Skip to contentSkip to conversation

net/cxgbe: fix build for Microsoft Windows OS support

PATCH In review Rahul Lakkireddy 2 participants 7 messages Dec 19, 2018 – Dec 20, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

v2 cover net/cxgbe: fix build for Microsoft Windows OS support

This series of patches fix compilation warning and errors seen while building CXGBE PMD in preparation for Microsoft Windows OS support.

Patch 1 uses relative paths for including header files. Patch 2 fixes macros related to rte_log().
Patch 3 only redefines symbols when they are not available. Patch 4 fixes other misc build issues.

Patches are generated against dpdk-next-net tree.

Build Environment:
1. Target OS: Microsoft Windows Server 2016
2. Compiler: Intel C++ Compiler v19 from Intel Parallel Studio XE 2019 [1]
3. Development Tools:
3.1 Microsoft Visual Studio 2017 Professional
3.2 Windows Software Development Kit (SDK) v10.0.17763
3.3 Windows Driver Kit (WDK) v10.0.17763

[1] https://software.intel.com/en-us/parallel-studio-xe

Thanks,
Rahul

---
v2:
- Add more info in commit message regarding Windows build.

Rahul Lakkireddy (4):
net/cxgbe: use relative paths for including header files net/cxgbe: fix macros related to logs for Windows net/cxgbe: only define symbols when not available net/cxgbe: fix other misc build issues for Windows

 drivers/net/cxgbe/Makefile         |  2 -
 drivers/net/cxgbe/base/adapter.h   |  4 +-
 drivers/net/cxgbe/base/common.h    |  4 +-
 drivers/net/cxgbe/base/t4_hw.c     |  4 +-
 drivers/net/cxgbe/base/t4vf_hw.c   |  2 +-
 drivers/net/cxgbe/clip_tbl.c       |  2 +-
 drivers/net/cxgbe/cxgbe.h          |  4 +-
 drivers/net/cxgbe/cxgbe_compat.h   | 83 ++++++++++++++++++++----------
 drivers/net/cxgbe/cxgbe_ethdev.c   |  2 +-
 drivers/net/cxgbe/cxgbe_filter.c   |  7 +--
 drivers/net/cxgbe/cxgbe_filter.h   |  2 +-
 drivers/net/cxgbe/cxgbe_flow.c     |  2 +-
 drivers/net/cxgbe/cxgbe_main.c     |  6 +--
 drivers/net/cxgbe/cxgbevf_ethdev.c |  2 +-
 drivers/net/cxgbe/cxgbevf_main.c   |  6 +--
 drivers/net/cxgbe/l2t.c            |  3 +-
 drivers/net/cxgbe/l2t.h            |  2 +-
 drivers/net/cxgbe/mps_tcam.h       |  2 +-
 drivers/net/cxgbe/sge.c            |  9 ++--
 19 files changed, 90 insertions(+), 58 deletions(-)
Signature · 1 line
2.18.0
#1 lore raw

PATCH v2 1/4 net/cxgbe: use relative paths for including header files

The Intel C++ compiler is not able to locate the header files without relative paths in Windows build. Following errors are seen for these header files.

C:\> base\common.h(9): error : cannot open source file "cxgbe_compat.h"

        #include "cxgbe_compat.h"
                                 ^

[...]

Fix by explicitly stating header file location using relative paths. Also, remove automatically including header files for Linux, to keep it consistent across both OS.

Build Environment:
1. Target OS: Microsoft Windows Server 2016
2. Compiler: Intel C++ Compiler from Intel Parallel Studio XE 2019 [1]
3. Development Tools:
3.1 Microsoft Visual Studio 2017 Professional
3.2 Windows Software Development Kit (SDK) v10.0.17763 3.3 Windows Driver Kit (WDK) v10.0.17763

[1] https://software.intel.com/en-us/parallel-studio-xe

---
v2:
- Add more info in commit message regarding Windows build.

 drivers/net/cxgbe/Makefile         | 2 --
 drivers/net/cxgbe/base/adapter.h   | 4 ++--
 drivers/net/cxgbe/base/common.h    | 2 +-
 drivers/net/cxgbe/clip_tbl.c       | 2 +-
 drivers/net/cxgbe/cxgbe.h          | 4 ++--
 drivers/net/cxgbe/cxgbe_ethdev.c   | 2 +-
 drivers/net/cxgbe/cxgbe_filter.c   | 7 ++++---
 drivers/net/cxgbe/cxgbe_filter.h   | 2 +-
 drivers/net/cxgbe/cxgbe_flow.c     | 2 +-
 drivers/net/cxgbe/cxgbe_main.c     | 6 +++---
 drivers/net/cxgbe/cxgbevf_ethdev.c | 2 +-
 drivers/net/cxgbe/cxgbevf_main.c   | 6 +++---
 drivers/net/cxgbe/l2t.c            | 3 ++-
 drivers/net/cxgbe/l2t.h            | 2 +-
 drivers/net/cxgbe/mps_tcam.h       | 2 +-
 drivers/net/cxgbe/sge.c            | 6 +++---
 16 files changed, 27 insertions(+), 27 deletions(-)
drivers/net/cxgbe/Makefile +0 -2
index 68466f13e..d809f4720 100644
@@ -9,8 +9,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
 #
 LIB = librte_pmd_cxgbe.a
 
-CFLAGS += -I$(SRCDIR)/base/
-CFLAGS += -I$(SRCDIR)
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
drivers/net/cxgbe/base/adapter.h +2 -2
index 47cfc5f5f..17ce60d04 100644
@@ -14,9 +14,9 @@
 #include <rte_rwlock.h>
 #include <rte_ethdev.h>
 
-#include "cxgbe_compat.h"
+#include "../cxgbe_compat.h"
+#include "../cxgbe_ofld.h"
 #include "t4_regs_values.h"
-#include "cxgbe_ofld.h"
 
 enum {
 	MAX_ETH_QSETS = 64,           /* # of Ethernet Tx/Rx queue sets */
drivers/net/cxgbe/base/common.h +1 -1
index fd2006682..84311fc95 100644
@@ -6,7 +6,7 @@
 #ifndef __CHELSIO_COMMON_H
 #define __CHELSIO_COMMON_H
 
-#include "cxgbe_compat.h"
+#include "../cxgbe_compat.h"
 #include "t4_hw.h"
 #include "t4vf_hw.h"
 #include "t4_chip_type.h"
drivers/net/cxgbe/clip_tbl.c +1 -1
index 5e4dc5270..a0ab2a6ac 100644
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-#include "common.h"
+#include "base/common.h"
 #include "clip_tbl.h"
 
 /**
drivers/net/cxgbe/cxgbe.h +2 -2
index eb58f8802..5a7490f91 100644
@@ -6,8 +6,8 @@
 #ifndef _CXGBE_H_
 #define _CXGBE_H_
 
-#include "common.h"
-#include "t4_regs.h"
+#include "base/common.h"
+#include "base/t4_regs.h"
 
 #define CXGBE_MIN_RING_DESC_SIZE      128  /* Min TX/RX descriptor ring size */
 #define CXGBE_MAX_RING_DESC_SIZE      4096 /* Max TX/RX descriptor ring size */
drivers/net/cxgbe/cxgbe_ethdev.c +1 -1
index b2f83ea37..010a818eb 100644
@@ -57,7 +57,7 @@
 /*
  *... and the PCI ID Table itself ...
  */
-#include "t4_pci_id_tbl.h"
+#include "base/t4_pci_id_tbl.h"
 
 uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			 uint16_t nb_pkts)
drivers/net/cxgbe/cxgbe_filter.c +4 -3
index 3a7912e48..86a6158fd 100644
@@ -3,9 +3,10 @@
  * All rights reserved.
  */
 #include <rte_net.h>
-#include "common.h"
-#include "t4_tcb.h"
-#include "t4_regs.h"
+
+#include "base/common.h"
+#include "base/t4_tcb.h"
+#include "base/t4_regs.h"
 #include "cxgbe_filter.h"
 #include "clip_tbl.h"
 #include "l2t.h"
drivers/net/cxgbe/cxgbe_filter.h +1 -1
index b7bcbf56a..2d6077718 100644
@@ -6,7 +6,7 @@
 #ifndef _CXGBE_FILTER_H_
 #define _CXGBE_FILTER_H_
 
-#include "t4_msg.h"
+#include "base/t4_msg.h"
 /*
  * Defined bit width of user definable filter tuples
  */
drivers/net/cxgbe/cxgbe_flow.c +1 -1
index 7b87bdf58..099499c2b 100644
@@ -2,7 +2,7 @@
  * Copyright(c) 2018 Chelsio Communications.
  * All rights reserved.
  */
-#include "common.h"
+#include "base/common.h"
 #include "cxgbe_flow.h"
 
 #define __CXGBE_FILL_FS(__v, __m, fs, elem, e) \
drivers/net/cxgbe/cxgbe_main.c +3 -3
index 5fa6cdd05..fd0707b95 100644
@@ -33,9 +33,9 @@
 #include <rte_dev.h>
 #include <rte_kvargs.h>
 
-#include "common.h"
-#include "t4_regs.h"
-#include "t4_msg.h"
+#include "base/common.h"
+#include "base/t4_regs.h"
+#include "base/t4_msg.h"
 #include "cxgbe.h"
 #include "clip_tbl.h"
 #include "l2t.h"
drivers/net/cxgbe/cxgbevf_ethdev.c +1 -1
index a6458d533..0e93d99e6 100644
@@ -28,7 +28,7 @@
 /*
  *... and the PCI ID Table itself ...
  */
-#include "t4_pci_id_tbl.h"
+#include "base/t4_pci_id_tbl.h"
 
 /*
  * Get port statistics.
drivers/net/cxgbe/cxgbevf_main.c +3 -3
index 61bd85193..f440b4345 100644
@@ -7,9 +7,9 @@
 #include <rte_ethdev_pci.h>
 #include <rte_malloc.h>
 
-#include "common.h"
-#include "t4_regs.h"
-#include "t4_msg.h"
+#include "base/common.h"
+#include "base/t4_regs.h"
+#include "base/t4_msg.h"
 #include "cxgbe.h"
 #include "mps_tcam.h"
 
drivers/net/cxgbe/l2t.c +2 -1
index 814188fea..27cdf6f33 100644
@@ -2,7 +2,8 @@
  * Copyright(c) 2018 Chelsio Communications.
  * All rights reserved.
  */
-#include "common.h"
+
+#include "base/common.h"
 #include "l2t.h"
 
 /**
drivers/net/cxgbe/l2t.h +1 -1
index 22a34e388..ee40dc1f6 100644
@@ -5,7 +5,7 @@
 #ifndef _CXGBE_L2T_H_
 #define _CXGBE_L2T_H_
 
-#include "t4_msg.h"
+#include "base/t4_msg.h"
 
 enum {
 	L2T_SIZE = 4096       /* # of L2T entries */
drivers/net/cxgbe/mps_tcam.h +1 -1
index c3d6fe0d7..f86bac7bd 100644
@@ -6,7 +6,7 @@
 #ifndef _CXGBE_MPSTCAM_H_
 #define _CXGBE_MPSTCAM_H_
 
-#include "common.h"
+#include "base/common.h"
 
 enum {
 	MPS_ENTRY_UNUSED,	/* Keep this first so memset 0 renders
drivers/net/cxgbe/sge.c +3 -3
index f9d2d48a0..bf0afb138 100644
@@ -33,9 +33,9 @@
 #include <rte_random.h>
 #include <rte_dev.h>
 
-#include "common.h"
-#include "t4_regs.h"
-#include "t4_msg.h"
+#include "base/common.h"
+#include "base/t4_regs.h"
+#include "base/t4_msg.h"
 #include "cxgbe.h"
 
 static inline void ship_tx_pkt_coalesce_wr(struct adapter *adap,
Signature · 1 line
2.18.0
#2 lore raw

PATCH v2 2/4 net/cxgbe: fix macros related to logs for Windows

In reply to Rahul Lakkireddy

Replace "args..." with "fmt, ..." and directly use __VA_ARGS__.

This fixes following errors reported by Intel C++ compiler in Windows build.

C:\> cxgbe_compat.h(28): error : expected a ")"

        #define dev_printf(level, fmt, args...) \
                                       ^

C:\> cxgbe_compat.h(31): error : expected a ")"

        #define dev_err(x, args...) dev_printf(ERR, args)
                           ^

[...]

Build Environment:
1. Target OS: Microsoft Windows Server 2016
2. Compiler: Intel C++ Compiler from Intel Parallel Studio XE 2019 [1]
3. Development Tools:
3.1 Microsoft Visual Studio 2017 Professional
3.2 Windows Software Development Kit (SDK) v10.0.17763 3.3 Windows Driver Kit (WDK) v10.0.17763

[1] https://software.intel.com/en-us/parallel-studio-xe

---
v2:
- Add more info in commit message regarding Windows build.

 drivers/net/cxgbe/cxgbe_compat.h | 40 ++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 18 deletions(-)
drivers/net/cxgbe/cxgbe_compat.h +22 -18
index 5d47c5f3d..ce4662d54 100644
@@ -19,41 +19,45 @@
 #include <rte_log.h>
 #include <rte_io.h>
 
-#define dev_printf(level, fmt, args...) \
-	RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ## args)
+#define dev_printf(level, fmt, ...) \
+	RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ##__VA_ARGS__)
 
-#define dev_err(x, args...) dev_printf(ERR, args)
-#define dev_info(x, args...) dev_printf(INFO, args)
-#define dev_warn(x, args...) dev_printf(WARNING, args)
+#define dev_err(x, fmt, ...) dev_printf(ERR, fmt, ##__VA_ARGS__)
+#define dev_info(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__)
+#define dev_warn(x, fmt, ...) dev_printf(WARNING, fmt, ##__VA_ARGS__)
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG
-#define dev_debug(x, args...) dev_printf(DEBUG, args)
+#define dev_debug(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__)
 #else
-#define dev_debug(x, args...) do { } while (0)
+#define dev_debug(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG_REG
-#define CXGBE_DEBUG_REG(x, args...) dev_printf(DEBUG, "REG:" args)
+#define CXGBE_DEBUG_REG(x, fmt, ...) \
+	dev_printf(INFO, "REG:" fmt, ##__VA_ARGS__)
 #else
-#define CXGBE_DEBUG_REG(x, args...) do { } while (0)
+#define CXGBE_DEBUG_REG(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG_MBOX
-#define CXGBE_DEBUG_MBOX(x, args...) dev_printf(DEBUG, "MBOX:" args)
+#define CXGBE_DEBUG_MBOX(x, fmt, ...) \
+	dev_printf(INFO, "MBOX:" fmt, ##__VA_ARGS__)
 #else
-#define CXGBE_DEBUG_MBOX(x, args...) do { } while (0)
+#define CXGBE_DEBUG_MBOX(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG_TX
-#define CXGBE_DEBUG_TX(x, args...) dev_printf(DEBUG, "TX:" args)
+#define CXGBE_DEBUG_TX(x, fmt, ...) \
+	dev_printf(INFO, "TX:" fmt, ##__VA_ARGS__)
 #else
-#define CXGBE_DEBUG_TX(x, args...) do { } while (0)
+#define CXGBE_DEBUG_TX(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG_RX
-#define CXGBE_DEBUG_RX(x, args...) dev_printf(DEBUG, "RX:" args)
+#define CXGBE_DEBUG_RX(x, fmt, ...) \
+	dev_printf(INFO, "RX:" fmt, ##__VA_ARGS__)
 #else
-#define CXGBE_DEBUG_RX(x, args...) do { } while (0)
+#define CXGBE_DEBUG_RX(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG
@@ -63,9 +67,9 @@
 #define CXGBE_FUNC_TRACE() do { } while (0)
 #endif
 
-#define pr_err(y, args...) dev_err(0, y, ##args)
-#define pr_warn(y, args...) dev_warn(0, y, ##args)
-#define pr_info(y, args...) dev_info(0, y, ##args)
+#define pr_err(fmt, ...) dev_err(0, fmt, ##__VA_ARGS__)
+#define pr_warn(fmt, ...) dev_warn(0, fmt, ##__VA_ARGS__)
+#define pr_info(fmt, ...) dev_info(0, fmt, ##__VA_ARGS__)
 #define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
 
 #define ASSERT(x) do {\
Signature · 1 line
2.18.0
#3 lore raw

PATCH v2 3/4 net/cxgbe: only define symbols when not available

In reply to Rahul Lakkireddy

Define symbols only when they are not available.

This fixes following types of issues reported by Intel C++ compiler in Windows build.

C:\> cxgbe_compat.h(154): warning #47: incompatible redefinition of macro "min"

        #define min(a, b) RTE_MIN(a, b)
                ^

C:\> t4_hw.c(338): warning #266: function "bzero" declared implicitly

            bzero(p, 0, size);
            ^

C:\> t4_hw.c(5337): warning #266: function "htonl" declared implicitly

            rvc.op_to_viid = htonl(V_FW_CMD_OP(FW_RSS_VI_CONFIG_CMD) |
                             ^

C:\> sge.c(361): error : expected an expression

        struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, fl);
                                  ^

C:\> sge.c(1350): error : identifier "caddr_t" is undefined
static void inline_tx_mbuf(const struct sge_txq *q, caddr_t from,

                                                      ^

[...]

Build Environment:
1. Target OS: Microsoft Windows Server 2016
2. Compiler: Intel C++ Compiler from Intel Parallel Studio XE 2019 [1]
3. Development Tools:
3.1 Microsoft Visual Studio 2017 Professional
3.2 Windows Software Development Kit (SDK) v10.0.17763 3.3 Windows Driver Kit (WDK) v10.0.17763

[1] https://software.intel.com/en-us/parallel-studio-xe

---
v2:
- Add more info in commit message regarding Windows build.

 drivers/net/cxgbe/base/t4_hw.c   |  4 ++--
 drivers/net/cxgbe/base/t4vf_hw.c |  2 +-
 drivers/net/cxgbe/cxgbe_compat.h | 29 ++++++++++++++++++++++++++++-
 3 files changed, 31 insertions(+), 4 deletions(-)
drivers/net/cxgbe/base/t4_hw.c +2 -2
index 701e0b1fe..796e2f7f8 100644
@@ -246,7 +246,7 @@ static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit,
 			 u32 mbox_addr)
 {
 	for ( ; nflit; nflit--, mbox_addr += 8)
-		*rpl++ = htobe64(t4_read_reg64(adap, mbox_addr));
+		*rpl++ = cpu_to_be64(t4_read_reg64(adap, mbox_addr));
 }
 
 /*
@@ -335,7 +335,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
 		return -EINVAL;
 	}
 
-	bzero(p, size);
+	memset(p, 0, size);
 	memcpy(p, (const __be64 *)cmd, size);
 
 	/*
drivers/net/cxgbe/base/t4vf_hw.c +1 -1
index d96456bbe..649bacfb2 100644
@@ -44,7 +44,7 @@ static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit,
 			 u32 mbox_addr)
 {
 	for ( ; nflit; nflit--, mbox_addr += 8)
-		*rpl++ = htobe64(t4_read_reg64(adap, mbox_addr));
+		*rpl++ = cpu_to_be64(t4_read_reg64(adap, mbox_addr));
 }
 
 /**
drivers/net/cxgbe/cxgbe_compat.h +28 -1
index ce4662d54..686ca6e0a 100644
@@ -18,6 +18,7 @@
 #include <rte_spinlock.h>
 #include <rte_log.h>
 #include <rte_io.h>
+#include <rte_net.h>
 
 #define dev_printf(level, fmt, ...) \
 	RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ##__VA_ARGS__)
@@ -149,18 +150,24 @@ typedef uint64_t  dma_addr_t;
 #define false	0
 #define true	1
 
+#ifndef min
 #define min(a, b) RTE_MIN(a, b)
+#endif
+
+#ifndef max
 #define max(a, b) RTE_MAX(a, b)
+#endif
 
 /*
  * round up val _p to a power of 2 size _s
  */
 #define cxgbe_roundup(_p, _s) (((unsigned long)(_p) + (_s - 1)) & ~(_s - 1))
 
-#undef container_of
+#ifndef container_of
 #define container_of(ptr, type, member) ({ \
 		typeof(((type *)0)->member)(*__mptr) = (ptr); \
 		(type *)((char *)__mptr - offsetof(type, member)); })
+#endif
 
 #define ARRAY_SIZE(arr) RTE_DIM(arr)
 
@@ -173,6 +180,26 @@ typedef uint64_t  dma_addr_t;
 #define be64_to_cpu(o) rte_be_to_cpu_64(o)
 #define le32_to_cpu(o) rte_le_to_cpu_32(o)
 
+#ifndef ntohs
+#define ntohs(o) be16_to_cpu(o)
+#endif
+
+#ifndef ntohl
+#define ntohl(o) be32_to_cpu(o)
+#endif
+
+#ifndef htons
+#define htons(o) cpu_to_be16(o)
+#endif
+
+#ifndef htonl
+#define htonl(o) cpu_to_be32(o)
+#endif
+
+#ifndef caddr_t
+typedef char *caddr_t;
+#endif
+
 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
 #define DELAY(x) rte_delay_us(x)
 #define udelay(x) DELAY(x)
Signature · 1 line
2.18.0
#4 lore raw

PATCH v2 4/4 net/cxgbe: fix other misc build issues for Windows

In reply to Rahul Lakkireddy

Fix following build errors reported by Intel C++ compiler in Windows build.

C:\> t4_hw.c(5105): warning #147: declaration is incompatible with "int t4_bar2_sge_qregs(struct adapter *, unsigned int, unsigned int, u64={uint64_t={unsigned __int64}} *, unsigned int *)" (declared at line 524 of "..\..\..\..\drivers\net\cxgbe\base\common.h")
int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid,
^

C:\> cxgbe_filter.c(42): error : expected an expression

        n_user_filters = mult_frac(adap->tids.nftids,
                         ^

C:\> sge.c(400): error : expression must be a pointer to a complete object type

                  (uint16_t)(RTE_PTR_ALIGN((char *)mbuf->buf_addr +
                             ^

Build Environment:
1. Target OS: Microsoft Windows Server 2016
2. Compiler: Intel C++ Compiler from Intel Parallel Studio XE 2019 [1]
3. Development Tools:
3.1 Microsoft Visual Studio 2017 Professional
3.2 Windows Software Development Kit (SDK) v10.0.17763 3.3 Windows Driver Kit (WDK) v10.0.17763

[1] https://software.intel.com/en-us/parallel-studio-xe

---
v2:
- Add more info in commit message regarding Windows build.

 drivers/net/cxgbe/base/common.h  |  2 +-
 drivers/net/cxgbe/cxgbe_compat.h | 14 +++++++-------
 drivers/net/cxgbe/sge.c          |  3 ++-
 3 files changed, 10 insertions(+), 9 deletions(-)
drivers/net/cxgbe/base/common.h +1 -1
index 84311fc95..973d4d7dd 100644
@@ -522,7 +522,7 @@ void t4_read_rss_key(struct adapter *adap, u32 *key);
 
 enum t4_bar2_qtype { T4_BAR2_QTYPE_EGRESS, T4_BAR2_QTYPE_INGRESS };
 int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid,
-		      unsigned int qtype, u64 *pbar2_qoffset,
+		      enum t4_bar2_qtype qtype, u64 *pbar2_qoffset,
 		      unsigned int *pbar2_qid);
 
 int t4_init_sge_params(struct adapter *adapter);
drivers/net/cxgbe/cxgbe_compat.h +7 -7
index 686ca6e0a..edc8ea57d 100644
@@ -276,12 +276,12 @@ static inline void writel_relaxed(unsigned int val, volatile void __iomem *addr)
  * Multiplies an integer by a fraction, while avoiding unnecessary
  * overflow or loss of precision.
  */
-#define mult_frac(x, numer, denom)(                     \
-{                                                       \
-	typeof(x) quot = (x) / (denom);                 \
-	typeof(x) rem  = (x) % (denom);                 \
-	(quot * (numer)) + ((rem * (numer)) / (denom)); \
-}                                                       \
-)
+static inline unsigned int mult_frac(unsigned int x, unsigned int numer,
+				     unsigned int denom)
+{
+	unsigned int quot = x / denom;
+	unsigned int rem = x % denom;
 
+	return (quot * numer) + ((rem * numer) / denom);
+}
 #endif /* _CXGBE_COMPAT_H_ */
drivers/net/cxgbe/sge.c +2 -1
index bf0afb138..673c4fbb3 100644
@@ -397,7 +397,8 @@ static unsigned int refill_fl_usembufs(struct adapter *adap, struct sge_fl *q,
 
 		rte_mbuf_refcnt_set(mbuf, 1);
 		mbuf->data_off =
-			(uint16_t)(RTE_PTR_ALIGN((char *)mbuf->buf_addr +
+			(uint16_t)((char *)
+				   RTE_PTR_ALIGN((char *)mbuf->buf_addr +
 						 RTE_PKTMBUF_HEADROOM,
 						 adap->sge.fl_align) -
 				   (char *)mbuf->buf_addr);
Signature · 1 line
2.18.0
#5 lore raw
In reply to Rahul Lakkireddy
Quoted 27 lines · Rahul Lakkireddy

This series of patches fix compilation warning and errors seen while building CXGBE PMD in preparation for Microsoft Windows OS support.

Patch 1 uses relative paths for including header files. Patch 2 fixes macros related to rte_log().
Patch 3 only redefines symbols when they are not available. Patch 4 fixes other misc build issues.

Patches are generated against dpdk-next-net tree.

Build Environment:
1. Target OS: Microsoft Windows Server 2016
2. Compiler: Intel C++ Compiler v19 from Intel Parallel Studio XE 2019 [1]
3. Development Tools:
3.1 Microsoft Visual Studio 2017 Professional
3.2 Windows Software Development Kit (SDK) v10.0.17763
3.3 Windows Driver Kit (WDK) v10.0.17763

[1] https://software.intel.com/en-us/parallel-studio-xe

Thanks,
Rahul

---
v2:
- Add more info in commit message regarding Windows build.

Quoted 5 lines

Rahul Lakkireddy (4):
net/cxgbe: use relative paths for including header files net/cxgbe: fix macros related to logs for Windows net/cxgbe: only define symbols when not available net/cxgbe: fix other misc build issues for Windows

Series applied to dpdk-next-net/master, thanks.

Beware none of the patches has fixes lines, so they won't be backported by default. If this wasn't the intention please provide fixes lines and I can update in tree.

#6 lore raw
Quoted 34 lines · Ferruh Yigit
Quoted 27 lines · Rahul Lakkireddy

This series of patches fix compilation warning and errors seen while building CXGBE PMD in preparation for Microsoft Windows OS support.

Patch 1 uses relative paths for including header files. Patch 2 fixes macros related to rte_log().
Patch 3 only redefines symbols when they are not available. Patch 4 fixes other misc build issues.

Patches are generated against dpdk-next-net tree.

Build Environment:
1. Target OS: Microsoft Windows Server 2016
2. Compiler: Intel C++ Compiler v19 from Intel Parallel Studio XE 2019 [1]
3. Development Tools:
3.1 Microsoft Visual Studio 2017 Professional
3.2 Windows Software Development Kit (SDK) v10.0.17763
3.3 Windows Driver Kit (WDK) v10.0.17763

[1] https://software.intel.com/en-us/parallel-studio-xe

Thanks,
Rahul

---
v2:
- Add more info in commit message regarding Windows build.

Quoted 5 lines

Rahul Lakkireddy (4):
net/cxgbe: use relative paths for including header files net/cxgbe: fix macros related to logs for Windows net/cxgbe: only define symbols when not available net/cxgbe: fix other misc build issues for Windows

Quoted 4 lines

Series applied to dpdk-next-net/master, thanks.

Beware none of the patches has fixes lines, so they won't be backported by default. If this wasn't the intention please provide fixes lines and I can update in tree.

Thanks Ferruh. I intentionally left out the fixes lines. Don't backport these patches.

Thanks,
Rahul