From: Daniel Borkmann <daniel@iogearbox.net>
To: Eric Leblond <eric@regit.org>
Cc: alexei.starovoitov@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v7 3/5] libbpf: add error reporting in XDP
Date: Sat, 27 Jan 2018 02:28:48 +0100 [thread overview]
Message-ID: <0291c0fe-d8c6-1072-3069-4b3000d290fe@iogearbox.net> (raw)
In-Reply-To: <20180125000548.12320-4-eric@regit.org>
On 01/25/2018 01:05 AM, Eric Leblond wrote:
> Parse netlink ext attribute to get the error message returned by
> the card. Code is partially take from libnl.
>
> We add netlink.h to the uapi include of tools. And we need to
> avoid include of userspace netlink header to have a successful
> build of sample so nlattr.h has a define to avoid
> the inclusion. Using a direct define could have been an issue
> as NLMSGERR_ATTR_MAX can change in the future.
>
> We also define SOL_NETLINK if not defined to avoid to have to
> copy socket.h for a fixed value.
>
> Signed-off-by: Eric Leblond <eric@regit.org>
> Acked-by: Alexei Starovoitov <ast@kernel.org>
>
> remote rtne
>
> Signed-off-by: Eric Leblond <eric@regit.org>
Some leftover artifact from squashing commits?
> samples/bpf/Makefile | 2 +-
> tools/lib/bpf/Build | 2 +-
> tools/lib/bpf/bpf.c | 13 +++-
> tools/lib/bpf/nlattr.c | 187 +++++++++++++++++++++++++++++++++++++++++++++++++
> tools/lib/bpf/nlattr.h | 72 +++++++++++++++++++
> 5 files changed, 273 insertions(+), 3 deletions(-)
> create mode 100644 tools/lib/bpf/nlattr.c
> create mode 100644 tools/lib/bpf/nlattr.h
>
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 7f61a3d57fa7..5c4cd3745282 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -45,7 +45,7 @@ hostprogs-y += xdp_rxq_info
> hostprogs-y += syscall_tp
>
> # Libbpf dependencies
> -LIBBPF := ../../tools/lib/bpf/bpf.o
> +LIBBPF := ../../tools/lib/bpf/bpf.o ../../tools/lib/bpf/nlattr.o
> CGROUP_HELPERS := ../../tools/testing/selftests/bpf/cgroup_helpers.o
>
> test_lru_dist-objs := test_lru_dist.o $(LIBBPF)
> diff --git a/tools/lib/bpf/Build b/tools/lib/bpf/Build
> index d8749756352d..64c679d67109 100644
> --- a/tools/lib/bpf/Build
> +++ b/tools/lib/bpf/Build
> @@ -1 +1 @@
> -libbpf-y := libbpf.o bpf.o
> +libbpf-y := libbpf.o bpf.o nlattr.o
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> index 749a447ec9ed..765fd95b0657 100644
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
> @@ -27,7 +27,7 @@
> #include "bpf.h"
> #include "libbpf.h"
> #include "nlattr.h"
> -#include <uapi/linux/rtnetlink.h>
> +#include <linux/rtnetlink.h>
Okay, so here it's put back from prior added uapi/linux/rtnetlink.h
into linux/rtnetlink.h. Could you add this properly in the first
commit rather than relative adjustment/fix within the same set?
> #include <sys/socket.h>
> #include <errno.h>
>
> @@ -37,6 +37,10 @@
> #define IFLA_XDP_FLAGS 3
> #endif
>
> +#ifndef SOL_NETLINK
> +#define SOL_NETLINK 270
> +#endif
This would need include/linux/socket.h into tools/ include infra
as well, no?
> /*
> * When building perf, unistd.h is overridden. __NR_bpf is
> * required to be defined explicitly.
> @@ -441,6 +445,7 @@ int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags)
> struct nlmsghdr *nh;
> struct nlmsgerr *err;
> socklen_t addrlen;
next prev parent reply other threads:[~2018-01-27 1:28 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-25 22:13 [PATCH bpf-next 0/3] add XDP loading support to libbpf Eric Leblond
2017-12-25 22:13 ` [PATCH bpf-next 1/3] libbpf: add function to setup XDP Eric Leblond
2017-12-25 22:13 ` [PATCH bpf-next 2/3] libbpf: add error reporting in XDP Eric Leblond
2017-12-27 2:27 ` Alexei Starovoitov
2017-12-27 18:02 ` [PATCH bpf-next v2 0/4] libbpf: add function to setup XDP Eric Leblond
2017-12-27 18:02 ` [PATCH 1/4] " Eric Leblond
2017-12-27 18:57 ` Alexei Starovoitov
2017-12-28 0:59 ` Toshiaki Makita
2017-12-27 18:02 ` [PATCH 2/4] libbpf: add error reporting in XDP Eric Leblond
2017-12-27 18:57 ` Alexei Starovoitov
2017-12-27 18:02 ` [PATCH 3/4] libbpf: break loop earlier Eric Leblond
2017-12-27 19:00 ` Alexei Starovoitov
2017-12-27 20:30 ` Eric Leblond
2017-12-27 23:05 ` Daniel Borkmann
2017-12-28 8:04 ` [PATCH bpf-next v3 0/3] libbpf: add XDP setup support Eric Leblond
2017-12-28 8:04 ` [PATCH bpf-next v3 1/3] libbpf: add function to setup XDP Eric Leblond
2017-12-28 8:18 ` Toshiaki Makita
2017-12-30 20:41 ` [PATCH bpf-next v4 0/3] " Eric Leblond
2017-12-30 20:41 ` [PATCH bpf-next v4 1/3] " Eric Leblond
2018-01-03 23:59 ` Eric Leblond
2018-01-04 8:21 ` [PATCH bpf-next v5 1/4] " Eric Leblond
2018-01-04 8:21 ` [PATCH bpf-next v5 2/4] libbpf: add error reporting in XDP Eric Leblond
2018-01-06 21:16 ` Daniel Borkmann
2018-01-18 23:35 ` Eric Leblond
2018-01-18 23:43 ` [PATCH bpf-next 0/4] libbpf: add XDP binding support Eric Leblond
2018-01-18 23:43 ` [PATCH bpf-next v6 1/4] libbpf: add function to setup XDP Eric Leblond
2018-01-18 23:43 ` [PATCH bpf-next v6 2/4] libbpf: add error reporting in XDP Eric Leblond
2018-01-18 23:43 ` [PATCH bpf-next v6 3/4] libbpf: add missing SPDX-License-Identifier Eric Leblond
2018-01-18 23:43 ` [PATCH bpf-next v6 4/4] samples/bpf: use bpf_set_link_xdp_fd Eric Leblond
2018-01-20 2:00 ` [PATCH bpf-next 0/4] libbpf: add XDP binding support Daniel Borkmann
2018-01-20 2:27 ` Alexei Starovoitov
2018-01-20 8:21 ` Daniel Borkmann
2018-01-25 0:05 ` [PATCH bpf-next v7 0/5] libbpf: add XDP setup support Eric Leblond
2018-01-25 0:05 ` [PATCH bpf-next v7 1/5] tools: import netlink header in tools uapi Eric Leblond
2018-01-25 0:05 ` [PATCH bpf-next v7 2/5] libbpf: add function to setup XDP Eric Leblond
2018-01-27 1:23 ` Daniel Borkmann
2018-01-27 10:22 ` Eric Leblond
2018-01-25 0:05 ` [PATCH bpf-next v7 3/5] libbpf: add error reporting in XDP Eric Leblond
2018-01-27 1:28 ` Daniel Borkmann [this message]
2018-01-27 10:32 ` Eric Leblond
2018-01-30 10:58 ` Daniel Borkmann
2018-01-30 20:50 ` [PATCH bpf-next v8 0/5] libbpf: add XDP binding support Eric Leblond
2018-01-31 16:53 ` Daniel Borkmann
2018-02-03 2:01 ` Alexei Starovoitov
2018-01-30 20:55 ` [PATCH bpf-next v8 1/5] tools: add netlink.h and if_link.h in tools uapi Eric Leblond
2018-01-30 20:55 ` [PATCH bpf-next v8 2/5] libbpf: add function to setup XDP Eric Leblond
2018-01-30 20:55 ` [PATCH bpf-next v8 3/5] libbpf: add error reporting in XDP Eric Leblond
2018-01-30 20:55 ` [PATCH bpf-next v8 4/5] libbpf: add missing SPDX-License-Identifier Eric Leblond
2018-01-30 20:55 ` [PATCH bpf-next v8 5/5] samples/bpf: use bpf_set_link_xdp_fd Eric Leblond
2018-01-25 0:05 ` [PATCH bpf-next v7 4/5] libbpf: add missing SPDX-License-Identifier Eric Leblond
2018-01-25 0:05 ` [PATCH bpf-next v7 5/5] samples/bpf: use bpf_set_link_xdp_fd Eric Leblond
2018-01-04 8:21 ` [PATCH bpf-next v5 3/4] libbpf: add missing SPDX-License-Identifier Eric Leblond
2018-01-04 9:49 ` Philippe Ombredanne
2018-01-04 8:21 ` [PATCH bpf-next v5 4/4] samples/bpf: use bpf_set_link_xdp_fd Eric Leblond
2017-12-30 20:41 ` [PATCH bpf-next v4 2/3] libbpf: add error reporting in XDP Eric Leblond
2017-12-31 11:20 ` Philippe Ombredanne
2017-12-30 20:41 ` [PATCH bpf-next v4 3/3] libbpf: add missing SPDX-License-Identifier Eric Leblond
2017-12-28 8:04 ` [PATCH bpf-next v3 2/3] libbpf: add error reporting in XDP Eric Leblond
2017-12-28 8:04 ` [PATCH bpf-next v3 3/3] libbpf: add missing SPDX-License-Identifier Eric Leblond
2017-12-29 12:35 ` Philippe Ombredanne
2017-12-27 18:02 ` [PATCH 4/4] " Eric Leblond
2017-12-27 19:01 ` Alexei Starovoitov
2017-12-25 22:13 ` [PATCH bpf-next 3/3] libbpf: break loop earlier Eric Leblond
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=0291c0fe-d8c6-1072-3069-4b3000d290fe@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=alexei.starovoitov@gmail.com \
--cc=eric@regit.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).