aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx4/en_rx.c
diff options
context:
space:
mode:
authorYan Burman <yanb@mellanox.com>2013-02-06 21:25:25 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-07 23:26:13 -0500
commitc07cb4b0ab78f279ea94c3b4661cad86eb02a5d9 (patch)
tree7c2eda4433a461a036410586a3ca31d27d46fb6a /drivers/net/ethernet/mellanox/mlx4/en_rx.c
parent90bbb74af68b3255bc298731f8b60d5668877306 (diff)
net/mlx4_en: Manage hash of MAC addresses per port
As a preparation step for supporting multiple unicast addresses, store MAC addresses in hash table. Remove the radix tree for MAC addresses per QP, as it's not in use. Signed-off-by: Yan Burman <yanb@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_rx.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 2e7f5bb94e1f..91bb8e157253 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -615,10 +615,25 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
615 ethh = (struct ethhdr *)(page_address(frags[0].page) + 615 ethh = (struct ethhdr *)(page_address(frags[0].page) +
616 frags[0].offset); 616 frags[0].offset);
617 617
618 /* Drop the packet, since HW loopback-ed it */ 618 if (is_multicast_ether_addr(ethh->h_dest)) {
619 if (ether_addr_equal_64bits(dev->dev_addr, 619 struct mlx4_mac_entry *entry;
620 ethh->h_source)) 620 struct hlist_node *n;
621 goto next; 621 struct hlist_head *bucket;
622 unsigned int mac_hash;
623
624 /* Drop the packet, since HW loopback-ed it */
625 mac_hash = ethh->h_source[MLX4_EN_MAC_HASH_IDX];
626 bucket = &priv->mac_hash[mac_hash];
627 rcu_read_lock();
628 hlist_for_each_entry_rcu(entry, n, bucket, hlist) {
629 if (ether_addr_equal_64bits(entry->mac,
630 ethh->h_source)) {
631 rcu_read_unlock();
632 goto next;
633 }
634 }
635 rcu_read_unlock();
636 }
622 } 637 }
623 638
624 /* 639 /*