netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e)
@ 2024-10-08 23:00 Tony Nguyen
  2024-10-08 23:00 ` [PATCH net 1/7] ice: Fix entering Safe Mode Tony Nguyen
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Tony Nguyen @ 2024-10-08 23:00 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev; +Cc: Tony Nguyen

This series contains updates to ice, i40e, igb, and e1000e drivers.

For ice:

Marcin allows driver to load, into safe mode, when DDP package is
missing or corrupted and adjusts the netif_is_ice() check to
account for when the device is in safe mode. He also fixes an
out-of-bounds issue when MSI-X are increased for VFs.

Wojciech clears FDB entries on reset to match the hardware state.

For i40e:

Aleksandr adds locking around MACVLAN filters to prevent memory leaks
due to concurrency issues.

For igb:

Mohamed Khalfella adds a check to not attempt to bring up an already
running interface on non-fatal PCIe errors.

For e1000e:

Vitaly changes board type for I219 to more closely match the hardware
and stop PHY issues.

The following are changes since commit 1fd9e4f257827d939cc627541f12fc4bdd979eb1:
  selftests: make kselftest-clean remove libynl outputs
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 100GbE

Aleksandr Loktionov (1):
  i40e: Fix macvlan leak by synchronizing access to mac_filter_hash

Marcin Szycik (3):
  ice: Fix entering Safe Mode
  ice: Fix netif_is_ice() in Safe Mode
  ice: Fix increasing MSI-X on VF

Mohamed Khalfella (1):
  igb: Do not bring the device up after non-fatal error

Vitaly Lifshits (1):
  e1000e: change I219 (19) devices to ADP

Wojciech Drewek (1):
  ice: Flush FDB entries before reset

 drivers/net/ethernet/intel/e1000e/hw.h        |  4 +--
 drivers/net/ethernet/intel/e1000e/netdev.c    |  4 +--
 drivers/net/ethernet/intel/i40e/i40e_main.c   |  1 +
 .../ethernet/intel/i40e/i40e_virtchnl_pf.c    |  2 ++
 .../net/ethernet/intel/ice/ice_eswitch_br.c   |  5 ++-
 .../net/ethernet/intel/ice/ice_eswitch_br.h   |  1 +
 drivers/net/ethernet/intel/ice/ice_main.c     | 31 ++++---------------
 drivers/net/ethernet/intel/ice/ice_sriov.c    | 11 +++++--
 drivers/net/ethernet/intel/ice/ice_vf_lib.c   |  2 +-
 .../ethernet/intel/ice/ice_vf_lib_private.h   |  1 -
 drivers/net/ethernet/intel/igb/igb_main.c     |  4 +++
 11 files changed, 31 insertions(+), 35 deletions(-)

-- 
2.42.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net 1/7] ice: Fix entering Safe Mode
  2024-10-08 23:00 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) Tony Nguyen
@ 2024-10-08 23:00 ` Tony Nguyen
  2024-10-09 14:51   ` Fijalkowski, Maciej
  2024-10-08 23:00 ` [PATCH net 2/7] ice: Fix netif_is_ice() in " Tony Nguyen
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 10+ messages in thread
From: Tony Nguyen @ 2024-10-08 23:00 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Marcin Szycik, anthony.l.nguyen, mateusz.polchlopek,
	maciej.fijalkowski, Przemek Kitszel, Brett Creeley,
	Pucha Himasekhar Reddy

From: Marcin Szycik <marcin.szycik@linux.intel.com>

If DDP package is missing or corrupted, the driver should enter Safe Mode.
Instead, an error is returned and probe fails.

To fix this, don't exit init if ice_init_ddp_config() returns an error.

Repro:
* Remove or rename DDP package (/lib/firmware/intel/ice/ddp/ice.pkg)
* Load ice

Fixes: cc5776fe1832 ("ice: Enable switching default Tx scheduler topology")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index fbab72fab79c..da1352dc26af 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -4767,14 +4767,12 @@ int ice_init_dev(struct ice_pf *pf)
 	ice_init_feature_support(pf);
 
 	err = ice_init_ddp_config(hw, pf);
-	if (err)
-		return err;
 
 	/* if ice_init_ddp_config fails, ICE_FLAG_ADV_FEATURES bit won't be
 	 * set in pf->state, which will cause ice_is_safe_mode to return
 	 * true
 	 */
-	if (ice_is_safe_mode(pf)) {
+	if (err || ice_is_safe_mode(pf)) {
 		/* we already got function/device capabilities but these don't
 		 * reflect what the driver needs to do in safe mode. Instead of
 		 * adding conditional logic everywhere to ignore these
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 2/7] ice: Fix netif_is_ice() in Safe Mode
  2024-10-08 23:00 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) Tony Nguyen
  2024-10-08 23:00 ` [PATCH net 1/7] ice: Fix entering Safe Mode Tony Nguyen
@ 2024-10-08 23:00 ` Tony Nguyen
  2024-10-08 23:00 ` [PATCH net 3/7] ice: Flush FDB entries before reset Tony Nguyen
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2024-10-08 23:00 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Marcin Szycik, anthony.l.nguyen, mateusz.polchlopek,
	maciej.fijalkowski, Przemek Kitszel, Brett Creeley,
	Sujai Buvaneswaran

From: Marcin Szycik <marcin.szycik@linux.intel.com>

netif_is_ice() works by checking the pointer to netdev ops. However, it
only checks for the default ice_netdev_ops, not ice_netdev_safe_mode_ops,
so in Safe Mode it always returns false, which is unintuitive. While it
doesn't look like netif_is_ice() is currently being called anywhere in Safe
Mode, this could change and potentially lead to unexpected behaviour.

Fixes: df006dd4b1dc ("ice: Add initial support framework for LAG")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index da1352dc26af..09d1a4eb5716 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -87,7 +87,8 @@ ice_indr_setup_tc_cb(struct net_device *netdev, struct Qdisc *sch,
 
 bool netif_is_ice(const struct net_device *dev)
 {
-	return dev && (dev->netdev_ops == &ice_netdev_ops);
+	return dev && (dev->netdev_ops == &ice_netdev_ops ||
+		       dev->netdev_ops == &ice_netdev_safe_mode_ops);
 }
 
 /**
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 3/7] ice: Flush FDB entries before reset
  2024-10-08 23:00 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) Tony Nguyen
  2024-10-08 23:00 ` [PATCH net 1/7] ice: Fix entering Safe Mode Tony Nguyen
  2024-10-08 23:00 ` [PATCH net 2/7] ice: Fix netif_is_ice() in " Tony Nguyen
@ 2024-10-08 23:00 ` Tony Nguyen
  2024-10-08 23:00 ` [PATCH net 4/7] ice: Fix increasing MSI-X on VF Tony Nguyen
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2024-10-08 23:00 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Wojciech Drewek, anthony.l.nguyen, horms, michal.swiatkowski,
	Mateusz Polchlopek, Sujai Buvaneswaran

From: Wojciech Drewek <wojciech.drewek@intel.com>

Triggering the reset while in switchdev mode causes
errors[1]. Rules are already removed by this time
because switch content is flushed in case of the reset.
This means that rules were deleted from HW but SW
still thinks they exist so when we get
SWITCHDEV_FDB_DEL_TO_DEVICE notification we try to
delete not existing rule.

We can avoid these errors by clearing the rules
early in the reset flow before they are removed from HW.
Switchdev API will get notified that the rule was removed
so we won't get SWITCHDEV_FDB_DEL_TO_DEVICE notification.
Remove unnecessary ice_clear_sw_switch_recipes.

[1]
ice 0000:01:00.0: Failed to delete FDB forward rule, err: -2
ice 0000:01:00.0: Failed to delete FDB guard rule, err: -2

Fixes: 7c945a1a8e5f ("ice: Switchdev FDB events support")
Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 .../net/ethernet/intel/ice/ice_eswitch_br.c   |  5 +++-
 .../net/ethernet/intel/ice/ice_eswitch_br.h   |  1 +
 drivers/net/ethernet/intel/ice/ice_main.c     | 24 +++----------------
 3 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
index f5aceb32bf4d..cccb7ddf61c9 100644
--- a/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
+++ b/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
@@ -582,10 +582,13 @@ ice_eswitch_br_switchdev_event(struct notifier_block *nb,
 	return NOTIFY_DONE;
 }
 
-static void ice_eswitch_br_fdb_flush(struct ice_esw_br *bridge)
+void ice_eswitch_br_fdb_flush(struct ice_esw_br *bridge)
 {
 	struct ice_esw_br_fdb_entry *entry, *tmp;
 
+	if (!bridge)
+		return;
+
 	list_for_each_entry_safe(entry, tmp, &bridge->fdb_list, list)
 		ice_eswitch_br_fdb_entry_notify_and_cleanup(bridge, entry);
 }
diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch_br.h b/drivers/net/ethernet/intel/ice/ice_eswitch_br.h
index c15c7344d7f8..66a2c804338f 100644
--- a/drivers/net/ethernet/intel/ice/ice_eswitch_br.h
+++ b/drivers/net/ethernet/intel/ice/ice_eswitch_br.h
@@ -117,5 +117,6 @@ void
 ice_eswitch_br_offloads_deinit(struct ice_pf *pf);
 int
 ice_eswitch_br_offloads_init(struct ice_pf *pf);
+void ice_eswitch_br_fdb_flush(struct ice_esw_br *bridge);
 
 #endif /* _ICE_ESWITCH_BR_H_ */
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 09d1a4eb5716..b1e7727b8677 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -521,25 +521,6 @@ static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked)
 		pf->vf_agg_node[node].num_vsis = 0;
 }
 
-/**
- * ice_clear_sw_switch_recipes - clear switch recipes
- * @pf: board private structure
- *
- * Mark switch recipes as not created in sw structures. There are cases where
- * rules (especially advanced rules) need to be restored, either re-read from
- * hardware or added again. For example after the reset. 'recp_created' flag
- * prevents from doing that and need to be cleared upfront.
- */
-static void ice_clear_sw_switch_recipes(struct ice_pf *pf)
-{
-	struct ice_sw_recipe *recp;
-	u8 i;
-
-	recp = pf->hw.switch_info->recp_list;
-	for (i = 0; i < ICE_MAX_NUM_RECIPES; i++)
-		recp[i].recp_created = false;
-}
-
 /**
  * ice_prepare_for_reset - prep for reset
  * @pf: board private structure
@@ -576,8 +557,9 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
 	mutex_unlock(&pf->vfs.table_lock);
 
 	if (ice_is_eswitch_mode_switchdev(pf)) {
-		if (reset_type != ICE_RESET_PFR)
-			ice_clear_sw_switch_recipes(pf);
+		rtnl_lock();
+		ice_eswitch_br_fdb_flush(pf->eswitch.br_offloads->bridge);
+		rtnl_unlock();
 	}
 
 	/* release ADQ specific HW and SW resources */
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 4/7] ice: Fix increasing MSI-X on VF
  2024-10-08 23:00 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) Tony Nguyen
                   ` (2 preceding siblings ...)
  2024-10-08 23:00 ` [PATCH net 3/7] ice: Flush FDB entries before reset Tony Nguyen
@ 2024-10-08 23:00 ` Tony Nguyen
  2024-10-08 23:00 ` [PATCH net 5/7] i40e: Fix macvlan leak by synchronizing access to mac_filter_hash Tony Nguyen
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2024-10-08 23:00 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Marcin Szycik, anthony.l.nguyen, poros, jacob.e.keller,
	przemyslaw.kitszel, Michal Swiatkowski, Simon Horman,
	Rafal Romanowski

From: Marcin Szycik <marcin.szycik@linux.intel.com>

Increasing MSI-X value on a VF leads to invalid memory operations. This
is caused by not reallocating some arrays.

Reproducer:
  modprobe ice
  echo 0 > /sys/bus/pci/devices/$PF_PCI/sriov_drivers_autoprobe
  echo 1 > /sys/bus/pci/devices/$PF_PCI/sriov_numvfs
  echo 17 > /sys/bus/pci/devices/$VF0_PCI/sriov_vf_msix_count

Default MSI-X is 16, so 17 and above triggers this issue.

KASAN reports:

  BUG: KASAN: slab-out-of-bounds in ice_vsi_alloc_ring_stats+0x38d/0x4b0 [ice]
  Read of size 8 at addr ffff8888b937d180 by task bash/28433
  (...)

  Call Trace:
   (...)
   ? ice_vsi_alloc_ring_stats+0x38d/0x4b0 [ice]
   kasan_report+0xed/0x120
   ? ice_vsi_alloc_ring_stats+0x38d/0x4b0 [ice]
   ice_vsi_alloc_ring_stats+0x38d/0x4b0 [ice]
   ice_vsi_cfg_def+0x3360/0x4770 [ice]
   ? mutex_unlock+0x83/0xd0
   ? __pfx_ice_vsi_cfg_def+0x10/0x10 [ice]
   ? __pfx_ice_remove_vsi_lkup_fltr+0x10/0x10 [ice]
   ice_vsi_cfg+0x7f/0x3b0 [ice]
   ice_vf_reconfig_vsi+0x114/0x210 [ice]
   ice_sriov_set_msix_vec_count+0x3d0/0x960 [ice]
   sriov_vf_msix_count_store+0x21c/0x300
   (...)

  Allocated by task 28201:
   (...)
   ice_vsi_cfg_def+0x1c8e/0x4770 [ice]
   ice_vsi_cfg+0x7f/0x3b0 [ice]
   ice_vsi_setup+0x179/0xa30 [ice]
   ice_sriov_configure+0xcaa/0x1520 [ice]
   sriov_numvfs_store+0x212/0x390
   (...)

To fix it, use ice_vsi_rebuild() instead of ice_vf_reconfig_vsi(). This
causes the required arrays to be reallocated taking the new queue count
into account (ice_vsi_realloc_stat_arrays()). Set req_txq and req_rxq
before ice_vsi_rebuild(), so that realloc uses the newly set queue
count.

Additionally, ice_vsi_rebuild() does not remove VSI filters
(ice_fltr_remove_all()), so ice_vf_init_host_cfg() is no longer
necessary.

Reported-by: Jacob Keller <jacob.e.keller@intel.com>
Fixes: 2a2cb4c6c181 ("ice: replace ice_vf_recreate_vsi() with ice_vf_reconfig_vsi()")
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_sriov.c          | 11 ++++++++---
 drivers/net/ethernet/intel/ice/ice_vf_lib.c         |  2 +-
 drivers/net/ethernet/intel/ice/ice_vf_lib_private.h |  1 -
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c
index c2d6b2a144e9..91cb393f616f 100644
--- a/drivers/net/ethernet/intel/ice/ice_sriov.c
+++ b/drivers/net/ethernet/intel/ice/ice_sriov.c
@@ -1121,7 +1121,10 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
 	if (vf->first_vector_idx < 0)
 		goto unroll;
 
-	if (ice_vf_reconfig_vsi(vf) || ice_vf_init_host_cfg(vf, vsi)) {
+	vsi->req_txq = queues;
+	vsi->req_rxq = queues;
+
+	if (ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT)) {
 		/* Try to rebuild with previous values */
 		needs_rebuild = true;
 		goto unroll;
@@ -1150,8 +1153,10 @@ int ice_sriov_set_msix_vec_count(struct pci_dev *vf_dev, int msix_vec_count)
 	}
 
 	if (needs_rebuild) {
-		ice_vf_reconfig_vsi(vf);
-		ice_vf_init_host_cfg(vf, vsi);
+		vsi->req_txq = prev_queues;
+		vsi->req_rxq = prev_queues;
+
+		ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT);
 	}
 
 	ice_ena_vf_mappings(vf);
diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
index 749a08ccf267..8c434689e3f7 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
@@ -256,7 +256,7 @@ static void ice_vf_pre_vsi_rebuild(struct ice_vf *vf)
  *
  * It brings the VSI down and then reconfigures it with the hardware.
  */
-int ice_vf_reconfig_vsi(struct ice_vf *vf)
+static int ice_vf_reconfig_vsi(struct ice_vf *vf)
 {
 	struct ice_vsi *vsi = ice_get_vf_vsi(vf);
 	struct ice_pf *pf = vf->pf;
diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib_private.h b/drivers/net/ethernet/intel/ice/ice_vf_lib_private.h
index 91ba7fe0eaee..0c7e77c0a09f 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_lib_private.h
+++ b/drivers/net/ethernet/intel/ice/ice_vf_lib_private.h
@@ -23,7 +23,6 @@
 #warning "Only include ice_vf_lib_private.h in CONFIG_PCI_IOV virtualization files"
 #endif
 
-int ice_vf_reconfig_vsi(struct ice_vf *vf);
 void ice_initialize_vf_entry(struct ice_vf *vf);
 void ice_dis_vf_qs(struct ice_vf *vf);
 int ice_check_vf_init(struct ice_vf *vf);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 5/7] i40e: Fix macvlan leak by synchronizing access to mac_filter_hash
  2024-10-08 23:00 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) Tony Nguyen
                   ` (3 preceding siblings ...)
  2024-10-08 23:00 ` [PATCH net 4/7] ice: Fix increasing MSI-X on VF Tony Nguyen
@ 2024-10-08 23:00 ` Tony Nguyen
  2024-10-08 23:00 ` [PATCH net 6/7] igb: Do not bring the device up after non-fatal error Tony Nguyen
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2024-10-08 23:00 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Aleksandr Loktionov, anthony.l.nguyen, Arkadiusz Kubalewski,
	Simon Horman, Rafal Romanowski

From: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

This patch addresses a macvlan leak issue in the i40e driver caused by
concurrent access to vsi->mac_filter_hash. The leak occurs when multiple
threads attempt to modify the mac_filter_hash simultaneously, leading to
inconsistent state and potential memory leaks.

To fix this, we now wrap the calls to i40e_del_mac_filter() and zeroing
vf->default_lan_addr.addr with spin_lock/unlock_bh(&vsi->mac_filter_hash_lock),
ensuring atomic operations and preventing concurrent access.

Additionally, we add lockdep_assert_held(&vsi->mac_filter_hash_lock) in
i40e_add_mac_filter() to help catch similar issues in the future.

Reproduction steps:
1. Spawn VFs and configure port vlan on them.
2. Trigger concurrent macvlan operations (e.g., adding and deleting
	portvlan and/or mac filters).
3. Observe the potential memory leak and inconsistent state in the
	mac_filter_hash.

This synchronization ensures the integrity of the mac_filter_hash and prevents
the described leak.

Fixes: fed0d9f13266 ("i40e: Fix VF's MAC Address change on VM")
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 1 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 03205eb9f925..25295ae370b2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -1734,6 +1734,7 @@ struct i40e_mac_filter *i40e_add_mac_filter(struct i40e_vsi *vsi,
 	struct hlist_node *h;
 	int bkt;
 
+	lockdep_assert_held(&vsi->mac_filter_hash_lock);
 	if (vsi->info.pvid)
 		return i40e_add_filter(vsi, macaddr,
 				       le16_to_cpu(vsi->info.pvid));
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 662622f01e31..dfa785e39458 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2213,8 +2213,10 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
 		vfres->vsi_res[0].qset_handle
 					  = le16_to_cpu(vsi->info.qs_handle[0]);
 		if (!(vf->driver_caps & VIRTCHNL_VF_OFFLOAD_USO) && !vf->pf_set_mac) {
+			spin_lock_bh(&vsi->mac_filter_hash_lock);
 			i40e_del_mac_filter(vsi, vf->default_lan_addr.addr);
 			eth_zero_addr(vf->default_lan_addr.addr);
+			spin_unlock_bh(&vsi->mac_filter_hash_lock);
 		}
 		ether_addr_copy(vfres->vsi_res[0].default_mac_addr,
 				vf->default_lan_addr.addr);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 6/7] igb: Do not bring the device up after non-fatal error
  2024-10-08 23:00 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) Tony Nguyen
                   ` (4 preceding siblings ...)
  2024-10-08 23:00 ` [PATCH net 5/7] i40e: Fix macvlan leak by synchronizing access to mac_filter_hash Tony Nguyen
@ 2024-10-08 23:00 ` Tony Nguyen
  2024-10-08 23:00 ` [PATCH net 7/7] e1000e: change I219 (19) devices to ADP Tony Nguyen
  2024-10-10  3:10 ` [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) patchwork-bot+netdevbpf
  7 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2024-10-08 23:00 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Mohamed Khalfella, anthony.l.nguyen, yinghsu, Yuanyuan Zhong,
	Simon Horman, Pucha Himasekhar Reddy

From: Mohamed Khalfella <mkhalfella@purestorage.com>

Commit 004d25060c78 ("igb: Fix igb_down hung on surprise removal")
changed igb_io_error_detected() to ignore non-fatal pcie errors in order
to avoid hung task that can happen when igb_down() is called multiple
times. This caused an issue when processing transient non-fatal errors.
igb_io_resume(), which is called after igb_io_error_detected(), assumes
that device is brought down by igb_io_error_detected() if the interface
is up. This resulted in panic with stacktrace below.

[ T3256] igb 0000:09:00.0 haeth0: igb: haeth0 NIC Link is Down
[  T292] pcieport 0000:00:1c.5: AER: Uncorrected (Non-Fatal) error received: 0000:09:00.0
[  T292] igb 0000:09:00.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, (Requester ID)
[  T292] igb 0000:09:00.0:   device [8086:1537] error status/mask=00004000/00000000
[  T292] igb 0000:09:00.0:    [14] CmpltTO [  200.105524,009][  T292] igb 0000:09:00.0: AER:   TLP Header: 00000000 00000000 00000000 00000000
[  T292] pcieport 0000:00:1c.5: AER: broadcast error_detected message
[  T292] igb 0000:09:00.0: Non-correctable non-fatal error reported.
[  T292] pcieport 0000:00:1c.5: AER: broadcast mmio_enabled message
[  T292] pcieport 0000:00:1c.5: AER: broadcast resume message
[  T292] ------------[ cut here ]------------
[  T292] kernel BUG at net/core/dev.c:6539!
[  T292] invalid opcode: 0000 [#1] PREEMPT SMP
[  T292] RIP: 0010:napi_enable+0x37/0x40
[  T292] Call Trace:
[  T292]  <TASK>
[  T292]  ? die+0x33/0x90
[  T292]  ? do_trap+0xdc/0x110
[  T292]  ? napi_enable+0x37/0x40
[  T292]  ? do_error_trap+0x70/0xb0
[  T292]  ? napi_enable+0x37/0x40
[  T292]  ? napi_enable+0x37/0x40
[  T292]  ? exc_invalid_op+0x4e/0x70
[  T292]  ? napi_enable+0x37/0x40
[  T292]  ? asm_exc_invalid_op+0x16/0x20
[  T292]  ? napi_enable+0x37/0x40
[  T292]  igb_up+0x41/0x150
[  T292]  igb_io_resume+0x25/0x70
[  T292]  report_resume+0x54/0x70
[  T292]  ? report_frozen_detected+0x20/0x20
[  T292]  pci_walk_bus+0x6c/0x90
[  T292]  ? aer_print_port_info+0xa0/0xa0
[  T292]  pcie_do_recovery+0x22f/0x380
[  T292]  aer_process_err_devices+0x110/0x160
[  T292]  aer_isr+0x1c1/0x1e0
[  T292]  ? disable_irq_nosync+0x10/0x10
[  T292]  irq_thread_fn+0x1a/0x60
[  T292]  irq_thread+0xe3/0x1a0
[  T292]  ? irq_set_affinity_notifier+0x120/0x120
[  T292]  ? irq_affinity_notify+0x100/0x100
[  T292]  kthread+0xe2/0x110
[  T292]  ? kthread_complete_and_exit+0x20/0x20
[  T292]  ret_from_fork+0x2d/0x50
[  T292]  ? kthread_complete_and_exit+0x20/0x20
[  T292]  ret_from_fork_asm+0x11/0x20
[  T292]  </TASK>

To fix this issue igb_io_resume() checks if the interface is running and
the device is not down this means igb_io_error_detected() did not bring
the device down and there is no need to bring it up.

Signed-off-by: Mohamed Khalfella <mkhalfella@purestorage.com>
Reviewed-by: Yuanyuan Zhong <yzhong@purestorage.com>
Fixes: 004d25060c78 ("igb: Fix igb_down hung on surprise removal")
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 1ef4cb871452..f1d088168723 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -9651,6 +9651,10 @@ static void igb_io_resume(struct pci_dev *pdev)
 	struct igb_adapter *adapter = netdev_priv(netdev);
 
 	if (netif_running(netdev)) {
+		if (!test_bit(__IGB_DOWN, &adapter->state)) {
+			dev_dbg(&pdev->dev, "Resuming from non-fatal error, do nothing.\n");
+			return;
+		}
 		if (igb_up(adapter)) {
 			dev_err(&pdev->dev, "igb_up failed after reset\n");
 			return;
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 7/7] e1000e: change I219 (19) devices to ADP
  2024-10-08 23:00 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) Tony Nguyen
                   ` (5 preceding siblings ...)
  2024-10-08 23:00 ` [PATCH net 6/7] igb: Do not bring the device up after non-fatal error Tony Nguyen
@ 2024-10-08 23:00 ` Tony Nguyen
  2024-10-10  3:10 ` [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) patchwork-bot+netdevbpf
  7 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2024-10-08 23:00 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Vitaly Lifshits, anthony.l.nguyen, dima.ruinskiy, Mor Bar-Gabay

From: Vitaly Lifshits <vitaly.lifshits@intel.com>

Sporadic issues, such as PHY access loss, have been observed on I219 (19)
devices. It was found that these devices have hardware more closely
related to ADP than MTP and the issues were caused by taking MTP-specific
flows.

Change the MAC and board types of these devices from MTP to ADP to
correctly reflect the LAN hardware, and flows, of these devices.

Fixes: db2d737d63c5 ("e1000e: Separate MTP board type from ADP")
Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Tested-by: Mor Bar-Gabay <morx.bar.gabay@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/e1000e/hw.h     | 4 ++--
 drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/hw.h b/drivers/net/ethernet/intel/e1000e/hw.h
index 4b6e7536170a..fc8ed38aa095 100644
--- a/drivers/net/ethernet/intel/e1000e/hw.h
+++ b/drivers/net/ethernet/intel/e1000e/hw.h
@@ -108,8 +108,8 @@ struct e1000_hw;
 #define E1000_DEV_ID_PCH_RPL_I219_V22		0x0DC8
 #define E1000_DEV_ID_PCH_MTP_I219_LM18		0x550A
 #define E1000_DEV_ID_PCH_MTP_I219_V18		0x550B
-#define E1000_DEV_ID_PCH_MTP_I219_LM19		0x550C
-#define E1000_DEV_ID_PCH_MTP_I219_V19		0x550D
+#define E1000_DEV_ID_PCH_ADP_I219_LM19		0x550C
+#define E1000_DEV_ID_PCH_ADP_I219_V19		0x550D
 #define E1000_DEV_ID_PCH_LNP_I219_LM20		0x550E
 #define E1000_DEV_ID_PCH_LNP_I219_V20		0x550F
 #define E1000_DEV_ID_PCH_LNP_I219_LM21		0x5510
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index f103249b12fa..07e903346358 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -7899,10 +7899,10 @@ static const struct pci_device_id e1000_pci_tbl[] = {
 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_adp },
 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_adp },
 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_adp },
+	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM19), board_pch_adp },
+	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V19), board_pch_adp },
 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_mtp },
 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_mtp },
-	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_mtp },
-	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_mtp },
 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_mtp },
 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_mtp },
 	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_mtp },
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH net 1/7] ice: Fix entering Safe Mode
  2024-10-08 23:00 ` [PATCH net 1/7] ice: Fix entering Safe Mode Tony Nguyen
@ 2024-10-09 14:51   ` Fijalkowski, Maciej
  0 siblings, 0 replies; 10+ messages in thread
From: Fijalkowski, Maciej @ 2024-10-09 14:51 UTC (permalink / raw)
  To: Nguyen, Anthony L, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org
  Cc: Marcin Szycik, Nguyen, Anthony L, Polchlopek, Mateusz,
	Kitszel, Przemyslaw, Brett Creeley, Pucha, HimasekharX Reddy

> From: Marcin Szycik <marcin.szycik@linux.intel.com>
> 
> If DDP package is missing or corrupted, the driver should enter Safe Mode.
> Instead, an error is returned and probe fails.
> 
> To fix this, don't exit init if ice_init_ddp_config() returns an error.
> 
> Repro:
> * Remove or rename DDP package (/lib/firmware/intel/ice/ddp/ice.pkg)
> * Load ice
> 
> Fixes: cc5776fe1832 ("ice: Enable switching default Tx scheduler topology")
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
> Reviewed-by: Brett Creeley <brett.creeley@amd.com>
> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index fbab72fab79c..da1352dc26af 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -4767,14 +4767,12 @@ int ice_init_dev(struct ice_pf *pf)
>  	ice_init_feature_support(pf);
> 
>  	err = ice_init_ddp_config(hw, pf);
> -	if (err)
> -		return err;
> 
>  	/* if ice_init_ddp_config fails, ICE_FLAG_ADV_FEATURES bit won't be
>  	 * set in pf->state, which will cause ice_is_safe_mode to return
>  	 * true
>  	 */
> -	if (ice_is_safe_mode(pf)) {
> +	if (err || ice_is_safe_mode(pf)) {
>  		/* we already got function/device capabilities but these don't
>  		 * reflect what the driver needs to do in safe mode. Instead of
>  		 * adding conditional logic everywhere to ignore these
> --
> 2.42.0
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e)
  2024-10-08 23:00 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) Tony Nguyen
                   ` (6 preceding siblings ...)
  2024-10-08 23:00 ` [PATCH net 7/7] e1000e: change I219 (19) devices to ADP Tony Nguyen
@ 2024-10-10  3:10 ` patchwork-bot+netdevbpf
  7 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-10  3:10 UTC (permalink / raw)
  To: Tony Nguyen; +Cc: davem, kuba, pabeni, edumazet, netdev

Hello:

This series was applied to netdev/net.git (main)
by Tony Nguyen <anthony.l.nguyen@intel.com>:

On Tue,  8 Oct 2024 16:00:38 -0700 you wrote:
> This series contains updates to ice, i40e, igb, and e1000e drivers.
> 
> For ice:
> 
> Marcin allows driver to load, into safe mode, when DDP package is
> missing or corrupted and adjusts the netif_is_ice() check to
> account for when the device is in safe mode. He also fixes an
> out-of-bounds issue when MSI-X are increased for VFs.
> 
> [...]

Here is the summary with links:
  - [net,1/7] ice: Fix entering Safe Mode
    https://git.kernel.org/netdev/net/c/b972060a4778
  - [net,2/7] ice: Fix netif_is_ice() in Safe Mode
    https://git.kernel.org/netdev/net/c/8e60dbcbaaa1
  - [net,3/7] ice: Flush FDB entries before reset
    https://git.kernel.org/netdev/net/c/fbcb968a98ac
  - [net,4/7] ice: Fix increasing MSI-X on VF
    https://git.kernel.org/netdev/net/c/bce9af1b030b
  - [net,5/7] i40e: Fix macvlan leak by synchronizing access to mac_filter_hash
    https://git.kernel.org/netdev/net/c/dac6c7b3d337
  - [net,6/7] igb: Do not bring the device up after non-fatal error
    https://git.kernel.org/netdev/net/c/330a699ecbfc
  - [net,7/7] e1000e: change I219 (19) devices to ADP
    https://git.kernel.org/netdev/net/c/9d9e5347b035

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-10-10  3:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 23:00 [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) Tony Nguyen
2024-10-08 23:00 ` [PATCH net 1/7] ice: Fix entering Safe Mode Tony Nguyen
2024-10-09 14:51   ` Fijalkowski, Maciej
2024-10-08 23:00 ` [PATCH net 2/7] ice: Fix netif_is_ice() in " Tony Nguyen
2024-10-08 23:00 ` [PATCH net 3/7] ice: Flush FDB entries before reset Tony Nguyen
2024-10-08 23:00 ` [PATCH net 4/7] ice: Fix increasing MSI-X on VF Tony Nguyen
2024-10-08 23:00 ` [PATCH net 5/7] i40e: Fix macvlan leak by synchronizing access to mac_filter_hash Tony Nguyen
2024-10-08 23:00 ` [PATCH net 6/7] igb: Do not bring the device up after non-fatal error Tony Nguyen
2024-10-08 23:00 ` [PATCH net 7/7] e1000e: change I219 (19) devices to ADP Tony Nguyen
2024-10-10  3:10 ` [PATCH net 0/7][pull request] Intel Wired LAN Driver Updates 2024-10-08 (ice, i40e, igb, e1000e) patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).