All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matt Thompson" <matt@boondocker.io>
Cc: intel-wired-lan@lists.osuosl.org, bpf@vger.kernel.org
Subject: Re: [PATCH net v2] i40e: stop XSK queue pairs in VSI shutdown order
Date: Fri, 04 Dec 2026 22:53:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-250788@kernel.org> (raw)
In-Reply-To: <20261203-b4-i40e-xsk-queue-order-v2-1-e14b712d5fc2@boondocker.io>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] i40e: i40e_pf_txq_wait() 20 ms timeout multiplies
  sequentially across VFs
- [Low] i40e: Rx enable timeout log dropped in
  i40e_queue_pair_toggle_rings()
--

commit 93f51afdbe4fd98b091222e08a53b9e822832e16
Author: Matt Thompson <matt@boondocker.io>

i40e: stop XSK queue pairs in VSI shutdown order

This commit updates i40e_queue_pair_toggle_rings() to match the whole-VSI
shutdown and startup sequence, shares the per-queue disable wait with
i40e_vsi_wait_queues_disabled(), and converts i40e_pf_txq_wait() to
read_poll_timeout() with a 20 ms disable timeout.

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index abbc71e815ae3..555eac07e28b8 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c

[ ... ]

> @@ -4660,6 +4661,8 @@ static void i40e_netpoll(struct net_device *netdev)
>  #endif
>  
>  #define I40E_QTX_ENA_WAIT_COUNT 50
> +#define I40E_TXQ_ENABLE_TIMEOUT_US 1000
> +#define I40E_TXQ_DISABLE_TIMEOUT_US 20000
>  
>  /**
>   * i40e_pf_txq_wait - Wait for a PF's Tx queue to be enabled or disabled
> @@ -4674,20 +4677,16 @@ static void i40e_netpoll(struct net_device *netdev)
>   **/
>  static int i40e_pf_txq_wait(struct i40e_pf *pf, int pf_q, bool enable)
>  {
> -	int i;
>  	u32 tx_reg;
>  
> -	for (i = 0; i < I40E_QUEUE_WAIT_RETRY_LIMIT; i++) {
> -		tx_reg = rd32(&pf->hw, I40E_QTX_ENA(pf_q));
> -		if (enable == !!(tx_reg & I40E_QTX_ENA_QENA_STAT_MASK))
> -			break;
> -
> -		usleep_range(10, 20);
> -	}
> -	if (i >= I40E_QUEUE_WAIT_RETRY_LIMIT)
> -		return -ETIMEDOUT;
> -
> -	return 0;
> +	/* QENA_STAT stays set until the disable marker leaves the Tx pipe.
> +	 * The pipe can take milliseconds to drain even when the ring is empty.
> +	 */
> +	return read_poll_timeout(rd32, tx_reg,
> +				 enable == !!(tx_reg & I40E_QTX_ENA_QENA_STAT_MASK),
> +				 200, enable ? I40E_TXQ_ENABLE_TIMEOUT_US :
> +				 I40E_TXQ_DISABLE_TIMEOUT_US, false, &pf->hw,
> +				 I40E_QTX_ENA(pf_q));
>  }

[Severity: Medium]
Can the 20 ms disable timeout in i40e_pf_txq_wait() multiply into a
multi-second stall across VFs?

i40e_reset_all_vfs() and i40e_free_vfs() call
i40e_vsi_wait_queues_disabled() per VF and ignore -ETIMEDOUT.  If a
wedged Tx pipe or PCIe link loss (rd32() returning 0xffffffff) leaves
QENA_STAT set, up to 128 VFs wait 20 ms each sequentially (up to 2.56 s).

When i40e_rebuild() runs with lock_acquired true (such as from
i40e_do_reset_safe()), i40e_reset_all_vfs() holds global rtnl_lock()
across the whole loop.  Exiting early on tx_reg == ~0U and aborting or
sharing a deadline across VFs would avoid this.

[ ... ]

> @@ -13408,46 +13412,38 @@ static int i40e_queue_pair_toggle_rings(struct i40e_vsi *vsi, int queue_pair,
>  					bool enable)

[ ... ]

> -	i40e_control_rx_q(pf, pf_q, enable);
> -	ret = i40e_pf_rxq_wait(pf, pf_q, enable);
> -	if (ret) {
> -		dev_info(&pf->pdev->dev,
> -			 "VSI seid %d Rx ring %d %sable timeout\n",
> -			 vsi->seid, pf_q, (enable ? "en" : "dis"));
> -		return ret;
> -	}

[ ... ]

> +	/* The whole-VSI enable path brings RX up before TX. */
> +	i40e_control_rx_q(pf, pf_q, true);
> +	ret = i40e_pf_rxq_wait(pf, pf_q, true);
> +	if (ret)
> +		return ret;
> +	ret = i40e_control_wait_tx_q(vsi->seid, pf, pf_q, false, true);
> +	if (ret || !has_xdp)
> +		return ret;
> +	return i40e_control_wait_tx_q(vsi->seid, pf, xdp_q, true, true);
>  }

[Severity: Low]
Should this keep the dev_info() Rx ring enable timeout log and reuse
i40e_control_wait_rx_q()?

Unlike i40e_control_wait_tx_q() below, i40e_pf_rxq_wait() does not log on
timeout, so an Rx ring enable failure now returns -ETIMEDOUT silently.
i40e_vsi_enable_rx() calls i40e_control_wait_rx_q() and logs the timeout
explicitly.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-b4-i40e-xsk-queue-order-v2-1-e14b712d5fc2@boondocker.io?part=1

  parent reply	other threads:[~2026-12-04 22:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 22:53 [PATCH net v2] i40e: stop XSK queue pairs in VSI shutdown order Matt Thompson via B4 Relay
2026-12-03 22:53 ` Matt Thompson
2026-12-04  9:49 ` Maciej Fijalkowski
2026-12-04 14:52 ` Loktionov, Aleksandr
2026-12-04 22:53 ` sashiko-bot [this message]
2026-12-04 23: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-250788@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=matt@boondocker.io \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.