[v2,40/41] net/mlx5: add meson support for FreeBSD

Message ID 20211007184350.73858-41-srikanth.k@oneconvergence.com (mailing list archive)
State New
Delegated to: Raslan Darawsheh
Headers
Series add MLX5 FreeBSD support |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Srikanth Kaka Oct. 7, 2021, 6:43 p.m. UTC
  - On FreeBSD, XOPEN_SOURCE=600 is missing 'strlen' prototype.
  The default XOPEN_SOURCE value (700) is used.

Signed-off-by: Srikanth Kaka <srikanth.k@oneconvergence.com>
Signed-off-by: Vag Singh <vag.singh@oneconvergence.com>
Signed-off-by: Anand Thulasiram <avelu@juniper.net>
---
 drivers/net/mlx5/freebsd/meson.build | 14 ++++++++++++++
 drivers/net/mlx5/meson.build         | 14 ++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/mlx5/freebsd/meson.build
  

Patch

diff --git a/drivers/net/mlx5/freebsd/meson.build b/drivers/net/mlx5/freebsd/meson.build
new file mode 100644
index 0000000000..8412edce78
--- /dev/null
+++ b/drivers/net/mlx5/freebsd/meson.build
@@ -0,0 +1,14 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+includes += include_directories('.')
+sources += files(
+	'mlx5_socket.c',
+	'mlx5_os.c',
+	'mlx5_ethdev_os.c',
+	'mlx5_verbs.c',
+	'mlx5_mp_os.c',
+	'mlx5_vlan_os.c',
+	'mlx5_flow_os.c',
+)
+
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index dac7f1fabf..51172adf90 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -2,9 +2,9 @@ 
 # Copyright 2018 6WIND S.A.
 # Copyright 2018 Mellanox Technologies, Ltd
 
-if not (is_linux or is_windows)
+if not (is_linux or is_windows or is_freebsd)
     build = false
-    reason = 'only supported on Linux and Windows'
+    reason = 'only supported on Linux, Windows and FreeBSD'
     subdir_done()
 endif
 
@@ -38,7 +38,7 @@  sources = files(
         'mlx5_devx.c',
 )
 
-if is_linux
+if is_linux or is_freebsd
     sources += files(
             'mlx5_flow_verbs.c',
     )
@@ -54,8 +54,14 @@  cflags_options = [
         '-Wno-strict-prototypes',
         '-D_BSD_SOURCE',
         '-D_DEFAULT_SOURCE',
-        '-D_XOPEN_SOURCE=600',
 ]
+
+if not is_freebsd
+    cflags_options += [
+	    '-D_XOPEN_SOURCE=600',
+    ]
+endif
+
 foreach option:cflags_options
     if cc.has_argument(option)
         cflags += option