[v3,1/3] net/iavf: build on Windows

Message ID 20210909232321.5091-2-pallavi.kadam@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series Support iavf PMD on Windows |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Kadam, Pallavi Sept. 9, 2021, 11:23 p.m. UTC
  - Enable IAVF PMD build on Windows
- Replace x86intrin.h with rte_vect.h to avoid __m_prefetchw conflicting
  types
- Fix for pointer and integer sign warnings using Clang compiler on
  Windows
- Add extra cflags '-fno-asynchronous-unwind-tables'
  to avoid MinGW build error:
  Error: invalid register for .seh_savexmm

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 drivers/net/iavf/iavf.h                 | 3 ++-
 drivers/net/iavf/iavf_rxtx_vec_avx2.c   | 2 +-
 drivers/net/iavf/iavf_rxtx_vec_avx512.c | 2 +-
 drivers/net/iavf/iavf_tm.c              | 2 +-
 drivers/net/iavf/meson.build            | 9 ++++-----
 5 files changed, 9 insertions(+), 9 deletions(-)
  

Comments

Shukla, Shivanshu Sept. 22, 2021, 8:58 p.m. UTC | #1
Ack-by:Shivanshu Shukla <Shivanshu.shukla@intel.com>

-----Original Message-----
From: Kadam, Pallavi <pallavi.kadam@intel.com> 
Sent: Thursday, September 9, 2021 4:23 PM
To: dev@dpdk.org
Cc: thomas@monjalon.net; Zhang, Qi Z <qi.z.zhang@intel.com>; fady@mellanox.com; Narcisa.Vasile@microsoft.com; dmitry.kozliuk@gmail.com; Yigit, Ferruh <ferruh.yigit@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Menon, Ranjit <ranjit.menon@intel.com>; Shukla, Shivanshu <shivanshu.shukla@intel.com>; Kadam, Pallavi <pallavi.kadam@intel.com>
Subject: [PATCH v3 1/3] net/iavf: build on Windows

- Enable IAVF PMD build on Windows
- Replace x86intrin.h with rte_vect.h to avoid __m_prefetchw conflicting
  types
- Fix for pointer and integer sign warnings using Clang compiler on
  Windows
- Add extra cflags '-fno-asynchronous-unwind-tables'
  to avoid MinGW build error:
  Error: invalid register for .seh_savexmm

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
---
 drivers/net/iavf/iavf.h                 | 3 ++-
 drivers/net/iavf/iavf_rxtx_vec_avx2.c   | 2 +-
 drivers/net/iavf/iavf_rxtx_vec_avx512.c | 2 +-
 drivers/net/iavf/iavf_tm.c              | 2 +-
 drivers/net/iavf/meson.build            | 9 ++++-----
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index b3bd078111..55b20a80af 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -335,7 +335,8 @@ _clear_cmd(struct iavf_info *vf)  static inline int  _atomic_set_cmd(struct iavf_info *vf, enum virtchnl_ops ops)  {
-	int ret = rte_atomic32_cmpset(&vf->pend_cmd, VIRTCHNL_OP_UNKNOWN, ops);
+	int ret = rte_atomic32_cmpset((volatile uint32_t *)&vf->pend_cmd,
+		VIRTCHNL_OP_UNKNOWN, ops);
 
 	if (!ret)
 		PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd); diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx2.c b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
index 475070e036..96c05d9319 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx2.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
@@ -4,7 +4,7 @@
 
 #include "iavf_rxtx_vec_common.h"
 
-#include <x86intrin.h>
+#include <rte_vect.h>
 
 #ifndef __INTEL_COMPILER
 #pragma GCC diagnostic ignored "-Wcast-qual"
diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx512.c b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
index 571161c0cd..cb0b057b0f 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
@@ -4,7 +4,7 @@
 
 #include "iavf_rxtx_vec_common.h"
 
-#include <x86intrin.h>
+#include <rte_vect.h>
 
 #ifndef __INTEL_COMPILER
 #pragma GCC diagnostic ignored "-Wcast-qual"
diff --git a/drivers/net/iavf/iavf_tm.c b/drivers/net/iavf/iavf_tm.c index 3c80276ff3..8d92062c7f 100644
--- a/drivers/net/iavf/iavf_tm.c
+++ b/drivers/net/iavf/iavf_tm.c
@@ -321,7 +321,7 @@ iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	}
 	/* check level */
 	if (level_id != RTE_TM_NODE_LEVEL_ID_ANY &&
-	    level_id != parent_node_type + 1) {
+	    level_id != (uint32_t)parent_node_type + 1) {
 		error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS;
 		error->message = "Wrong level";
 		return -EINVAL;
diff --git a/drivers/net/iavf/meson.build b/drivers/net/iavf/meson.build index f2010a8337..36a82e3faa 100644
--- a/drivers/net/iavf/meson.build
+++ b/drivers/net/iavf/meson.build
@@ -1,11 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
 
 cflags += ['-Wno-strict-aliasing']
 
@@ -25,6 +20,10 @@ sources = files(
 if arch_subdir == 'x86'
     sources += files('iavf_rxtx_vec_sse.c')
 
+    if is_windows and cc.get_id() != 'clang'
+        cflags += ['-fno-asynchronous-unwind-tables']
+    endif
+
     # compile AVX2 version if either:
     # a. we have AVX supported in minimum instruction set baseline
     # b. it's not minimum instruction set, but supported by compiler
--
2.31.1.windows.1
  

Patch

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index b3bd078111..55b20a80af 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -335,7 +335,8 @@  _clear_cmd(struct iavf_info *vf)
 static inline int
 _atomic_set_cmd(struct iavf_info *vf, enum virtchnl_ops ops)
 {
-	int ret = rte_atomic32_cmpset(&vf->pend_cmd, VIRTCHNL_OP_UNKNOWN, ops);
+	int ret = rte_atomic32_cmpset((volatile uint32_t *)&vf->pend_cmd,
+		VIRTCHNL_OP_UNKNOWN, ops);
 
 	if (!ret)
 		PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd);
diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx2.c b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
index 475070e036..96c05d9319 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx2.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx2.c
@@ -4,7 +4,7 @@ 
 
 #include "iavf_rxtx_vec_common.h"
 
-#include <x86intrin.h>
+#include <rte_vect.h>
 
 #ifndef __INTEL_COMPILER
 #pragma GCC diagnostic ignored "-Wcast-qual"
diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx512.c b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
index 571161c0cd..cb0b057b0f 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
@@ -4,7 +4,7 @@ 
 
 #include "iavf_rxtx_vec_common.h"
 
-#include <x86intrin.h>
+#include <rte_vect.h>
 
 #ifndef __INTEL_COMPILER
 #pragma GCC diagnostic ignored "-Wcast-qual"
diff --git a/drivers/net/iavf/iavf_tm.c b/drivers/net/iavf/iavf_tm.c
index 3c80276ff3..8d92062c7f 100644
--- a/drivers/net/iavf/iavf_tm.c
+++ b/drivers/net/iavf/iavf_tm.c
@@ -321,7 +321,7 @@  iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	}
 	/* check level */
 	if (level_id != RTE_TM_NODE_LEVEL_ID_ANY &&
-	    level_id != parent_node_type + 1) {
+	    level_id != (uint32_t)parent_node_type + 1) {
 		error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS;
 		error->message = "Wrong level";
 		return -EINVAL;
diff --git a/drivers/net/iavf/meson.build b/drivers/net/iavf/meson.build
index f2010a8337..36a82e3faa 100644
--- a/drivers/net/iavf/meson.build
+++ b/drivers/net/iavf/meson.build
@@ -1,11 +1,6 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
 
 cflags += ['-Wno-strict-aliasing']
 
@@ -25,6 +20,10 @@  sources = files(
 if arch_subdir == 'x86'
     sources += files('iavf_rxtx_vec_sse.c')
 
+    if is_windows and cc.get_id() != 'clang'
+        cflags += ['-fno-asynchronous-unwind-tables']
+    endif
+
     # compile AVX2 version if either:
     # a. we have AVX supported in minimum instruction set baseline
     # b. it's not minimum instruction set, but supported by compiler