Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352380
b: refs/heads/master
c: 3807ff5
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Feb 8, 2013
1 parent 103fb28 commit 1cbf2e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d527043040740f41192dfd71793f905a998ee4f6
refs/heads/master: 3807ff5899f892abb4f06747c245fd648a2acdc5
17 changes: 13 additions & 4 deletions trunk/drivers/net/macvlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,18 @@ static int macvlan_broadcast_one(struct sk_buff *skb,
return vlan->receive(skb);
}

static unsigned int mc_hash(const unsigned char *addr)
static u32 macvlan_hash_mix(const struct macvlan_dev *vlan)
{
return (u32)(((unsigned long)vlan) >> L1_CACHE_SHIFT);
}


static unsigned int mc_hash(const struct macvlan_dev *vlan,
const unsigned char *addr)
{
u32 val = __get_unaligned_cpu32(addr + 2);

val ^= macvlan_hash_mix(vlan);
return hash_32(val, MACVLAN_MC_FILTER_BITS);
}

Expand All @@ -145,7 +153,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
struct sk_buff *nskb;
unsigned int i;
int err;
unsigned int hash = mc_hash(eth->h_dest);
unsigned int hash;

if (skb->protocol == htons(ETH_P_PAUSE))
return;
Expand All @@ -155,6 +163,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
if (vlan->dev == src || !(vlan->mode & mode))
continue;

hash = mc_hash(vlan, eth->h_dest);
if (!test_bit(hash, vlan->mc_filter))
continue;
nskb = skb_clone(skb, GFP_ATOMIC);
Expand Down Expand Up @@ -424,10 +433,10 @@ static void macvlan_set_mac_lists(struct net_device *dev)

bitmap_zero(filter, MACVLAN_MC_FILTER_SZ);
netdev_for_each_mc_addr(ha, dev) {
__set_bit(mc_hash(ha->addr), filter);
__set_bit(mc_hash(vlan, ha->addr), filter);
}

__set_bit(mc_hash(dev->broadcast), filter);
__set_bit(mc_hash(vlan, dev->broadcast), filter);

bitmap_copy(vlan->mc_filter, filter, MACVLAN_MC_FILTER_SZ);
}
Expand Down

0 comments on commit 1cbf2e4

Please sign in to comment.