From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 0F7094C9D for ; Sun, 30 Sep 2018 10:22:52 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id r64-v6so662317pfb.13 for ; Sun, 30 Sep 2018 01:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nfware-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Y0j37AooEAVu8TWp97AQAnKTQ2CA48IZO/9F03rCGUY=; b=jLWJWXUxqmlwWBAE8hszdjafRO6eynzAlKIDrFewlKjefFaeewla8f2FzGWYQ5DLVL uVT+EvLtwkm6cQo7ZYcfNB1YK4LXPy3Ut19Ze4dRk/GF3e8/JPn71/qc4CGIr04yfIGC kCZR47xw9lZTsPDXnLgisLlj/JTy7tKZJI+LHikp1kCWBQRdgHWbIJBkEexEfbMvzAtF sy/Xxx3shmZTvon6ckDygik33ENZ8V5HlLXBmNlhia0HaN4ybB8qhTPAgfC4vaihQ9pI ban+NrXx+CvubagVPQH05+atJJyU/iZL6kEn6duFPp0Lf7RH1ws1vkeh28gv9DGljr3y bnvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Y0j37AooEAVu8TWp97AQAnKTQ2CA48IZO/9F03rCGUY=; b=CuzpOY8iuHDOZqq5h4/1SR1DtxQkDan8FdFjnv+X4smNfWnBoVBI4AY3+AMvS+R1QO n1WiIE08r+VFuko5ucGxMDDZcFYC8Jt1W/X+hpWjSeVU7Gurj5pnt2LtuUNJD3UTlkuw JLJYTKYT/SEx05d3Apuh+aZXiM9MgeYuqLED4UcFA+s37Scx1tJbx1slqHBL34EnAiWt XdhQ411zjdExHKvU843Qznl7U/9rcv/Re1nHEaFbnv3SeXy2jfYvyW4TS3lh8SGvRKb5 P+ICWAG1ac8diVlGGR0udwajJgcxldiX/QIJnkRT2NUby5uDxSPp907uRUsEGHq0IZc0 WUfQ== X-Gm-Message-State: ABuFfogZ5wYRUBNrDvoDM4Aflh8fGem2fCkGJriRY0tnPjrSgCmKm7dU norIdisrtODAKFNjpEaBAWEOmD0J9R7v6QwBj4dM8A== X-Google-Smtp-Source: ACcGV62xNz6F5uPC0OLLXLI/SBIW3zqfFaQxNgKA7VoPpsSKSfvXhgyNSTHve+P/wyjykDuNlku4rqZ7JlQ2jf1lvH4= X-Received: by 2002:a62:9554:: with SMTP id p81-v6mr6142222pfd.222.1538295772089; Sun, 30 Sep 2018 01:22:52 -0700 (PDT) MIME-Version: 1.0 References: <20180927000224.4011-1-iryzhov@nfware.com> <20180929092159.6b50e439@shemminger-XPS-13-9360> In-Reply-To: From: Igor Ryzhov Date: Sun, 30 Sep 2018 11:22:40 +0300 Message-ID: To: Stephen Hemminger Cc: dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] kni: implement header_ops parse method X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Sep 2018 08:22:53 -0000 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 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@networkplumber.org> wrote: > >> On Thu, 27 Sep 2018 03:02:24 +0300 >> Igor Ryzhov 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. >> >