[v2,20/33] mlx5/windows: add mlx5 meson file

Message ID 20201210150648.8784-21-talshn@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series mlx5 Windows support - part #5 |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Tal Shnaiderman Dec. 10, 2020, 3:06 p.m. UTC
  File drivers/common/mlx5/windows/meson.build is added to enable mlx5
source files compilation under common windows directory.
A Devx SDK tool must be installed to export two external H files:
mlx5devx.h and mlx5_ifc_devx.h. The installation is based on environment
variable DEVX_INC_PATH. In addition a DLL lib file is installed based on
environment variable DEVX_LIB_PATH. The meson file is using the
environment variables for compilation and linkage.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/meson.build         |  4 ++--
 drivers/common/mlx5/windows/meson.build | 42 +++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 drivers/common/mlx5/windows/meson.build
  

Comments

Dmitry Kozlyuk Dec. 11, 2020, 11:42 p.m. UTC | #1
On Thu, 10 Dec 2020 17:06:35 +0200, Tal Shnaiderman wrote:
> File drivers/common/mlx5/windows/meson.build is added to enable mlx5
> source files compilation under common windows directory.
> A Devx SDK tool must be installed to export two external H files:
> mlx5devx.h and mlx5_ifc_devx.h. The installation is based on environment
> variable DEVX_INC_PATH. In addition a DLL lib file is installed based on
> environment variable DEVX_LIB_PATH. The meson file is using the
> environment variables for compilation and linkage.

I installed WinOF-2 for Windows Server 2019 from this page:

https://www.mellanox.com/products/adapter-software/ethernet/windows/winof-2

Then I installed DevX SDK from C:\Program Files\Mellanox\DevX SDK
and set environment variables:

$env:DEVX_INC_PATH = "C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc"
$env:DEVX_LIB_PATH = "C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\lib"

Meson complained no more, but the build failed, log is below.
What am I missing? Note: I'm building the whole series.

Another question, why there's a clang restriction?

[149/203] Compiling C object drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_common.c.obj.
FAILED: drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_common.c.obj
clang @drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_common.c.obj.rsp
In file included from ../../drivers/common/mlx5/mlx5_common.c:13:
In file included from ..\..\drivers\common/mlx5/mlx5_common.h:18:
..\..\drivers\common/mlx5/mlx5_prm.h:363:31: error: field has incomplete type 'struct mlx5_wqe_srq_next_seg'
        struct mlx5_wqe_srq_next_seg next_seg;
                                     ^
..\..\drivers\common/mlx5/mlx5_prm.h:363:9: note: forward declaration of 'struct mlx5_wqe_srq_next_seg'
        struct mlx5_wqe_srq_next_seg next_seg;
               ^
..\..\drivers\common/mlx5/mlx5_prm.h:364:27: error: field has incomplete type 'struct mlx5_wqe_data_seg'
        struct mlx5_wqe_data_seg dseg;
                                 ^
..\..\drivers\common/mlx5/mlx5_prm.h:364:9: note: forward declaration of 'struct mlx5_wqe_data_seg'
        struct mlx5_wqe_data_seg dseg;
               ^
In file included from ../../drivers/common/mlx5/mlx5_common.c:14:
In file included from ..\..\drivers\common/mlx5\windows\mlx5_common_os.h:15:
In file included from ..\..\drivers\common/mlx5\mlx5_common_mr.h:19:
..\..\drivers\common/mlx5/mlx5_common_mp.h:29:7: warning: forward references to 'enum' types are a Microsoft extension [-Wmicrosoft-enum-forward-reference]
        enum ibv_wq_state state; /* WQ requested state. */
             ^
In file included from ../../drivers/common/mlx5/mlx5_common.c:14:
In file included from ..\..\drivers\common/mlx5\windows\mlx5_common_os.h:16:
In file included from ..\..\drivers\common/mlx5\windows/mlx5_win_ext.h:12:
In file included from C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc\mlx5devx.h:26:
C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc/mlx5_ifc_devx.h:95:45: error: field has incomplete type 'struct mlx5_ifc_dest_format_struct_bits'
    struct mlx5_ifc_dest_format_struct_bits dest;
                                            ^
C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc/mlx5_ifc_devx.h:95:12: note: forward declaration of 'struct mlx5_ifc_dest_format_struct_bits'
    struct mlx5_ifc_dest_format_struct_bits dest;
           ^
../../drivers/common/mlx5/mlx5_common.c:323:15: warning: implicit declaration of function 'mlx5_os_get_devx_uar_base_addr' is invalid in C99 [-Wimplicit-function-declaration]
                base_addr = mlx5_os_get_devx_uar_base_addr(uar);
                            ^
../../drivers/common/mlx5/mlx5_common.c:323:13: warning: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
                base_addr = mlx5_os_get_devx_uar_base_addr(uar);
                          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 3 errors generated.
[151/203] Compiling C object drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_malloc.c.obj.
FAILED: drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_malloc.c.obj
clang @drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_malloc.c.obj.rsp
In file included from ../../drivers/common/mlx5/mlx5_malloc.c:11:
In file included from ..\..\drivers\common/mlx5/mlx5_common_utils.h:8:
In file included from ..\..\drivers\common/mlx5/mlx5_common.h:18:
..\..\drivers\common/mlx5/mlx5_prm.h:363:31: error: field has incomplete type 'struct mlx5_wqe_srq_next_seg'
        struct mlx5_wqe_srq_next_seg next_seg;
                                     ^
..\..\drivers\common/mlx5/mlx5_prm.h:363:9: note: forward declaration of 'struct mlx5_wqe_srq_next_seg'
        struct mlx5_wqe_srq_next_seg next_seg;
               ^
..\..\drivers\common/mlx5/mlx5_prm.h:364:27: error: field has incomplete type 'struct mlx5_wqe_data_seg'
        struct mlx5_wqe_data_seg dseg;
                                 ^
..\..\drivers\common/mlx5/mlx5_prm.h:364:9: note: forward declaration of 'struct mlx5_wqe_data_seg'
        struct mlx5_wqe_data_seg dseg;
               ^
In file included from ../../drivers/common/mlx5/mlx5_malloc.c:12:
In file included from ..\..\drivers\common/mlx5\windows\mlx5_common_os.h:15:
In file included from ..\..\drivers\common/mlx5\mlx5_common_mr.h:19:
..\..\drivers\common/mlx5/mlx5_common_mp.h:29:7: warning: forward references to 'enum' types are a Microsoft extension [-Wmicrosoft-enum-forward-reference]
        enum ibv_wq_state state; /* WQ requested state. */
             ^
In file included from ../../drivers/common/mlx5/mlx5_malloc.c:12:
In file included from ..\..\drivers\common/mlx5\windows\mlx5_common_os.h:16:
In file included from ..\..\drivers\common/mlx5\windows/mlx5_win_ext.h:12:
In file included from C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc\mlx5devx.h:26:
C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc/mlx5_ifc_devx.h:95:45: error: field has incomplete type 'struct mlx5_ifc_dest_format_struct_bits'
    struct mlx5_ifc_dest_format_struct_bits dest;
                                            ^
C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc/mlx5_ifc_devx.h:95:12: note: forward declaration of 'struct mlx5_ifc_dest_format_struct_bits'
    struct mlx5_ifc_dest_format_struct_bits dest;
           ^
1 warning and 3 errors generated.
[154/203] Compiling C object lib/76b5a35@@rte_hash@sta/librte_hash_rte_cuckoo_hash.c.obj.
ninja: build stopped: subcommand failed.
  
Tal Shnaiderman Dec. 12, 2020, 2:34 a.m. UTC | #2
> Subject: Re: [dpdk-dev] [PATCH v2 20/33] mlx5/windows: add mlx5 meson
> file
> 
> External email: Use caution opening links or attachments
> 
> 
> On Thu, 10 Dec 2020 17:06:35 +0200, Tal Shnaiderman wrote:
> > File drivers/common/mlx5/windows/meson.build is added to enable mlx5
> > source files compilation under common windows directory.
> > A Devx SDK tool must be installed to export two external H files:
> > mlx5devx.h and mlx5_ifc_devx.h. The installation is based on
> > environment variable DEVX_INC_PATH. In addition a DLL lib file is
> > installed based on environment variable DEVX_LIB_PATH. The meson file
> > is using the environment variables for compilation and linkage.
> 
> I installed WinOF-2 for Windows Server 2019 from this page:
> 
> https://www.mellanox.com/products/adapter-
> software/ethernet/windows/winof-2
> 
> Then I installed DevX SDK from C:\Program Files\Mellanox\DevX SDK and set
> environment variables:
> 
> $env:DEVX_INC_PATH = "C:\Program
> Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc"
> $env:DEVX_LIB_PATH = "C:\Program
> Files\Mellanox\MLNX_WinOF2_DevX_SDK\lib"
> 
> Meson complained no more, but the build failed, log is below.
> What am I missing? Note: I'm building the whole series.

Thanks for testing Dmitry, this is an patches order issue on my side, the common
build patch should come in the next series.

I'll fix in v3.

> 
> Another question, why there's a clang restriction?
> 

On the current release we've ported and tested the PMD and SDK for clang, once we'll do the same for MinGW64 we'll remove this restriction. 

> [149/203] Compiling C object
> drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_common
> .c.obj.
> FAILED:
> drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_common
> .c.obj
> clang
> @drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_comm
> on.c.obj.rsp
> In file included from ../../drivers/common/mlx5/mlx5_common.c:13:
> In file included from ..\..\drivers\common/mlx5/mlx5_common.h:18:
> ..\..\drivers\common/mlx5/mlx5_prm.h:363:31: error: field has incomplete
> type 'struct mlx5_wqe_srq_next_seg'
>         struct mlx5_wqe_srq_next_seg next_seg;
>                                      ^
> ..\..\drivers\common/mlx5/mlx5_prm.h:363:9: note: forward declaration of
> 'struct mlx5_wqe_srq_next_seg'
>         struct mlx5_wqe_srq_next_seg next_seg;
>                ^
> ..\..\drivers\common/mlx5/mlx5_prm.h:364:27: error: field has incomplete
> type 'struct mlx5_wqe_data_seg'
>         struct mlx5_wqe_data_seg dseg;
>                                  ^
> ..\..\drivers\common/mlx5/mlx5_prm.h:364:9: note: forward declaration of
> 'struct mlx5_wqe_data_seg'
>         struct mlx5_wqe_data_seg dseg;
>                ^
> In file included from ../../drivers/common/mlx5/mlx5_common.c:14:
> In file included from
> ..\..\drivers\common/mlx5\windows\mlx5_common_os.h:15:
> In file included from ..\..\drivers\common/mlx5\mlx5_common_mr.h:19:
> ..\..\drivers\common/mlx5/mlx5_common_mp.h:29:7: warning: forward
> references to 'enum' types are a Microsoft extension [-Wmicrosoft-enum-
> forward-reference]
>         enum ibv_wq_state state; /* WQ requested state. */
>              ^
> In file included from ../../drivers/common/mlx5/mlx5_common.c:14:
> In file included from
> ..\..\drivers\common/mlx5\windows\mlx5_common_os.h:16:
> In file included from
> ..\..\drivers\common/mlx5\windows/mlx5_win_ext.h:12:
> In file included from C:\Program
> Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc\mlx5devx.h:26:
> C:\Program
> Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc/mlx5_ifc_devx.h:95:45: error:
> field has incomplete type 'struct mlx5_ifc_dest_format_struct_bits'
>     struct mlx5_ifc_dest_format_struct_bits dest;
>                                             ^ C:\Program
> Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc/mlx5_ifc_devx.h:95:12: note:
> forward declaration of 'struct mlx5_ifc_dest_format_struct_bits'
>     struct mlx5_ifc_dest_format_struct_bits dest;
>            ^
> ../../drivers/common/mlx5/mlx5_common.c:323:15: warning: implicit
> declaration of function 'mlx5_os_get_devx_uar_base_addr' is invalid in C99
> [-Wimplicit-function-declaration]
>                 base_addr = mlx5_os_get_devx_uar_base_addr(uar);
>                             ^
> ../../drivers/common/mlx5/mlx5_common.c:323:13: warning: incompatible
> integer to pointer conversion assigning to 'void *' from 'int' [-Wint-
> conversion]
>                 base_addr = mlx5_os_get_devx_uar_base_addr(uar);
>                           ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3 warnings and 3 errors generated.
> [151/203] Compiling C object
> drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_malloc.c.
> obj.
> FAILED:
> drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_malloc.c.
> obj
> clang
> @drivers/a715181@@rte_common_mlx5@sta/common_mlx5_mlx5_malloc.
> c.obj.rsp
> In file included from ../../drivers/common/mlx5/mlx5_malloc.c:11:
> In file included from ..\..\drivers\common/mlx5/mlx5_common_utils.h:8:
> In file included from ..\..\drivers\common/mlx5/mlx5_common.h:18:
> ..\..\drivers\common/mlx5/mlx5_prm.h:363:31: error: field has incomplete
> type 'struct mlx5_wqe_srq_next_seg'
>         struct mlx5_wqe_srq_next_seg next_seg;
>                                      ^
> ..\..\drivers\common/mlx5/mlx5_prm.h:363:9: note: forward declaration of
> 'struct mlx5_wqe_srq_next_seg'
>         struct mlx5_wqe_srq_next_seg next_seg;
>                ^
> ..\..\drivers\common/mlx5/mlx5_prm.h:364:27: error: field has incomplete
> type 'struct mlx5_wqe_data_seg'
>         struct mlx5_wqe_data_seg dseg;
>                                  ^
> ..\..\drivers\common/mlx5/mlx5_prm.h:364:9: note: forward declaration of
> 'struct mlx5_wqe_data_seg'
>         struct mlx5_wqe_data_seg dseg;
>                ^
> In file included from ../../drivers/common/mlx5/mlx5_malloc.c:12:
> In file included from
> ..\..\drivers\common/mlx5\windows\mlx5_common_os.h:15:
> In file included from ..\..\drivers\common/mlx5\mlx5_common_mr.h:19:
> ..\..\drivers\common/mlx5/mlx5_common_mp.h:29:7: warning: forward
> references to 'enum' types are a Microsoft extension [-Wmicrosoft-enum-
> forward-reference]
>         enum ibv_wq_state state; /* WQ requested state. */
>              ^
> In file included from ../../drivers/common/mlx5/mlx5_malloc.c:12:
> In file included from
> ..\..\drivers\common/mlx5\windows\mlx5_common_os.h:16:
> In file included from
> ..\..\drivers\common/mlx5\windows/mlx5_win_ext.h:12:
> In file included from C:\Program
> Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc\mlx5devx.h:26:
> C:\Program
> Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc/mlx5_ifc_devx.h:95:45: error:
> field has incomplete type 'struct mlx5_ifc_dest_format_struct_bits'
>     struct mlx5_ifc_dest_format_struct_bits dest;
>                                             ^ C:\Program
> Files\Mellanox\MLNX_WinOF2_DevX_SDK\inc/mlx5_ifc_devx.h:95:12: note:
> forward declaration of 'struct mlx5_ifc_dest_format_struct_bits'
>     struct mlx5_ifc_dest_format_struct_bits dest;
>            ^
> 1 warning and 3 errors generated.
> [154/203] Compiling C object
> lib/76b5a35@@rte_hash@sta/librte_hash_rte_cuckoo_hash.c.obj.
> ninja: build stopped: subcommand failed.
  

Patch

diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build
index 3dacc6f683..3047b455cf 100644
--- a/drivers/common/mlx5/meson.build
+++ b/drivers/common/mlx5/meson.build
@@ -1,9 +1,9 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019 Mellanox Technologies, Ltd
 
-if not is_linux
+if not (is_linux or (is_windows and is_ms_linker))
 	build = false
-	reason = 'only supported on Linux'
+	reason = 'only supported on Linux and Windows build with clang'
 	subdir_done()
 endif
 
diff --git a/drivers/common/mlx5/windows/meson.build b/drivers/common/mlx5/windows/meson.build
new file mode 100644
index 0000000000..2b2aa3b097
--- /dev/null
+++ b/drivers/common/mlx5/windows/meson.build
@@ -0,0 +1,42 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Mellanox Technologies, Ltd
+
+includes += include_directories('.')
+
+allow_experimental_apis = true
+sources += files(
+	'mlx5_glue.c',
+)
+
+res_lib = run_command(python3, '-c', 'import os; print(os.environ["DEVX_LIB_PATH"])')
+res_inc = run_command(python3, '-c', 'import os; print(os.environ["DEVX_INC_PATH"])')
+
+if (res_lib.returncode() != 0 or res_inc.returncode() != 0)
+	build = false
+	reason = 'DevX environment variables are not set, DEVX_LIB_PATH and DEVX_INC_PATH vars must be exported'
+	subdir_done()
+endif
+
+devx_lib_dir = res_lib.stdout().strip()
+devx_inc_dir = res_inc.stdout().strip()
+
+ext_deps += cc.find_library('mlx5devx', dirs: devx_lib_dir, required: true)
+includes += include_directories(devx_inc_dir)
+cflags_options = [
+	'-std=c11',
+	'-Wno-strict-prototypes',
+	'-D_BSD_SOURCE',
+	'-D_DEFAULT_SOURCE',
+	'-D_XOPEN_SOURCE=600'
+]
+foreach option:cflags_options
+	if cc.has_argument(option)
+		cflags += option
+	endif
+endforeach
+if get_option('buildtype').contains('debug')
+	cflags += [ '-pedantic', '-DPEDANTIC' ]
+else
+	cflags += [ '-UPEDANTIC' ]
+endif
+