Skip to contentSkip to conversation

Intel Wired LAN Driver Updates 2024-02-12 (ice)

GIT PULL New Tony Nguyen 2 participants 7 messages Feb 12, 2024 – Feb 15, 2024

Subsystems (3)
lore
Share & tools
lore

Tony Nguyen

author maintainer
#0 lore raw

This series contains updates to ice driver only.

Grzegorz adds support for E825-C devices.

Wojciech reworks devlink reload to fulfill expected conditions (remove and readd).

The following are changes since commit 0f37666d87d2dea42ec21776c3d562b7cbd71612:
Merge branch 'net-avoid-slow-rcu'
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 100GbE

Grzegorz Nitka (3):
ice: introduce new E825C devices family
ice: Add helper function ice_is_generic_mac
ice: add support for 3k signing DDP sections for E825C

Wojciech Drewek (2):
ice: Remove and readd netdev during devlink reload
ice: Fix debugfs with devlink reload

 drivers/net/ethernet/intel/ice/ice.h          |   3 +
 drivers/net/ethernet/intel/ice/ice_common.c   |  37 ++++
 drivers/net/ethernet/intel/ice/ice_common.h   |   2 +
 drivers/net/ethernet/intel/ice/ice_controlq.c |   2 +-
 drivers/net/ethernet/intel/ice/ice_ddp.c      |   4 +
 drivers/net/ethernet/intel/ice/ice_debugfs.c  |  10 +
 drivers/net/ethernet/intel/ice/ice_devids.h   |   8 +
 drivers/net/ethernet/intel/ice/ice_devlink.c  |  68 +++++-
 drivers/net/ethernet/intel/ice/ice_fwlog.c    |   2 +
 drivers/net/ethernet/intel/ice/ice_main.c     | 199 ++++++------------
 drivers/net/ethernet/intel/ice/ice_type.h     |   1 +
 11 files changed, 200 insertions(+), 136 deletions(-)
Signature · 1 line
2.41.0
author maintainer
#1 lore raw

PATCH 1/5 ice: introduce new E825C devices family

From: Grzegorz Nitka <[email protected]>

Introduce new Intel Ethernet E825C family devices. Add new PCI device IDs which are going to be supported by the driver:
- 579C: Intel(R) Ethernet Connection E825-C for backplane
- 579D: Intel(R) Ethernet Connection E825-C for QSFP
- 579E: Intel(R) Ethernet Connection E825-C for SFP
- 579F: Intel(R) Ethernet Connection E825-C for SGMII

Add helper function ice_is_e825c() to verify if the running device belongs to E825C family.

---
 drivers/net/ethernet/intel/ice/ice_common.c | 19 +++++++++++++++++++
 drivers/net/ethernet/intel/ice/ice_common.h |  1 +
 drivers/net/ethernet/intel/ice/ice_devids.h |  8 ++++++++
 drivers/net/ethernet/intel/ice/ice_main.c   |  4 ++++
 4 files changed, 32 insertions(+)
drivers/net/ethernet/intel/ice/ice_common.c +19 -0
index 10c32cd80fff..cc8c9f2b72f5 100644
@@ -240,6 +240,25 @@ bool ice_is_e823(struct ice_hw *hw)
 	}
 }
 
+/**
+ * ice_is_e825c - Check if a device is E825C family device
+ * @hw: pointer to the hardware structure
+ *
+ * Return: true if the device is E825-C based, false if not.
+ */
+bool ice_is_e825c(struct ice_hw *hw)
+{
+	switch (hw->device_id) {
+	case ICE_DEV_ID_E825C_BACKPLANE:
+	case ICE_DEV_ID_E825C_QSFP:
+	case ICE_DEV_ID_E825C_SFP:
+	case ICE_DEV_ID_E825C_SGMII:
+		return true;
+	default:
+		return false;
+	}
+}
+
 /**
  * ice_clear_pf_cfg - Clear PF configuration
  * @hw: pointer to the hardware structure
drivers/net/ethernet/intel/ice/ice_common.h +1 -0
index 3e933f75e948..42d45a73359c 100644
@@ -251,6 +251,7 @@ ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
 		  u64 *prev_stat, u64 *cur_stat);
 bool ice_is_e810t(struct ice_hw *hw);
 bool ice_is_e823(struct ice_hw *hw);
+bool ice_is_e825c(struct ice_hw *hw);
 int
 ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
 		     struct ice_aqc_txsched_elem_data *buf);
drivers/net/ethernet/intel/ice/ice_devids.h +8 -0
index a2d384dbfc76..9dfae9bce758 100644
@@ -71,5 +71,13 @@
 #define ICE_DEV_ID_E822L_10G_BASE_T	0x1899
 /* Intel(R) Ethernet Connection E822-L 1GbE */
 #define ICE_DEV_ID_E822L_SGMII		0x189A
+/* Intel(R) Ethernet Connection E825-C for backplane */
+#define ICE_DEV_ID_E825C_BACKPLANE	0x579c
+/* Intel(R) Ethernet Connection E825-C for QSFP */
+#define ICE_DEV_ID_E825C_QSFP		0x579d
+/* Intel(R) Ethernet Connection E825-C for SFP */
+#define ICE_DEV_ID_E825C_SFP		0x579e
+/* Intel(R) Ethernet Connection E825-C 1GbE */
+#define ICE_DEV_ID_E825C_SGMII		0x579f
 
 #endif /* _ICE_DEVIDS_H_ */
drivers/net/ethernet/intel/ice/ice_main.c +4 -0
index 2b7960824bc3..b3c24e40ccb6 100644
@@ -5752,6 +5752,10 @@ static const struct pci_device_id ice_pci_tbl[] = {
 	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_1GBE) },
 	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E823L_QSFP) },
 	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E822_SI_DFLT) },
+	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_BACKPLANE), },
+	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_QSFP), },
+	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_SFP), },
+	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E825C_SGMII), },
 	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_BACKPLANE) },
 	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_QSFP56) },
 	{ PCI_VDEVICE(INTEL, ICE_DEV_ID_E830_SFP) },
Signature · 1 line
2.41.0
author maintainer
#2 lore raw

PATCH 2/5 ice: Add helper function ice_is_generic_mac

In reply to Tony Nguyen

From: Grzegorz Nitka <[email protected]>

E800 series devices have a couple of quirks:
1. Sideband control queues are not supported
2. The registers that the driver needs to program for the "Precision Time Protocol (PTP)" feature are different for E800 series devices compared to other devices supported by this driver.

Both these require conditional logic based on the underlying device we are dealing with.

The function ice_is_sbq_supported added by commit 8f5ee3c477a8 ("ice: add support for sideband messages") addresses (1). The same function can be used to address (2) as well
but this just looks weird readability wise in cases that have nothing to do with sideband control queues:

	if (ice_is_sbq_supported(hw))
		/* program register A */
	else
		/* program register B */

For these cases, the function ice_is_generic_mac introduced by this patch communicates the idea/intention better. Also rework ice_is_sbq_supported to use this new function.
As side-band queue is supported for E825C devices, it's mac_type is considered as generic mac_type.

---
 drivers/net/ethernet/intel/ice/ice_common.c   | 12 ++++++++++++
 drivers/net/ethernet/intel/ice/ice_common.h   |  1 +
 drivers/net/ethernet/intel/ice/ice_controlq.c |  2 +-
 drivers/net/ethernet/intel/ice/ice_main.c     |  6 ++++--
 drivers/net/ethernet/intel/ice/ice_type.h     |  1 +
 5 files changed, 19 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +12 -0
index cc8c9f2b72f5..a7e6e5c1d06e 100644
@@ -169,6 +169,18 @@ static int ice_set_mac_type(struct ice_hw *hw)
 	return 0;
 }
 
+/**
+ * ice_is_generic_mac - check if device's mac_type is generic
+ * @hw: pointer to the hardware structure
+ *
+ * Return: true if mac_type is generic (with SBQ support), false if not
+ */
+bool ice_is_generic_mac(struct ice_hw *hw)
+{
+	return (hw->mac_type == ICE_MAC_GENERIC ||
+		hw->mac_type == ICE_MAC_GENERIC_3K_E825);
+}
+
 /**
  * ice_is_e810
  * @hw: pointer to the hardware structure
drivers/net/ethernet/intel/ice/ice_common.h +1 -0
index 42d45a73359c..32fd10de620c 100644
@@ -112,6 +112,7 @@ ice_update_phy_type(u64 *phy_type_low, u64 *phy_type_high,
 int
 ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags,
 			struct ice_sq_cd *cd);
+bool ice_is_generic_mac(struct ice_hw *hw);
 bool ice_is_e810(struct ice_hw *hw);
 int ice_clear_pf_cfg(struct ice_hw *hw);
 int
drivers/net/ethernet/intel/ice/ice_controlq.c +1 -1
index e7d2474c431c..ffe660f34992 100644
@@ -666,7 +666,7 @@ bool ice_is_sbq_supported(struct ice_hw *hw)
 	/* The device sideband queue is only supported on devices with the
 	 * generic MAC type.
 	 */
-	return hw->mac_type == ICE_MAC_GENERIC;
+	return ice_is_generic_mac(hw);
 }
 
 /**
drivers/net/ethernet/intel/ice/ice_main.c +4 -2
index b3c24e40ccb6..1fa3f40743f5 100644
@@ -1649,8 +1649,10 @@ static void ice_clean_sbq_subtask(struct ice_pf *pf)
 {
 	struct ice_hw *hw = &pf->hw;
 
-	/* Nothing to do here if sideband queue is not supported */
-	if (!ice_is_sbq_supported(hw)) {
+	/* if mac_type is not generic, sideband is not supported
+	 * and there's nothing to do here
+	 */
+	if (!ice_is_generic_mac(hw)) {
 		clear_bit(ICE_SIDEBANDQ_EVENT_PENDING, pf->state);
 		return;
 	}
drivers/net/ethernet/intel/ice/ice_type.h +1 -0
index a508e917ce5f..9ff92dba5823 100644
@@ -132,6 +132,7 @@ enum ice_mac_type {
 	ICE_MAC_E810,
 	ICE_MAC_E830,
 	ICE_MAC_GENERIC,
+	ICE_MAC_GENERIC_3K_E825,
 };
 
 /* Media Types */
Signature · 1 line
2.41.0
author maintainer
#3 lore raw

PATCH 3/5 ice: add support for 3k signing DDP sections for E825C

In reply to Tony Nguyen

From: Grzegorz Nitka <[email protected]>

E825C devices shall support the new signing type of RSA 3K for new DDP section (SEGMENT_SIGN_TYPE_RSA3K_E825 (5) - already in the code). The driver is responsible to verify the presence of correct signing type. Add 3k signinig support for E825C devices based on mac_type:
ICE_MAC_GENERIC_3K_E825;

---
 drivers/net/ethernet/intel/ice/ice_common.c | 6 ++++++
 drivers/net/ethernet/intel/ice/ice_ddp.c    | 4 ++++
 2 files changed, 10 insertions(+)
drivers/net/ethernet/intel/ice/ice_common.c +6 -0
index a7e6e5c1d06e..9266f25a9978 100644
@@ -154,6 +154,12 @@ static int ice_set_mac_type(struct ice_hw *hw)
 	case ICE_DEV_ID_E823L_SFP:
 		hw->mac_type = ICE_MAC_GENERIC;
 		break;
+	case ICE_DEV_ID_E825C_BACKPLANE:
+	case ICE_DEV_ID_E825C_QSFP:
+	case ICE_DEV_ID_E825C_SFP:
+	case ICE_DEV_ID_E825C_SGMII:
+		hw->mac_type = ICE_MAC_GENERIC_3K_E825;
+		break;
 	case ICE_DEV_ID_E830_BACKPLANE:
 	case ICE_DEV_ID_E830_QSFP56:
 	case ICE_DEV_ID_E830_SFP:
drivers/net/ethernet/intel/ice/ice_ddp.c +4 -0
index 8b7504a9df31..7532d11ad7f3 100644
@@ -1825,6 +1825,7 @@ static u32 ice_get_pkg_segment_id(enum ice_mac_type mac_type)
 		seg_id = SEGMENT_TYPE_ICE_E830;
 		break;
 	case ICE_MAC_GENERIC:
+	case ICE_MAC_GENERIC_3K_E825:
 	default:
 		seg_id = SEGMENT_TYPE_ICE_E810;
 		break;
@@ -1845,6 +1846,9 @@ static u32 ice_get_pkg_sign_type(enum ice_mac_type mac_type)
 	case ICE_MAC_E830:
 		sign_type = SEGMENT_SIGN_TYPE_RSA3K_SBB;
 		break;
+	case ICE_MAC_GENERIC_3K_E825:
+		sign_type = SEGMENT_SIGN_TYPE_RSA3K_E825;
+		break;
 	case ICE_MAC_GENERIC:
 	default:
 		sign_type = SEGMENT_SIGN_TYPE_RSA2K;
Signature · 1 line
2.41.0
author maintainer
#4 lore raw

PATCH 4/5 ice: Remove and readd netdev during devlink reload

In reply to Tony Nguyen

From: Wojciech Drewek <[email protected]>

Recent changes to the devlink reload (commit 9b2348e2d6c9 ("devlink: warn about existing entities during reload-reinit")) force the drivers to destroy devlink ports during reinit. Adjust ice driver to this requirement, unregister netdvice, destroy devlink port. ice_init_eth() was removed and all the common code between probe and reload was moved to ice_load().

During devlink reload we can't take devl_lock (it's already taken) and in ice_probe() we have to lock it. Use devl_* variant of the API which does not acquire and release devl_lock. Guard ice_load() with devl_lock only in case of probe.

---
 drivers/net/ethernet/intel/ice/ice.h         |   2 +
 drivers/net/ethernet/intel/ice/ice_devlink.c |  68 ++++++-
 drivers/net/ethernet/intel/ice/ice_main.c    | 186 ++++++-------------
 3 files changed, 125 insertions(+), 131 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +2 -0
index a4ba60e17d0b..118e84835720 100644
@@ -983,6 +983,8 @@ void ice_service_task_schedule(struct ice_pf *pf);
 int ice_load(struct ice_pf *pf);
 void ice_unload(struct ice_pf *pf);
 void ice_adv_lnk_speed_maps_init(void);
+int ice_init_dev(struct ice_pf *pf);
+void ice_deinit_dev(struct ice_pf *pf);
 
 /**
  * ice_set_rdma_cap - enable RDMA support
drivers/net/ethernet/intel/ice/ice_devlink.c +62 -6

120 lines not on this page · raw message

drivers/net/ethernet/intel/ice/ice_main.c +61 -125

264 lines not on this page · raw message

Signature · 1 line
2.41.0
author maintainer
#5 lore raw

PATCH 5/5 ice: Fix debugfs with devlink reload

In reply to Tony Nguyen

From: Wojciech Drewek <[email protected]>

During devlink reload it is needed to remove debugfs entries correlated with only one PF. ice_debugfs_exit() removes all entries created by ice driver so we can't use it.

Introduce ice_debugfs_pf_deinit() in order to release PF's debugfs entries. Move ice_debugfs_exit() call to ice_module_exit(), it makes more sense since ice_debugfs_init() is called in ice_module_init() and not in ice_probe().

---
 drivers/net/ethernet/intel/ice/ice.h         |  1 +
 drivers/net/ethernet/intel/ice/ice_debugfs.c | 10 ++++++++++
 drivers/net/ethernet/intel/ice/ice_fwlog.c   |  2 ++
 drivers/net/ethernet/intel/ice/ice_main.c    |  3 +--
 4 files changed, 14 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +1 -0
index 118e84835720..365c03d1c462 100644
@@ -896,6 +896,7 @@ static inline bool ice_is_adq_active(struct ice_pf *pf)
 }
 
 void ice_debugfs_fwlog_init(struct ice_pf *pf);
+void ice_debugfs_pf_deinit(struct ice_pf *pf);
 void ice_debugfs_init(void);
 void ice_debugfs_exit(void);
 void ice_pf_fwlog_update_module(struct ice_pf *pf, int log_level, int module);
drivers/net/ethernet/intel/ice/ice_debugfs.c +10 -0
index 85aa31dd86b1..d252d98218d0 100644
@@ -644,6 +644,16 @@ void ice_debugfs_fwlog_init(struct ice_pf *pf)
 	kfree(fw_modules);
 }
 
+/**
+ * ice_debugfs_pf_deinit - cleanup PF's debugfs
+ * @pf: pointer to the PF struct
+ */
+void ice_debugfs_pf_deinit(struct ice_pf *pf)
+{
+	debugfs_remove_recursive(pf->ice_debugfs_pf);
+	pf->ice_debugfs_pf = NULL;
+}
+
 /**
  * ice_debugfs_init - create root directory for debugfs entries
  */
drivers/net/ethernet/intel/ice/ice_fwlog.c +2 -0
index 92b5dac481cd..4fd15387a7e5 100644
@@ -188,6 +188,8 @@ void ice_fwlog_deinit(struct ice_hw *hw)
 	if (hw->bus.func)
 		return;
 
+	ice_debugfs_pf_deinit(hw->back);
+
 	/* make sure FW logging is disabled to not put the FW in a weird state
 	 * for the next driver load
 	 */
drivers/net/ethernet/intel/ice/ice_main.c +1 -2
index 85a996ad2c1f..9c2c8637b4a7 100644
@@ -5276,8 +5276,6 @@ static void ice_remove(struct pci_dev *pdev)
 		msleep(100);
 	}
 
-	ice_debugfs_exit();
-
 	if (test_bit(ICE_FLAG_SRIOV_ENA, pf->flags)) {
 		set_bit(ICE_VF_RESETS_DISABLED, pf->state);
 		ice_free_vfs(pf);
@@ -5783,6 +5781,7 @@ module_init(ice_module_init);
 static void __exit ice_module_exit(void)
 {
 	pci_unregister_driver(&ice_driver);
+	ice_debugfs_exit();
 	destroy_workqueue(ice_wq);
 	destroy_workqueue(ice_lag_wq);
 	pr_info("module unloaded\n");
Signature · 1 line
2.41.0
maintainer
#6 lore raw
In reply to Tony Nguyen
Quoted 6 lines · On Mon, 12 Feb 2024 13:11:54 -0800 Tony Nguyen wrote:

This series contains updates to ice driver only.

Grzegorz adds support for E825-C devices.

Wojciech reworks devlink reload to fulfill expected conditions (remove and readd).

Looks like this got (silently) applied, thanks!