From: lizetao <[email protected]>
To: David Wei <[email protected]>
Cc: Jens Axboe <[email protected]>,
Pavel Begunkov <[email protected]>,
Jakub Kicinski <[email protected]>, Paolo Abeni <[email protected]>,
"David S. Miller" <[email protected]>,
Eric Dumazet <[email protected]>,
"Jesper Dangaard Brouer" <[email protected]>,
David Ahern <[email protected]>,
"Mina Almasry" <[email protected]>,
Stanislav Fomichev <[email protected]>,
Joe Damato <[email protected]>,
Pedro Tammela <[email protected]>,
"[email protected]" <[email protected]>,
"[email protected]" <[email protected]>
Subject: RE: [PATCH net-next v13 11/11] io_uring/zcrx: add selftest
Date: Fri, 14 Feb 2025 02:27:16 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Hi,
> -----Original Message-----
> From: David Wei <[email protected]>
> Sent: Thursday, February 13, 2025 2:58 AM
> To: [email protected]; [email protected]
> Cc: Jens Axboe <[email protected]>; Pavel Begunkov
> <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni
> <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet
> <[email protected]>; Jesper Dangaard Brouer <[email protected]>; David
> Ahern <[email protected]>; Mina Almasry <[email protected]>;
> Stanislav Fomichev <[email protected]>; Joe Damato
> <[email protected]>; Pedro Tammela <[email protected]>
> Subject: [PATCH net-next v13 11/11] io_uring/zcrx: add selftest
>
> Add a selftest for io_uring zero copy Rx. This test cannot run locally and
> requires a remote host to be configured in net.config. The remote host must
> have hardware support for zero copy Rx as listed in the documentation page.
> The test will restore the NIC config back to before the test and is idempotent.
>
> liburing is required to compile the test and be installed on the remote host
> running the test.
>
> Signed-off-by: David Wei <[email protected]>
> ---
> .../selftests/drivers/net/hw/.gitignore | 2 +
> .../testing/selftests/drivers/net/hw/Makefile | 5 +
> .../selftests/drivers/net/hw/iou-zcrx.c | 426 ++++++++++++++++++
> .../selftests/drivers/net/hw/iou-zcrx.py | 64 +++
> 4 files changed, 497 insertions(+)
> create mode 100644 tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> create mode 100755 tools/testing/selftests/drivers/net/hw/iou-zcrx.py
>
> diff --git a/tools/testing/selftests/drivers/net/hw/.gitignore
> b/tools/testing/selftests/drivers/net/hw/.gitignore
> index e9fe6ede681a..6942bf575497 100644
> --- a/tools/testing/selftests/drivers/net/hw/.gitignore
> +++ b/tools/testing/selftests/drivers/net/hw/.gitignore
> @@ -1 +1,3 @@
> +# SPDX-License-Identifier: GPL-2.0-only iou-zcrx
> ncdevmem
> diff --git a/tools/testing/selftests/drivers/net/hw/Makefile
> b/tools/testing/selftests/drivers/net/hw/Makefile
> index 21ba64ce1e34..7efc47c89463 100644
> --- a/tools/testing/selftests/drivers/net/hw/Makefile
> +++ b/tools/testing/selftests/drivers/net/hw/Makefile
> @@ -1,5 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0+ OR MIT
>
> +TEST_GEN_FILES = iou-zcrx
> +
> TEST_PROGS = \
> csum.py \
> devlink_port_split.py \
> @@ -10,6 +12,7 @@ TEST_PROGS = \
> ethtool_rmon.sh \
> hw_stats_l3.sh \
> hw_stats_l3_gre.sh \
> + iou-zcrx.py \
> loopback.sh \
> nic_link_layer.py \
> nic_performance.py \
> @@ -38,3 +41,5 @@ include ../../../lib.mk # YNL build YNL_GENS := ethtool
> netdev include ../../../net/ynl.mk
> +
> +$(OUTPUT)/iou-zcrx: LDLIBS += -luring
> diff --git a/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> b/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> new file mode 100644
> index 000000000000..010c261d2132
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/hw/iou-zcrx.c
> @@ -0,0 +1,426 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <assert.h>
> +#include <errno.h>
> +#include <error.h>
> +#include <fcntl.h>
> +#include <limits.h>
> +#include <stdbool.h>
> +#include <stdint.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <unistd.h>
> +
> +#include <arpa/inet.h>
> +#include <linux/errqueue.h>
> +#include <linux/if_packet.h>
> +#include <linux/ipv6.h>
> +#include <linux/socket.h>
> +#include <linux/sockios.h>
> +#include <net/ethernet.h>
> +#include <net/if.h>
> +#include <netinet/in.h>
> +#include <netinet/ip.h>
> +#include <netinet/ip6.h>
> +#include <netinet/tcp.h>
> +#include <netinet/udp.h>
> +#include <sys/epoll.h>
> +#include <sys/ioctl.h>
> +#include <sys/mman.h>
> +#include <sys/resource.h>
> +#include <sys/socket.h>
> +#include <sys/stat.h>
> +#include <sys/time.h>
> +#include <sys/types.h>
> +#include <sys/un.h>
> +#include <sys/wait.h>
> +
When I compiled this testcase, I got some errors:
iou-zcrx.c:145:9: error: variable ‘region_reg’ has initializer but incomplete type
iou-zcrx.c:148:12: error: ‘IORING_MEM_REGION_TYPE_USER’ undeclared (first use in this function)
...
It seems that the linux/io_uring.h should be included here.
Also, after include this header file, some errors still exist.
iou-zcrx.c:(.text+0x5f0): undefined reference to `io_uring_register_ifq'
It is caused because io_uring_register_ifq symbol was not exported in liburing.
Finally some warnings should also be fixed:
iou-zcrx.c:288:17: warning: passing argument 2 of ‘bind’ from incompatible pointer type
iou-zcrx.c:326:18: warning: passing argument 2 of ‘connect’ from incompatible pointer type
> +#include <liburing.h>
---
Li Zetao
next prev parent reply other threads:[~2025-02-14 2:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 18:57 [PATCH v13 00/11] io_uring zero copy rx David Wei
2025-02-12 18:57 ` [PATCH net-next v13 01/11] io_uring/zcrx: add interface queue and refill queue David Wei
2025-02-12 18:57 ` [PATCH net-next v13 02/11] io_uring/zcrx: add io_zcrx_area David Wei
2025-02-12 18:57 ` [PATCH net-next v13 03/11] io_uring/zcrx: grab a net device David Wei
2025-02-12 18:57 ` [PATCH net-next v13 04/11] io_uring/zcrx: implement zerocopy receive pp memory provider David Wei
2025-02-13 20:57 ` Mina Almasry
2025-02-13 22:37 ` Pavel Begunkov
2025-02-13 22:46 ` Mina Almasry
2025-02-13 23:05 ` Pavel Begunkov
2025-02-12 18:57 ` [PATCH net-next v13 05/11] io_uring/zcrx: dma-map area for the device David Wei
2025-02-12 18:57 ` [PATCH net-next v13 06/11] io_uring/zcrx: add io_recvzc request David Wei
2025-02-12 18:57 ` [PATCH net-next v13 07/11] io_uring/zcrx: set pp memory provider for an rx queue David Wei
2025-02-12 18:57 ` [PATCH net-next v13 08/11] io_uring/zcrx: throttle receive requests David Wei
2025-02-12 18:57 ` [PATCH net-next v13 09/11] io_uring/zcrx: add copy fallback David Wei
2025-02-12 18:58 ` [PATCH net-next v13 10/11] net: add documentation for io_uring zcrx David Wei
2025-02-12 18:58 ` [PATCH net-next v13 11/11] io_uring/zcrx: add selftest David Wei
2025-02-14 2:27 ` lizetao [this message]
2025-02-14 15:52 ` David Wei
2025-02-14 21:57 ` David Wei
2025-02-14 22:31 ` David Wei
2025-02-13 17:44 ` [PATCH v13 00/11] io_uring zero copy rx Jens Axboe
2025-02-13 23:02 ` Pavel Begunkov
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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