Netdev List
 help / color / mirror / Atom feed
* [PATCH net] iavf: restore queues after failed VF reset
@ 2026-12-03  8:39 Alexander Lopintsev
  2026-12-04  8:47 ` netdev-bot+sashiko
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Lopintsev @ 2026-12-03  8:39 UTC (permalink / raw)
  To: anthony.l.nguyen, przemyslaw.kitszel
  Cc: intel-wired-lan, netdev, andrew+netdev, davem, edumazet, kuba,
	pabeni

If Admin Queue initialization fails during a VF reset, iavf_disable_vf()
frees the queues and lets the watchdog retry initialization. The registered
netdev can retain IFF_UP while the adapter reaches __IAVF_DOWN. The
finish-config worker updates the queue counts but does not allocate and
enable the data queues, leaving the interface without traffic until a
manual down/up.

This was observed as a connectivity loss on a running SR-IOV guest.
Reproduce the recovery failure by returning IAVF_ERR_ADMIN_QUEUE_ERROR
once from the post-reset iavf_init_adminq() call through a lab-only hook.
Request the VF reset by changing the RX descriptor count.

Share the queue-start sequence with ndo_open and run it from
iavf_finish_config() for an already registered, administratively up VF.
Keep RTNL before the netdev lock, skip removal and pending resets, and
leave carrier updates to the existing virtchnl completion path. Clear
address synchronization state when the VF filters are discarded so that
reinitialization can replay them. Reschedule finish-config when a
follow-on reset finishes before queue restart.

Remove the unreachable RUNNING check while extracting the open sequence.
The preceding DOWN check already returns -EBUSY for RUNNING adapters.

The 2023 revert removed dev_close() from reset failures while retaining
the removal of direct IFF_UP updates. Reopening the preserved interface
after successful reinitialization restores the missing recovery step.

Two hardware A/B runs on an Intel X722 VF with an i40e PF and Ubuntu
7.0.0-38-generic reproduced carrier 0 for 30 seconds with the baseline.
With this change, the same injected failure recovered carrier and three
consecutive IPv6 replies while preserving IFF_UP. Control resets also
recovered. Testing required the one-shot source hook described
above.

The full x86 allmodconfig and allyesconfig all targets build before and
after this fix with W=1 and GCC 13.4.0. CONFIG_WERROR and
CONFIG_DRM_WERROR are disabled for existing baseline warnings, while
iavf_main.c is built with -Werror. allyesconfig uses KASAN_OUTLINE to fit
the build host; KASAN remains enabled. The fixed builds reuse completed
baseline objects and add no warnings. Kernel networking selftests and
runtime testing on the current net base have not been run.

Developed with AI assistance (Codex); reviewed with Kimi and Mistral.

Fixes: d916d273041b ("Revert "iavf: Do not restart Tx queues after reset task failure"")
Signed-off-by: Alexander Lopintsev <cldlss@gmail.com>
---
Notes for reviewers:

Przemek's XLVF v7 01/15 [1] addresses RSS and resource handling during
reinitialization after iavf_disable_vf(). This patch restores the data
queues when that reinitialization leaves a registered, administratively
up netdev in __IAVF_DOWN. The relevant posted XLVF diffs do not add this
queue restart.

Yuho's queue-disable failure patch [2] keeps rings allocated when the PF
fails VIRTCHNL_OP_DISABLE_QUEUES. Here, the injected failure is in
post-reset Admin Queue initialization. The comparison is based on the
posted diffs; combined runtime testing with either proposal has not been
performed.

The trigger of the original PF reset has not been established. The
one-shot hook reproduces the recovery failure after that reset. Hardware
A/B used the Ubuntu kernel described above; runtime testing on the net
base remains pending. The Fixes attribution follows source history,
without a hardware bisect of historical kernels.

A local C control-flow regression and an alternative hardware regression
harness are public at [3]. The public hardware harness uses fail_function
with a debug kernel. The A/B results above used the one-shot module
parameter hook; the public fail_function harness has not been
hardware-validated.

[1] https://lists.openwall.net/netdev/2026/11/21/273
[2] https://lists.openwall.net/netdev/2026/11/02/63
[3] https://github.com/alopintsev/iavf-recovery/tree/bddcb3ba700b42f25487e9027f8018047bbf06ff

 drivers/net/ethernet/intel/iavf/iavf_main.c | 107 ++++++++++++--------
 1 file changed, 66 insertions(+), 41 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 4de3ea852..c235c408f 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -14,6 +14,7 @@
 #define CREATE_TRACE_POINTS
 #include "iavf_trace.h"
 
+static int iavf_start_queues(struct iavf_adapter *adapter);
 static int iavf_setup_all_tx_resources(struct iavf_adapter *adapter);
 static int iavf_setup_all_rx_resources(struct iavf_adapter *adapter);
 static int iavf_close(struct net_device *netdev);
@@ -2003,21 +2004,23 @@ static int iavf_reinit_interrupt_scheme(struct iavf_adapter *adapter, bool runni
 static void iavf_finish_config(struct work_struct *work)
 {
 	struct iavf_adapter *adapter;
+	struct net_device *netdev;
 	bool netdev_released = false;
 	int pairs, err;
 
 	adapter = container_of(work, struct iavf_adapter, finish_config);
+	netdev = adapter->netdev;
 
 	/* Always take RTNL first to prevent circular lock dependency;
 	 * the dev->lock (== netdev lock) is needed to update the queue number.
 	 */
 	rtnl_lock();
-	netdev_lock(adapter->netdev);
+	netdev_lock(netdev);
 
 	if ((adapter->flags & IAVF_FLAG_SETUP_NETDEV_FEATURES) &&
-	    adapter->netdev->reg_state == NETREG_REGISTERED &&
+	    netdev->reg_state == NETREG_REGISTERED &&
 	    !test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
-		netdev_update_features(adapter->netdev);
+		netdev_update_features(netdev);
 		adapter->flags &= ~IAVF_FLAG_SETUP_NETDEV_FEATURES;
 	}
 
@@ -2027,33 +2030,44 @@ static void iavf_finish_config(struct work_struct *work)
 		 * state == __IAVF_DOWN
 		 */
 		pairs = adapter->num_active_queues;
-		netif_set_real_num_rx_queues(adapter->netdev, pairs);
-		netif_set_real_num_tx_queues(adapter->netdev, pairs);
+		netif_set_real_num_rx_queues(netdev, pairs);
+		netif_set_real_num_tx_queues(netdev, pairs);
 
-		if (adapter->netdev->reg_state != NETREG_REGISTERED) {
-			netdev_unlock(adapter->netdev);
+		if (netdev->reg_state != NETREG_REGISTERED) {
+			netdev_unlock(netdev);
 			netdev_released = true;
-			err = register_netdevice(adapter->netdev);
+			err = register_netdevice(netdev);
 			if (err) {
 				dev_err(&adapter->pdev->dev, "Unable to register netdev (%d)\n",
 					err);
 
 				/* go back and try again.*/
-				netdev_lock(adapter->netdev);
+				netdev_lock(netdev);
 				iavf_free_rss(adapter);
 				iavf_free_misc_irq(adapter);
 				iavf_reset_interrupt_capability(adapter);
 				iavf_change_state(adapter,
 						  __IAVF_INIT_CONFIG_ADAPTER);
-				netdev_unlock(adapter->netdev);
+				netdev_unlock(netdev);
 				goto out;
 			}
+		} else if ((netdev->flags & IFF_UP) && netif_device_present(netdev) &&
+			   !(adapter->flags & (IAVF_FLAG_PF_COMMS_FAILED |
+					       IAVF_FLAG_RESET_PENDING |
+					       IAVF_FLAG_RESET_NEEDED)) &&
+			   !test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
+			/* The netdev kept IFF_UP while the VF was down. */
+			adapter->flags |= IAVF_FLAG_QUEUES_DISABLED;
+			err = iavf_start_queues(adapter);
+			if (err)
+				netdev_err(netdev, "Failed to restart queues after VF reinitialization: %d\n",
+					   err);
 		}
 		break;
 	case __IAVF_RUNNING:
 		pairs = adapter->num_active_queues;
-		netif_set_real_num_rx_queues(adapter->netdev, pairs);
-		netif_set_real_num_tx_queues(adapter->netdev, pairs);
+		netif_set_real_num_rx_queues(netdev, pairs);
+		netif_set_real_num_tx_queues(netdev, pairs);
 		break;
 
 	default:
@@ -2062,7 +2076,7 @@ static void iavf_finish_config(struct work_struct *work)
 
 out:
 	if (!netdev_released)
-		netdev_unlock(adapter->netdev);
+		netdev_unlock(netdev);
 	rtnl_unlock();
 }
 
@@ -3068,7 +3082,11 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
 		iavf_free_all_rx_resources(adapter);
 	}
 
+	/* Startup must be able to replay addresses whose VF filters are lost. */
+	netif_addr_lock_bh(adapter->netdev);
 	spin_lock_bh(&adapter->mac_vlan_list_lock);
+	__dev_uc_unsync(adapter->netdev, NULL);
+	__dev_mc_unsync(adapter->netdev, NULL);
 
 	/* Delete all of the filters */
 	list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
@@ -3083,6 +3101,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
 	adapter->num_vlan_filters = 0;
 
 	spin_unlock_bh(&adapter->mac_vlan_list_lock);
+	netif_addr_unlock_bh(adapter->netdev);
 
 	spin_lock_bh(&adapter->cloud_filter_list_lock);
 	list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, list) {
@@ -3341,6 +3360,9 @@ void iavf_reset_step(struct iavf_adapter *adapter)
 	} else {
 		iavf_change_state(adapter, __IAVF_DOWN);
 		wake_up(&adapter->down_waitqueue);
+		/* A follow-on reset can finish before the queues were restarted. */
+		if (netif_running(netdev))
+			iavf_schedule_finish_config(adapter);
 	}
 
 	adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED;
@@ -4472,39 +4494,13 @@ static void iavf_restore_fdir_filters(struct iavf_adapter *adapter)
 	spin_unlock_bh(&adapter->fdir_fltr_lock);
 }
 
-/**
- * iavf_open - Called when a network interface is made active
- * @netdev: network interface device structure
- *
- * Returns 0 on success, negative value on failure
- *
- * The open entry point is called when a network interface is made
- * active by the system (IFF_UP).  At this point all resources needed
- * for transmit and receive operations are allocated, the interrupt
- * handler is registered with the OS, the watchdog is started,
- * and the stack is notified that the interface is ready.
- **/
-static int iavf_open(struct net_device *netdev)
+static int iavf_start_queues(struct iavf_adapter *adapter)
 {
-	struct iavf_adapter *adapter = netdev_priv(netdev);
+	struct net_device *netdev = adapter->netdev;
 	int err;
 
 	netdev_assert_locked(netdev);
 
-	if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) {
-		dev_err(&adapter->pdev->dev, "Unable to open device due to PF driver failure.\n");
-		return -EIO;
-	}
-
-	if (adapter->state != __IAVF_DOWN)
-		return -EBUSY;
-
-	if (adapter->state == __IAVF_RUNNING &&
-	    !test_bit(__IAVF_VSI_DOWN, adapter->vsi.state)) {
-		dev_dbg(&adapter->pdev->dev, "VF is already open.\n");
-		return 0;
-	}
-
 	/* allocate transmit descriptors */
 	err = iavf_setup_all_tx_resources(adapter);
 	if (err)
@@ -4545,6 +4541,35 @@ static int iavf_open(struct net_device *netdev)
 	return err;
 }
 
+/**
+ * iavf_open - Called when a network interface is made active
+ * @netdev: network interface device structure
+ *
+ * Returns 0 on success, negative value on failure
+ *
+ * The open entry point is called when a network interface is made
+ * active by the system (IFF_UP).  At this point all resources needed
+ * for transmit and receive operations are allocated, the interrupt
+ * handler is registered with the OS, the watchdog is started,
+ * and the stack is notified that the interface is ready.
+ **/
+static int iavf_open(struct net_device *netdev)
+{
+	struct iavf_adapter *adapter = netdev_priv(netdev);
+
+	netdev_assert_locked(netdev);
+
+	if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) {
+		dev_err(&adapter->pdev->dev, "Unable to open device due to PF driver failure.\n");
+		return -EIO;
+	}
+
+	if (adapter->state != __IAVF_DOWN)
+		return -EBUSY;
+
+	return iavf_start_queues(adapter);
+}
+
 /**
  * iavf_close - Disables a network interface
  * @netdev: network interface device structure

base-commit: 0d39bf81267861742b80d5f1c52e8a63e9ca0ca1
-- 
2.50.1 (Apple Git-155)


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

* Re: [PATCH net] iavf: restore queues after failed VF reset
  2026-12-03  8:39 [PATCH net] iavf: restore queues after failed VF reset Alexander Lopintsev
@ 2026-12-04  8:47 ` netdev-bot+sashiko
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sashiko @ 2026-12-04  8:47 UTC (permalink / raw)
  To: cldlss
  Cc: anthony.l.nguyen, przemyslaw.kitszel, intel-wired-lan, netdev,
	andrew+netdev, davem, edumazet, kuba, pabeni

Thank you for your contribution! Sashiko AI review found 6 potential
issue(s) to consider.

Critical: 0 · High: 0 (1) · Medium: 5 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The patch replays the uc/mc addresses that iavf_disable_vf()
  discards, but not the VLAN filters it frees in the same block.
- [Medium] If iavf_start_queues() fails when called from
  iavf_finish_config(), the error is only logged with netdev_err() and…
- [Medium] iavf_disable_vf() now calls
  netif_addr_lock_bh(adapter->netdev) and walks dev->uc/dev->mc whether…
- [Medium] On resume, the new queue restart can be skipped and never
  retried.
- [Medium] iavf: iavf_add_filter() can miss re-arming MAC filter AQ after
  VF recovery
- [Low] The commit message misdescribes the history it cites.

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but
  iavf_clear_mac_filters(), called from iavf_down(), runs…

--

iavf: restore queues after failed VF reset

This patch moves the queue start sequence out of iavf_open() into a new
iavf_start_queues(). iavf_finish_config() now calls it when a registered
netdev is still IFF_UP but the adapter is in __IAVF_DOWN after a failed
reset. The patch also clears the uc/mc sync state in iavf_disable_vf() so
the addresses can be replayed, and iavf_reset_step() reschedules
finish_config when the netdev is running.

> The 2023 revert removed dev_close() from reset failures while retaining
> the removal of direct IFF_UP updates. Reopening the preserved interface
> after successful reinitialization restores the missing recovery step.

[Severity: Low]
Is this description of the history accurate?

Commit 08f1c147b726 removed the direct IFF_UP clear from iavf_disable_vf()
and added dev_close() on both reset failure paths. The revert d916d273041b
then removed those dev_close() calls and kept the removal of the IFF_UP
update.

So the revert dropped a close. That close cleared IFF_UP and left it to
the administrator to bring the interface up again. As far as I can tell,
the driver never restarted the data path by itself after a VF disabled
event.

Would it be more accurate to call the automatic restart new recovery
behaviour, rather than a missing step being restored? The Fixes tag itself
looks reasonable, since d916d273041b is where IFF_UP started to persist
without queues.

> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
> index 4de3ea8525b3f..c235c408f0a5b 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_main.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c

[ ... ]

> @@ -2027,33 +2030,44 @@ static void iavf_finish_config(struct work_struct *work)

[ ... ]

> +		} else if ((netdev->flags & IFF_UP) && netif_device_present(netdev) &&
> +			   !(adapter->flags & (IAVF_FLAG_PF_COMMS_FAILED |
> +					       IAVF_FLAG_RESET_PENDING |
> +					       IAVF_FLAG_RESET_NEEDED)) &&
> +			   !test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {

[Severity: Medium]
Can this restart be skipped on resume and then never retried?

iavf_resume() queues the reset task before it marks the device present:

iavf_resume() {
    ...
	queue_work(adapter->wq, &adapter->reset_task);

	netif_device_attach(adapter->netdev);
    ...
}

netif_device_attach() takes neither RTNL nor the netdev lock.

Suppose the VF was suspended with the adapter in __IAVF_DOWN and the
netdev IFF_UP. On resume, iavf_reset_step() takes the !running branch, and
the new iavf_schedule_finish_config() call queues finish_config.

If iavf_finish_config() gets the locks before the resume thread reaches
netif_device_attach(), netif_device_present() is false here. In that case
iavf_start_queues() is skipped without any message.

Nothing requeues finish_config after the attach. Would the interface then
stay up with no data queues?

> +			/* The netdev kept IFF_UP while the VF was down. */
> +			adapter->flags |= IAVF_FLAG_QUEUES_DISABLED;
> +			err = iavf_start_queues(adapter);
> +			if (err)
> +				netdev_err(netdev, "Failed to restart queues after VF reinitialization: %d\n",
> +					   err);
>  		}

[Severity: Medium]
What happens if iavf_start_queues() fails here?

It can fail in iavf_setup_all_tx_resources(),
iavf_setup_all_rx_resources() or iavf_request_traffic_irqs(). The unwind
frees the traffic IRQs and the Tx/Rx rings, and the adapter stays in
__IAVF_DOWN. IFF_UP and __LINK_STATE_START stay set, because nothing calls
dev_close().

Nothing tries again after that:

- finish_config is not requeued.
- No reset is scheduled.
- The watchdog does not restart queues in __IAVF_DOWN.

Doesn't that leave the interface up with no traffic until a manual
down/up, which is the state this patch is trying to fix?

The running branch in iavf_reset_step() handles the same allocation
failures by going to reset_err and iavf_disable_vf(), which leads to
another watchdog reinit. Should this path have a similar retry?

[ ... ]

> @@ -3068,7 +3082,11 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
>  		iavf_free_all_rx_resources(adapter);
>  	}
>  
> +	/* Startup must be able to replay addresses whose VF filters are lost. */
> +	netif_addr_lock_bh(adapter->netdev);

[Severity: Medium]
Can this take addr_list_lock before it has been initialized?

dev->addr_list_lock is only initialized in register_netdevice():

register_netdevice() {
    ...
	spin_lock_init(&dev->addr_list_lock);
	netdev_set_addr_lockdep_class(dev);
    ...
}

iavf_disable_vf() can run before the netdev is registered.

During first probe, iavf_poll_virtchnl_msg() can schedule reset_task on
VIRTCHNL_EVENT_RESET_IMPENDING. iavf_reset_step() then calls
iavf_disable_vf() on the "Reset never finished" path, before the
early-restart check:

iavf_reset_step() {
    ...
	if (i == IAVF_RESET_WAIT_COMPLETE_COUNT) {
		dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n", reg_val);
		iavf_disable_vf(adapter);
		return;
	}

continue_reset:
	/* If we are still early in the state machine, just restart. */
	if (adapter->state <= __IAVF_INIT_FAILED) {
    ...
}

A reset can also reach reset_err after iavf_init_config_adapter() sets
__IAVF_DOWN but before iavf_finish_config() calls register_netdevice().
That path ends up here too.

With CONFIG_DEBUG_SPINLOCK this reports a spinlock with bad magic. With
lockdep it reports "trying to register non-static key".

Should the address lock and the unsync be skipped when netdev->reg_state
is not NETREG_REGISTERED?

>  	spin_lock_bh(&adapter->mac_vlan_list_lock);
> +	__dev_uc_unsync(adapter->netdev, NULL);
> +	__dev_mc_unsync(adapter->netdev, NULL);

[Severity: Medium]
Can the uc/mc addresses that are unsynced here get stuck on
adapter->mac_filter_list without ever being sent to the PF?

After iavf_disable_vf() the netdev keeps IFF_UP and stays present, so
the core rx mode path (netif_rx_mode_run()) can still call
iavf_set_rx_mode() while the watchdog sits in __IAVF_COMM_FAILED.
iavf_set_rx_mode() has no IAVF_FLAG_PF_COMMS_FAILED or state check.
Because the entries in netdev->uc and netdev->mc now have sync_cnt of
0, __hw_addr_sync_dev() calls iavf_addr_sync()->iavf_add_filter() for
each of them. They land on mac_filter_list with f->add set,
IAVF_FLAG_AQ_ADD_MAC_FILTER is set, and the core lists are marked
synced again.

The next watchdog tick in __IAVF_COMM_FAILED then does:

	adapter->aq_required = 0;
	adapter->current_op = VIRTCHNL_OP_UNKNOWN;

This drops IAVF_FLAG_AQ_ADD_MAC_FILTER but leaves the entries pending
on the list. The polled init states up to __IAVF_INIT_CONFIG_ADAPTER do
not set the flag again.

When iavf_finish_config() later calls iavf_start_queues(), the
iavf_add_filter() call for adapter->hw.mac.addr only re-arms the flag
when it creates a new entry. If hw.mac.addr was already pulled in from
netdev->uc, it takes the existing-entry branch:

	} else {
		f->remove = false;
	}

A bridge static FDB, a macsec upper device or PACKET_MR_UNICAST can
put dev_addr into netdev->uc, and iavf_addr_unsync() already
special-cases that.

iavf_configure()->iavf_set_rx_mode() is then a no-op because every
address is already synced, and iavf_up_complete() moves the adapter to
__IAVF_RUNNING with the flag still clear. iavf_add_ether_addrs() is
never called, so the multicast filters, including the IPv6
solicited-node groups needed for neighbour discovery, and any secondary
unicast filters are never programmed on the PF. Traffic for them is
dropped until an unrelated address change sets the flag again or the
interface is cycled down and up.

Before this patch the core lists stayed synced across
iavf_disable_vf(), so only addresses added in that window could hit
this.

Should iavf_add_filter() set IAVF_FLAG_AQ_ADD_MAC_FILTER whenever the
existing entry still has f->add set? Or should iavf_set_rx_mode() avoid
syncing while IAVF_FLAG_PF_COMMS_FAILED is set, so the replay happens
from iavf_start_queues() as intended?

[Severity: High]
This isn't a bug introduced by this patch, but there is a related
locking problem. This hunk takes netif_addr_lock_bh() around
__dev_uc_unsync() and __dev_mc_unsync(). iavf_clear_mac_filters(), called
from iavf_down(), does the same unsync with only mac_vlan_list_lock held:

iavf_clear_mac_filters() {
	spin_lock_bh(&adapter->mac_vlan_list_lock);
	/* clear the sync flag on all filters */
	__dev_uc_unsync(adapter->netdev, NULL);
	__dev_mc_unsync(adapter->netdev, NULL);
    ...
}

Some writers of the address lists hold only addr_list_lock and not RTNL.
One example is this path, reachable by an unprivileged
IPV6_ADD_MEMBERSHIP:

__ipv6_sock_mc_join()->__ipv6_dev_mc_inc()->igmp6_group_added()->
dev_mc_add()

Upper devices can also call dev_uc_sync() or dev_mc_sync() on iavf with
only its address lock held.

Can __hw_addr_unsync_dev() from iavf_down() race with these writers? The
race would be on the netdev_hw_addr list and rbtree, and on the
non-atomic sync_cnt and refcount updates.

Should iavf_clear_mac_filters() also take netif_addr_lock_bh(), like the
new code here?

>  
>  	/* Delete all of the filters */
>  	list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
> @@ -3083,6 +3101,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
>  	adapter->num_vlan_filters = 0;
>  
>  	spin_unlock_bh(&adapter->mac_vlan_list_lock);
> +	netif_addr_unlock_bh(adapter->netdev);

[Severity: Medium]
The uc/mc addresses are now unsynced so that iavf_configure()->
iavf_set_rx_mode() can replay them. What restores the VLAN filters that
are freed in the same locked section?

iavf_disable_vf() frees every entry on adapter->vlan_filter_list and sets
num_vlan_filters to 0.

In iavf_virtchnl_completion(), the VLAN replay for
VIRTCHNL_OP_GET_VF_RESOURCES and VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS only
re-marks entries that are already on that list:

	if (!list_empty(&adapter->vlan_filter_list)) {
		/* re-add all VLAN filters over virtchnl */

Only iavf_add_vlan() creates new entries, and it is reached only from
ndo_vlan_rx_add_vid(). The stack won't call that again for VIDs it already
considers installed.

netdev_update_features() in iavf_finish_config() doesn't push them either,
because NETIF_F_HW_VLAN_CTAG_FILTER doesn't toggle.

Cloud filters on adapter->cloud_filter_list are freed the same way, while
tc still holds them.

After the automatic restart in iavf_finish_config(), the primary MAC, the
uc/mc addresses and the FDIR filters are restored. Would VLAN
sub-interfaces and ADq filters be left with no matching VF filters?

On a PF that enforces VLAN pruning, VLAN traffic would be dropped. On
i40e, the forgotten VIDs would start being dropped once any new VLAN is
added.

Freeing the VLAN list predates this patch, and a manual down/up never
restored it either. The commit message does say that reinitialization can
replay the filters that were discarded.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203083936.79920-1-cldlss%40gmail.com

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

end of thread, other threads:[~2026-12-04  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  8:39 [PATCH net] iavf: restore queues after failed VF reset Alexander Lopintsev
2026-12-04  8:47 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox