aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-02-27 02:35:45 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-28 04:44:01 -0500
commit655ffee284dfcf9a24ac0343f3e5ee6db85b85c5 (patch)
tree83ac4727338e0565baae5bbe9ac8dfa57c69c545
parent9675478bbafed08848bf8d7e28400d5e46330b23 (diff)
wireless: convert to use netdev_for_each_mc_addr
also added missed locking in rndis_wlan.c Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/wireless/libertas/main.c8
-rw-r--r--drivers/net/wireless/orinoco/hw.c22
-rw-r--r--drivers/net/wireless/orinoco/hw.h2
-rw-r--r--drivers/net/wireless/orinoco/main.c3
-rw-r--r--drivers/net/wireless/ray_cs.c8
-rw-r--r--drivers/net/wireless/rndis_wlan.c15
-rw-r--r--drivers/net/wireless/zd1201.c9
7 files changed, 31 insertions, 36 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index cd8ed7fdafad..28a1c9d1627a 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -319,15 +319,18 @@ static int lbs_add_mcast_addrs(struct cmd_ds_mac_multicast_adr *cmd,
319{ 319{
320 int i = nr_addrs; 320 int i = nr_addrs;
321 struct dev_mc_list *mc_list; 321 struct dev_mc_list *mc_list;
322 int cnt;
322 323
323 if ((dev->flags & (IFF_UP|IFF_MULTICAST)) != (IFF_UP|IFF_MULTICAST)) 324 if ((dev->flags & (IFF_UP|IFF_MULTICAST)) != (IFF_UP|IFF_MULTICAST))
324 return nr_addrs; 325 return nr_addrs;
325 326
326 netif_addr_lock_bh(dev); 327 netif_addr_lock_bh(dev);
327 for (mc_list = dev->mc_list; mc_list; mc_list = mc_list->next) { 328 cnt = netdev_mc_count(dev);
329 netdev_for_each_mc_addr(mc_list, dev) {
328 if (mac_in_list(cmd->maclist, nr_addrs, mc_list->dmi_addr)) { 330 if (mac_in_list(cmd->maclist, nr_addrs, mc_list->dmi_addr)) {
329 lbs_deb_net("mcast address %s:%pM skipped\n", dev->name, 331 lbs_deb_net("mcast address %s:%pM skipped\n", dev->name,
330 mc_list->dmi_addr); 332 mc_list->dmi_addr);
333 cnt--;
331 continue; 334 continue;
332 } 335 }
333 336
@@ -337,9 +340,10 @@ static int lbs_add_mcast_addrs(struct cmd_ds_mac_multicast_adr *cmd,
337 lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name, 340 lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name,
338 mc_list->dmi_addr); 341 mc_list->dmi_addr);
339 i++; 342 i++;
343 cnt--;
340 } 344 }
341 netif_addr_unlock_bh(dev); 345 netif_addr_unlock_bh(dev);
342 if (mc_list) 346 if (cnt)
343 return -EOVERFLOW; 347 return -EOVERFLOW;
344 348
345 return i; 349 return i;
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index 404830f47ab2..e6369242e49c 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -1028,7 +1028,7 @@ int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx)
1028} 1028}
1029 1029
1030int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, 1030int __orinoco_hw_set_multicast_list(struct orinoco_private *priv,
1031 struct dev_addr_list *mc_list, 1031 struct net_device *dev,
1032 int mc_count, int promisc) 1032 int mc_count, int promisc)
1033{ 1033{
1034 hermes_t *hw = &priv->hw; 1034 hermes_t *hw = &priv->hw;
@@ -1049,24 +1049,16 @@ int __orinoco_hw_set_multicast_list(struct orinoco_private *priv,
1049 * group address if either we want to multicast, or if we were 1049 * group address if either we want to multicast, or if we were
1050 * multicasting and want to stop */ 1050 * multicasting and want to stop */
1051 if (!promisc && (mc_count || priv->mc_count)) { 1051 if (!promisc && (mc_count || priv->mc_count)) {
1052 struct dev_mc_list *p = mc_list; 1052 struct dev_mc_list *p;
1053 struct hermes_multicast mclist; 1053 struct hermes_multicast mclist;
1054 int i; 1054 int i = 0;
1055 1055
1056 for (i = 0; i < mc_count; i++) { 1056 netdev_for_each_mc_addr(p, dev) {
1057 /* paranoia: is list shorter than mc_count? */ 1057 if (i == mc_count)
1058 BUG_ON(!p); 1058 break;
1059 /* paranoia: bad address size in list? */ 1059 memcpy(mclist.addr[i++], p->dmi_addr, ETH_ALEN);
1060 BUG_ON(p->dmi_addrlen != ETH_ALEN);
1061
1062 memcpy(mclist.addr[i], p->dmi_addr, ETH_ALEN);
1063 p = p->next;
1064 } 1060 }
1065 1061
1066 if (p)
1067 printk(KERN_WARNING "%s: Multicast list is "
1068 "longer than mc_count\n", priv->ndev->name);
1069
1070 err = hermes_write_ltv(hw, USER_BAP, 1062 err = hermes_write_ltv(hw, USER_BAP,
1071 HERMES_RID_CNFGROUPADDRESSES, 1063 HERMES_RID_CNFGROUPADDRESSES,
1072 HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN), 1064 HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN),
diff --git a/drivers/net/wireless/orinoco/hw.h b/drivers/net/wireless/orinoco/hw.h
index e2f7fdc4d45a..9799a1d14a63 100644
--- a/drivers/net/wireless/orinoco/hw.h
+++ b/drivers/net/wireless/orinoco/hw.h
@@ -43,7 +43,7 @@ int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx,
43 u8 *tsc, size_t tsc_len); 43 u8 *tsc, size_t tsc_len);
44int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx); 44int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx);
45int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, 45int __orinoco_hw_set_multicast_list(struct orinoco_private *priv,
46 struct dev_addr_list *mc_list, 46 struct net_device *dev,
47 int mc_count, int promisc); 47 int mc_count, int promisc);
48int orinoco_hw_get_essid(struct orinoco_private *priv, int *active, 48int orinoco_hw_get_essid(struct orinoco_private *priv, int *active,
49 char buf[IW_ESSID_MAX_SIZE+1]); 49 char buf[IW_ESSID_MAX_SIZE+1]);
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index a9e9cea2d767..b42634c614b5 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -1676,8 +1676,7 @@ __orinoco_set_multicast_list(struct net_device *dev)
1676 mc_count = netdev_mc_count(dev); 1676 mc_count = netdev_mc_count(dev);
1677 } 1677 }
1678 1678
1679 err = __orinoco_hw_set_multicast_list(priv, dev->mc_list, mc_count, 1679 err = __orinoco_hw_set_multicast_list(priv, dev, mc_count, promisc);
1680 promisc);
1681 1680
1682 return err; 1681 return err;
1683} 1682}
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 85905cab4f16..84c530aa52f9 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -1871,10 +1871,8 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value,
1871/*===========================================================================*/ 1871/*===========================================================================*/
1872static void ray_update_multi_list(struct net_device *dev, int all) 1872static void ray_update_multi_list(struct net_device *dev, int all)
1873{ 1873{
1874 struct dev_mc_list *dmi, **dmip;
1875 int ccsindex; 1874 int ccsindex;
1876 struct ccs __iomem *pccs; 1875 struct ccs __iomem *pccs;
1877 int i = 0;
1878 ray_dev_t *local = netdev_priv(dev); 1876 ray_dev_t *local = netdev_priv(dev);
1879 struct pcmcia_device *link = local->finder; 1877 struct pcmcia_device *link = local->finder;
1880 void __iomem *p = local->sram + HOST_TO_ECF_BASE; 1878 void __iomem *p = local->sram + HOST_TO_ECF_BASE;
@@ -1895,9 +1893,11 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1895 writeb(0xff, &pccs->var); 1893 writeb(0xff, &pccs->var);
1896 local->num_multi = 0xff; 1894 local->num_multi = 0xff;
1897 } else { 1895 } else {
1896 struct dev_mc_list *dmi;
1897 int i = 0;
1898
1898 /* Copy the kernel's list of MC addresses to card */ 1899 /* Copy the kernel's list of MC addresses to card */
1899 for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; 1900 netdev_for_each_mc_addr(dmi, dev) {
1900 dmip = &dmi->next) {
1901 memcpy_toio(p, dmi->dmi_addr, ETH_ALEN); 1901 memcpy_toio(p, dmi->dmi_addr, ETH_ALEN);
1902 dev_dbg(&link->dev, 1902 dev_dbg(&link->dev,
1903 "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n", 1903 "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n",
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 65cbd060cc30..9f6d6bf06b8e 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1502,6 +1502,7 @@ static void set_multicast_list(struct usbnet *usbdev)
1502 1502
1503 filter = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST; 1503 filter = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST;
1504 1504
1505 netif_addr_lock_bh(usbdev->net);
1505 if (usbdev->net->flags & IFF_PROMISC) { 1506 if (usbdev->net->flags & IFF_PROMISC) {
1506 filter |= RNDIS_PACKET_TYPE_PROMISCUOUS | 1507 filter |= RNDIS_PACKET_TYPE_PROMISCUOUS |
1507 RNDIS_PACKET_TYPE_ALL_LOCAL; 1508 RNDIS_PACKET_TYPE_ALL_LOCAL;
@@ -1515,16 +1516,15 @@ static void set_multicast_list(struct usbnet *usbdev)
1515 netdev_warn(usbdev->net, 1516 netdev_warn(usbdev->net,
1516 "couldn't alloc %d bytes of memory\n", 1517 "couldn't alloc %d bytes of memory\n",
1517 size * ETH_ALEN); 1518 size * ETH_ALEN);
1519 netif_addr_unlock_bh(usbdev->net);
1518 return; 1520 return;
1519 } 1521 }
1520 1522
1521 mclist = usbdev->net->mc_list; 1523 i = 0;
1522 for (i = 0; i < size && mclist; mclist = mclist->next) { 1524 netdev_for_each_mc_addr(mclist, usbdev->net) {
1523 if (mclist->dmi_addrlen != ETH_ALEN) 1525 if (i == size)
1524 continue; 1526 break;
1525 1527 memcpy(buf + i++ * ETH_ALEN, mclist->dmi_addr, ETH_ALEN);
1526 memcpy(buf + i * ETH_ALEN, mclist->dmi_addr, ETH_ALEN);
1527 i++;
1528 } 1528 }
1529 1529
1530 ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, buf, 1530 ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, buf,
@@ -1539,6 +1539,7 @@ static void set_multicast_list(struct usbnet *usbdev)
1539 1539
1540 kfree(buf); 1540 kfree(buf);
1541 } 1541 }
1542 netif_addr_unlock_bh(usbdev->net);
1542 1543
1543 ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter, 1544 ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter,
1544 sizeof(filter)); 1545 sizeof(filter));
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index 5d2b52f4717f..6917286edcae 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -875,17 +875,16 @@ static struct iw_statistics *zd1201_get_wireless_stats(struct net_device *dev)
875static void zd1201_set_multicast(struct net_device *dev) 875static void zd1201_set_multicast(struct net_device *dev)
876{ 876{
877 struct zd1201 *zd = netdev_priv(dev); 877 struct zd1201 *zd = netdev_priv(dev);
878 struct dev_mc_list *mc = dev->mc_list; 878 struct dev_mc_list *mc;
879 unsigned char reqbuf[ETH_ALEN*ZD1201_MAXMULTI]; 879 unsigned char reqbuf[ETH_ALEN*ZD1201_MAXMULTI];
880 int i; 880 int i;
881 881
882 if (netdev_mc_count(dev) > ZD1201_MAXMULTI) 882 if (netdev_mc_count(dev) > ZD1201_MAXMULTI)
883 return; 883 return;
884 884
885 for (i=0; i<netdev_mc_count(dev); i++) { 885 i = 0;
886 memcpy(reqbuf+i*ETH_ALEN, mc->dmi_addr, ETH_ALEN); 886 netdev_for_each_mc_addr(mc, dev)
887 mc = mc->next; 887 memcpy(reqbuf + i++ * ETH_ALEN, mc->dmi_addr, ETH_ALEN);
888 }
889 zd1201_setconfig(zd, ZD1201_RID_CNFGROUPADDRESS, reqbuf, 888 zd1201_setconfig(zd, ZD1201_RID_CNFGROUPADDRESS, reqbuf,
890 netdev_mc_count(dev) * ETH_ALEN, 0); 889 netdev_mc_count(dev) * ETH_ALEN, 0);
891} 890}