Subject: Re: [Intel-wired-lan] i40e XDP program stops transmitting after link down/up

From: Maciej Fijalkowski <[email-masked]>
Date: Tue, 30 Jan 2024 23:06:07 +0100

On Tue, Jan 30, 2024 at 08:28:24PM +0100, Maciej Fijalkowski wrote:
> On Tue, Jan 30, 2024 at 10:59:13AM -0600, Seth Forshee wrote:
> > On Tue, Jan 30, 2024 at 05:14:23PM +0100, Paul Menzel wrote:
> > > Dear Seth,
> > > 
> > > 
> > > Thank you for bring this up.
> > > 
> > > Am 30.01.24 um 15:17 schrieb Seth Forshee:
> > > > I got a inquiry from a colleague about a behavior he's seeing with i40e
> > > > but not with other NICs. The interfaces are bonded with a XDP
> > > > load-balancer program attached to them. After 'ip link set ethX down; ip
> > > > link set ethX up' on one of the interfaces the XDP program on that
> > > > interface is no longer transmitting packets. He found that tx starts
> > > > again after running 'sudo ethtool -t ethX'.
> > > > 
> > > > There's a 'i40e 0000:d8:00.1: VSI seid 391 XDP Tx ring 0 disable
> > > > timeout' message in dmesg when disabling the interface. I've included
> > > > the relevant portions from dmesg below.
> > > > 
> > > > This was first observed with a 6.1 kernel, but we've confirmed that the
> > > > behavior is the same in 6.7. I realize the firmware is pretty old, so
> > > > far our attempts to update the NVM have failed.
> > > 
> > > Does that mean, the problem didn’t happen before Linux 6.1? If so, if you
> > > have the reproducer and the time, bisecting the issue is normally the
> > > fastest way to solve the issue.
> > 
> > No, sorry, I should have worded that better. I meant that they were
> > using 6.1 when they noticed the issue, not that kernels before 6.1 did
> > not have that issue. We've also tried a 5.15 kernel build now and still
> > see the issue there, we haven't tested anything older than that.
> 
> Hey Seth,
> 
> I am observing same thing on my side with xdpsock in txonly mode, so I'll
> take a look at this and will keep you updated.

Can you try this diff on your side?

>From 1d3b2d92506c0af4bea843c046bdef34f3f66893 Mon Sep 17 00:00:00 2001
From: Maciej Fijalkowski <[email-masked]>
Date: Tue, 30 Jan 2024 23:01:28 +0100
Subject: [PATCH net] i40e: stop XDP txqs

Signed-off-by: Maciej Fijalkowski <[email-masked]>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 6e7fd473abfd..08ef88783762 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4926,13 +4926,16 @@ int i40e_vsi_start_rings(struct i40e_vsi *vsi)
 void i40e_vsi_stop_rings(struct i40e_vsi *vsi)
 {
 	struct i40e_pf *pf = vsi->back;
+	u32 alloc_queue_pairs;
 	int pf_q, err, q_end;
 
 	/* When port TX is suspended, don't wait */
 	if (test_bit(__I40E_PORT_SUSPENDED, vsi->back->state))
 		return i40e_vsi_stop_rings_no_wait(vsi);
 
-	q_end = vsi->base_queue + vsi->num_queue_pairs;
+	alloc_queue_pairs = vsi->alloc_queue_pairs *
+			    (i40e_enabled_xdp_vsi(vsi) ? 2 : 1);
+	q_end = vsi->base_queue + alloc_queue_pairs;
 	for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++)
 		i40e_pre_tx_queue_cfg(&pf->hw, (u32)pf_q, false);
 
-- 
2.34.1

> > Thanks,
> > Seth