[3/4] net/cxgbe: only redefine symbols when not available for Windows
Checks
Commit Message
Redefine symbols only when they are not available for Windows
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
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(-)
Comments
On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote:
> Redefine symbols only when they are not available for Windows
>
Again "for Windows" is very vague, can you please add more context?
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
<...>
On Tuesday, December 12/18/18, 2018 at 23:56:22 +0530, Ferruh Yigit wrote:
> On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote:
> > Redefine symbols only when they are not available for Windows
> >
>
> Again "for Windows" is very vague, can you please add more context?
>
These patches are a pre-requisite to enable compilation for CXGBE PMD
for Windows OS. It currently uses Intel C++ compiler [1]. Our plan is
to integrate these compilation fixes to dpdk-next-net and then ask for
a pull request to pull these to dpdk-draft-windows tree [2].
[1] https://software.intel.com/en-us/parallel-studio-xe
[2] http://git.dpdk.org/draft/dpdk-draft-windows/
This patch fixes following issues in Windows build:
# cxgbe_compat.h(154): warning #47: incompatible redefinition of macro "min"
#define min(a, b) RTE_MIN(a, b)
^
# cxgbe_compat.h(158): warning #47: incompatible redefinition of macro "max"
#define max(a, b) RTE_MAX(a, b)
^
# t4_hw.c(249): warning #266: function "htobe64" declared implicitly
*rpl++ = htobe64(t4_read_reg64(adap, mbox_addr));
^
# t4_hw.c(338): warning #266: function "bzero" declared implicitly
bzero(p, 0, size);
^
# t4_hw.c(5337): warning #266: function "htonl" declared implicitly
rvc.op_to_viid = htonl(V_FW_CMD_OP(FW_RSS_VI_CONFIG_CMD) |
^
# t4_hw.c(5344): warning #266: function "ntohl" declared implicitly
p->rss_mode = ntohl(rvc.u.basicvirtual.defaultq_to_udpen);
^
# t4vf_hw.ct4vf_hw.c(47): warning #266: function "htobe64" declared implicitly
*rpl++ = htobe64(t4_read_reg64(adap, mbox_addr));
^
# sge.c(361): error : expected an expression
struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, fl);
^
# sge.c(465): warning #266: function "ntohs" declared implicitly
int hw_cidx = ntohs(q->stat->cidx);
^
# sge.c(1918): warning #266: function "htons" declared implicitly
htons(V_FW_IQ_CMD_IQPCIECH(pciechan) |
^
# sge.c(1350): error : identifier "caddr_t" is undefined
static void inline_tx_mbuf(const struct sge_txq *q, caddr_t from, caddr_t *to,
^
Thanks,
Rahul
@@ -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);
/*
@@ -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));
}
/**
@@ -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)