[dpdk-dev] [PATCH] kni: implement header_ops parse method

Igor Ryzhov iryzhov at nfware.com
Sun Sep 30 10:22:40 CEST 2018


Hello Stephen,

I looked at KNI code again, memcpy is already used everywhere
(kni_net_header, kni_net_rebuild_header) for MAC address copy.
So I propose to accept the patch as it is.

memcpy can be replaced by ether_addr_copy in all functions at once in
separate patch.

Igor

On Sat, Sep 29, 2018 at 10:19 PM Igor Ryzhov <iryzhov at nfware.com> wrote:

> It's just exact copy of eth_header_parse function from Linux kernel.
>
> No problem, can do that with ether_addr_copy.
>
> On Sat, Sep 29, 2018 at 10:22 AM Stephen Hemminger <
> stephen at networkplumber.org> wrote:
>
>> On Thu, 27 Sep 2018 03:02:24 +0300
>> Igor Ryzhov <iryzhov at nfware.com> wrote:
>>
>> > +/*
>> > + *  Extract hardware address from packet
>> > + */
>> > +static int
>> > +kni_net_header_parse(const struct sk_buff *skb, unsigned char *haddr)
>> > +{
>> > +     const struct ethhdr *eth = eth_hdr(skb);
>> > +
>> > +     memcpy(haddr, eth->h_source, ETH_ALEN);
>> > +
>> > +     return ETH_ALEN;
>> > +}
>>
>> Kernel has function ether_addr_copy which is marginally faster and
>> commonly used.
>>
>


More information about the dev mailing list