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 94F03A0679
	for <public@inbox.dpdk.org>; Fri,  5 Apr 2019 17:10:31 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id E0EF51B535;
	Fri,  5 Apr 2019 17:10:30 +0200 (CEST)
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id 7B64F1B533
 for <dev@dpdk.org>; Fri,  5 Apr 2019 17:10:29 +0200 (CEST)
X-Amp-Result: UNKNOWN
X-Amp-Original-Verdict: FILE UNKNOWN
X-Amp-File-Uploaded: False
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 05 Apr 2019 08:10:27 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,313,1549958400"; d="scan'208";a="140287908"
Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206])
 by orsmga003.jf.intel.com with ESMTP; 05 Apr 2019 08:10:25 -0700
Date: Fri, 5 Apr 2019 23:05:25 +0800
From: Ye Xiaolong <xiaolong.ye@intel.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>,
 Luca Boccassi <bluca@debian.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>,
 Bruce Richardson <bruce.richardson@intel.com>,
 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: <20190405150525.GA41807@intel.com>
References: <20190301080947.91086-1-xiaolong.ye@intel.com>
 <20190404085113.16732-1-xiaolong.ye@intel.com>
 <20190404085113.16732-2-xiaolong.ye@intel.com>
 <ce168dbb-faf6-10b0-b82a-e209a39ad00c@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
In-Reply-To: <ce168dbb-faf6-10b0-b82a-e209a39ad00c@intel.com>
User-Agent: Mutt/1.9.4 (2018-02-28)
Subject: Re: [dpdk-dev] [PATCH v11 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: <20190405150525.Up8l3bb9Ahct_PdAaveELHH_QegsjcJ1HMgqd4icd1U@z>

Hi, Ferruh

On 04/05, Ferruh Yigit wrote:
>On 4/4/2019 9:51 AM, 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>
>
><...>
>
>> diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
>> new file mode 100644
>> index 000000000..840c93728
>> --- /dev/null
>> +++ b/drivers/net/af_xdp/meson.build
>> @@ -0,0 +1,19 @@
>> +# SPDX-License-Identifier: BSD-3-Clause
>> +# Copyright(c) 2019 Intel Corporation
>> +
>> +if host_machine.system() == 'linux'
>> +	bpf_dep = dependency('libbpf', required: false)
>> +	if bpf_dep.found()
>> +		build = true
>> +	else
>> +		bpf_dep = cc.find_library('bpf', required: false)
>> +		if bpf_dep.found() and cc.has_header('bpf/xsk.h', dependencies: bpf_dep) and cc.has_header('linux/if_xdp.h')
>> +			build = true
>> +			pkgconfig_extra_libs += '-lbpf'
>> +		else
>> +			build = false
>> +		endif
>> +	endif
>> +	ext_deps += bpf_dep
>> +endif
>> +sources = files('rte_eth_af_xdp.c')
>
>if system is not 'linux', by default build will be 'true', right, so will it try
>to build the driver in that case?
>What about setting "build = false" before the linux check, so won't need to set
>it false again in the if block, only set it true if dependencies found?

This is a good catch, we do need to initialize build = false first, otherwise
meson/ninja would just try to build af_xdp pmd if system is not linux, which is
undesired. Do I need to send a separate patch for this so you can squash it into
af_xdp pmd patch?

>And can 'ext_deps' go out of if block?

If we move `ext_deps += bpf_dep` out of if block and build system is not linux, there
would be error "ERROR: Unknown variable "bpf_dep".", so we need either initialize
bpf_dep (to value like NULL?) first or keep `ext_deps += bpf_dep` inside the if 
block, I'd prefer keep it as it is, what's you opinion?


Thanks,
Xiaolong