Skip to content

Commit c243543

Browse files
committed
Merge: [Intel 9.6 FEAT] e1000e: Driver Update
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5835 JIRA: https://issues.redhat.com/browse/RHEL-49812 Commits: ``` 4c39e76 ("e1000e: Use PCI_EXP_LNKSTA_NLW & FIELD_GET() instead of custom defines/code") bf88f7d ("e1000e: Use pcie_capability_read_word() for reading LNKSTA") 236f31b ("e1000e: make lost bits explicit") 4d893c1 ("intel: legacy: field prep conversion") b9a4525 ("intel: legacy: field get conversion") f1f6a6b ("e1000e: correct maximum frequency adjustment values") 662200e ("e1000e: Minor flow correction in e1000_shutdown function") ba54b1a ("intel: legacy: Partial revert of field get conversion") 6dbdd4d ("e1000e: Workaround for sporadic MDI error on Meteor Lake systems") 861e808 ("e1000e: move force SMBUS from enable ulp function to avoid PHY loss issue") 75a3f93 ("net: intel: implement modern PM ops declarations") b2c2894 ("e1000e: Remove redundant runtime resume for ethtool_ops") 387f295 ("e1000e: change usleep_range to udelay in PHY mdic access") 6918107 ("net: e1000e & ixgbe: Remove PCI_HEADER_TYPE_MFD duplicates") bfd546a ("e1000e: move force SMBUS near the end of enable_ulp function") a2fe35d ("net: intel: Use *-y instead of *-objs in Makefile") c93a6f6 ("e1000e: Fix S0ix residency on corporate systems") 76a0a3f ("e1000e: fix force smbus during suspend flow") bf130ed ("net: intel: Remove MODULE_AUTHORs") 0a6ad4d ("e1000e: avoid failing the system during pm_suspend") 9d9e534 ("e1000e: change I219 (19) devices to ADP") b847372 ("e1000e: Remove Meteor Lake SMBUS workarounds") ``` Signed-off-by: Ivan Vecera <[email protected]> Approved-by: José Ignacio Tornos Martínez <[email protected]> Approved-by: Kamal Heib <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Rado Vrbovsky <[email protected]>
2 parents 69d3ac1 + 32d0895 commit c243543

File tree

13 files changed

+363
-303
lines changed

13 files changed

+363
-303
lines changed

drivers/net/ethernet/intel/e1000e/80003es2lan.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)
9292

9393
nvm->type = e1000_nvm_eeprom_spi;
9494

95-
size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
96-
E1000_EECD_SIZE_EX_SHIFT);
95+
size = (u16)FIELD_GET(E1000_EECD_SIZE_EX_MASK, eecd);
9796

9897
/* Added to a constant, "size" becomes the left-shift value
9998
* for setting word_size.
@@ -1035,17 +1034,18 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw)
10351034
* iteration and increase the max iterations when
10361035
* polling the phy; this fixes erroneous timeouts at 10Mbps.
10371036
*/
1038-
ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4),
1039-
0xFFFF);
1037+
/* these next three accesses were always meant to use page 0x34 using
1038+
* GG82563_REG(0x34, N) but never did, so we've just corrected the call
1039+
* to not drop bits
1040+
*/
1041+
ret_val = e1000_write_kmrn_reg_80003es2lan(hw, 4, 0xFFFF);
10401042
if (ret_val)
10411043
return ret_val;
1042-
ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
1043-
&reg_data);
1044+
ret_val = e1000_read_kmrn_reg_80003es2lan(hw, 9, &reg_data);
10441045
if (ret_val)
10451046
return ret_val;
10461047
reg_data |= 0x3F;
1047-
ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
1048-
reg_data);
1048+
ret_val = e1000_write_kmrn_reg_80003es2lan(hw, 9, reg_data);
10491049
if (ret_val)
10501050
return ret_val;
10511051
ret_val =
@@ -1209,8 +1209,8 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
12091209
if (ret_val)
12101210
return ret_val;
12111211

1212-
kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1213-
E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
1212+
kmrnctrlsta = FIELD_PREP(E1000_KMRNCTRLSTA_OFFSET, offset) |
1213+
E1000_KMRNCTRLSTA_REN;
12141214
ew32(KMRNCTRLSTA, kmrnctrlsta);
12151215
e1e_flush();
12161216

@@ -1244,8 +1244,7 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
12441244
if (ret_val)
12451245
return ret_val;
12461246

1247-
kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
1248-
E1000_KMRNCTRLSTA_OFFSET) | data;
1247+
kmrnctrlsta = FIELD_PREP(E1000_KMRNCTRLSTA_OFFSET, offset) | data;
12491248
ew32(KMRNCTRLSTA, kmrnctrlsta);
12501249
e1e_flush();
12511250

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
157157
fallthrough;
158158
default:
159159
nvm->type = e1000_nvm_eeprom_spi;
160-
size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
161-
E1000_EECD_SIZE_EX_SHIFT);
160+
size = (u16)FIELD_GET(E1000_EECD_SIZE_EX_MASK, eecd);
162161
/* Added to a constant, "size" becomes the left-shift value
163162
* for setting word_size.
164163
*/

drivers/net/ethernet/intel/e1000e/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ subdir-ccflags-y += -I$(src)
1010

1111
obj-$(CONFIG_E1000E) += e1000e.o
1212

13-
e1000e-objs := 82571.o ich8lan.o 80003es2lan.o \
14-
mac.o manage.o nvm.o phy.o \
15-
param.o ethtool.o netdev.o ptp.o
16-
13+
e1000e-y := 82571.o ich8lan.o 80003es2lan.o \
14+
mac.o manage.o nvm.o phy.o \
15+
param.o ethtool.o netdev.o ptp.o

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,6 @@
678678

679679
/* PCI/PCI-X/PCI-EX Config space */
680680
#define PCI_HEADER_TYPE_REGISTER 0x0E
681-
#define PCIE_LINK_STATUS 0x12
682-
683-
#define PCI_HEADER_TYPE_MULTIFUNC 0x80
684-
#define PCIE_LINK_WIDTH_MASK 0x3F0
685-
#define PCIE_LINK_WIDTH_SHIFT 4
686681

687682
#define PHY_REVISION_MASK 0xFFFFFFF0
688683
#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,23 +360,43 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);
360360
* As a result, a shift of INCVALUE_SHIFT_n is used to fit a value of
361361
* INCVALUE_n into the TIMINCA register allowing 32+8+(24-INCVALUE_SHIFT_n)
362362
* bits to count nanoseconds leaving the rest for fractional nonseconds.
363+
*
364+
* Any given INCVALUE also has an associated maximum adjustment value. This
365+
* maximum adjustment value is the largest increase (or decrease) which can be
366+
* safely applied without overflowing the INCVALUE. Since INCVALUE has
367+
* a maximum range of 24 bits, its largest value is 0xFFFFFF.
368+
*
369+
* To understand where the maximum value comes from, consider the following
370+
* equation:
371+
*
372+
* new_incval = base_incval + (base_incval * adjustment) / 1billion
373+
*
374+
* To avoid overflow that means:
375+
* max_incval = base_incval + (base_incval * max_adj) / billion
376+
*
377+
* Re-arranging:
378+
* max_adj = floor(((max_incval - base_incval) * 1billion) / 1billion)
363379
*/
364380
#define INCVALUE_96MHZ 125
365381
#define INCVALUE_SHIFT_96MHZ 17
366382
#define INCPERIOD_SHIFT_96MHZ 2
367383
#define INCPERIOD_96MHZ (12 >> INCPERIOD_SHIFT_96MHZ)
384+
#define MAX_PPB_96MHZ 23999900 /* 23,999,900 ppb */
368385

369386
#define INCVALUE_25MHZ 40
370387
#define INCVALUE_SHIFT_25MHZ 18
371388
#define INCPERIOD_25MHZ 1
389+
#define MAX_PPB_25MHZ 599999900 /* 599,999,900 ppb */
372390

373391
#define INCVALUE_24MHZ 125
374392
#define INCVALUE_SHIFT_24MHZ 14
375393
#define INCPERIOD_24MHZ 3
394+
#define MAX_PPB_24MHZ 999999999 /* 999,999,999 ppb */
376395

377396
#define INCVALUE_38400KHZ 26
378397
#define INCVALUE_SHIFT_38400KHZ 19
379398
#define INCPERIOD_38400KHZ 1
399+
#define MAX_PPB_38400KHZ 230769100 /* 230,769,100 ppb */
380400

381401
/* Another drawback of scaling the incvalue by a large factor is the
382402
* 64-bit SYSTIM register overflows more quickly. This is dealt with

0 commit comments

Comments
 (0)