DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net: remove endianness annotations for L2TPv2 bitfields
@ 2021-10-25 12:31 David Marchand
  2021-10-28 10:14 ` [dpdk-dev] [PATCH v2] net: fix build with sparse on " David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2021-10-25 12:31 UTC (permalink / raw)
  To: dev
  Cc: Olivier Matz, Ferruh Yigit, Ori Kam, Jie Wang, Wenjun Wu,
	Andrew Rybchenko

Endianness is already handled by the checks on RTE_BYTE_ORDER.
Marking bitfields with endianness types is at best unneeded, at worse it
breaks build with OVS (with sparse enabled).

Example:
../../lib/ofp-packet.c: note: in included file (through
  .../ovs/dpdk-dir/build/include/rte_flow.h, ../../lib/netdev-dpdk.h,
  ../../lib/dp-packet.h):
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:92:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:93:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:94:40:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:95:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:96:40:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:97:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:98:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:99:40:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:100:39:
  error: invalid bitfield specifier for type restricted ovs_be16.
make[3]: *** [lib/ofp-packet.lo] Error 1

Fixes: 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/net/rte_l2tpv2.h | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index 670fe5470e..b90e36cf12 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -89,25 +89,25 @@ struct rte_l2tpv2_common_hdr {
 		__extension__
 		struct {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
-			rte_be16_t t:1;		/**< message Type */
-			rte_be16_t l:1;		/**< length option bit */
-			rte_be16_t res1:2;	/**< reserved */
-			rte_be16_t s:1;		/**< ns/nr option bit */
-			rte_be16_t res2:1;	/**< reserved */
-			rte_be16_t o:1;		/**< offset option bit */
-			rte_be16_t p:1;		/**< priority option bit */
-			rte_be16_t res3:4;	/**< reserved */
-			rte_be16_t ver:4;	/**< protocol version */
+			uint16_t t:1;		/**< message Type */
+			uint16_t l:1;		/**< length option bit */
+			uint16_t res1:2;	/**< reserved */
+			uint16_t s:1;		/**< ns/nr option bit */
+			uint16_t res2:1;	/**< reserved */
+			uint16_t o:1;		/**< offset option bit */
+			uint16_t p:1;		/**< priority option bit */
+			uint16_t res3:4;	/**< reserved */
+			uint16_t ver:4;		/**< protocol version */
 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
-			rte_be16_t ver:4;	/**< protocol version */
-			rte_be16_t res3:4;	/**< reserved */
-			rte_be16_t p:1;		/**< priority option bit */
-			rte_be16_t o:1;		/**< offset option bit */
-			rte_be16_t res2:1;	/**< reserved */
-			rte_be16_t s:1;		/**< ns/nr option bit */
-			rte_be16_t res1:2;	/**< reserved */
-			rte_be16_t l:1;		/**< length option bit */
-			rte_be16_t t:1;		/**< message Type */
+			uint16_t ver:4;		/**< protocol version */
+			uint16_t res3:4;	/**< reserved */
+			uint16_t p:1;		/**< priority option bit */
+			uint16_t o:1;		/**< offset option bit */
+			uint16_t res2:1;	/**< reserved */
+			uint16_t s:1;		/**< ns/nr option bit */
+			uint16_t res1:2;	/**< reserved */
+			uint16_t l:1;		/**< length option bit */
+			uint16_t t:1;		/**< message Type */
 #endif
 		};
 	};
-- 
2.23.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH v2] net: fix build with sparse on L2TPv2 bitfields
  2021-10-25 12:31 [dpdk-dev] [PATCH] net: remove endianness annotations for L2TPv2 bitfields David Marchand
@ 2021-10-28 10:14 ` David Marchand
  2021-10-28 18:44   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2021-10-28 10:14 UTC (permalink / raw)
  To: dev
  Cc: Olivier Matz, Ferruh Yigit, Ori Kam, Jie Wang, Wenjun Wu,
	Andrew Rybchenko

An external project that wants to do additional checks on fields
endianness can remap rte_beXX types to instrumented types and use
sparse.

The current code breaks OVS build with sparse:
../../lib/ofp-packet.c: note: in included file (through
  .../ovs/dpdk-dir/build/include/rte_flow.h, ../../lib/netdev-dpdk.h,
  ../../lib/dp-packet.h):
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:92:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:93:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:94:40:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:95:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:96:40:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:97:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:98:37:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:99:40:
  error: invalid bitfield specifier for type restricted ovs_be16.
.../ovs/dpdk-dir/build/include/rte_l2tpv2.h:100:39:
  error: invalid bitfield specifier for type restricted ovs_be16.
make[3]: *** [lib/ofp-packet.lo] Error 1

Use simple uint16_t types for bitfields in L2TPv2 struct.

Fixes: 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/net/rte_l2tpv2.h | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index 670fe5470e..b90e36cf12 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -89,25 +89,25 @@ struct rte_l2tpv2_common_hdr {
 		__extension__
 		struct {
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
-			rte_be16_t t:1;		/**< message Type */
-			rte_be16_t l:1;		/**< length option bit */
-			rte_be16_t res1:2;	/**< reserved */
-			rte_be16_t s:1;		/**< ns/nr option bit */
-			rte_be16_t res2:1;	/**< reserved */
-			rte_be16_t o:1;		/**< offset option bit */
-			rte_be16_t p:1;		/**< priority option bit */
-			rte_be16_t res3:4;	/**< reserved */
-			rte_be16_t ver:4;	/**< protocol version */
+			uint16_t t:1;		/**< message Type */
+			uint16_t l:1;		/**< length option bit */
+			uint16_t res1:2;	/**< reserved */
+			uint16_t s:1;		/**< ns/nr option bit */
+			uint16_t res2:1;	/**< reserved */
+			uint16_t o:1;		/**< offset option bit */
+			uint16_t p:1;		/**< priority option bit */
+			uint16_t res3:4;	/**< reserved */
+			uint16_t ver:4;		/**< protocol version */
 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
-			rte_be16_t ver:4;	/**< protocol version */
-			rte_be16_t res3:4;	/**< reserved */
-			rte_be16_t p:1;		/**< priority option bit */
-			rte_be16_t o:1;		/**< offset option bit */
-			rte_be16_t res2:1;	/**< reserved */
-			rte_be16_t s:1;		/**< ns/nr option bit */
-			rte_be16_t res1:2;	/**< reserved */
-			rte_be16_t l:1;		/**< length option bit */
-			rte_be16_t t:1;		/**< message Type */
+			uint16_t ver:4;		/**< protocol version */
+			uint16_t res3:4;	/**< reserved */
+			uint16_t p:1;		/**< priority option bit */
+			uint16_t o:1;		/**< offset option bit */
+			uint16_t res2:1;	/**< reserved */
+			uint16_t s:1;		/**< ns/nr option bit */
+			uint16_t res1:2;	/**< reserved */
+			uint16_t l:1;		/**< length option bit */
+			uint16_t t:1;		/**< message Type */
 #endif
 		};
 	};
-- 
2.23.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net: fix build with sparse on L2TPv2 bitfields
  2021-10-28 10:14 ` [dpdk-dev] [PATCH v2] net: fix build with sparse on " David Marchand
@ 2021-10-28 18:44   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2021-10-28 18:44 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Olivier Matz, Ori Kam, Jie Wang, Wenjun Wu, Andrew Rybchenko

On 10/28/2021 11:14 AM, David Marchand wrote:
> An external project that wants to do additional checks on fields
> endianness can remap rte_beXX types to instrumented types and use
> sparse.
> 
> The current code breaks OVS build with sparse:
> ../../lib/ofp-packet.c: note: in included file (through
>    .../ovs/dpdk-dir/build/include/rte_flow.h, ../../lib/netdev-dpdk.h,
>    ../../lib/dp-packet.h):
> .../ovs/dpdk-dir/build/include/rte_l2tpv2.h:92:37:
>    error: invalid bitfield specifier for type restricted ovs_be16.
> .../ovs/dpdk-dir/build/include/rte_l2tpv2.h:93:37:
>    error: invalid bitfield specifier for type restricted ovs_be16.
> .../ovs/dpdk-dir/build/include/rte_l2tpv2.h:94:40:
>    error: invalid bitfield specifier for type restricted ovs_be16.
> .../ovs/dpdk-dir/build/include/rte_l2tpv2.h:95:37:
>    error: invalid bitfield specifier for type restricted ovs_be16.
> .../ovs/dpdk-dir/build/include/rte_l2tpv2.h:96:40:
>    error: invalid bitfield specifier for type restricted ovs_be16.
> .../ovs/dpdk-dir/build/include/rte_l2tpv2.h:97:37:
>    error: invalid bitfield specifier for type restricted ovs_be16.
> .../ovs/dpdk-dir/build/include/rte_l2tpv2.h:98:37:
>    error: invalid bitfield specifier for type restricted ovs_be16.
> .../ovs/dpdk-dir/build/include/rte_l2tpv2.h:99:40:
>    error: invalid bitfield specifier for type restricted ovs_be16.
> .../ovs/dpdk-dir/build/include/rte_l2tpv2.h:100:39:
>    error: invalid bitfield specifier for type restricted ovs_be16.
> make[3]: *** [lib/ofp-packet.lo] Error 1
> 
> Use simple uint16_t types for bitfields in L2TPv2 struct.
> 
> Fixes: 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/main, thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-28 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 12:31 [dpdk-dev] [PATCH] net: remove endianness annotations for L2TPv2 bitfields David Marchand
2021-10-28 10:14 ` [dpdk-dev] [PATCH v2] net: fix build with sparse on " David Marchand
2021-10-28 18:44   ` Ferruh Yigit

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).