Skip to contentSkip to conversation

net/af_xdp: fix meson for non Linux platforms

PATCH New Ferruh Yigit 2 participants 4 messages Apr 5, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/af_xdp: fix meson for non Linux platforms

Fixes 55bcda7b3515 ("net/af_xdp: introduce AF XDP PMD driver")
---
 drivers/net/af_xdp/meson.build | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/af_xdp/meson.build +1 -2
index 840c93728..e3d86c39a 100644
@@ -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
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 net/af_xdp: simplify meson build specification

The build spec has lots of levels of indentation, which can be reduced by not explicitly checking for linux, but for the needed header and library files needed for the driver.

---
 drivers/net/af_xdp/meson.build | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/net/af_xdp/meson.build +11 -14
index 840c93728..7904840f0 100644
@@ -1,19 +1,16 @@
 # 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
+sources = files('rte_eth_af_xdp.c')
+
+bpf_dep = dependency('libbpf', required: false)
+if not bpf_dep.found()
+	bpf_dep = cc.find_library('bpf', required: false)
+endif
+
+if bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('linux/if_xdp.h')
 	ext_deps += bpf_dep
+	pkgconfig_extra_libs += '-lbpf'
+else
+	build = false
 endif
-sources = files('rte_eth_af_xdp.c')
Signature · 1 line
2.20.1
#2 lore raw

Re: [dpdk-dev] [PATCH] net/af_xdp: simplify meson build specification

Quoted 35 lines · Bruce Richardson

The build spec has lots of levels of indentation, which can be reduced by not explicitly checking for linux, but for the needed header and library files needed for the driver.

---
 drivers/net/af_xdp/meson.build | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/net/af_xdp/meson.build +4 -13
index 840c93728..7904840f0 100644
@@ -1,19 +1,16 @@
 # 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
+sources = files('rte_eth_af_xdp.c')
+
+bpf_dep = dependency('libbpf', required: false)
+if not bpf_dep.found()

drivers/net/af_xdp/meson.build line 19

Quoted 10 lines
drivers/net/af_xdp/meson.build +7 -1
+	bpf_dep = cc.find_library('bpf', required: false)
+endif
+
+if bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('linux/if_xdp.h')
 	ext_deps += bpf_dep
+	pkgconfig_extra_libs += '-lbpf'
+else
+	build = false
 endif
-sources = files('rte_eth_af_xdp.c')

Looks good to me.

#3 lore raw

Re: [dpdk-dev] [PATCH] net/af_xdp: simplify meson build specification

In reply to Bruce Richardson
Quoted 5 lines · Bruce Richardson

The build spec has lots of levels of indentation, which can be reduced by not explicitly checking for linux, but for the needed header and library files needed for the driver.

Squashed into relevant commit in next-net, thanks.