public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Fomichev <stfomichev@gmail.com>
To: Tushar Vyavahare <tushar.vyavahare@intel.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, bjorn@kernel.org,
	magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
	jonathan.lemon@gmail.com, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net
Subject: Re: [PATCH bpf-next 1/6] selftests/xsk: Add packet stream replacement functions
Date: Thu, 20 Feb 2025 09:45:48 -0800	[thread overview]
Message-ID: <Z7dqTLVxnVcO3YyF@mini-arch> (raw)
In-Reply-To: <20250220084147.94494-2-tushar.vyavahare@intel.com>

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@intel.com>
> ---
>  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?

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.

  reply	other threads:[~2025-02-20 17:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20  8:41 [PATCH bpf-next 0/6] selftests/xsk: Add tests for XDP tail adjustment in AF_XDP Tushar Vyavahare
2025-02-20  8:41 ` [PATCH bpf-next 1/6] selftests/xsk: Add packet stream replacement functions Tushar Vyavahare
2025-02-20 17:45   ` Stanislav Fomichev [this message]
2025-02-25 15:57     ` Vyavahare, Tushar
2025-02-20  8:41 ` [PATCH bpf-next 2/6] selftests/xsk: Add tail adjustment functionality to XDP Tushar Vyavahare
2025-02-20 17:46   ` Stanislav Fomichev
2025-02-25 15:58     ` Vyavahare, Tushar
2025-02-25 22:37       ` Stanislav Fomichev
2025-02-26 12:23         ` Vyavahare, Tushar
2025-02-20  8:41 ` [PATCH bpf-next 3/6] selftests/xsk: Add testapp_xdp_adjust_tail function to userspace for packet tail adjustment Tushar Vyavahare
2025-02-20  8:41 ` [PATCH bpf-next 4/6] selftests/xsk: Add support check for bpf_xdp_adjust_tail() helper in xskxceiver Tushar Vyavahare
2025-02-20  8:41 ` [PATCH bpf-next 5/6] selftests/xsk: Implement packet resizing test with bpf_xdp_adjust_tail Tushar Vyavahare
2025-02-20  8:41 ` [PATCH bpf-next 6/6] selftests/xsk: Add packet resizing tests with bpf_xdp_adjust_tail for AF_XDP Tushar Vyavahare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z7dqTLVxnVcO3YyF@mini-arch \
    --to=stfomichev@gmail.com \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tushar.vyavahare@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox