From: Yonghong Song <yhs@fb.com>
To: Weqaar Janjua <weqaar.janjua@gmail.com>, <bpf@vger.kernel.org>,
<netdev@vger.kernel.org>, <daniel@iogearbox.net>,
<ast@kernel.org>, <magnus.karlsson@gmail.com>,
<bjorn.topel@intel.com>
Cc: Weqaar Janjua <weqaar.a.janjua@intel.com>, <shuah@kernel.org>,
<skhan@linuxfoundation.org>, <linux-kselftest@vger.kernel.org>,
<anders.roxell@linaro.org>, <jonathan.lemon@gmail.com>
Subject: Re: [PATCH bpf-next v3 2/5] selftests/bpf: xsk selftests - SKB POLL, NOPOLL
Date: Thu, 26 Nov 2020 20:31:49 -0800 [thread overview]
Message-ID: <394e96ea-cf70-90e1-599e-eef8e613eef8@fb.com> (raw)
In-Reply-To: <20201125183749.13797-3-weqaar.a.janjua@intel.com>
On 11/25/20 10:37 AM, Weqaar Janjua wrote:
> Adds following tests:
>
> 1. AF_XDP SKB mode
> Generic mode XDP is driver independent, used when the driver does
> not have support for XDP. Works on any netdevice using sockets and
> generic XDP path. XDP hook from netif_receive_skb().
> a. nopoll - soft-irq processing
> b. poll - using poll() syscall
>
> Signed-off-by: Weqaar Janjua <weqaar.a.janjua@intel.com>
> ---
> tools/testing/selftests/bpf/Makefile | 2 +-
> tools/testing/selftests/bpf/test_xsk.sh | 36 +-
> tools/testing/selftests/bpf/xdpxceiver.c | 961 +++++++++++++++++++++++
> tools/testing/selftests/bpf/xdpxceiver.h | 151 ++++
> tools/testing/selftests/bpf/xsk_env.sh | 17 +
> 5 files changed, 1158 insertions(+), 9 deletions(-)
> create mode 100644 tools/testing/selftests/bpf/xdpxceiver.c
> create mode 100644 tools/testing/selftests/bpf/xdpxceiver.h
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 596ee5c27906..a2be2725be11 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -83,7 +83,7 @@ TEST_PROGS_EXTENDED := with_addr.sh \
> # Compile but not part of 'make run_tests'
> TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \
> flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \
> - test_lirc_mode2_user xdping test_cpp runqslower bench
> + test_lirc_mode2_user xdping test_cpp runqslower bench xdpxceiver
>
> TEST_CUSTOM_PROGS = urandom_read
>
[...]
> +
> +static void parse_command_line(int argc, char **argv)
> +{
> + int option_index, interface_index = 0, c;
> +
> + opterr = 0;
> +
> + for (;;) {
> + c = getopt_long(argc, argv, "i:q:pScDC:", long_options, &option_index);
> +
> + if (c == -1)
> + break;
> +
> + switch (c) {
> + case 'i':
> + if (interface_index == MAX_INTERFACES)
> + break;
> + char *sptr, *token;
> +
> + memcpy(ifdict[interface_index]->ifname,
> + strtok_r(optarg, ",", &sptr), MAX_INTERFACE_NAME_CHARS);
During compilation, I hit the following compiler warnings,
xdpxceiver.c: In function ‘main’:
xdpxceiver.c:461:4: warning: ‘__s’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
memcpy(ifdict[interface_index]->ifname,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strtok_r(optarg, ",", &sptr), MAX_INTERFACE_NAME_CHARS);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xdpxceiver.c:443:13: note: ‘__s’ was declared here
static void parse_command_line(int argc, char **argv)
^~~~~~~~~~~~~~~~~~
I am using gcc8. I am not sure whether we should silence such
warning or not (-Wno-maybe-uninitialized). Did you see such a warning
during your compilation?
> + token = strtok_r(NULL, ",", &sptr);
> + if (token)
> + memcpy(ifdict[interface_index]->nsname, token,
> + MAX_INTERFACES_NAMESPACE_CHARS);
> + interface_index++;
> + break;
> + case 'q':
> + opt_queue = atoi(optarg);
> + break;
> + case 'p':
> + opt_poll = 1;
> + break;
> + case 'S':
> + opt_xdp_flags |= XDP_FLAGS_SKB_MODE;
> + opt_xdp_bind_flags |= XDP_COPY;
> + uut = ORDER_CONTENT_VALIDATE_XDP_SKB;
> + break;
> + case 'c':
> + opt_xdp_bind_flags |= XDP_COPY;
> + break;
> + case 'D':
> + debug_pkt_dump = 1;
> + break;
> + case 'C':
> + opt_pkt_count = atoi(optarg);
> + break;
> + default:
> + usage(basename(argv[0]));
> + ksft_exit_xfail();
> + }
> + }
> +
> + if (!validate_interfaces()) {
> + usage(basename(argv[0]));
> + ksft_exit_xfail();
> + }
> +}
> +
[...]
next prev parent reply other threads:[~2020-11-27 4:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 18:37 [PATCH bpf-next v3 0/5] selftests/bpf: xsk selftests Weqaar Janjua
2020-11-25 18:37 ` [PATCH bpf-next v3 1/5] selftests/bpf: xsk selftests framework Weqaar Janjua
2020-11-26 6:44 ` Yonghong Song
2020-11-26 9:01 ` Björn Töpel
2020-11-26 21:22 ` Weqaar Janjua
2020-11-27 4:19 ` Yonghong Song
2020-11-27 17:54 ` Weqaar Janjua
2020-11-28 3:13 ` Yonghong Song
2020-12-07 21:55 ` Weqaar Janjua
2020-12-08 3:48 ` Yonghong Song
2020-11-25 18:37 ` [PATCH bpf-next v3 2/5] selftests/bpf: xsk selftests - SKB POLL, NOPOLL Weqaar Janjua
2020-11-27 4:31 ` Yonghong Song [this message]
2020-11-27 9:01 ` Weqaar Janjua
2020-11-25 18:37 ` [PATCH bpf-next v3 3/5] selftests/bpf: xsk selftests - DRV " Weqaar Janjua
2020-11-25 18:37 ` [PATCH bpf-next v3 4/5] selftests/bpf: xsk selftests - Socket Teardown - SKB, DRV Weqaar Janjua
2020-11-25 18:37 ` [PATCH bpf-next v3 5/5] selftests/bpf: xsk selftests - Bi-directional Sockets " Weqaar Janjua
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=394e96ea-cf70-90e1-599e-eef8e613eef8@fb.com \
--to=yhs@fb.com \
--cc=anders.roxell@linaro.org \
--cc=ast@kernel.org \
--cc=bjorn.topel@intel.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jonathan.lemon@gmail.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=magnus.karlsson@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=weqaar.a.janjua@intel.com \
--cc=weqaar.janjua@gmail.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).