Skip to contentSkip to conversation

i40e: bug fix of compile error

PATCH Superseded Helin Zhang 4 participants 7 messages Dec 1, 2014 – Dec 3, 2014 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40e: bug fix of compile error

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]

---
 lib/librte_pmd_i40e/i40e_rxtx.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
lib/librte_pmd_i40e/i40e_rxtx.c +10 -8
index 2d2ef04..95666fd 100644
@@ -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
Signature · 1 line
1.9.3
#2 lore raw
In reply to a message not in the archive

2014-12-01 15:33, Helin Zhang:

Quoted 7 lines

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.

Quoted 3 lines
lib/librte_pmd_i40e/i40e_rxtx.c +2 -1
-			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);

[...]

lib/librte_pmd_i40e/i40e_rxtx.c i40e_rxd_build_fdir(volatile union i40e_rx_desc *rxdp, struct rte_mbuf *mb) · line 451

Quoted 3 lines
lib/librte_pmd_i40e/i40e_rxtx.c +2 -1
-			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.

Signature · 1 line
Thomas
#3 lore raw
Quoted 29 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, December 1, 2014 7:13 PM
To: Zhang, Helin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] i40e: bug fix of compile error

2014-12-01 15:33, Helin Zhang:

Quoted 1 line

The compile error will occur as below when set

'RTE_LIBRTE_I40E_16BYTE_RX_DESC=y'.

Quoted 9 lines

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.

Quoted 3 lines
lib/librte_pmd_i40e/i40e_rxtx.c +2 -1
-			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);

[...]

Quoted 6 lines

lib/librte_pmd_i40e/i40e_rxtx.c i40e_rxd_build_fdir(volatile union i40e_rx_desc *rxdp, struct rte_mbuf *mb) · line 451

Quoted 3 lines
lib/librte_pmd_i40e/i40e_rxtx.c +2 -1
-			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?

Quoted 3 lines

--
Thomas

Regards,
Helin

#4 lore raw
Quoted 27 lines · Helin
Quoted 27 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, December 1, 2014 7:13 PM
To: Zhang, Helin
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] i40e: bug fix of compile error

2014-12-01 15:33, Helin Zhang:

Quoted 1 line

The compile error will occur as below when set

'RTE_LIBRTE_I40E_16BYTE_RX_DESC=y'.

Quoted 9 lines

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.

Quoted 3 lines
(quoted diff) +2 -1
-			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);

[...]

Quoted 7 lines
Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +2 -1
-			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?

I think this coding style fix is not good enough,

		mb->hash.fdir.hi = rte_le_to_cpu_32(rxdp->wb.qword3
						    .hi_dword.fd_id);

This would be better :)

See the attached diff file, so sorry I indeed do not know how to add diff file in the email(except git send-email), So I just attached it.

Quoted 6 lines
Quoted 3 lines

--
Thomas

Regards,
Helin

lib/librte_pmd_i40e/i40e_rxtx.c +7 -8
index 2d2ef04..e0264fc 100644
@@ -427,8 +427,7 @@ i40e_rxd_build_fdir(volatile union i40e_rx_desc *rxdp, struct rte_mbuf *mb)
 	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);
+	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) >>
@@ -440,17 +439,17 @@ i40e_rxd_build_fdir(volatile union i40e_rx_desc *rxdp, struct rte_mbuf *mb)
 
 
 	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);
+		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);
+		mb->hash.fdir.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);
+		mb->hash.fdir.lo = rte_le_to_cpu_32(rxdp->wb.qword3
+						    .lo_dword.flex_bytes_lo);
 		flags |= PKT_RX_FDIR_FLX;
 	}
 #endif
#5 lore raw

PATCH v2 1/1 i40e: fix of compile error

In reply to a message not in the archive

The compile error will occur as below when set 'RTE_LIBRTE_I40E_16BYTE_RX_DESC=y'. 'fd_id' should be used to replace 'fd', as 'fd' is not defined in that structure at all. In addition, local variable of 'flexbl' and 'flexbh' must be used only if 32 bytes RX descriptor is selected.

error logs:
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]

---
 lib/librte_pmd_i40e/i40e_rxtx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

v2 changes:
* Removed the changes for code style fix, and kept it for compile error fix only.
* Re-word the commit logs.

lib/librte_pmd_i40e/i40e_rxtx.c +5 -5
index 2d2ef04..63c872d 100644
@@ -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;
@@ -453,6 +449,10 @@ i40e_rxd_build_fdir(volatile union i40e_rx_desc *rxdp, struct rte_mbuf *mb)
 			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;
 }
Signature · 1 line
1.9.3
Acked-by
#7 lore raw

Re: [PATCH v2] i40e: fix of compile error

In reply to a message not in the archive
Quoted 63 lines

-----Original Message-----
From: Zhang, Helin
Sent: Wednesday, December 03, 2014 9:13 AM
To: [email protected]
Cc: Cao, Waterman; Cao, Min; Wu, Jingjing; Zhang, Helin
Subject: [PATCH v2] i40e: fix of compile error

The compile error will occur as below when set 'RTE_LIBRTE_I40E_16BYTE_RX_DESC=y'.
'fd_id' should be used to replace 'fd', as 'fd' is not defined in that structure at all. In addition, local variable of 'flexbl' and 'flexbh' must be used only if 32 bytes RX descriptor is selected.

error logs:
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]

---
 lib/librte_pmd_i40e/i40e_rxtx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

v2 changes:
* Removed the changes for code style fix, and kept it for compile error fix only.
* Re-word the commit logs.

lib/librte_pmd_i40e/i40e_rxtx.c +5 -5
index 2d2ef04..63c872d 100644
@@ -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;
@@ -453,6 +449,10 @@ i40e_rxd_build_fdir(volatile union i40e_rx_desc
 *rxdp, struct rte_mbuf *mb)
 			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
Quoted 4 lines

return flags;
}
--
1.9.3

#9 lore raw

Re: [PATCH v2] i40e: fix of compile error

In reply to a message not in the archive
Quoted 15 lines
Quoted 15 lines

The compile error will occur as below when set 'RTE_LIBRTE_I40E_16BYTE_RX_DESC=y'.
'fd_id' should be used to replace 'fd', as 'fd' is not defined in that structure at all. In addition, local variable of 'flexbl' and 'flexbh' must be used only if 32 bytes RX descriptor is selected.

error logs:
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]

Quoted 3 lines
Quoted 1 line

Applied

Thanks

Signature · 1 line
Thomas