Received: by 10.223.176.5 with SMTP id f5csp4151810wra; Tue, 30 Jan 2018 02:59:07 -0800 (PST) X-Google-Smtp-Source: AH8x225gI9Z1kY6PyPgYj84XFTnoEDP/JnPPgfsGCKs9fBifGdZbKNYfJwYJjnQL8apxfu2ujX4q X-Received: by 10.99.112.75 with SMTP id a11mr24630425pgn.47.1517309946992; Tue, 30 Jan 2018 02:59:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517309946; cv=none; d=google.com; s=arc-20160816; b=p/zSFuSfi4Z+N9V4pRFEZpL4TSn7LXNQzF4Y9kYE5v2HRSuM9m9mRWRfZEg6REB9yI 38uhExc6z5urXLR7jKIqtdglfFkjPKpweO3O3Zh0lQQZWJcNUfnskyoKdiK2Hfd4jqi8 OOgsxOF3s5JEDwAH4ckIbsrqZ6F27TfW5noGXsUmzbrEjpveY9GRHMPsiPMK8GwWkDd5 awco/vRRFSvDdst0on9lesgT6bZHjCEDJStZ8KQzWsVVx0ZOWI9dwureRXn0j9xFKf5l fpplSWO2IjK1uKkN+HlbemnUNF5A8HTaoE+eFJy6ojB3CMYoO7vmCPx3h34E9dCc9Qc3 0I3A== 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=QvD5e2rPiCu/1UrCBAUCecnAw/mI/PApGyOpFoRLZ3g=; b=LdQ385JHj9MowQMnXH1pjT6jB7dDPL0xT8tyloz7IkCHN/Wu4GuohJvogkS1GJy5We U7dPHs576qPVFL50qpipIIzpdQ8gJ7PD0GtrUGavr3pzRRDk3thrGQnJHK0Hu2H/CbVS DOeStDTh1aVr4giPYArb42xVXe4qTfKnep/U10Gdmh5YfdVHcQ59lHuABPJmATDfO6tM kotgjfoNKHSwlR5CRHadIcdiYhoujDHCe5tjd84GwuLApcij/7mBqMkIRbsYAhEgMWE4 G4RDUM+YQTImhVHJ/c8Fia3N8I59h5E+KQhqAbToueOy8OMBU2VbOZZpvSM3jM3ADbar ZiWg== 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 p13si1453213pff.251.2018.01.30.02.58.52; Tue, 30 Jan 2018 02:59:06 -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 S1751853AbeA3K60 (ORCPT + 99 others); Tue, 30 Jan 2018 05:58:26 -0500 Received: from www62.your-server.de ([213.133.104.62]:50859 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751764AbeA3K6Z (ORCPT ); Tue, 30 Jan 2018 05:58:25 -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 1egTcM-0006qn-RT; Tue, 30 Jan 2018 11:58:23 +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> <0291c0fe-d8c6-1072-3069-4b3000d290fe@iogearbox.net> <1517049126.24241.19.camel@regit.org> From: Daniel Borkmann Message-ID: Date: Tue, 30 Jan 2018 11:58:22 +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: <1517049126.24241.19.camel@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.3/24269/Tue Jan 30 10:24:12 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, On 01/27/2018 11:32 AM, Eric Leblond wrote: > On Sat, 2018-01-27 at 02:28 +0100, Daniel Borkmann wrote: >> 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? > > Outch > >>> 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? > > Yes, sure. > >>> #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? > > Yes, and I fear a lot of dependencies. Sorry for the delay! So, once you pull these two headers in, are there more follow-up dependencies with other headers required on your old test system? I'd also be fine with keeping SOL_NETLINK here as is, but I would try to have the if_link.h in the tools/ include infra, so we have all XDP definitions available and up to date from the lib's pov. The dependency for if_link.h seems minimal and probably enough to to only get in this single header. Could you give that a try? Thanks a lot, Daniel