[v3,4/4] net/ixgbe: Add support for Windows

Message ID 20211002003344.594-5-u9012063@gmail.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series net/ixgbe: Add support for Windows |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

William Tu Oct. 2, 2021, 12:33 a.m. UTC
  This patch enables building the ixgbe driver for Windows.
It also enables its dependencies on security and cryptodev.
I tested on AWS using ixgbe VF device, using dpdk-testpmd.

Signed-off-by: William Tu <u9012063@gmail.com>
---
 drivers/net/ixgbe/base/ixgbe_hv_vf.c | 1 +
 drivers/net/ixgbe/base/ixgbe_osdep.h | 5 +++++
 drivers/net/ixgbe/base/meson.build   | 7 +++++++
 drivers/net/ixgbe/ixgbe_ethdev.c     | 2 +-
 drivers/net/ixgbe/ixgbe_ethdev.h     | 1 +
 drivers/net/ixgbe/ixgbe_flow.c       | 2 +-
 drivers/net/ixgbe/ixgbe_tm.c         | 2 +-
 drivers/net/ixgbe/meson.build        | 6 ------
 8 files changed, 17 insertions(+), 9 deletions(-)
  

Comments

Dmitry Kozlyuk Oct. 1, 2021, 7:03 p.m. UTC | #1
Hi William,

Recommended title: "net/ixgbe: build on Windows".

2021-10-01 17:33 (UTC-0700), William Tu:
> This patch enables building the ixgbe driver for Windows.
> It also enables its dependencies on security and cryptodev.
> I tested on AWS using ixgbe VF device, using dpdk-testpmd.
> 
> Signed-off-by: William Tu <u9012063@gmail.com>

I'm getting this error when building with MinGW:

	../drivers/net/ixgbe/ixgbe_ethdev.c:6416:29: error: ‘IPPROTO_SCTP’
	undeclared (first use in this function); did you mean ‘IPPROTO_TCP’?

Can be fixed by defining IPPROTO_SCTP in e.g. ixgbe_osdep.h if not defined.
Note that rte_os_shim.h cannot be used even in ixgbe_ethdev.c, because it
defines `read()` macro, which causes another error:

	../drivers/net/ixgbe/ixgbe_ethdev.c:4097:37: error: macro "read"
	passed 4 arguments, but takes just 3
	 4097 |  if (mbx->ops.read(hw, &in_msg, 1, 0))

> [...]
> diff --git a/drivers/net/ixgbe/base/meson.build b/drivers/net/ixgbe/base/meson.build
> index 22972c6b56..51a58a3183 100644
> --- a/drivers/net/ixgbe/base/meson.build
> +++ b/drivers/net/ixgbe/base/meson.build
> @@ -28,7 +28,14 @@ foreach flag: error_cflags
>      endif
>  endforeach
>  
> +inc = []
> +inc += include_directories('../../../../lib/net')
> +inc += include_directories('../../../../lib/mbuf')
> +inc += include_directories('../../../../lib/mempool')
> +inc += include_directories('../../../../lib/ring')
> +
>  base_lib = static_library('ixgbe_base', sources,
>      dependencies: static_rte_eal,
> +    include_directories: inc,
>      c_args: c_args)
>  base_objs = base_lib.extract_all_objects(recursive: true)

Looks messy, you could just do this:

    dependencies: [static_rte_eal, static_rte_net]

This works because all drivers/net have a standard dependency on lib/ethdev,
which pulls lib/net in its turn.
  

Patch

diff --git a/drivers/net/ixgbe/base/ixgbe_hv_vf.c b/drivers/net/ixgbe/base/ixgbe_hv_vf.c
index b7ad44ab8c..4572411d39 100644
--- a/drivers/net/ixgbe/base/ixgbe_hv_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_hv_vf.c
@@ -4,6 +4,7 @@ 
 
 #include "ixgbe_vf.h"
 #include "ixgbe_hv_vf.h"
+#include "ixgbe_osdep.h"
 
 /**
  * Hyper-V variant - just a stub.
diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h
index cacf724198..2c44e7bf35 100644
--- a/drivers/net/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/ixgbe/base/ixgbe_osdep.h
@@ -16,6 +16,7 @@ 
 #include <rte_log.h>
 #include <rte_byteorder.h>
 #include <rte_io.h>
+#include <rte_ip.h>
 
 #include "../ixgbe_logs.h"
 #include "../ixgbe_bypass_defines.h"
@@ -43,12 +44,16 @@ 
 
 #define false               0
 #define true                1
+#ifndef RTE_EXEC_ENV_WINDOWS
 #define min(a,b)	RTE_MIN(a,b) 
+#endif
 
 #define EWARN(hw, S, args...)     DEBUGOUT1(S, ##args)
 
 /* Bunch of defines for shared code bogosity */
+#ifndef UNREFERENCED_PARAMETER
 #define UNREFERENCED_PARAMETER(_p)  
+#endif
 #define UNREFERENCED_1PARAMETER(_p) 
 #define UNREFERENCED_2PARAMETER(_p, _q)
 #define UNREFERENCED_3PARAMETER(_p, _q, _r) 
diff --git a/drivers/net/ixgbe/base/meson.build b/drivers/net/ixgbe/base/meson.build
index 22972c6b56..51a58a3183 100644
--- a/drivers/net/ixgbe/base/meson.build
+++ b/drivers/net/ixgbe/base/meson.build
@@ -28,7 +28,14 @@  foreach flag: error_cflags
     endif
 endforeach
 
+inc = []
+inc += include_directories('../../../../lib/net')
+inc += include_directories('../../../../lib/mbuf')
+inc += include_directories('../../../../lib/mempool')
+inc += include_directories('../../../../lib/ring')
+
 base_lib = static_library('ixgbe_base', sources,
     dependencies: static_rte_eal,
+    include_directories: inc,
     c_args: c_args)
 base_objs = base_lib.extract_all_objects(recursive: true)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 47693c0c47..8b33897ca1 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -10,7 +10,6 @@ 
 #include <unistd.h>
 #include <stdarg.h>
 #include <inttypes.h>
-#include <netinet/in.h>
 #include <rte_string_fns.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
@@ -46,6 +45,7 @@ 
 #include "ixgbe_rxtx.h"
 #include "base/ixgbe_type.h"
 #include "base/ixgbe_phy.h"
+#include "base/ixgbe_osdep.h"
 #include "ixgbe_regs.h"
 
 /*
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index a0ce18ca24..645207e130 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -6,6 +6,7 @@ 
 #define _IXGBE_ETHDEV_H_
 
 #include <stdint.h>
+#include <sys/queue.h>
 
 #include "base/ixgbe_type.h"
 #include "base/ixgbe_dcb.h"
diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c
index 511b612f7f..27322ab903 100644
--- a/drivers/net/ixgbe/ixgbe_flow.c
+++ b/drivers/net/ixgbe/ixgbe_flow.c
@@ -10,7 +10,6 @@ 
 #include <unistd.h>
 #include <stdarg.h>
 #include <inttypes.h>
-#include <netinet/in.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
@@ -37,6 +36,7 @@ 
 #include "base/ixgbe_api.h"
 #include "base/ixgbe_vf.h"
 #include "base/ixgbe_common.h"
+#include "base/ixgbe_osdep.h"
 #include "ixgbe_ethdev.h"
 #include "ixgbe_bypass.h"
 #include "ixgbe_rxtx.h"
diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c
index a8407e742e..ae03ea6e9d 100644
--- a/drivers/net/ixgbe/ixgbe_tm.c
+++ b/drivers/net/ixgbe/ixgbe_tm.c
@@ -665,7 +665,7 @@  ixgbe_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/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
index 55ac91fcd1..4b18e47273 100644
--- a/drivers/net/ixgbe/meson.build
+++ b/drivers/net/ixgbe/meson.build
@@ -1,12 +1,6 @@ 
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
 
 subdir('base')