[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQ+o0JcbrJr9YE0wHgg11DMWfpxsYcexU1SXt-SOzD1E-w@mail.gmail.com>
Date: Wed, 15 Jan 2020 13:26:23 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Eelco Chaudron <echaudro@...hat.com>, bpf <bpf@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Alexei Starovoitov <ast@...nel.org>,
Networking <netdev@...r.kernel.org>,
"Fijalkowski, Maciej" <maciej.fijalkowski@...el.com>
Subject: Re: [PATCH bpf-next v3] selftests/bpf: Add a test for attaching a bpf
fentry/fexit trace to an XDP program
On Wed, Jan 15, 2020 at 9:04 AM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
> On Wed, Jan 15, 2020 at 5:15 AM Eelco Chaudron <echaudro@...hat.com> wrote:
> >
> > Add a test that will attach a FENTRY and FEXIT program to the XDP test
> > program. It will also verify data from the XDP context on FENTRY and
> > verifies the return code on exit.
> >
> > Signed-off-by: Eelco Chaudron <echaudro@...hat.com>
> > ---
>
> Looks good, thanks! You are just missing one CHECK() for
> bpf_map_update_elem below, please add it. With that:
>
> Acked-by: Andrii Nakryiko <andriin@...com>
>
> > v2 -> v3:
> > - Incorporated review comments from Andrii and Maciej
> >
> > v1 -> v2:
> > - Changed code to use the BPF skeleton
> > - Replace static volatile with global variable in eBPF code
> >
> > .../testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c | 65 ++++++++++++++++++++
> > .../testing/selftests/bpf/progs/test_xdp_bpf2bpf.c | 44 ++++++++++++++
> > 2 files changed, 109 insertions(+)
> > create mode 100644 tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c
> > create mode 100644 tools/testing/selftests/bpf/progs/test_xdp_bpf2bpf.c
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c b/tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c
> > new file mode 100644
> > index 000000000000..6b56bdc73ebc
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c
> > @@ -0,0 +1,65 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +#include <test_progs.h>
> > +#include <net/if.h>
> > +#include "test_xdp.skel.h"
> > +#include "test_xdp_bpf2bpf.skel.h"
> > +
> > +void test_xdp_bpf2bpf(void)
> > +{
> > + __u32 duration = 0, retval, size;
> > + char buf[128];
> > + int err, pkt_fd, map_fd;
> > + struct iphdr *iph = (void *)buf + sizeof(struct ethhdr);
> > + struct iptnl_info value4 = {.family = AF_INET};
> > + struct test_xdp *pkt_skel = NULL;
> > + struct test_xdp_bpf2bpf *ftrace_skel = NULL;
> > + struct vip key4 = {.protocol = 6, .family = AF_INET};
> > + DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts);
> > +
> > + /* Load XDP program to introspect */
> > + pkt_skel = test_xdp__open_and_load();
> > + if (CHECK(!pkt_skel, "pkt_skel_load", "test_xdp skeleton failed\n"))
> > + return;
> > +
> > + pkt_fd = bpf_program__fd(pkt_skel->progs._xdp_tx_iptunnel);
> > +
> > + map_fd = bpf_map__fd(pkt_skel->maps.vip2tnl);
> > + bpf_map_update_elem(map_fd, &key4, &value4, 0);
>
> CHECK()? Sorry, didn't spot first time.
There is no such check in few other places in selftests and
I don't think it's really necessary here.
If we adjust them let's fix them all.
Applied to bpf-next. Thanks.
Powered by blists - more mailing lists