ice: port missing i40e fixes
Subsystems (4)
cover ice: port missing i40e fixes
This series fixes bugs in ice that have been fixed in i40e, some of them years ago, but are still present in ice. They were found by going through the i40e history and checking each fix against the current ice code.
Patches 3, 6 and 8 have no i40e counterpart. They showed up while verifying the ports and are kept in the series. Patch 3 was found while testing patch 2. With the IRQ unwind fixed the netdev still could not be opened again after the failed ndo_open, so patch 2 alone does not make that error path recoverable. Patch 6 was found while building a reproducer for the i40e MAC filter overflow fixes. Those are not part of this series, because a full switch table on E810 leaves no room for the promiscuous rule either. Patch 8 was found while checking the i40e PF reset fixes. It is an ice regression of the poll loop timeout check, which i40e does correctly.
Every patch was checked on E810 before and after the change. Patches 1, 4, 5 and 6 have plain reproducers, which show UDP tunnel offload lost after CORER, an always empty default XPS map, VF tx_dropped stuck at zero and multicast filters silently not programmed. Patches 2, 3, 8, 9 and 10 need conditions the test box does not hit on its own (a failing request_irq, a hung PFR, a WoL capable port, counters past 2^32) and were verified with fault injection. Patch 7 was verified by filling the switch table, with debug prints for the failure analysis.
An LLM was used to go through the i40e history, to write the reproducers and fault injection hooks and to draft the patches and changelogs. All of it was reviewed, and every fix was tested on E810 as described above.
Petr Oros (10):
ice: replay UDP tunnel ports after a core or global reset
ice: fix IRQ freeing in ice_vsi_req_irq_msix() error path
ice: stop the LAN Tx queues when ice_vsi_open() fails
ice: restore the default XPS map after a netdev TC change
ice: report VF tx_dropped with tx_errors instead of tx_discards
ice: keep adding MAC filters after one that already exists
ice: take the switch rule AQ error from the response descriptor
ice: detect a PF reset that does not complete
ice: program multicast magic wake before tearing down the main VSI
ice: fix unsigned stat widths
drivers/net/ethernet/intel/ice/ice.h | 8 ++--- drivers/net/ethernet/intel/ice/ice_common.c | 2 +- drivers/net/ethernet/intel/ice/ice_lib.c | 6 ++++ drivers/net/ethernet/intel/ice/ice_main.c | 36 ++++++++++++++------- drivers/net/ethernet/intel/ice/ice_sriov.c | 2 +- drivers/net/ethernet/intel/ice/ice_switch.c | 17 +++++++--- 6 files changed, 49 insertions(+), 22 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/10 ice: replay UDP tunnel ports after a core or global reset
A CORER, GLOBR or EMPR reloads the DDP package in ice_rebuild() and ice_init_pkg_hints() clears hw->tnl, so every offloaded VXLAN and GENEVE port is gone from both the boost TCAM and the driver table. The udp_tunnel_nic core is never told about it and still considers the ports programmed, so the Rx tunnel offloads silently stop working after the reset. With VXLAN port 4789 offloaded, 64 flows that differ only in the inner headers are spread over all six Rx queues of the test port by RSS, after a CORER they all land in a single queue, the same as without the port. Removing the port later trips the WARN_ON() in ice_destroy_tunnel() because its table entry is no longer valid:
WARNING: ice_flex_pipe.c:524 at ice_udp_tunnel_unset_port+0x56/0x280 [ice] ice 0000:04:00.3 enp4s0f3np3: Error removing UDP tunnel - -5 ice 0000:04:00.3 enp4s0f3np3: UDP tunnel port sync failed port 4789 type vxlan: -5
Call udp_tunnel_nic_reset_ntf() once the main VSI is rebuilt so the core programs the ports again. A PF reset keeps the package and the table, so it is left alone. No rtnl_lock is needed since commit 1ead7501094c ("udp_tunnel: remove rtnl_lock dependency").
i40e fixed the same problem in commit 1f190d936948 ("i40e: Reprogram port offloads after reset").
--- drivers/net/ethernet/intel/ice/ice_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +4 -1
@@ -7859,8 +7859,11 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)ice_rebuild_arfs (pf); } -if (vsi && vsi->netdev) +if (vsi && vsi->netdev) {netif_device_attach (vsi->netdev); +if (reset_type !=ICE_RESET_PFR ) +udp_tunnel_nic_reset_ntf (vsi->netdev); + }ice_update_pf_netdev_link (pf);
Signature · 1 line
2.55.0
Re: [PATCH iwl-net 01/10] ice: replay UDP tunnel ports after a core or global reset
Quoted 37 lines · Petr Oros
A CORER, GLOBR or EMPR reloads the DDP package in
ice_rebuild()andice_init_pkg_hints()clearshw->tnl, so every offloaded VXLAN and GENEVE port is gone from both the boost TCAM and the driver table. Theudp_tunnel_niccore is never told about it and still considers the ports programmed, so the Rx tunnel offloads silently stop working after the reset. With VXLAN port 4789 offloaded, 64 flows that differ only in the inner headers are spread over all six Rx queues of the test port by RSS, after a CORER they all land in a single queue, the same as without the port. Removing the port later trips theWARN_ON()inice_destroy_tunnel()because its table entry is no longer valid:WARNING: ice_flex_pipe.c:524 at ice_udp_tunnel_unset_port+0x56/0x280 [ice] ice 0000:04:00.3 enp4s0f3np3: Error removing UDP tunnel - -5 ice 0000:04:00.3 enp4s0f3np3: UDP tunnel port sync failed port 4789 type vxlan: -5Call
udp_tunnel_nic_reset_ntf()once the main VSI is rebuilt so the core programs the ports again. A PF reset keeps the package and the table, so it is left alone. Nortnl_lockis needed since commit1ead7501094c("udp_tunnel: removertnl_lockdependency").i40e fixed the same problem in commit
1f190d936948("i40e: Reprogram port offloads after reset").Fixes a4e82a81f573 ("ice: Add support for tunnel offloads")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_main.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_main.c +0
-0@@ -7859,8 +7859,11 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)ice_rebuild_arfs (pf); }
drivers/net/ethernet/intel/ice/ice_main.c static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) · line 7869
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +4
-1-if (vsi && vsi->netdev) +if (vsi && vsi->netdev) {netif_device_attach (vsi->netdev); +if (reset_type !=ICE_RESET_PFR ) +udp_tunnel_nic_reset_ntf (vsi->netdev); + }ice_update_pf_netdev_link (pf);
RE: [PATCH iwl-net 01/10] ice: replay UDP tunnel ports after a core or global reset
In reply to Petr OrosQuoted 81 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 3:08 PM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH iwl-net 01/10] ice: replay UDP tunnel ports after a core or global resetA CORER, GLOBR or EMPR reloads the DDP package in
ice_rebuild()andice_init_pkg_hints()clearshw->tnl, so every offloaded VXLAN and GENEVE port is gone from both the boost TCAM and the driver table. Theudp_tunnel_niccore is never told about it and still considers the ports programmed, so the Rx tunnel offloads silently stop working after the reset. With VXLAN port 4789 offloaded, 64 flows that differ only in the inner headers are spread over all six Rx queues of the test port by RSS, after a CORER they all land in a single queue, the same as without the port. Removing the port later trips theWARN_ON()inice_destroy_tunnel()because its table entry is no longer valid:WARNING: ice_flex_pipe.c:524 at ice_udp_tunnel_unset_port+0x56/0x280[ice]
ice 0000:04:00.3 enp4s0f3np3: Error removing UDP tunnel - -5 ice 0000:04:00.3 enp4s0f3np3: UDP tunnel port sync failed port 4789
type vxlan: -5Call
udp_tunnel_nic_reset_ntf()once the main VSI is rebuilt so the core programs the ports again. A PF reset keeps the package and the table, so it is left alone. Nortnl_lockis needed since commit1ead7501094c
("udp_tunnel: removertnl_lockdependency").i40e fixed the same problem in commit
1f190d936948("i40e: Reprogram port offloads after reset").Fixes a4e82a81f573 ("ice: Add support for tunnel offloads")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_main.c +4
-2@@ -7859,8 +7859,11 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)ice_rebuild_arfs (pf ); } -if (vsi && vsi->netdev) +if (vsi && vsi->netdev) {netif_device_attach (vsi->netdev); +if (reset_type !=ICE_RESET_PFR ) +udp_tunnel_nic_reset_ntf (vsi->netdev); + }ice_update_pf_netdev_link (pf); --
Quoted 1 line
2.55.0
RE: [PATCH iwl-net 01/10] ice: replay UDP tunnel ports after a core or global reset
In reply to Petr OrosQuoted 18 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 6:08 AM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman > <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH iwl-net 01/10] ice: replay UDP tunnel ports after a core or global resetA CORER, GLOBR or EMPR reloads the DDP package in
ice_rebuild()andice_init_pkg_hints()clearshw->tnl, so every offloaded VXLAN and GENEVE port is gone from both the boost TCAM and the driver table. Theudp_tunnel_niccore is never told about it and still considers the ports > programmed, so the Rx tunnel offloads silently stop working after the reset. With VXLAN port 4789 offloaded, 64 flows that differ only in the inner headers are spread over all six Rx queues of the test port by RSS, after a CORER they all land in a single queue, the same as without the port. Removing the port later trips theWARN_ON()inice_destroy_tunnel()because its table entry is no longer valid:WARNING: ice_flex_pipe.c:524 at ice_udp_tunnel_unset_port+0x56/0x280 [ice] ice 0000:04:00.3 enp4s0f3np3: Error removing UDP tunnel - -5 ice 0000:04:00.3 enp4s0f3np3: UDP tunnel port sync failed port 4789 type vxlan: -5Call
udp_tunnel_nic_reset_ntf()once the main VSI is rebuilt so the core programs the ports again. A PF reset keeps the package and the table, so it is left alone. Nortnl_lockis needed since commit1ead7501094c("udp_tunnel: removertnl_lockdependency").
Quoted 8 lines
i40e fixed the same problem in commit
1f190d936948("i40e: Reprogram port offloads after reset").Fixes a4e82a81f573 ("ice: Add support for tunnel offloads")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
PATCH 2/10 ice: fix IRQ freeing in ice_vsi_req_irq_msix() error path
In reply to Petr OrosThe vectors are requested with the q_vector as dev_id, but the error path frees them with &vsi->q_vectors[vector], which is the address of the array slot. devm_free_irq() finds no matching devres entry, warns and leaves the IRQ requested. The unwind also tries to free vectors that the request loop skipped because they have no rings.
Forcing request_irq to fail on the fourth vector during ndo_open gives:
ice 0000:04:00.2 enp4s0f2np2: MSIX request_irq failed, error: -16
WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40 WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40 WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40
and the three IRQs stay registered in /proc/interrupts while the interface is down.
Pass the q_vector as dev_id and skip the vectors without rings, which the request loop never requested.
i40e fixed the same mistake in commit 915470e1b44e ("i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path").
--- drivers/net/ethernet/intel/ice/ice_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +6 -2
@@ -2582,8 +2582,12 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename) free_q_irqs:while (vector--) { - irq_num = vsi->q_vectors[vector]->irq.virq; -devm_free_irq (dev, irq_num, &vsi->q_vectors[vector]); +struct ice_q_vector *q_vector = vsi->q_vectors[vector]; + +if (!q_vector->tx.tx_ring && !q_vector->rx.rx_ring) +continue ; + +devm_free_irq (dev, q_vector->irq.virq, q_vector); }return err; }
Signature · 1 line
2.55.0
Re: [PATCH iwl-net 02/10] ice: fix IRQ freeing in ice_vsi_req_irq_msix() error path
Quoted 45 lines · Petr Oros
The vectors are requested with the
q_vectorasdev_id, but the error path frees them with &vsi->q_vectors[vector], which is the address of the array slot.devm_free_irq()finds no matching devres entry, warns and leaves the IRQ requested. The unwind also tries to free vectors that the request loop skipped because they have no rings.Forcing
request_irqto fail on the fourth vector duringndo_opengives:ice 0000:04:00.2 enp4s0f2np2: MSIX
request_irqfailed, error: -16WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40 WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40 WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40and the three IRQs stay registered in
/proc/interruptswhile the interface is down.Pass the
q_vectorasdev_idand skip the vectors without rings, which the request loop never requested.i40e fixed the same mistake in commit
915470e1b44e("i40e: fix IRQ freeing ini40e_vsi_request_irq_msixerror path").Fixes cdedef59deb0 ("ice: Configure VSIs for Tx/Rx")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_main.c| 8 ++++++--1 file changed, 6 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +0
-0@@ -2582,8 +2582,12 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename)
free_q_irqs:while (vector--) {drivers/net/ethernet/intel/ice/ice_main.c +6
-2- irq_num = vsi->q_vectors[vector]->irq.virq; -devm_free_irq (dev, irq_num, &vsi->q_vectors[vector]); +struct ice_q_vector *q_vector = vsi->q_vectors[vector]; + +if (!q_vector->tx.tx_ring && !q_vector->rx.rx_ring) +continue ; + +devm_free_irq (dev, q_vector->irq.virq, q_vector);
Quoted 3 lines
} return err; }
RE: [PATCH iwl-net 02/10] ice: fix IRQ freeing in ice_vsi_req_irq_msix() error path
In reply to Petr OrosQuoted 77 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 3:08 PM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH iwl-net 02/10] ice: fix IRQ freeing inice_vsi_req_irq_msix()error pathThe vectors are requested with the
q_vectorasdev_id, but the error path frees them with &vsi->q_vectors[vector], which is the address of the array slot.devm_free_irq()finds no matching devres entry, warns and leaves the IRQ requested. The unwind also tries to free vectors that the request loop skipped because they have no rings.Forcing
request_irqto fail on the fourth vector duringndo_opengives:ice 0000:04:00.2 enp4s0f2np2: MSIX
request_irqfailed, error: -16WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40 WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40 WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40and the three IRQs stay registered in
/proc/interruptswhile the interface is down.Pass the
q_vectorasdev_idand skip the vectors without rings, which the request loop never requested.i40e fixed the same mistake in commit
915470e1b44e("i40e: fix IRQ freeing ini40e_vsi_request_irq_msixerror path").Fixes cdedef59deb0 ("ice: Configure VSIs for Tx/Rx")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +6
-2@@ -2582,8 +2582,12 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename) free_q_irqs:while (vector--) { - irq_num = vsi->q_vectors[vector]->irq.virq; -devm_free_irq (dev, irq_num, &vsi->q_vectors[vector]); +struct ice_q_vector *q_vector = vsi->q_vectors[vector]; + +if (!q_vector->tx.tx_ring && !q_vector->rx.rx_ring) +continue ; + +devm_free_irq (dev, q_vector->irq.virq, q_vector); }return err;
Quoted 3 lines
}
--
2.55.0
RE: [PATCH iwl-net 02/10] ice: fix IRQ freeing in ice_vsi_req_irq_msix() error path
In reply to Petr OrosQuoted 20 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 6:08 AM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman > <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH iwl-net 02/10] ice: fix IRQ freeing inice_vsi_req_irq_msix()error pathThe vectors are requested with the
q_vectorasdev_id, but the error path frees them with &vsi->q_vectors[vector], which is the address of the array slot.devm_free_irq()finds no matching devres entry, warns and leaves the IRQ requested. The unwind also tries to free vectors that the request loop skipped because they have no rings.Forcing
request_irqto fail on the fourth vector duringndo_opengives:ice 0000:04:00.2 enp4s0f2np2: MSIX
request_irqfailed, error: -16WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40 WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40 WARNING: kernel/irq/devres.c:191 at devm_free_irq+0x30/0x40and the three IRQs stay registered in
/proc/interruptswhile the interface is down.Pass the
q_vectorasdev_idand skip the vectors without rings, which the request loop never requested.
Quoted 8 lines
i40e fixed the same mistake in commit
915470e1b44e("i40e: fix IRQ freeing ini40e_vsi_request_irq_msixerror path").Fixes cdedef59deb0 ("ice: Configure VSIs for Tx/Rx")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
PATCH 3/10 ice: stop the LAN Tx queues when ice_vsi_open() fails
In reply to Petr Orosice_vsi_cfg_lan() adds the LAN (and XDP) Tx queues to the scheduler and enables them in hardware. If anything after it fails in ice_vsi_open(), for example requesting the MSI-X vectors, the error path only frees the ring memory and leaves the queues configured. Every following open then fails to add the same queues again and the netdev can not be brought up until the driver is reloaded:
ice 0000:04:00.2: Failed to set LAN Tx queue context, error: -5 ice 0000:04:00.2 enp4s0f2np2: Failed to open VSI 0x0010 on switch 0x0002
Stop the Tx queues on the error paths that run after ice_vsi_cfg_lan(). The ice_up_complete() failure path already does it through ice_down(), so let it skip the new step.
There is no i40e counterpart of this fix, i40e does not add its Tx queues through the admin queue. It was found while verifying the previous patch. With the IRQ unwind fixed the warnings were gone, but the netdev still could not be opened again after the forced request_irq failure.
--- drivers/net/ethernet/intel/ice/ice_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +8 -2
@@ -7561,13 +7561,13 @@ int ice_vsi_open(struct ice_vsi *vsi) err =ice_vsi_cfg_lan (vsi);if (err) - goto err_setup_rx; + goto err_stop_tx;snprintf (int_name,sizeof (int_name) -1 ,"%s-%s" ,dev_driver_string (ice_pf_to_dev (pf)), vsi->netdev->name); err =ice_vsi_req_irq_msix (vsi, int_name);if (err) - goto err_setup_rx; + goto err_stop_tx;if (bitmap_empty (pf->txtime_txqs, pf->max_pf_txqs))ice_vsi_cfg_netdev_tc (vsi, vsi->tc_cfg.ena_tc);
@@ -7593,8 +7593,14 @@ int ice_vsi_open(struct ice_vsi *vsi) err_up_complete:ice_down (vsi); +ice_vsi_free_irq (vsi); + goto err_setup_rx; err_set_qs:ice_vsi_free_irq (vsi); +err_stop_tx: +ice_vsi_stop_lan_tx_rings (vsi,ICE_NO_RESET ,0 ); +if (vsi->xdp_rings) +ice_vsi_stop_xdp_tx_rings (vsi); err_setup_rx:ice_vsi_free_rx_rings (vsi); err_setup_tx:
Signature · 1 line
2.55.0
Re: [PATCH iwl-net 03/10] ice: stop the LAN Tx queues when ice_vsi_open() fails
Quoted 14 lines · Petr Oros
ice_vsi_cfg_lan()adds the LAN (and XDP) Tx queues to the scheduler and enables them in hardware. If anything after it fails inice_vsi_open(), for example requesting the MSI-X vectors, the error path only frees the ring memory and leaves the queues configured. Every following open then fails to add the same queues again and the netdev can not be brought up until the driver is reloaded:ice 0000:04:00.2: Failed to set LAN Tx queue context, error: -5 ice 0000:04:00.2 enp4s0f2np2: Failed to open VSI
0x0010on switch0x0002Stop the Tx queues on the error paths that run after
ice_vsi_cfg_lan(). Theice_up_complete()failure path already does it throughice_down(), so let it skip the new step.
Quoted 8 lines
There is no i40e counterpart of this fix, i40e does not add its Tx queues through the admin queue. It was found while verifying the previous patch. With the IRQ unwind fixed the warnings were gone, but the netdev still could not be opened again after the forced
request_irqfailure.Fixes cdedef59deb0 ("ice: Configure VSIs for Tx/Rx")Assisted-by LLM
Which one?
Otherwise...
Quoted 40 lines
Signed-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_main.c| 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +2
-2@@ -7561,13 +7561,13 @@ int ice_vsi_open(struct ice_vsi *vsi) err =ice_vsi_cfg_lan (vsi);if (err) - goto err_setup_rx; + goto err_stop_tx;snprintf (int_name,sizeof (int_name) -1 ,"%s-%s" ,dev_driver_string (ice_pf_to_dev (pf)), vsi->netdev->name); err =ice_vsi_req_irq_msix (vsi, int_name);if (err) - goto err_setup_rx; + goto err_stop_tx;if (bitmap_empty (pf->txtime_txqs, pf->max_pf_txqs))ice_vsi_cfg_netdev_tc (vsi, vsi->tc_cfg.ena_tc);@@ -7593,8 +7593,14 @@ int ice_vsi_open(struct ice_vsi *vsi)
err_up_complete:ice_down(vsi);drivers/net/ethernet/intel/ice/ice_main.c +2
-0+ice_vsi_free_irq (vsi); + goto err_setup_rx;
err_set_qs:ice_vsi_free_irq(vsi);drivers/net/ethernet/intel/ice/ice_main.c +4
-0+err_stop_tx: +ice_vsi_stop_lan_tx_rings (vsi,ICE_NO_RESET ,0 ); +if (vsi->xdp_rings) +ice_vsi_stop_xdp_tx_rings (vsi);
err_setup_rx:ice_vsi_free_rx_rings(vsi);
err_setup_tx:
Re: [PATCH iwl-net 03/10] ice: stop the LAN Tx queues when ice_vsi_open() fails
Quoted 21 lines · Ivan Vecera
Quoted 20 lines · Petr Oros
ice_vsi_cfg_lan()adds the LAN (and XDP) Tx queues to the scheduler and enables them in hardware. If anything after it fails inice_vsi_open(), for example requesting the MSI-X vectors, the error path only frees the ring memory and leaves the queues configured. Every following open then fails to add the same queues again and the netdev can not be brought up until the driver is reloaded:ice 0000:04:00.2: Failed to set LAN Tx queue context, error: -5 ice 0000:04:00.2 enp4s0f2np2: Failed to open VSI
0x0010on switch0x0002Stop the Tx queues on the error paths that run after
ice_vsi_cfg_lan(). Theice_up_complete()failure path already does it throughice_down(), so let it skip the new step.There is no i40e counterpart of this fix, i40e does not add its Tx queues through the admin queue. It was found while verifying the previous patch. With the IRQ unwind fixed the warnings were gone, but the netdev still could not be opened again after the forced
request_irqfailure.
Quoted 3 lines
Quoted 2 lines
Fixes cdedef59deb0 ("ice: Configure VSIs for Tx/Rx")Assisted-by LLMWhich one?
It was Claude Code with Claude Fable 5.1
Thanks for the review.
Petr
Quoted 46 lines
Otherwise...
Reviewed-by Ivan Vecera <[email protected]>Quoted 40 lines
Signed-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_main.c| 10 ++++++++--1 file changed, 8 insertions(+), 2 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +2
-2@@ -7561,13 +7561,13 @@ int ice_vsi_open(struct ice_vsi *vsi) err =ice_vsi_cfg_lan (vsi);if (err) - goto err_setup_rx; + goto err_stop_tx;snprintf (int_name,sizeof (int_name) -1 ,"%s-%s" ,dev_driver_string (ice_pf_to_dev (pf)), vsi->netdev->name); err =ice_vsi_req_irq_msix (vsi, int_name);if (err) - goto err_setup_rx; + goto err_stop_tx;if (bitmap_empty (pf->txtime_txqs, pf->max_pf_txqs))ice_vsi_cfg_netdev_tc (vsi, vsi->tc_cfg.ena_tc);@@ -7593,8 +7593,14 @@ int ice_vsi_open(struct ice_vsi *vsi)
err_up_complete:ice_down(vsi);drivers/net/ethernet/intel/ice/ice_main.c +2
-0+ice_vsi_free_irq (vsi); + goto err_setup_rx;
err_set_qs:ice_vsi_free_irq(vsi);drivers/net/ethernet/intel/ice/ice_main.c +4
-0+err_stop_tx: +ice_vsi_stop_lan_tx_rings (vsi,ICE_NO_RESET ,0 ); +if (vsi->xdp_rings) +ice_vsi_stop_xdp_tx_rings (vsi);
err_setup_rx:ice_vsi_free_rx_rings(vsi);
err_setup_tx:
RE: [PATCH iwl-net 03/10] ice: stop the LAN Tx queues when ice_vsi_open() fails
In reply to Petr OrosQuoted 15 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 6:08 AM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman > <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH iwl-net 03/10] ice: stop the LAN Tx queues whenice_vsi_open()fails
ice_vsi_cfg_lan()adds the LAN (and XDP) Tx queues to the scheduler and enables them in hardware. If anything after it fails inice_vsi_open(), for example requesting the MSI-X vectors, the error path only frees the ring memory and leaves the queues configured. Every following open then fails to add the same queues again and the netdev can not be brought up until the driver is reloaded:ice 0000:04:00.2: Failed to set LAN Tx queue context, error: -5 ice 0000:04:00.2 enp4s0f2np2: Failed to open VSI
0x0010on switch0x0002Stop the Tx queues on the error paths that run after
ice_vsi_cfg_lan().
Theice_up_complete()failure path already does it throughice_down(), so let it skip the new step.
Quoted 8 lines
There is no i40e counterpart of this fix, i40e does not add its Tx queues through the admin queue. It was found while verifying the previous patch. With the IRQ unwind fixed the warnings were gone, but the netdev still could not be opened again after the forced
request_irqfailure.Fixes cdedef59deb0 ("ice: Configure VSIs for Tx/Rx")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
PATCH 4/10 ice: restore the default XPS map after a netdev TC change
In reply to Petr Orosice_cfg_xps_tx_ring() programs the default XPS map only once per ring, guarded by ICE_TX_XPS_INIT_DONE. netdev_reset_tc() and netdev_set_num_tc() drop all XPS maps of the device, but the bit is never cleared, so the default map is not programmed again.
Since commit 122045ca7704 ("ice: config netdev tc before setting queues number") ice_vsi_open() calls ice_vsi_cfg_netdev_tc() after the Tx queues have been configured, so the map is wiped right after it was written on every open and stays empty:
# cat /sys/class/net/enp4s0f0np0/queues/tx-*/xps_cpus 0000 0000 ...
A DCB reconfiguration ends the same way through ice_vsi_cfg_tc().
Clear ICE_TX_XPS_INIT_DONE in ice_vsi_cfg_netdev_tc(), which resets the netdev TC state, and configure the netdev TCs in ice_vsi_open() before the Tx queues so the default map is applied after the reset, not before it.
i40e fixed the same stale bit in commit 82e0572b2302 ("i40e: Fix not setting default xps_cpus after reset").
--- drivers/net/ethernet/intel/ice/ice_lib.c | 6 ++++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +6 -0
@@ -3218,6 +3218,12 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc)if (vsi->type ==ICE_VSI_CHNL )return ; +if (vsi->tx_rings) +ice_for_each_txq (vsi, i) +if (vsi->tx_rings[i]) +clear_bit (ICE_TX_XPS_INIT_DONE , + vsi->tx_rings[i]->xps_state); +if (!ena_tc) {netdev_reset_tc (netdev);return ;
drivers/net/ethernet/intel/ice/ice_main.c +3 -3
@@ -7559,6 +7559,9 @@ int ice_vsi_open(struct ice_vsi *vsi)if (err) goto err_setup_rx; +if (bitmap_empty (pf->txtime_txqs, pf->max_pf_txqs)) +ice_vsi_cfg_netdev_tc (vsi, vsi->tc_cfg.ena_tc); + err =ice_vsi_cfg_lan (vsi);if (err) goto err_stop_tx;
@@ -7569,9 +7572,6 @@ int ice_vsi_open(struct ice_vsi *vsi)if (err) goto err_stop_tx; -if (bitmap_empty (pf->txtime_txqs, pf->max_pf_txqs)) -ice_vsi_cfg_netdev_tc (vsi, vsi->tc_cfg.ena_tc); -if (vsi->type ==ICE_VSI_PF || vsi->type ==ICE_VSI_SF ) {/* Notify the stack of the actual queue counts. */ err =netif_set_real_num_tx_queues (vsi->netdev, vsi->num_txq);
Signature · 1 line
2.55.0
Re: [PATCH iwl-net 04/10] ice: restore the default XPS map after a netdev TC change
Quoted 65 lines · Petr Oros
ice_cfg_xps_tx_ring()programs the default XPS map only once per ring, guarded byICE_TX_XPS_INIT_DONE.netdev_reset_tc()andnetdev_set_num_tc()drop all XPS maps of the device, but the bit is never cleared, so the default map is not programmed again.Since commit
122045ca7704("ice: config netdev tc before setting queues number")ice_vsi_open()callsice_vsi_cfg_netdev_tc()after the Tx queues have been configured, so the map is wiped right after it was written on every open and stays empty:# cat /sys/class/net/enp4s0f0np0/queues/tx-*/xps_cpus 0000 0000 ...A DCB reconfiguration ends the same way through
ice_vsi_cfg_tc().Clear
ICE_TX_XPS_INIT_DONEinice_vsi_cfg_netdev_tc(), which resets the netdev TC state, and configure the netdev TCs inice_vsi_open()before the Tx queues so the default map is applied after the reset, not before it.i40e fixed the same stale bit in commit
82e0572b2302("i40e: Fix not setting defaultxps_cpusafter reset").Fixes 122045ca7704 ("ice: config netdev tc before setting queues number")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_lib.c| 6 ++++++drivers/net/ethernet/intel/ice/ice_main.c| 6 +++---2 files changed, 9 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/ice/ice_lib.c +6
-0@@ -3218,6 +3218,12 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc)if (vsi->type ==ICE_VSI_CHNL )return ; +if (vsi->tx_rings) +ice_for_each_txq (vsi, i) +if (vsi->tx_rings[i]) +clear_bit (ICE_TX_XPS_INIT_DONE , + vsi->tx_rings[i]->xps_state); +if (!ena_tc) {netdev_reset_tc (netdev);return ;drivers/net/ethernet/intel/ice/ice_main.c +3
-0@@ -7559,6 +7559,9 @@ int ice_vsi_open(struct ice_vsi *vsi)if (err) goto err_setup_rx; +if (bitmap_empty (pf->txtime_txqs, pf->max_pf_txqs)) +ice_vsi_cfg_netdev_tc (vsi, vsi->tc_cfg.ena_tc); + err =ice_vsi_cfg_lan (vsi);if (err) goto err_stop_tx;
drivers/net/ethernet/intel/ice/ice_main.c int ice_vsi_open(struct ice_vsi *vsi) · line 7577
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_main.c +0
-3@@ -7569,9 +7572,6 @@ int ice_vsi_open(struct ice_vsi *vsi)if (err) goto err_stop_tx; -if (bitmap_empty (pf->txtime_txqs, pf->max_pf_txqs)) -ice_vsi_cfg_netdev_tc (vsi, vsi->tc_cfg.ena_tc); -if (vsi->type ==ICE_VSI_PF || vsi->type ==ICE_VSI_SF ) {/* Notify the stack of the actual queue counts. */ err =netif_set_real_num_tx_queues (vsi->netdev, vsi->num_txq);
RE: [PATCH iwl-net 04/10] ice: restore the default XPS map after a netdev TC change
In reply to Petr OrosQuoted 107 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 3:08 PM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH iwl-net 04/10] ice: restore the default XPS map after a netdev TC change
ice_cfg_xps_tx_ring()programs the default XPS map only once per ring, guarded byICE_TX_XPS_INIT_DONE.netdev_reset_tc()andnetdev_set_num_tc()drop all XPS maps of the device, but the bit is never cleared, so the default map is not programmed again.Since commit
122045ca7704("ice: config netdev tc before setting queues
number")ice_vsi_open()callsice_vsi_cfg_netdev_tc()after the Tx queues have been configured, so the map is wiped right after it was written on every open and stays empty:# cat /sys/class/net/enp4s0f0np0/queues/tx-*/xps_cpus 0000 0000 ...A DCB reconfiguration ends the same way through
ice_vsi_cfg_tc().Clear
ICE_TX_XPS_INIT_DONEinice_vsi_cfg_netdev_tc(), which resets the netdev TC state, and configure the netdev TCs inice_vsi_open()before the Tx queues so the default map is applied after the reset, not before it.i40e fixed the same stale bit in commit
82e0572b2302("i40e: Fix not setting defaultxps_cpusafter reset").Fixes 122045ca7704 ("ice: config netdev tc before setting queuesnumber")
Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 6 ++++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/ice/ice_lib.c +6
-0@@ -3218,6 +3218,12 @@ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc)if (vsi->type ==ICE_VSI_CHNL )return ; +if (vsi->tx_rings) +ice_for_each_txq (vsi, i) +if (vsi->tx_rings[i]) +clear_bit (ICE_TX_XPS_INIT_DONE , + vsi->tx_rings[i]->xps_state); +if (!ena_tc) {netdev_reset_tc (netdev);drivers/net/ethernet/intel/ice/ice_lib.c +0
-0return ;drivers/net/ethernet/intel/ice/ice_main.c +3
-3@@ -7559,6 +7559,9 @@ int ice_vsi_open(struct ice_vsi *vsi)if (err) goto err_setup_rx; +if (bitmap_empty (pf->txtime_txqs, pf->max_pf_txqs)) +ice_vsi_cfg_netdev_tc (vsi, vsi->tc_cfg.ena_tc); + err =ice_vsi_cfg_lan (vsi);if (err) goto err_stop_tx;@@ -7569,9 +7572,6 @@ int ice_vsi_open(struct ice_vsi *vsi)if (err) goto err_stop_tx; -if (bitmap_empty (pf->txtime_txqs, pf->max_pf_txqs)) -ice_vsi_cfg_netdev_tc (vsi, vsi->tc_cfg.ena_tc); -if (vsi->type ==ICE_VSI_PF || vsi->type ==ICE_VSI_SF ) {/* Notify the stack of the actual queue counts. */ err = netif_set_real_num_tx_queues(vsi->netdev, vsi-Quoted 1 line
num_txq);
Quoted 2 lines
--
2.55.0
RE: [PATCH iwl-net 04/10] ice: restore the default XPS map after a netdev TC change
In reply to Petr OrosQuoted 22 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 6:08 AM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman > <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH iwl-net 04/10] ice: restore the default XPS map after a netdev TC change
ice_cfg_xps_tx_ring()programs the default XPS map only once per ring, guarded byICE_TX_XPS_INIT_DONE.netdev_reset_tc()andnetdev_set_num_tc()drop all XPS maps of the device, but the bit is never cleared, so the default map is not programmed again.Since commit
122045ca7704("ice: config netdev tc before setting queues
number")ice_vsi_open()callsice_vsi_cfg_netdev_tc()after the Tx queues have been configured, so the map is wiped right after it was written on every open and stays empty:# cat /sys/class/net/enp4s0f0np0/queues/tx-*/xps_cpus 0000 0000 ...A DCB reconfiguration ends the same way through
ice_vsi_cfg_tc().Clear
ICE_TX_XPS_INIT_DONEinice_vsi_cfg_netdev_tc(), which resets the netdev TC state, and configure the netdev TCs inice_vsi_open()before the Tx queues so the default map is applied after the reset, not before it.
Quoted 8 lines
i40e fixed the same stale bit in commit
82e0572b2302("i40e: Fix not setting defaultxps_cpusafter reset").Fixes 122045ca7704 ("ice: config netdev tc before setting queues number")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 6 ++++++ drivers/net/ethernet/intel/ice/ice_main.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-)
PATCH 5/10 ice: report VF tx_dropped with tx_errors instead of tx_discards
In reply to Petr Orosice_get_vf_stats() fills tx_dropped from eth_stats.tx_discards, which ice_update_eth_stats() never updates because the GLV_TDPC register it would come from is not implemented in E810 hardware. The Tx drops of a VF, such as switch drops on an anti spoof violation, malicious driver drops or TTL expiry, are counted by GLV_TEPC into eth_stats.tx_errors instead, so the VF always reports zero dropped packets.
With spoof checking on, a VF sending 60 valid frames and 30 frames with a forged source MAC shows:
vf 0 ... spoof checking on, link-state auto, trust off
TX: bytes packets dropped
3600 60 0
Report tx_errors as tx_dropped, the VF stats have no separate error field. With the change the same test reports 30 dropped packets.
i40e fixed the same issue in commit 50b2af451597 ("i40e: report VF tx_dropped with tx_errors instead of tx_discards").
--- drivers/net/ethernet/intel/ice/ice_sriov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_sriov.c +1 -1
@@ -1640,7 +1640,7 @@ int ice_get_vf_stats(struct net_device *netdev, int vf_id, vf_stats->broadcast = stats->rx_broadcast; vf_stats->multicast = stats->rx_multicast; vf_stats->rx_dropped = stats->rx_discards; - vf_stats->tx_dropped = stats->tx_discards; + vf_stats->tx_dropped = stats->tx_errors; out_put_vf:ice_put_vf (vf);
Signature · 1 line
2.55.0
Re: [PATCH iwl-net 05/10] ice: report VF tx_dropped with tx_errors instead of tx_discards
Quoted 39 lines · Petr Oros
ice_get_vf_stats()fillstx_droppedfrom eth_stats.tx_discards, whichice_update_eth_stats()never updates because theGLV_TDPCregister it would come from is not implemented in E810 hardware. The Tx drops of a VF, such as switch drops on an anti spoof violation, malicious driver drops or TTL expiry, are counted byGLV_TEPCinto eth_stats.tx_errors instead, so the VF always reports zero dropped packets.With spoof checking on, a VF sending 60 valid frames and 30 frames with a forged source MAC shows:
vf 0 ... spoof checking on, link-state auto, trust off
TX: bytes packets dropped3600 60 0Report
tx_errorsastx_dropped, the VF stats have no separate error field. With the change the same test reports 30 dropped packets.i40e fixed the same issue in commit
50b2af451597("i40e: report VFtx_droppedwithtx_errorsinstead oftx_discards").Fixes 730fdea40bef ("ice: implement VF stats NDO")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_sriov.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_sriov.c +1
-1@@ -1640,7 +1640,7 @@ int ice_get_vf_stats(struct net_device *netdev, int vf_id, vf_stats->broadcast = stats->rx_broadcast; vf_stats->multicast = stats->rx_multicast; vf_stats->rx_dropped = stats->rx_discards; - vf_stats->tx_dropped = stats->tx_discards; + vf_stats->tx_dropped = stats->tx_errors;
out_put_vf:
Quoted 1 line
ice_put_vf(vf);
Romanowski, Rafal
Tested-byRE: [PATCH iwl-net 05/10] ice: report VF tx_dropped with tx_errors instead of tx_discards
Quoted 65 lines
-----Original Message-----
From: Ivan Vecera <[email protected]>
Sent: Saturday, October 3, 2026 11:55 AM
To: [email protected]; Oros, Petr <[email protected]>; [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH iwl-net 05/10] ice: report VFtx_droppedwithtx_errorsinstead oftx_discardsdrivers/net/ethernet/intel/ice/ice_sriov.c int ice_get_vf_stats(struct net_device *netdev, int
Quoted 33 lines · Petr Oros
ice_get_vf_stats()fillstx_droppedfrom eth_stats.tx_discards, whichice_update_eth_stats()never updates because theGLV_TDPCregister it would come from is not implemented in E810 hardware. The Tx drops of a VF, such as switch drops on an anti spoof violation, malicious driver drops or TTL expiry, are counted byGLV_TEPCinto eth_stats.tx_errors instead, so the VF always reports zero dropped packets.With spoof checking on, a VF sending 60 valid frames and 30 frames with a forged source MAC shows:
vf 0 ... spoof checking on, link-state auto, trust off
TX: bytes packets dropped3600 60 0Report
tx_errorsastx_dropped, the VF stats have no separate error field. With the change the same test reports 30 dropped packets.i40e fixed the same issue in commit
50b2af451597("i40e: report VFtx_droppedwithtx_errorsinstead oftx_discards").Fixes 730fdea40bef ("ice: implement VF stats NDO")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_sriov.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_sriov.c +0
-0@@ -1640,7 +1640,7 @@ int ice_get_vf_stats(struct net_device *netdev, int
vf_id,Quoted 6 lines
drivers/net/ethernet/intel/ice/ice_sriov.c +1
-1vf_stats->broadcast = stats->rx_broadcast; vf_stats->multicast = stats->rx_multicast; vf_stats->rx_dropped = stats->rx_discards; - vf_stats->tx_dropped = stats->tx_discards; + vf_stats->tx_dropped = stats->tx_errors;
Quoted 4 lines
Quoted 2 lines
out_put_vf:ice_put_vf(vf);Reviewed-by Ivan Vecera <[email protected]>
RE: [PATCH iwl-net 05/10] ice: report VF tx_dropped with tx_errors instead of tx_discards
In reply to Petr OrosQuoted 68 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 3:08 PM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH iwl-net 05/10] ice: report VFtx_droppedwithtx_errorsinstead oftx_discards
ice_get_vf_stats()fillstx_droppedfrom eth_stats.tx_discards, whichice_update_eth_stats()never updates because theGLV_TDPCregister it would come from is not implemented in E810 hardware. The Tx drops of a VF, such as switch drops on an anti spoof violation, malicious driver drops or TTL expiry, are counted byGLV_TEPCinto eth_stats.tx_errors instead, so the VF always reports zero dropped packets.With spoof checking on, a VF sending 60 valid frames and 30 frames with a forged source MAC shows:
vf 0 ... spoof checking on, link-state auto, trust off
TX: bytes packets dropped
3600 60 0Report
tx_errorsastx_dropped, the VF stats have no separate error field. With the change the same test reports 30 dropped packets.i40e fixed the same issue in commit
50b2af451597("i40e: report VFtx_droppedwithtx_errorsinstead oftx_discards").Fixes 730fdea40bef ("ice: implement VF stats NDO")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_sriov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_sriov.c +1
-1@@ -1640,7 +1640,7 @@ int ice_get_vf_stats(struct net_device *netdev,int vf_id, vf_stats->broadcast = stats->rx_broadcast; vf_stats->multicast = stats->rx_multicast; vf_stats->rx_dropped = stats->rx_discards; - vf_stats->tx_dropped = stats->tx_discards; + vf_stats->tx_dropped = stats->tx_errors; out_put_vf:
Quoted 3 lines
ice_put_vf(vf);
--
2.55.0
PATCH 6/10 ice: keep adding MAC filters after one that already exists
In reply to Petr Orosice_add_mac() returns as soon as one entry of the list fails, including -EEXIST for a filter that is already programmed for the VSI. The rest of the list is never added. ice_vsi_sync_fltr() treats -EEXIST as success, so the skipped addresses are considered synced and their traffic is dropped until they are removed and added again.
In a test that adds 50 multicast addresses to a port in a burst with the port MAC address in the middle of it, 19 of them were left without a filter.
Continue with the next entry on -EEXIST and report it once the whole list has been processed. Other errors still stop the loop.
There is no i40e counterpart of this fix, i40e keeps its MAC filters in a hash with a state per filter and syncs them differently. It was found while building a reproducer for the MAC filter overflow handling that i40e fixed in commit e58872398684 ("i40e: fix disabling overflow promiscuous mode") and commit 7363115efb04 ("i40e: do not force filter failure in overflow promiscuous").
Commit bbb968e8b34c ("ice: Fix issues updating VSI MAC filters") dealt with the same problem for the VF MAC filter requests, which are now added one by one with -EEXIST tolerated, but left ice_add_mac() and the PF filter sync as they were.
--- drivers/net/ethernet/intel/ice/ice_switch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_switch.c +3 -1
@@ -3659,7 +3659,9 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) m_list_itr->status =ice_add_rule_internal (hw,ICE_SW_LKUP_MAC , m_list_itr); -if (m_list_itr->status) +if (m_list_itr->status == -EEXIST ) + status = -EEXIST ; +else if (m_list_itr->status)return m_list_itr->status; }
Signature · 1 line
2.55.0
Re: [PATCH iwl-net 06/10] ice: keep adding MAC filters after one that already exists
Quoted 37 lines · Petr Oros
ice_add_mac()returns as soon as one entry of the list fails, including-EEXISTfor a filter that is already programmed for the VSI. The rest of the list is never added.ice_vsi_sync_fltr()treats-EEXISTas success, so the skipped addresses are considered synced and their traffic is dropped until they are removed and added again.In a test that adds 50 multicast addresses to a port in a burst with the port MAC address in the middle of it, 19 of them were left without a filter.
Continue with the next entry on
-EEXISTand report it once the whole list has been processed. Other errors still stop the loop.There is no i40e counterpart of this fix, i40e keeps its MAC filters in a hash with a state per filter and syncs them differently. It was found while building a reproducer for the MAC filter overflow handling that i40e fixed in commit
e58872398684("i40e: fix disabling overflow promiscuous mode") and commit7363115efb04("i40e: do not force filter failure in overflow promiscuous").Commit
bbb968e8b34c("ice: Fix issues updating VSI MAC filters") dealt with the same problem for the VF MAC filter requests, which are now added one by one with-EEXISTtolerated, but leftice_add_mac()and the PF filter sync as they were.Fixes 89f3e4a5b762 ("ice: Do not bail out when filter already exists")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_switch.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_switch.c +0
-0
drivers/net/ethernet/intel/ice/ice_switch.c int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) · line 3667
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_switch.c +3
-1@@ -3659,7 +3659,9 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) m_list_itr->status =ice_add_rule_internal (hw,ICE_SW_LKUP_MAC , m_list_itr); -if (m_list_itr->status) +if (m_list_itr->status == -EEXIST ) + status = -EEXIST ; +else if (m_list_itr->status)return m_list_itr->status; }
RE: [PATCH iwl-net 06/10] ice: keep adding MAC filters after one that already exists
In reply to Petr OrosQuoted 78 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 3:08 PM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH iwl-net 06/10] ice: keep adding MAC filters after one that already exists
ice_add_mac()returns as soon as one entry of the list fails, including-EEXISTfor a filter that is already programmed for the VSI. The rest of the list is never added.ice_vsi_sync_fltr()treats - EEXIST as success, so the skipped addresses are considered synced and their traffic is dropped until they are removed and added again.In a test that adds 50 multicast addresses to a port in a burst with the port MAC address in the middle of it, 19 of them were left without a filter.
Continue with the next entry on
-EEXISTand report it once the whole list has been processed. Other errors still stop the loop.There is no i40e counterpart of this fix, i40e keeps its MAC filters in a hash with a state per filter and syncs them differently. It was found while building a reproducer for the MAC filter overflow handling that i40e fixed in commit
e58872398684("i40e: fix disabling overflow promiscuous mode") and commit7363115efb04("i40e: do not force filter failure in overflow promiscuous").Commit
bbb968e8b34c("ice: Fix issues updating VSI MAC filters") dealt with the same problem for the VF MAC filter requests, which are now added one by one with-EEXISTtolerated, but leftice_add_mac()and the PF filter sync as they were.Fixes 89f3e4a5b762 ("ice: Do not bail out when filter alreadyexists")
Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_switch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_switch.c +3
-1@@ -3659,7 +3659,9 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) m_list_itr->status = ice_add_rule_internal(hw,ICE_SW_LKUP_MAC , m_list_itr); -if (m_list_itr->status) +if (m_list_itr->status == -EEXIST ) + status = -EEXIST ; +else if (m_list_itr->status)return m_list_itr->status;}
Quoted 2 lines
--
2.55.0
RE: [PATCH iwl-net 06/10] ice: keep adding MAC filters after one that already exists
In reply to Petr OrosQuoted 15 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 6:08 AM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman > <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH iwl-net 06/10] ice: keep adding MAC filters after one that already exists
ice_add_mac()returns as soon as one entry of the list fails, including-EEXISTfor a filter that is already programmed for the VSI. The rest of the list is never added.ice_vsi_sync_fltr()treats-EEXISTas success, so the skipped addresses are considered synced and their traffic is dropped until they are removed and added again.In a test that adds 50 multicast addresses to a port in a burst with the port MAC address in the middle of it, 19 of them were left without a filter.
Continue with the next entry on
-EEXISTand report it once the whole list has been processed. Other errors still stop the loop.There is no i40e counterpart of this fix, i40e keeps its MAC filters in a hash with a state per filter and syncs them differently. It was found while building a reproducer for the MAC filter overflow handling that i40e > fixed in commit
e58872398684("i40e: fix disabling overflow promiscuous mode") and commit7363115efb04("i40e: do not force filter failure in overflow promiscuous").
Quoted 8 lines
Commit
bbb968e8b34c("ice: Fix issues updating VSI MAC filters") dealt with the same problem for the VF MAC filter requests, which are now added one by one with-EEXISTtolerated, but leftice_add_mac()and the PF filter sync as they were.Fixes 89f3e4a5b762 ("ice: Do not bail out when filter already exists")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_switch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
PATCH 7/10 ice: take the switch rule AQ error from the response descriptor
In reply to Petr Orosice_aq_sw_rules() decides whether a rule removal failed with ENOENT by reading hw->adminq.sq_last_status after ice_aq_send_cmd() returned. That field is shared by every admin queue user and is only stable while the send queue lock is held. Another AQ command completing in between can overwrite it, so a failed removal is reported as a generic error, and a successful one can even be turned into -ENOENT, because the check is not limited to the failure case. A caller that sees -ENOENT keeps its rule bookkeeping while the rule is gone from the hardware.
ice_vsi_sync_fltr() has the same problem with ENOSPC. It checks sq_last_status only after it has freed the list of filters it tried to add. Every entry is a separate devres allocation, so freeing a list of thousands of entries takes seconds, and by then the value usually belongs to a different command, so the MAC filter overflow handling is never entered. With debug prints of the error and sq_last_status added to both places:
ice_aq_sw_rules: opc 0x2a0 status -5 aq 16
ice 0000:04:00.0 enp4s0f0np0: Failed to add MAC filters err -5 aq 0
Use the retval of the descriptor that ice_aq_send_cmd() copies back, only when the command failed, translate ENOSPC on add to -ENOSPC and let ice_vsi_sync_fltr() check the return code instead of sq_last_status.
i40e fixed the same kind of race in commit 53a9e346e159 ("i40e: Fix race condition while adding/deleting MAC/VLAN filters").
--- drivers/net/ethernet/intel/ice/ice_main.c | 4 +--- drivers/net/ethernet/intel/ice/ice_switch.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +1 -3
@@ -396,8 +396,6 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)struct device *dev =ice_pf_to_dev (vsi->back);struct net_device *netdev = vsi->netdev;bool promisc_forced_on = false; -struct ice_pf *pf = vsi->back; -struct ice_hw *hw = &pf->hw;u32 changed_flags =0 ;int err;
@@ -450,7 +448,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)* should go into promiscuous mode. There should be some * space reserved for promiscuous filters. */ -if (hw->adminq.sq_last_status ==LIBIE_AQ_RC_ENOSPC && +if (err == -ENOSPC && !test_and_set_bit (ICE_FLTR_OVERFLOW_PROMISC , vsi->state)) { promisc_forced_on = true;
drivers/net/ethernet/intel/ice/ice_switch.c +10 -3
@@ -1959,9 +1959,16 @@ ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz, desc.flags |=cpu_to_le16 (LIBIE_AQ_FLAG_RD ); cmd->num_rules_fltr_entry_index =cpu_to_le16 (num_rules); status =ice_aq_send_cmd (hw, &desc, rule_list, rule_list_sz, cd); -if (opc != ice_aqc_opc_add_sw_rules && - hw->adminq.sq_last_status ==LIBIE_AQ_RC_ENOENT ) - status = -ENOENT ; +if (status) { +enum libie_aq_err aq_err =le16_to_cpu (desc.retval) &0xff ; + +if (opc != ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOENT ) + status = -ENOENT ; +else if (opc == ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOSPC ) + status = -ENOSPC ; + }if (!status) {if (opc == ice_aqc_opc_add_sw_rules)
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH iwl-net 07/10] ice: take the switch rule AQ error from the response descriptor
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] ice: conflated -ENOSPC causes silent MAC filter drop on queue full --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ice: conflated -ENOSPC causes silent MAC filter drop on queue full --
commit 5b00f3f5a2fd8517b295e1041c4e6854bbdcfd81
Author: Petr Oros <[email protected]>
ice: take the switch rule AQ error from the response descriptor
This commit modifies how the driver extracts switch rule AQ errors by directly reading the return code from the descriptor that ice_aq_send_cmd() copies back, rather than from hw->adminq.sq_last_status. This avoids races when other commands complete and overwrite the shared last status variable.
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_main.c +0
-0
[ ... ]
drivers/net/ethernet/intel/ice/ice_main.c static int ice_vsi_sync_fltr(struct ice_vsi *vsi) · line 454
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_main.c +1
-1@@ -450,7 +448,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)* should go into promiscuous mode. There should be some * space reserved for promiscuous filters. */ -if (hw->adminq.sq_last_status ==LIBIE_AQ_RC_ENOSPC && +if (err == -ENOSPC && !test_and_set_bit (ICE_FLTR_OVERFLOW_PROMISC , vsi->state)) { promisc_forced_on = true;
[Severity: High]
Does this change unintentionally catch transient software queue exhaustion errors?
If ice_sq_send_cmd() returns a native software -ENOSPC because the control send queue is temporarily full (e.g., under heavy administrative queue load), this fallback block will now catch it.
Previously, this block was gated behind the hardware-specific hw->adminq.sq_last_status == LIBIE_AQ_RC_ENOSPC check. By changing it to check err == -ENOSPC, a temporary queue-full condition could be misidentified as a permanent hardware MAC filter limit.
This would cause the driver to erroneously set the overflow state bit and return success, dropping MAC filters and leaving the hardware permanently out of sync with the OS.
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_switch.c +0
-0
[ ... ]
drivers/net/ethernet/intel/ice/ice_switch.c ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz, · line 1971
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_switch.c +10
-0+if (status) { +enum libie_aq_err aq_err =le16_to_cpu (desc.retval) &0xff ; + +if (opc != ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOENT ) + status = -ENOENT ; +else if (opc == ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOSPC ) + status = -ENOSPC ; + }
[Severity: High]
Will this translation ignore hardware MAC filter exhaustion during rule updates?
Because the error translation is strictly gated behind
opc == ice_aqc_opc_add_sw_rules, if a rule update command (e.g., expanding a VSI list) triggers hardware exhaustion, it appears it will return a generic -EIO rather than -ENOSPC.
Additionally, native software -ENOSPC errors returned directly by ice_sq_send_cmd() will pass through unchanged, leading to the conflation issue mentioned above in ice_vsi_sync_fltr().
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
Re: [PATCH iwl-net 07/10] ice: take the switch rule AQ error from the response descriptor
Quoted 35 lines · On 10/2/26 15:27, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ice: conflated-ENOSPCcauses silent MAC filter drop on queue full --commit
5b00f3f5a2fd8517b295e1041c4e6854bbdcfd81
Author: Petr Oros <[email protected]>ice: take the switch rule AQ error from the response descriptor
This commit modifies how the driver extracts switch rule AQ errors by directly reading the return code from the descriptor that
ice_aq_send_cmd()copies back, rather than fromhw->adminq.sq_last_status. This avoids races when other commands complete and overwrite the shared last status variable.Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_main.c +0
-0[ ... ]
drivers/net/ethernet/intel/ice/ice_main.c static int ice_vsi_sync_fltr(struct ice_vsi *vsi) · line 454
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_main.c +1
-1@@ -450,7 +448,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)* should go into promiscuous mode. There should be some * space reserved for promiscuous filters. */ -if (hw->adminq.sq_last_status ==LIBIE_AQ_RC_ENOSPC && +if (err == -ENOSPC && !test_and_set_bit (ICE_FLTR_OVERFLOW_PROMISC , vsi->state)) { promisc_forced_on = true;[Severity: High]
Does this change unintentionally catch transient software queue exhaustion errors?If
ice_sq_send_cmd()returns a native software-ENOSPCbecause the control send queue is temporarily full (e.g., under heavy administrative queue load), this fallback block will now catch it.
Quoted 8 lines
Previously, this block was gated behind the hardware-specific
hw->adminq.sq_last_status==LIBIE_AQ_RC_ENOSPCcheck. By changing it to check err ==-ENOSPC, a temporary queue-full condition could be misidentified as a permanent hardware MAC filter limit.This would cause the driver to erroneously set the overflow state bit and return success, dropping MAC filters and leaving the hardware permanently out of sync with the OS.
The send queue can not be temporarily full. Commands are sent one at a time under sq_lock and each one waits for its completion, and the queue is reclaimed from the FW head pointer. It only fills up once the FW has stopped processing the AQ for 191 commands in a row, and at that point no filter can be programmed either way.
Quoted 19 lines
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_switch.c +0
-0[ ... ]
drivers/net/ethernet/intel/ice/ice_switch.c ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz, · line 1971
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_switch.c +10
-0+if (status) { +enum libie_aq_err aq_err =le16_to_cpu (desc.retval) &0xff ; + +if (opc != ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOENT ) + status = -ENOENT ; +else if (opc == ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOSPC ) + status = -ENOSPC ; + }[Severity: High]
Will this translation ignore hardware MAC filter exhaustion during rule updates?
Quoted 4 lines
Because the error translation is strictly gated behind
opc ==ice_aqc_opc_add_sw_rules, if a rule update command (e.g., expanding a VSI list) triggers hardware exhaustion, it appears it will return a generic-EIOrather than-ENOSPC.
An update modifies an existing rule and the FW does not allocate anything for it. The VSI list allocation in that path goes through ice_aq_alloc_free_res(), not through ice_aq_sw_rules(), so the translation is limited to add on purpose, the same way ca1fdb885e5f limited ENOENT to the non-add commands.
Quoted 4 lines
Additionally, native software
-ENOSPCerrors returned directly byice_sq_send_cmd()will pass through unchanged, leading to the conflation issue mentioned above inice_vsi_sync_fltr().
See above, that needs a send queue the FW stopped draining.
Re: [PATCH iwl-net 07/10] ice: take the switch rule AQ error from the response descriptor
In reply to Petr OrosQuoted 72 lines · Petr Oros
ice_aq_sw_rules()decides whether a rule removal failed with ENOENT by readinghw->adminq.sq_last_statusafterice_aq_send_cmd()returned. That field is shared by every admin queue user and is only stable while the send queue lock is held. Another AQ command completing in between can overwrite it, so a failed removal is reported as a generic error, and a successful one can even be turned into-ENOENT, because the check is not limited to the failure case. A caller that sees-ENOENTkeeps its rule bookkeeping while the rule is gone from the hardware.
ice_vsi_sync_fltr()has the same problem with ENOSPC. It checkssq_last_statusonly after it has freed the list of filters it tried to add. Every entry is a separate devres allocation, so freeing a list of thousands of entries takes seconds, and by then the value usually belongs to a different command, so the MAC filter overflow handling is never entered. With debug prints of the error andsq_last_statusadded to both places:
ice_aq_sw_rules: opc0x2a0status -5 aq 16
ice 0000:04:00.0 enp4s0f0np0: Failed to add MAC filters err -5 aq 0Use the retval of the descriptor that
ice_aq_send_cmd()copies back, only when the command failed, translate ENOSPC on add to-ENOSPCand letice_vsi_sync_fltr()check the return code instead ofsq_last_status.i40e fixed the same kind of race in commit
53a9e346e159("i40e: Fix race condition while adding/deleting MAC/VLAN filters").Fixes ca1fdb885e5f ("ice: return correct error code from ice_aq_sw_rules")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_main.c| 4 +---drivers/net/ethernet/intel/ice/ice_switch.c| 13 ++++++++++---2 files changed, 11 insertions(+), 6 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +1
-3@@ -396,8 +396,6 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)struct device *dev =ice_pf_to_dev (vsi->back);struct net_device *netdev = vsi->netdev;bool promisc_forced_on = false; -struct ice_pf *pf = vsi->back; -struct ice_hw *hw = &pf->hw;u32 changed_flags =0 ;int err;@@ -450,7 +448,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)* should go into promiscuous mode. There should be some * space reserved for promiscuous filters. */ -if (hw->adminq.sq_last_status ==LIBIE_AQ_RC_ENOSPC && +if (err == -ENOSPC && !test_and_set_bit (ICE_FLTR_OVERFLOW_PROMISC , vsi->state)) { promisc_forced_on = true;drivers/net/ethernet/intel/ice/ice_switch.c +3
-3@@ -1959,9 +1959,16 @@ ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz, desc.flags |=cpu_to_le16 (LIBIE_AQ_FLAG_RD ); cmd->num_rules_fltr_entry_index =cpu_to_le16 (num_rules); status =ice_aq_send_cmd (hw, &desc, rule_list, rule_list_sz, cd); -if (opc != ice_aqc_opc_add_sw_rules && - hw->adminq.sq_last_status ==LIBIE_AQ_RC_ENOENT ) - status = -ENOENT ; +if (status) { +enum libie_aq_err aq_err =le16_to_cpu (desc.retval) &0xff ; +
drivers/net/ethernet/intel/ice/ice_switch.c ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz, · line 1974
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_switch.c +7
-0+if (opc != ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOENT ) + status = -ENOENT ; +else if (opc == ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOSPC ) + status = -ENOSPC ; + }if (!status) {if (opc == ice_aqc_opc_add_sw_rules)
RE: [PATCH iwl-net 07/10] ice: take the switch rule AQ error from the response descriptor
In reply to Petr OrosQuoted 117 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 3:08 PM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH iwl-net 07/10] ice: take the switch rule AQ error from the response descriptor
ice_aq_sw_rules()decides whether a rule removal failed with ENOENT by readinghw->adminq.sq_last_statusafterice_aq_send_cmd()returned. That field is shared by every admin queue user and is only stable while the send queue lock is held. Another AQ command completing in between can overwrite it, so a failed removal is reported as a generic error, and a successful one can even be turned into-ENOENT, because the check is not limited to the failure case. A caller that sees - ENOENT keeps its rule bookkeeping while the rule is gone from the hardware.
ice_vsi_sync_fltr()has the same problem with ENOSPC. It checkssq_last_statusonly after it has freed the list of filters it tried to add. Every entry is a separate devres allocation, so freeing a list of thousands of entries takes seconds, and by then the value usually belongs to a different command, so the MAC filter overflow handling is never entered. With debug prints of the error andsq_last_statusadded to both places:
ice_aq_sw_rules: opc0x2a0status -5 aq 16
ice 0000:04:00.0 enp4s0f0np0: Failed to add MAC filters err -5 aq 0Use the retval of the descriptor that
ice_aq_send_cmd()copies back, only when the command failed, translate ENOSPC on add to-ENOSPCand letice_vsi_sync_fltr()check the return code instead ofsq_last_status.i40e fixed the same kind of race in commit
53a9e346e159("i40e: Fix race condition while adding/deleting MAC/VLAN filters").Fixes ca1fdb885e5f ("ice: return correct error code from
ice_aq_sw_rules")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 4 +--- drivers/net/ethernet/intel/ice/ice_switch.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +1
-3@@ -396,8 +396,6 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)struct device *dev =ice_pf_to_dev (vsi->back);struct net_device *netdev = vsi->netdev;bool promisc_forced_on = false; -struct ice_pf *pf = vsi->back; -struct ice_hw *hw = &pf->hw;u32 changed_flags =0 ;int err;@@ -450,7 +448,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)* should go into promiscuous mode. There should be some * space reserved for promiscuous filters. */ -if (hw->adminq.sq_last_status ==LIBIE_AQ_RC_ENOSPC && +if (err == -ENOSPC && !test_and_set_bit (ICE_FLTR_OVERFLOW_PROMISC , vsi->state)) { promisc_forced_on = true;drivers/net/ethernet/intel/ice/ice_switch.c +10
-3@@ -1959,9 +1959,16 @@ ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz, desc.flags |=cpu_to_le16 (LIBIE_AQ_FLAG_RD ); cmd->num_rules_fltr_entry_index =cpu_to_le16 (num_rules); status =ice_aq_send_cmd (hw, &desc, rule_list, rule_list_sz, cd); -if (opc != ice_aqc_opc_add_sw_rules && - hw->adminq.sq_last_status ==LIBIE_AQ_RC_ENOENT ) - status = -ENOENT ; +if (status) { +enum libie_aq_err aq_err =le16_to_cpu (desc.retval) &0xff ; + +if (opc != ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOENT ) + status = -ENOENT ; +else if (opc == ice_aqc_opc_add_sw_rules && + aq_err ==LIBIE_AQ_RC_ENOSPC ) + status = -ENOSPC ; + }drivers/net/ethernet/intel/ice/ice_switch.c +0
-1if (!status) {if (opc == ice_aqc_opc_add_sw_rules) --
Quoted 1 line
2.55.0
RE: [PATCH iwl-net 07/10] ice: take the switch rule AQ error from the response descriptor
In reply to Petr OrosQuoted 18 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 6:08 AM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman > <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH iwl-net 07/10] ice: take the switch rule AQ error from the response descriptor
ice_aq_sw_rules()decides whether a rule removal failed with ENOENT by readinghw->adminq.sq_last_statusafterice_aq_send_cmd()returned. That field is shared by every admin queue user and is only stable > while the send queue lock is held. Another AQ command completing in between can overwrite it, so a failed removal is reported as a generic error, and a successful one can even be turned into-ENOENT, because the check is not limited to the failure case. A caller that sees-ENOENTkeeps its rule bookkeeping while the rule is gone from the hardware.
ice_vsi_sync_fltr()has the same problem with ENOSPC. It checkssq_last_statusonly after it has freed the list of filters it tried to add. Every entry is a separate devres allocation, so freeing a list of thousands of entries takes seconds, and by then the value usually belongs to a different command, so the MAC filter overflow handling is never entered. With debug prints of the error andsq_last_statusadded to both places:
ice_aq_sw_rules: opc0x2a0status -5 aq 16
ice 0000:04:00.0 enp4s0f0np0: Failed to add MAC filters err -5 aq 0Use the retval of the descriptor that
ice_aq_send_cmd()copies back, only when the command failed, translate ENOSPC on add to-ENOSPCand letice_vsi_sync_fltr()check the return code instead ofsq_last_status.i40e fixed the same kind of race in commit
53a9e346e159("i40e: Fix race condition while adding/deleting MAC/VLAN filters").
Quoted 7 lines
Fixes ca1fdb885e5f ("ice: return correct error code from ice_aq_sw_rules")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 4 +--- drivers/net/ethernet/intel/ice/ice_switch.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-)
PATCH 8/10 ice: detect a PF reset that does not complete
In reply to Petr Orosice_pf_reset() polls PFGEN_CTRL.PFSWR for up to ICE_GLOBAL_CFG_LOCK_TIMEOUT + ICE_PF_RESET_WAIT_COUNT iterations, but the timeout check after the loop still compares the counter with ICE_PF_RESET_WAIT_COUNT alone. When the reset never completes the loop ends with cnt == 5300, the check does not match and the function returns success with PFSWR still set. A reset that completes just when the counter reaches ICE_PF_RESET_WAIT_COUNT is reported as a failure instead.
Check the PFSWR bit read last instead of the loop counter, the same way i40e_pf_reset() does after its poll loop.
--- drivers/net/ethernet/intel/ice/ice_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_common.c +1 -1
@@ -1291,7 +1291,7 @@ static int ice_pf_reset(struct ice_hw *hw)mdelay (1 ); } -if (cnt ==ICE_PF_RESET_WAIT_COUNT ) { +if (reg &PFGEN_CTRL_PFSWR_M ) {ice_debug (hw,ICE_DBG_INIT ,"PF reset polling failed to complete.\n" );return -EIO ; }
Signature · 1 line
2.55.0
Re: [PATCH iwl-net 08/10] ice: detect a PF reset that does not complete
Quoted 24 lines · Petr Oros
ice_pf_reset()polls PFGEN_CTRL.PFSWR for up toICE_GLOBAL_CFG_LOCK_TIMEOUT+ICE_PF_RESET_WAIT_COUNTiterations, but the timeout check after the loop still compares the counter withICE_PF_RESET_WAIT_COUNTalone. When the reset never completes the loop ends with cnt == 5300, the check does not match and the function returns success with PFSWR still set. A reset that completes just when the counter reachesICE_PF_RESET_WAIT_COUNTis reported as a failure instead.Check the PFSWR bit read last instead of the loop counter, the same way
i40e_pf_reset()does after its poll loop.Fixes c9a12d6d2091 ("ice: Increase timeout after PFR")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_common.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_common.c +0
-0
drivers/net/ethernet/intel/ice/ice_common.c static int ice_pf_reset(struct ice_hw *hw) · line 1297
Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_common.c +1
-1@@ -1291,7 +1291,7 @@ static int ice_pf_reset(struct ice_hw *hw)mdelay (1 ); } -if (cnt ==ICE_PF_RESET_WAIT_COUNT ) { +if (reg &PFGEN_CTRL_PFSWR_M ) {ice_debug (hw,ICE_DBG_INIT ,"PF reset polling failed to complete.\n" );return -EIO ; }
RE: [PATCH iwl-net 08/10] ice: detect a PF reset that does not complete
In reply to Petr OrosQuoted 60 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 3:08 PM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH iwl-net 08/10] ice: detect a PF reset that does not complete
ice_pf_reset()polls PFGEN_CTRL.PFSWR for up toICE_GLOBAL_CFG_LOCK_TIMEOUT+ICE_PF_RESET_WAIT_COUNTiterations, but the timeout check after the loop still compares the counter withICE_PF_RESET_WAIT_COUNTalone. When the reset never completes the loop ends with cnt == 5300, the check does not match and the function returns success with PFSWR still set. A reset that completes just when the counter reachesICE_PF_RESET_WAIT_COUNTis reported as a failure instead.Check the PFSWR bit read last instead of the loop counter, the same way
i40e_pf_reset()does after its poll loop.Fixes c9a12d6d2091 ("ice: Increase timeout after PFR")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_common.c +1
-1@@ -1291,7 +1291,7 @@ static int ice_pf_reset(struct ice_hw *hw)mdelay (1 ); } -if (cnt ==ICE_PF_RESET_WAIT_COUNT ) { +if (reg &PFGEN_CTRL_PFSWR_M ) { ice_debug(hw, ICE_DBG_INIT, "PF reset polling failed to complete.\n");return -EIO ;
Quoted 3 lines
}
--
2.55.0
RE: [PATCH iwl-net 08/10] ice: detect a PF reset that does not complete
In reply to Petr OrosQuoted 9 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 6:08 AM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman > <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH iwl-net 08/10] ice: detect a PF reset that does not complete
ice_pf_reset()polls PFGEN_CTRL.PFSWR for up toICE_GLOBAL_CFG_LOCK_TIMEOUT+ICE_PF_RESET_WAIT_COUNTiterations, but the timeout check after the loop still compares the counter withICE_PF_RESET_WAIT_COUNTalone. When the reset never completes the loop ends with cnt == 5300, the check does not match and the function returns success with PFSWR still set. A reset that completes just when the counter reachesICE_PF_RESET_WAIT_COUNTis reported as a failure instead.
Quoted 8 lines
Check the PFSWR bit read last instead of the loop counter, the same way
i40e_pf_reset()does after its poll loop.Fixes c9a12d6d2091 ("ice: Increase timeout after PFR")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 9/10 ice: program multicast magic wake before tearing down the main VSI
In reply to Petr OrosSince commit 5b246e533d01 ("ice: split probe into smaller functions") ice_remove() calls ice_setup_mc_magic_wake() after ice_deinit(), which frees pf->vsi. ice_get_main_vsi() then returns NULL and the function returns before it sends the Manage MAC Write command, so multicast magic packet wake and keeping a locally administered address across the PF reset are never set up on shutdown with WoL enabled.
Program it before the netdev and the VSIs are torn down, as it was done before that commit, so the current netdev address is used again.
i40e had a similar problem, where the multicast magic wake setup ran after the admin queue had already been shut down, and fixed it in commit e661414c98df ("i40e: Remove duplicated prepare call in i40e_shutdown").
--- drivers/net/ethernet/intel/ice/ice_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +2 -1
@@ -5456,6 +5456,8 @@ static void ice_remove(struct pci_dev *pdev)if (!ice_is_safe_mode (pf))ice_remove_arfs (pf); +ice_setup_mc_magic_wake (pf); +devl_lock (priv_to_devlink (pf));ice_dealloc_all_dynamic_ports (pf);ice_deinit_devlink (pf);
@@ -5466,7 +5468,6 @@ static void ice_remove(struct pci_dev *pdev)ice_deinit (pf);ice_vsi_release_all (pf); -ice_setup_mc_magic_wake (pf);ice_set_wake (pf);ice_adapter_put (pdev);
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH iwl-net 09/10] ice: program multicast magic wake before tearing down the main VSI
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] ice: Use-After-Free in ice_setup_mc_magic_wake() during concurrent devlink reload --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ice: Use-After-Free in ice_setup_mc_magic_wake() during concurrent devlink reload --
commit 6cf8b519dd4de7f3996192dbff4ffe7afc4d34f8
Author: Petr Oros <[email protected]>
ice: program multicast magic wake before tearing down the main VSI
This commit moves the ice_setup_mc_magic_wake() call earlier in ice_remove() before device structures are torn down. It fixes an issue where WoL magic packet wake was not set up correctly because it was being called after ice_deinit().
drivers/net/ethernet/intel/ice/ice_main.c static void ice_remove(struct pci_dev *pdev) · line 5470
Quoted 11 lines
drivers/net/ethernet/intel/ice/ice_main.c +2
-0@@ -5465,6 +5465,8 @@ static void ice_remove(struct pci_dev *pdev)if (!ice_is_safe_mode (pf))ice_remove_arfs (pf); +ice_setup_mc_magic_wake (pf); +devl_lock (priv_to_devlink (pf));
[Severity: High]
By moving ice_setup_mc_magic_wake() outside of devl_lock(), is it exposed to concurrent devlink operations like reload?
If a devlink reload operation executes concurrently with the driver's removal routine when Wake-on-LAN is enabled, the reload can call ice_unload() and ice_decfg_netdev(). This unregisters and frees the netdev.
When ice_setup_mc_magic_wake() runs unprotected by the devlink lock, can it experience a use-after-free when attempting to read the freed netdev's MAC address?
drivers/net/ethernet/intel/ice/ice_main.c:ice_setup_mc_magic_wake() {
...
if (vsi->netdev)
ether_addr_copy(mac_addr, vsi->netdev->dev_addr);
...
}Would it be safer to place the ice_setup_mc_magic_wake() call after acquiring the devlink lock?
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_main.c +0
-1ice_dealloc_all_dynamic_ports (pf);ice_deinit_devlink (pf);@@ -5475,7 +5477,6 @@ static void ice_remove(struct pci_dev *pdev)ice_deinit (pf);ice_vsi_release_all (pf); -ice_setup_mc_magic_wake (pf);ice_set_wake (pf);ice_adapter_put (pdev);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
Re: [PATCH iwl-net 09/10] ice: program multicast magic wake before tearing down the main VSI
Quoted 29 lines · On 10/2/26 15:28, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ice: Use-After-Free inice_setup_mc_magic_wake()during concurrent devlink reload --commit
6cf8b519dd4de7f3996192dbff4ffe7afc4d34f8
Author: Petr Oros <[email protected]>ice: program multicast magic wake before tearing down the main VSI
This commit moves the
ice_setup_mc_magic_wake()call earlier inice_remove()before device structures are torn down. It fixes an issue where WoL magic packet wake was not set up correctly because it was being called afterice_deinit().drivers/net/ethernet/intel/ice/ice_main.c static void ice_remove(struct pci_dev *pdev) · line 5470
Quoted 11 lines
drivers/net/ethernet/intel/ice/ice_main.c +2
-0@@ -5465,6 +5465,8 @@ static void ice_remove(struct pci_dev *pdev)if (!ice_is_safe_mode (pf))ice_remove_arfs (pf); +ice_setup_mc_magic_wake (pf); +devl_lock (priv_to_devlink (pf));[Severity: High]
By movingice_setup_mc_magic_wake()outside ofdevl_lock(), is it exposed to concurrent devlink operations like reload?
Quoted 3 lines
If a devlink reload operation executes concurrently with the driver's removal routine when Wake-on-LAN is enabled, the reload can call
ice_unload()andice_decfg_netdev(). This unregisters and frees the netdev.
A devlink reload can not run concurrently with ice_remove(). Since commit bf6b200bc80d18 ("devlink: Acquire device lock during reload command") the reload takes the device lock before the devlink instance lock, and both the PCI unbind path and device_shutdown() hold that same device lock for the whole of ice_remove().
Quoted 12 lines
When
ice_setup_mc_magic_wake()runs unprotected by the devlink lock, can it experience a use-after-free when attempting to read the freed netdev's MAC address?drivers/net/ethernet/intel/ice/ice_main.c:ice_setup_mc_magic_wake() { ... if (vsi->netdev) ether_addr_copy(mac_addr, vsi->netdev->dev_addr); ... }
Quoted 2 lines
Would it be safer to place the
ice_setup_mc_magic_wake()call after acquiring the devlink lock?
No, the netdev can not go away underneath ice_setup_mc_magic_wake() regardless of where the devlink lock is taken in ice_remove().
Quoted 11 lines
Quoted 11 lines
drivers/net/ethernet/intel/ice/ice_main.c +0
-1ice_dealloc_all_dynamic_ports (pf);ice_deinit_devlink (pf);@@ -5475,7 +5477,6 @@ static void ice_remove(struct pci_dev *pdev)ice_deinit (pf);ice_vsi_release_all (pf); -ice_setup_mc_magic_wake (pf);ice_set_wake (pf);ice_adapter_put (pdev);
Re: [PATCH iwl-net 09/10] ice: program multicast magic wake before tearing down the main VSI
In reply to Petr OrosQuoted 36 lines · Petr Oros
Since commit
5b246e533d01("ice: split probe into smaller functions")ice_remove()callsice_setup_mc_magic_wake()afterice_deinit(), which freespf->vsi.ice_get_main_vsi()then returns NULL and the function returns before it sends the Manage MAC Write command, so multicast magic packet wake and keeping a locally administered address across the PF reset are never set up on shutdown with WoL enabled.Program it before the netdev and the VSIs are torn down, as it was done before that commit, so the current netdev address is used again.
i40e had a similar problem, where the multicast magic wake setup ran after the admin queue had already been shut down, and fixed it in commit
e661414c98df("i40e: Remove duplicated prepare call ini40e_shutdown").Fixes 5b246e533d01 ("ice: split probe into smaller functions")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice_main.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_main.c +2
-0@@ -5456,6 +5456,8 @@ static void ice_remove(struct pci_dev *pdev)if (!ice_is_safe_mode (pf))ice_remove_arfs (pf); +ice_setup_mc_magic_wake (pf); +devl_lock (priv_to_devlink (pf));ice_dealloc_all_dynamic_ports (pf);ice_deinit_devlink (pf);
drivers/net/ethernet/intel/ice/ice_main.c static void ice_remove(struct pci_dev *pdev) · line 5473
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_main.c +0
-1@@ -5466,7 +5468,6 @@ static void ice_remove(struct pci_dev *pdev)ice_deinit (pf);ice_vsi_release_all (pf); -ice_setup_mc_magic_wake (pf);ice_set_wake (pf);ice_adapter_put (pdev);
RE: [PATCH iwl-net 09/10] ice: program multicast magic wake before tearing down the main VSI
In reply to Petr OrosQuoted 72 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 3:08 PM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH iwl-net 09/10] ice: program multicast magic wake before tearing down the main VSISince commit
5b246e533d01("ice: split probe into smaller functions")ice_remove()callsice_setup_mc_magic_wake()afterice_deinit(), which freespf->vsi.ice_get_main_vsi()then returns NULL and the function returns before it sends the Manage MAC Write command, so multicast magic packet wake and keeping a locally administered address across the PF reset are never set up on shutdown with WoL enabled.Program it before the netdev and the VSIs are torn down, as it was done before that commit, so the current netdev address is used again.
i40e had a similar problem, where the multicast magic wake setup ran after the admin queue had already been shut down, and fixed it in commit
e661414c98df("i40e: Remove duplicated prepare call ini40e_shutdown").Fixes 5b246e533d01 ("ice: split probe into smaller functions")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/ice/ice_main.c +2
-2@@ -5456,6 +5456,8 @@ static void ice_remove(struct pci_dev *pdev)if (!ice_is_safe_mode (pf))ice_remove_arfs (pf); +ice_setup_mc_magic_wake (pf); +devl_lock (priv_to_devlink (pf));ice_dealloc_all_dynamic_ports (pf);ice_deinit_devlink (pf);@@ -5466,7 +5468,6 @@ static void ice_remove(struct pci_dev *pdev)ice_deinit (pf);ice_vsi_release_all (pf); -ice_setup_mc_magic_wake (pf);ice_set_wake (pf);ice_adapter_put (pdev); --
Quoted 1 line
2.55.0
RE: [PATCH iwl-net 09/10] ice: program multicast magic wake before tearing down the main VSI
In reply to Petr OrosQuoted 12 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 6:08 AM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman > <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH iwl-net 09/10] ice: program multicast magic wake before tearing down the main VSISince commit
5b246e533d01("ice: split probe into smaller functions")ice_remove()callsice_setup_mc_magic_wake()afterice_deinit(), which freespf->vsi.ice_get_main_vsi()then returns NULL and the function returns before it sends the Manage MAC Write command, so multicast magic packet wake and keeping a locally administered address across the PF reset are never set up on shutdown with WoL enabled.Program it before the netdev and the VSIs are torn down, as it was done before that commit, so the current netdev address is used again.
Quoted 8 lines
i40e had a similar problem, where the multicast magic wake setup ran after the admin queue had already been shut down, and fixed it in commit
e661414c98df("i40e: Remove duplicated prepare call ini40e_shutdown").Fixes 5b246e533d01 ("ice: split probe into smaller functions")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
PATCH 10/10 ice: fix unsigned stat widths
In reply to Petr Orostx_restart, tx_busy, rx_buf_failed and rx_page_failed in struct ice_vsi are u32, but ice_update_vsi_ring_stats() fills them with sums of the 64-bit per ring counters. The values are truncated and the ethtool statistics exported from them wrap at 2^32 while the ring counters keep counting.
Make them u64 like tx_linearize next to them.
i40e fixed the same truncation in commit 3b8428b84539 ("i40e: fix unsigned stat widths").
--- drivers/net/ethernet/intel/ice/ice.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +4 -4
@@ -344,10 +344,10 @@ struct ice_vsi {u64 tx_linearize;DECLARE_BITMAP (state,ICE_VSI_STATE_NBITS );unsigned int current_netdev_flags; -u32 tx_restart; -u32 tx_busy; -u32 rx_buf_failed; -u32 rx_page_failed; +u64 tx_restart; +u64 tx_busy; +u64 rx_buf_failed; +u64 rx_page_failed;u16 num_q_vectors;/* tell if only dynamic irq allocation is allowed */ bool irq_dyn_alloc;
Signature · 1 line
2.55.0
RE: [PATCH iwl-net 10/10] ice: fix unsigned stat widths
Quoted 65 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 3:08 PM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH iwl-net 10/10] ice: fix unsigned stat widths
tx_restart,tx_busy,rx_buf_failedandrx_page_failedin structice_vsiare u32, butice_update_vsi_ring_stats()fills them with sums of the 64-bit per ring counters. The values are truncated and the ethtool statistics exported from them wrap at 2^32 while the ring counters keep counting.Make them u64 like
tx_linearizenext to them.i40e fixed the same truncation in commit
3b8428b84539("i40e: fix unsigned stat widths").Fixes fcea6f3da546 ("ice: Add stats and ethtool support")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/ice/ice.h +4
-5@@ -344,10 +344,10 @@ struct ice_vsi {u64 tx_linearize;DECLARE_BITMAP (state,ICE_VSI_STATE_NBITS );unsigned int current_netdev_flags; -u32 tx_restart; -u32 tx_busy; -u32 rx_buf_failed; -u32 rx_page_failed; +u64 tx_restart; +u64 tx_busy; +u64 rx_buf_failed; +u64 rx_page_failed;u16 num_q_vectors;/* tell if only dynamic irq allocation is allowed */ bool irq_dyn_alloc; --
Quoted 1 line
2.55.0
Re: [PATCH iwl-net 10/10] ice: fix unsigned stat widths
In reply to Petr OrosQuoted 27 lines · Petr Oros
tx_restart,tx_busy,rx_buf_failedandrx_page_failedin structice_vsiare u32, butice_update_vsi_ring_stats()fills them with sums of the 64-bit per ring counters. The values are truncated and the ethtool statistics exported from them wrap at 2^32 while the ring counters keep counting.Make them u64 like
tx_linearizenext to them.i40e fixed the same truncation in commit
3b8428b84539("i40e: fix unsigned stat widths").Fixes fcea6f3da546 ("ice: Add stats and ethtool support")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>---
drivers/net/ethernet/intel/ice/ice.h| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/ice/ice.h +0
-1@@ -344,10 +344,10 @@ struct ice_vsi {u64 tx_linearize;DECLARE_BITMAP (state,ICE_VSI_STATE_NBITS );unsigned int current_netdev_flags; -u32 tx_restart;
drivers/net/ethernet/intel/ice/ice.h struct ice_vsi { · line 353
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice.h +4
-3-u32 tx_busy; -u32 rx_buf_failed; -u32 rx_page_failed; +u64 tx_restart; +u64 tx_busy; +u64 rx_buf_failed; +u64 rx_page_failed;u16 num_q_vectors;/* tell if only dynamic irq allocation is allowed */ bool irq_dyn_alloc;
RE: [PATCH iwl-net 10/10] ice: fix unsigned stat widths
In reply to Petr OrosQuoted 11 lines
-----Original Message-----
From: Petr Oros <[email protected]>
Sent: Friday, October 2, 2026 6:08 AM
To: [email protected]
Cc: Oros, Petr <[email protected]>; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Lobakin, Aleksander <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel Borkmann <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John Fastabend <[email protected]>; Stanislav Fomichev <[email protected]>; Henry Tieman > <[email protected]>; Anirudh Venkataramanan <[email protected]>; Michal Swiatkowski <[email protected]>; Jesse Brandeburg <[email protected]>; Preethi Banala <[email protected]>; Kiran Patil <[email protected]>; Dan Nowlin <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH iwl-net 10/10] ice: fix unsigned stat widths
tx_restart,tx_busy,rx_buf_failedandrx_page_failedin structice_vsiare u32, butice_update_vsi_ring_stats()fills them with sums of the 64-bit per ring counters. The values are truncated and the ethtool statistics exported from them wrap at 2^32 while the ring counters keep counting.Make them u64 like
tx_linearizenext to them.
Quoted 8 lines
i40e fixed the same truncation in commit
3b8428b84539("i40e: fix unsigned stat widths").Fixes fcea6f3da546 ("ice: Add stats and ethtool support")Assisted-by LLMSigned-off-by Petr Oros <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)