DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Olivier Matz <olivier.matz@6wind.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>, Ori Kam <orika@nvidia.com>,
	Jie Wang <jie1x.wang@intel.com>, Wenjun Wu <wenjun1.wu@intel.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH v2] net: fix build with sparse on L2TPv2 bitfields
Date: Thu, 28 Oct 2021 12:14:28 +0200	[thread overview]
Message-ID: <20211028101428.15007-1-david.marchand@redhat.com> (raw)
In-Reply-To: <20211025123107.1600-1-david.marchand@redhat.com>

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


  reply	other threads:[~2021-10-28 10:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 12:31 [dpdk-dev] [PATCH] net: remove endianness annotations for " David Marchand
2021-10-28 10:14 ` David Marchand [this message]
2021-10-28 18:44   ` [dpdk-dev] [PATCH v2] net: fix build with sparse on " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211028101428.15007-1-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jie1x.wang@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=orika@nvidia.com \
    --cc=wenjun1.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).