diff mbox

[dpdk-dev,v3,12/19] kni: prefer ether_addr_copy to memcpy

Message ID 20160926153938.7575-13-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show

Commit Message

Ferruh Yigit Sept. 26, 2016, 3:39 p.m. UTC
Signed-off-by: Ferruh Yigit <ferruh.yigit@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 mbox

Patch

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 4145886..d7d4d4e 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -563,7 +563,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