[dpdk-dev] i40e: bug fix of compile error

Message ID 1417419227-21465-1-git-send-email-helin.zhang@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Zhang, Helin Dec. 1, 2014, 7:33 a.m. UTC
  The compile error will occur as below when set 'RTE_LIBRTE_I40E_16BYTE_RX_DESC=y'.
The changes is just to fix it.

lib/librte_pmd_i40e/i40e_rxtx.c: In function i40e_rxd_build_fdir:
lib/librte_pmd_i40e/i40e_rxtx.c:431:28: error: volatile union <anonymous> has no member named fd
lib/librte_pmd_i40e/i40e_rxtx.c:427:19: error: unused variable flexbl [-Werror=unused-variable]
lib/librte_pmd_i40e/i40e_rxtx.c:427:11: error: unused variable flexbh [-Werror=unused-variable]

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 lib/librte_pmd_i40e/i40e_rxtx.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
  

Comments

Thomas Monjalon Dec. 1, 2014, 11:12 a.m. UTC | #1
2014-12-01 15:33, Helin Zhang:
> The compile error will occur as below when set 'RTE_LIBRTE_I40E_16BYTE_RX_DESC=y'.
> The changes is just to fix it.
> 
> lib/librte_pmd_i40e/i40e_rxtx.c: In function i40e_rxd_build_fdir:
> lib/librte_pmd_i40e/i40e_rxtx.c:431:28: error: volatile union <anonymous> has no member named fd
> lib/librte_pmd_i40e/i40e_rxtx.c:427:19: error: unused variable flexbl [-Werror=unused-variable]
> lib/librte_pmd_i40e/i40e_rxtx.c:427:11: error: unused variable flexbh [-Werror=unused-variable]

It would be nice to reference the commit which introduced the error
and explain it a bit.

> -			rte_le_to_cpu_32(rxdp->wb.qword3.hi_dword.flex_bytes_hi);
> +			rte_le_to_cpu_32(
> +			rxdp->wb.qword3.hi_dword.flex_bytes_hi);
[...]
> -			rte_le_to_cpu_32(rxdp->wb.qword3.lo_dword.flex_bytes_lo);
> +			rte_le_to_cpu_32(
> +			rxdp->wb.qword3.lo_dword.flex_bytes_lo);

Why are you wrapping these lines (with wrong indentation)?
It makes the fix confuse.
  
Zhang, Helin Dec. 2, 2014, 12:35 a.m. UTC | #2
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Monday, December 1, 2014 7:13 PM
> To: Zhang, Helin
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] i40e: bug fix of compile error
> 
> 2014-12-01 15:33, Helin Zhang:
> > The compile error will occur as below when set
> 'RTE_LIBRTE_I40E_16BYTE_RX_DESC=y'.
> > The changes is just to fix it.
> >
> > lib/librte_pmd_i40e/i40e_rxtx.c: In function i40e_rxd_build_fdir:
> > lib/librte_pmd_i40e/i40e_rxtx.c:431:28: error: volatile union
> > <anonymous> has no member named fd
> > lib/librte_pmd_i40e/i40e_rxtx.c:427:19: error: unused variable flexbl
> > [-Werror=unused-variable]
> > lib/librte_pmd_i40e/i40e_rxtx.c:427:11: error: unused variable flexbh
> > [-Werror=unused-variable]
> 
> It would be nice to reference the commit which introduced the error and explain
> it a bit.
> 
> > -			rte_le_to_cpu_32(rxdp->wb.qword3.hi_dword.flex_bytes_hi);
> > +			rte_le_to_cpu_32(
> > +			rxdp->wb.qword3.hi_dword.flex_bytes_hi);
> [...]
> > -			rte_le_to_cpu_32(rxdp->wb.qword3.lo_dword.flex_bytes_lo);
> > +			rte_le_to_cpu_32(
> > +			rxdp->wb.qword3.lo_dword.flex_bytes_lo);
> 
> Why are you wrapping these lines (with wrong indentation)?
> It makes the fix confuse.
Sorry, it is a code style fix, as the length of the line should not be more than 80.
Do I need to split the patch or add more commit logs?

> 
> --
> Thomas

Regards,
Helin
  

Patch

diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
index 2d2ef04..95666fd 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -424,13 +424,9 @@  static inline uint64_t
 i40e_rxd_build_fdir(volatile union i40e_rx_desc *rxdp, struct rte_mbuf *mb)
 {
 	uint64_t flags = 0;
+#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
 	uint16_t flexbh, flexbl;
 
-#ifdef RTE_LIBRTE_I40E_16BYTE_RX_DESC
-	mb->hash.fdir.hi =
-		rte_le_to_cpu_32(rxdp->wb.qword0.hi_dword.fd);
-	flags |= PKT_RX_FDIR_ID;
-#else
 	flexbh = (rte_le_to_cpu_32(rxdp->wb.qword2.ext_status) >>
 		I40E_RX_DESC_EXT_STATUS_FLEXBH_SHIFT) &
 		I40E_RX_DESC_EXT_STATUS_FLEXBH_MASK;
@@ -438,22 +434,28 @@  i40e_rxd_build_fdir(volatile union i40e_rx_desc *rxdp, struct rte_mbuf *mb)
 		I40E_RX_DESC_EXT_STATUS_FLEXBL_SHIFT) &
 		I40E_RX_DESC_EXT_STATUS_FLEXBL_MASK;
 
-
 	if (flexbh == I40E_RX_DESC_EXT_STATUS_FLEXBH_FD_ID) {
 		mb->hash.fdir.hi =
 			rte_le_to_cpu_32(rxdp->wb.qword3.hi_dword.fd_id);
 		flags |= PKT_RX_FDIR_ID;
 	} else if (flexbh == I40E_RX_DESC_EXT_STATUS_FLEXBH_FLEX) {
 		mb->hash.fdir.hi =
-			rte_le_to_cpu_32(rxdp->wb.qword3.hi_dword.flex_bytes_hi);
+			rte_le_to_cpu_32(
+			rxdp->wb.qword3.hi_dword.flex_bytes_hi);
 		flags |= PKT_RX_FDIR_FLX;
 	}
+
 	if (flexbl == I40E_RX_DESC_EXT_STATUS_FLEXBL_FLEX) {
 		mb->hash.fdir.lo =
-			rte_le_to_cpu_32(rxdp->wb.qword3.lo_dword.flex_bytes_lo);
+			rte_le_to_cpu_32(
+			rxdp->wb.qword3.lo_dword.flex_bytes_lo);
 		flags |= PKT_RX_FDIR_FLX;
 	}
+#else
+	mb->hash.fdir.hi = rte_le_to_cpu_32(rxdp->wb.qword0.hi_dword.fd_id);
+	flags |= PKT_RX_FDIR_ID;
 #endif
+
 	return flags;
 }
 static inline void