net/cxgbe: fix other misc build issues for Windows
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Wed, 19 Dec 2018 16:28:26 +0000 (21:58 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 21 Dec 2018 15:22:41 +0000 (16:22 +0100)
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>
drivers/net/cxgbe/base/common.h
drivers/net/cxgbe/cxgbe_compat.h
drivers/net/cxgbe/sge.c

index 84311fc..973d4d7 100644 (file)
@@ -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);
index 686ca6e..edc8ea5 100644 (file)
@@ -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_ */
index bf0afb1..673c4fb 100644 (file)
@@ -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);