[PATCH dpdk v2 03/16] net: add structure for ipv6 addresses
Morten Brørup
mb at smartsharesystems.com
Sun Oct 6 10:18:57 CEST 2024
+to: Various CPU architecture maintainers
+to: Stephen (already participating in this discussion)
+cc: x86 CPU architecture maintainers
> From: Robin Jarry [mailto:rjarry at redhat.com]
> Sent: Tuesday, 1 October 2024 10.17
>
> There is currently no structure defined for IPv6 addresses. Introduce
> one that is simply a uint8_t array of 16 elements without any union.
> The
> idea is to ensure this structure alignment is 1 so that it can be
> mapped
> directly on unaligned packet memory.
>
> Signed-off-by: Robin Jarry <rjarry at redhat.com>
> ---
> lib/net/rte_ip6.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/lib/net/rte_ip6.h b/lib/net/rte_ip6.h
> index 5ad1dd25db08..52c41088681e 100644
> --- a/lib/net/rte_ip6.h
> +++ b/lib/net/rte_ip6.h
> @@ -35,6 +35,16 @@
> extern "C" {
> #endif
>
> +#define RTE_IPV6_ADDR_SIZE 16
> +#define RTE_IPV6_MAX_DEPTH 128
> +
> +/**
> + * IPv6 Address
> + */
> +struct rte_ipv6_addr {
> + unsigned char a[RTE_IPV6_ADDR_SIZE];
> +};
This has been discussed before, but I want to double check...
If - sometime in the future - we want to add a union to offer a 2-byte access variant and make the structure to 2-byte aligned (which is the common case in Ethernet packets), it will break both API and ABI. This seems unlikely to get accepted at a later time, so I think we are - right now - in a situation where it's now or never:
struct rte_ipv6_addr {
__extension__
union {
unsigned char a[RTE_IPV6_ADDR_SIZE];
uint16_t w[RTE_IPV6_ADDR_SIZE / 2];
};
};
Unless some of the CPU folks want the 2-byte aligned variant, stick with what you offered.
More information about the dev
mailing list