DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: satishr@chelsio.com, indranil@chelsio.com
Subject: [dpdk-dev] [PATCH 3/4] net/cxgbe: only redefine symbols when not available for Windows
Date: Thu, 13 Dec 2018 20:32:12 +0530	[thread overview]
Message-ID: <1544713333-32239-4-git-send-email-rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <1544713333-32239-1-git-send-email-rahul.lakkireddy@chelsio.com>

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(-)

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

  parent reply	other threads:[~2018-12-13 15:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 15:02 [dpdk-dev] [PATCH 0/4] net/cxgbe: fix build for Microsoft Windows OS support Rahul Lakkireddy
2018-12-13 15:02 ` [dpdk-dev] [PATCH 1/4] net/cxgbe: use relative paths for including header files Rahul Lakkireddy
2018-12-18 18:23   ` Ferruh Yigit
2018-12-19 12:42     ` Rahul Lakkireddy
2018-12-13 15:02 ` [dpdk-dev] [PATCH 2/4] net/cxgbe: fix macros related to logs for Windows Rahul Lakkireddy
2018-12-18 18:25   ` Ferruh Yigit
2018-12-19 12:39     ` Rahul Lakkireddy
2018-12-19 13:45       ` Ferruh Yigit
2018-12-19 14:11         ` Rahul Lakkireddy
2018-12-13 15:02 ` Rahul Lakkireddy [this message]
2018-12-18 18:26   ` [dpdk-dev] [PATCH 3/4] net/cxgbe: only redefine symbols when not available " Ferruh Yigit
2018-12-19 12:41     ` Rahul Lakkireddy
2018-12-13 15:02 ` [dpdk-dev] [PATCH 4/4] net/cxgbe: fix other misc build issues " Rahul Lakkireddy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1544713333-32239-4-git-send-email-rahul.lakkireddy@chelsio.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=dev@dpdk.org \
    --cc=indranil@chelsio.com \
    --cc=satishr@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).