On Wed, Dec 02, 2026 at 10:49:52AM -0700, Matt Thompson via B4 Relay wrote:
> From: Matt Thompson <ma…@boondocker.io> > > An AF_XDP zero-copy pool transition on an active X710 can time out > disabling the regular Tx ring. With 12 combined queues and simultaneous > 2048-frame bursts on queues 0 and 11, the original driver reported > "VSI seid 390 Tx ring 11 disable timeout" on the first bind cycle and > networking stopped responding. > > The queue-pair path disables Tx before Rx. The whole-VSI shutdown path > first announces the Tx disable to firmware, disables Rx, waits for the > Rx disable erratum, and then disables both regular and XDP Tx queues. > Use that sequence for a single queue pair as well. Bring Rx up before > Tx on enable, matching the whole-VSI start path. > > On the same X710, the order-only change completed 100 high-volume > AF_XDP setup/teardown cycles at 12 queues without a queue timeout. > > Fixes: 123cecd427b6 ("i40e: added queue pair disable/enable functions") > Cc: stab…@vger.kernel.org > Signed-off-by: Matt Thompson <ma…@boondocker.io>
Huh, I had a feeling I was fixing that in the past but I apparently the bug report was about pure XDP and I was too lazy to look at AF_XDP behavior ;)
> --- > drivers/net/ethernet/intel/i40e/i40e_main.c | 79 ++++++++++++++++------------- > 1 file changed, 45 insertions(+), 34 deletions(-) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c > index abbc71e81..d93023dde 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c > @@ -13408,46 +13408,57 @@ static int i40e_queue_pair_toggle_rings(struct i40e_vsi *vsi, int queue_pair, > bool enable) > { > struct i40e_pf *pf = vsi->back; > - int pf_q, ret = 0; > + int pf_q = vsi->base_queue + queue_pair; > + int xdp_q = pf_q + vsi->alloc_queue_pairs; > + bool has_xdp = i40e_enabled_xdp_vsi(vsi); > + int ret;
a minor thing is we usually require the Reverse Xmas Tree (RCT) rule which implies ordering local variables by their length (from longest to shortest).
> > - pf_q = vsi->base_queue + queue_pair; > - ret = i40e_control_wait_tx_q(vsi->seid, pf, pf_q, > - false /*is xdp*/, enable); > - if (ret) { > - dev_info(&pf->pdev->dev, > - "VSI seid %d Tx ring %d %sable timeout\n", > - vsi->seid, pf_q, (enable ? "en" : "dis")); > - return ret; > - } > + if (!enable) { > + /* Use the same firmware transition as i40e_vsi_stop_rings(). > + * Both TX queues must be announced before RX is stopped. > + */ > + i40e_pre_tx_queue_cfg(&pf->hw, pf_q, false); > + if (has_xdp) > + i40e_pre_tx_queue_cfg(&pf->hw, xdp_q, false); > + i40e_control_rx_q(pf, pf_q, false); > + msleep(I40E_DISABLE_TX_GAP_MSEC); > + wr32(&pf->hw, I40E_QTX_ENA(pf_q), 0); > + if (has_xdp) > + wr32(&pf->hw, I40E_QTX_ENA(xdp_q), 0); > > - 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")); > + ret = i40e_pf_txq_wait(pf, pf_q, false); > + if (ret) { > + dev_info(&pf->pdev->dev, > + "VSI seid %d Tx ring %d disable timeout\n", > + vsi->seid, pf_q); > + return ret; > + } > + if (has_xdp) { > + ret = i40e_pf_txq_wait(pf, xdp_q, false); > + if (ret) { > + dev_info(&pf->pdev->dev, > + "VSI seid %d XDP Tx ring %d disable timeout\n", > + vsi->seid, xdp_q); > + return ret; > + } > + } > + ret = i40e_pf_rxq_wait(pf, pf_q, false); > + if (ret) > + dev_info(&pf->pdev->dev, > + "VSI seid %d Rx ring %d disable timeout\n", > + vsi->seid, pf_q);
it seems this body is repeated from i40e_vsi_wait_queues_disabled() now. could we pull this out to a routine which disables single queue pair and use it here plus iterate over num_queue_pairs in mentioned function and call it there? Other than that, thanks for fixing this. Also let us see what Sashiko will punch you with, this driver has its issues. However, if sashiko would be unexpectedly calm then I would still vote for going with this refactor even though it is a fix and then I will ack the change. Thanks again!
> return ret; > } > > - /* Due to HW errata, on Rx disable only, the register can > - * indicate done before it really is. Needs 50ms to be sure > - */ > - if (!enable) > - mdelay(50); > - > - if (!i40e_enabled_xdp_vsi(vsi)) > + /* 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 + vsi->alloc_queue_pairs, > - true /*is xdp*/, enable); > - if (ret) { > - dev_info(&pf->pdev->dev, > - "VSI seid %d XDP Tx ring %d %sable timeout\n", > - vsi->seid, pf_q, (enable ? "en" : "dis")); > - } > - > - 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); > } > > /** > > --- > base-commit: c1c39137dcc3134010566ff29a81c93124efa539 > change-id: 20261202-b4-i40e-xsk-queue-order-0103023207a2 > > Best regards, > -- > Matt Thompson <ma…@boondocker.io> > > >