From ce6617a0698e7cd2e5eab6d69a605a580fe0f451 Mon Sep 17 00:00:00 2001 From: Pallavi Kadam Date: Thu, 1 Apr 2021 18:26:20 -0700 Subject: [PATCH] net/ice: build on Windows - 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 - Add documentation to support ice PMD on Windows. Update the release notes and features list for the same. Signed-off-by: Pallavi Kadam Reviewed-by: Ranjit Menon Acked-by: Jie Zhou Reviewed-by: Ferruh Yigit --- doc/guides/nics/features/ice.ini | 1 + doc/guides/nics/ice.rst | 18 ++++++++++++++++-- doc/guides/rel_notes/release_21_05.rst | 4 ++++ 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/base/meson.build | 5 +++++ 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 ++++------ 15 files changed, 59 insertions(+), 22 deletions(-) diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini index e30a7d2e57..2b93872b1c 100644 --- a/doc/guides/nics/features/ice.ini +++ b/doc/guides/nics/features/ice.ini @@ -40,5 +40,6 @@ Module EEPROM dump = Y Multiprocess aware = Y FreeBSD = Y Linux = Y +Windows = Y x86-32 = Y x86-64 = Y diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index ccda26f82f..1000861328 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -8,8 +8,8 @@ The ice PMD (**librte_net_ice**) provides poll mode driver support for 10/25/50/100 Gbps Intel® Ethernet 800 Series Network Adapters based on the Intel Ethernet Controller E810 and Intel Ethernet Connection E822/E823. -Prerequisites -------------- +Linux Prerequisites +------------------- - Follow the DPDK :ref:`Getting Started Guide for Linux ` to setup the basic DPDK environment. @@ -25,6 +25,20 @@ Prerequisites - To understand DDP for COMMs usage with DPDK, please review `Intel® Ethernet 800 Series Telecommunication (Comms) Dynamic Device Personalization (DDP) Package `_. +Windows Prerequisites +--------------------- + +- Follow the DPDK `Getting Started Guide for Windows `_ to setup the basic DPDK environment. + +- Identify the Intel® Ethernet adapter and get the latest NVM/FW version. + +- To access any Intel® Ethernet hardware, load the NetUIO driver in place of existing built-in (inbox) driver. + +- To load NetUIO driver, follow the steps mentioned in `dpdk-kmods repository + `_. + +- Loading of private Dynamic Device Personalization (DDP) package is not supported on Windows. + Recommended Matching List ------------------------- diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index 0b741b79ee..fadcf681b1 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -109,6 +109,10 @@ New Features * Added flow filter to support GTPU inner L3/L4 fields matching. +* **Updated Intel ice driver.** + + * Added Intel ice support on Windows. + * **Updated NXP DPAA driver.** * Added support for shared ethernet interface. diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index bceb257d61..c12ddfa247 100644 --- a/drivers/net/ice/base/ice_flow.c +++ b/drivers/net/ice/base/ice_flow.c @@ -3144,7 +3144,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 c3bce13194..af15ecb0ff 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 46ac868349..f4cc762e99 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 3dc764266b..9233c5fd2a 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -6683,7 +6683,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)) { + (size_t)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 e9f13e7814..bcb6ff7134 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/base/meson.build b/drivers/net/ice/base/meson.build index b82d05fe73..c44d0e035d 100644 --- a/drivers/net/ice/base/meson.build +++ b/drivers/net/ice/base/meson.build @@ -21,6 +21,11 @@ error_cflags = ['-Wno-unused-value', '-Wno-unused-variable', '-Wno-unused-parameter', ] + +if is_windows and cc.get_id() != 'clang' + cflags += ['-fno-asynchronous-unwind-tables'] +endif + c_args = cflags foreach flag: error_cflags diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 215d71e1ba..b937cbbb03 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c index 476fd49067..a8571b35ee 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 5082c227bf..d432abcec2 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -1678,17 +1678,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 1cc54903c6..25efd30e6b 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 +#include #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 0e5a676e68..835d0aa703 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 +#include #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wcast-qual" diff --git a/drivers/net/ice/meson.build b/drivers/net/ice/meson.build index 9a67c8f7ba..44ef64b4cf 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.20.1