Skip to content

Commit 8421250

Browse files
Sasha Neftingregkh
authored andcommitted
e1000e: Fix the max snoop/no-snoop latency for 10M
[ Upstream commit 44a13a5d99c71bf9e1676d9e51679daf4d7b3d73 ] We should decode the latency and the max_latency before directly compare. The latency should be presented as lat_enc = scale x value: lat_enc_d = (lat_enc & 0x0x3ff) x (1U << (5*((max_ltr_enc & 0x1c00) >> 10))) Fixes: cf8fb73 ("e1000e: add support for LTR on I217/I218") Suggested-by: Yee Li <seven.yi.lee@gmail.com> Signed-off-by: Sasha Neftin <sasha.neftin@intel.com> Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent fc5d2ff commit 8421250

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

drivers/net/ethernet/intel/e1000e/ich8lan.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
10101010
{
10111011
u32 reg = link << (E1000_LTRV_REQ_SHIFT + E1000_LTRV_NOSNOOP_SHIFT) |
10121012
link << E1000_LTRV_REQ_SHIFT | E1000_LTRV_SEND;
1013+
u16 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */
1014+
u16 lat_enc_d = 0; /* latency decoded */
10131015
u16 lat_enc = 0; /* latency encoded */
10141016

10151017
if (link) {
@@ -1063,7 +1065,17 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
10631065
E1000_PCI_LTR_CAP_LPT + 2, &max_nosnoop);
10641066
max_ltr_enc = max_t(u16, max_snoop, max_nosnoop);
10651067

1066-
if (lat_enc > max_ltr_enc)
1068+
lat_enc_d = (lat_enc & E1000_LTRV_VALUE_MASK) *
1069+
(1U << (E1000_LTRV_SCALE_FACTOR *
1070+
((lat_enc & E1000_LTRV_SCALE_MASK)
1071+
>> E1000_LTRV_SCALE_SHIFT)));
1072+
1073+
max_ltr_enc_d = (max_ltr_enc & E1000_LTRV_VALUE_MASK) *
1074+
(1U << (E1000_LTRV_SCALE_FACTOR *
1075+
((max_ltr_enc & E1000_LTRV_SCALE_MASK)
1076+
>> E1000_LTRV_SCALE_SHIFT)));
1077+
1078+
if (lat_enc_d > max_ltr_enc_d)
10671079
lat_enc = max_ltr_enc;
10681080
}
10691081

drivers/net/ethernet/intel/e1000e/ich8lan.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,11 @@
291291

292292
/* Latency Tolerance Reporting */
293293
#define E1000_LTRV 0x000F8
294+
#define E1000_LTRV_VALUE_MASK 0x000003FF
294295
#define E1000_LTRV_SCALE_MAX 5
295296
#define E1000_LTRV_SCALE_FACTOR 5
297+
#define E1000_LTRV_SCALE_SHIFT 10
298+
#define E1000_LTRV_SCALE_MASK 0x00001C00
296299
#define E1000_LTRV_REQ_SHIFT 15
297300
#define E1000_LTRV_NOSNOOP_SHIFT 16
298301
#define E1000_LTRV_SEND (1 << 30)

0 commit comments

Comments
 (0)