[PATCH dpdk v2 03/16] net: add structure for ipv6 addresses
Stephen Hemminger
stephen at networkplumber.org
Fri Oct 4 01:18:40 CEST 2024
On Tue, 1 Oct 2024 10:17:15 +0200
Robin Jarry <rjarry at redhat.com> wrote:
> 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];
> +};
> +
Why is RTE_IPV6_MAX_DEPTH here, it is not really a property
of the address itself.
Not sure if using a union (like struct in6_addr does) might be better
to encourage compiler alignment and allow simpler faster comparison.
More information about the dev
mailing list