HI Stephen: BR Rongwei
> -----Original Message----- > From: Stephen Hemminger <[email protected]> > Sent: Tuesday, January 31, 2023 00:50 > To: Rongwei Liu <[email protected]> > Cc: Matan Azrad <[email protected]>; Slava Ovsiienko > <[email protected]>; Ori Kam <[email protected]>; NBU-Contact- > Thomas Monjalon (EXTERNAL) <[email protected]>; Aman Singh > <[email protected]>; Yuying Zhang <[email protected]>; > Ferruh Yigit <[email protected]>; Andrew Rybchenko > <[email protected]>; Olivier Matz <[email protected]>; > [email protected]; Raslan Darawsheh <[email protected]> > 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 <[email protected]> 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

