Received: by 10.223.176.5 with SMTP id f5csp58553wra; Fri, 26 Jan 2018 17:29:29 -0800 (PST) X-Google-Smtp-Source: AH8x226JsgEVbcVhLmH263ZikOltuOp9agWpRUngQDVoQxeSZaOTYlTdzXYIxdGtHkZnOfSRcTbe X-Received: by 10.101.99.131 with SMTP id h3mr14834682pgv.381.1517016569165; Fri, 26 Jan 2018 17:29:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517016569; cv=none; d=google.com; s=arc-20160816; b=OsUAZe8uy1XaEd4T10lwfQFvVjuCFidWhq1JWV4JNGDcE9YyhxR8bligJJU7V0JR/b +v2eh29a1Dk3YR9CLOVCyscxKOHhKR4BbSvXUqWy4vyqTR8+b06CnfScffogTIQ3WfBt 0jjdTOrIRZ9T4lKOYokwgFHxAYt0qSl48j1Fp0U+GRsI3J32BWF7lUA6QJB981A5jj5p 1L46+rfzx3dMhNiexYLfifxmpIcVKINOTuNzm7VKaox+GwgSbzJOrjVpgOXFIS9g7fzj 2Qfj/uVZiP6Ri5B8uKSGMlckrzm84U4TIyuMnY8z0nOJzXJHEHYmLlx3Wz0KzuEZoBhc 6i8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=BGxnB4m58kWctTQ0juSle/vO+C1iy5tlDlEc9ZNlWGY=; b=azgVjnzAodLnBJSEPSEU7+Rvx0aw7zk6wSfkpMBxio/3s/evuMTa6looT3X2rRQy0k eHFm2GY1kzY/p4oqXQhcoJhj21uNEz5yhprxS/nvo2nu9qst9HAaHy2H/O7mX6jqdnU+ mdwDOoyxH0zHJj6HITwQnGe5mSgD0GmrRrL27mGjcu/HI48COxx42RBtYMcYo0qXxxps kvp6faO40o2scH8eop1KF6o7z+kOKher8DxzKSesspyOdb/A1Cn5ON+ZC5x0ZfCCd4zI 8jX0FeGDOUBEh14OWCkJB7Jkt0D9IwMYiwysfWft3zxXMs5o+78rNMpSOCJGJ4FSRJgn HEqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si3735849pgs.605.2018.01.26.17.29.14; Fri, 26 Jan 2018 17:29:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751712AbeA0B2v (ORCPT + 99 others); Fri, 26 Jan 2018 20:28:51 -0500 Received: from www62.your-server.de ([213.133.104.62]:58408 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbeA0B2u (ORCPT ); Fri, 26 Jan 2018 20:28:50 -0500 Received: from [62.202.221.5] (helo=linux.home) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1efFIW-0007mk-Ox; Sat, 27 Jan 2018 02:28:48 +0100 Subject: Re: [PATCH bpf-next v7 3/5] libbpf: add error reporting in XDP To: Eric Leblond Cc: alexei.starovoitov@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <4dc597a1-5046-3805-eb81-03a23bf0acbb@iogearbox.net> <20180125000548.12320-1-eric@regit.org> <20180125000548.12320-4-eric@regit.org> From: Daniel Borkmann Message-ID: <0291c0fe-d8c6-1072-3069-4b3000d290fe@iogearbox.net> Date: Sat, 27 Jan 2018 02:28:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20180125000548.12320-4-eric@regit.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.99.2/24253/Thu Jan 25 02:22:43 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 > Acked-by: Alexei Starovoitov > > remote rtne > > Signed-off-by: Eric Leblond 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 > +#include 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 > #include > > @@ -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;