Skip to contentSkip to conversation

net/ixgbe: fix issue for change definitions of bool

PATCH In review Wei Zhao 2 participants 6 messages Feb 27, 2020 – Mar 30, 2020 Network drivers

lore
Share & tools
lore

Wei Zhao

author
#0 lore raw

PATCH 1/1 net/ixgbe: fix issue for change definitions of bool

We had better not to change code in base folder, that patch will introduce a bug for etag/etag_strip for x550 NIC. So change back to the aboriginal definition.

Fixes ad43b7bce95b ("net/ixgbe: avoid multiple definitions of bool")
---
 drivers/net/ixgbe/base/ixgbe_osdep.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_osdep.h +4 -1
index 844d1701f..19ce2d1c8 100644
@@ -9,7 +9,6 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdarg.h>
-#include <stdbool.h>
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_cycles.h>
@@ -84,6 +83,10 @@ typedef uint32_t	u32;
 typedef int32_t		s32;
 typedef uint64_t	u64;
 
+#ifndef __cplusplus
+typedef int		bool;
+#endif
+
 #define mb()	rte_mb()
 #define wmb()	rte_wmb()
 #define rmb()	rte_rmb()
Signature · 1 line
2.17.1
#1 lore raw

Hi, Wei

Quoted 2 lines · Wei Zhao

We had better not to change code in base folder, that patch will introduce a bug for etag/etag_strip for x550 NIC. So change back

Could you elaborate the details of this bug?

Thanks,
Xiaolong

Quoted 36 lines

to the aboriginal definition.

Fixes ad43b7bce95b ("net/ixgbe: avoid multiple definitions of bool")

---
drivers/net/ixgbe/base/ixgbe_osdep.h | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_osdep.h +4 -1
index 844d1701f..19ce2d1c8 100644
@@ -9,7 +9,6 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdarg.h>
-#include <stdbool.h>
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_cycles.h>
@@ -84,6 +83,10 @@ typedef uint32_t	u32;
 typedef int32_t		s32;
 typedef uint64_t	u64;
 
+#ifndef __cplusplus
+typedef int		bool;
+#endif
+
 #define mb()	rte_mb()
 #define wmb()	rte_wmb()
 #define rmb()	rte_rmb()
Signature · 1 line
2.17.1
#2 lore raw
In reply to Wei Zhao

Hi,

Quoted 6 lines · Wei Zhao

We had better not to change code in base folder, that patch will introduce a bug for etag/etag_strip for x550 NIC. So change back to the aboriginal definition.

Fixes ad43b7bce95b ("net/ixgbe: avoid multiple definitions of bool")

I think this patch makes sense to remove local bool type to avoid possible multiple definitions of 'bool', could you try to investigate the root cause of the bug that this patch revealed?

Thanks,
Xiaolong

Quoted 32 lines

---
drivers/net/ixgbe/base/ixgbe_osdep.h | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_osdep.h +4 -1
index 844d1701f..19ce2d1c8 100644
@@ -9,7 +9,6 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdarg.h>
-#include <stdbool.h>
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_cycles.h>
@@ -84,6 +83,10 @@ typedef uint32_t	u32;
 typedef int32_t		s32;
 typedef uint64_t	u64;
 
+#ifndef __cplusplus
+typedef int		bool;
+#endif
+
 #define mb()	rte_mb()
 #define wmb()	rte_wmb()
 #define rmb()	rte_rmb()
Signature · 1 line
2.17.1
author
#3 lore raw

Ok,more info will be update to this patch

Quoted 57 lines

-----Original Message-----
From: Ye, Xiaolong <[email protected]>
Sent: Thursday, February 27, 2020 11:09 AM
To: Zhao1, Wei <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] net/ixgbe: fix issue for change definitions of bool

Hi,

Quoted 6 lines · Wei Zhao

We had better not to change code in base folder, that patch will introduce a bug for etag/etag_strip for x550 NIC. So change back to the aboriginal definition.

Fixes ad43b7bce95b ("net/ixgbe: avoid multiple definitions of bool")

I think this patch makes sense to remove local bool type to avoid possible multiple definitions of 'bool', could you try to investigate the root cause of the bug that this patch revealed?

Thanks,
Xiaolong

Quoted 33 lines

---
drivers/net/ixgbe/base/ixgbe_osdep.h | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_osdep.h +4 -2
index 844d1701f..19ce2d1c8 100644
@@ -9,7 +9,6 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdarg.h>
-#include <stdbool.h>
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_cycles.h>
@@ -84,6 +83,10 @@ typedef uint32_t	u32;
 typedef int32_t		s32;
 typedef uint64_t	u64;
 
+#ifndef __cplusplus
+typedef int		bool;
+#endif
+
 #define mb()	rte_mb()
 #define wmb()	rte_wmb()
 #define rmb()	rte_rmb()
--

2.17.1

author
#4 lore raw

PATCH v2 1/1 net/ixgbe: fix issue for e-tag defination

In reply to Wei Zhao

An issue has been caused after change definations of bool, we had better use uint16_t to define e-tag ethertype, not 8 bits length bool, that patch will change bool bits length, which introduce a bug for etag/etag_strip for x550 NIC. So change to the 16 bits defination.

Fixes ad43b7bce95b ("net/ixgbe: avoid multiple definitions of bool")

v2:
-add more info and find root cause for this issue

---
 drivers/net/ixgbe/ixgbe_ethdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.h +1 -1
index e1cd8fd16..c5d0e0912 100644
@@ -358,7 +358,7 @@ struct ixgbe_l2_tn_info {
 	struct rte_hash                    *hash_handle;
 	bool e_tag_en; /* e-tag enabled */
 	bool e_tag_fwd_en; /* e-tag based forwarding enabled */
-	bool e_tag_ether_type; /* ether type for e-tag */
+	uint16_t e_tag_ether_type; /* ether type for e-tag */
 };
 
 struct rte_flow {
Signature · 1 line
2.19.1
Acked-by on v2 1/1 Applied
#5 lore raw

Re: [dpdk-dev] [PATCH v2] net/ixgbe: fix issue for e-tag defination

Hi, Wei

Thanks for identifying the root cause.

Quoted 33 lines · Wei Zhao

An issue has been caused after change definations of bool, we had better use uint16_t to define e-tag ethertype, not 8 bits length bool, that patch will change bool bits length, which introduce a bug for etag/etag_strip for x550 NIC. So change to the 16 bits defination.

Fixes ad43b7bce95b ("net/ixgbe: avoid multiple definitions of bool")

v2:
-add more info and find root cause for this issue
---
drivers/net/ixgbe/ixgbe_ethdev.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.h +1 -1
index e1cd8fd16..c5d0e0912 100644
@@ -358,7 +358,7 @@ struct ixgbe_l2_tn_info {
 	struct rte_hash                    *hash_handle;
 	bool e_tag_en; /* e-tag enabled */
 	bool e_tag_fwd_en; /* e-tag based forwarding enabled */
-	bool e_tag_ether_type; /* ether type for e-tag */
+	uint16_t e_tag_ether_type; /* ether type for e-tag */
 };
 
 struct rte_flow {
Signature · 1 line
2.19.1

Applied to dpdk-next-net-intel, Thanks.