From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 579D11BEB3 for ; Wed, 4 Jul 2018 22:11:59 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A4F1121B4F; Wed, 4 Jul 2018 16:11:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 04 Jul 2018 16:11:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=//ZcfkIDQdGx9VxlaAKEBFo2YO LOpxKODSHzbdBDuZc=; b=Sm8japC9H/8BXzZ2SPBAYbxlQ8Ov0WJgmsqsGccZGz JvMLRYSWj8vff2mfpI8zrB2qkYan7BzdyHgk4JIDv1Yen8tpwvk+jOH0zmgwFTvi V3BKKuUFZnYfoHjBLMQNQwbS4QSH2Gj5p8P+6UYCT3L/lwb04OsJ6tLmo6S/ZM6R Q= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=//Zcfk IDQdGx9VxlaAKEBFo2YOLOpxKODSHzbdBDuZc=; b=Z5j2UXRd9/ZXsVVu00LxW0 hAqZ2nAq7dmI7yyGK1iXZzrbi3SzldMy12YOTgwCBW7qo8+eESh7d+rFq6WWlFgw mA+Om+6bxJCwVZn3wLcBPqf4ORMEIdaWj60PatB3wXY+F5Ccr/nS4hf+Tcfzl6ua SRqYh2yjEc4wL7u77K5hDFZ5kPPXobhgYXa9lQuj7N6p8qCYfFUYgCgxlr//dedR 6tALVdRwunMGVByY8RYYvcjX840YBGc9qg77bdHRTbz9oTWRzAOtGP+ntBtygimA ObutVieBNGMlmFn4+kKs5n7pQwCM50G2qzdYA3Iivl/eWe8FfU+VFMm2SWa4m8DA == X-ME-Proxy: X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 0B11210261; Wed, 4 Jul 2018 16:11:56 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit Cc: Ophir Munk , "Wiles, Keith" , "dev@dpdk.org" , Pascal Mazon , Olga Shern Date: Wed, 04 Jul 2018 22:11:53 +0200 Message-ID: <1566202.bke8Esm90b@xps> In-Reply-To: <48f3aef6-765d-66d4-305c-541bd2aa3eb7@intel.com> References: <1528733172-24747-1-git-send-email-ophirmu@mellanox.com> <48f3aef6-765d-66d4-305c-541bd2aa3eb7@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v1] net/tap: explain how to compile eBPF C file X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 20:11:59 -0000 04/07/2018 21:47, Ferruh Yigit: > On 6/12/2018 3:02 PM, Ophir Munk wrote: > > Please note that other than cloning iproute2 we also need to install cl= ang and llvm tools versions 3.7 and upper. > > Not sure there are clang and llvm packages of the required versions for= the common distributions.=20 > > I compiled the tools source code and installed them manually. >=20 > Hi Keith, Thomas, >=20 > What do you suggest on this patch? >=20 > The "tap_bpf_program.c" is already withing the tap pmd this patch improve= s the > doc about how to compile it, although it may not be so user friendly as K= eith > pointed, I believe better to get doc improvement here. >=20 > And there is a code update "+#include "bpf_api.h", which includes a iprou= te2 > header, I am not sure about this one and how to manage this dependency. If you feel it needs some improvement, we can postpone it for 18.11. The most important is to have a patch to reference when somebody asks. It can be improved and merged later, no pressure. > >> -----Original Message----- > >> From: Wiles, Keith [mailto:keith.wiles@intel.com] > >> > >>> On Jun 12, 2018, at 8:44 AM, Thomas Monjalon > >> wrote: > >>> > >>> 12/06/2018 15:33, Wiles, Keith: > >>>> > >>>>> On Jun 12, 2018, at 7:58 AM, Thomas Monjalon > >> wrote: > >>>>> > >>>>> 12/06/2018 14:36, Wiles, Keith: > >>>>>> > >>>>>>> On Jun 12, 2018, at 7:26 AM, Thomas Monjalon > >> wrote: > >>>>>>> > >>>>>>> 11/06/2018 18:35, Wiles, Keith: > >>>>>>>> > >>>>>>>>> On Jun 11, 2018, at 11:06 AM, Ophir Munk > >> wrote: > >>>>>>>>> > >>>>>>>>> This commit explains how to manually compile the C source file > >>>>>>>>> tap_bpf_program.c into an ELF file using the clang compiler. > >>>>>>>>> The code in tap_bpf_program.c requires definitions found in > >>>>>>>>> iproute2 source code. This commit suggests cloning the iproute2 > >>>>>>>>> git tree and include its path in the clang command. It also adds > >>>>>>>>> inclusion of file bpf_api.h (required for eBPF definitions) > >>>>>>>>> which is located in iproute2 source tree. For more details refe= r to > >> TAP documentation. > >>>>>>>>> This commit is related to commits [1] and [2]. > >>>>>>>> > >>>>>>>> Normally I would have suggested that eBPF be disable in the TAP > >> driver as it requires external code and programs, but that ship has sa= iled. > >>>>>>> > >>>>>>> The external programs are required only to generate new > >>>>>>> instructions, changing the behaviour of the BPF program. > >>>>>>> Currently, the instructions for RSS behaviour are provided. > >>>>>>> > >>>>>>>> I would like to see building the tap_bpf_program.o as a target i= n the > >> Makefile, this way the developer can just run the =E2=80=98make bpf_pr= ogram=E2=80=99 target > >> and it would be simpler and less error prone. > >>>>> > >>>>> As explained in the documentation, for now there is a dependency on > >>>>> iproute2 for the compilation of this BPF program. > >>>>> So we cannot make it as simple as a "make command". > >>>>> Probably that we can rework it to change the dependency. > >>>>> I heard there are some good BPF libraries available now? > >>>> > >>>> Well the dependence of iproute2 is really no different then requirin= g say > >> libnuma, they just have to pull the code first to type the =E2=80=98ma= ke bpf_program=E2=80=99 > >> right? > >>> > >>> The iproute2 dependency is different because it is not a library. > >>> The .h file is never packaged. > >>> So we need to download the sources and set -I to this directory. > >> > >> To eliminate the -I problem the clone could be done inside the tap dir= ectory > >> and -I ./iproute2/include used, right? > >> The make target could even clone the code into the tap directory, which > >> means we can solve these problems you are pointing out. > >> > >> Go ahead and do what you want here, but making it harder for the devel= oper > >> should not be our normally mode of operation. > >> > >>> > >>> > >>>> If that is the case then a make target make sense to me. If iproute2= is not > >> found then an error, right? > >>> > >>> > >>>>>>> For this to happen, we need to improve the tools. > >>>>>> > >>>>>> In what way do we need to improve the tools and which tools are we > >> talking about. Building the .o file below appears to be a simple set of > >> command lines. I have a question in my original email about what tool. > >>>>> > >>>>> The .o file is only the an intermediate file. > >>>>> The next step (numbered as 5 in this patch) is to extract the > >>>>> section of BPF instructions to be uploaded in the kernel. > >>>>> This step must be done by a "tool". Ophir did it by hacking tc, but > >>>>> it is not upstreamed yet. > >>>>> There could be other ways (possibly easier) to achieve the same res= ult. > >>>> > >>>> Please change the doc to reflect the tool is not upstreamed yet and = the > >> developer needs to figure out how to extract the data from the binary. > >>>> > >>>> I used objdump -j l3_l4 -s tap_bpf_program.o and got a hex dump of > >>>> the l3_l4 section > >>>> > >>>> 0000 bf160000 00000000 61681000 00000000 ... > >>>> > >>>> Someone schooled in the art of Python coding should be able to > >>>> convert that output to a =E2=80=98C=E2=80=99 data array. :-) > >>>> > >>>>> > >>>>>>> It is a work in progress. > >>>>> > >>>>> Contributions are welcome. > >>>>> > >>>>>>> This is a very first step to use Linux BPF with DPDK. > >>>>>>> If there are more interests, we should really streamline its usage > >>>>>>> for all parts of DPDK which runs on top of some kernel code. > >>>>>> > >>>>>> streamlining other parts of DPDK would be nice, but we are now tal= king > >> about the tap/eBPF patch. > >>>> > >>>> Regards, > >>>> Keith > >> > >> Regards, > >> Keith > >=20 >=20 >=20