DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH dpdk] net: enforce 2-bytes alignment on IPv6 headers
@ 2024-11-05 12:25 Robin Jarry
  2024-11-05 12:27 ` Morten Brørup
  2024-11-05 14:12 ` [PATCH dpdk v2] " Robin Jarry
  0 siblings, 2 replies; 6+ messages in thread
From: Robin Jarry @ 2024-11-05 12:25 UTC (permalink / raw)
  To: dev; +Cc: Morten Brørup, David Marchand

IPv6 headers are always aligned on a 2-bytes grid. Reflect this in the
structure definition.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 lib/net/rte_ip6.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/net/rte_ip6.h b/lib/net/rte_ip6.h
index 3ae38811b27c..fea7d7b0cd73 100644
--- a/lib/net/rte_ip6.h
+++ b/lib/net/rte_ip6.h
@@ -460,7 +460,7 @@ rte_ether_mcast_from_ipv6(struct rte_ether_addr *mac, const struct rte_ipv6_addr
 /**
  * IPv6 Header
  */
-struct rte_ipv6_hdr {
+struct __rte_aligned(2) rte_ipv6_hdr {
 	union {
 		rte_be32_t vtc_flow;        /**< IP version, traffic class & flow label. */
 		__extension__
@@ -507,7 +507,7 @@ static inline int rte_ipv6_check_version(const struct rte_ipv6_hdr *ip)
 /**
  * IPv6 Routing Extension Header
  */
-struct rte_ipv6_routing_ext {
+struct __rte_aligned(2) rte_ipv6_routing_ext {
 	uint8_t next_hdr;			/**< Protocol, next header. */
 	uint8_t hdr_len;			/**< Header length. */
 	uint8_t type;				/**< Extension header type. */
@@ -751,7 +751,7 @@ rte_ipv6_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m,
 #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
 	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
 
-struct rte_ipv6_fragment_ext {
+struct __rte_aligned(2) rte_ipv6_fragment_ext {
 	uint8_t next_header;	/**< Next header type */
 	uint8_t reserved;	/**< Reserved */
 	rte_be16_t frag_data;	/**< All fragmentation data */
-- 
2.47.0


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

* RE: [PATCH dpdk] net: enforce 2-bytes alignment on IPv6 headers
  2024-11-05 12:25 [PATCH dpdk] net: enforce 2-bytes alignment on IPv6 headers Robin Jarry
@ 2024-11-05 12:27 ` Morten Brørup
  2024-11-05 12:33   ` Morten Brørup
  2024-11-05 14:12 ` [PATCH dpdk v2] " Robin Jarry
  1 sibling, 1 reply; 6+ messages in thread
From: Morten Brørup @ 2024-11-05 12:27 UTC (permalink / raw)
  To: Robin Jarry, dev; +Cc: David Marchand

> From: Robin Jarry [mailto:rjarry@redhat.com]
> Sent: Tuesday, 5 November 2024 13.25
> 
> IPv6 headers are always aligned on a 2-bytes grid. Reflect this in the
> structure definition.
> 
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---
>  lib/net/rte_ip6.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/net/rte_ip6.h b/lib/net/rte_ip6.h
> index 3ae38811b27c..fea7d7b0cd73 100644
> --- a/lib/net/rte_ip6.h
> +++ b/lib/net/rte_ip6.h
> @@ -460,7 +460,7 @@ rte_ether_mcast_from_ipv6(struct rte_ether_addr
> *mac, const struct rte_ipv6_addr
>  /**
>   * IPv6 Header
>   */
> -struct rte_ipv6_hdr {
> +struct __rte_aligned(2) rte_ipv6_hdr {
>  	union {
>  		rte_be32_t vtc_flow;        /**< IP version, traffic class
> & flow label. */
>  		__extension__
> @@ -507,7 +507,7 @@ static inline int rte_ipv6_check_version(const
> struct rte_ipv6_hdr *ip)
>  /**
>   * IPv6 Routing Extension Header
>   */
> -struct rte_ipv6_routing_ext {
> +struct __rte_aligned(2) rte_ipv6_routing_ext {
>  	uint8_t next_hdr;			/**< Protocol, next header. */
>  	uint8_t hdr_len;			/**< Header length. */
>  	uint8_t type;				/**< Extension header type.
> */
> @@ -751,7 +751,7 @@ rte_ipv6_udptcp_cksum_mbuf_verify(const struct
> rte_mbuf *m,
>  #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
>  	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
> 
> -struct rte_ipv6_fragment_ext {
> +struct __rte_aligned(2) rte_ipv6_fragment_ext {
>  	uint8_t next_header;	/**< Next header type */
>  	uint8_t reserved;	/**< Reserved */
>  	rte_be16_t frag_data;	/**< All fragmentation data */
> --
> 2.47.0

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>


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

* RE: [PATCH dpdk] net: enforce 2-bytes alignment on IPv6 headers
  2024-11-05 12:27 ` Morten Brørup
@ 2024-11-05 12:33   ` Morten Brørup
  0 siblings, 0 replies; 6+ messages in thread
From: Morten Brørup @ 2024-11-05 12:33 UTC (permalink / raw)
  To: Robin Jarry, dev; +Cc: David Marchand

> From: Morten Brørup [mailto:mb@smartsharesystems.com]
> Sent: Tuesday, 5 November 2024 13.28
> 
> > From: Robin Jarry [mailto:rjarry@redhat.com]
> > Sent: Tuesday, 5 November 2024 13.25
> >
> > IPv6 headers are always aligned on a 2-bytes grid. Reflect this in
> the
> > structure definition.
> >
> > Signed-off-by: Robin Jarry <rjarry@redhat.com>
> > ---
> >  lib/net/rte_ip6.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/net/rte_ip6.h b/lib/net/rte_ip6.h
> > index 3ae38811b27c..fea7d7b0cd73 100644
> > --- a/lib/net/rte_ip6.h
> > +++ b/lib/net/rte_ip6.h
> > @@ -460,7 +460,7 @@ rte_ether_mcast_from_ipv6(struct rte_ether_addr
> > *mac, const struct rte_ipv6_addr
> >  /**
> >   * IPv6 Header
> >   */
> > -struct rte_ipv6_hdr {
> > +struct __rte_aligned(2) rte_ipv6_hdr {
> >  	union {
> >  		rte_be32_t vtc_flow;        /**< IP version, traffic class
> > & flow label. */
> >  		__extension__
> > @@ -507,7 +507,7 @@ static inline int rte_ipv6_check_version(const
> > struct rte_ipv6_hdr *ip)
> >  /**
> >   * IPv6 Routing Extension Header
> >   */
> > -struct rte_ipv6_routing_ext {
> > +struct __rte_aligned(2) rte_ipv6_routing_ext {
> >  	uint8_t next_hdr;			/**< Protocol, next header. */
> >  	uint8_t hdr_len;			/**< Header length. */
> >  	uint8_t type;				/**< Extension header type.
> > */
> > @@ -751,7 +751,7 @@ rte_ipv6_udptcp_cksum_mbuf_verify(const struct
> > rte_mbuf *m,
> >  #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
> >  	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
> >
> > -struct rte_ipv6_fragment_ext {
> > +struct __rte_aligned(2) rte_ipv6_fragment_ext {
> >  	uint8_t next_header;	/**< Next header type */
> >  	uint8_t reserved;	/**< Reserved */
> >  	rte_be16_t frag_data;	/**< All fragmentation data */
> > --
> > 2.47.0
> 
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

Too trigger happy, I am.

Please also update the release notes like the IPv4 patch. Suggest:

+++ b/doc/guides/rel_notes/release_24_11.rst
@@ -291,6 +291,8 @@ API Changes
     releases: it handles key=value and only-key cases.
   * Both ``rte_kvargs_process`` and ``rte_kvargs_process_opt`` reject a NULL ``kvlist`` parameter.
 
 * net: The IPv4 header structure ``rte_ipv4_hdr`` has been marked as two bytes aligned.
 
+* net: The IPv6 header and extension structures ``rte_ipv6_hdr``, ``rte_ipv6_routing_ext`` and ``rte_ipv6_fragment_ext`` have been marked as two bytes aligned.
+ 
 * net: The ICMP message types ``RTE_IP_ICMP_ECHO_REPLY`` and ``RTE_IP_ICMP_ECHO_REQUEST``
   are marked as deprecated, and are replaced
   by ``RTE_ICMP_TYPE_ECHO_REPLY`` and ``RTE_ICMP_TYPE_ECHO_REQUEST``.

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

* [PATCH dpdk v2] net: enforce 2-bytes alignment on IPv6 headers
  2024-11-05 12:25 [PATCH dpdk] net: enforce 2-bytes alignment on IPv6 headers Robin Jarry
  2024-11-05 12:27 ` Morten Brørup
@ 2024-11-05 14:12 ` Robin Jarry
  2024-11-05 14:20   ` Morten Brørup
  1 sibling, 1 reply; 6+ messages in thread
From: Robin Jarry @ 2024-11-05 14:12 UTC (permalink / raw)
  To: dev; +Cc: Morten Brørup, David Marchand

IPv6 headers are always aligned on a 2-bytes grid. Reflect this in the
structure definition.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---

Notes:
    v2: added changelog entry

 doc/guides/rel_notes/release_24_11.rst | 6 ++++++
 lib/net/rte_ip6.h                      | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst
index 53a5ffebe552..e27c6831e0f3 100644
--- a/doc/guides/rel_notes/release_24_11.rst
+++ b/doc/guides/rel_notes/release_24_11.rst
@@ -295,6 +295,12 @@ API Changes
   are marked as deprecated, and are replaced
   by ``RTE_ICMP_TYPE_ECHO_REPLY`` and ``RTE_ICMP_TYPE_ECHO_REQUEST``.
 
+* net: The IPv6 header and extension structures have been marked as two bytes aligned:
+
+  - ``struct rte_ipv6_hdr``
+  - ``struct rte_ipv6_routing_ext``
+  - ``struct rte_ipv6_fragment_ext``
+
 * net: A new IPv6 address structure was introduced to replace ad-hoc ``uint8_t[16]`` arrays.
   The following libraries and symbols were modified:
 
diff --git a/lib/net/rte_ip6.h b/lib/net/rte_ip6.h
index 3ae38811b27c..fea7d7b0cd73 100644
--- a/lib/net/rte_ip6.h
+++ b/lib/net/rte_ip6.h
@@ -460,7 +460,7 @@ rte_ether_mcast_from_ipv6(struct rte_ether_addr *mac, const struct rte_ipv6_addr
 /**
  * IPv6 Header
  */
-struct rte_ipv6_hdr {
+struct __rte_aligned(2) rte_ipv6_hdr {
 	union {
 		rte_be32_t vtc_flow;        /**< IP version, traffic class & flow label. */
 		__extension__
@@ -507,7 +507,7 @@ static inline int rte_ipv6_check_version(const struct rte_ipv6_hdr *ip)
 /**
  * IPv6 Routing Extension Header
  */
-struct rte_ipv6_routing_ext {
+struct __rte_aligned(2) rte_ipv6_routing_ext {
 	uint8_t next_hdr;			/**< Protocol, next header. */
 	uint8_t hdr_len;			/**< Header length. */
 	uint8_t type;				/**< Extension header type. */
@@ -751,7 +751,7 @@ rte_ipv6_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m,
 #define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
 	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
 
-struct rte_ipv6_fragment_ext {
+struct __rte_aligned(2) rte_ipv6_fragment_ext {
 	uint8_t next_header;	/**< Next header type */
 	uint8_t reserved;	/**< Reserved */
 	rte_be16_t frag_data;	/**< All fragmentation data */
-- 
2.47.0


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

* RE: [PATCH dpdk v2] net: enforce 2-bytes alignment on IPv6 headers
  2024-11-05 14:12 ` [PATCH dpdk v2] " Robin Jarry
@ 2024-11-05 14:20   ` Morten Brørup
  2024-11-06 20:23     ` David Marchand
  0 siblings, 1 reply; 6+ messages in thread
From: Morten Brørup @ 2024-11-05 14:20 UTC (permalink / raw)
  To: Robin Jarry, dev, bruce.richardson; +Cc: David Marchand, Ferruh Yigit

> From: Robin Jarry [mailto:rjarry@redhat.com]
> Sent: Tuesday, 5 November 2024 15.13
> 
> IPv6 headers are always aligned on a 2-bytes grid. Reflect this in the
> structure definition.
> 
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---
> 
> Notes:
>     v2: added changelog entry
> 
>  doc/guides/rel_notes/release_24_11.rst | 6 ++++++
>  lib/net/rte_ip6.h                      | 6 +++---
>  2 files changed, 9 insertions(+), 3 deletions(-)

Thank you, Robin.

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

Note for other reviewers:
This patch provides consistency with the IPv4 header alignment patch,
https://patchwork.dpdk.org/project/dpdk/patch/20241105085912.4148208-1-david.marchand@redhat.com/


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

* Re: [PATCH dpdk v2] net: enforce 2-bytes alignment on IPv6 headers
  2024-11-05 14:20   ` Morten Brørup
@ 2024-11-06 20:23     ` David Marchand
  0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2024-11-06 20:23 UTC (permalink / raw)
  To: Robin Jarry; +Cc: dev, bruce.richardson, Ferruh Yigit, Morten Brørup

On Tue, Nov 5, 2024 at 3:20 PM Morten Brørup <mb@smartsharesystems.com> wrote:
>
> > From: Robin Jarry [mailto:rjarry@redhat.com]
> > Sent: Tuesday, 5 November 2024 15.13
> >
> > IPv6 headers are always aligned on a 2-bytes grid. Reflect this in the
> > structure definition.
> >
> > Signed-off-by: Robin Jarry <rjarry@redhat.com>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

Applied, thanks.


-- 
David Marchand


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

end of thread, other threads:[~2024-11-06 20:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-05 12:25 [PATCH dpdk] net: enforce 2-bytes alignment on IPv6 headers Robin Jarry
2024-11-05 12:27 ` Morten Brørup
2024-11-05 12:33   ` Morten Brørup
2024-11-05 14:12 ` [PATCH dpdk v2] " Robin Jarry
2024-11-05 14:20   ` Morten Brørup
2024-11-06 20:23     ` 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).