DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pallavi Kadam <pallavi.kadam@intel.com>
To: dev@dpdk.org, thomas@monjalon.net
Cc: ranjit.menon@intel.com, qiming.yang@intel.com,
	qi.z.zhang@intel.com, ferruh.yigit@intel.com,
	pallavi.kadam@intel.com
Subject: [dpdk-dev] [PATCH 2/4] net/ice: build on Windows
Date: Wed,  3 Mar 2021 13:59:27 -0800
Message-ID: <20210303215929.5616-3-pallavi.kadam@intel.com> (raw)
In-Reply-To: <20210303215929.5616-1-pallavi.kadam@intel.com>

Add Intel ice PMD support on Windows.
Remove #include sys/ioctl header file as it is not needed.
Replace x86intrin.h with rte_vect.h to avoid __m_prefetchw conflicting
types.
Replace POSIX usleep() API with rte API.
Add a new macro for the access() API as the original function
has been deprecated 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/ice/base/ice_flow.c       |  2 +-
 drivers/net/ice/base/ice_flow.h       |  2 +-
 drivers/net/ice/base/ice_osdep.h      | 15 +++++++++++++++
 drivers/net/ice/base/ice_switch.c     |  2 +-
 drivers/net/ice/base/ice_vlan_mode.h  |  1 +
 drivers/net/ice/ice_dcf_ethdev.c      |  1 -
 drivers/net/ice/ice_dcf_parent.c      | 10 +++++-----
 drivers/net/ice/ice_ethdev.c          |  6 +++---
 drivers/net/ice/ice_rxtx_vec_avx2.c   |  2 +-
 drivers/net/ice/ice_rxtx_vec_avx512.c |  2 +-
 drivers/net/ice/meson.build           | 10 ++++------
 11 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index a081fbe5a..a4c233d4c 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -3139,7 +3139,7 @@ enum ice_status ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk,
 	if (entry_h == ICE_FLOW_ENTRY_HANDLE_INVAL)
 		return ICE_ERR_PARAM;
 
-	entry = ICE_FLOW_ENTRY_PTR((unsigned long)entry_h);
+	entry = ICE_FLOW_ENTRY_PTR((intptr_t)entry_h);
 
 	/* Retain the pointer to the flow profile as the entry will be freed */
 	prof = entry->prof;
diff --git a/drivers/net/ice/base/ice_flow.h b/drivers/net/ice/base/ice_flow.h
index c3bce1319..af15ecb0f 100644
--- a/drivers/net/ice/base/ice_flow.h
+++ b/drivers/net/ice/base/ice_flow.h
@@ -446,7 +446,7 @@ struct ice_flow_entry {
 	u8 acts_cnt;
 };
 
-#define ICE_FLOW_ENTRY_HNDL(e)	((unsigned long)e)
+#define ICE_FLOW_ENTRY_HNDL(e)	((intptr_t)e)
 #define ICE_FLOW_ENTRY_PTR(h)	((struct ice_flow_entry *)(h))
 
 struct ice_flow_prof {
diff --git a/drivers/net/ice/base/ice_osdep.h b/drivers/net/ice/base/ice_osdep.h
index 46ac86834..f4cc762e9 100644
--- a/drivers/net/ice/base/ice_osdep.h
+++ b/drivers/net/ice/base/ice_osdep.h
@@ -62,9 +62,24 @@ typedef uint64_t        s64;
 #define __be64          uint64_t
 #endif
 
+/* Avoid macro redefinition warning on Windows */
+#ifdef RTE_EXEC_ENV_WINDOWS
+#ifdef min
+#undef min
+#endif
+#ifdef max
+#undef max
+#endif
+#endif
 #define min(a, b) RTE_MIN(a, b)
 #define max(a, b) RTE_MAX(a, b)
 
+#ifdef RTE_EXEC_ENV_WINDOWS
+#define ice_access _access
+#else
+#define ice_access access
+#endif
+
 #define FIELD_SIZEOF(t, f) RTE_SIZEOF_FIELD(t, f)
 #define ARRAY_SIZE(arr) RTE_DIM(arr)
 
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 4568242c1..b546e3d4e 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -6684,7 +6684,7 @@ ice_fill_valid_words(struct ice_adv_lkup_elem *rule,
 
 	for (j = 0; j < sizeof(rule->m_u) / sizeof(u16); j++)
 		if (((u16 *)&rule->m_u)[j] &&
-		    rule->type < ARRAY_SIZE(ice_prot_ext)) {
+		    (unsigned long long)rule->type < ARRAY_SIZE(ice_prot_ext)) {
 			/* No more space to accommodate */
 			if (word >= ICE_MAX_CHAIN_WORDS)
 				return 0;
diff --git a/drivers/net/ice/base/ice_vlan_mode.h b/drivers/net/ice/base/ice_vlan_mode.h
index e9f13e781..bcb6ff713 100644
--- a/drivers/net/ice/base/ice_vlan_mode.h
+++ b/drivers/net/ice/base/ice_vlan_mode.h
@@ -6,6 +6,7 @@
 #define _ICE_VLAN_MODE_H_
 
 #include "ice_osdep.h"
+#include "ice_status.h"
 
 struct ice_hw;
 
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index e0772295e..af4731f55 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -5,7 +5,6 @@
 #include <errno.h>
 #include <stdbool.h>
 #include <sys/types.h>
-#include <sys/ioctl.h>
 #include <unistd.h>
 
 #include <rte_interrupts.h>
diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c
index 476fd4906..a8571b35e 100644
--- a/drivers/net/ice/ice_dcf_parent.c
+++ b/drivers/net/ice/ice_dcf_parent.c
@@ -121,7 +121,7 @@ ice_dcf_vsi_update_service_handler(void *param)
 	struct ice_dcf_hw *hw = reset_param->dcf_hw;
 	struct ice_dcf_adapter *adapter;
 
-	usleep(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
+	rte_delay_us(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
 
 	rte_spinlock_lock(&vsi_update_lock);
 
@@ -315,24 +315,24 @@ ice_dcf_request_pkg_name(struct ice_hw *hw, char *pkg_name)
 	snprintf(pkg_name, ICE_MAX_PKG_FILENAME_SIZE,
 		 ICE_PKG_FILE_SEARCH_PATH_UPDATES "ice-%016llx.pkg",
 		 (unsigned long long)dsn);
-	if (!access(pkg_name, 0))
+	if (!ice_access(pkg_name, 0))
 		return 0;
 
 	snprintf(pkg_name, ICE_MAX_PKG_FILENAME_SIZE,
 		 ICE_PKG_FILE_SEARCH_PATH_DEFAULT "ice-%016llx.pkg",
 		 (unsigned long long)dsn);
-	if (!access(pkg_name, 0))
+	if (!ice_access(pkg_name, 0))
 		return 0;
 
 pkg_file_direct:
 	snprintf(pkg_name,
 		 ICE_MAX_PKG_FILENAME_SIZE, "%s", ICE_PKG_FILE_UPDATES);
-	if (!access(pkg_name, 0))
+	if (!ice_access(pkg_name, 0))
 		return 0;
 
 	snprintf(pkg_name,
 		 ICE_MAX_PKG_FILENAME_SIZE, "%s", ICE_PKG_FILE_DEFAULT);
-	if (!access(pkg_name, 0))
+	if (!ice_access(pkg_name, 0))
 		return 0;
 
 	return -1;
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index dfd99ace9..d22bc92ff 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1674,17 +1674,17 @@ ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file)
 
 	strncpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_UPDATES,
 		ICE_MAX_PKG_FILENAME_SIZE);
-	if (!access(strcat(pkg_file, opt_ddp_filename), 0))
+	if (!ice_access(strcat(pkg_file, opt_ddp_filename), 0))
 		return 0;
 
 	strncpy(pkg_file, ICE_PKG_FILE_SEARCH_PATH_DEFAULT,
 		ICE_MAX_PKG_FILENAME_SIZE);
-	if (!access(strcat(pkg_file, opt_ddp_filename), 0))
+	if (!ice_access(strcat(pkg_file, opt_ddp_filename), 0))
 		return 0;
 
 fail_dsn:
 	strncpy(pkg_file, ICE_PKG_FILE_UPDATES, ICE_MAX_PKG_FILENAME_SIZE);
-	if (!access(pkg_file, 0))
+	if (!ice_access(pkg_file, 0))
 		return 0;
 	strncpy(pkg_file, ICE_PKG_FILE_DEFAULT, ICE_MAX_PKG_FILENAME_SIZE);
 	return 0;
diff --git a/drivers/net/ice/ice_rxtx_vec_avx2.c b/drivers/net/ice/ice_rxtx_vec_avx2.c
index 7838e1778..a56fdd9a9 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx2.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx2.c
@@ -4,7 +4,7 @@
 
 #include "ice_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/ice/ice_rxtx_vec_avx512.c b/drivers/net/ice/ice_rxtx_vec_avx512.c
index fd5d72432..00de45479 100644
--- a/drivers/net/ice/ice_rxtx_vec_avx512.c
+++ b/drivers/net/ice/ice_rxtx_vec_avx512.c
@@ -4,7 +4,7 @@
 
 #include "ice_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/ice/meson.build b/drivers/net/ice/meson.build
index 9a67c8f7b..44ef64b4c 100644
--- a/drivers/net/ice/meson.build
+++ b/drivers/net/ice/meson.build
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-if is_windows
-	build = false
-	reason = 'not supported on Windows'
-	subdir_done()
-endif
-
 subdir('base')
 objs = [base_objs]
 
@@ -26,6 +20,10 @@ includes += include_directories('base', '../../common/iavf')
 if arch_subdir == 'x86'
 	sources += files('ice_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.18.0.windows.1


  parent reply	other threads:[~2021-03-03 21:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03 21:59 [dpdk-dev] [PATCH 0/4] Support ice PMD " Pallavi Kadam
2021-03-03 21:59 ` [dpdk-dev] [PATCH 1/4] build: enable iavf driver " Pallavi Kadam
2021-03-03 21:59 ` Pallavi Kadam [this message]
2021-03-04 12:56   ` [dpdk-dev] [PATCH 2/4] net/ice: build " David Marchand
2021-03-08 23:30     ` Kadam, Pallavi
2021-03-03 21:59 ` [dpdk-dev] [PATCH 3/4] net/ice: disable ice DDP package " Pallavi Kadam
2021-03-03 23:12   ` Dmitry Kozlyuk
2021-03-05  0:31     ` Kadam, Pallavi
2021-03-03 21:59 ` [dpdk-dev] [PATCH 4/4] doc: update ice PMD and 21.05 release notes Pallavi Kadam
2021-03-03 23:13   ` Dmitry Kozlyuk
2021-03-05  0:25     ` Kadam, Pallavi
2021-03-11  1:58 ` [dpdk-dev] [PATCH v2 0/3] Support ice PMD on Windows Pallavi Kadam
2021-03-11  1:58   ` [dpdk-dev] [PATCH v2 1/3] build: enable iavf base code to build on windows Pallavi Kadam
2021-03-25 16:41     ` Jie Zhou
2021-03-26 11:41     ` Ferruh Yigit
2021-03-28  2:05       ` Kadam, Pallavi
2021-03-11  1:58   ` [dpdk-dev] [PATCH v2 2/3] net/ice: build on Windows Pallavi Kadam
2021-03-25 16:48     ` Jie Zhou
2021-03-26 11:51     ` Ferruh Yigit
2021-03-28  2:00       ` Kadam, Pallavi
2021-03-26 11:58     ` Ferruh Yigit
2021-03-28  2:04       ` Kadam, Pallavi
2021-03-11  1:58   ` [dpdk-dev] [PATCH v2 3/3] net/ice: disable ice DDP package " Pallavi Kadam
2021-03-25 16:55     ` Jie Zhou
2021-03-26 11:53     ` Ferruh Yigit
2021-03-28  2:02       ` Kadam, Pallavi
2021-04-02  1:26   ` [dpdk-dev] [PATCH v3 0/3] Support ice PMD " Pallavi Kadam
2021-04-02  1:26     ` [dpdk-dev] [PATCH v3 1/3] build: enable iavf base code to build on windows Pallavi Kadam
2021-04-02  1:26     ` [dpdk-dev] [PATCH v3 2/3] net/ice: build on Windows Pallavi Kadam
2021-04-02  1:26     ` [dpdk-dev] [PATCH v3 3/3] net/ice: disable ice DDP package " Pallavi Kadam
2021-04-06 16:40     ` [dpdk-dev] [PATCH v3 0/3] Support ice PMD " Ferruh Yigit
2021-04-06 17:22       ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210303215929.5616-3-pallavi.kadam@intel.com \
    --to=pallavi.kadam@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=ranjit.menon@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git