From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: YiFei Zhu <zhuyifei@google.com>,
netdev@vger.kernel.org, bpf@vger.kernel.org
Cc: "Björn Töpel" <bjorn@kernel.org>,
"Magnus Karlsson" <magnus.karlsson@intel.com>,
"Maciej Fijalkowski" <maciej.fijalkowski@intel.com>,
"Jonathan Lemon" <jonathan.lemon@gmail.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"David S . Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Stanislav Fomichev" <sdf@google.com>,
"Willem de Bruijn" <willemb@google.com>
Subject: Re: [RFC PATCH net-next 1/3] selftests/bpf: Move rxq_num helper from xdp_hw_metadata to network_helpers
Date: Tue, 11 Jun 2024 17:12:22 -0400 [thread overview]
Message-ID: <6668bdb68eaf5_f6b0e29416@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <a932c40e59f648d9d2771f9533cbc01cd4c0935c.1718138187.git.zhuyifei@google.com>
YiFei Zhu wrote:
> This helper may be useful for other AF_XDP tests, such as xsk_hw.
> Moving it out so we don't need to copy-paste that function.
>
> I also changed the function from directly calling error(1, errno, ...)
> to returning an error because I don't think it makes sense for a
> library function to outright kill the process if the function fails.
>
> Signed-off-by: YiFei Zhu <zhuyifei@google.com>
> ---
> tools/testing/selftests/bpf/network_helpers.c | 27 +++++++++++++++++++
> tools/testing/selftests/bpf/network_helpers.h | 2 ++
> tools/testing/selftests/bpf/xdp_hw_metadata.c | 27 ++-----------------
> 3 files changed, 31 insertions(+), 25 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c
> index 35250e6cde7f..4c3bef07df23 100644
> --- a/tools/testing/selftests/bpf/network_helpers.c
> +++ b/tools/testing/selftests/bpf/network_helpers.c
> @@ -569,6 +569,33 @@ int set_hw_ring_size(char *ifname, struct ethtool_ringparam *ring_param)
> return 0;
> }
>
> +int rxq_num(const char *ifname)
> +{
> + struct ethtool_channels ch = {
> + .cmd = ETHTOOL_GCHANNELS,
> + };
> + struct ifreq ifr = {
> + .ifr_data = (void *)&ch,
> + };
> + strncpy(ifr.ifr_name, ifname, IF_NAMESIZE - 1);
> + int fd, ret, err;
Since sending this as RFC, when sending for inclusion let's move the
strncpy, to not mix declarations and code.
next prev parent reply other threads:[~2024-06-11 21:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 20:42 [RFC PATCH net-next 0/3] selftests: Add AF_XDP functionality test YiFei Zhu
2024-06-11 20:42 ` [RFC PATCH net-next 1/3] selftests/bpf: Move rxq_num helper from xdp_hw_metadata to network_helpers YiFei Zhu
2024-06-11 21:12 ` Willem de Bruijn [this message]
2024-06-11 20:42 ` [RFC PATCH net-next 2/3] selftests/bpf: Add xsk_hw AF_XDP functionality test YiFei Zhu
2024-06-11 20:42 ` [RFC PATCH net-next 3/3] selftests: drv-net: " YiFei Zhu
2024-06-11 21:09 ` Willem de Bruijn
2024-06-12 11:47 ` [RFC PATCH net-next 0/3] selftests: Add " Magnus Karlsson
2024-06-12 12:49 ` Maciej Fijalkowski
2024-06-12 16:44 ` YiFei Zhu
2024-06-13 6:42 ` Magnus Karlsson
2024-06-12 13:57 ` Willem de Bruijn
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=6668bdb68eaf5_f6b0e29416@willemb.c.googlers.com.notmuch \
--to=willemdebruijn.kernel@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--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=sdf@google.com \
--cc=willemb@google.com \
--cc=zhuyifei@google.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