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] [day] [month] [year] [list]
Message-ID: <057cb8a9-97ca-47c6-bad0-19f3780a08cd@davidwei.uk>
Date: Fri, 14 Feb 2025 14:31:59 -0800
From: David Wei <dw@...idwei.uk>
To: lizetao <lizetao1@...wei.com>
Cc: Jens Axboe <axboe@...nel.dk>, Pavel Begunkov <asml.silence@...il.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jesper Dangaard Brouer <hawk@...nel.org>, David Ahern <dsahern@...nel.org>,
 Mina Almasry <almasrymina@...gle.com>,
 Stanislav Fomichev <stfomichev@...il.com>, Joe Damato <jdamato@...tly.com>,
 Pedro Tammela <pctammela@...atatu.com>,
 "io-uring@...r.kernel.org" <io-uring@...r.kernel.org>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v13 11/11] io_uring/zcrx: add selftest

On 2025-02-13 18:27, lizetao wrote:
> Hi,
> 
>> -----Original Message-----
>> From: David Wei <dw@...idwei.uk>
>> Sent: Thursday, February 13, 2025 2:58 AM
>> To: io-uring@...r.kernel.org; netdev@...r.kernel.org
>> Cc: Jens Axboe <axboe@...nel.dk>; Pavel Begunkov
>> <asml.silence@...il.com>; Jakub Kicinski <kuba@...nel.org>; Paolo Abeni
>> <pabeni@...hat.com>; David S. Miller <davem@...emloft.net>; Eric Dumazet
>> <edumazet@...gle.com>; Jesper Dangaard Brouer <hawk@...nel.org>; David
>> Ahern <dsahern@...nel.org>; Mina Almasry <almasrymina@...gle.com>;
>> Stanislav Fomichev <stfomichev@...il.com>; Joe Damato
>> <jdamato@...tly.com>; Pedro Tammela <pctammela@...atatu.com>
>> 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 <dw@...idwei.uk>
>> ---
>>  .../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

Hmm I don't get these warnings with neither GCC nor clang. What is your
setup?

$ gcc --version
gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-2)

$ clang --version
clang version 19.1.5 (CentOS 19.1.5-2.el9)

> 
>> +#include <liburing.h>
> 
> ---
> Li Zetao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ