[PATCH v3 1/8] ethdev: add IPv6 routing extension header definition

Rongwei Liu rongweil at nvidia.com
Tue Jan 31 03:05:50 CET 2023


HI Stephen:

BR
Rongwei

> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Tuesday, January 31, 2023 00:50
> To: Rongwei Liu <rongweil at nvidia.com>
> Cc: Matan Azrad <matan at nvidia.com>; Slava Ovsiienko
> <viacheslavo at nvidia.com>; Ori Kam <orika at nvidia.com>; NBU-Contact-
> Thomas Monjalon (EXTERNAL) <thomas at monjalon.net>; Aman Singh
> <aman.deep.singh at intel.com>; Yuying Zhang <yuying.zhang at intel.com>;
> Ferruh Yigit <ferruh.yigit at amd.com>; Andrew Rybchenko
> <andrew.rybchenko at oktetlabs.ru>; Olivier Matz <olivier.matz at 6wind.com>;
> dev at dpdk.org; Raslan Darawsheh <rasland at nvidia.com>
> Subject: Re: [PATCH v3 1/8] ethdev: add IPv6 routing extension header
> definition
> 
> External email: Use caution opening links or attachments
> 
> 
> 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.
> 
Following existing routine, rte_flow_item_***_conv(). Change to memcpy() in the next version
> That cast is unnecessary in C because "segments" is an array and any valid
> pointer type can be passed as void *.
Sure


More information about the dev mailing list