From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03352C169C4 for ; Thu, 31 Jan 2019 10:05:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D3DCD20B1F for ; Thu, 31 Jan 2019 10:05:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729232AbfAaKFi (ORCPT ); Thu, 31 Jan 2019 05:05:38 -0500 Received: from www62.your-server.de ([213.133.104.62]:49924 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726316AbfAaKFi (ORCPT ); Thu, 31 Jan 2019 05:05:38 -0500 Received: from [78.46.172.3] (helo=sslproxy06.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1gp9Dy-0002oc-VU; Thu, 31 Jan 2019 11:05:35 +0100 Received: from [178.197.249.18] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1gp9Dy-0008z6-Nl; Thu, 31 Jan 2019 11:05:34 +0100 Subject: Re: [PATCH bpf-next v3 2/3] libbpf: add support for using AF_XDP sockets To: Magnus Karlsson , bjorn.topel@intel.com, ast@kernel.org, netdev@vger.kernel.org, jakub.kicinski@netronome.com, bjorn.topel@gmail.com, qi.z.zhang@intel.com Cc: brouer@redhat.com References: <1548774737-16579-1-git-send-email-magnus.karlsson@intel.com> <1548774737-16579-3-git-send-email-magnus.karlsson@intel.com> From: Daniel Borkmann Message-ID: Date: Thu, 31 Jan 2019 11:05:33 +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: <1548774737-16579-3-git-send-email-magnus.karlsson@intel.com> 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.100.2/25345/Thu Jan 31 07:13:04 2019) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 01/29/2019 04:12 PM, Magnus Karlsson wrote: > This commit adds AF_XDP support to libbpf. The main reason for this is > to facilitate writing applications that use AF_XDP by offering > higher-level APIs that hide many of the details of the AF_XDP > uapi. This is in the same vein as libbpf facilitates XDP adoption by > offering easy-to-use higher level interfaces of XDP > functionality. Hopefully this will facilitate adoption of AF_XDP, make > applications using it simpler and smaller, and finally also make it > possible for applications to benefit from optimizations in the AF_XDP > user space access code. Previously, people just copied and pasted the > code from the sample application into their application, which is not > desirable. > > The interface is composed of two parts: > > * Low-level access interface to the four rings and the packet > * High-level control plane interface for creating and setting > up umems and af_xdp sockets as well as a simple XDP program. > > Signed-off-by: Magnus Karlsson [...] > libbpf ABI > ========== > > diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map > index 266bc95..d294843 100644 > --- a/tools/lib/bpf/libbpf.map > +++ b/tools/lib/bpf/libbpf.map > @@ -121,6 +121,18 @@ LIBBPF_0.0.1 { > libbpf_prog_type_by_name; > libbpf_set_print; > libbpf_strerror; > + xsk_ring_cons__peek; > + xsk_ring_cons__release; > + xsk_ring_prod__reserve; > + xsk_ring_prod__submit; > + xsk_umem__get_data; > + xsk_umem__get_data_raw; > + xsk_umem__create; > + xsk_socket__create; > + xsk_umem__delete; > + xsk_socket__delete; > + xsk_umem__fd; > + xsk_socket__fd; This definitely needs to be placed under LIBBPF_0.0.2 where we have bpf_probe_* that were added in this cycle. > local: > *; > }; > diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c