DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] fix mlx5 build with MinGW
@ 2023-01-05 16:10 Thomas Monjalon
  2023-01-05 16:10 ` [PATCH 1/3] eal/windows: fix pedantic build Thomas Monjalon
                   ` (4 more replies)
  0 siblings, 5 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-05 16:10 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman

The first patch is a fix for EAL Windows.
The 2 other patches are cleaning up mlx5 for Windows.
The result is to make possible to compile mlx5 on Linux for Windows.

Thomas Monjalon (3):
  eal/windows: fix pedantic build
  common/mlx5: get Windows dependency from standard variables
  net/mlx5: fix Windows build with MinGW GCC 12

 doc/guides/platform/mlx5.rst                |  12 ++-
 drivers/common/mlx5/meson.build             |   4 +-
 drivers/common/mlx5/windows/meson.build     |  28 +++---
 drivers/common/mlx5/windows/mlx5_win_defs.h | 100 +++++++++++---------
 drivers/net/mlx5/meson.build                |  11 ++-
 drivers/net/mlx5/windows/mlx5_os.c          |   4 +-
 lib/eal/windows/include/pthread.h           |   3 +-
 7 files changed, 89 insertions(+), 73 deletions(-)

-- 
2.39.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 1/3] eal/windows: fix pedantic build
  2023-01-05 16:10 [PATCH 0/3] fix mlx5 build with MinGW Thomas Monjalon
@ 2023-01-05 16:10 ` Thomas Monjalon
  2023-01-05 16:40   ` Tyler Retzlaff
  2023-01-05 16:10 ` [PATCH 2/3] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-05 16:10 UTC (permalink / raw)
  To: dev
  Cc: Tal Shnaiderman, stable, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Narcisa Vasile, Bruce Richardson, Keith Wiles

MinGW GCC 12 shows an illegal pointer conversion
when included in a pedantic module:

lib/eal/windows/include/pthread.h:137:41: error:
	ISO C forbids conversion of object pointer to function pointer type
	[-Werror=pedantic]
 137 | hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,
     |                                 ^

Fixes: e8428a9d89f1 ("eal/windows: add some basic functions and macros")
Cc: stable@dpdk.org

By using uintptr_t, the compiler is forced to accept the conversion.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/eal/windows/include/pthread.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h
index 27fd2cca52..f7cf0e9ddf 100644
--- a/lib/eal/windows/include/pthread.h
+++ b/lib/eal/windows/include/pthread.h
@@ -134,7 +134,8 @@ pthread_create(void *threadid, const void *threadattr, void *threadfunc,
 {
 	RTE_SET_USED(threadattr);
 	HANDLE hThread;
-	hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,
+	hThread = CreateThread(NULL, 0,
+		(LPTHREAD_START_ROUTINE)(uintptr_t)threadfunc,
 		args, 0, (LPDWORD)threadid);
 	if (hThread) {
 		SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
-- 
2.39.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 2/3] common/mlx5: get Windows dependency from standard variables
  2023-01-05 16:10 [PATCH 0/3] fix mlx5 build with MinGW Thomas Monjalon
  2023-01-05 16:10 ` [PATCH 1/3] eal/windows: fix pedantic build Thomas Monjalon
@ 2023-01-05 16:10 ` Thomas Monjalon
  2023-01-05 16:10 ` [PATCH 3/3] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-05 16:10 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

It was requested to provide path to DevX library through
DEVX_INC_PATH and DEVX_LIB_PATH.
It was non-standard and triggers some issues with recent Meson.

Using CFLAGS/LDFLAGS is standard and simpler.
It is also possible to use the Meson options -Dc_args and -Dc_link_args.
There are 2 options to provide:
	-I<include_directory>
	-L<library_directory>

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/platform/mlx5.rst            | 12 ++++++-----
 drivers/common/mlx5/windows/meson.build | 28 ++++++++++++-------------
 2 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/doc/guides/platform/mlx5.rst b/doc/guides/platform/mlx5.rst
index 5784b9a87b..33eb8627b5 100644
--- a/doc/guides/platform/mlx5.rst
+++ b/doc/guides/platform/mlx5.rst
@@ -259,13 +259,15 @@ configured by the ``ibverbs_link`` build option:
 Compilation on Windows
 ~~~~~~~~~~~~~~~~~~~~~~
 
-The DevX SDK location must be set through two environment variables:
+The DevX SDK location must be set through CFLAGS/LDFLAGS,
+either::
 
-``DEVX_LIB_PATH``
-   path to the DevX lib file.
+   meson -Dc_args=-Idevx/inc -Dc_link_args=-Ldevx/lib
 
-``DEVX_INC_PATH``
-   path to the DevX header files.
+or::
+
+   export CFLAGS=-Idevx/inc
+   export LDFLAGS=-Ldevx/lib
 
 
 .. _mlx5_common_env:
diff --git a/drivers/common/mlx5/windows/meson.build b/drivers/common/mlx5/windows/meson.build
index cc486014a8..f60daed840 100644
--- a/drivers/common/mlx5/windows/meson.build
+++ b/drivers/common/mlx5/windows/meson.build
@@ -1,6 +1,20 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019 Mellanox Technologies, Ltd
 
+if not cc.has_header('mlx5devx.h')
+    build = false
+    reason = 'missing dependency, "mlx5devx.h"'
+    subdir_done()
+endif
+
+devxlib = cc.find_library('mlx5devx', required: true)
+if not devxlib.found()
+    build = false
+    reason = 'missing dependency, "mlx5devx"'
+    subdir_done()
+endif
+ext_deps += devxlib
+
 includes += include_directories('.')
 
 sources += files(
@@ -8,20 +22,6 @@ sources += files(
         'mlx5_common_os.c',
 )
 
-res_lib = run_command(python3, '-c', 'import os; print(os.environ["DEVX_LIB_PATH"])', check: false)
-res_inc = run_command(python3, '-c', 'import os; print(os.environ["DEVX_INC_PATH"])', check: false)
-
-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',
-- 
2.39.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 3/3] net/mlx5: fix Windows build with MinGW GCC 12
  2023-01-05 16:10 [PATCH 0/3] fix mlx5 build with MinGW Thomas Monjalon
  2023-01-05 16:10 ` [PATCH 1/3] eal/windows: fix pedantic build Thomas Monjalon
  2023-01-05 16:10 ` [PATCH 2/3] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
@ 2023-01-05 16:10 ` Thomas Monjalon
  2023-01-12 20:37 ` [PATCH v2 0/4] fix Windows build with MinGW and mlx5 Thomas Monjalon
  2023-03-02 13:21 ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Thomas Monjalon
  4 siblings, 0 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-05 16:10 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman, stable, Matan Azrad, Viacheslav Ovsiienko

With recent changes in Meson and MinGW toolchain,
the driver mlx5 was not able to compile on Linux for Windows.

There were errors due to non-typed constants,
constant going over int range forbidden in pedantic mode,
vector Rx functions undefined in Windows case,
and minimum-comparison of different types.

Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/common/mlx5/meson.build             |   4 +-
 drivers/common/mlx5/windows/mlx5_win_defs.h | 100 +++++++++++---------
 drivers/net/mlx5/meson.build                |  11 ++-
 drivers/net/mlx5/windows/mlx5_os.c          |   4 +-
 4 files changed, 66 insertions(+), 53 deletions(-)

diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build
index 60ccd95cbc..aea3ae4927 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 or (is_windows and is_ms_linker))
+if not (is_linux or is_windows)
     build = false
-    reason = 'only supported on Linux and Windows build with clang'
+    reason = 'only supported on Linux and Windows'
     subdir_done()
 endif
 
diff --git a/drivers/common/mlx5/windows/mlx5_win_defs.h b/drivers/common/mlx5/windows/mlx5_win_defs.h
index 3554e4a7ff..65da820c5e 100644
--- a/drivers/common/mlx5/windows/mlx5_win_defs.h
+++ b/drivers/common/mlx5/windows/mlx5_win_defs.h
@@ -2,8 +2,10 @@
  * Copyright (C) Mellanox Technologies, Ltd. 2001-2020.
  */
 
-#ifndef __MLX5_WIN_DEFS_H__
-#define __MLX5_WIN_DEFS_H__
+#ifndef MLX5_WIN_DEFS_H
+#define MLX5_WIN_DEFS_H
+
+#include <rte_bitops.h>
 
 enum {
 	MLX5_CQE_OWNER_MASK	= 1,
@@ -40,29 +42,29 @@ enum {
 };
 
 enum mlx5dv_cq_init_attr_mask {
-	MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE	= 1 << 0,
-	MLX5DV_CQ_INIT_ATTR_MASK_FLAGS		= 1 << 1,
-	MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE = 1 << 2,
+	MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE = RTE_BIT32(0),
+	MLX5DV_CQ_INIT_ATTR_MASK_FLAG           = RTE_BIT32(1),
+	MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE       = RTE_BIT32(2),
 };
 
 enum mlx5dv_cqe_comp_res_format {
-	MLX5DV_CQE_RES_FORMAT_HASH		= 1 << 0,
-	MLX5DV_CQE_RES_FORMAT_CSUM		= 1 << 1,
-	MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX	= 1 << 2,
+	MLX5DV_CQE_RES_FORMAT_HASH        = RTE_BIT32(0),
+	MLX5DV_CQE_RES_FORMAT_CSUM        = RTE_BIT32(1),
+	MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX = RTE_BIT32(2),
 };
 
 enum ibv_access_flags {
-	IBV_ACCESS_LOCAL_WRITE		= 1,
-	IBV_ACCESS_REMOTE_WRITE		= 1 << 1,
-	IBV_ACCESS_REMOTE_READ		= 1 << 2,
-	IBV_ACCESS_REMOTE_ATOMIC	= 1 << 3,
-	IBV_ACCESS_MW_BIND		= 1 << 4,
-	IBV_ACCESS_ZERO_BASED		= 1 << 5,
-	IBV_ACCESS_ON_DEMAND		= 1 << 6,
+	IBV_ACCESS_LOCAL_WRITE   = RTE_BIT32(0),
+	IBV_ACCESS_REMOTE_WRITE  = RTE_BIT32(1),
+	IBV_ACCESS_REMOTE_READ   = RTE_BIT32(2),
+	IBV_ACCESS_REMOTE_ATOMIC = RTE_BIT32(3),
+	IBV_ACCESS_MW_BIND       = RTE_BIT32(4),
+	IBV_ACCESS_ZERO_BASED    = RTE_BIT32(5),
+	IBV_ACCESS_ON_DEMAND     = RTE_BIT32(6),
 };
 
 enum mlx5_ib_uapi_devx_create_event_channel_flags {
-	MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0,
+	MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = RTE_BIT32(0),
 };
 
 #define MLX5DV_DEVX_CREATE_EVENT_CHANNEL_FLAGS_OMIT_EV_DATA \
@@ -85,15 +87,15 @@ enum {
 };
 
 enum {
-	MLX5_ETH_WQE_L3_CSUM = (1 << 6),
-	MLX5_ETH_WQE_L4_CSUM = (1 << 7),
+	MLX5_ETH_WQE_L3_CSUM = RTE_BIT32(6),
+	MLX5_ETH_WQE_L4_CSUM = RTE_BIT32(7),
 };
 
 enum {
-	MLX5_WQE_CTRL_CQ_UPDATE	= 2 << 2,
-	MLX5_WQE_CTRL_SOLICITED	= 1 << 1,
-	MLX5_WQE_CTRL_FENCE	= 4 << 5,
-	MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE = 1 << 5,
+	MLX5_WQE_CTRL_SOLICITED             = RTE_BIT32(1),
+	MLX5_WQE_CTRL_CQ_UPDATE             = RTE_BIT32(3),
+	MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE = RTE_BIT32(5),
+	MLX5_WQE_CTRL_FENCE                 = RTE_BIT32(7),
 };
 
 enum {
@@ -101,6 +103,11 @@ enum {
 	MLX5_SEND_WQE_SHIFT	= 6,
 };
 
+/* Verbs headers do not support -pedantic. */
+#ifdef PEDANTIC
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+
 /*
  * RX Hash fields enable to set which incoming packet's field should
  * participates in RX Hash. Each flag represent certain packet's field,
@@ -110,18 +117,22 @@ enum {
  * TCP and UDP flags can't be enabled together on the same QP.
  */
 enum ibv_rx_hash_fields {
-	IBV_RX_HASH_SRC_IPV4	= 1 << 0,
-	IBV_RX_HASH_DST_IPV4	= 1 << 1,
-	IBV_RX_HASH_SRC_IPV6	= 1 << 2,
-	IBV_RX_HASH_DST_IPV6	= 1 << 3,
-	IBV_RX_HASH_SRC_PORT_TCP	= 1 << 4,
-	IBV_RX_HASH_DST_PORT_TCP	= 1 << 5,
-	IBV_RX_HASH_SRC_PORT_UDP	= 1 << 6,
-	IBV_RX_HASH_DST_PORT_UDP	= 1 << 7,
-	IBV_RX_HASH_IPSEC_SPI		= 1 << 8,
-	IBV_RX_HASH_INNER		= (1 << 31),
+	IBV_RX_HASH_SRC_IPV4     = RTE_BIT32(0),
+	IBV_RX_HASH_DST_IPV4     = RTE_BIT32(1),
+	IBV_RX_HASH_SRC_IPV6     = RTE_BIT32(2),
+	IBV_RX_HASH_DST_IPV6     = RTE_BIT32(3),
+	IBV_RX_HASH_SRC_PORT_TCP = RTE_BIT32(4),
+	IBV_RX_HASH_DST_PORT_TCP = RTE_BIT32(5),
+	IBV_RX_HASH_SRC_PORT_UDP = RTE_BIT32(6),
+	IBV_RX_HASH_DST_PORT_UDP = RTE_BIT32(7),
+	IBV_RX_HASH_IPSEC_SPI    = RTE_BIT32(8),
+	IBV_RX_HASH_INNER        = RTE_BIT32(31),
 };
 
+#ifdef PEDANTIC
+#pragma GCC diagnostic error "-Wpedantic"
+#endif
+
 enum {
 	MLX5_RCV_DBR	= 0,
 	MLX5_SND_DBR	= 1,
@@ -141,9 +152,9 @@ enum {
 #endif
 
 enum ibv_flow_flags {
-	IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK = 1 << 0,
-	IBV_FLOW_ATTR_FLAGS_DONT_TRAP = 1 << 1,
-	IBV_FLOW_ATTR_FLAGS_EGRESS = 1 << 2,
+	IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK = RTE_BIT32(0),
+	IBV_FLOW_ATTR_FLAGS_DONT_TRAP = RTE_BIT32(1),
+	IBV_FLOW_ATTR_FLAGS_EGRESS = RTE_BIT32(2),
 };
 
 enum ibv_flow_attr_type {
@@ -240,11 +251,11 @@ struct mlx5_wqe_data_seg {
 	rte_be64_t		addr;
 };
 
-#define MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP	(1 << 4)
-#define IBV_DEVICE_RAW_IP_CSUM			(1 << 26)
-#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING	(1 << 0)
-#define IBV_RAW_PACKET_CAP_SCATTER_FCS		(1 << 1)
-#define IBV_QPT_RAW_PACKET			8
+#define MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP   RTE_BIT32(4)
+#define IBV_DEVICE_RAW_IP_CSUM               RTE_BIT32(26)
+#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING   RTE_BIT32(0)
+#define IBV_RAW_PACKET_CAP_SCATTER_FCS       RTE_BIT32(1)
+#define IBV_QPT_RAW_PACKET                   8
 
 enum {
 	MLX5_FLOW_CONTEXT_DEST_TYPE_VPORT                    = 0x0,
@@ -254,8 +265,9 @@ enum {
 };
 
 enum {
-	MLX5_MATCH_OUTER_HEADERS        = 1 << 0,
-	MLX5_MATCH_MISC_PARAMETERS      = 1 << 1,
-	MLX5_MATCH_INNER_HEADERS        = 1 << 2,
+	MLX5_MATCH_OUTER_HEADERS        = RTE_BIT32(0),
+	MLX5_MATCH_MISC_PARAMETERS      = RTE_BIT32(1),
+	MLX5_MATCH_INNER_HEADERS        = RTE_BIT32(2),
 };
-#endif /* __MLX5_WIN_DEFS_H__ */
+
+#endif /* MLX5_WIN_DEFS_H */
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index abd507bd88..fe704b1477 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -49,11 +49,12 @@ if is_linux
             'mlx5_hws_cnt.c',
             'mlx5_flow_verbs.c',
     )
-    if (dpdk_conf.has('RTE_ARCH_X86_64')
-        or dpdk_conf.has('RTE_ARCH_ARM64')
-        or dpdk_conf.has('RTE_ARCH_PPC_64'))
-        sources += files('mlx5_rxtx_vec.c')
-    endif
+endif
+
+if (dpdk_conf.has('RTE_ARCH_X86_64')
+	    or dpdk_conf.has('RTE_ARCH_ARM64')
+	    or dpdk_conf.has('RTE_ARCH_PPC_64'))
+	sources += files('mlx5_rxtx_vec.c')
 endif
 
 cflags_options = [
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index 77f04cc931..7795c0a065 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -193,8 +193,8 @@ mlx5_os_capabilities_prepare(struct mlx5_dev_ctx_shared *sh)
 		 * Once DPDK supports it, take max size from device attr.
 		 */
 		sh->dev_cap.ind_table_max_size =
-			RTE_MIN(1 << hca_attr->rss_ind_tbl_cap,
-				(unsigned int)RTE_ETH_RSS_RETA_SIZE_512);
+			RTE_MIN((uint32_t) 1 << hca_attr->rss_ind_tbl_cap,
+				(uint32_t)RTE_ETH_RSS_RETA_SIZE_512);
 		DRV_LOG(DEBUG, "Maximum Rx indirection table size is %u",
 			sh->dev_cap.ind_table_max_size);
 	}
-- 
2.39.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 1/3] eal/windows: fix pedantic build
  2023-01-05 16:10 ` [PATCH 1/3] eal/windows: fix pedantic build Thomas Monjalon
@ 2023-01-05 16:40   ` Tyler Retzlaff
  0 siblings, 0 replies; 28+ messages in thread
From: Tyler Retzlaff @ 2023-01-05 16:40 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Tal Shnaiderman, stable, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Narcisa Vasile, Bruce Richardson, Keith Wiles

On Thu, Jan 05, 2023 at 05:10:18PM +0100, Thomas Monjalon wrote:
> MinGW GCC 12 shows an illegal pointer conversion
> when included in a pedantic module:
> 
> lib/eal/windows/include/pthread.h:137:41: error:
> 	ISO C forbids conversion of object pointer to function pointer type
> 	[-Werror=pedantic]
>  137 | hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,
>      |                                 ^
> 
> Fixes: e8428a9d89f1 ("eal/windows: add some basic functions and macros")
> Cc: stable@dpdk.org
> 
> By using uintptr_t, the compiler is forced to accept the conversion.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 0/4] fix Windows build with MinGW and mlx5
  2023-01-05 16:10 [PATCH 0/3] fix mlx5 build with MinGW Thomas Monjalon
                   ` (2 preceding siblings ...)
  2023-01-05 16:10 ` [PATCH 3/3] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
@ 2023-01-12 20:37 ` Thomas Monjalon
  2023-01-12 20:37   ` [PATCH v2 1/4] eal/windows: fix pedantic build Thomas Monjalon
                     ` (3 more replies)
  2023-03-02 13:21 ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Thomas Monjalon
  4 siblings, 4 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-12 20:37 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman

The first patch is a fix for EAL Windows.
The 3 other patches are cleaning up mlx5 for Windows.
The result is to make possible to compile mlx5 on Linux for Windows.

v2: improve mlx5 doc and remove weak attribute from mlx5

Thomas Monjalon (4):
  eal/windows: fix pedantic build
  common/mlx5: get Windows dependency from standard variables
  net/mlx5: remove weak stub functions
  net/mlx5: fix Windows build with MinGW GCC 12

 doc/guides/platform/mlx5.rst                |  11 ++-
 drivers/common/mlx5/meson.build             |   4 +-
 drivers/common/mlx5/windows/meson.build     |  28 +++---
 drivers/common/mlx5/windows/mlx5_win_defs.h | 100 +++++++++++---------
 drivers/net/mlx5/meson.build                |  13 ++-
 drivers/net/mlx5/mlx5_rx.c                  |  35 -------
 drivers/net/mlx5/mlx5_rxtx_vec_null.c       |  38 ++++++++
 drivers/net/mlx5/windows/mlx5_os.c          |   4 +-
 lib/eal/windows/include/pthread.h           |   3 +-
 9 files changed, 128 insertions(+), 108 deletions(-)
 create mode 100644 drivers/net/mlx5/mlx5_rxtx_vec_null.c

-- 
2.39.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 1/4] eal/windows: fix pedantic build
  2023-01-12 20:37 ` [PATCH v2 0/4] fix Windows build with MinGW and mlx5 Thomas Monjalon
@ 2023-01-12 20:37   ` Thomas Monjalon
  2023-03-01 16:33     ` Thomas Monjalon
  2023-01-12 20:37   ` [PATCH v2 2/4] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-12 20:37 UTC (permalink / raw)
  To: dev
  Cc: Tal Shnaiderman, stable, Tyler Retzlaff, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Bruce Richardson, Ranjit Menon, Keith Wiles

MinGW GCC 12 shows an illegal pointer conversion
when included in a pedantic module:

lib/eal/windows/include/pthread.h:137:41: error:
	ISO C forbids conversion of object pointer to function pointer type
	[-Werror=pedantic]
 137 | hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,
     |                                 ^

Fixes: e8428a9d89f1 ("eal/windows: add some basic functions and macros")
Cc: stable@dpdk.org

By using uintptr_t, the compiler is forced to accept the conversion.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/windows/include/pthread.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h
index 27fd2cca52..f7cf0e9ddf 100644
--- a/lib/eal/windows/include/pthread.h
+++ b/lib/eal/windows/include/pthread.h
@@ -134,7 +134,8 @@ pthread_create(void *threadid, const void *threadattr, void *threadfunc,
 {
 	RTE_SET_USED(threadattr);
 	HANDLE hThread;
-	hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,
+	hThread = CreateThread(NULL, 0,
+		(LPTHREAD_START_ROUTINE)(uintptr_t)threadfunc,
 		args, 0, (LPDWORD)threadid);
 	if (hThread) {
 		SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
-- 
2.39.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 2/4] common/mlx5: get Windows dependency from standard variables
  2023-01-12 20:37 ` [PATCH v2 0/4] fix Windows build with MinGW and mlx5 Thomas Monjalon
  2023-01-12 20:37   ` [PATCH v2 1/4] eal/windows: fix pedantic build Thomas Monjalon
@ 2023-01-12 20:37   ` Thomas Monjalon
  2023-01-12 20:37   ` [PATCH v2 3/4] net/mlx5: remove weak stub functions Thomas Monjalon
  2023-01-12 20:37   ` [PATCH v2 4/4] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
  3 siblings, 0 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-12 20:37 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

It was requested to provide path to DevX library through
DEVX_INC_PATH and DEVX_LIB_PATH.
It was non-standard and triggers some issues with recent Meson.

Using CFLAGS/LDFLAGS is standard and simpler.
It is also possible to use the Meson options -Dc_args and -Dc_link_args.
There are 2 options to provide:
	-I<include_directory>
	-L<library_directory>

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/platform/mlx5.rst            | 11 +++++-----
 drivers/common/mlx5/windows/meson.build | 28 ++++++++++++-------------
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/doc/guides/platform/mlx5.rst b/doc/guides/platform/mlx5.rst
index 5784b9a87b..f68ccf127d 100644
--- a/doc/guides/platform/mlx5.rst
+++ b/doc/guides/platform/mlx5.rst
@@ -259,13 +259,14 @@ configured by the ``ibverbs_link`` build option:
 Compilation on Windows
 ~~~~~~~~~~~~~~~~~~~~~~
 
-The DevX SDK location must be set through two environment variables:
+The DevX SDK location must be set through CFLAGS/LDFLAGS,
+either::
 
-``DEVX_LIB_PATH``
-   path to the DevX lib file.
+   meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" "-Dc_link_args=-L\"%DEVX_LIB_PATH%\"" ...
 
-``DEVX_INC_PATH``
-   path to the DevX header files.
+or::
+
+   set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-L"%DEVX_LIB_PATH%" && meson.exe setup ...
 
 
 .. _mlx5_common_env:
diff --git a/drivers/common/mlx5/windows/meson.build b/drivers/common/mlx5/windows/meson.build
index cc486014a8..f60daed840 100644
--- a/drivers/common/mlx5/windows/meson.build
+++ b/drivers/common/mlx5/windows/meson.build
@@ -1,6 +1,20 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019 Mellanox Technologies, Ltd
 
+if not cc.has_header('mlx5devx.h')
+    build = false
+    reason = 'missing dependency, "mlx5devx.h"'
+    subdir_done()
+endif
+
+devxlib = cc.find_library('mlx5devx', required: true)
+if not devxlib.found()
+    build = false
+    reason = 'missing dependency, "mlx5devx"'
+    subdir_done()
+endif
+ext_deps += devxlib
+
 includes += include_directories('.')
 
 sources += files(
@@ -8,20 +22,6 @@ sources += files(
         'mlx5_common_os.c',
 )
 
-res_lib = run_command(python3, '-c', 'import os; print(os.environ["DEVX_LIB_PATH"])', check: false)
-res_inc = run_command(python3, '-c', 'import os; print(os.environ["DEVX_INC_PATH"])', check: false)
-
-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',
-- 
2.39.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 3/4] net/mlx5: remove weak stub functions
  2023-01-12 20:37 ` [PATCH v2 0/4] fix Windows build with MinGW and mlx5 Thomas Monjalon
  2023-01-12 20:37   ` [PATCH v2 1/4] eal/windows: fix pedantic build Thomas Monjalon
  2023-01-12 20:37   ` [PATCH v2 2/4] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
@ 2023-01-12 20:37   ` Thomas Monjalon
  2023-01-23 19:42     ` Dmitry Kozlyuk
  2023-01-12 20:37   ` [PATCH v2 4/4] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
  3 siblings, 1 reply; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-12 20:37 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

The vector Rx functions are conditionally compiled.
Some stub functions were also always compiled with weak attribute.
If there is no vector support, the weak functions were linked.

These weak functions are moved in a specific file
which is compiled only if there is no vector support.
This way it is simpler to understand,
and the weak attributes can be removed.

This change helps to compile with MinGW GCC
which has no support for weak functions.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/net/mlx5/meson.build          | 13 +++++----
 drivers/net/mlx5/mlx5_rx.c            | 35 ------------------------
 drivers/net/mlx5/mlx5_rxtx_vec_null.c | 38 +++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 40 deletions(-)
 create mode 100644 drivers/net/mlx5/mlx5_rxtx_vec_null.c

diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index abd507bd88..dba911693e 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -49,11 +49,14 @@ if is_linux
             'mlx5_hws_cnt.c',
             'mlx5_flow_verbs.c',
     )
-    if (dpdk_conf.has('RTE_ARCH_X86_64')
-        or dpdk_conf.has('RTE_ARCH_ARM64')
-        or dpdk_conf.has('RTE_ARCH_PPC_64'))
-        sources += files('mlx5_rxtx_vec.c')
-    endif
+endif
+
+if is_linux and (dpdk_conf.has('RTE_ARCH_X86_64')
+              or dpdk_conf.has('RTE_ARCH_ARM64')
+              or dpdk_conf.has('RTE_ARCH_PPC_64'))
+    sources += files('mlx5_rxtx_vec.c')
+else
+    sources += files('mlx5_rxtx_vec_null.c')
 endif
 
 cflags_options = [
diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
index 917c517b83..d054f9728a 100644
--- a/drivers/net/mlx5/mlx5_rx.c
+++ b/drivers/net/mlx5/mlx5_rx.c
@@ -1185,41 +1185,6 @@ mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 	return i;
 }
 
-/*
- * Vectorized Rx routines are not compiled in when required vector instructions
- * are not supported on a target architecture.
- * The following null stubs are needed for linkage when those are not included
- * outside of this file (e.g. mlx5_rxtx_vec_sse.c for x86).
- */
-
-__rte_weak uint16_t
-mlx5_rx_burst_vec(void *dpdk_rxq __rte_unused,
-		  struct rte_mbuf **pkts __rte_unused,
-		  uint16_t pkts_n __rte_unused)
-{
-	return 0;
-}
-
-__rte_weak uint16_t
-mlx5_rx_burst_mprq_vec(void *dpdk_rxq __rte_unused,
-		       struct rte_mbuf **pkts __rte_unused,
-		       uint16_t pkts_n __rte_unused)
-{
-	return 0;
-}
-
-__rte_weak int
-mlx5_rxq_check_vec_support(struct mlx5_rxq_data *rxq __rte_unused)
-{
-	return -ENOTSUP;
-}
-
-__rte_weak int
-mlx5_check_vec_rx_support(struct rte_eth_dev *dev __rte_unused)
-{
-	return -ENOTSUP;
-}
-
 int
 mlx5_rx_queue_lwm_query(struct rte_eth_dev *dev,
 			uint16_t *queue_id, uint8_t *lwm)
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_null.c b/drivers/net/mlx5/mlx5_rxtx_vec_null.c
new file mode 100644
index 0000000000..03d6629e24
--- /dev/null
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_null.c
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2023 NVIDIA Corporation & Affiliates
+ */
+
+#include <rte_common.h>
+
+#include "mlx5_rx.h"
+
+struct rte_mbuf;
+struct rte_eth_dev;
+
+uint16_t
+mlx5_rx_burst_vec(void *dpdk_rxq __rte_unused,
+		struct rte_mbuf **pkts __rte_unused,
+		uint16_t pkts_n __rte_unused)
+{
+	return 0;
+}
+
+uint16_t
+mlx5_rx_burst_mprq_vec(void *dpdk_rxq __rte_unused,
+		struct rte_mbuf **pkts __rte_unused,
+		uint16_t pkts_n __rte_unused)
+{
+	return 0;
+}
+
+int
+mlx5_rxq_check_vec_support(struct mlx5_rxq_data *rxq __rte_unused)
+{
+	return -ENOTSUP;
+}
+
+int
+mlx5_check_vec_rx_support(struct rte_eth_dev *dev __rte_unused)
+{
+	return -ENOTSUP;
+}
-- 
2.39.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 4/4] net/mlx5: fix Windows build with MinGW GCC 12
  2023-01-12 20:37 ` [PATCH v2 0/4] fix Windows build with MinGW and mlx5 Thomas Monjalon
                     ` (2 preceding siblings ...)
  2023-01-12 20:37   ` [PATCH v2 3/4] net/mlx5: remove weak stub functions Thomas Monjalon
@ 2023-01-12 20:37   ` Thomas Monjalon
  3 siblings, 0 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-12 20:37 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman, stable, Matan Azrad, Viacheslav Ovsiienko

With recent changes in Meson and MinGW toolchain,
the driver mlx5 was not able to compile on Linux for Windows.

There were errors due to system detection, non-typed constants,
constant going over int range forbidden in pedantic mode,
and minimum-comparison of different types.

Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/common/mlx5/meson.build             |   4 +-
 drivers/common/mlx5/windows/mlx5_win_defs.h | 100 +++++++++++---------
 drivers/net/mlx5/windows/mlx5_os.c          |   4 +-
 3 files changed, 60 insertions(+), 48 deletions(-)

diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build
index 60ccd95cbc..aea3ae4927 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 or (is_windows and is_ms_linker))
+if not (is_linux or is_windows)
     build = false
-    reason = 'only supported on Linux and Windows build with clang'
+    reason = 'only supported on Linux and Windows'
     subdir_done()
 endif
 
diff --git a/drivers/common/mlx5/windows/mlx5_win_defs.h b/drivers/common/mlx5/windows/mlx5_win_defs.h
index 3554e4a7ff..65da820c5e 100644
--- a/drivers/common/mlx5/windows/mlx5_win_defs.h
+++ b/drivers/common/mlx5/windows/mlx5_win_defs.h
@@ -2,8 +2,10 @@
  * Copyright (C) Mellanox Technologies, Ltd. 2001-2020.
  */
 
-#ifndef __MLX5_WIN_DEFS_H__
-#define __MLX5_WIN_DEFS_H__
+#ifndef MLX5_WIN_DEFS_H
+#define MLX5_WIN_DEFS_H
+
+#include <rte_bitops.h>
 
 enum {
 	MLX5_CQE_OWNER_MASK	= 1,
@@ -40,29 +42,29 @@ enum {
 };
 
 enum mlx5dv_cq_init_attr_mask {
-	MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE	= 1 << 0,
-	MLX5DV_CQ_INIT_ATTR_MASK_FLAGS		= 1 << 1,
-	MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE = 1 << 2,
+	MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE = RTE_BIT32(0),
+	MLX5DV_CQ_INIT_ATTR_MASK_FLAG           = RTE_BIT32(1),
+	MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE       = RTE_BIT32(2),
 };
 
 enum mlx5dv_cqe_comp_res_format {
-	MLX5DV_CQE_RES_FORMAT_HASH		= 1 << 0,
-	MLX5DV_CQE_RES_FORMAT_CSUM		= 1 << 1,
-	MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX	= 1 << 2,
+	MLX5DV_CQE_RES_FORMAT_HASH        = RTE_BIT32(0),
+	MLX5DV_CQE_RES_FORMAT_CSUM        = RTE_BIT32(1),
+	MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX = RTE_BIT32(2),
 };
 
 enum ibv_access_flags {
-	IBV_ACCESS_LOCAL_WRITE		= 1,
-	IBV_ACCESS_REMOTE_WRITE		= 1 << 1,
-	IBV_ACCESS_REMOTE_READ		= 1 << 2,
-	IBV_ACCESS_REMOTE_ATOMIC	= 1 << 3,
-	IBV_ACCESS_MW_BIND		= 1 << 4,
-	IBV_ACCESS_ZERO_BASED		= 1 << 5,
-	IBV_ACCESS_ON_DEMAND		= 1 << 6,
+	IBV_ACCESS_LOCAL_WRITE   = RTE_BIT32(0),
+	IBV_ACCESS_REMOTE_WRITE  = RTE_BIT32(1),
+	IBV_ACCESS_REMOTE_READ   = RTE_BIT32(2),
+	IBV_ACCESS_REMOTE_ATOMIC = RTE_BIT32(3),
+	IBV_ACCESS_MW_BIND       = RTE_BIT32(4),
+	IBV_ACCESS_ZERO_BASED    = RTE_BIT32(5),
+	IBV_ACCESS_ON_DEMAND     = RTE_BIT32(6),
 };
 
 enum mlx5_ib_uapi_devx_create_event_channel_flags {
-	MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0,
+	MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = RTE_BIT32(0),
 };
 
 #define MLX5DV_DEVX_CREATE_EVENT_CHANNEL_FLAGS_OMIT_EV_DATA \
@@ -85,15 +87,15 @@ enum {
 };
 
 enum {
-	MLX5_ETH_WQE_L3_CSUM = (1 << 6),
-	MLX5_ETH_WQE_L4_CSUM = (1 << 7),
+	MLX5_ETH_WQE_L3_CSUM = RTE_BIT32(6),
+	MLX5_ETH_WQE_L4_CSUM = RTE_BIT32(7),
 };
 
 enum {
-	MLX5_WQE_CTRL_CQ_UPDATE	= 2 << 2,
-	MLX5_WQE_CTRL_SOLICITED	= 1 << 1,
-	MLX5_WQE_CTRL_FENCE	= 4 << 5,
-	MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE = 1 << 5,
+	MLX5_WQE_CTRL_SOLICITED             = RTE_BIT32(1),
+	MLX5_WQE_CTRL_CQ_UPDATE             = RTE_BIT32(3),
+	MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE = RTE_BIT32(5),
+	MLX5_WQE_CTRL_FENCE                 = RTE_BIT32(7),
 };
 
 enum {
@@ -101,6 +103,11 @@ enum {
 	MLX5_SEND_WQE_SHIFT	= 6,
 };
 
+/* Verbs headers do not support -pedantic. */
+#ifdef PEDANTIC
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+
 /*
  * RX Hash fields enable to set which incoming packet's field should
  * participates in RX Hash. Each flag represent certain packet's field,
@@ -110,18 +117,22 @@ enum {
  * TCP and UDP flags can't be enabled together on the same QP.
  */
 enum ibv_rx_hash_fields {
-	IBV_RX_HASH_SRC_IPV4	= 1 << 0,
-	IBV_RX_HASH_DST_IPV4	= 1 << 1,
-	IBV_RX_HASH_SRC_IPV6	= 1 << 2,
-	IBV_RX_HASH_DST_IPV6	= 1 << 3,
-	IBV_RX_HASH_SRC_PORT_TCP	= 1 << 4,
-	IBV_RX_HASH_DST_PORT_TCP	= 1 << 5,
-	IBV_RX_HASH_SRC_PORT_UDP	= 1 << 6,
-	IBV_RX_HASH_DST_PORT_UDP	= 1 << 7,
-	IBV_RX_HASH_IPSEC_SPI		= 1 << 8,
-	IBV_RX_HASH_INNER		= (1 << 31),
+	IBV_RX_HASH_SRC_IPV4     = RTE_BIT32(0),
+	IBV_RX_HASH_DST_IPV4     = RTE_BIT32(1),
+	IBV_RX_HASH_SRC_IPV6     = RTE_BIT32(2),
+	IBV_RX_HASH_DST_IPV6     = RTE_BIT32(3),
+	IBV_RX_HASH_SRC_PORT_TCP = RTE_BIT32(4),
+	IBV_RX_HASH_DST_PORT_TCP = RTE_BIT32(5),
+	IBV_RX_HASH_SRC_PORT_UDP = RTE_BIT32(6),
+	IBV_RX_HASH_DST_PORT_UDP = RTE_BIT32(7),
+	IBV_RX_HASH_IPSEC_SPI    = RTE_BIT32(8),
+	IBV_RX_HASH_INNER        = RTE_BIT32(31),
 };
 
+#ifdef PEDANTIC
+#pragma GCC diagnostic error "-Wpedantic"
+#endif
+
 enum {
 	MLX5_RCV_DBR	= 0,
 	MLX5_SND_DBR	= 1,
@@ -141,9 +152,9 @@ enum {
 #endif
 
 enum ibv_flow_flags {
-	IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK = 1 << 0,
-	IBV_FLOW_ATTR_FLAGS_DONT_TRAP = 1 << 1,
-	IBV_FLOW_ATTR_FLAGS_EGRESS = 1 << 2,
+	IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK = RTE_BIT32(0),
+	IBV_FLOW_ATTR_FLAGS_DONT_TRAP = RTE_BIT32(1),
+	IBV_FLOW_ATTR_FLAGS_EGRESS = RTE_BIT32(2),
 };
 
 enum ibv_flow_attr_type {
@@ -240,11 +251,11 @@ struct mlx5_wqe_data_seg {
 	rte_be64_t		addr;
 };
 
-#define MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP	(1 << 4)
-#define IBV_DEVICE_RAW_IP_CSUM			(1 << 26)
-#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING	(1 << 0)
-#define IBV_RAW_PACKET_CAP_SCATTER_FCS		(1 << 1)
-#define IBV_QPT_RAW_PACKET			8
+#define MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP   RTE_BIT32(4)
+#define IBV_DEVICE_RAW_IP_CSUM               RTE_BIT32(26)
+#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING   RTE_BIT32(0)
+#define IBV_RAW_PACKET_CAP_SCATTER_FCS       RTE_BIT32(1)
+#define IBV_QPT_RAW_PACKET                   8
 
 enum {
 	MLX5_FLOW_CONTEXT_DEST_TYPE_VPORT                    = 0x0,
@@ -254,8 +265,9 @@ enum {
 };
 
 enum {
-	MLX5_MATCH_OUTER_HEADERS        = 1 << 0,
-	MLX5_MATCH_MISC_PARAMETERS      = 1 << 1,
-	MLX5_MATCH_INNER_HEADERS        = 1 << 2,
+	MLX5_MATCH_OUTER_HEADERS        = RTE_BIT32(0),
+	MLX5_MATCH_MISC_PARAMETERS      = RTE_BIT32(1),
+	MLX5_MATCH_INNER_HEADERS        = RTE_BIT32(2),
 };
-#endif /* __MLX5_WIN_DEFS_H__ */
+
+#endif /* MLX5_WIN_DEFS_H */
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index 77f04cc931..f401264b61 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -193,8 +193,8 @@ mlx5_os_capabilities_prepare(struct mlx5_dev_ctx_shared *sh)
 		 * Once DPDK supports it, take max size from device attr.
 		 */
 		sh->dev_cap.ind_table_max_size =
-			RTE_MIN(1 << hca_attr->rss_ind_tbl_cap,
-				(unsigned int)RTE_ETH_RSS_RETA_SIZE_512);
+			RTE_MIN((uint32_t)1 << hca_attr->rss_ind_tbl_cap,
+				(uint32_t)RTE_ETH_RSS_RETA_SIZE_512);
 		DRV_LOG(DEBUG, "Maximum Rx indirection table size is %u",
 			sh->dev_cap.ind_table_max_size);
 	}
-- 
2.39.0


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 3/4] net/mlx5: remove weak stub functions
  2023-01-12 20:37   ` [PATCH v2 3/4] net/mlx5: remove weak stub functions Thomas Monjalon
@ 2023-01-23 19:42     ` Dmitry Kozlyuk
  2023-01-24 14:42       ` Thomas Monjalon
  0 siblings, 1 reply; 28+ messages in thread
From: Dmitry Kozlyuk @ 2023-01-23 19:42 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

2023-01-12 21:37 (UTC+0100), Thomas Monjalon:
> The vector Rx functions are conditionally compiled.
> Some stub functions were also always compiled with weak attribute.
> If there is no vector support, the weak functions were linked.
> 
> These weak functions are moved in a specific file
> which is compiled only if there is no vector support.
> This way it is simpler to understand,
> and the weak attributes can be removed.
> 
> This change helps to compile with MinGW GCC
> which has no support for weak functions.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  drivers/net/mlx5/meson.build          | 13 +++++----
>  drivers/net/mlx5/mlx5_rx.c            | 35 ------------------------
>  drivers/net/mlx5/mlx5_rxtx_vec_null.c | 38 +++++++++++++++++++++++++++
>  3 files changed, 46 insertions(+), 40 deletions(-)
>  create mode 100644 drivers/net/mlx5/mlx5_rxtx_vec_null.c
> 
> diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
> index abd507bd88..dba911693e 100644
> --- a/drivers/net/mlx5/meson.build
> +++ b/drivers/net/mlx5/meson.build
> @@ -49,11 +49,14 @@ if is_linux
>              'mlx5_hws_cnt.c',
>              'mlx5_flow_verbs.c',
>      )
> -    if (dpdk_conf.has('RTE_ARCH_X86_64')
> -        or dpdk_conf.has('RTE_ARCH_ARM64')
> -        or dpdk_conf.has('RTE_ARCH_PPC_64'))
> -        sources += files('mlx5_rxtx_vec.c')
> -    endif
> +endif
> +
> +if is_linux and (dpdk_conf.has('RTE_ARCH_X86_64')
> +              or dpdk_conf.has('RTE_ARCH_ARM64')
> +              or dpdk_conf.has('RTE_ARCH_PPC_64'))
> +    sources += files('mlx5_rxtx_vec.c')
> +else
> +    sources += files('mlx5_rxtx_vec_null.c')
>  endif

Can "is_linux" be dropped now?
I suspect that vector routines were compiled only for Linux
to prevent linker errors from both weak and non-weak symbols present,
not because vector code is somehow Linux-specific.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 3/4] net/mlx5: remove weak stub functions
  2023-01-23 19:42     ` Dmitry Kozlyuk
@ 2023-01-24 14:42       ` Thomas Monjalon
  0 siblings, 0 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-01-24 14:42 UTC (permalink / raw)
  To: Dmitry Kozlyuk; +Cc: dev, Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

23/01/2023 20:42, Dmitry Kozlyuk:
> 2023-01-12 21:37 (UTC+0100), Thomas Monjalon:
> > The vector Rx functions are conditionally compiled.
> > Some stub functions were also always compiled with weak attribute.
> > If there is no vector support, the weak functions were linked.
> > 
> > These weak functions are moved in a specific file
> > which is compiled only if there is no vector support.
> > This way it is simpler to understand,
> > and the weak attributes can be removed.
> > 
> > This change helps to compile with MinGW GCC
> > which has no support for weak functions.
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> >  drivers/net/mlx5/meson.build          | 13 +++++----
> >  drivers/net/mlx5/mlx5_rx.c            | 35 ------------------------
> >  drivers/net/mlx5/mlx5_rxtx_vec_null.c | 38 +++++++++++++++++++++++++++
> >  3 files changed, 46 insertions(+), 40 deletions(-)
> >  create mode 100644 drivers/net/mlx5/mlx5_rxtx_vec_null.c
> > 
> > diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
> > index abd507bd88..dba911693e 100644
> > --- a/drivers/net/mlx5/meson.build
> > +++ b/drivers/net/mlx5/meson.build
> > @@ -49,11 +49,14 @@ if is_linux
> >              'mlx5_hws_cnt.c',
> >              'mlx5_flow_verbs.c',
> >      )
> > -    if (dpdk_conf.has('RTE_ARCH_X86_64')
> > -        or dpdk_conf.has('RTE_ARCH_ARM64')
> > -        or dpdk_conf.has('RTE_ARCH_PPC_64'))
> > -        sources += files('mlx5_rxtx_vec.c')
> > -    endif
> > +endif
> > +
> > +if is_linux and (dpdk_conf.has('RTE_ARCH_X86_64')
> > +              or dpdk_conf.has('RTE_ARCH_ARM64')
> > +              or dpdk_conf.has('RTE_ARCH_PPC_64'))
> > +    sources += files('mlx5_rxtx_vec.c')
> > +else
> > +    sources += files('mlx5_rxtx_vec_null.c')
> >  endif
> 
> Can "is_linux" be dropped now?
> I suspect that vector routines were compiled only for Linux
> to prevent linker errors from both weak and non-weak symbols present,
> not because vector code is somehow Linux-specific.

Maybe but we should enable vector routines on Windows in a separate patch.





^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 1/4] eal/windows: fix pedantic build
  2023-01-12 20:37   ` [PATCH v2 1/4] eal/windows: fix pedantic build Thomas Monjalon
@ 2023-03-01 16:33     ` Thomas Monjalon
  0 siblings, 0 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-03-01 16:33 UTC (permalink / raw)
  To: dev
  Cc: Tal Shnaiderman, stable, Tyler Retzlaff, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam,
	Bruce Richardson, Ranjit Menon, Keith Wiles, rasland

12/01/2023 21:37, Thomas Monjalon:
> MinGW GCC 12 shows an illegal pointer conversion
> when included in a pedantic module:
> 
> lib/eal/windows/include/pthread.h:137:41: error:
> 	ISO C forbids conversion of object pointer to function pointer type
> 	[-Werror=pedantic]
>  137 | hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)threadfunc,
>      |                                 ^
> 
> Fixes: e8428a9d89f1 ("eal/windows: add some basic functions and macros")
> Cc: stable@dpdk.org
> 
> By using uintptr_t, the compiler is forced to accept the conversion.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Applied this single patch, so the rest of the series can be managed in mlx tree.



^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW
  2023-01-05 16:10 [PATCH 0/3] fix mlx5 build with MinGW Thomas Monjalon
                   ` (3 preceding siblings ...)
  2023-01-12 20:37 ` [PATCH v2 0/4] fix Windows build with MinGW and mlx5 Thomas Monjalon
@ 2023-03-02 13:21 ` Thomas Monjalon
  2023-03-02 13:21   ` [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
                     ` (3 more replies)
  4 siblings, 4 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-03-02 13:21 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman

The result is to make possible to compile mlx5 on Linux for Windows.

v2: improve mlx5 doc and remove weak attribute from mlx5
v3: avoid MinGW on Windows - EAL patch already applied


Thomas Monjalon (3):
  common/mlx5: get Windows dependency from standard variables
  net/mlx5: remove weak stub functions
  net/mlx5: fix Windows build with MinGW GCC 12

 doc/guides/platform/mlx5.rst                |  11 ++-
 drivers/common/mlx5/meson.build             |   9 +-
 drivers/common/mlx5/windows/meson.build     |  28 +++---
 drivers/common/mlx5/windows/mlx5_win_defs.h | 100 +++++++++++---------
 drivers/net/mlx5/meson.build                |  13 ++-
 drivers/net/mlx5/mlx5_rx.c                  |  35 -------
 drivers/net/mlx5/mlx5_rxtx_vec_null.c       |  38 ++++++++
 drivers/net/mlx5/windows/mlx5_os.c          |   4 +-
 8 files changed, 131 insertions(+), 107 deletions(-)
 create mode 100644 drivers/net/mlx5/mlx5_rxtx_vec_null.c

-- 
2.39.1


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables
  2023-03-02 13:21 ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Thomas Monjalon
@ 2023-03-02 13:21   ` Thomas Monjalon
  2023-03-02 17:17     ` Tyler Retzlaff
  2023-03-08 10:24     ` Tal Shnaiderman
  2023-03-02 13:21   ` [PATCH v3 2/3] net/mlx5: remove weak stub functions Thomas Monjalon
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 28+ messages in thread
From: Thomas Monjalon @ 2023-03-02 13:21 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

The DevX library path had to be provided through the variables
DEVX_INC_PATH and DEVX_LIB_PATH.
It was non-standard and triggers some issues with recent Meson.

Using CFLAGS/LDFLAGS is standard and simpler.
It is also possible to use the Meson options -Dc_args and -Dc_link_args.
There are 2 options to provide:
	-I<include_directory>
	-L<library_directory>

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/platform/mlx5.rst            | 11 +++++-----
 drivers/common/mlx5/windows/meson.build | 28 ++++++++++++-------------
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/doc/guides/platform/mlx5.rst b/doc/guides/platform/mlx5.rst
index 2d6fbe7e44..5fc5d0cb8c 100644
--- a/doc/guides/platform/mlx5.rst
+++ b/doc/guides/platform/mlx5.rst
@@ -259,13 +259,14 @@ configured by the ``ibverbs_link`` build option:
 Compilation on Windows
 ~~~~~~~~~~~~~~~~~~~~~~
 
-The DevX SDK location must be set through two environment variables:
+The DevX SDK location must be set through CFLAGS/LDFLAGS,
+either::
 
-``DEVX_LIB_PATH``
-   path to the DevX lib file.
+   meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" "-Dc_link_args=-L\"%DEVX_LIB_PATH%\"" ...
 
-``DEVX_INC_PATH``
-   path to the DevX header files.
+or::
+
+   set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-L"%DEVX_LIB_PATH%" && meson.exe setup ...
 
 
 .. _mlx5_common_env:
diff --git a/drivers/common/mlx5/windows/meson.build b/drivers/common/mlx5/windows/meson.build
index cc486014a8..f60daed840 100644
--- a/drivers/common/mlx5/windows/meson.build
+++ b/drivers/common/mlx5/windows/meson.build
@@ -1,6 +1,20 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019 Mellanox Technologies, Ltd
 
+if not cc.has_header('mlx5devx.h')
+    build = false
+    reason = 'missing dependency, "mlx5devx.h"'
+    subdir_done()
+endif
+
+devxlib = cc.find_library('mlx5devx', required: true)
+if not devxlib.found()
+    build = false
+    reason = 'missing dependency, "mlx5devx"'
+    subdir_done()
+endif
+ext_deps += devxlib
+
 includes += include_directories('.')
 
 sources += files(
@@ -8,20 +22,6 @@ sources += files(
         'mlx5_common_os.c',
 )
 
-res_lib = run_command(python3, '-c', 'import os; print(os.environ["DEVX_LIB_PATH"])', check: false)
-res_inc = run_command(python3, '-c', 'import os; print(os.environ["DEVX_INC_PATH"])', check: false)
-
-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',
-- 
2.39.1


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v3 2/3] net/mlx5: remove weak stub functions
  2023-03-02 13:21 ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Thomas Monjalon
  2023-03-02 13:21   ` [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
@ 2023-03-02 13:21   ` Thomas Monjalon
  2023-03-02 17:19     ` Tyler Retzlaff
  2023-03-02 13:21   ` [PATCH v3 3/3] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
  2023-03-12 15:44   ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Raslan Darawsheh
  3 siblings, 1 reply; 28+ messages in thread
From: Thomas Monjalon @ 2023-03-02 13:21 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

The vector Rx functions are conditionally compiled.
Some stub functions were also always compiled with weak attribute.
If there is no vector support, the weak functions were linked.

These weak functions are moved in a specific file
which is compiled only if there is no vector support.
This way it is simpler to understand,
and the weak attributes can be removed.

This change helps to compile with MinGW GCC
which has no support for weak functions.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/net/mlx5/meson.build          | 13 +++++----
 drivers/net/mlx5/mlx5_rx.c            | 35 ------------------------
 drivers/net/mlx5/mlx5_rxtx_vec_null.c | 38 +++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 40 deletions(-)
 create mode 100644 drivers/net/mlx5/mlx5_rxtx_vec_null.c

diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index abd507bd88..dba911693e 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -49,11 +49,14 @@ if is_linux
             'mlx5_hws_cnt.c',
             'mlx5_flow_verbs.c',
     )
-    if (dpdk_conf.has('RTE_ARCH_X86_64')
-        or dpdk_conf.has('RTE_ARCH_ARM64')
-        or dpdk_conf.has('RTE_ARCH_PPC_64'))
-        sources += files('mlx5_rxtx_vec.c')
-    endif
+endif
+
+if is_linux and (dpdk_conf.has('RTE_ARCH_X86_64')
+              or dpdk_conf.has('RTE_ARCH_ARM64')
+              or dpdk_conf.has('RTE_ARCH_PPC_64'))
+    sources += files('mlx5_rxtx_vec.c')
+else
+    sources += files('mlx5_rxtx_vec_null.c')
 endif
 
 cflags_options = [
diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
index 99a08ef5f1..a4d5031147 100644
--- a/drivers/net/mlx5/mlx5_rx.c
+++ b/drivers/net/mlx5/mlx5_rx.c
@@ -1262,41 +1262,6 @@ mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 	return i;
 }
 
-/*
- * Vectorized Rx routines are not compiled in when required vector instructions
- * are not supported on a target architecture.
- * The following null stubs are needed for linkage when those are not included
- * outside of this file (e.g. mlx5_rxtx_vec_sse.c for x86).
- */
-
-__rte_weak uint16_t
-mlx5_rx_burst_vec(void *dpdk_rxq __rte_unused,
-		  struct rte_mbuf **pkts __rte_unused,
-		  uint16_t pkts_n __rte_unused)
-{
-	return 0;
-}
-
-__rte_weak uint16_t
-mlx5_rx_burst_mprq_vec(void *dpdk_rxq __rte_unused,
-		       struct rte_mbuf **pkts __rte_unused,
-		       uint16_t pkts_n __rte_unused)
-{
-	return 0;
-}
-
-__rte_weak int
-mlx5_rxq_check_vec_support(struct mlx5_rxq_data *rxq __rte_unused)
-{
-	return -ENOTSUP;
-}
-
-__rte_weak int
-mlx5_check_vec_rx_support(struct rte_eth_dev *dev __rte_unused)
-{
-	return -ENOTSUP;
-}
-
 int
 mlx5_rx_queue_lwm_query(struct rte_eth_dev *dev,
 			uint16_t *queue_id, uint8_t *lwm)
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_null.c b/drivers/net/mlx5/mlx5_rxtx_vec_null.c
new file mode 100644
index 0000000000..03d6629e24
--- /dev/null
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_null.c
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2023 NVIDIA Corporation & Affiliates
+ */
+
+#include <rte_common.h>
+
+#include "mlx5_rx.h"
+
+struct rte_mbuf;
+struct rte_eth_dev;
+
+uint16_t
+mlx5_rx_burst_vec(void *dpdk_rxq __rte_unused,
+		struct rte_mbuf **pkts __rte_unused,
+		uint16_t pkts_n __rte_unused)
+{
+	return 0;
+}
+
+uint16_t
+mlx5_rx_burst_mprq_vec(void *dpdk_rxq __rte_unused,
+		struct rte_mbuf **pkts __rte_unused,
+		uint16_t pkts_n __rte_unused)
+{
+	return 0;
+}
+
+int
+mlx5_rxq_check_vec_support(struct mlx5_rxq_data *rxq __rte_unused)
+{
+	return -ENOTSUP;
+}
+
+int
+mlx5_check_vec_rx_support(struct rte_eth_dev *dev __rte_unused)
+{
+	return -ENOTSUP;
+}
-- 
2.39.1


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v3 3/3] net/mlx5: fix Windows build with MinGW GCC 12
  2023-03-02 13:21 ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Thomas Monjalon
  2023-03-02 13:21   ` [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
  2023-03-02 13:21   ` [PATCH v3 2/3] net/mlx5: remove weak stub functions Thomas Monjalon
@ 2023-03-02 13:21   ` Thomas Monjalon
  2023-03-02 17:28     ` Tyler Retzlaff
  2023-03-12 15:44   ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Raslan Darawsheh
  3 siblings, 1 reply; 28+ messages in thread
From: Thomas Monjalon @ 2023-03-02 13:21 UTC (permalink / raw)
  To: dev; +Cc: Tal Shnaiderman, stable, Matan Azrad, Viacheslav Ovsiienko

With recent changes in Meson and MinGW toolchain,
the driver mlx5 was not able to compile on Linux for Windows.

There were errors due to system detection, non-typed constants,
constant going over int range forbidden in pedantic mode,
and minimum-comparison of different types.

Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/common/mlx5/meson.build             |   9 +-
 drivers/common/mlx5/windows/mlx5_win_defs.h | 100 +++++++++++---------
 drivers/net/mlx5/windows/mlx5_os.c          |   4 +-
 3 files changed, 65 insertions(+), 48 deletions(-)

diff --git a/drivers/common/mlx5/meson.build b/drivers/common/mlx5/meson.build
index 60ccd95cbc..9dc809f192 100644
--- a/drivers/common/mlx5/meson.build
+++ b/drivers/common/mlx5/meson.build
@@ -1,9 +1,14 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019 Mellanox Technologies, Ltd
 
-if not (is_linux or (is_windows and is_ms_linker))
+if not (is_linux or is_windows)
     build = false
-    reason = 'only supported on Linux and Windows build with clang'
+    reason = 'only supported on Linux and Windows'
+    subdir_done()
+endif
+if is_windows and not is_ms_linker and not meson.is_cross_build()
+    build = false
+    reason = 'MinGW is supported only for cross-compilation test'
     subdir_done()
 endif
 
diff --git a/drivers/common/mlx5/windows/mlx5_win_defs.h b/drivers/common/mlx5/windows/mlx5_win_defs.h
index 3554e4a7ff..65da820c5e 100644
--- a/drivers/common/mlx5/windows/mlx5_win_defs.h
+++ b/drivers/common/mlx5/windows/mlx5_win_defs.h
@@ -2,8 +2,10 @@
  * Copyright (C) Mellanox Technologies, Ltd. 2001-2020.
  */
 
-#ifndef __MLX5_WIN_DEFS_H__
-#define __MLX5_WIN_DEFS_H__
+#ifndef MLX5_WIN_DEFS_H
+#define MLX5_WIN_DEFS_H
+
+#include <rte_bitops.h>
 
 enum {
 	MLX5_CQE_OWNER_MASK	= 1,
@@ -40,29 +42,29 @@ enum {
 };
 
 enum mlx5dv_cq_init_attr_mask {
-	MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE	= 1 << 0,
-	MLX5DV_CQ_INIT_ATTR_MASK_FLAGS		= 1 << 1,
-	MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE = 1 << 2,
+	MLX5DV_CQ_INIT_ATTR_MASK_COMPRESSED_CQE = RTE_BIT32(0),
+	MLX5DV_CQ_INIT_ATTR_MASK_FLAG           = RTE_BIT32(1),
+	MLX5DV_CQ_INIT_ATTR_MASK_CQE_SIZE       = RTE_BIT32(2),
 };
 
 enum mlx5dv_cqe_comp_res_format {
-	MLX5DV_CQE_RES_FORMAT_HASH		= 1 << 0,
-	MLX5DV_CQE_RES_FORMAT_CSUM		= 1 << 1,
-	MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX	= 1 << 2,
+	MLX5DV_CQE_RES_FORMAT_HASH        = RTE_BIT32(0),
+	MLX5DV_CQE_RES_FORMAT_CSUM        = RTE_BIT32(1),
+	MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX = RTE_BIT32(2),
 };
 
 enum ibv_access_flags {
-	IBV_ACCESS_LOCAL_WRITE		= 1,
-	IBV_ACCESS_REMOTE_WRITE		= 1 << 1,
-	IBV_ACCESS_REMOTE_READ		= 1 << 2,
-	IBV_ACCESS_REMOTE_ATOMIC	= 1 << 3,
-	IBV_ACCESS_MW_BIND		= 1 << 4,
-	IBV_ACCESS_ZERO_BASED		= 1 << 5,
-	IBV_ACCESS_ON_DEMAND		= 1 << 6,
+	IBV_ACCESS_LOCAL_WRITE   = RTE_BIT32(0),
+	IBV_ACCESS_REMOTE_WRITE  = RTE_BIT32(1),
+	IBV_ACCESS_REMOTE_READ   = RTE_BIT32(2),
+	IBV_ACCESS_REMOTE_ATOMIC = RTE_BIT32(3),
+	IBV_ACCESS_MW_BIND       = RTE_BIT32(4),
+	IBV_ACCESS_ZERO_BASED    = RTE_BIT32(5),
+	IBV_ACCESS_ON_DEMAND     = RTE_BIT32(6),
 };
 
 enum mlx5_ib_uapi_devx_create_event_channel_flags {
-	MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = 1 << 0,
+	MLX5_IB_UAPI_DEVX_CR_EV_CH_FLAGS_OMIT_DATA = RTE_BIT32(0),
 };
 
 #define MLX5DV_DEVX_CREATE_EVENT_CHANNEL_FLAGS_OMIT_EV_DATA \
@@ -85,15 +87,15 @@ enum {
 };
 
 enum {
-	MLX5_ETH_WQE_L3_CSUM = (1 << 6),
-	MLX5_ETH_WQE_L4_CSUM = (1 << 7),
+	MLX5_ETH_WQE_L3_CSUM = RTE_BIT32(6),
+	MLX5_ETH_WQE_L4_CSUM = RTE_BIT32(7),
 };
 
 enum {
-	MLX5_WQE_CTRL_CQ_UPDATE	= 2 << 2,
-	MLX5_WQE_CTRL_SOLICITED	= 1 << 1,
-	MLX5_WQE_CTRL_FENCE	= 4 << 5,
-	MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE = 1 << 5,
+	MLX5_WQE_CTRL_SOLICITED             = RTE_BIT32(1),
+	MLX5_WQE_CTRL_CQ_UPDATE             = RTE_BIT32(3),
+	MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE = RTE_BIT32(5),
+	MLX5_WQE_CTRL_FENCE                 = RTE_BIT32(7),
 };
 
 enum {
@@ -101,6 +103,11 @@ enum {
 	MLX5_SEND_WQE_SHIFT	= 6,
 };
 
+/* Verbs headers do not support -pedantic. */
+#ifdef PEDANTIC
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+
 /*
  * RX Hash fields enable to set which incoming packet's field should
  * participates in RX Hash. Each flag represent certain packet's field,
@@ -110,18 +117,22 @@ enum {
  * TCP and UDP flags can't be enabled together on the same QP.
  */
 enum ibv_rx_hash_fields {
-	IBV_RX_HASH_SRC_IPV4	= 1 << 0,
-	IBV_RX_HASH_DST_IPV4	= 1 << 1,
-	IBV_RX_HASH_SRC_IPV6	= 1 << 2,
-	IBV_RX_HASH_DST_IPV6	= 1 << 3,
-	IBV_RX_HASH_SRC_PORT_TCP	= 1 << 4,
-	IBV_RX_HASH_DST_PORT_TCP	= 1 << 5,
-	IBV_RX_HASH_SRC_PORT_UDP	= 1 << 6,
-	IBV_RX_HASH_DST_PORT_UDP	= 1 << 7,
-	IBV_RX_HASH_IPSEC_SPI		= 1 << 8,
-	IBV_RX_HASH_INNER		= (1 << 31),
+	IBV_RX_HASH_SRC_IPV4     = RTE_BIT32(0),
+	IBV_RX_HASH_DST_IPV4     = RTE_BIT32(1),
+	IBV_RX_HASH_SRC_IPV6     = RTE_BIT32(2),
+	IBV_RX_HASH_DST_IPV6     = RTE_BIT32(3),
+	IBV_RX_HASH_SRC_PORT_TCP = RTE_BIT32(4),
+	IBV_RX_HASH_DST_PORT_TCP = RTE_BIT32(5),
+	IBV_RX_HASH_SRC_PORT_UDP = RTE_BIT32(6),
+	IBV_RX_HASH_DST_PORT_UDP = RTE_BIT32(7),
+	IBV_RX_HASH_IPSEC_SPI    = RTE_BIT32(8),
+	IBV_RX_HASH_INNER        = RTE_BIT32(31),
 };
 
+#ifdef PEDANTIC
+#pragma GCC diagnostic error "-Wpedantic"
+#endif
+
 enum {
 	MLX5_RCV_DBR	= 0,
 	MLX5_SND_DBR	= 1,
@@ -141,9 +152,9 @@ enum {
 #endif
 
 enum ibv_flow_flags {
-	IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK = 1 << 0,
-	IBV_FLOW_ATTR_FLAGS_DONT_TRAP = 1 << 1,
-	IBV_FLOW_ATTR_FLAGS_EGRESS = 1 << 2,
+	IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK = RTE_BIT32(0),
+	IBV_FLOW_ATTR_FLAGS_DONT_TRAP = RTE_BIT32(1),
+	IBV_FLOW_ATTR_FLAGS_EGRESS = RTE_BIT32(2),
 };
 
 enum ibv_flow_attr_type {
@@ -240,11 +251,11 @@ struct mlx5_wqe_data_seg {
 	rte_be64_t		addr;
 };
 
-#define MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP	(1 << 4)
-#define IBV_DEVICE_RAW_IP_CSUM			(1 << 26)
-#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING	(1 << 0)
-#define IBV_RAW_PACKET_CAP_SCATTER_FCS		(1 << 1)
-#define IBV_QPT_RAW_PACKET			8
+#define MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP   RTE_BIT32(4)
+#define IBV_DEVICE_RAW_IP_CSUM               RTE_BIT32(26)
+#define IBV_RAW_PACKET_CAP_CVLAN_STRIPPING   RTE_BIT32(0)
+#define IBV_RAW_PACKET_CAP_SCATTER_FCS       RTE_BIT32(1)
+#define IBV_QPT_RAW_PACKET                   8
 
 enum {
 	MLX5_FLOW_CONTEXT_DEST_TYPE_VPORT                    = 0x0,
@@ -254,8 +265,9 @@ enum {
 };
 
 enum {
-	MLX5_MATCH_OUTER_HEADERS        = 1 << 0,
-	MLX5_MATCH_MISC_PARAMETERS      = 1 << 1,
-	MLX5_MATCH_INNER_HEADERS        = 1 << 2,
+	MLX5_MATCH_OUTER_HEADERS        = RTE_BIT32(0),
+	MLX5_MATCH_MISC_PARAMETERS      = RTE_BIT32(1),
+	MLX5_MATCH_INNER_HEADERS        = RTE_BIT32(2),
 };
-#endif /* __MLX5_WIN_DEFS_H__ */
+
+#endif /* MLX5_WIN_DEFS_H */
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index 77f04cc931..f401264b61 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -193,8 +193,8 @@ mlx5_os_capabilities_prepare(struct mlx5_dev_ctx_shared *sh)
 		 * Once DPDK supports it, take max size from device attr.
 		 */
 		sh->dev_cap.ind_table_max_size =
-			RTE_MIN(1 << hca_attr->rss_ind_tbl_cap,
-				(unsigned int)RTE_ETH_RSS_RETA_SIZE_512);
+			RTE_MIN((uint32_t)1 << hca_attr->rss_ind_tbl_cap,
+				(uint32_t)RTE_ETH_RSS_RETA_SIZE_512);
 		DRV_LOG(DEBUG, "Maximum Rx indirection table size is %u",
 			sh->dev_cap.ind_table_max_size);
 	}
-- 
2.39.1


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables
  2023-03-02 13:21   ` [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
@ 2023-03-02 17:17     ` Tyler Retzlaff
  2023-03-03 14:12       ` Thomas Monjalon
  2023-03-08 10:24     ` Tal Shnaiderman
  1 sibling, 1 reply; 28+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 17:17 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

On Thu, Mar 02, 2023 at 02:21:48PM +0100, Thomas Monjalon wrote:
> The DevX library path had to be provided through the variables
> DEVX_INC_PATH and DEVX_LIB_PATH.
> It was non-standard and triggers some issues with recent Meson.

is it possible for meson to search the default install location that the
devx sdk installation is normally located on windows? then only if you
installed it to some silly non-default location you have to provide
CFLAGS/LDFLAGS?

> 
> Using CFLAGS/LDFLAGS is standard and simpler.
> It is also possible to use the Meson options -Dc_args and -Dc_link_args.
> There are 2 options to provide:
> 	-I<include_directory>
> 	-L<library_directory>
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v3 2/3] net/mlx5: remove weak stub functions
  2023-03-02 13:21   ` [PATCH v3 2/3] net/mlx5: remove weak stub functions Thomas Monjalon
@ 2023-03-02 17:19     ` Tyler Retzlaff
  2023-03-08 10:26       ` Tal Shnaiderman
  0 siblings, 1 reply; 28+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 17:19 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

On Thu, Mar 02, 2023 at 02:21:49PM +0100, Thomas Monjalon wrote:
> The vector Rx functions are conditionally compiled.
> Some stub functions were also always compiled with weak attribute.
> If there is no vector support, the weak functions were linked.
> 
> These weak functions are moved in a specific file
> which is compiled only if there is no vector support.
> This way it is simpler to understand,
> and the weak attributes can be removed.
> 
> This change helps to compile with MinGW GCC
> which has no support for weak functions.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v3 3/3] net/mlx5: fix Windows build with MinGW GCC 12
  2023-03-02 13:21   ` [PATCH v3 3/3] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
@ 2023-03-02 17:28     ` Tyler Retzlaff
  2023-03-08 10:27       ` Tal Shnaiderman
  0 siblings, 1 reply; 28+ messages in thread
From: Tyler Retzlaff @ 2023-03-02 17:28 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Tal Shnaiderman, stable, Matan Azrad, Viacheslav Ovsiienko

On Thu, Mar 02, 2023 at 02:21:50PM +0100, Thomas Monjalon wrote:
> With recent changes in Meson and MinGW toolchain,
> the driver mlx5 was not able to compile on Linux for Windows.
> 
> There were errors due to system detection, non-typed constants,
> constant going over int range forbidden in pedantic mode,
> and minimum-comparison of different types.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---

lgtm

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables
  2023-03-02 17:17     ` Tyler Retzlaff
@ 2023-03-03 14:12       ` Thomas Monjalon
  2023-03-03 21:09         ` Tyler Retzlaff
  0 siblings, 1 reply; 28+ messages in thread
From: Thomas Monjalon @ 2023-03-03 14:12 UTC (permalink / raw)
  To: Tyler Retzlaff; +Cc: dev, Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

02/03/2023 18:17, Tyler Retzlaff:
> On Thu, Mar 02, 2023 at 02:21:48PM +0100, Thomas Monjalon wrote:
> > The DevX library path had to be provided through the variables
> > DEVX_INC_PATH and DEVX_LIB_PATH.
> > It was non-standard and triggers some issues with recent Meson.
> 
> is it possible for meson to search the default install location that the
> devx sdk installation is normally located on windows? then only if you
> installed it to some silly non-default location you have to provide
> CFLAGS/LDFLAGS?

Meson will look into standard system directories I guess,
but DevX is never installed in a system directory.
Which path do you have in mind?




^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables
  2023-03-03 14:12       ` Thomas Monjalon
@ 2023-03-03 21:09         ` Tyler Retzlaff
  2023-03-06  8:30           ` Thomas Monjalon
  0 siblings, 1 reply; 28+ messages in thread
From: Tyler Retzlaff @ 2023-03-03 21:09 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

On Fri, Mar 03, 2023 at 03:12:19PM +0100, Thomas Monjalon wrote:
> 02/03/2023 18:17, Tyler Retzlaff:
> > On Thu, Mar 02, 2023 at 02:21:48PM +0100, Thomas Monjalon wrote:
> > > The DevX library path had to be provided through the variables
> > > DEVX_INC_PATH and DEVX_LIB_PATH.
> > > It was non-standard and triggers some issues with recent Meson.
> > 
> > is it possible for meson to search the default install location that the
> > devx sdk installation is normally located on windows? then only if you
> > installed it to some silly non-default location you have to provide
> > CFLAGS/LDFLAGS?
> 
> Meson will look into standard system directories I guess,
> but DevX is never installed in a system directory.
> Which path do you have in mind?

i think when i install the sdk it goes here by default if i just mash
the next button. is it wrong to take a look at this path by default?

C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\{inc,lib}


> 
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables
  2023-03-03 21:09         ` Tyler Retzlaff
@ 2023-03-06  8:30           ` Thomas Monjalon
  2023-03-06 20:55             ` Tyler Retzlaff
  0 siblings, 1 reply; 28+ messages in thread
From: Thomas Monjalon @ 2023-03-06  8:30 UTC (permalink / raw)
  To: Tyler Retzlaff; +Cc: dev, Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

03/03/2023 22:09, Tyler Retzlaff:
> On Fri, Mar 03, 2023 at 03:12:19PM +0100, Thomas Monjalon wrote:
> > 02/03/2023 18:17, Tyler Retzlaff:
> > > On Thu, Mar 02, 2023 at 02:21:48PM +0100, Thomas Monjalon wrote:
> > > > The DevX library path had to be provided through the variables
> > > > DEVX_INC_PATH and DEVX_LIB_PATH.
> > > > It was non-standard and triggers some issues with recent Meson.
> > > 
> > > is it possible for meson to search the default install location that the
> > > devx sdk installation is normally located on windows? then only if you
> > > installed it to some silly non-default location you have to provide
> > > CFLAGS/LDFLAGS?
> > 
> > Meson will look into standard system directories I guess,
> > but DevX is never installed in a system directory.
> > Which path do you have in mind?
> 
> i think when i install the sdk it goes here by default if i just mash
> the next button. is it wrong to take a look at this path by default?
> 
> C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\{inc,lib}

If we have 2 versions in 2 directories,
and we look at the default location, then we can miss the right one.
I'm afraid such facility induce more complications at the end.



^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables
  2023-03-06  8:30           ` Thomas Monjalon
@ 2023-03-06 20:55             ` Tyler Retzlaff
  0 siblings, 0 replies; 28+ messages in thread
From: Tyler Retzlaff @ 2023-03-06 20:55 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Tal Shnaiderman, Matan Azrad, Viacheslav Ovsiienko

On Mon, Mar 06, 2023 at 09:30:00AM +0100, Thomas Monjalon wrote:
> 03/03/2023 22:09, Tyler Retzlaff:
> > On Fri, Mar 03, 2023 at 03:12:19PM +0100, Thomas Monjalon wrote:
> > > 02/03/2023 18:17, Tyler Retzlaff:
> > > > On Thu, Mar 02, 2023 at 02:21:48PM +0100, Thomas Monjalon wrote:
> > > > > The DevX library path had to be provided through the variables
> > > > > DEVX_INC_PATH and DEVX_LIB_PATH.
> > > > > It was non-standard and triggers some issues with recent Meson.
> > > > 
> > > > is it possible for meson to search the default install location that the
> > > > devx sdk installation is normally located on windows? then only if you
> > > > installed it to some silly non-default location you have to provide
> > > > CFLAGS/LDFLAGS?
> > > 
> > > Meson will look into standard system directories I guess,
> > > but DevX is never installed in a system directory.
> > > Which path do you have in mind?
> > 
> > i think when i install the sdk it goes here by default if i just mash
> > the next button. is it wrong to take a look at this path by default?
> > 
> > C:\Program Files\Mellanox\MLNX_WinOF2_DevX_SDK\{inc,lib}
> 
> If we have 2 versions in 2 directories,
> and we look at the default location, then we can miss the right one.
> I'm afraid such facility induce more complications at the end.

oh, didn't realize you can have multiple installations. suppose you
could "pick the newest" but maybe that's not terribly sensible.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables
  2023-03-02 13:21   ` [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
  2023-03-02 17:17     ` Tyler Retzlaff
@ 2023-03-08 10:24     ` Tal Shnaiderman
  1 sibling, 0 replies; 28+ messages in thread
From: Tal Shnaiderman @ 2023-03-08 10:24 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon (EXTERNAL), dev; +Cc: Matan Azrad, Slava Ovsiienko

> Subject: [PATCH v3 1/3] common/mlx5: get Windows dependency from
> standard variables
> 
> External email: Use caution opening links or attachments
> 
> 
> The DevX library path had to be provided through the variables
> DEVX_INC_PATH and DEVX_LIB_PATH.
> It was non-standard and triggers some issues with recent Meson.
> 
> Using CFLAGS/LDFLAGS is standard and simpler.
> It is also possible to use the Meson options -Dc_args and -Dc_link_args.
> There are 2 options to provide:
>         -I<include_directory>
>         -L<library_directory>
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  doc/guides/platform/mlx5.rst            | 11 +++++-----
>  drivers/common/mlx5/windows/meson.build | 28 ++++++++++++------------
> -
>  2 files changed, 20 insertions(+), 19 deletions(-)
> 
> diff --git a/doc/guides/platform/mlx5.rst b/doc/guides/platform/mlx5.rst
> index 2d6fbe7e44..5fc5d0cb8c 100644
> --- a/doc/guides/platform/mlx5.rst
> +++ b/doc/guides/platform/mlx5.rst
> @@ -259,13 +259,14 @@ configured by the ``ibverbs_link`` build option:
>  Compilation on Windows
>  ~~~~~~~~~~~~~~~~~~~~~~
> 
> -The DevX SDK location must be set through two environment variables:
> +The DevX SDK location must be set through CFLAGS/LDFLAGS,
> +either::
> 
> -``DEVX_LIB_PATH``
> -   path to the DevX lib file.
> +   meson.exe setup "-Dc_args=-I\"%DEVX_INC_PATH%\"" "-Dc_link_args=-
> L\"%DEVX_LIB_PATH%\"" ...
> 
> -``DEVX_INC_PATH``
> -   path to the DevX header files.
> +or::
> +
> +   set CFLAGS=-I"%DEVX_INC_PATH%" && set LDFLAGS=-
> L"%DEVX_LIB_PATH%" && meson.exe setup ...
> 
> 
>  .. _mlx5_common_env:
> diff --git a/drivers/common/mlx5/windows/meson.build
> b/drivers/common/mlx5/windows/meson.build
> index cc486014a8..f60daed840 100644
> --- a/drivers/common/mlx5/windows/meson.build
> +++ b/drivers/common/mlx5/windows/meson.build
> @@ -1,6 +1,20 @@
>  # SPDX-License-Identifier: BSD-3-Clause  # Copyright 2019 Mellanox
> Technologies, Ltd
> 
> +if not cc.has_header('mlx5devx.h')
> +    build = false
> +    reason = 'missing dependency, "mlx5devx.h"'
> +    subdir_done()
> +endif
> +
> +devxlib = cc.find_library('mlx5devx', required: true) if not
> +devxlib.found()
> +    build = false
> +    reason = 'missing dependency, "mlx5devx"'
> +    subdir_done()
> +endif
> +ext_deps += devxlib
> +
>  includes += include_directories('.')
> 
>  sources += files(
> @@ -8,20 +22,6 @@ sources += files(
>          'mlx5_common_os.c',
>  )
> 
> -res_lib = run_command(python3, '-c', 'import os;
> print(os.environ["DEVX_LIB_PATH"])', check: false) -res_inc =
> run_command(python3, '-c', 'import os;
> print(os.environ["DEVX_INC_PATH"])', check: false)
> -
> -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',
> --
> 2.39.1

Acked-by: Tal Shnaiderman <talshn@nvidia.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: [PATCH v3 2/3] net/mlx5: remove weak stub functions
  2023-03-02 17:19     ` Tyler Retzlaff
@ 2023-03-08 10:26       ` Tal Shnaiderman
  0 siblings, 0 replies; 28+ messages in thread
From: Tal Shnaiderman @ 2023-03-08 10:26 UTC (permalink / raw)
  To: Tyler Retzlaff, NBU-Contact-Thomas Monjalon (EXTERNAL)
  Cc: dev, Matan Azrad, Slava Ovsiienko

> Subject: Re: [PATCH v3 2/3] net/mlx5: remove weak stub functions
> 
> External email: Use caution opening links or attachments
> 
> 
> On Thu, Mar 02, 2023 at 02:21:49PM +0100, Thomas Monjalon wrote:
> > The vector Rx functions are conditionally compiled.
> > Some stub functions were also always compiled with weak attribute.
> > If there is no vector support, the weak functions were linked.
> >
> > These weak functions are moved in a specific file which is compiled
> > only if there is no vector support.
> > This way it is simpler to understand,
> > and the weak attributes can be removed.
> >
> > This change helps to compile with MinGW GCC which has no support for
> > weak functions.
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> 
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Acked-by: Tal Shnaiderman <talshn@nvidia.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: [PATCH v3 3/3] net/mlx5: fix Windows build with MinGW GCC 12
  2023-03-02 17:28     ` Tyler Retzlaff
@ 2023-03-08 10:27       ` Tal Shnaiderman
  0 siblings, 0 replies; 28+ messages in thread
From: Tal Shnaiderman @ 2023-03-08 10:27 UTC (permalink / raw)
  To: Tyler Retzlaff, NBU-Contact-Thomas Monjalon (EXTERNAL)
  Cc: dev, stable, Matan Azrad, Slava Ovsiienko

> Subject: Re: [PATCH v3 3/3] net/mlx5: fix Windows build with MinGW GCC 12
> 
> External email: Use caution opening links or attachments
> 
> 
> On Thu, Mar 02, 2023 at 02:21:50PM +0100, Thomas Monjalon wrote:
> > With recent changes in Meson and MinGW toolchain, the driver mlx5 was
> > not able to compile on Linux for Windows.
> >
> > There were errors due to system detection, non-typed constants,
> > constant going over int range forbidden in pedantic mode, and
> > minimum-comparison of different types.
> >
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> 
> lgtm
> 
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Acked-by: Tal Shnaiderman <talshn@nvidia.com>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* RE: [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW
  2023-03-02 13:21 ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Thomas Monjalon
                     ` (2 preceding siblings ...)
  2023-03-02 13:21   ` [PATCH v3 3/3] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
@ 2023-03-12 15:44   ` Raslan Darawsheh
  3 siblings, 0 replies; 28+ messages in thread
From: Raslan Darawsheh @ 2023-03-12 15:44 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon (EXTERNAL), dev; +Cc: Tal Shnaiderman

Hi,

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Thursday, March 2, 2023 3:22 PM
> To: dev@dpdk.org
> Cc: Tal Shnaiderman <talshn@nvidia.com>
> Subject: [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW
> 
> The result is to make possible to compile mlx5 on Linux for Windows.
> 
> v2: improve mlx5 doc and remove weak attribute from mlx5
> v3: avoid MinGW on Windows - EAL patch already applied
> 
> 
> Thomas Monjalon (3):
>   common/mlx5: get Windows dependency from standard variables
>   net/mlx5: remove weak stub functions
>   net/mlx5: fix Windows build with MinGW GCC 12
> 
>  doc/guides/platform/mlx5.rst                |  11 ++-
>  drivers/common/mlx5/meson.build             |   9 +-
>  drivers/common/mlx5/windows/meson.build     |  28 +++---
>  drivers/common/mlx5/windows/mlx5_win_defs.h | 100 +++++++++++------
> ---
>  drivers/net/mlx5/meson.build                |  13 ++-
>  drivers/net/mlx5/mlx5_rx.c                  |  35 -------
>  drivers/net/mlx5/mlx5_rxtx_vec_null.c       |  38 ++++++++
>  drivers/net/mlx5/windows/mlx5_os.c          |   4 +-
>  8 files changed, 131 insertions(+), 107 deletions(-)  create mode 100644
> drivers/net/mlx5/mlx5_rxtx_vec_null.c
> 
> --
> 2.39.1

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2023-03-12 15:44 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 16:10 [PATCH 0/3] fix mlx5 build with MinGW Thomas Monjalon
2023-01-05 16:10 ` [PATCH 1/3] eal/windows: fix pedantic build Thomas Monjalon
2023-01-05 16:40   ` Tyler Retzlaff
2023-01-05 16:10 ` [PATCH 2/3] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
2023-01-05 16:10 ` [PATCH 3/3] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
2023-01-12 20:37 ` [PATCH v2 0/4] fix Windows build with MinGW and mlx5 Thomas Monjalon
2023-01-12 20:37   ` [PATCH v2 1/4] eal/windows: fix pedantic build Thomas Monjalon
2023-03-01 16:33     ` Thomas Monjalon
2023-01-12 20:37   ` [PATCH v2 2/4] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
2023-01-12 20:37   ` [PATCH v2 3/4] net/mlx5: remove weak stub functions Thomas Monjalon
2023-01-23 19:42     ` Dmitry Kozlyuk
2023-01-24 14:42       ` Thomas Monjalon
2023-01-12 20:37   ` [PATCH v2 4/4] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
2023-03-02 13:21 ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Thomas Monjalon
2023-03-02 13:21   ` [PATCH v3 1/3] common/mlx5: get Windows dependency from standard variables Thomas Monjalon
2023-03-02 17:17     ` Tyler Retzlaff
2023-03-03 14:12       ` Thomas Monjalon
2023-03-03 21:09         ` Tyler Retzlaff
2023-03-06  8:30           ` Thomas Monjalon
2023-03-06 20:55             ` Tyler Retzlaff
2023-03-08 10:24     ` Tal Shnaiderman
2023-03-02 13:21   ` [PATCH v3 2/3] net/mlx5: remove weak stub functions Thomas Monjalon
2023-03-02 17:19     ` Tyler Retzlaff
2023-03-08 10:26       ` Tal Shnaiderman
2023-03-02 13:21   ` [PATCH v3 3/3] net/mlx5: fix Windows build with MinGW GCC 12 Thomas Monjalon
2023-03-02 17:28     ` Tyler Retzlaff
2023-03-08 10:27       ` Tal Shnaiderman
2023-03-12 15:44   ` [PATCH v3 0/3] mlx5: fix Windows build with Linux MinGW Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).