From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas@monjalon.net>
Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com
 [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id DF0EA1E862
 for <dev@dpdk.org>; Tue, 12 Jun 2018 15:44:09 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 74E61212AD;
 Tue, 12 Jun 2018 09:44:09 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Tue, 12 Jun 2018 09:44:09 -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=BcJIuTbHnQNpmUIUbk5idOiNJN
 qUHuVuPimTZEuz21w=; b=D9DDF4Ho3N4KT8OHDMtCuhy+LnXUcM5McpdJkV88M7
 Z+yBQirxNFIF4QnGeEy99w5spEIdsCUcpEXOjC5nxZveBoMtyMSNJkWsOWHWcw+Q
 WRJSTk0wtkJe+uo/QiEmATwBAgDTAA9/K2FmgcBkhHwGNp/EQr0UluEWTtlBbra9
 0=
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=BcJIuT
 bHnQNpmUIUbk5idOiNJNqUHuVuPimTZEuz21w=; b=N9ZEUrRRQywCegVQkver7i
 hg/IVD/JJnnnynl97POvENuuUjspXeFmZHz/Z/Vh237QKhoxfiKV/TvgNLFTuKvX
 A4or84jx3oSWF1ZhBdlaUyF4YFWWDWxfwirmQXWVuRN+RELKJL03pvop7Zo8jRKo
 VGU3atYje8Ps5bg20fHXv7iyZgnazplNsb7tWrW1Ka/D4GtpHZ+jxEOElyl10bcQ
 XREh2gRLt7Jdmyagcz5nnsjTYfZzoVkVWOAhMI4GS5xSggEZUlwQodBrOwkDY3/c
 e0vuMpk1Gc6Pj83sApd371fHOKRjEDkZsI+F35lg5zENFiJ8vcJX9cDC8+ytx5lw
 ==
X-ME-Proxy: <xmx:Kc4fW42xfrjhYnD9SKa-un_dB5TnIVTFfZCMHLYZGcvgbP2XZzyZEg>
X-ME-Proxy: <xmx:Kc4fW_8bkNxepUPJSNluxVKKyJ2NdWaajt22cImysXP_YPsm3Rftyw>
X-ME-Proxy: <xmx:Kc4fWwq7I2Fvt_1fRCt_QbN684yl-iNtFJ8OmD4zeX4OaJ6momNpsQ>
X-ME-Proxy: <xmx:Kc4fWxTP-RD0YnUGtDRYw_sgSZ0v_XttCHPY3BtLhH81NvJXp6rpeA>
X-ME-Proxy: <xmx:Kc4fW7PZevp4XtKu5IWtbw0-mJ47YgHuAZkMcT7CcYqbUqeq9ZUw-g>
X-ME-Proxy: <xmx:Kc4fW7gLv2AptObWq0fHEnmR7uMvx4z6nOaq-IVmXlYmhLJqyPTmLw>
X-ME-Sender: <xms:Kc4fW4m9jZ2R-CzcurIkx8eE_x_k2FJ106jStx00eV1TbQT68FppYQ>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 9E5291035D;
 Tue, 12 Jun 2018 09:44:08 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: "Wiles, Keith" <keith.wiles@intel.com>
Cc: dev@dpdk.org, Ophir Munk <ophirmu@mellanox.com>,
 Pascal Mazon <pascal.mazon@6wind.com>, Olga Shern <olgas@mellanox.com>
Date: Tue, 12 Jun 2018 15:44:07 +0200
Message-ID: <2475252.9oVMbiDvHd@xps>
In-Reply-To: <2FAE2DE7-DB89-42F8-9010-E522187248AD@intel.com>
References: <1528733172-24747-1-git-send-email-ophirmu@mellanox.com>
 <3694221.zYt2n70HGy@xps> <2FAE2DE7-DB89-42F8-9010-E522187248AD@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 <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 12 Jun 2018 13:44:10 -0000

12/06/2018 15:33, Wiles, Keith:
>=20
> > On Jun 12, 2018, at 7:58 AM, Thomas Monjalon <thomas@monjalon.net> wrot=
e:
> >=20
> > 12/06/2018 14:36, Wiles, Keith:
> >>=20
> >>> On Jun 12, 2018, at 7:26 AM, Thomas Monjalon <thomas@monjalon.net> wr=
ote:
> >>>=20
> >>> 11/06/2018 18:35, Wiles, Keith:
> >>>>=20
> >>>>> On Jun 11, 2018, at 11:06 AM, Ophir Munk <ophirmu@mellanox.com> wro=
te:
> >>>>>=20
> >>>>> 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 fi=
le
> >>>>> bpf_api.h (required for eBPF definitions) which is located in iprou=
te2
> >>>>> source tree. For more details refer to TAP documentation.
> >>>>> This commit is related to commits [1] and [2].
> >>>>=20
> >>>> Normally I would have suggested that eBPF be disable in the TAP driv=
er as it requires external code and programs, but that ship has sailed.
> >>>=20
> >>> 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.
> >>>=20
> >>>> I would like to see building the tap_bpf_program.o as a target in th=
e Makefile, this way the developer can just run the =E2=80=98make bpf_progr=
am=E2=80=99 target and it would be simpler and less error prone.
> >=20
> > As explained in the documentation, for now there is a dependency on ipr=
oute2
> > 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?
>=20
> Well the dependence of iproute2 is really no different then requiring say=
 libnuma, they just have to pull the code first to type the =E2=80=98make b=
pf_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.


> If that is the case then a make target make sense to me. If iproute2 is n=
ot found then an error, right?


> >>> For this to happen, we need to improve the tools.
> >>=20
> >> In what way do we need to improve the tools and which tools are we tal=
king about. Building the .o file below appears to be a simple set of comman=
d lines. I have a question in my original email about what tool.
> >=20
> > 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 result.
>=20
> Please change the doc to reflect the tool is not upstreamed yet and the d=
eveloper needs to figure out how to extract the data from the binary.
>=20
> I used objdump -j l3_l4 -s tap_bpf_program.o and got a hex dump of the l3=
_l4 section
>=20
> 0000 bf160000 00000000 61681000 00000000 <Ascii characters>
> ...
>=20
> Someone schooled in the art of Python coding should be able to convert th=
at output to a =E2=80=98C=E2=80=99 data array. :-)
>=20
> >=20
> >>> It is a work in progress.
> >=20
> > Contributions are welcome.
> >=20
> >>> 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.
> >>=20
> >> streamlining other parts of DPDK would be nice, but we are now talking=
 about the tap/eBPF patch.
>=20
> Regards,
> Keith
>=20
>=20