On Thu, Oct 23, 2025 at 04:39:29AM +1100, Your Name wrote: > On Wed, Oct 22, 2025 at 07:17:20PM +0200, Maciej Fijalkowski wrote: > > On Wed, Oct 22, 2025 at 12:32:00AM +0700, Alessandro Decina wrote: > > > > Hi Alessandro, > > Hey, > > Thanks for the review! > > > > > > > Whenever a status descriptor is received, i40e processes and skips over > > > it, correctly updating next_to_process but forgetting to update > > > next_to_clean. In the next iteration this accidentally causes the > > > creation of an invalid multi-buffer xdp_buff where the first fragment > > > is the status descriptor. > > > > > > If then a skb is constructed from such an invalid buffer - because the > > > eBPF program returns XDP_PASS - a panic occurs: > > > > can you elaborate on the test case that would reproduce this? I suppose > > AF_XDP ZC with jumbo frames, doing XDP_PASS, but what was FDIR setup that > > caused status descriptors? > > Doesn't have to be jumbo or multi-frag, anything that does XDP_PASS > reproduces, as long as status descriptors are posted. > > See the scenarios here > https://lore.kernel.org/netdev/aPkDtuVgbS4J-Og_@lima-default/ > > As for what's causing the status descriptors, I haven't been able to > figure that out. I just know that I periodically get > I40E_RX_PROG_STATUS_DESC_FD_FILTER_STATUS. Happy to dig deeper if you > have any ideas! > > > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c > > > b/drivers/net/ethernet/intel/i40e/i40e_xsk.c > > > index 9f47388eaba5..dbc19083bbb7 100644 > > > --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c > > > +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c > > > @@ -441,13 +441,18 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, > > > int budget) > > > dma_rmb(); > > > > > > if (i40e_rx_is_programming_status(qword)) { > > > + u16 ntp; > > > + > > > i40e_clean_programming_status(rx_ring, > > > rx_desc->raw.qword[0], > > > qword); > > > bi = *i40e_rx_bi(rx_ring, next_to_process); > > > xsk_buff_free(bi); > > > - if (++next_to_process == count) > > > + ntp = next_to_process++; > > > + if (next_to_process == count) > > > next_to_process = 0; > > > + if (next_to_clean == ntp) > > > + next_to_clean = next_to_process; > > > > I wonder if this is more readable? > > > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c > > b/drivers/net/ethernet/intel/i40e/i40e_xsk.c > > index 9f47388eaba5..36f412a2d836 100644 > > --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c > > +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c > > @@ -446,6 +446,10 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, > > int budget) > > qword); > > bi = *i40e_rx_bi(rx_ring, next_to_process); > > xsk_buff_free(bi); > > + if (next_to_clean == next_to_process) { > > + if (++next_to_clean == count) > > + next_to_clean = 0; > > + } > > if (++next_to_process == count) > > next_to_process = 0; > > continue; > > > > > continue; > > > } > > Probably because I've looked at it for longer, I find my version clearer > (I think I copied it from another driver actually). But I don't really > mind, happy to switch to yours if you prefer!
Hmm. After taking a second look, how about we make it into a common function shared between i40e_clean_rx_irq() and i40e_clean_rx_irq_zc() ? > > Ciao > Alessandro >
