lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6668bdb68eaf5_f6b0e29416@willemb.c.googlers.com.notmuch>
Date: Tue, 11 Jun 2024 17:12:22 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: YiFei Zhu <zhuyifei@...gle.com>, 
 netdev@...r.kernel.org, 
 bpf@...r.kernel.org
Cc: Björn Töpel <bjorn@...nel.org>, 
 Magnus Karlsson <magnus.karlsson@...el.com>, 
 Maciej Fijalkowski <maciej.fijalkowski@...el.com>, 
 Jonathan Lemon <jonathan.lemon@...il.com>, 
 Alexei Starovoitov <ast@...nel.org>, 
 Daniel Borkmann <daniel@...earbox.net>, 
 "David S . Miller" <davem@...emloft.net>, 
 Jakub Kicinski <kuba@...nel.org>, 
 Jesper Dangaard Brouer <hawk@...nel.org>, 
 John Fastabend <john.fastabend@...il.com>, 
 Andrii Nakryiko <andrii@...nel.org>, 
 Stanislav Fomichev <sdf@...gle.com>, 
 Willem de Bruijn <willemb@...gle.com>
Subject: Re: [RFC PATCH net-next 1/3] selftests/bpf: Move rxq_num helper from
 xdp_hw_metadata to network_helpers

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@...gle.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ