netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: YiFei Zhu <zhuyifei@google.com>
To: 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: [RFC PATCH net-next 0/3] selftests: Add AF_XDP functionality test
Date: Tue, 11 Jun 2024 20:42:44 +0000	[thread overview]
Message-ID: <cover.1718138187.git.zhuyifei@google.com> (raw)

We have observed that hardware NIC drivers may have faulty AF_XDP
implementations, and there seem to be a lack of a test of various modes
in which AF_XDP could run. This series adds a test to verify that NIC
drivers implements many AF_XDP features by performing a send / receive
of a single UDP packet.

I put the C code of the test under selftests/bpf because I'm not really
sure how I'd build the BPF-related code without the selftests/bpf
build infrastructure.

Tested on Google Cloud, with GVE:

  $ sudo NETIF=ens4 REMOTE_TYPE=ssh \
    REMOTE_ARGS="root@10.138.15.235" \
    LOCAL_V4="10.138.15.234" \
    REMOTE_V4="10.138.15.235" \
    LOCAL_NEXTHOP_MAC="42:01:0a:8a:00:01" \
    REMOTE_NEXTHOP_MAC="42:01:0a:8a:00:01" \
    python3 xsk_hw.py

  KTAP version 1
  1..22
  ok 1 xsk_hw.ipv4_basic
  ok 2 xsk_hw.ipv4_tx_skb_copy
  ok 3 xsk_hw.ipv4_tx_skb_copy_force_attach
  ok 4 xsk_hw.ipv4_rx_skb_copy
  ok 5 xsk_hw.ipv4_tx_drv_copy
  ok 6 xsk_hw.ipv4_tx_drv_copy_force_attach
  ok 7 xsk_hw.ipv4_rx_drv_copy
  [...]
  # Exception| STDERR: b'/tmp/zzfhcqkg/pbgodkgjxsk_hw: recv_pfpacket: Timeout\n'
  not ok 8 xsk_hw.ipv4_tx_drv_zerocopy
  ok 9 xsk_hw.ipv4_tx_drv_zerocopy_force_attach
  ok 10 xsk_hw.ipv4_rx_drv_zerocopy
  [...]
  # Exception| STDERR: b'/tmp/zzfhcqkg/pbgodkgjxsk_hw: connect sync client: max_retries\n'
  [...]
  # Exception| STDERR: b'/linux/tools/testing/selftests/bpf/xsk_hw: open_xsk: Device or resource busy\n'
  not ok 11 xsk_hw.ipv4_rx_drv_zerocopy_fill_after_bind
  ok 12 xsk_hw.ipv6_basic # SKIP Test requires IPv6 connectivity
  [...]
  ok 22 xsk_hw.ipv6_rx_drv_zerocopy_fill_after_bind # SKIP Test requires IPv6 connectivity
  # Totals: pass:9 fail:2 xfail:0 xpass:0 skip:11 error:0

YiFei Zhu (3):
  selftests/bpf: Move rxq_num helper from xdp_hw_metadata to
    network_helpers
  selftests/bpf: Add xsk_hw AF_XDP functionality test
  selftests: drv-net: Add xsk_hw AF_XDP functionality test

 tools/testing/selftests/bpf/.gitignore        |   1 +
 tools/testing/selftests/bpf/Makefile          |   7 +-
 tools/testing/selftests/bpf/network_helpers.c |  27 +
 tools/testing/selftests/bpf/network_helpers.h |  16 +
 tools/testing/selftests/bpf/progs/xsk_hw.c    |  72 ++
 tools/testing/selftests/bpf/xdp_hw_metadata.c |  27 +-
 tools/testing/selftests/bpf/xsk_hw.c          | 844 ++++++++++++++++++
 .../testing/selftests/drivers/net/hw/Makefile |   1 +
 .../selftests/drivers/net/hw/xsk_hw.py        | 133 +++
 9 files changed, 1102 insertions(+), 26 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/xsk_hw.c
 create mode 100644 tools/testing/selftests/bpf/xsk_hw.c
 create mode 100755 tools/testing/selftests/drivers/net/hw/xsk_hw.py

-- 
2.45.2.505.gda0bf45e8d-goog


             reply	other threads:[~2024-06-11 20:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 20:42 YiFei Zhu [this message]
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
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=cover.1718138187.git.zhuyifei@google.com \
    --to=zhuyifei@google.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 \
    /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;
as well as URLs for NNTP newsgroup(s).