[dpdk-dev] [PATCH 12/19] kni: prefer ether_addr_copy to memcpy
Ferruh Yigit
ferruh.yigit at intel.com
Thu Sep 15 17:46:38 CEST 2016
Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
lib/librte_eal/linuxapp/kni/compat.h | 4 ++++
lib/librte_eal/linuxapp/kni/kni_misc.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index d79d626..9ae50a7 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -26,6 +26,10 @@
#define HAVE_CHANGE_CARRIER_CB
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
+#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN)
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
#define HAVE_IOV_ITER_MSGHDR
#endif
diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 0cbc499..6dc8f6e 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -524,7 +524,7 @@ kni_ioctl_create(struct net *net,
pci_dev_put(pci);
if (kni->lad_dev)
- memcpy(net_dev->dev_addr, kni->lad_dev->dev_addr, ETH_ALEN);
+ ether_addr_copy(net_dev->dev_addr, kni->lad_dev->dev_addr);
else
/*
* Generate random mac address. eth_random_addr() is the newer
--
2.7.4
More information about the dev
mailing list