* [dpdk-dev] [PATCH v2 1/4] net/cxgbe: use relative paths for including header files
2018-12-19 16:28 [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support Rahul Lakkireddy
@ 2018-12-19 16:28 ` Rahul Lakkireddy
2018-12-19 16:28 ` [dpdk-dev] [PATCH v2 2/4] net/cxgbe: fix macros related to logs for Windows Rahul Lakkireddy
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Rahul Lakkireddy @ 2018-12-19 16:28 UTC (permalink / raw)
To: dev; +Cc: satishr, indranil
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
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
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(-)
diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile
index 68466f13e..d809f4720 100644
--- a/drivers/net/cxgbe/Makefile
+++ b/drivers/net/cxgbe/Makefile
@@ -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)
diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h
index 47cfc5f5f..17ce60d04 100644
--- a/drivers/net/cxgbe/base/adapter.h
+++ b/drivers/net/cxgbe/base/adapter.h
@@ -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 */
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index fd2006682..84311fc95 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -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"
diff --git a/drivers/net/cxgbe/clip_tbl.c b/drivers/net/cxgbe/clip_tbl.c
index 5e4dc5270..a0ab2a6ac 100644
--- a/drivers/net/cxgbe/clip_tbl.c
+++ b/drivers/net/cxgbe/clip_tbl.c
@@ -3,7 +3,7 @@
* All rights reserved.
*/
-#include "common.h"
+#include "base/common.h"
#include "clip_tbl.h"
/**
diff --git a/drivers/net/cxgbe/cxgbe.h b/drivers/net/cxgbe/cxgbe.h
index eb58f8802..5a7490f91 100644
--- a/drivers/net/cxgbe/cxgbe.h
+++ b/drivers/net/cxgbe/cxgbe.h
@@ -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 */
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index b2f83ea37..010a818eb 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -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)
diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c
index 3a7912e48..86a6158fd 100644
--- a/drivers/net/cxgbe/cxgbe_filter.c
+++ b/drivers/net/cxgbe/cxgbe_filter.c
@@ -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"
diff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h
index b7bcbf56a..2d6077718 100644
--- a/drivers/net/cxgbe/cxgbe_filter.h
+++ b/drivers/net/cxgbe/cxgbe_filter.h
@@ -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
*/
diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c
index 7b87bdf58..099499c2b 100644
--- a/drivers/net/cxgbe/cxgbe_flow.c
+++ b/drivers/net/cxgbe/cxgbe_flow.c
@@ -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) \
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index 5fa6cdd05..fd0707b95 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -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"
diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c
index a6458d533..0e93d99e6 100644
--- a/drivers/net/cxgbe/cxgbevf_ethdev.c
+++ b/drivers/net/cxgbe/cxgbevf_ethdev.c
@@ -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.
diff --git a/drivers/net/cxgbe/cxgbevf_main.c b/drivers/net/cxgbe/cxgbevf_main.c
index 61bd85193..f440b4345 100644
--- a/drivers/net/cxgbe/cxgbevf_main.c
+++ b/drivers/net/cxgbe/cxgbevf_main.c
@@ -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"
diff --git a/drivers/net/cxgbe/l2t.c b/drivers/net/cxgbe/l2t.c
index 814188fea..27cdf6f33 100644
--- a/drivers/net/cxgbe/l2t.c
+++ b/drivers/net/cxgbe/l2t.c
@@ -2,7 +2,8 @@
* Copyright(c) 2018 Chelsio Communications.
* All rights reserved.
*/
-#include "common.h"
+
+#include "base/common.h"
#include "l2t.h"
/**
diff --git a/drivers/net/cxgbe/l2t.h b/drivers/net/cxgbe/l2t.h
index 22a34e388..ee40dc1f6 100644
--- a/drivers/net/cxgbe/l2t.h
+++ b/drivers/net/cxgbe/l2t.h
@@ -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 */
diff --git a/drivers/net/cxgbe/mps_tcam.h b/drivers/net/cxgbe/mps_tcam.h
index c3d6fe0d7..f86bac7bd 100644
--- a/drivers/net/cxgbe/mps_tcam.h
+++ b/drivers/net/cxgbe/mps_tcam.h
@@ -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
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index f9d2d48a0..bf0afb138 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -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,
--
2.18.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2 2/4] net/cxgbe: fix macros related to logs for Windows
2018-12-19 16:28 [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support Rahul Lakkireddy
2018-12-19 16:28 ` [dpdk-dev] [PATCH v2 1/4] net/cxgbe: use relative paths for including header files Rahul Lakkireddy
@ 2018-12-19 16:28 ` Rahul Lakkireddy
2018-12-19 16:28 ` [dpdk-dev] [PATCH v2 3/4] net/cxgbe: only define symbols when not available Rahul Lakkireddy
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Rahul Lakkireddy @ 2018-12-19 16:28 UTC (permalink / raw)
To: dev; +Cc: satishr, indranil
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
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
v2:
- Add more info in commit message regarding Windows build.
drivers/net/cxgbe/cxgbe_compat.h | 40 ++++++++++++++++++--------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h
index 5d47c5f3d..ce4662d54 100644
--- a/drivers/net/cxgbe/cxgbe_compat.h
+++ b/drivers/net/cxgbe/cxgbe_compat.h
@@ -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 {\
--
2.18.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2 3/4] net/cxgbe: only define symbols when not available
2018-12-19 16:28 [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support Rahul Lakkireddy
2018-12-19 16:28 ` [dpdk-dev] [PATCH v2 1/4] net/cxgbe: use relative paths for including header files Rahul Lakkireddy
2018-12-19 16:28 ` [dpdk-dev] [PATCH v2 2/4] net/cxgbe: fix macros related to logs for Windows Rahul Lakkireddy
@ 2018-12-19 16:28 ` Rahul Lakkireddy
2018-12-19 16:28 ` [dpdk-dev] [PATCH v2 4/4] net/cxgbe: fix other misc build issues for Windows Rahul Lakkireddy
2018-12-19 21:39 ` [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support Ferruh Yigit
4 siblings, 0 replies; 7+ messages in thread
From: Rahul Lakkireddy @ 2018-12-19 16:28 UTC (permalink / raw)
To: dev; +Cc: satishr, indranil
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
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
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(-)
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 701e0b1fe..796e2f7f8 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -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);
/*
diff --git a/drivers/net/cxgbe/base/t4vf_hw.c b/drivers/net/cxgbe/base/t4vf_hw.c
index d96456bbe..649bacfb2 100644
--- a/drivers/net/cxgbe/base/t4vf_hw.c
+++ b/drivers/net/cxgbe/base/t4vf_hw.c
@@ -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));
}
/**
diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h
index ce4662d54..686ca6e0a 100644
--- a/drivers/net/cxgbe/cxgbe_compat.h
+++ b/drivers/net/cxgbe/cxgbe_compat.h
@@ -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)
--
2.18.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2 4/4] net/cxgbe: fix other misc build issues for Windows
2018-12-19 16:28 [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support Rahul Lakkireddy
` (2 preceding siblings ...)
2018-12-19 16:28 ` [dpdk-dev] [PATCH v2 3/4] net/cxgbe: only define symbols when not available Rahul Lakkireddy
@ 2018-12-19 16:28 ` Rahul Lakkireddy
2018-12-19 21:39 ` [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support Ferruh Yigit
4 siblings, 0 replies; 7+ messages in thread
From: Rahul Lakkireddy @ 2018-12-19 16:28 UTC (permalink / raw)
To: dev; +Cc: satishr, indranil
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
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
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(-)
diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 84311fc95..973d4d7dd 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -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);
diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h
index 686ca6e0a..edc8ea57d 100644
--- a/drivers/net/cxgbe/cxgbe_compat.h
+++ b/drivers/net/cxgbe/cxgbe_compat.h
@@ -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_ */
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index bf0afb138..673c4fbb3 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -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);
--
2.18.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support
2018-12-19 16:28 [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support Rahul Lakkireddy
` (3 preceding siblings ...)
2018-12-19 16:28 ` [dpdk-dev] [PATCH v2 4/4] net/cxgbe: fix other misc build issues for Windows Rahul Lakkireddy
@ 2018-12-19 21:39 ` Ferruh Yigit
2018-12-20 3:54 ` Rahul Lakkireddy
4 siblings, 1 reply; 7+ messages in thread
From: Ferruh Yigit @ 2018-12-19 21:39 UTC (permalink / raw)
To: Rahul Lakkireddy, dev; +Cc: satishr, indranil
On 12/19/2018 4:28 PM, Rahul Lakkireddy wrote:
> 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
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support
2018-12-19 21:39 ` [dpdk-dev] [PATCH v2 0/4] net/cxgbe: fix build for Microsoft Windows OS support Ferruh Yigit
@ 2018-12-20 3:54 ` Rahul Lakkireddy
0 siblings, 0 replies; 7+ messages in thread
From: Rahul Lakkireddy @ 2018-12-20 3:54 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev, Satish Rangarajan, Indranil Choudhury
On Thursday, December 12/20/18, 2018 at 03:09:44 +0530, Ferruh Yigit wrote:
> On 12/19/2018 4:28 PM, Rahul Lakkireddy wrote:
> > 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
>
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread