DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] igb/ixgbe: use ether_addr_equal()
@ 2014-02-04 13:59 Aaro Koskinen
  2014-02-04 15:01 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Aaro Koskinen @ 2014-02-04 13:59 UTC (permalink / raw)
  To: dev

ether_addr_equal() was added in Linux 3.5. compare_ether_addr() was
deleted in 3.14. Start using ether_addr_equal() and provide an own
implementation for older kernels.

This fixes the compilation with Linux 3.14-rc1.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>
---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c     | 2 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h      | 4 ++++
 lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c | 2 +-
 lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h    | 4 ++++
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index f199133..ffb9fae 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -8399,7 +8399,7 @@ int igb_del_mac_filter(struct igb_adapter *adapter, u8* addr, u16 queue)
 	if (is_zero_ether_addr(addr))
 		return 0;
 	for (i = 0; i < hw->mac.rar_entry_count; i++) {
-		if (!compare_ether_addr(addr, adapter->mac_table[i].addr) &&
+		if (ether_addr_equal(addr, adapter->mac_table[i].addr) &&
 		    adapter->mac_table[i].queue == queue) {
 			adapter->mac_table[i].state = IGB_MAC_STATE_MODIFIED;
 			memset(adapter->mac_table[i].addr, 0, ETH_ALEN);
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index 1d86c2b..1418c76 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3049,6 +3049,10 @@ typedef netdev_features_t kni_netdev_features_t;
 
 /*****************************************************************************/
 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) )
+static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
+{
+	return !compare_ether_addr(addr1, addr2);
+}
 #else
 #define HAVE_FDB_OPS
 #endif /* < 3.5.0 */
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
index 947be44..cb56906 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
@@ -525,7 +525,7 @@ int ixgbe_del_mac_filter(struct ixgbe_adapter *adapter, u8* addr, u16 queue)
 	if (is_zero_ether_addr(addr))
 		return 0;
 	for (i = 0; i < hw->mac.num_rar_entries; i++) {
-		if (!compare_ether_addr(addr, adapter->mac_table[i].addr) &&
+		if (ether_addr_equal(addr, adapter->mac_table[i].addr) &&
 		    adapter->mac_table[i].queue == queue) {
 			adapter->mac_table[i].state |= IXGBE_MAC_STATE_MODIFIED;
 			adapter->mac_table[i].state &= ~IXGBE_MAC_STATE_IN_USE;
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
index 1c4e057..57beb7f 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
@@ -3106,6 +3106,10 @@ typedef netdev_features_t kni_netdev_features_t;
 
 /*****************************************************************************/
 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) )
+static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
+{
+	return !compare_ether_addr(addr1, addr2);
+}
 #else
 #define HAVE_FDB_OPS
 #endif /* < 3.5.0 */
-- 
1.8.5.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] igb/ixgbe: use ether_addr_equal()
  2014-02-04 13:59 [dpdk-dev] [PATCH] igb/ixgbe: use ether_addr_equal() Aaro Koskinen
@ 2014-02-04 15:01 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2014-02-04 15:01 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: dev

04/02/2014 14:59, Aaro Koskinen:
> ether_addr_equal() was added in Linux 3.5. compare_ether_addr() was
> deleted in 3.14. Start using ether_addr_equal() and provide an own
> implementation for older kernels.
> 
> This fixes the compilation with Linux 3.14-rc1.
> 
> Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>

Looks good.

Acked and applied with this title:
	kni: fix build with kernel 3.14

Thank you
-- 
Thomas

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-04 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-04 13:59 [dpdk-dev] [PATCH] igb/ixgbe: use ether_addr_equal() Aaro Koskinen
2014-02-04 15:01 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).