Subject: Re: [PATCH net 5/6] selftests: bpf: fix pkt grow tests

From: Maciej Fijalkowski <[email-masked]>
Date: Tue, 17 Mar 2026 11:57:09 +0100

On Tue, Mar 17, 2026 at 10:27:11AM +0100, Björn Töpel wrote:
> Maciej Fijalkowski <[email-masked]> writes:
> 
> > Skip tail adjust tests in xskxceiver for SKB mode as it is not very
> > friendly for it. multi-buffer case does not work as xdp_rxq_info that is
> > registered for generic XDP does not report ::frag_size. The non-mbuf
> > path copies packet via skb_pp_cow_data() which only accounts for
> > headroom, leaving us with no tailroom and causing underlying XDP prog to
> > drop packets therefore.
> >
> > For multi-buffer test on other modes, change the amount of bytes we use
> > for growth, assume worst-case scenario and take care of headroom and
> > tailroom.
> >
> > Signed-off-by: Maciej Fijalkowski <[email-masked]>
> > ---
> >  .../selftests/bpf/prog_tests/test_xsk.c       | 21 ++++++++++++++++---
> >  1 file changed, 18 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> > index 7e38ec6e656b..a496f1784b66 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> > @@ -2551,16 +2551,31 @@ int testapp_adjust_tail_shrink_mb(struct test_spec *test)
> >  
> >  int testapp_adjust_tail_grow(struct test_spec *test)
> >  {
> > +	if (test->mode == TEST_MODE_SKB)
> > +		return TEST_SKIP;
> > +
> >  	/* Grow by 4 bytes for testing purpose */
> >  	return testapp_adjust_tail(test, 4, MIN_PKT_SIZE * 2);
> >  }
> >  
> >  int testapp_adjust_tail_grow_mb(struct test_spec *test)
> >  {
> > +	u32 grow_size;
> > +
> > +	if (test->mode == TEST_MODE_SKB)
> > +		return TEST_SKIP;
> > +
> > +	/* worst case scenario is when underlying setup will work on 3k
> > +	 * buffers, let us account for it; given that we will use 6k as
> > +	 * pkt_len, expect that it will be broken down to 2 descs each
> > +	 * with 3k payload;
> > +	 *
> > +	 * 4k is truesize, 3k payload, 256 HR, 320 TR;
> > +	 */
> > +	grow_size = XSK_UMEM__MAX_FRAME_SIZE - XSK_UMEM__LARGE_FRAME_SIZE - 256 - 320;
> 
> nit: Use defines, XDP_PACKET_HEADROOM, and maybe
> SKB_DATA_ALIGN(sizeof(struct skb_shared_info))?

umm right, but the latter would have to be exposed via UAPI ?