Commit ac06713d authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

macvlan: Use compare_ether_addr_64bits()

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: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c3c74327
...@@ -54,7 +54,7 @@ static struct macvlan_dev *macvlan_hash_lookup(const struct macvlan_port *port, ...@@ -54,7 +54,7 @@ static struct macvlan_dev *macvlan_hash_lookup(const struct macvlan_port *port,
struct hlist_node *n; struct hlist_node *n;
hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[addr[5]], hlist) { 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 vlan;
} }
return NULL; return NULL;
...@@ -92,7 +92,7 @@ static int macvlan_addr_busy(const struct macvlan_port *port, ...@@ -92,7 +92,7 @@ static int macvlan_addr_busy(const struct macvlan_port *port,
* currently in use by the underlying device or * currently in use by the underlying device or
* another macvlan. * another macvlan.
*/ */
if (memcmp(port->dev->dev_addr, addr, ETH_ALEN) == 0) if (!compare_ether_addr_64bits(port->dev->dev_addr, addr))
return 1; return 1;
if (macvlan_hash_lookup(port, addr)) if (macvlan_hash_lookup(port, addr))
...@@ -130,7 +130,7 @@ static void macvlan_broadcast(struct sk_buff *skb, ...@@ -130,7 +130,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
dev->stats.multicast++; dev->stats.multicast++;
nskb->dev = dev; 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; nskb->pkt_type = PACKET_BROADCAST;
else else
nskb->pkt_type = PACKET_MULTICAST; nskb->pkt_type = PACKET_MULTICAST;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment