From: netdev-bot+sashiko@kernel.org
To: satishkh@cisco.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
willemb@google.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, sebaddel@cisco.com,
aradhana@cisco.com, rfaucett@cisco.com
Subject: Re: [PATCH net-next v4 3/6] enic: recover V2 VF mailbox after request failure
Date: Tue, 01 Dec 2026 14:04:50 +0000 [thread overview]
Message-ID: <179613389066.3146.6241038227181892804@kernel.org> (raw)
In-Reply-To: <20261130-b4-enic-sriov-v2-vf-receive-control-v4-3-5858d5a9ecb1@cisco.com>
Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 2 (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 commit is titled and framed as V2 VF mailbox recovery, but
it changes the shared reset, stop and open paths of every ENIC device.
- [Medium] The RX quarantine is not armed for internal resets that are
not caused by a mailbox fault.
- [Medium] A mailbox fault that arrives while a recovery worker is
running is dropped if it also makes that recovery fail.
- [Low] At this commit, several new comments describe behaviour that only
later patches add.
- [Low] The schedule_reset_on_failure parameter of __enic_open() and the
helper enic_schedule_datapath_reset() are dead code.
Pre-existing issues:
- [Low] When a generic WQ/RQ disable fails in __enic_stop(), the code
jumps to stop_failed after datapath_open has already been cleared.
--
enic: recover V2 VF mailbox after request failure
This patch adds V2 VF mailbox recovery after a lost reply or a
send-completion timeout. Recovery runs on a dedicated work item and shares
the hang-reset sequence with the Tx watchdog. The patch also reworks the
shared open, stop and reset paths: it tracks datapath_open, takes
devcmd_lock around the reset polls, issues runtime CMD_INIT after soft
reset, and detaches the netdev when recovery fails.
> diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
> index dde9098357d16..9c4b94a949809 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_main.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_main.c
[ ... ]
> @@ -1743,6 +1760,37 @@ static int enic_open(struct net_device *netdev)
> enic_admin_channel_is_quarantined(enic))
> return -EBUSY;
>
[ ... ]
> + if (enic_is_sriov_vf_v2(enic) &&
> + (READ_ONCE(enic->admin_chan_state) != ENIC_ADMIN_CHAN_LIVE ||
> + READ_ONCE(enic->mbox_tx_poisoned) ||
> + !READ_ONCE(enic->vf_registered) ||
> + READ_ONCE(enic->vf_mbox_reconnect_required))) {
> + /* Re-registration makes the PF discard the old VF-requested
> + * filters. Clear the netdev-core synchronization state so the
> + * receive-mode callback replays the current address lists.
> + */
> + enic_reset_addr_lists(enic);
> + if (READ_ONCE(enic->admin_chan_state) !=
> + ENIC_ADMIN_CHAN_DOWN) {
> + err = enic_admin_channel_close(enic);
> + if (READ_ONCE(enic->admin_chan_state) !=
> + ENIC_ADMIN_CHAN_DOWN) {
> + if (schedule_reset_on_failure &&
> + !enic_admin_channel_is_quarantined(enic))
> + enic_schedule_datapath_reset(enic);
> + return err ?: -EBUSY;
[Severity: Low]
Can this branch ever call enic_schedule_datapath_reset()?
The quarantined check just above returns -EBUSY before this block runs. So
enic_admin_channel_close() is only reached here with the channel LIVE.
>From LIVE, enic_admin_channel_close() ends in one of two states. It is
QUARANTINED if the WQ or RQ disable fails. Otherwise it is DOWN, through
enic_admin_channel_release(). The state enum has only DOWN, LIVE and
QUARANTINED.
So "state != DOWN" implies quarantined here, and the inner condition looks
unreachable. That would make enic_schedule_datapath_reset() dead code, and
the schedule_reset_on_failure flag passed through enic_open(), enic_reset()
and enic_hang_reset() would have no effect. Could both be dropped? This is
unchanged at the end of the series.
> + }
> + }
[ ... ]
> @@ -1840,13 +1934,23 @@ static int enic_open(struct net_device *netdev)
> return err;
> }
>
> +static int enic_open(struct net_device *netdev)
> +{
> + return __enic_open(netdev, true);
> +}
> +
> /* rtnl lock is held, process context */
> -static int enic_stop(struct net_device *netdev)
> +static int __enic_stop(struct net_device *netdev)
> {
> struct enic *enic = netdev_priv(netdev);
> unsigned int i;
> int err;
>
> + /* IFF_UP can outlive a failed internal recovery. Stop software once. */
> + if (!READ_ONCE(enic->datapath_open))
> + return 0;
> + WRITE_ONCE(enic->datapath_open, false);
> +
[Severity: Medium]
The subject limits this to V2 VF mailbox recovery. Several changes here
affect every ENIC device and fix older bugs. Should they be split out with
their own Fixes: tags?
Compared with the baseline, these look like standalone fixes:
- The datapath_open guard. In the baseline, a failed enic_open() in
enic_reset() could leave IFF_UP set. A later dev_close() then ran
enic_stop() and called napi_disable() a second time.
- Moving enic_free_intr() before the queue disables. Baseline
enic_stop() returned before freeing the IRQs when vnic_wq_disable() or
vnic_rq_disable() failed.
- The devcmd_lock in enic_dev_soft_reset_start(),
enic_dev_soft_reset_done() and enic_dev_hang_reset_start(). Baseline
enic_dev_wait() called the reset helpers without the lock, so they
could collide with CMD_STATS_DUMP.
These change behaviour for PFs and other non-VF functions:
- enic_reset() now issues CMD_INIT through enic_vnic_dev_init() after
SOFT_RESET for every non-dynamic function.
- A failed soft reset, hang reset, INIT or queue stop now calls
enic_detach_after_recovery_failure() on any ENIC device. The driver
has no netif_device_attach(), so only a rebind recovers.
- The soft reset fallback in vnic_dev_hang_reset() no longer runs
vnic_dev_init() inline. INIT is now deferred, and dynamic vNICs do not
get it at all.
Several smaller, unrelated changes are also included:
- netif_addr_lock_bh() in enic_reset_addr_lists()
- the VF ACK worker
- CQ VLAN sender filtering in enic_admin_rq_cq_service()
- the netif_device_present() checks in enic_set_ringparam()
With everything in one commit, stable trees cannot take the hang, IRQ-leak
or devcmd fixes on their own. A bisect of a PF reset regression would also
land on a commit whose subject says it only touches V2 VFs.
[ ... ]
> @@ -1871,23 +1975,25 @@ static int enic_stop(struct net_device *netdev)
> napi_disable(&enic->napi[enic_cq_wq(enic, i)]);
> netif_tx_disable(netdev);
>
> + /* Detach IRQ callbacks even if a later queue disable fails. */
> + enic_unset_affinity_hint(enic);
> + enic_free_intr(enic);
> +
> if (!enic_is_dynamic(enic) && !enic_is_sriov_vf(enic))
> enic_dev_del_station_addr(enic);
>
> for (i = 0; i < enic->wq_count; i++) {
> err = vnic_wq_disable(&enic->wq[i].vwq);
> if (err)
> - return err;
> + goto stop_failed;
> }
> for (i = 0; i < enic->rq_count; i++) {
> err = vnic_rq_disable(&enic->rq[i].vrq);
> if (err)
> - return err;
> + goto stop_failed;
> }
>
> enic_dev_notify_unset(enic);
> - enic_unset_affinity_hint(enic);
> - enic_free_intr(enic);
>
> for (i = 0; i < enic->wq_count; i++)
> vnic_wq_clean(&enic->wq[i].vwq, enic_free_wq_buf);
> @@ -1902,6 +2008,18 @@ static int enic_stop(struct net_device *netdev)
> vnic_intr_clean(&enic->intr[i]);
>
> return 0;
> +
> +stop_failed:
> + /* Prevent another open from treating this partial stop as a clean one.
> + * Generic queue DMA lifetime after a stop failure is separate work.
> + */
> + enic_detach_after_recovery_failure(enic);
> + return err;
> +}
[Severity: Low]
This isn't a bug introduced by this patch, but the stop_failed path leaves
the datapath resources allocated, and nothing frees them later.
datapath_open was already cleared at the top of __enic_stop(). A later
dev_close() or unregister_netdev()->enic_stop() therefore returns 0 at
once. These calls never run:
- enic_dev_notify_unset()
- vnic_wq_clean()
- vnic_rq_clean() with page_pool_destroy()
- vnic_cq_clean()
__enic_open() behaves the same way on its late unwind path when stop_err
is set. The TX buffers and the pools of RQs that failed to disable are
kept.
Baseline enic_stop() also returned early on the same error, and the commit
message calls this separate work. Keeping buffers for a queue that may
still be running avoids DMA into freed memory, so this may be deliberate.
Is a follow-up planned for these resources?
[ ... ]
> @@ -2215,12 +2422,13 @@ static bool enic_control_dma_unresolved(struct enic *enic)
> * handshake (the reset wiped the VF's admin QP, so the VF must register
> * again), or for a PF re-push the current link state to registered VFs.
> */
> -static void enic_admin_chan_reopen(struct enic *enic)
> +static int enic_admin_chan_reopen(struct enic *enic)
> {
[Severity: Low]
The header comment of enic_admin_chan_reopen() still says it re-establishes
the channel "after a reset has re-created the data path". For V2 VFs it now
runs before the datapath reopen, from enic_reset(), enic_hang_reset() and
__enic_open(). The comment also doesn't describe the new int return. Could
it be updated?
Some other new comments describe behaviour that only later patches in the
series add:
- The late check in __enic_open() says "while station and receive
policy were being programmed". At this commit, VF station install is
skipped and enic_set_rx_mode() uses devcmds.
- enic_reset() and enic_hang_reset() say "A V2 VF needs PF registration
before enic_open() can install its station address."
- enic_mbox_wait_reply() says the reconnect decision is "an
operation-specific decision made by the caller". No caller makes that
decision yet.
These become accurate after "enic: manage V2 VF station and administrative
MAC" and "enic: configure V2 VF receive mode over mailbox". The
enic_admin_chan_reopen() header comment is still stale at the end of the
series.
[ ... ]
> @@ -2271,135 +2511,342 @@ static void enic_admin_chan_reopen(struct enic *enic)
[ ... ]
> +static bool enic_vf_mbox_recovery_finish(struct enic *enic, bool succeeded)
> +{
> + bool restart;
> +
> + spin_lock_bh(&enic->mbox_state_lock);
> + /* Restart only for a fault still outstanding after recovery. Fresh
> + * registration may already have consumed a fault from the old channel.
> + * A failed handshake remains quarantined for an external recovery event.
> + */
> + restart = succeeded &&
> + (READ_ONCE(enic->vf_mbox_reconnect_required) ||
> + READ_ONCE(enic->mbox_tx_poisoned));
> + enic->vf_mbox_recovery_active = false;
> + spin_unlock_bh(&enic->mbox_state_lock);
> +
> + return restart;
> +}
[Severity: Medium]
What happens to a mailbox fault that arrives while recovery is running and
also makes that recovery fail?
enic_vf_mbox_recovery_work()
enic_hang_reset(enic, true)
enic_vf_mbox_recovery_begin() /* vf_mbox_recovery_active = true */
enic_admin_chan_reopen()
enic_admin_channel_open() /* channel is LIVE again */
enic_mbox_vf_capability_check() / enic_mbox_vf_register()
Meanwhile, on the admin RX path:
enic_admin_msg_enqueue() /* kmalloc failure or backlog full */
enic_admin_rx_lost()
enic_mbox_vf_require_reconnect()
vf_mbox_fault_generation++
enic_mbox_vf_kick_recovery() /* recovery_active, not scheduled */
A bad length, truncation, bad FCS or a send timeout in
enic_mbox_send_msg_id() follows the same path.
enic_admin_chan_reopen() then returns -EAGAIN from the generation check, or
the late check in __enic_open() returns -EIO. Either way,
enic_vf_mbox_recovery_finish(enic, false) returns restart == false, and
nothing is scheduled.
The VF is left in this state:
- IFF_UP still set
- datapath stopped and IRQs freed
- admin channel DOWN
- carrier off
- netdev still attached
None of the automatic recovery triggers can fire in this state. The Tx
watchdog needs carrier, the error IRQ has been freed, and new mailbox
faults need a LIVE channel. Only a manual down/up seems to recover it.
Should a suppressed kick be remembered, or should finish() restart when
vf_mbox_fault_generation changed during the recovery? The -EAGAIN return
implies a retry that never happens. This is unchanged at the end of the
series.
[ ... ]
> diff --git a/drivers/net/ethernet/cisco/enic/enic_mbox.c b/drivers/net/ethernet/cisco/enic/enic_mbox.c
> index d1b6f13c8002f..3579d2980a246 100644
> --- a/drivers/net/ethernet/cisco/enic/enic_mbox.c
> +++ b/drivers/net/ethernet/cisco/enic/enic_mbox.c
[ ... ]
> @@ -764,7 +921,12 @@ void enic_mbox_init(struct enic *enic)
> mutex_init(&enic->vf_mbox_request_lock);
> init_completion(&enic->mbox_comp);
> spin_lock_init(&enic->mbox_state_lock);
> + spin_lock_init(&enic->vf_ack_lock);
> + INIT_LIST_HEAD(&enic->vf_ack_list);
> + INIT_WORK(&enic->vf_ack_work, enic_mbox_vf_ack_work);
> enic->mbox_msg_num = 0;
> + if (enic_is_sriov_vf_v2(enic))
> + WRITE_ONCE(enic->vf_rx_quarantined, true);
> enic->mbox_initialized = true;
> } else {
> reinit_completion(&enic->mbox_comp);
[Severity: Medium]
Is vf_rx_quarantined armed again for internal resets that weren't caused by
a mailbox fault?
It is set to true in only three places:
- this first-init branch
- the send-timeout branch of enic_mbox_send_msg_id()
- enic_mbox_vf_mark_reconnect_locked()
The reinit branch used by enic_admin_chan_reopen() leaves it at the false
value from the last successful open.
Take a queue-error reset (enic->reset) or a Tx-timeout reset
(tx_hang_reset) on a V2 VF:
enic_reset()
enic_admin_channel_close() /* vf_registered = false */
__enic_stop()
enic_admin_chan_reopen()
enic_mbox_init() /* reinit branch, quarantine untouched */
__enic_open()
enables RQs and NAPI, issues CMD_ENABLE
... late vf_registered / mbox_send_disabled check
Any NAPI poll between CMD_ENABLE and the late check, for example busy poll,
passes this check in enic_rq_indicate_buf():
if (unlikely(READ_ONCE(enic->vf_rx_quarantined))) {
and delivers frames to the stack.
The enic.h comment says the flag "keeps the RX hot path fail-closed while
VF registration is lost or receive state may not match the PF". The commit
message says "Keep VF carrier off and receive delivery quarantined until
the final open-time mailbox check succeeds".
Should the reset paths, or enic_admin_chan_reopen(), set vf_rx_quarantined
to true when they drop the registration?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-b4-enic-sriov-v2-vf-receive-control-v4-0-5858d5a9ecb1%40cisco.com
next prev parent reply other threads:[~2026-12-01 14:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 13:58 [PATCH net-next v4 0/6] enic: add V2 VF receive control over MBOX Satish Kharat
2026-11-30 13:58 ` [PATCH net-next v4 1/6] net: add netif_rx_mode_schedule_update() Satish Kharat
2026-11-30 13:58 ` [PATCH net-next v4 2/6] enic: serialize V2 VF mailbox requests Satish Kharat
2026-12-01 14:04 ` netdev-bot+sashiko
2026-11-30 13:58 ` [PATCH net-next v4 3/6] enic: recover V2 VF mailbox after request failure Satish Kharat
2026-12-01 14:04 ` netdev-bot+sashiko [this message]
2026-11-30 13:58 ` [PATCH net-next v4 4/6] enic: validate V2 VF configuration replies Satish Kharat
2026-12-01 14:04 ` netdev-bot+sashiko
2026-11-30 13:58 ` [PATCH net-next v4 5/6] enic: manage V2 VF station and administrative MAC Satish Kharat
2026-12-01 14:04 ` netdev-bot+sashiko
2026-11-30 13:58 ` [PATCH net-next v4 6/6] enic: configure V2 VF receive mode over mailbox Satish Kharat
2026-12-01 14:04 ` 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=179613389066.3146.6241038227181892804@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=aradhana@cisco.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rfaucett@cisco.com \
--cc=satishkh@cisco.com \
--cc=sebaddel@cisco.com \
--cc=willemb@google.com \
/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