macvlan: Use compare_ether_addr_64bits()
authorEric Dumazet <eric.dumazet@gmail.com>
Tue, 1 Sep 2009 05:46:05 +0000 (05:46 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Sep 2009 00:40:25 +0000 (17:40 -0700)
To speedup ether addresses compares, we can use compare_ether_addr_64bits()
(all operands are guaranteed to be at least 8 bytes long)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macvlan.c

index f893cd41580a0197a962abe39fe17190163af155..c85c46d2a309afd9d99b7932c3211b1f37a60806 100644 (file)
@@ -54,7 +54,7 @@ static struct macvlan_dev *macvlan_hash_lookup(const struct macvlan_port *port,
        struct hlist_node *n;
 
        hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[addr[5]], hlist) {
-               if (!compare_ether_addr(vlan->dev->dev_addr, addr))
+               if (!compare_ether_addr_64bits(vlan->dev->dev_addr, addr))
                        return vlan;
        }
        return NULL;
@@ -92,7 +92,7 @@ static int macvlan_addr_busy(const struct macvlan_port *port,
         * currently in use by the underlying device or
         * another macvlan.
         */
-       if (memcmp(port->dev->dev_addr, addr, ETH_ALEN) == 0)
+       if (!compare_ether_addr_64bits(port->dev->dev_addr, addr))
                return 1;
 
        if (macvlan_hash_lookup(port, addr))
@@ -130,7 +130,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
                        dev->stats.multicast++;
 
                        nskb->dev = dev;
-                       if (!compare_ether_addr(eth->h_dest, dev->broadcast))
+                       if (!compare_ether_addr_64bits(eth->h_dest, dev->broadcast))
                                nskb->pkt_type = PACKET_BROADCAST;
                        else
                                nskb->pkt_type = PACKET_MULTICAST;