RE: [PATCH bpf-next 1/6] selftests/xsk: Add packet stream replacement functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Stanislav Fomichev <stfomichev@xxxxxxxxx>
> Sent: Thursday, February 20, 2025 11:16 PM
> To: Vyavahare, Tushar <tushar.vyavahare@xxxxxxxxx>
> Cc: bpf@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; bjorn@xxxxxxxxxx; Karlsson,
> Magnus <magnus.karlsson@xxxxxxxxx>; Fijalkowski, Maciej
> <maciej.fijalkowski@xxxxxxxxx>; jonathan.lemon@xxxxxxxxx;
> davem@xxxxxxxxxxxxx; kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx; ast@xxxxxxxxxx;
> daniel@xxxxxxxxxxxxx
> Subject: Re: [PATCH bpf-next 1/6] selftests/xsk: Add packet stream replacement
> functions
> 
> On 02/20, Tushar Vyavahare wrote:
> > Add pkt_stream_replace function to replace the packet stream for a
> > given ifobject. Add pkt_stream_replace_both function to replace the
> > packet streams for both transmit and receive ifobject in test_spec.
> > Enhance test framework to handle packet stream replacements efficiently.
> >
> > Signed-off-by: Tushar Vyavahare <tushar.vyavahare@xxxxxxxxx>
> > ---
> >  tools/testing/selftests/bpf/xskxceiver.c | 29
> > +++++++++++++-----------
> >  1 file changed, 16 insertions(+), 13 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/xskxceiver.c
> > b/tools/testing/selftests/bpf/xskxceiver.c
> > index 11f047b8af75..1d9b03666ee6 100644
> > --- a/tools/testing/selftests/bpf/xskxceiver.c
> > +++ b/tools/testing/selftests/bpf/xskxceiver.c
> > @@ -757,14 +757,15 @@ static struct pkt_stream *pkt_stream_clone(struct
> pkt_stream *pkt_stream)
> >  	return pkt_stream_generate(pkt_stream->nb_pkts,
> > pkt_stream->pkts[0].len);  }
> >
> > -static void pkt_stream_replace(struct test_spec *test, u32 nb_pkts,
> > u32 pkt_len)
> > +static void pkt_stream_replace(struct ifobject *ifobj, u32 nb_pkts,
> > +u32 pkt_len)
> >  {
> > -	struct pkt_stream *pkt_stream;
> > +	ifobj->xsk->pkt_stream = pkt_stream_generate(nb_pkts, pkt_len); }
> >
> > -	pkt_stream = pkt_stream_generate(nb_pkts, pkt_len);
> > -	test->ifobj_tx->xsk->pkt_stream = pkt_stream;
> > -	pkt_stream = pkt_stream_generate(nb_pkts, pkt_len);
> > -	test->ifobj_rx->xsk->pkt_stream = pkt_stream;
> 
> [..]
> 
> > +static void pkt_stream_replace_both(struct test_spec *test, u32
> > +nb_pkts, u32 pkt_len) {
> > +	pkt_stream_replace(test->ifobj_tx, nb_pkts, pkt_len);
> > +	pkt_stream_replace(test->ifobj_rx, nb_pkts, pkt_len);
> >  }
> 
> nit: maybe keep existing name pkt_stream_replace here? and add new helper
> pkt_stream_replace_ifobject to work on particular ifobject?
> 

Will do. Thank you.

> static void pkt_stream_replace_both(struct test_spec *test, u32 nb_pkts, u32
> pkt_len) {
> 	pkt_stream_replace_ifobject(test->ifobj_tx, nb_pkts, pkt_len);
> 	pkt_stream_replace_ifobject(test->ifobj_rx, nb_pkts, pkt_len); }
> 
> This should avoid touching existing call sites.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux