From mboxrd@z Thu Jan 1 00:00:00 1970 From: Igor Ryzhov Subject: [PATCH] kni: implement header_ops parse method Date: Thu, 27 Sep 2018 03:02:24 +0300 Message-ID: <20180927000224.4011-1-iryzhov@nfware.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit To: dev@dpdk.org Return-path: Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id 167B81B1EB for ; Thu, 27 Sep 2018 02:02:32 +0200 (CEST) Received: by mail-lf1-f68.google.com with SMTP id a82-v6so637063lfa.4 for ; Wed, 26 Sep 2018 17:02:31 -0700 (PDT) Received: from localhost.localdomain ([77.105.176.214]) by smtp.gmail.com with ESMTPSA id l14-v6sm72648ljc.68.2018.09.26.17.02.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Sep 2018 17:02:29 -0700 (PDT) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Igor Ryzhov --- kernel/linux/kni/kni_net.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c index 7fcfa106c..128a5477c 100644 --- a/kernel/linux/kni/kni_net.c +++ b/kernel/linux/kni/kni_net.c @@ -678,6 +678,19 @@ kni_net_header(struct sk_buff *skb, struct net_device *dev, return dev->hard_header_len; } +/* + * 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; +} + /* * Re-fill the eth header */ @@ -739,6 +752,7 @@ kni_net_change_carrier(struct net_device *dev, bool new_carrier) static const struct header_ops kni_net_header_ops = { .create = kni_net_header, + .parse = kni_net_header_parse, #ifdef HAVE_REBUILD_HEADER .rebuild = kni_net_rebuild_header, #endif /* < 4.1.0 */ -- 2.19.0