DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net: add bit fields to IPv6 header definition
@ 2024-06-18  5:17 Gregory Etelson
  2024-06-18  6:42 ` Morten Brørup
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Gregory Etelson @ 2024-06-18  5:17 UTC (permalink / raw)
  To: dev
  Cc: getelson,  ,
	bruce.richardson, jasvinder.singh, konstantin.v.ananyev,
	ruifeng.wang, andrew.rybchenko, cristian.dumitrescu,
	ferruh.yigit, orika, thomas

DPDK IPv6 header definition combined the `version`, `traffic class`
and `flow label` header fields into a single 32 bits structure member
`vtc_flow`.

The patch expands IPv6 header definition with dedicated structure
members for the `version`, `traffic class` and `flow label` fields.
The patch also preserves existing `vtc_flow` structure member for
backward compatibility.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 lib/net/rte_ip.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 0d103d4127..26e78a6624 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -524,7 +524,21 @@ rte_ipv4_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m,
  * IPv6 Header
  */
 struct rte_ipv6_hdr {
-	rte_be32_t vtc_flow;	/**< IP version, traffic class & flow label. */
+	__extension__
+	union {
+		rte_be32_t vtc_flow;        /**< IP version, traffic class & flow label. */
+		struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+			uint32_t flow_label:24; /**< flow label */
+			uint32_t tc:4;     /**< traffic class */
+			uint32_t version:4; /**< version */
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+			uint8_t version:4; /**< version */
+			uint8_t tc:4;     /**< traffic class */
+			uint32_t flow_label:24; /**< flow label */
+#endif
+		};
+	};
 	rte_be16_t payload_len;	/**< IP payload size, including ext. headers */
 	uint8_t  proto;		/**< Protocol, next header. */
 	uint8_t  hop_limits;	/**< Hop limits. */
-- 
2.43.0


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

end of thread, other threads:[~2024-06-19  4:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-18  5:17 [PATCH] net: add bit fields to IPv6 header definition Gregory Etelson
2024-06-18  6:42 ` Morten Brørup
2024-06-18  7:02   ` Morten Brørup
2024-06-18  8:07     ` Etelson, Gregory
2024-06-19  0:11   ` Tyler Retzlaff
2024-06-19  4:31     ` Etelson, Gregory
2024-06-18  7:58 ` [PATCH v2] " Gregory Etelson
2024-06-18  8:11   ` Morten Brørup
2024-06-18  9:51 ` [PATCH v3] " Gregory Etelson
2024-06-18 10:47   ` Morten Brørup
2024-06-18 12:18 ` [PATCH v4] " Gregory Etelson
2024-06-18 12:44   ` Morten Brørup

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