[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ae94398-2581-3cfb-da7e-702852d712a4@fb.com>
Date: Thu, 23 Jul 2020 15:05:19 -0700
From: Yonghong Song <yhs@...com>
To: Jakub Sitnicki <jakub@...udflare.com>, <bpf@...r.kernel.org>
CC: <netdev@...r.kernel.org>, <kernel-team@...udflare.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Subject: Re: [PATCH bpf v2 2/2] selftests/bpf: Add test for narrow loads from
context at an offset
On 7/23/20 2:59 AM, Jakub Sitnicki wrote:
> Check that narrow loads at various offsets from a context field backed by a
> target field that is smaller in size work as expected. That is target field
> value is loaded only when the offset is less than the target field size.
> While for offsets beyond the target field, the loaded value is zero.
>
> Signed-off-by: Jakub Sitnicki <jakub@...udflare.com>
Ack with minor nit below.
Acked-by: Yonghong Song <yhs@...com>
> ---
> .../selftests/bpf/prog_tests/narrow_load.c | 84 +++++++++++++++++++
> .../selftests/bpf/progs/test_narrow_load.c | 43 ++++++++++
> 2 files changed, 127 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/narrow_load.c
> create mode 100644 tools/testing/selftests/bpf/progs/test_narrow_load.c
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/narrow_load.c b/tools/testing/selftests/bpf/prog_tests/narrow_load.c
> new file mode 100644
> index 000000000000..6d79d722a66d
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/narrow_load.c
> @@ -0,0 +1,84 @@
> +// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
> +// Copyright (c) 2020 Cloudflare
> +
> +#include "test_progs.h"
> +#include "test_narrow_load.skel.h"
> +
> +static int duration;
> +
> +void run_sk_reuseport_prog(struct bpf_program *reuseport_prog)
static function?
> +{
> + static const struct timeval timeo = { .tv_sec = 3 };
> + struct sockaddr_in addr = {
> + .sin_family = AF_INET,
> + .sin_port = 0,
> + .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
> + };
> + socklen_t len = sizeof(addr);
> + int err, fd, prog_fd;
> + const int one = 1;
> + char buf = 42;
> + ssize_t n;
> +
[...]
Powered by blists - more mailing lists