> -----Original Message----- > From: Matt Thompson via B4 Relay <devn…@kernel.org> > Sent: Thursday, December 3, 2026 11:53 PM > To: Nguyen, Anthony L <anth…@intel.com>; Kitszel, Przemyslaw > <prze…@intel.com>; Andrew Lunn <andr…@lunn.ch>; > David S. Miller <dav…@davemloft.net>; Eric Dumazet > <edum…@kernel.org>; Jakub Kicinski <ku…@kernel.org>; Paolo Abeni > <pabe…@redhat.com>; Alexei Starovoitov <a…@kernel.org>; Daniel > Borkmann <dani…@iogearbox.net>; Jesper Dangaard Brouer > <ha…@kernel.org>; John Fastabend <john…@gmail.com>; Stanislav > Fomichev <s…@fomichev.me> > Cc: inte…@lists.osuosl.org; netd…@vger.kernel.org; > b…@vger.kernel.org; stab…@vger.kernel.org; Matt Thompson > <ma…@boondocker.io> > Subject: [PATCH net v2] i40e: stop XSK queue pairs in VSI shutdown order > > 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" 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. > > The Tx queue disable request is asynchronous. The X710 leaves QENA_STAT > set until a disable marker has traversed the Tx pipe, including when the > descriptor ring is empty. The original ten 10-20 us sleeps can report > failure while QENA_REQ is clear and QENA_STAT is still set; in the test > the status then cleared within milliseconds. Poll the status with an > elapsed-time deadline before cleaning the rings and releasing the AF_XDP > pool. The deadline covers the observed multi-millisecond transitions > without using a fixed retry count. > > With this change, 1,000 AF_XDP setup/teardown cycles at 12 queues > completed 2,048 Tx descriptors per cycle on each of queues 0 and 11. > Another 310 cycles closed the sockets with 2,048 Tx descriptors per > queue still uncompleted. Neither test produced a disable timeout or > AF_XDP teardown warning. > > Fixes: 123cecd427b6 ("i40e: added queue pair disable/enable functions") > Cc: stab…@vger.kernel.org > Signed-off-by: Matt Thompson <ma…@boondocker.io> > --- > Changes in v2: > - Share the per-queue disable wait with the full-VSI path, as requested > by Maciej Fijalkowski. > - Order the new local declarations in reverse Christmas tree style. > - Wait for Tx QENA_STAT with a time-based deadline so the hardware > disable marker can drain before AF_XDP buffers are released. > - Retain the v1 queue shutdown and startup ordering changes. > - Link to v1: https://patch.msgid.link/20261202-b4-i40e-xsk-queue-order- > v1-1…@boondocker.io > > To: Tony Nguyen <anth…@intel.com> > To: Przemek Kitszel <prze…@intel.com> > To: Andrew Lunn <andr…@lunn.ch> > To: "David S. Miller" <dav…@davemloft.net> > To: Eric Dumazet <edum…@kernel.org> > To: Jakub Kicinski <ku…@kernel.org> > To: Paolo Abeni <pabe…@redhat.com> > To: Alexei Starovoitov <a…@kernel.org> > To: Daniel Borkmann <dani…@iogearbox.net> > To: Jesper Dangaard Brouer <ha…@kernel.org> > To: John Fastabend <john…@gmail.com> > To: Stanislav Fomichev <s…@fomichev.me> > Cc: inte…@lists.osuosl.org > Cc: netd…@vger.kernel.org > Cc: b…@vger.kernel.org > --- > drivers/net/ethernet/intel/i40e/i40e_main.c | 148 ++++++++++++++------- > ------- > 1 file changed, 72 insertions(+), 76 deletions(-) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c > b/drivers/net/ethernet/intel/i40e/i40e_main.c > index abbc71e81..555eac07e 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c > @@ -7,6 +7,7 @@ > #include <linux/net/intel/libie/rx.h> > #include <linux/if_bridge.h> > #include <linux/if_macvlan.h> > +#include <linux/iopoll.h> > #include <linux/module.h> > #include <net/pkt_cls.h> > #include <net/xdp_sock_drv.h> > @@ -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)); > } > > /** > @@ -5293,6 +5292,39 @@ static void i40e_pf_unquiesce_all_vsi(struct > i40e_pf *pf) > i40e_unquiesce_vsi(vsi); > } >
...
> } > > /** > > --- > base-commit: c1c39137dcc3134010566ff29a81c93124efa539 > change-id: 20261202-b4-i40e-xsk-queue-order-0103023207a2 > > Best regards, > -- > Matt Thompson <ma…@boondocker.io> >
Reviewed-by: Aleksandr Loktionov <alek…@intel.com>