* [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; 13+ 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] 13+ messages in thread
* RE: [PATCH] net: add bit fields to IPv6 header definition
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-19 0:11 ` Tyler Retzlaff
2024-06-18 7:58 ` [PATCH v2] " Gregory Etelson
` (2 subsequent siblings)
3 siblings, 2 replies; 13+ messages in thread
From: Morten Brørup @ 2024-06-18 6:42 UTC (permalink / raw)
To: Gregory Etelson, dev
Cc: mkashani, bruce.richardson, jasvinder.singh,
konstantin.v.ananyev, ruifeng.wang, andrew.rybchenko,
cristian.dumitrescu, ferruh.yigit, orika, thomas
> From: Gregory Etelson [mailto:getelson@nvidia.com]
> Sent: Tuesday, 18 June 2024 07.18
>
> 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.
Good addition.
I had been wondering why we didn't have this already. :-)
>
> 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. */
The mbuf structure [1] has __extension__ here,
i.e. preceding the structure following the integer field,
instead of preceding the union.
[1]: https://git.dpdk.org/dpdk/tree/lib/mbuf/rte_mbuf_core.h#n520
> + struct {
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> + uint32_t flow_label:24; /**< flow label */
Flow Label is 20 bits, not 24.
> + uint32_t tc:4; /**< traffic class */
TC is 8 bits, not 4.
> + uint32_t version:4; /**< version */
> +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> + uint8_t version:4; /**< version */
> + uint8_t tc:4; /**< traffic class */
:8, not :4.
> + uint32_t flow_label:24; /**< flow label */
:20, not :24.
> +#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] 13+ messages in thread
* RE: [PATCH] net: add bit fields to IPv6 header definition
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
1 sibling, 1 reply; 13+ messages in thread
From: Morten Brørup @ 2024-06-18 7:02 UTC (permalink / raw)
To: Gregory Etelson, dev
Cc: mkashani, bruce.richardson, jasvinder.singh,
konstantin.v.ananyev, ruifeng.wang, andrew.rybchenko,
cristian.dumitrescu, ferruh.yigit, orika, thomas
> From: Morten Brørup [mailto:mb@smartsharesystems.com]
>
> > From: Gregory Etelson [mailto:getelson@nvidia.com]
> > Sent: Tuesday, 18 June 2024 07.18
> >
> > 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.
>
> Good addition.
> I had been wondering why we didn't have this already. :-)
>
> >
> > 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. */
>
> The mbuf structure [1] has __extension__ here,
> i.e. preceding the structure following the integer field,
> instead of preceding the union.
>
> [1]: https://git.dpdk.org/dpdk/tree/lib/mbuf/rte_mbuf_core.h#n520
>
> > + struct {
> > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> > + uint32_t flow_label:24; /**< flow label */
>
> Flow Label is 20 bits, not 24.
I forgot to mention that the flow_label field should be rte_be32_t instead of uint32_t.
>
> > + uint32_t tc:4; /**< traffic class */
>
> TC is 8 bits, not 4.
While you are at it, please also expand the "tc" field to another union with dedicated fields for "dscp:6" and "ecn:2", keeping the combined "tc" field too. The same goes for the IPv4 "type_of_service" field. This expansion could go into a separate patch, possibly in the same series.
>
> > + uint32_t version:4; /**< version */
> > +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> > + uint8_t version:4; /**< version */
> > + uint8_t tc:4; /**< traffic class */
>
> :8, not :4.
>
> > + uint32_t flow_label:24; /**< flow label */
>
> :20, not :24.
>
> > +#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] 13+ messages in thread
* [PATCH v2] net: add bit fields to IPv6 header definition
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:58 ` Gregory Etelson
2024-06-18 8:11 ` Morten Brørup
2024-06-18 9:51 ` [PATCH v3] " Gregory Etelson
2024-06-18 12:18 ` [PATCH v4] " Gregory Etelson
3 siblings, 1 reply; 13+ messages in thread
From: Gregory Etelson @ 2024-06-18 7:58 UTC (permalink / raw)
To: dev
Cc: getelson, andrew.rybchenko, bruce.richardson,
cristian.dumitrescu, ferruh.yigit, jasvinder.singh,
konstantin.v.ananyev, mkashani, orika, ruifeng.wang, thomas, mb
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 `traffic class` is also separated into DS and ECN fields.
The patch also preserves existing `vtc_flow` structure member for
backward compatibility.
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
v2:
Replace uint32_t with rte_be32_t.
Split traffic_class into DS and ECN bits.
---
lib/net/rte_ip.h | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 0d103d4127..fe1d596054 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -524,7 +524,23 @@ 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. */
+ union {
+ rte_be32_t vtc_flow; /**< IP version, traffic class & flow label. */
+ __extension__
+ struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+ rte_be32_t flow_label:20; /**< flow label */
+ rte_be32_t ecn:2; /**< ECN */
+ rte_be32_t ds:6; /**< differentiated services */
+ rte_be32_t version:4; /**< version */
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+ rte_be32_t version:4; /**< version */
+ rte_be32_t ds:6; /**< differentiated services */
+ rte_be32_t ecn:2; /**< ECN */
+ rte_be32_t flow_label:20; /**< 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] 13+ messages in thread
* RE: [PATCH] net: add bit fields to IPv6 header definition
2024-06-18 7:02 ` Morten Brørup
@ 2024-06-18 8:07 ` Etelson, Gregory
0 siblings, 0 replies; 13+ messages in thread
From: Etelson, Gregory @ 2024-06-18 8:07 UTC (permalink / raw)
To: Morten Brørup
Cc: dev, mkashani, bruce.richardson, jasvinder.singh,
konstantin.v.ananyev, ruifeng.wang, andrew.rybchenko,
cristian.dumitrescu, ferruh.yigit, orika, thomas
Hello,
I've posted v2 patch with fixes.
Regards,
Gregory
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v2] net: add bit fields to IPv6 header definition
2024-06-18 7:58 ` [PATCH v2] " Gregory Etelson
@ 2024-06-18 8:11 ` Morten Brørup
0 siblings, 0 replies; 13+ messages in thread
From: Morten Brørup @ 2024-06-18 8:11 UTC (permalink / raw)
To: Gregory Etelson, dev
Cc: andrew.rybchenko, bruce.richardson, cristian.dumitrescu,
ferruh.yigit, jasvinder.singh, konstantin.v.ananyev, mkashani,
orika, ruifeng.wang, thomas
> From: Gregory Etelson [mailto:getelson@nvidia.com]
> Sent: Tuesday, 18 June 2024 09.58
>
> 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 `traffic class` is also separated into DS and ECN fields.
>
> The patch also preserves existing `vtc_flow` structure member for
> backward compatibility.
>
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> ---
> v2:
> Replace uint32_t with rte_be32_t.
> Split traffic_class into DS and ECN bits.
> ---
> lib/net/rte_ip.h | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
> index 0d103d4127..fe1d596054 100644
> --- a/lib/net/rte_ip.h
> +++ b/lib/net/rte_ip.h
> @@ -524,7 +524,23 @@ 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.
> */
> + union {
> + rte_be32_t vtc_flow; /**< IP version, traffic class & flow
> label. */
> + __extension__
> + struct {
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> + rte_be32_t flow_label:20; /**< flow label */
I don't know if sub-unions of bitfields are possible and/or require special magic for packing the bits.
If possible, expanding the 8 bit "tc" field like this would be nice:
+ union {
+ rte_be32_t tc:8;
+ __extension__
+ struct {
> + rte_be32_t ecn:2; /**< ECN */
> + rte_be32_t ds:6; /**< differentiated services */
+ };
+ };
> + rte_be32_t version:4; /**< version */
> +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> + rte_be32_t version:4; /**< version */
> + rte_be32_t ds:6; /**< differentiated services */
> + rte_be32_t ecn:2; /**< ECN */
> + rte_be32_t flow_label:20; /**< 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
Without the suggested addition,
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
With the suggested addition,
Acked-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3] net: add bit fields to IPv6 header definition
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:58 ` [PATCH v2] " Gregory Etelson
@ 2024-06-18 9:51 ` Gregory Etelson
2024-06-18 10:47 ` Morten Brørup
2024-06-18 12:18 ` [PATCH v4] " Gregory Etelson
3 siblings, 1 reply; 13+ messages in thread
From: Gregory Etelson @ 2024-06-18 9:51 UTC (permalink / raw)
To: dev
Cc: getelson, andrew.rybchenko, bruce.richardson,
cristian.dumitrescu, ferruh.yigit, jasvinder.singh,
konstantin.v.ananyev, mkashani, orika, ruifeng.wang, thomas, mb
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 `traffic class` is also separated into DS and ECN fields.
The patch also preserves existing `vtc_flow` structure member for
backward compatibility.
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
v2:
Replace uint32_t with rte_be32_t.
Split traffic_class into DS and ECN bits.
v3:
Define both traffic_class and DS + ECN fields.
---
lib/net/rte_ip.h | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 0d103d4127..3adfcbc431 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -524,7 +524,33 @@ 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. */
+ union {
+ rte_be32_t vtc_flow; /**< IP version, traffic class & flow label. */
+ __extension__
+ struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+ rte_be32_t flow_label:20; /**< flow label */
+ union {
+ rte_be32_t tc:8;
+ struct {
+ rte_be32_t ecn:2; /**< ECN */
+ rte_be32_t ds:6; /**< differentiated services */
+ };
+ };
+ rte_be32_t version:4; /**< version */
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+ rte_be32_t version:4; /**< version */
+ union {
+ rte_be32_t tc:8;
+ struct {
+ rte_be32_t ds:6; /**< differentiated services */
+ rte_be32_t ecn:2; /**< ECN */
+ };
+ };
+ rte_be32_t flow_label:20; /**< 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] 13+ messages in thread
* RE: [PATCH v3] net: add bit fields to IPv6 header definition
2024-06-18 9:51 ` [PATCH v3] " Gregory Etelson
@ 2024-06-18 10:47 ` Morten Brørup
0 siblings, 0 replies; 13+ messages in thread
From: Morten Brørup @ 2024-06-18 10:47 UTC (permalink / raw)
To: Gregory Etelson, dev
Cc: andrew.rybchenko, bruce.richardson, cristian.dumitrescu,
ferruh.yigit, jasvinder.singh, konstantin.v.ananyev, mkashani,
orika, ruifeng.wang, thomas
> struct rte_ipv6_hdr {
> - rte_be32_t vtc_flow; /**< IP version, traffic class & flow label.
> */
> + union {
> + rte_be32_t vtc_flow; /**< IP version, traffic class & flow
> label. */
> + __extension__
> + struct {
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> + rte_be32_t flow_label:20; /**< flow label */
I played around with this in Godbolt, and __attribute__((__packed__)) only packs bytes, not bits, so the packed structure grows from 4 to 5 bytes, because the compiler adds 4 bits of padding here, to byte align the union holding "tc".
Please revert to v2.
Sorry about the noise. ;-)
> + union {
> + rte_be32_t tc:8;
> + struct {
> + rte_be32_t ecn:2; /**< ECN */
> + rte_be32_t ds:6; /**< differentiated
> services */
> + };
> + };
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4] net: add bit fields to IPv6 header definition
2024-06-18 5:17 [PATCH] net: add bit fields to IPv6 header definition Gregory Etelson
` (2 preceding siblings ...)
2024-06-18 9:51 ` [PATCH v3] " Gregory Etelson
@ 2024-06-18 12:18 ` Gregory Etelson
2024-06-18 12:44 ` Morten Brørup
3 siblings, 1 reply; 13+ messages in thread
From: Gregory Etelson @ 2024-06-18 12:18 UTC (permalink / raw)
To: dev
Cc: getelson, andrew.rybchenko, bruce.richardson,
cristian.dumitrescu, ferruh.yigit, jasvinder.singh,
konstantin.v.ananyev, mkashani, orika, ruifeng.wang, thomas, mb
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 `traffic class` is also separated into DS and ECN fields.
The patch also preserves existing `vtc_flow` structure member for
backward compatibility.
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
v2:
Replace uint32_t with rte_be32_t.
Split traffic_class into DS and ECN bits.
v3:
Define both traffic_class and DS + ECN fields.
v4:
The `packed` attribute works on bytes only.
Back to v2.
---
lib/net/rte_ip.h | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h
index 0d103d4127..fe1d596054 100644
--- a/lib/net/rte_ip.h
+++ b/lib/net/rte_ip.h
@@ -524,7 +524,23 @@ 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. */
+ union {
+ rte_be32_t vtc_flow; /**< IP version, traffic class & flow label. */
+ __extension__
+ struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+ rte_be32_t flow_label:20; /**< flow label */
+ rte_be32_t ecn:2; /**< ECN */
+ rte_be32_t ds:6; /**< differentiated services */
+ rte_be32_t version:4; /**< version */
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+ rte_be32_t version:4; /**< version */
+ rte_be32_t ds:6; /**< differentiated services */
+ rte_be32_t ecn:2; /**< ECN */
+ rte_be32_t flow_label:20; /**< 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] 13+ messages in thread
* RE: [PATCH v4] net: add bit fields to IPv6 header definition
2024-06-18 12:18 ` [PATCH v4] " Gregory Etelson
@ 2024-06-18 12:44 ` Morten Brørup
2024-10-18 16:47 ` David Marchand
0 siblings, 1 reply; 13+ messages in thread
From: Morten Brørup @ 2024-06-18 12:44 UTC (permalink / raw)
To: Gregory Etelson, dev
Cc: andrew.rybchenko, bruce.richardson, cristian.dumitrescu,
ferruh.yigit, jasvinder.singh, konstantin.v.ananyev, mkashani,
orika, ruifeng.wang, thomas
> From: Gregory Etelson [mailto:getelson@nvidia.com]
>
> 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 `traffic class` is also separated into DS and ECN fields.
>
> The patch also preserves existing `vtc_flow` structure member for
> backward compatibility.
>
> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> ---
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] net: add bit fields to IPv6 header definition
2024-06-18 6:42 ` Morten Brørup
2024-06-18 7:02 ` Morten Brørup
@ 2024-06-19 0:11 ` Tyler Retzlaff
2024-06-19 4:31 ` Etelson, Gregory
1 sibling, 1 reply; 13+ messages in thread
From: Tyler Retzlaff @ 2024-06-19 0:11 UTC (permalink / raw)
To: Morten Brørup
Cc: Gregory Etelson, dev, mkashani, bruce.richardson,
jasvinder.singh, konstantin.v.ananyev, ruifeng.wang,
andrew.rybchenko, cristian.dumitrescu, ferruh.yigit, orika,
thomas
On Tue, Jun 18, 2024 at 08:42:53AM +0200, Morten Brørup wrote:
> > From: Gregory Etelson [mailto:getelson@nvidia.com]
> > Sent: Tuesday, 18 June 2024 07.18
> >
> > 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.
>
> Good addition.
> I had been wondering why we didn't have this already. :-)
>
> >
> > 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. */
>
> The mbuf structure [1] has __extension__ here,
> i.e. preceding the structure following the integer field,
> instead of preceding the union.
>
> [1]: https://git.dpdk.org/dpdk/tree/lib/mbuf/rte_mbuf_core.h#n520
+1 anonymous unions are standard C so __extension__ is not necessary, it
is necessary for an anonymous struct.
>
> > + struct {
> > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> > + uint32_t flow_label:24; /**< flow label */
>
> Flow Label is 20 bits, not 24.
>
> > + uint32_t tc:4; /**< traffic class */
>
> TC is 8 bits, not 4.
>
> > + uint32_t version:4; /**< version */
> > +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> > + uint8_t version:4; /**< version */
> > + uint8_t tc:4; /**< traffic class */
>
> :8, not :4.
>
> > + uint32_t flow_label:24; /**< flow label */
>
> :20, not :24.
>
> > +#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] 13+ messages in thread
* Re: [PATCH] net: add bit fields to IPv6 header definition
2024-06-19 0:11 ` Tyler Retzlaff
@ 2024-06-19 4:31 ` Etelson, Gregory
0 siblings, 0 replies; 13+ messages in thread
From: Etelson, Gregory @ 2024-06-19 4:31 UTC (permalink / raw)
To: Tyler Retzlaff
Cc: Morten Brørup, dev, mkashani, bruce.richardson,
jasvinder.singh, konstantin.v.ananyev, ruifeng.wang,
andrew.rybchenko, cristian.dumitrescu, ferruh.yigit, orika,
thomas
Hello,
>> The mbuf structure [1] has __extension__ here,
>> i.e. preceding the structure following the integer field,
>> instead of preceding the union.
>>
>> [1]: https://git.dpdk.org/dpdk/tree/lib/mbuf/rte_mbuf_core.h#n520
>
> +1 anonymous unions are standard C so __extension__ is not necessary, it
> is necessary for an anonymous struct.
>
That was fixed in the v4:
https://mails.dpdk.org/archives/dev/2024-June/295803.html
Regards,
Gregory
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v4] net: add bit fields to IPv6 header definition
2024-06-18 12:44 ` Morten Brørup
@ 2024-10-18 16:47 ` David Marchand
0 siblings, 0 replies; 13+ messages in thread
From: David Marchand @ 2024-10-18 16:47 UTC (permalink / raw)
To: Gregory Etelson
Cc: Morten Brørup, dev, andrew.rybchenko, bruce.richardson,
cristian.dumitrescu, ferruh.yigit, jasvinder.singh,
konstantin.v.ananyev, mkashani, orika, ruifeng.wang, thomas
On Tue, Jun 18, 2024 at 2:44 PM Morten Brørup <mb@smartsharesystems.com> wrote:
> > From: Gregory Etelson [mailto:getelson@nvidia.com]
> >
> > 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 `traffic class` is also separated into DS and ECN fields.
> >
> > The patch also preserves existing `vtc_flow` structure member for
> > backward compatibility.
> >
> > Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-10-18 16:47 UTC | newest]
Thread overview: 13+ 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
2024-10-18 16:47 ` David Marchand
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).