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

Igor Ryzhov iryzhov at nfware.com
Sat Sep 29 21:19:38 CEST 2018


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