diff options
author | Jiri Pirko <jpirko@redhat.com> | 2009-05-22 19:22:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-30 01:12:32 -0400 |
commit | ccffad25b5136958d4769ed6de5e87992dd9c65c (patch) | |
tree | cd5f36fe67f4deeae23d76436f7a032a201cba44 /drivers/net/e1000 | |
parent | ae63e808f508c38fe65e23a1480c85d5bd00ecbd (diff) |
net: convert unicast addr list
This patch converts unicast address list to standard list_head using
previously introduced struct netdev_hw_addr. It also relaxes the
locking. Original spinlock (still used for multicast addresses) is not
needed and is no longer used for a protection of this list. All
reading and writing takes place under rtnl (with no changes).
I also removed a possibility to specify the length of the address
while adding or deleting unicast address. It's always dev->addr_len.
The convertion touched especially e1000 and ixgbe codes when the
change is not so trivial.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
drivers/net/bnx2.c | 13 +--
drivers/net/e1000/e1000_main.c | 24 +++--
drivers/net/ixgbe/ixgbe_common.c | 14 ++--
drivers/net/ixgbe/ixgbe_common.h | 4 +-
drivers/net/ixgbe/ixgbe_main.c | 6 +-
drivers/net/ixgbe/ixgbe_type.h | 4 +-
drivers/net/macvlan.c | 11 +-
drivers/net/mv643xx_eth.c | 11 +-
drivers/net/niu.c | 7 +-
drivers/net/virtio_net.c | 7 +-
drivers/s390/net/qeth_l2_main.c | 6 +-
drivers/scsi/fcoe/fcoe.c | 16 ++--
include/linux/netdevice.h | 18 ++--
net/8021q/vlan.c | 4 +-
net/8021q/vlan_dev.c | 10 +-
net/core/dev.c | 195 +++++++++++++++++++++++++++-----------
net/dsa/slave.c | 10 +-
net/packet/af_packet.c | 4 +-
18 files changed, 227 insertions(+), 137 deletions(-)
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 79fe1ee3da52..74667e521431 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -2330,7 +2330,8 @@ static void e1000_set_rx_mode(struct net_device *netdev) | |||
2330 | { | 2330 | { |
2331 | struct e1000_adapter *adapter = netdev_priv(netdev); | 2331 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2332 | struct e1000_hw *hw = &adapter->hw; | 2332 | struct e1000_hw *hw = &adapter->hw; |
2333 | struct dev_addr_list *uc_ptr; | 2333 | struct netdev_hw_addr *ha; |
2334 | bool use_uc = false; | ||
2334 | struct dev_addr_list *mc_ptr; | 2335 | struct dev_addr_list *mc_ptr; |
2335 | u32 rctl; | 2336 | u32 rctl; |
2336 | u32 hash_value; | 2337 | u32 hash_value; |
@@ -2369,12 +2370,11 @@ static void e1000_set_rx_mode(struct net_device *netdev) | |||
2369 | rctl |= E1000_RCTL_VFE; | 2370 | rctl |= E1000_RCTL_VFE; |
2370 | } | 2371 | } |
2371 | 2372 | ||
2372 | uc_ptr = NULL; | ||
2373 | if (netdev->uc_count > rar_entries - 1) { | 2373 | if (netdev->uc_count > rar_entries - 1) { |
2374 | rctl |= E1000_RCTL_UPE; | 2374 | rctl |= E1000_RCTL_UPE; |
2375 | } else if (!(netdev->flags & IFF_PROMISC)) { | 2375 | } else if (!(netdev->flags & IFF_PROMISC)) { |
2376 | rctl &= ~E1000_RCTL_UPE; | 2376 | rctl &= ~E1000_RCTL_UPE; |
2377 | uc_ptr = netdev->uc_list; | 2377 | use_uc = true; |
2378 | } | 2378 | } |
2379 | 2379 | ||
2380 | ew32(RCTL, rctl); | 2380 | ew32(RCTL, rctl); |
@@ -2392,13 +2392,20 @@ static void e1000_set_rx_mode(struct net_device *netdev) | |||
2392 | * if there are not 14 addresses, go ahead and clear the filters | 2392 | * if there are not 14 addresses, go ahead and clear the filters |
2393 | * -- with 82571 controllers only 0-13 entries are filled here | 2393 | * -- with 82571 controllers only 0-13 entries are filled here |
2394 | */ | 2394 | */ |
2395 | i = 1; | ||
2396 | if (use_uc) | ||
2397 | list_for_each_entry(ha, &netdev->uc_list, list) { | ||
2398 | if (i == rar_entries) | ||
2399 | break; | ||
2400 | e1000_rar_set(hw, ha->addr, i++); | ||
2401 | } | ||
2402 | |||
2403 | WARN_ON(i == rar_entries); | ||
2404 | |||
2395 | mc_ptr = netdev->mc_list; | 2405 | mc_ptr = netdev->mc_list; |
2396 | 2406 | ||
2397 | for (i = 1; i < rar_entries; i++) { | 2407 | for (; i < rar_entries; i++) { |
2398 | if (uc_ptr) { | 2408 | if (mc_ptr) { |
2399 | e1000_rar_set(hw, uc_ptr->da_addr, i); | ||
2400 | uc_ptr = uc_ptr->next; | ||
2401 | } else if (mc_ptr) { | ||
2402 | e1000_rar_set(hw, mc_ptr->da_addr, i); | 2409 | e1000_rar_set(hw, mc_ptr->da_addr, i); |
2403 | mc_ptr = mc_ptr->next; | 2410 | mc_ptr = mc_ptr->next; |
2404 | } else { | 2411 | } else { |
@@ -2408,7 +2415,6 @@ static void e1000_set_rx_mode(struct net_device *netdev) | |||
2408 | E1000_WRITE_FLUSH(); | 2415 | E1000_WRITE_FLUSH(); |
2409 | } | 2416 | } |
2410 | } | 2417 | } |
2411 | WARN_ON(uc_ptr != NULL); | ||
2412 | 2418 | ||
2413 | /* load any remaining addresses into the hash table */ | 2419 | /* load any remaining addresses into the hash table */ |
2414 | 2420 | ||