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 v2 4/4] net/cxgbe: fix other misc build issues for Windows
Date: Wed, 19 Dec 2018 21:58:26 +0530	[thread overview]
Message-ID: <6e330a2642fca7b356e361d3b913a7a55d6e6697.1545236474.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1545236474.git.rahul.lakkireddy@chelsio.com>
In-Reply-To: <cover.1545236474.git.rahul.lakkireddy@chelsio.com>

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

  parent reply	other threads:[~2018-12-19 16:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` [dpdk-dev] [PATCH v2 3/4] net/cxgbe: only define symbols when not available Rahul Lakkireddy
2018-12-19 16:28 ` Rahul Lakkireddy [this message]
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

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=6e330a2642fca7b356e361d3b913a7a55d6e6697.1545236474.git.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).