[PATCH v3 1/8] ethdev: add IPv6 routing extension header definition
Stephen Hemminger
stephen at networkplumber.org
Mon Jan 30 17:50:13 CET 2023
On Mon, 30 Jan 2023 05:59:33 +0200
Rongwei Liu <rongweil at nvidia.com> wrote:
> +static size_t
> +rte_flow_item_ipv6_routing_ext_conv(void *buf, const void *data)
> +{
> + struct rte_flow_item_ipv6_routing_ext *dst = buf;
> + const struct rte_flow_item_ipv6_routing_ext *src = data;
> + size_t len;
> +
> + if (src->hdr.hdr_len)
> + len = src->hdr.hdr_len << 3;
> + else
> + len = src->hdr.segments_left << 4;
> + if (dst == NULL)
> + return 0;
> + rte_memcpy((void *)((uintptr_t)(dst->hdr.segments)), src->hdr.segments, len);
> + return len;
Why use rte_memcpy for such a small size? Please just use normal memcpy which
will cause more compiler and static scan checking.
That cast is unnecessary in C because "segments" is an array and any valid
pointer type can be passed as void *.
More information about the dev
mailing list