Skip to content

Commit e8dc17a

Browse files
committed
Merge: igc: Driver Update
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1063 ade6fde igc: remove autoneg parameter from igc_mac_info b37dba8 igc: Remove unused igc_acquire/release_nvm 121c3c6 igc: Remove unused igc_read/write_pci_cfg wrappers c758890 igc: Remove unused igc_read/write_pcie_cap_reg bd2776e igc: return early when failing to read EECD register 484d367 igc: Allow hot-swapping XDP program 8b6237e igc: Fix passing 0 to ERR_PTR in igc_xdp_run_prog() 1a63399 igc: Link IRQs to NAPI instances b659698 igc: Link queues to NAPI instances be324b7 igc: Avoid unnecessary link down event in XDP_SETUP_PROG process 7822dd4 igc: Fix HW RX timestamp when passed by ZC XDP 63f20f0 igc: Set buffer type for empty frames in igc_init_empty_frame dddeeaa igc: Fix XSK queue NAPI ID mapping 8fa7292 treewide: Switch/rename to timer_delete[_sync]() 8e404ad igc: fix PTM cycle trigger logic 714cd03 igc: increase wait time before retrying PTM cd7f732 igc: move ktime snapshot into PTM retry loop 26a3910 igc: handle the IGC_PTP_ENABLED flag correctly 1f02575 igc: cleanup PTP module if probe fails 1a931c4 igc: add lock preventing multiple simultaneous PTM transactions f9c961e igc: enable HW vlan tag insertion/stripping by default 19d6290 igc: rename xdp_get_tx_ring() for non-xdp usage 67287d6 igc: rename I225_RXPBSIZE_DEFAULT and I225_TXPBSIZE_DEFAULT 425d8d9 igc: use FIELD_PREP and GENMASK for existing TX packet buffer size 0d58cdc igc: optimize TX packet buffer utilization for TSN mode 9cd87aa igc: use FIELD_PREP and GENMASK for existing RX packet buffer size 7663370 igc: set the RX packet buffer size for TSN mode c7d6cb9 igc: fix lock order in igc_ptp_reset JIRA: https://issues.redhat.com/browse/RHEL-83571 Signed-off-by: Corinna Vinschen <[email protected]> Approved-by: Michal Schmidt <[email protected]> Approved-by: Kamal Heib <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Julio Faracco <[email protected]>
2 parents f124c2d + afb2ab4 commit e8dc17a

File tree

14 files changed

+422
-384
lines changed

14 files changed

+422
-384
lines changed

drivers/net/ethernet/intel/igc/igc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ struct igc_adapter {
319319
struct timespec64 prev_ptp_time; /* Pre-reset PTP clock */
320320
ktime_t ptp_reset_start; /* Reset time in clock mono */
321321
struct system_time_snapshot snapshot;
322+
struct mutex ptm_lock; /* Only allow one PTM transaction at a time */
322323

323324
char fw_version[32];
324325

@@ -734,7 +735,7 @@ struct igc_nfc_rule *igc_get_nfc_rule(struct igc_adapter *adapter,
734735
u32 location);
735736
int igc_add_nfc_rule(struct igc_adapter *adapter, struct igc_nfc_rule *rule);
736737
void igc_del_nfc_rule(struct igc_adapter *adapter, struct igc_nfc_rule *rule);
737-
738+
struct igc_ring *igc_get_tx_ring(struct igc_adapter *adapter, int cpu);
738739
void igc_ptp_init(struct igc_adapter *adapter);
739740
void igc_ptp_reset(struct igc_adapter *adapter);
740741
void igc_ptp_suspend(struct igc_adapter *adapter);

drivers/net/ethernet/intel/igc/igc_base.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ static s32 igc_init_nvm_params_base(struct igc_hw *hw)
6868
u32 eecd = rd32(IGC_EECD);
6969
u16 size;
7070

71+
/* failed to read reg and got all F's */
72+
if (!(~eecd))
73+
return -ENXIO;
74+
7175
size = FIELD_GET(IGC_EECD_SIZE_EX_MASK, eecd);
7276

7377
/* Added to a constant, "size" becomes the left-shift value
@@ -221,6 +225,8 @@ static s32 igc_get_invariants_base(struct igc_hw *hw)
221225

222226
/* NVM initialization */
223227
ret_val = igc_init_nvm_params_base(hw);
228+
if (ret_val)
229+
goto out;
224230
switch (hw->mac.type) {
225231
case igc_i225:
226232
ret_val = igc_init_nvm_params_i225(hw);

drivers/net/ethernet/intel/igc/igc_defines.h

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,47 @@
396396
#define IGC_RCTL_PMCF 0x00800000 /* pass MAC control frames */
397397
#define IGC_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */
398398

399-
#define I225_RXPBSIZE_DEFAULT 0x000000A2 /* RXPBSIZE default */
400-
#define I225_TXPBSIZE_DEFAULT 0x04000014 /* TXPBSIZE default */
401-
#define IGC_RXPBS_CFG_TS_EN 0x80000000 /* Timestamp in Rx buffer */
402-
403-
#define IGC_TXPBSIZE_TSN 0x04145145 /* 5k bytes buffer for each queue */
399+
/* Mask for RX packet buffer size */
400+
#define IGC_RXPBSIZE_EXP_MASK GENMASK(5, 0)
401+
#define IGC_BMC2OSPBSIZE_MASK GENMASK(11, 6)
402+
#define IGC_RXPBSIZE_BE_MASK GENMASK(17, 12)
403+
/* Mask for timestamp in RX buffer */
404+
#define IGC_RXPBS_CFG_TS_EN_MASK GENMASK(31, 31)
405+
/* High-priority RX packet buffer size (KB). Used for Express traffic when preemption is enabled */
406+
#define IGC_RXPBSIZE_EXP(x) FIELD_PREP(IGC_RXPBSIZE_EXP_MASK, (x))
407+
/* BMC to OS packet buffer size in KB */
408+
#define IGC_BMC2OSPBSIZE(x) FIELD_PREP(IGC_BMC2OSPBSIZE_MASK, (x))
409+
/* Low-priority RX packet buffer size (KB). Used for BE traffic when preemption is enabled */
410+
#define IGC_RXPBSIZE_BE(x) FIELD_PREP(IGC_RXPBSIZE_BE_MASK, (x))
411+
/* Enable RX packet buffer for timestamp descriptor, saving 16 bytes per packet if set */
412+
#define IGC_RXPBS_CFG_TS_EN FIELD_PREP(IGC_RXPBS_CFG_TS_EN_MASK, 1)
413+
/* Default value following I225/I226 SW User Manual Section 8.3.1 */
414+
#define IGC_RXPBSIZE_EXP_BMC_DEFAULT ( \
415+
IGC_RXPBSIZE_EXP(34) | IGC_BMC2OSPBSIZE(2))
416+
#define IGC_RXPBSIZE_EXP_BMC_BE_TSN ( \
417+
IGC_RXPBSIZE_EXP(15) | IGC_BMC2OSPBSIZE(2) | IGC_RXPBSIZE_BE(15))
418+
419+
/* Mask for TX packet buffer size */
420+
#define IGC_TXPB0SIZE_MASK GENMASK(5, 0)
421+
#define IGC_TXPB1SIZE_MASK GENMASK(11, 6)
422+
#define IGC_TXPB2SIZE_MASK GENMASK(17, 12)
423+
#define IGC_TXPB3SIZE_MASK GENMASK(23, 18)
424+
/* Mask for OS to BMC packet buffer size */
425+
#define IGC_OS2BMCPBSIZE_MASK GENMASK(29, 24)
426+
/* TX Packet buffer size in KB */
427+
#define IGC_TXPB0SIZE(x) FIELD_PREP(IGC_TXPB0SIZE_MASK, (x))
428+
#define IGC_TXPB1SIZE(x) FIELD_PREP(IGC_TXPB1SIZE_MASK, (x))
429+
#define IGC_TXPB2SIZE(x) FIELD_PREP(IGC_TXPB2SIZE_MASK, (x))
430+
#define IGC_TXPB3SIZE(x) FIELD_PREP(IGC_TXPB3SIZE_MASK, (x))
431+
/* OS to BMC packet buffer size in KB */
432+
#define IGC_OS2BMCPBSIZE(x) FIELD_PREP(IGC_OS2BMCPBSIZE_MASK, (x))
433+
/* Default value following I225/I226 SW User Manual Section 8.3.2 */
434+
#define IGC_TXPBSIZE_DEFAULT ( \
435+
IGC_TXPB0SIZE(20) | IGC_TXPB1SIZE(0) | IGC_TXPB2SIZE(0) | \
436+
IGC_TXPB3SIZE(0) | IGC_OS2BMCPBSIZE(4))
437+
#define IGC_TXPBSIZE_TSN ( \
438+
IGC_TXPB0SIZE(7) | IGC_TXPB1SIZE(7) | IGC_TXPB2SIZE(7) | \
439+
IGC_TXPB3SIZE(7) | IGC_OS2BMCPBSIZE(4))
404440

405441
#define IGC_DTXMXPKTSZ_TSN 0x19 /* 1600 bytes of max TX DMA packet size */
406442
#define IGC_DTXMXPKTSZ_DEFAULT 0x98 /* 9728-byte Jumbo frames */
@@ -574,7 +610,10 @@
574610
#define IGC_PTM_CTRL_SHRT_CYC(usec) (((usec) & 0x3f) << 2)
575611
#define IGC_PTM_CTRL_PTM_TO(usec) (((usec) & 0xff) << 8)
576612

577-
#define IGC_PTM_SHORT_CYC_DEFAULT 1 /* Default short cycle interval */
613+
/* A short cycle time of 1us theoretically should work, but appears to be too
614+
* short in practice.
615+
*/
616+
#define IGC_PTM_SHORT_CYC_DEFAULT 4 /* Default short cycle interval */
578617
#define IGC_PTM_CYC_TIME_DEFAULT 5 /* Default PTM cycle time */
579618
#define IGC_PTM_TIMEOUT_DEFAULT 255 /* Default timeout for PTM errors */
580619

@@ -593,6 +632,7 @@
593632
#define IGC_PTM_STAT_T4M1_OVFL BIT(3) /* T4 minus T1 overflow */
594633
#define IGC_PTM_STAT_ADJUST_1ST BIT(4) /* 1588 timer adjusted during 1st PTM cycle */
595634
#define IGC_PTM_STAT_ADJUST_CYC BIT(5) /* 1588 timer adjusted during non-1st PTM cycle */
635+
#define IGC_PTM_STAT_ALL GENMASK(5, 0) /* Used to clear all status */
596636

597637
/* PCIe PTM Cycle Control */
598638
#define IGC_PTM_CYCLE_CTRL_CYC_TIME(msec) ((msec) & 0x3ff) /* PTM Cycle Time (msec) */

drivers/net/ethernet/intel/igc/igc_diag.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ bool igc_link_test(struct igc_adapter *adapter, u64 *data)
173173
*data = 0;
174174

175175
/* add delay to give enough time for autonegotioation to finish */
176-
if (adapter->hw.mac.autoneg)
177-
ssleep(5);
176+
ssleep(5);
178177

179178
link_up = igc_has_link(adapter);
180179
if (!link_up) {

drivers/net/ethernet/intel/igc/igc_ethtool.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,11 +1821,8 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev,
18211821
ethtool_link_ksettings_add_link_mode(cmd, advertising, 2500baseT_Full);
18221822

18231823
/* set autoneg settings */
1824-
if (hw->mac.autoneg == 1) {
1825-
ethtool_link_ksettings_add_link_mode(cmd, supported, Autoneg);
1826-
ethtool_link_ksettings_add_link_mode(cmd, advertising,
1827-
Autoneg);
1828-
}
1824+
ethtool_link_ksettings_add_link_mode(cmd, supported, Autoneg);
1825+
ethtool_link_ksettings_add_link_mode(cmd, advertising, Autoneg);
18291826

18301827
/* Set pause flow control settings */
18311828
ethtool_link_ksettings_add_link_mode(cmd, supported, Pause);
@@ -1878,10 +1875,7 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev,
18781875
cmd->base.duplex = DUPLEX_UNKNOWN;
18791876
}
18801877
cmd->base.speed = speed;
1881-
if (hw->mac.autoneg)
1882-
cmd->base.autoneg = AUTONEG_ENABLE;
1883-
else
1884-
cmd->base.autoneg = AUTONEG_DISABLE;
1878+
cmd->base.autoneg = AUTONEG_ENABLE;
18851879

18861880
/* MDI-X => 2; MDI =>1; Invalid =>0 */
18871881
if (hw->phy.media_type == igc_media_type_copper)
@@ -1955,7 +1949,6 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev,
19551949
advertised |= ADVERTISE_10_HALF;
19561950

19571951
if (cmd->base.autoneg == AUTONEG_ENABLE) {
1958-
hw->mac.autoneg = 1;
19591952
hw->phy.autoneg_advertised = advertised;
19601953
if (adapter->fc_autoneg)
19611954
hw->fc.requested_mode = igc_fc_default;

drivers/net/ethernet/intel/igc/igc_hw.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ struct igc_mac_info {
9292
bool asf_firmware_present;
9393
bool arc_subsystem_valid;
9494

95-
bool autoneg;
9695
bool autoneg_failed;
9796
bool get_link_status;
9897
};
@@ -280,9 +279,4 @@ struct net_device *igc_get_hw_dev(struct igc_hw *hw);
280279
#define hw_dbg(format, arg...) \
281280
netdev_dbg(igc_get_hw_dev(hw), format, ##arg)
282281

283-
s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value);
284-
s32 igc_write_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value);
285-
void igc_read_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value);
286-
void igc_write_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value);
287-
288282
#endif /* _IGC_HW_H_ */

0 commit comments

Comments
 (0)