From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bruce.richardson@intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id E4EFF1B439
 for <dev@dpdk.org>; Wed,  3 Apr 2019 15:22:20 +0200 (CEST)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from fmsmga007.fm.intel.com ([10.253.24.52])
 by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 03 Apr 2019 06:22:19 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,304,1549958400"; d="scan'208";a="139798587"
Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.35])
 by fmsmga007.fm.intel.com with SMTP; 03 Apr 2019 06:22:16 -0700
Received: by  (sSMTP sendmail emulation); Wed, 03 Apr 2019 14:22:15 +0100
Date: Wed, 3 Apr 2019 14:22:15 +0100
From: Bruce Richardson <bruce.richardson@intel.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Xiaolong Ye <xiaolong.ye@intel.com>, dev@dpdk.org,
 Stephen Hemminger <stephen@networkplumber.org>,
 Qi Zhang <qi.z.zhang@intel.com>,
 Karlsson Magnus <magnus.karlsson@intel.com>,
 Topel Bjorn <bjorn.topel@intel.com>,
 Maxime Coquelin <maxime.coquelin@redhat.com>,
 Luca Boccassi <bluca@debian.org>,
 Ananyev Konstantin <konstantin.ananyev@intel.com>,
 David Marchand <david.marchand@redhat.com>,
 Andrew Rybchenko <arybchenko@solarflare.com>,
 Olivier Matz <olivier.matz@6wind.com>
Message-ID: <20190403132214.GA1309@bricha3-MOBL.ger.corp.intel.com>
References: <20190301080947.91086-1-xiaolong.ye@intel.com>
 <20190402154653.711-1-xiaolong.ye@intel.com>
 <20190402154653.711-2-xiaolong.ye@intel.com>
 <3b489dd8-c70f-94d1-163f-1cf3199f1cf5@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <3b489dd8-c70f-94d1-163f-1cf3199f1cf5@intel.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
Subject: Re: [dpdk-dev] [PATCH v9 1/1] net/af_xdp: introduce AF XDP PMD
	driver
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://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 03 Apr 2019 13:22:21 -0000

On Tue, Apr 02, 2019 at 08:43:48PM +0100, Ferruh Yigit wrote:
> On 4/2/2019 4:46 PM, Xiaolong Ye wrote:
> > Add a new PMD driver for AF_XDP which is a proposed faster version of
> > AF_PACKET interface in Linux. More info about AF_XDP, please refer to [1]
> > [2].
> > 
> > This is the vanilla version PMD which just uses a raw buffer registered as
> > the umem.
> > 
> > [1] https://fosdem.org/2018/schedule/event/af_xdp/
> > [2] https://lwn.net/Articles/745934/
> > 
> > Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> 
> <...>
> 
> > @@ -0,0 +1,956 @@
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright(c) 2019 Intel Corporation.
> > + */
> 
> > +#include <bpf/bpf.h>
> > +#include <xsk.h>
> 
> Under linux, both headers are in same 'bpf' folder, why one included as
> 'bpf/bpf.h' but other 'xsk.h'?
> 
> Perhaps this is not problem when headers are installed into system folders, but
> I am compiling using RTE_KERNELDIR, which used in Makefile as:
>  -I$(RTE_KERNELDIR)/tools/lib/bpf

When installed in system folders they will still need the "bpf" prefix. On
my system after running "make headers_install" in libbpf folder, the
headers are placed in "/usr/local/include/bpf/"

> 
> This fails to find 'bpf/bpf.h'
> 
> Also for '-lbpf', shouldn't need to add '-L$(RTE_KERNELDIR)/tools/lib/bpf', to
> new added line in 'rte.app.mk', so that it can find the library?
> 
> I assume you are building in a system with new kernel, I think you need this for
> functionality, where 'xsk.h' is located in that case? Because I was thinking
> building and installing libbpf can solve the issue but it is not installing
> 'xsk.h', not sure why, so not exactly solving.
> 
> if you still need "CFLAGS += -I$(RTE_KERNELDIR)/tools/lib/bpf" for your case,
> does it make sense update as following:
>  CFLAGS += -I$(RTE_KERNELDIR)/tools/lib
>  #include <bpf/xsk.h>

We should not include in any driver a cflag or ldflag that points to the
kernel dir. We should expect the headers for libbpf in a regular include
folder and the library itself in /usr/lib or /usr/local/lib.

/Bruce

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 08AA2A0679
	for <public@inbox.dpdk.org>; Wed,  3 Apr 2019 15:22:51 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 0A81F1B442;
	Wed,  3 Apr 2019 15:22:23 +0200 (CEST)
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id E4EFF1B439
 for <dev@dpdk.org>; Wed,  3 Apr 2019 15:22:20 +0200 (CEST)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from fmsmga007.fm.intel.com ([10.253.24.52])
 by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 03 Apr 2019 06:22:19 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,304,1549958400"; d="scan'208";a="139798587"
Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.35])
 by fmsmga007.fm.intel.com with SMTP; 03 Apr 2019 06:22:16 -0700
Received: by  (sSMTP sendmail emulation); Wed, 03 Apr 2019 14:22:15 +0100
Date: Wed, 3 Apr 2019 14:22:15 +0100
From: Bruce Richardson <bruce.richardson@intel.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Xiaolong Ye <xiaolong.ye@intel.com>, dev@dpdk.org,
 Stephen Hemminger <stephen@networkplumber.org>,
 Qi Zhang <qi.z.zhang@intel.com>,
 Karlsson Magnus <magnus.karlsson@intel.com>,
 Topel Bjorn <bjorn.topel@intel.com>,
 Maxime Coquelin <maxime.coquelin@redhat.com>,
 Luca Boccassi <bluca@debian.org>,
 Ananyev Konstantin <konstantin.ananyev@intel.com>,
 David Marchand <david.marchand@redhat.com>,
 Andrew Rybchenko <arybchenko@solarflare.com>,
 Olivier Matz <olivier.matz@6wind.com>
Message-ID: <20190403132214.GA1309@bricha3-MOBL.ger.corp.intel.com>
References: <20190301080947.91086-1-xiaolong.ye@intel.com>
 <20190402154653.711-1-xiaolong.ye@intel.com>
 <20190402154653.711-2-xiaolong.ye@intel.com>
 <3b489dd8-c70f-94d1-163f-1cf3199f1cf5@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
In-Reply-To: <3b489dd8-c70f-94d1-163f-1cf3199f1cf5@intel.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
Subject: Re: [dpdk-dev] [PATCH v9 1/1] net/af_xdp: introduce AF XDP PMD
	driver
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://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190403132215.O5OcOQvGrdQGMSH7tOs7MZ73iJPi1uOsx-87j-CBF7A@z>

On Tue, Apr 02, 2019 at 08:43:48PM +0100, Ferruh Yigit wrote:
> On 4/2/2019 4:46 PM, Xiaolong Ye wrote:
> > Add a new PMD driver for AF_XDP which is a proposed faster version of
> > AF_PACKET interface in Linux. More info about AF_XDP, please refer to [1]
> > [2].
> > 
> > This is the vanilla version PMD which just uses a raw buffer registered as
> > the umem.
> > 
> > [1] https://fosdem.org/2018/schedule/event/af_xdp/
> > [2] https://lwn.net/Articles/745934/
> > 
> > Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> 
> <...>
> 
> > @@ -0,0 +1,956 @@
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright(c) 2019 Intel Corporation.
> > + */
> 
> > +#include <bpf/bpf.h>
> > +#include <xsk.h>
> 
> Under linux, both headers are in same 'bpf' folder, why one included as
> 'bpf/bpf.h' but other 'xsk.h'?
> 
> Perhaps this is not problem when headers are installed into system folders, but
> I am compiling using RTE_KERNELDIR, which used in Makefile as:
>  -I$(RTE_KERNELDIR)/tools/lib/bpf

When installed in system folders they will still need the "bpf" prefix. On
my system after running "make headers_install" in libbpf folder, the
headers are placed in "/usr/local/include/bpf/"

> 
> This fails to find 'bpf/bpf.h'
> 
> Also for '-lbpf', shouldn't need to add '-L$(RTE_KERNELDIR)/tools/lib/bpf', to
> new added line in 'rte.app.mk', so that it can find the library?
> 
> I assume you are building in a system with new kernel, I think you need this for
> functionality, where 'xsk.h' is located in that case? Because I was thinking
> building and installing libbpf can solve the issue but it is not installing
> 'xsk.h', not sure why, so not exactly solving.
> 
> if you still need "CFLAGS += -I$(RTE_KERNELDIR)/tools/lib/bpf" for your case,
> does it make sense update as following:
>  CFLAGS += -I$(RTE_KERNELDIR)/tools/lib
>  #include <bpf/xsk.h>

We should not include in any driver a cflag or ldflag that points to the
kernel dir. We should expect the headers for libbpf in a regular include
folder and the library itself in /usr/lib or /usr/local/lib.

/Bruce