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 | |
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')
-rw-r--r-- | drivers/net/bnx2.c | 13 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 24 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_common.c | 14 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_common.h | 4 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 6 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_type.h | 4 | ||||
-rw-r--r-- | drivers/net/macvlan.c | 11 | ||||
-rw-r--r-- | drivers/net/mv643xx_eth.c | 11 | ||||
-rw-r--r-- | drivers/net/niu.c | 7 | ||||
-rw-r--r-- | drivers/net/virtio_net.c | 7 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l2_main.c | 6 | ||||
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 16 |
12 files changed, 64 insertions, 59 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 83ee0f53f2d2..f53017250e09 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/cache.h> | 48 | #include <linux/cache.h> |
49 | #include <linux/firmware.h> | 49 | #include <linux/firmware.h> |
50 | #include <linux/log2.h> | 50 | #include <linux/log2.h> |
51 | #include <linux/list.h> | ||
51 | 52 | ||
52 | #include "bnx2.h" | 53 | #include "bnx2.h" |
53 | #include "bnx2_fw.h" | 54 | #include "bnx2_fw.h" |
@@ -3310,7 +3311,7 @@ bnx2_set_rx_mode(struct net_device *dev) | |||
3310 | { | 3311 | { |
3311 | struct bnx2 *bp = netdev_priv(dev); | 3312 | struct bnx2 *bp = netdev_priv(dev); |
3312 | u32 rx_mode, sort_mode; | 3313 | u32 rx_mode, sort_mode; |
3313 | struct dev_addr_list *uc_ptr; | 3314 | struct netdev_hw_addr *ha; |
3314 | int i; | 3315 | int i; |
3315 | 3316 | ||
3316 | if (!netif_running(dev)) | 3317 | if (!netif_running(dev)) |
@@ -3369,21 +3370,19 @@ bnx2_set_rx_mode(struct net_device *dev) | |||
3369 | sort_mode |= BNX2_RPM_SORT_USER0_MC_HSH_EN; | 3370 | sort_mode |= BNX2_RPM_SORT_USER0_MC_HSH_EN; |
3370 | } | 3371 | } |
3371 | 3372 | ||
3372 | uc_ptr = NULL; | ||
3373 | if (dev->uc_count > BNX2_MAX_UNICAST_ADDRESSES) { | 3373 | if (dev->uc_count > BNX2_MAX_UNICAST_ADDRESSES) { |
3374 | rx_mode |= BNX2_EMAC_RX_MODE_PROMISCUOUS; | 3374 | rx_mode |= BNX2_EMAC_RX_MODE_PROMISCUOUS; |
3375 | sort_mode |= BNX2_RPM_SORT_USER0_PROM_EN | | 3375 | sort_mode |= BNX2_RPM_SORT_USER0_PROM_EN | |
3376 | BNX2_RPM_SORT_USER0_PROM_VLAN; | 3376 | BNX2_RPM_SORT_USER0_PROM_VLAN; |
3377 | } else if (!(dev->flags & IFF_PROMISC)) { | 3377 | } else if (!(dev->flags & IFF_PROMISC)) { |
3378 | uc_ptr = dev->uc_list; | ||
3379 | |||
3380 | /* Add all entries into to the match filter list */ | 3378 | /* Add all entries into to the match filter list */ |
3381 | for (i = 0; i < dev->uc_count; i++) { | 3379 | i = 0; |
3382 | bnx2_set_mac_addr(bp, uc_ptr->da_addr, | 3380 | list_for_each_entry(ha, &dev->uc_list, list) { |
3381 | bnx2_set_mac_addr(bp, ha->addr, | ||
3383 | i + BNX2_START_UNICAST_ADDRESS_INDEX); | 3382 | i + BNX2_START_UNICAST_ADDRESS_INDEX); |
3384 | sort_mode |= (1 << | 3383 | sort_mode |= (1 << |
3385 | (i + BNX2_START_UNICAST_ADDRESS_INDEX)); | 3384 | (i + BNX2_START_UNICAST_ADDRESS_INDEX)); |
3386 | uc_ptr = uc_ptr->next; | 3385 | i++; |
3387 | } | 3386 | } |
3388 | 3387 | ||
3389 | } | 3388 | } |
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 | ||
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index 0cc3c47cb453..6f79409270a7 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
31 | #include <linux/list.h> | ||
32 | #include <linux/netdevice.h> | ||
31 | 33 | ||
32 | #include "ixgbe.h" | 34 | #include "ixgbe.h" |
33 | #include "ixgbe_common.h" | 35 | #include "ixgbe_common.h" |
@@ -1356,15 +1358,14 @@ static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq) | |||
1356 | * Drivers using secondary unicast addresses must set user_set_promisc when | 1358 | * Drivers using secondary unicast addresses must set user_set_promisc when |
1357 | * manually putting the device into promiscuous mode. | 1359 | * manually putting the device into promiscuous mode. |
1358 | **/ | 1360 | **/ |
1359 | s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list, | 1361 | s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, |
1360 | u32 addr_count, ixgbe_mc_addr_itr next) | 1362 | struct list_head *uc_list) |
1361 | { | 1363 | { |
1362 | u8 *addr; | ||
1363 | u32 i; | 1364 | u32 i; |
1364 | u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc; | 1365 | u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc; |
1365 | u32 uc_addr_in_use; | 1366 | u32 uc_addr_in_use; |
1366 | u32 fctrl; | 1367 | u32 fctrl; |
1367 | u32 vmdq; | 1368 | struct netdev_hw_addr *ha; |
1368 | 1369 | ||
1369 | /* | 1370 | /* |
1370 | * Clear accounting of old secondary address list, | 1371 | * Clear accounting of old secondary address list, |
@@ -1382,10 +1383,9 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list, | |||
1382 | } | 1383 | } |
1383 | 1384 | ||
1384 | /* Add the new addresses */ | 1385 | /* Add the new addresses */ |
1385 | for (i = 0; i < addr_count; i++) { | 1386 | list_for_each_entry(ha, uc_list, list) { |
1386 | hw_dbg(hw, " Adding the secondary addresses:\n"); | 1387 | hw_dbg(hw, " Adding the secondary addresses:\n"); |
1387 | addr = next(hw, &addr_list, &vmdq); | 1388 | ixgbe_add_uc_addr(hw, ha->addr, 0); |
1388 | ixgbe_add_uc_addr(hw, addr, vmdq); | ||
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | if (hw->addr_ctrl.overflow_promisc) { | 1391 | if (hw->addr_ctrl.overflow_promisc) { |
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h index dd260890ad0a..b2a4b2c99c40 100644 --- a/drivers/net/ixgbe/ixgbe_common.h +++ b/drivers/net/ixgbe/ixgbe_common.h | |||
@@ -59,8 +59,8 @@ s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw); | |||
59 | s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list, | 59 | s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list, |
60 | u32 mc_addr_count, | 60 | u32 mc_addr_count, |
61 | ixgbe_mc_addr_itr func); | 61 | ixgbe_mc_addr_itr func); |
62 | s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list, | 62 | s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, |
63 | u32 addr_count, ixgbe_mc_addr_itr func); | 63 | struct list_head *uc_list); |
64 | s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw); | 64 | s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw); |
65 | s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw); | 65 | s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw); |
66 | s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); | 66 | s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 924aa5ed02ce..de70a2df9aeb 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2181,11 +2181,7 @@ static void ixgbe_set_rx_mode(struct net_device *netdev) | |||
2181 | IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl); | 2181 | IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl); |
2182 | 2182 | ||
2183 | /* reprogram secondary unicast list */ | 2183 | /* reprogram secondary unicast list */ |
2184 | addr_count = netdev->uc_count; | 2184 | hw->mac.ops.update_uc_addr_list(hw, &netdev->uc_list); |
2185 | if (addr_count) | ||
2186 | addr_list = netdev->uc_list->dmi_addr; | ||
2187 | hw->mac.ops.update_uc_addr_list(hw, addr_list, addr_count, | ||
2188 | ixgbe_addr_list_itr); | ||
2189 | 2185 | ||
2190 | /* reprogram multicast list */ | 2186 | /* reprogram multicast list */ |
2191 | addr_count = netdev->mc_count; | 2187 | addr_count = netdev->mc_count; |
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h index df1f7034c284..a8a8243d8fdb 100644 --- a/drivers/net/ixgbe/ixgbe_type.h +++ b/drivers/net/ixgbe/ixgbe_type.h | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
32 | #include <linux/mdio.h> | 32 | #include <linux/mdio.h> |
33 | #include <linux/list.h> | ||
33 | 34 | ||
34 | /* Vendor ID */ | 35 | /* Vendor ID */ |
35 | #define IXGBE_INTEL_VENDOR_ID 0x8086 | 36 | #define IXGBE_INTEL_VENDOR_ID 0x8086 |
@@ -2223,8 +2224,7 @@ struct ixgbe_mac_operations { | |||
2223 | s32 (*set_vmdq)(struct ixgbe_hw *, u32, u32); | 2224 | s32 (*set_vmdq)(struct ixgbe_hw *, u32, u32); |
2224 | s32 (*clear_vmdq)(struct ixgbe_hw *, u32, u32); | 2225 | s32 (*clear_vmdq)(struct ixgbe_hw *, u32, u32); |
2225 | s32 (*init_rx_addrs)(struct ixgbe_hw *); | 2226 | s32 (*init_rx_addrs)(struct ixgbe_hw *); |
2226 | s32 (*update_uc_addr_list)(struct ixgbe_hw *, u8 *, u32, | 2227 | s32 (*update_uc_addr_list)(struct ixgbe_hw *, struct list_head *); |
2227 | ixgbe_mc_addr_itr); | ||
2228 | s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32, | 2228 | s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32, |
2229 | ixgbe_mc_addr_itr); | 2229 | ixgbe_mc_addr_itr); |
2230 | s32 (*enable_mc)(struct ixgbe_hw *); | 2230 | s32 (*enable_mc)(struct ixgbe_hw *); |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index d5334b41e4b4..021d9941c292 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -232,7 +232,7 @@ static int macvlan_open(struct net_device *dev) | |||
232 | if (macvlan_addr_busy(vlan->port, dev->dev_addr)) | 232 | if (macvlan_addr_busy(vlan->port, dev->dev_addr)) |
233 | goto out; | 233 | goto out; |
234 | 234 | ||
235 | err = dev_unicast_add(lowerdev, dev->dev_addr, ETH_ALEN); | 235 | err = dev_unicast_add(lowerdev, dev->dev_addr); |
236 | if (err < 0) | 236 | if (err < 0) |
237 | goto out; | 237 | goto out; |
238 | if (dev->flags & IFF_ALLMULTI) { | 238 | if (dev->flags & IFF_ALLMULTI) { |
@@ -244,7 +244,7 @@ static int macvlan_open(struct net_device *dev) | |||
244 | return 0; | 244 | return 0; |
245 | 245 | ||
246 | del_unicast: | 246 | del_unicast: |
247 | dev_unicast_delete(lowerdev, dev->dev_addr, ETH_ALEN); | 247 | dev_unicast_delete(lowerdev, dev->dev_addr); |
248 | out: | 248 | out: |
249 | return err; | 249 | return err; |
250 | } | 250 | } |
@@ -258,7 +258,7 @@ static int macvlan_stop(struct net_device *dev) | |||
258 | if (dev->flags & IFF_ALLMULTI) | 258 | if (dev->flags & IFF_ALLMULTI) |
259 | dev_set_allmulti(lowerdev, -1); | 259 | dev_set_allmulti(lowerdev, -1); |
260 | 260 | ||
261 | dev_unicast_delete(lowerdev, dev->dev_addr, ETH_ALEN); | 261 | dev_unicast_delete(lowerdev, dev->dev_addr); |
262 | 262 | ||
263 | macvlan_hash_del(vlan); | 263 | macvlan_hash_del(vlan); |
264 | return 0; | 264 | return 0; |
@@ -282,10 +282,11 @@ static int macvlan_set_mac_address(struct net_device *dev, void *p) | |||
282 | if (macvlan_addr_busy(vlan->port, addr->sa_data)) | 282 | if (macvlan_addr_busy(vlan->port, addr->sa_data)) |
283 | return -EBUSY; | 283 | return -EBUSY; |
284 | 284 | ||
285 | if ((err = dev_unicast_add(lowerdev, addr->sa_data, ETH_ALEN))) | 285 | err = dev_unicast_add(lowerdev, addr->sa_data); |
286 | if (err) | ||
286 | return err; | 287 | return err; |
287 | 288 | ||
288 | dev_unicast_delete(lowerdev, dev->dev_addr, ETH_ALEN); | 289 | dev_unicast_delete(lowerdev, dev->dev_addr); |
289 | 290 | ||
290 | macvlan_hash_change_addr(vlan, addr->sa_data); | 291 | macvlan_hash_change_addr(vlan, addr->sa_data); |
291 | } | 292 | } |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 1361ddc8d31f..b4e18a58cb1b 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/types.h> | 55 | #include <linux/types.h> |
56 | #include <linux/inet_lro.h> | 56 | #include <linux/inet_lro.h> |
57 | #include <asm/system.h> | 57 | #include <asm/system.h> |
58 | #include <linux/list.h> | ||
58 | 59 | ||
59 | static char mv643xx_eth_driver_name[] = "mv643xx_eth"; | 60 | static char mv643xx_eth_driver_name[] = "mv643xx_eth"; |
60 | static char mv643xx_eth_driver_version[] = "1.4"; | 61 | static char mv643xx_eth_driver_version[] = "1.4"; |
@@ -1721,20 +1722,20 @@ static void uc_addr_set(struct mv643xx_eth_private *mp, unsigned char *addr) | |||
1721 | 1722 | ||
1722 | static u32 uc_addr_filter_mask(struct net_device *dev) | 1723 | static u32 uc_addr_filter_mask(struct net_device *dev) |
1723 | { | 1724 | { |
1724 | struct dev_addr_list *uc_ptr; | 1725 | struct netdev_hw_addr *ha; |
1725 | u32 nibbles; | 1726 | u32 nibbles; |
1726 | 1727 | ||
1727 | if (dev->flags & IFF_PROMISC) | 1728 | if (dev->flags & IFF_PROMISC) |
1728 | return 0; | 1729 | return 0; |
1729 | 1730 | ||
1730 | nibbles = 1 << (dev->dev_addr[5] & 0x0f); | 1731 | nibbles = 1 << (dev->dev_addr[5] & 0x0f); |
1731 | for (uc_ptr = dev->uc_list; uc_ptr != NULL; uc_ptr = uc_ptr->next) { | 1732 | list_for_each_entry(ha, &dev->uc_list, list) { |
1732 | if (memcmp(dev->dev_addr, uc_ptr->da_addr, 5)) | 1733 | if (memcmp(dev->dev_addr, ha->addr, 5)) |
1733 | return 0; | 1734 | return 0; |
1734 | if ((dev->dev_addr[5] ^ uc_ptr->da_addr[5]) & 0xf0) | 1735 | if ((dev->dev_addr[5] ^ ha->addr[5]) & 0xf0) |
1735 | return 0; | 1736 | return 0; |
1736 | 1737 | ||
1737 | nibbles |= 1 << (uc_ptr->da_addr[5] & 0x0f); | 1738 | nibbles |= 1 << (ha->addr[5] & 0x0f); |
1738 | } | 1739 | } |
1739 | 1740 | ||
1740 | return nibbles; | 1741 | return nibbles; |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index edac3a0b02d6..fa61a12c5e15 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/log2.h> | 22 | #include <linux/log2.h> |
23 | #include <linux/jiffies.h> | 23 | #include <linux/jiffies.h> |
24 | #include <linux/crc32.h> | 24 | #include <linux/crc32.h> |
25 | #include <linux/list.h> | ||
25 | 26 | ||
26 | #include <linux/io.h> | 27 | #include <linux/io.h> |
27 | 28 | ||
@@ -6362,6 +6363,7 @@ static void niu_set_rx_mode(struct net_device *dev) | |||
6362 | struct niu *np = netdev_priv(dev); | 6363 | struct niu *np = netdev_priv(dev); |
6363 | int i, alt_cnt, err; | 6364 | int i, alt_cnt, err; |
6364 | struct dev_addr_list *addr; | 6365 | struct dev_addr_list *addr; |
6366 | struct netdev_hw_addr *ha; | ||
6365 | unsigned long flags; | 6367 | unsigned long flags; |
6366 | u16 hash[16] = { 0, }; | 6368 | u16 hash[16] = { 0, }; |
6367 | 6369 | ||
@@ -6383,9 +6385,8 @@ static void niu_set_rx_mode(struct net_device *dev) | |||
6383 | if (alt_cnt) { | 6385 | if (alt_cnt) { |
6384 | int index = 0; | 6386 | int index = 0; |
6385 | 6387 | ||
6386 | for (addr = dev->uc_list; addr; addr = addr->next) { | 6388 | list_for_each_entry(ha, &dev->uc_list, list) { |
6387 | err = niu_set_alt_mac(np, index, | 6389 | err = niu_set_alt_mac(np, index, ha->addr); |
6388 | addr->da_addr); | ||
6389 | if (err) | 6390 | if (err) |
6390 | printk(KERN_WARNING PFX "%s: Error %d " | 6391 | printk(KERN_WARNING PFX "%s: Error %d " |
6391 | "adding alt mac %d\n", | 6392 | "adding alt mac %d\n", |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 6cc5bcd34fb0..0c9ca67f66e6 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -680,6 +680,7 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
680 | u8 promisc, allmulti; | 680 | u8 promisc, allmulti; |
681 | struct virtio_net_ctrl_mac *mac_data; | 681 | struct virtio_net_ctrl_mac *mac_data; |
682 | struct dev_addr_list *addr; | 682 | struct dev_addr_list *addr; |
683 | struct netdev_hw_addr *ha; | ||
683 | void *buf; | 684 | void *buf; |
684 | int i; | 685 | int i; |
685 | 686 | ||
@@ -718,9 +719,9 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
718 | 719 | ||
719 | /* Store the unicast list and count in the front of the buffer */ | 720 | /* Store the unicast list and count in the front of the buffer */ |
720 | mac_data->entries = dev->uc_count; | 721 | mac_data->entries = dev->uc_count; |
721 | addr = dev->uc_list; | 722 | i = 0; |
722 | for (i = 0; i < dev->uc_count; i++, addr = addr->next) | 723 | list_for_each_entry(ha, &dev->uc_list, list) |
723 | memcpy(&mac_data->macs[i][0], addr->da_addr, ETH_ALEN); | 724 | memcpy(&mac_data->macs[i++][0], ha->addr, ETH_ALEN); |
724 | 725 | ||
725 | sg_set_buf(&sg[0], mac_data, | 726 | sg_set_buf(&sg[0], mac_data, |
726 | sizeof(mac_data->entries) + (dev->uc_count * ETH_ALEN)); | 727 | sizeof(mac_data->entries) + (dev->uc_count * ETH_ALEN)); |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 9ca6bab7c9ba..ecd3d06c0d5c 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/etherdevice.h> | 19 | #include <linux/etherdevice.h> |
20 | #include <linux/mii.h> | 20 | #include <linux/mii.h> |
21 | #include <linux/ip.h> | 21 | #include <linux/ip.h> |
22 | #include <linux/list.h> | ||
22 | 23 | ||
23 | #include "qeth_core.h" | 24 | #include "qeth_core.h" |
24 | 25 | ||
@@ -640,6 +641,7 @@ static void qeth_l2_set_multicast_list(struct net_device *dev) | |||
640 | { | 641 | { |
641 | struct qeth_card *card = dev->ml_priv; | 642 | struct qeth_card *card = dev->ml_priv; |
642 | struct dev_addr_list *dm; | 643 | struct dev_addr_list *dm; |
644 | struct netdev_hw_addr *ha; | ||
643 | 645 | ||
644 | if (card->info.type == QETH_CARD_TYPE_OSN) | 646 | if (card->info.type == QETH_CARD_TYPE_OSN) |
645 | return ; | 647 | return ; |
@@ -653,8 +655,8 @@ static void qeth_l2_set_multicast_list(struct net_device *dev) | |||
653 | for (dm = dev->mc_list; dm; dm = dm->next) | 655 | for (dm = dev->mc_list; dm; dm = dm->next) |
654 | qeth_l2_add_mc(card, dm->da_addr, 0); | 656 | qeth_l2_add_mc(card, dm->da_addr, 0); |
655 | 657 | ||
656 | for (dm = dev->uc_list; dm; dm = dm->next) | 658 | list_for_each_entry(ha, &dev->uc_list, list) |
657 | qeth_l2_add_mc(card, dm->da_addr, 1); | 659 | qeth_l2_add_mc(card, ha->addr, 1); |
658 | 660 | ||
659 | spin_unlock_bh(&card->mclock); | 661 | spin_unlock_bh(&card->mclock); |
660 | if (!qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) | 662 | if (!qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) |
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index ce33f107b0a0..f791348871fc 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -182,8 +182,8 @@ static void fcoe_update_src_mac(struct fcoe_ctlr *fip, u8 *old, u8 *new) | |||
182 | fc = fcoe_from_ctlr(fip); | 182 | fc = fcoe_from_ctlr(fip); |
183 | rtnl_lock(); | 183 | rtnl_lock(); |
184 | if (!is_zero_ether_addr(old)) | 184 | if (!is_zero_ether_addr(old)) |
185 | dev_unicast_delete(fc->real_dev, old, ETH_ALEN); | 185 | dev_unicast_delete(fc->real_dev, old); |
186 | dev_unicast_add(fc->real_dev, new, ETH_ALEN); | 186 | dev_unicast_add(fc->real_dev, new); |
187 | rtnl_unlock(); | 187 | rtnl_unlock(); |
188 | } | 188 | } |
189 | 189 | ||
@@ -233,13 +233,11 @@ void fcoe_netdev_cleanup(struct fcoe_softc *fc) | |||
233 | /* Delete secondary MAC addresses */ | 233 | /* Delete secondary MAC addresses */ |
234 | rtnl_lock(); | 234 | rtnl_lock(); |
235 | memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN); | 235 | memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN); |
236 | dev_unicast_delete(fc->real_dev, flogi_maddr, ETH_ALEN); | 236 | dev_unicast_delete(fc->real_dev, flogi_maddr); |
237 | if (!is_zero_ether_addr(fc->ctlr.data_src_addr)) | 237 | if (!is_zero_ether_addr(fc->ctlr.data_src_addr)) |
238 | dev_unicast_delete(fc->real_dev, | 238 | dev_unicast_delete(fc->real_dev, fc->ctlr.data_src_addr); |
239 | fc->ctlr.data_src_addr, ETH_ALEN); | ||
240 | if (fc->ctlr.spma) | 239 | if (fc->ctlr.spma) |
241 | dev_unicast_delete(fc->real_dev, | 240 | dev_unicast_delete(fc->real_dev, fc->ctlr.ctl_src_addr); |
242 | fc->ctlr.ctl_src_addr, ETH_ALEN); | ||
243 | dev_mc_delete(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0); | 241 | dev_mc_delete(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0); |
244 | rtnl_unlock(); | 242 | rtnl_unlock(); |
245 | } | 243 | } |
@@ -347,9 +345,9 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev) | |||
347 | */ | 345 | */ |
348 | rtnl_lock(); | 346 | rtnl_lock(); |
349 | memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN); | 347 | memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN); |
350 | dev_unicast_add(fc->real_dev, flogi_maddr, ETH_ALEN); | 348 | dev_unicast_add(fc->real_dev, flogi_maddr); |
351 | if (fc->ctlr.spma) | 349 | if (fc->ctlr.spma) |
352 | dev_unicast_add(fc->real_dev, fc->ctlr.ctl_src_addr, ETH_ALEN); | 350 | dev_unicast_add(fc->real_dev, fc->ctlr.ctl_src_addr); |
353 | dev_mc_add(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0); | 351 | dev_mc_add(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0); |
354 | rtnl_unlock(); | 352 | rtnl_unlock(); |
355 | 353 | ||