Skip to contentSkip to conversation

VLAN code can use the faster ether_compare_addr

PATCH In review Stephen Hemminger 3 participants 3 messages Jul 14, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VLAN code can use the faster ether_compare_addr

The inline function compare_ether_addr is faster than memcmp. Also, don't need to drag in proc_fs.h, the only reference to proc_dir_entry is a pointer so the declaration is needed here.

---

 include/linux/if_vlan.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

1738bd3d785bb3f9fa24e26f98b8d86e7783eadf

include/linux/if_vlan.h +3 -2
index eef0876..383627a 100644
@@ -23,8 +23,8 @@ struct vlan_collection;
 struct vlan_dev_info;
 struct hlist_node;
 
-#include <linux/proc_fs.h> /* for proc_dir_entry */
 #include <linux/netdevice.h>
+#include <linux/etherdevice.h>
 
 #define VLAN_HLEN	4		/* The additional bytes (on top of the Ethernet header)
 					 * that VLAN requires.
@@ -185,7 +185,8 @@ static inline int __vlan_hwaccel_rx(stru
 		 * This allows the VLAN to have a different MAC than the underlying
 		 * device, and still route correctly.
 		 */
-		if (!memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN))
+		if (!compare_ether_addr(eth_hdr(skb)->h_dest,
+				       	skb->dev->dev_addr))
 			skb->pkt_type = PACKET_HOST;
 		break;
 	};
Signature · 1 line
1.2.4
#1 lore raw
Quoted 3 lines · Stephen Hemminger

The inline function compare_ether_addr is faster than memcmp. Also, don't need to drag in proc_fs.h, the only reference to proc_dir_entry is a pointer so the declaration is needed here.

Looks fine to me.

Ben

Quoted 33 lines

---

 include/linux/if_vlan.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

1738bd3d785bb3f9fa24e26f98b8d86e7783eadf

include/linux/if_vlan.h +3 -2
index eef0876..383627a 100644
@@ -23,8 +23,8 @@ struct vlan_collection;
 struct vlan_dev_info;
 struct hlist_node;
 
-#include <linux/proc_fs.h> /* for proc_dir_entry */
 #include <linux/netdevice.h>
+#include <linux/etherdevice.h>
 
 #define VLAN_HLEN	4		/* The additional bytes (on top of the Ethernet header)
 					 * that VLAN requires.
@@ -185,7 +185,8 @@ static inline int __vlan_hwaccel_rx(stru
 		 * This allows the VLAN to have a different MAC than the underlying
 		 * device, and still route correctly.
 		 */
-		if (!memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN))
+		if (!compare_ether_addr(eth_hdr(skb)->h_dest,
+				       	skb->dev->dev_addr))
 			skb->pkt_type = PACKET_HOST;
 		break;
 	};
Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
maintainer
#2 lore raw

From: Ben Greear <[email protected]>
Date: Fri, 14 Jul 2006 14:36:17 -0700

Quoted 6 lines
Quoted 3 lines · Stephen Hemminger

The inline function compare_ether_addr is faster than memcmp. Also, don't need to drag in proc_fs.h, the only reference to proc_dir_entry is a pointer so the declaration is needed here.

Looks fine to me.

To me too, applied, thanks a lot.