aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/bnx2.c5
-rw-r--r--drivers/net/e1000/e1000_main.c4
-rw-r--r--drivers/net/igb/igb_main.c7
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c7
-rw-r--r--drivers/net/ixgbe/ixgbe_common.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h4
-rw-r--r--drivers/net/mv643xx_eth.c3
-rw-r--r--drivers/net/niu.c4
-rw-r--r--drivers/net/stmmac/dwmac1000_core.c10
-rw-r--r--drivers/net/virtio_net.c12
-rw-r--r--drivers/s390/net/qeth_l2_main.c2
-rw-r--r--include/linux/netdevice.h5
-rw-r--r--net/core/dev.c4
14 files changed, 38 insertions, 33 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d83512d3e02f..a7b6b12c1c05 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -48,7 +48,6 @@
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>
52 51
53#if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE) 52#if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE)
54#define BCM_CNIC 1 53#define BCM_CNIC 1
@@ -3579,14 +3578,14 @@ bnx2_set_rx_mode(struct net_device *dev)
3579 sort_mode |= BNX2_RPM_SORT_USER0_MC_HSH_EN; 3578 sort_mode |= BNX2_RPM_SORT_USER0_MC_HSH_EN;
3580 } 3579 }
3581 3580
3582 if (dev->uc.count > BNX2_MAX_UNICAST_ADDRESSES) { 3581 if (netdev_uc_count(dev) > BNX2_MAX_UNICAST_ADDRESSES) {
3583 rx_mode |= BNX2_EMAC_RX_MODE_PROMISCUOUS; 3582 rx_mode |= BNX2_EMAC_RX_MODE_PROMISCUOUS;
3584 sort_mode |= BNX2_RPM_SORT_USER0_PROM_EN | 3583 sort_mode |= BNX2_RPM_SORT_USER0_PROM_EN |
3585 BNX2_RPM_SORT_USER0_PROM_VLAN; 3584 BNX2_RPM_SORT_USER0_PROM_VLAN;
3586 } else if (!(dev->flags & IFF_PROMISC)) { 3585 } else if (!(dev->flags & IFF_PROMISC)) {
3587 /* Add all entries into to the match filter list */ 3586 /* Add all entries into to the match filter list */
3588 i = 0; 3587 i = 0;
3589 list_for_each_entry(ha, &dev->uc.list, list) { 3588 netdev_for_each_uc_addr(ha, dev) {
3590 bnx2_set_mac_addr(bp, ha->addr, 3589 bnx2_set_mac_addr(bp, ha->addr,
3591 i + BNX2_START_UNICAST_ADDRESS_INDEX); 3590 i + BNX2_START_UNICAST_ADDRESS_INDEX);
3592 sort_mode |= (1 << 3591 sort_mode |= (1 <<
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 87f575ca427d..2ce88c5f75c5 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2139,7 +2139,7 @@ static void e1000_set_rx_mode(struct net_device *netdev)
2139 rctl |= E1000_RCTL_VFE; 2139 rctl |= E1000_RCTL_VFE;
2140 } 2140 }
2141 2141
2142 if (netdev->uc.count > rar_entries - 1) { 2142 if (netdev_uc_count(netdev) > rar_entries - 1) {
2143 rctl |= E1000_RCTL_UPE; 2143 rctl |= E1000_RCTL_UPE;
2144 } else if (!(netdev->flags & IFF_PROMISC)) { 2144 } else if (!(netdev->flags & IFF_PROMISC)) {
2145 rctl &= ~E1000_RCTL_UPE; 2145 rctl &= ~E1000_RCTL_UPE;
@@ -2162,7 +2162,7 @@ static void e1000_set_rx_mode(struct net_device *netdev)
2162 */ 2162 */
2163 i = 1; 2163 i = 1;
2164 if (use_uc) 2164 if (use_uc)
2165 list_for_each_entry(ha, &netdev->uc.list, list) { 2165 netdev_for_each_uc_addr(ha, netdev) {
2166 if (i == rar_entries) 2166 if (i == rar_entries)
2167 break; 2167 break;
2168 e1000_rar_set(hw, ha->addr, i++); 2168 e1000_rar_set(hw, ha->addr, i++);
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index d9679493c635..01cc29483e2f 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -2905,12 +2905,13 @@ static int igb_write_uc_addr_list(struct net_device *netdev)
2905 int count = 0; 2905 int count = 0;
2906 2906
2907 /* return ENOMEM indicating insufficient memory for addresses */ 2907 /* return ENOMEM indicating insufficient memory for addresses */
2908 if (netdev->uc.count > rar_entries) 2908 if (netdev_uc_count(netdev) > rar_entries)
2909 return -ENOMEM; 2909 return -ENOMEM;
2910 2910
2911 if (netdev->uc.count && rar_entries) { 2911 if (!netdev_uc_empty(netdev) && rar_entries) {
2912 struct netdev_hw_addr *ha; 2912 struct netdev_hw_addr *ha;
2913 list_for_each_entry(ha, &netdev->uc.list, list) { 2913
2914 netdev_for_each_uc_addr(ha, netdev) {
2914 if (!rar_entries) 2915 if (!rar_entries)
2915 break; 2916 break;
2916 igb_rar_set_qsel(adapter, ha->addr, 2917 igb_rar_set_qsel(adapter, ha->addr,
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 276c2aaa800b..eb49020903c1 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -28,7 +28,6 @@
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#include <linux/netdevice.h>
33 32
34#include "ixgbe.h" 33#include "ixgbe.h"
@@ -1347,7 +1346,7 @@ static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
1347/** 1346/**
1348 * ixgbe_update_uc_addr_list_generic - Updates MAC list of secondary addresses 1347 * ixgbe_update_uc_addr_list_generic - Updates MAC list of secondary addresses
1349 * @hw: pointer to hardware structure 1348 * @hw: pointer to hardware structure
1350 * @uc_list: the list of new addresses 1349 * @netdev: pointer to net device structure
1351 * 1350 *
1352 * The given list replaces any existing list. Clears the secondary addrs from 1351 * The given list replaces any existing list. Clears the secondary addrs from
1353 * receive address registers. Uses unused receive address registers for the 1352 * receive address registers. Uses unused receive address registers for the
@@ -1357,7 +1356,7 @@ static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
1357 * manually putting the device into promiscuous mode. 1356 * manually putting the device into promiscuous mode.
1358 **/ 1357 **/
1359s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, 1358s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw,
1360 struct list_head *uc_list) 1359 struct net_device *netdev)
1361{ 1360{
1362 u32 i; 1361 u32 i;
1363 u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc; 1362 u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc;
@@ -1381,7 +1380,7 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw,
1381 } 1380 }
1382 1381
1383 /* Add the new addresses */ 1382 /* Add the new addresses */
1384 list_for_each_entry(ha, uc_list, list) { 1383 netdev_for_each_uc_addr(ha, netdev) {
1385 hw_dbg(hw, " Adding the secondary addresses:\n"); 1384 hw_dbg(hw, " Adding the secondary addresses:\n");
1386 ixgbe_add_uc_addr(hw, ha->addr, 0); 1385 ixgbe_add_uc_addr(hw, ha->addr, 0);
1387 } 1386 }
diff --git a/drivers/net/ixgbe/ixgbe_common.h b/drivers/net/ixgbe/ixgbe_common.h
index dfff0ffaa502..13606d4809c9 100644
--- a/drivers/net/ixgbe/ixgbe_common.h
+++ b/drivers/net/ixgbe/ixgbe_common.h
@@ -60,7 +60,7 @@ 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);
62s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, 62s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw,
63 struct list_head *uc_list); 63 struct net_device *netdev);
64s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw); 64s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw);
65s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw); 65s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw);
66s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); 66s32 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 ee41d331a35f..439645d2aeef 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2568,7 +2568,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
2568 IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl); 2568 IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlnctrl);
2569 2569
2570 /* reprogram secondary unicast list */ 2570 /* reprogram secondary unicast list */
2571 hw->mac.ops.update_uc_addr_list(hw, &netdev->uc.list); 2571 hw->mac.ops.update_uc_addr_list(hw, netdev);
2572 2572
2573 /* reprogram multicast list */ 2573 /* reprogram multicast list */
2574 addr_count = netdev->mc_count; 2574 addr_count = netdev->mc_count;
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index b4caa7011a2b..0db67c19b2c4 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -30,7 +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#include <linux/netdevice.h>
34 34
35/* Vendor ID */ 35/* Vendor ID */
36#define IXGBE_INTEL_VENDOR_ID 0x8086 36#define IXGBE_INTEL_VENDOR_ID 0x8086
@@ -2405,7 +2405,7 @@ struct ixgbe_mac_operations {
2405 s32 (*set_vmdq)(struct ixgbe_hw *, u32, u32); 2405 s32 (*set_vmdq)(struct ixgbe_hw *, u32, u32);
2406 s32 (*clear_vmdq)(struct ixgbe_hw *, u32, u32); 2406 s32 (*clear_vmdq)(struct ixgbe_hw *, u32, u32);
2407 s32 (*init_rx_addrs)(struct ixgbe_hw *); 2407 s32 (*init_rx_addrs)(struct ixgbe_hw *);
2408 s32 (*update_uc_addr_list)(struct ixgbe_hw *, struct list_head *); 2408 s32 (*update_uc_addr_list)(struct ixgbe_hw *, struct net_device *);
2409 s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32, 2409 s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32,
2410 ixgbe_mc_addr_itr); 2410 ixgbe_mc_addr_itr);
2411 s32 (*enable_mc)(struct ixgbe_hw *); 2411 s32 (*enable_mc)(struct ixgbe_hw *);
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index af67af55efe7..e24072a9a979 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -55,7 +55,6 @@
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>
59 58
60static char mv643xx_eth_driver_name[] = "mv643xx_eth"; 59static char mv643xx_eth_driver_name[] = "mv643xx_eth";
61static char mv643xx_eth_driver_version[] = "1.4"; 60static char mv643xx_eth_driver_version[] = "1.4";
@@ -1697,7 +1696,7 @@ static u32 uc_addr_filter_mask(struct net_device *dev)
1697 return 0; 1696 return 0;
1698 1697
1699 nibbles = 1 << (dev->dev_addr[5] & 0x0f); 1698 nibbles = 1 << (dev->dev_addr[5] & 0x0f);
1700 list_for_each_entry(ha, &dev->uc.list, list) { 1699 netdev_for_each_uc_addr(ha, dev) {
1701 if (memcmp(dev->dev_addr, ha->addr, 5)) 1700 if (memcmp(dev->dev_addr, ha->addr, 5))
1702 return 0; 1701 return 0;
1703 if ((dev->dev_addr[5] ^ ha->addr[5]) & 0xf0) 1702 if ((dev->dev_addr[5] ^ ha->addr[5]) & 0xf0)
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 0e260cfbff7b..af9a8647c7e8 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -6372,7 +6372,7 @@ static void niu_set_rx_mode(struct net_device *dev)
6372 if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 0)) 6372 if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 0))
6373 np->flags |= NIU_FLAGS_MCAST; 6373 np->flags |= NIU_FLAGS_MCAST;
6374 6374
6375 alt_cnt = dev->uc.count; 6375 alt_cnt = netdev_uc_count(dev);
6376 if (alt_cnt > niu_num_alt_addr(np)) { 6376 if (alt_cnt > niu_num_alt_addr(np)) {
6377 alt_cnt = 0; 6377 alt_cnt = 0;
6378 np->flags |= NIU_FLAGS_PROMISC; 6378 np->flags |= NIU_FLAGS_PROMISC;
@@ -6381,7 +6381,7 @@ static void niu_set_rx_mode(struct net_device *dev)
6381 if (alt_cnt) { 6381 if (alt_cnt) {
6382 int index = 0; 6382 int index = 0;
6383 6383
6384 list_for_each_entry(ha, &dev->uc.list, list) { 6384 netdev_for_each_uc_addr(ha, dev) {
6385 err = niu_set_alt_mac(np, index, ha->addr); 6385 err = niu_set_alt_mac(np, index, ha->addr);
6386 if (err) 6386 if (err)
6387 printk(KERN_WARNING PFX "%s: Error %d " 6387 printk(KERN_WARNING PFX "%s: Error %d "
diff --git a/drivers/net/stmmac/dwmac1000_core.c b/drivers/net/stmmac/dwmac1000_core.c
index 928eac05b912..d812e9cdb3db 100644
--- a/drivers/net/stmmac/dwmac1000_core.c
+++ b/drivers/net/stmmac/dwmac1000_core.c
@@ -83,7 +83,7 @@ static void dwmac1000_set_filter(struct net_device *dev)
83 unsigned int value = 0; 83 unsigned int value = 0;
84 84
85 DBG(KERN_INFO "%s: # mcasts %d, # unicast %d\n", 85 DBG(KERN_INFO "%s: # mcasts %d, # unicast %d\n",
86 __func__, dev->mc_count, dev->uc.count); 86 __func__, dev->mc_count, netdev_uc_count(dev));
87 87
88 if (dev->flags & IFF_PROMISC) 88 if (dev->flags & IFF_PROMISC)
89 value = GMAC_FRAME_FILTER_PR; 89 value = GMAC_FRAME_FILTER_PR;
@@ -117,7 +117,7 @@ static void dwmac1000_set_filter(struct net_device *dev)
117 } 117 }
118 118
119 /* Handle multiple unicast addresses (perfect filtering)*/ 119 /* Handle multiple unicast addresses (perfect filtering)*/
120 if (dev->uc.count > GMAC_MAX_UNICAST_ADDRESSES) 120 if (netdev_uc_count(dev) > GMAC_MAX_UNICAST_ADDRESSES)
121 /* Switch to promiscuous mode is more than 16 addrs 121 /* Switch to promiscuous mode is more than 16 addrs
122 are required */ 122 are required */
123 value |= GMAC_FRAME_FILTER_PR; 123 value |= GMAC_FRAME_FILTER_PR;
@@ -125,9 +125,9 @@ static void dwmac1000_set_filter(struct net_device *dev)
125 int reg = 1; 125 int reg = 1;
126 struct netdev_hw_addr *ha; 126 struct netdev_hw_addr *ha;
127 127
128 list_for_each_entry(ha, &dev->uc.list, list) { 128 netdev_for_each_uc_addr(ha, dev) {
129 dwmac1000_set_umac_addr(ioaddr, ha->addr, reg); 129 dwmac1000_set_umac_addr(ioaddr, ha->addr, reg);
130 reg++; 130 reg++;
131 } 131 }
132 } 132 }
133 133
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index c708ecc3cb2e..088332a943f7 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -675,6 +675,7 @@ static void virtnet_set_rx_mode(struct net_device *dev)
675 struct virtio_net_ctrl_mac *mac_data; 675 struct virtio_net_ctrl_mac *mac_data;
676 struct dev_addr_list *addr; 676 struct dev_addr_list *addr;
677 struct netdev_hw_addr *ha; 677 struct netdev_hw_addr *ha;
678 int uc_count;
678 void *buf; 679 void *buf;
679 int i; 680 int i;
680 681
@@ -701,8 +702,9 @@ static void virtnet_set_rx_mode(struct net_device *dev)
701 dev_warn(&dev->dev, "Failed to %sable allmulti mode.\n", 702 dev_warn(&dev->dev, "Failed to %sable allmulti mode.\n",
702 allmulti ? "en" : "dis"); 703 allmulti ? "en" : "dis");
703 704
705 uc_count = netdev_uc_count(dev);
704 /* MAC filter - use one buffer for both lists */ 706 /* MAC filter - use one buffer for both lists */
705 mac_data = buf = kzalloc(((dev->uc.count + dev->mc_count) * ETH_ALEN) + 707 mac_data = buf = kzalloc(((uc_count + dev->mc_count) * ETH_ALEN) +
706 (2 * sizeof(mac_data->entries)), GFP_ATOMIC); 708 (2 * sizeof(mac_data->entries)), GFP_ATOMIC);
707 if (!buf) { 709 if (!buf) {
708 dev_warn(&dev->dev, "No memory for MAC address buffer\n"); 710 dev_warn(&dev->dev, "No memory for MAC address buffer\n");
@@ -712,16 +714,16 @@ static void virtnet_set_rx_mode(struct net_device *dev)
712 sg_init_table(sg, 2); 714 sg_init_table(sg, 2);
713 715
714 /* Store the unicast list and count in the front of the buffer */ 716 /* Store the unicast list and count in the front of the buffer */
715 mac_data->entries = dev->uc.count; 717 mac_data->entries = uc_count;
716 i = 0; 718 i = 0;
717 list_for_each_entry(ha, &dev->uc.list, list) 719 netdev_for_each_uc_addr(ha, dev)
718 memcpy(&mac_data->macs[i++][0], ha->addr, ETH_ALEN); 720 memcpy(&mac_data->macs[i++][0], ha->addr, ETH_ALEN);
719 721
720 sg_set_buf(&sg[0], mac_data, 722 sg_set_buf(&sg[0], mac_data,
721 sizeof(mac_data->entries) + (dev->uc.count * ETH_ALEN)); 723 sizeof(mac_data->entries) + (uc_count * ETH_ALEN));
722 724
723 /* multicast list and count fill the end */ 725 /* multicast list and count fill the end */
724 mac_data = (void *)&mac_data->macs[dev->uc.count][0]; 726 mac_data = (void *)&mac_data->macs[uc_count][0];
725 727
726 mac_data->entries = dev->mc_count; 728 mac_data->entries = dev->mc_count;
727 addr = dev->mc_list; 729 addr = dev->mc_list;
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index c3258b0dd649..51fde6f2e0b8 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -622,7 +622,7 @@ static void qeth_l2_set_multicast_list(struct net_device *dev)
622 for (dm = dev->mc_list; dm; dm = dm->next) 622 for (dm = dev->mc_list; dm; dm = dm->next)
623 qeth_l2_add_mc(card, dm->da_addr, 0); 623 qeth_l2_add_mc(card, dm->da_addr, 0);
624 624
625 list_for_each_entry(ha, &dev->uc.list, list) 625 netdev_for_each_uc_addr(ha, dev)
626 qeth_l2_add_mc(card, ha->addr, 1); 626 qeth_l2_add_mc(card, ha->addr, 1);
627 627
628 spin_unlock_bh(&card->mclock); 628 spin_unlock_bh(&card->mclock);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b5fb51d0b8b1..93a32a5ca74f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -263,6 +263,11 @@ struct netdev_hw_addr_list {
263 int count; 263 int count;
264}; 264};
265 265
266#define netdev_uc_count(dev) ((dev)->uc.count)
267#define netdev_uc_empty(dev) ((dev)->uc.count == 0)
268#define netdev_for_each_uc_addr(ha, dev) \
269 list_for_each_entry(ha, &dev->uc.list, list)
270
266struct hh_cache { 271struct hh_cache {
267 struct hh_cache *hh_next; /* Next entry */ 272 struct hh_cache *hh_next; /* Next entry */
268 atomic_t hh_refcnt; /* number of users */ 273 atomic_t hh_refcnt; /* number of users */
diff --git a/net/core/dev.c b/net/core/dev.c
index 4fad9db417b1..2cba5c521e56 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3665,10 +3665,10 @@ void __dev_set_rx_mode(struct net_device *dev)
3665 /* Unicast addresses changes may only happen under the rtnl, 3665 /* Unicast addresses changes may only happen under the rtnl,
3666 * therefore calling __dev_set_promiscuity here is safe. 3666 * therefore calling __dev_set_promiscuity here is safe.
3667 */ 3667 */
3668 if (dev->uc.count > 0 && !dev->uc_promisc) { 3668 if (!netdev_uc_empty(dev) && !dev->uc_promisc) {
3669 __dev_set_promiscuity(dev, 1); 3669 __dev_set_promiscuity(dev, 1);
3670 dev->uc_promisc = 1; 3670 dev->uc_promisc = 1;
3671 } else if (dev->uc.count == 0 && dev->uc_promisc) { 3671 } else if (netdev_uc_empty(dev) && dev->uc_promisc) {
3672 __dev_set_promiscuity(dev, -1); 3672 __dev_set_promiscuity(dev, -1);
3673 dev->uc_promisc = 0; 3673 dev->uc_promisc = 0;
3674 } 3674 }