From: Stanislav Fomichev <stfomichev@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
dxu@dxuuu.xyz, shuah@kernel.org, hawk@kernel.org,
petrm@nvidia.com, willemb@google.com, jstancek@redhat.com,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net v2 2/2] selftests: drv-net: test XDP, HDS auto and the ioctl path
Date: Fri, 21 Feb 2025 08:07:02 -0800 [thread overview]
Message-ID: <Z7ikpmXut900JqA1@mini-arch> (raw)
In-Reply-To: <20250221025141.1132944-2-kuba@kernel.org>
On 02/20, Jakub Kicinski wrote:
> Test XDP and HDS interaction. While at it add a test for using the IOCTL,
> as that turned out to be the real culprit.
>
> Testing bnxt:
>
> # NETIF=eth0 ./ksft-net-drv/drivers/net/hds.py
> KTAP version 1
> 1..12
> ok 1 hds.get_hds
> ok 2 hds.get_hds_thresh
> ok 3 hds.set_hds_disable # SKIP disabling of HDS not supported by the device
> ok 4 hds.set_hds_enable
> ok 5 hds.set_hds_thresh_zero
> ok 6 hds.set_hds_thresh_max
> ok 7 hds.set_hds_thresh_gt
> ok 8 hds.set_xdp
> ok 9 hds.enabled_set_xdp
> ok 10 hds.ioctl
> ok 11 hds.ioctl_set_xdp
> ok 12 hds.ioctl_enabled_set_xdp
> # Totals: pass:11 fail:0 xfail:0 xpass:0 skip:1 error:0
>
> and netdevsim:
>
> # ./ksft-net-drv/drivers/net/hds.py
> KTAP version 1
> 1..12
> ok 1 hds.get_hds
> ok 2 hds.get_hds_thresh
> ok 3 hds.set_hds_disable
> ok 4 hds.set_hds_enable
> ok 5 hds.set_hds_thresh_zero
> ok 6 hds.set_hds_thresh_max
> ok 7 hds.set_hds_thresh_gt
> ok 8 hds.set_xdp
> ok 9 hds.enabled_set_xdp
> ok 10 hds.ioctl
> ok 11 hds.ioctl_set_xdp
> ok 12 hds.ioctl_enabled_set_xdp
> # Totals: pass:12 fail:0 xfail:0 xpass:0 skip:0 error:0
>
> Netdevsim needs a sane default for tx/rx ring size.
>
> ethtool 6.11 is needed for the --disable-netlink option.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
> ---
> Since this is targeting net there is no cfg.rpath(),
> I'll follow up once in net-next.
>
> v2:
> - add the ioctl tests
> - factor out some common logic
>
> CC: shuah@kernel.org
> CC: hawk@kernel.org
> CC: petrm@nvidia.com
> CC: willemb@google.com
> CC: jstancek@redhat.com
> CC: linux-kselftest@vger.kernel.org
> ---
> tools/testing/selftests/net/lib/Makefile | 3 +
> drivers/net/netdevsim/ethtool.c | 2 +
> .../testing/selftests/net/lib/xdp_dummy.bpf.c | 13 ++
> tools/testing/selftests/drivers/net/hds.py | 145 +++++++++++++++++-
> 4 files changed, 160 insertions(+), 3 deletions(-)
> create mode 100644 tools/testing/selftests/net/lib/xdp_dummy.bpf.c
>
> diff --git a/tools/testing/selftests/net/lib/Makefile b/tools/testing/selftests/net/lib/Makefile
> index bc6b6762baf3..c22623b9a2a5 100644
> --- a/tools/testing/selftests/net/lib/Makefile
> +++ b/tools/testing/selftests/net/lib/Makefile
> @@ -9,7 +9,10 @@ TEST_FILES := ../../../../../Documentation/netlink/specs
> TEST_FILES += ../../../../net/ynl
>
> TEST_GEN_FILES += csum
> +TEST_GEN_FILES += $(patsubst %.c,%.o,$(wildcard *.bpf.c))
>
> TEST_INCLUDES := $(wildcard py/*.py sh/*.sh)
>
> include ../../lib.mk
> +
> +include ../bpf.mk
> diff --git a/drivers/net/netdevsim/ethtool.c b/drivers/net/netdevsim/ethtool.c
> index 5c80fbee7913..7ab358616e03 100644
> --- a/drivers/net/netdevsim/ethtool.c
> +++ b/drivers/net/netdevsim/ethtool.c
> @@ -184,9 +184,11 @@ static const struct ethtool_ops nsim_ethtool_ops = {
>
> static void nsim_ethtool_ring_init(struct netdevsim *ns)
> {
> + ns->ethtool.ring.rx_pending = 512;
> ns->ethtool.ring.rx_max_pending = 4096;
> ns->ethtool.ring.rx_jumbo_max_pending = 4096;
> ns->ethtool.ring.rx_mini_max_pending = 4096;
> + ns->ethtool.ring.tx_pending = 512;
> ns->ethtool.ring.tx_max_pending = 4096;
> }
>
> diff --git a/tools/testing/selftests/net/lib/xdp_dummy.bpf.c b/tools/testing/selftests/net/lib/xdp_dummy.bpf.c
> new file mode 100644
> index 000000000000..d988b2e0cee8
> --- /dev/null
> +++ b/tools/testing/selftests/net/lib/xdp_dummy.bpf.c
> @@ -0,0 +1,13 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#define KBUILD_MODNAME "xdp_dummy"
> +#include <linux/bpf.h>
> +#include <bpf/bpf_helpers.h>
> +
> +SEC("xdp")
> +int xdp_dummy_prog(struct xdp_md *ctx)
> +{
> + return XDP_PASS;
> +}
> +
> +char _license[] SEC("license") = "GPL";
> diff --git a/tools/testing/selftests/drivers/net/hds.py b/tools/testing/selftests/drivers/net/hds.py
> index 394971b25c0b..90807b21a6eb 100755
> --- a/tools/testing/selftests/drivers/net/hds.py
> +++ b/tools/testing/selftests/drivers/net/hds.py
> @@ -2,17 +2,54 @@
> # SPDX-License-Identifier: GPL-2.0
>
> import errno
> +import os
> from lib.py import ksft_run, ksft_exit, ksft_eq, ksft_raises, KsftSkipEx
> -from lib.py import EthtoolFamily, NlError
> +from lib.py import CmdExitFailure, EthtoolFamily, NlError
> from lib.py import NetDrvEnv
> +from lib.py import defer, ethtool, ip
>
> -def get_hds(cfg, netnl) -> None:
> +
> +def _get_hds_mode(cfg, netnl) -> str:
> try:
> rings = netnl.rings_get({'header': {'dev-index': cfg.ifindex}})
> except NlError as e:
> raise KsftSkipEx('ring-get not supported by device')
> if 'tcp-data-split' not in rings:
> raise KsftSkipEx('tcp-data-split not supported by device')
> + return rings['tcp-data-split']
> +
> +
> +def _xdp_onoff(cfg):
> + test_dir = os.path.dirname(os.path.realpath(__file__))
> + prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o"
> + ip(f"link set dev %s xdp obj %s sec xdp" %
> + (cfg.ifname, prog))
> + ip(f"link set dev %s xdp off" % cfg.ifname)
nit: any reason you're not using {format} strings here?
ip(f"link set dev {cfg.ifname} xdp obj {prog} sec xdp")
ip(f"link set dev {cfg.ifname} xdp off")
next prev parent reply other threads:[~2025-02-21 16:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 2:51 [PATCH net v2 1/2] net: ethtool: fix ioctl confusing drivers about desired HDS user config Jakub Kicinski
2025-02-21 2:51 ` [PATCH net v2 2/2] selftests: drv-net: test XDP, HDS auto and the ioctl path Jakub Kicinski
2025-02-21 16:07 ` Stanislav Fomichev [this message]
2025-02-23 12:32 ` Taehee Yoo
2025-02-21 16:07 ` [PATCH net v2 1/2] net: ethtool: fix ioctl confusing drivers about desired HDS user config Stanislav Fomichev
2025-02-23 1:17 ` Daniel Xu
2025-02-23 12:26 ` Taehee Yoo
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=Z7ikpmXut900JqA1@mini-arch \
--to=stfomichev@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dxu@dxuuu.xyz \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=jstancek@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=shuah@kernel.org \
--cc=willemb@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.