From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 767A9A0C47;
	Wed, 22 Sep 2021 22:58:37 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 0769A411EC;
	Wed, 22 Sep 2021 22:58:37 +0200 (CEST)
Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com
 [209.85.210.172])
 by mails.dpdk.org (Postfix) with ESMTP id 20020411A8
 for <dev@dpdk.org>; Wed, 22 Sep 2021 22:58:36 +0200 (CEST)
Received: by mail-pf1-f172.google.com with SMTP id e16so3795794pfc.6
 for <dev@dpdk.org>; Wed, 22 Sep 2021 13:58:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=Jkk7Tom5+WCBHg+JfBfVNqxRzzmY6fuH6bpNBYAlI30=;
 b=a3Tbvk/DTpQmomLS9Rl46KYdoJ0x497yhK4yHgbwME+wV6m7iXqyqI65Dg40JueFHR
 qaZIvbsUwEI+mETIsdyEP8mCMO/1MCOsEzEraXq4sqilpDB+WvpI6ByKQ1L29v4mdDWX
 zWrlOsVQrwNbPMJ/PZpYYWQBUP7cMbLQJJWcRE0ByVJoR8nOLWAbtrX8nMg5Ye2CPpzn
 XdkGpxg9bagZD2m6sKjDqVJ6C246bQKFI03HRX3wOgoch5vOIvGK9nHJjC8FNVR7QGYo
 kqdtxrhKoGx0c7QF/hKgPAnxCeglObbojY9GjU9nDrL2i6L8XF4RUkXGQn2ibhkwZL0+
 R+zw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=Jkk7Tom5+WCBHg+JfBfVNqxRzzmY6fuH6bpNBYAlI30=;
 b=raPkYV7tFRIn2hwRcwvpuovL3f7x8YivP4gdZbCbYhSLbTQj846aqCHc9Z5u0SrLuk
 0RmBGtnQCGNFGgCNK0L1fFo8ukJmA4CAaf3No/85AsNH7tIh/2lV/u1p0YbaYFiFGm7g
 +DF5eiMnaAN4mgdaYaPEDmlgVBprIA+zM67j0taFJwbFyBR7+FxxuIHs+3sxsJ5sL9RK
 NXLF3cZZf/cVjpBHZgVVlpAXU/HP54s41B9cbL67hhLQCQF61K6cogHzgr+iTY2Tc4L9
 eN0zRYhiEF7UD2wL1TdZaz0CbeGgqvrkSH8CegdF6ng4E9QjsxRVgZ81OvvB82fVoA/0
 wU7A==
X-Gm-Message-State: AOAM532w8LNd+FIovcRaJucw4QQvC+w0RW+C1VDQcND/hqmW/SNVbktj
 gh5NTeRjfruDxkbQRBBFg3sXvu2eXczXLQ==
X-Google-Smtp-Source: ABdhPJzZFiuq6YPBDSWTu9ieEYrCqPFMGn9H9P+81wXR5jlJ2lD4MZzZleYbebwlusW6lXYf1NHVGg==
X-Received: by 2002:a63:5011:: with SMTP id e17mr786671pgb.391.1632344314494; 
 Wed, 22 Sep 2021 13:58:34 -0700 (PDT)
Received: from localhost.localdomain (c-67-160-105-174.hsd1.wa.comcast.net.
 [67.160.105.174])
 by smtp.gmail.com with ESMTPSA id e1sm4032017pgi.43.2021.09.22.13.58.32
 for <dev@dpdk.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 22 Sep 2021 13:58:33 -0700 (PDT)
From: William Tu <u9012063@gmail.com>
To: dev@dpdk.org
Date: Wed, 22 Sep 2021 20:58:23 +0000
Message-Id: <20210922205823.38073-1-u9012063@gmail.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20210915184448.92751-1-u9012063@gmail.com>
References: <20210915184448.92751-1-u9012063@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v2] net/ixgbe: Add support for Windows
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

This patch enables building the ixgbe driver for Windows.
It also enables its dependencies on security and cryptodev.
I tested on AWS using Intel Corporation 82599 Ethernet
Controller Virtual Function [8086:10ed], using dpdk-testpmd.

Signed-off-by: William Tu <u9012063@gmail.com>
---
Depends-on: series-18880 ("cryptodev: build on Windows")
Depends-on: series-18943 ("security: use the net library for IP structs")

v2:
* add dependencies on cryptodev and security
* add #include <rte_ip.h>, instead of doing
    #ifndef RTE_EXEC_ENV_WINDOWS
    #include <netinet/in.h>
    #else
    #include <Ws2tcpip.h>
    #endif
  however, including rte_ip.h requires including another
  set of dependent headers, see the
    drivers/net/ixgbe/base/meson.build
---
 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_flow.c       | 2 +-
 drivers/net/ixgbe/ixgbe_tm.c         | 2 +-
 drivers/net/ixgbe/meson.build        | 6 ------
 7 files changed, 16 insertions(+), 9 deletions(-)

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_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')
-- 
2.30.2