Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexander Lopintsev" <cldlss@gmail.com>
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH net] iavf: restore queues after failed VF reset
Date: Fri, 04 Dec 2026 08:40:01 +0000	[thread overview]
Message-ID: <sashiko-outbox-249407@kernel.org> (raw)
In-Reply-To: <20261203083936.79920-1-cldlss@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] iavf: uninitialized addr_list_lock acquired in
  iavf_disable_vf()
- [Medium] iavf: iavf_add_filter() can miss re-arming MAC filter AQ
  after VF recovery
--

commit 4b2079495d73ccc01c58e17981bdaa6016d5f5fe
Author: Alexander Lopintsev <cldlss@gmail.com>

iavf: restore queues after failed VF reset

This commit extracts queue startup from iavf_open() into
iavf_start_queues(), runs it from iavf_finish_config() when an
administratively up VF finishes reinitialization, and unsyncs the netdev
unicast and multicast lists in iavf_disable_vf() so filters can be
replayed.

> 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

[ ... ]

> @@ -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 acquire an uninitialized adapter->netdev->addr_list_lock?

alloc_netdev_mqs() leaves dev->addr_list_lock zeroed, and
spin_lock_init(&dev->addr_list_lock) only runs in register_netdevice(),
which iavf_probe() defers to iavf_finish_config().  Before registration
completes, iavf_poll_virtchnl_msg() can schedule a reset during early VF
startup, and a reset timeout in iavf_reset_step() calls iavf_disable_vf()
before checking adapter->state <= __IAVF_INIT_FAILED.

Locking the uninitialized spinlock triggers a bad-magic bug under
CONFIG_DEBUG_SPINLOCK and a lockdep splat under CONFIG_LOCKDEP.  Guarding
netif_addr_lock_bh() and the unsync calls with
adapter->netdev->reg_state == NETREG_REGISTERED avoids locking before
registration.

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

[Severity: Medium]
If an rx-mode update runs while the VF is in __IAVF_COMM_FAILED, can
recovery fail to re-arm IAVF_FLAG_AQ_ADD_MAC_FILTER and leave pending MAC
filters unprogrammed on the PF?

iavf_disable_vf() leaves IFF_UP set and netif_device_present() true, so
netif_rx_mode_run() can still call iavf_set_rx_mode() during
__IAVF_COMM_FAILED.  If adapter->hw.mac.addr is also present in
netdev->uc (for example, via a bridge or MACsec upper device), the
following sequence drops IAVF_FLAG_AQ_ADD_MAC_FILTER:

rx_mode work                      watchdog / finish_config
                                  iavf_disable_vf()
                                    __dev_uc_unsync() / __dev_mc_unsync()
netif_rx_mode_run()
  iavf_set_rx_mode()
    adds filters (f->add = true)
    sets AQ_ADD_MAC_FILTER
    marks uc/mc synced
                                  iavf_watchdog_step() [__IAVF_COMM_FAILED]
                                    adapter->aq_required = 0
                                  ...
                                  iavf_finish_config()
                                    iavf_start_queues()
                                      iavf_add_filter(hw.mac.addr)
                                      iavf_set_rx_mode() <-- no-op

In iavf_start_queues(), iavf_add_filter() finds the existing entry for
hw.mac.addr and only clears f->remove without re-setting
IAVF_FLAG_AQ_ADD_MAC_FILTER, and iavf_configure() -> iavf_set_rx_mode()
does nothing because uc and mc are already synced.  All pending filters
on adapter->mac_filter_list (including multicast filters such as IPv6
solicited-node multicast) then remain unsent after the VF returns to
__IAVF_RUNNING, silently dropping matching traffic until a new address is
added or the interface is cycled down and up.

Setting IAVF_FLAG_AQ_ADD_MAC_FILTER in iavf_add_filter() when an existing
entry still has f->add set would ensure those pending filters are
replayed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203083936.79920-1-cldlss@gmail.com?part=1

  reply	other threads:[~2026-12-04  8:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  8:39 [PATCH net] iavf: restore queues after failed VF reset Alexander Lopintsev
2026-12-04  8:40 ` sashiko-bot [this message]
2026-12-04  8:47 ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-249407@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cldlss@gmail.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox