On 4/5/2019 4:05 PM, Ye Xiaolong wrote:
> 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...@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?

If you are agree with the change, I can send the patch and squash it into the
original af_xdp commit:

  diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
  index 840c93728..e3d86c39a 100644
  --- a/drivers/net/af_xdp/meson.build
  +++ b/drivers/net/af_xdp/meson.build
  @@ -1,6 +1,7 @@
   # SPDX-License-Identifier: BSD-3-Clause
   # Copyright(c) 2019 Intel Corporation

  +build = false
   if host_machine.system() == 'linux'
          bpf_dep = dependency('libbpf', required: false)
          if bpf_dep.found()
  @@ -10,8 +11,6 @@ if host_machine.system() == 'linux'
                  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

> 
>> 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?

OK to keep as it is.

Reply via email to