diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-18 00:10:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-18 17:47:51 -0500 |
commit | d59079425f6f1be0da995926b5ad1d54d9e4545d (patch) | |
tree | 26eb7414eba48eba2b5760b867c11e252701a9a6 /drivers/staging | |
parent | a92635dc77b14f0f28d45c0fbf91b5064d9d7617 (diff) |
staging: convert to use netdev_for_each_mc_addr
removed needless checks in arlan-main.c and slicoss.c
fixed bug in et131x_netdev.c to actually fill addresses in.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/arlan/arlan-main.c | 25 | ||||
-rw-r--r-- | drivers/staging/et131x/et131x_netdev.c | 15 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet.c | 2 | ||||
-rw-r--r-- | drivers/staging/slicoss/slicoss.c | 16 | ||||
-rw-r--r-- | drivers/staging/vt6655/device_main.c | 6 | ||||
-rw-r--r-- | drivers/staging/vt6656/main_usb.c | 5 | ||||
-rw-r--r-- | drivers/staging/wavelan/wavelan.c | 6 | ||||
-rw-r--r-- | drivers/staging/wavelan/wavelan_cs.c | 9 | ||||
-rw-r--r-- | drivers/staging/wlags49_h2/wl_netdev.c | 16 |
9 files changed, 40 insertions, 60 deletions
diff --git a/drivers/staging/arlan/arlan-main.c b/drivers/staging/arlan/arlan-main.c index 921a082487a1..88fdd53cf5d3 100644 --- a/drivers/staging/arlan/arlan-main.c +++ b/drivers/staging/arlan/arlan-main.c | |||
@@ -1455,10 +1455,10 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short | |||
1455 | #ifdef ARLAN_MULTICAST | 1455 | #ifdef ARLAN_MULTICAST |
1456 | if (!(dev->flags & IFF_ALLMULTI) && | 1456 | if (!(dev->flags & IFF_ALLMULTI) && |
1457 | !(dev->flags & IFF_PROMISC) && | 1457 | !(dev->flags & IFF_PROMISC) && |
1458 | dev->mc_list) | 1458 | !netdev_mc_empty(dev)) |
1459 | { | 1459 | { |
1460 | char hw_dst_addr[6]; | 1460 | char hw_dst_addr[6]; |
1461 | struct dev_mc_list *dmi = dev->mc_list; | 1461 | struct dev_mc_list *dmi; |
1462 | int i; | 1462 | int i; |
1463 | 1463 | ||
1464 | memcpy_fromio(hw_dst_addr, arlan->ultimateDestAddress, 6); | 1464 | memcpy_fromio(hw_dst_addr, arlan->ultimateDestAddress, 6); |
@@ -1469,20 +1469,15 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short | |||
1469 | printk(KERN_ERR "%s mcast 0x0100 \n", dev->name); | 1469 | printk(KERN_ERR "%s mcast 0x0100 \n", dev->name); |
1470 | else if (hw_dst_addr[1] == 0x40) | 1470 | else if (hw_dst_addr[1] == 0x40) |
1471 | printk(KERN_ERR "%s m/bcast 0x0140 \n", dev->name); | 1471 | printk(KERN_ERR "%s m/bcast 0x0140 \n", dev->name); |
1472 | while (dmi) | 1472 | netdev_for_each_mc_entry(dmi, dev) { |
1473 | { | 1473 | if (arlan_debug & ARLAN_DEBUG_HEADER_DUMP) |
1474 | if (dmi->dmi_addrlen == 6) { | 1474 | printk(KERN_ERR "%s mcl %pM\n", |
1475 | if (arlan_debug & ARLAN_DEBUG_HEADER_DUMP) | 1475 | dev->name, dmi->dmi_addr); |
1476 | printk(KERN_ERR "%s mcl %pM\n", | 1476 | for (i = 0; i < 6; i++) |
1477 | dev->name, dmi->dmi_addr); | 1477 | if (dmi->dmi_addr[i] != hw_dst_addr[i]) |
1478 | for (i = 0; i < 6; i++) | ||
1479 | if (dmi->dmi_addr[i] != hw_dst_addr[i]) | ||
1480 | break; | ||
1481 | if (i == 6) | ||
1482 | break; | 1478 | break; |
1483 | } else | 1479 | if (i == 6) |
1484 | printk(KERN_ERR "%s: invalid multicast address length given.\n", dev->name); | 1480 | break; |
1485 | dmi = dmi->next; | ||
1486 | } | 1481 | } |
1487 | /* we reach here if multicast filtering is on and packet | 1482 | /* we reach here if multicast filtering is on and packet |
1488 | * is multicast and not for receive */ | 1483 | * is multicast and not for receive */ |
diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index bc1fad248952..edb78ae9e593 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c | |||
@@ -411,9 +411,9 @@ void et131x_multicast(struct net_device *netdev) | |||
411 | { | 411 | { |
412 | struct et131x_adapter *adapter = netdev_priv(netdev); | 412 | struct et131x_adapter *adapter = netdev_priv(netdev); |
413 | uint32_t PacketFilter = 0; | 413 | uint32_t PacketFilter = 0; |
414 | uint32_t count; | ||
415 | unsigned long flags; | 414 | unsigned long flags; |
416 | struct dev_mc_list *mclist = netdev->mc_list; | 415 | struct dev_mc_list *mclist; |
416 | int i; | ||
417 | 417 | ||
418 | spin_lock_irqsave(&adapter->Lock, flags); | 418 | spin_lock_irqsave(&adapter->Lock, flags); |
419 | 419 | ||
@@ -456,12 +456,13 @@ void et131x_multicast(struct net_device *netdev) | |||
456 | } | 456 | } |
457 | 457 | ||
458 | /* Set values in the private adapter struct */ | 458 | /* Set values in the private adapter struct */ |
459 | adapter->MCAddressCount = netdev_mc_count(netdev); | 459 | i = 0; |
460 | 460 | netdev_for_each_mc_addr(mclist, netdev) { | |
461 | if (!netdev_mc_empty(netdev)) { | 461 | if (i == NIC_MAX_MCAST_LIST) |
462 | count = netdev_mc_count(netdev) - 1; | 462 | break; |
463 | memcpy(adapter->MCList[count], mclist->dmi_addr, ETH_ALEN); | 463 | memcpy(adapter->MCList[i++], mclist->dmi_addr, ETH_ALEN); |
464 | } | 464 | } |
465 | adapter->MCAddressCount = i; | ||
465 | 466 | ||
466 | /* Are the new flags different from the previous ones? If not, then no | 467 | /* Are the new flags different from the previous ones? If not, then no |
467 | * action is required | 468 | * action is required |
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 4cfd4b136b32..220de133a6a5 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c | |||
@@ -382,7 +382,7 @@ static void cvm_oct_common_set_multicast_list(struct net_device *dev) | |||
382 | control.u64 = 0; | 382 | control.u64 = 0; |
383 | control.s.bcst = 1; /* Allow broadcast MAC addresses */ | 383 | control.s.bcst = 1; /* Allow broadcast MAC addresses */ |
384 | 384 | ||
385 | if (dev->mc_list || (dev->flags & IFF_ALLMULTI) || | 385 | if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI) || |
386 | (dev->flags & IFF_PROMISC)) | 386 | (dev->flags & IFF_PROMISC)) |
387 | /* Force accept multicast packets */ | 387 | /* Force accept multicast packets */ |
388 | control.s.mcst = 2; | 388 | control.s.mcst = 2; |
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 8c9d5e5c7702..f5cc01ba4145 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c | |||
@@ -1362,25 +1362,17 @@ static void slic_mcast_set_list(struct net_device *dev) | |||
1362 | { | 1362 | { |
1363 | struct adapter *adapter = (struct adapter *)netdev_priv(dev); | 1363 | struct adapter *adapter = (struct adapter *)netdev_priv(dev); |
1364 | int status = STATUS_SUCCESS; | 1364 | int status = STATUS_SUCCESS; |
1365 | int i; | ||
1366 | char *addresses; | 1365 | char *addresses; |
1367 | struct dev_mc_list *mc_list = dev->mc_list; | 1366 | struct dev_mc_list *mc_list; |
1368 | int mc_count = netdev_mc_count(dev); | ||
1369 | 1367 | ||
1370 | ASSERT(adapter); | 1368 | ASSERT(adapter); |
1371 | 1369 | ||
1372 | for (i = 1; i <= mc_count; i++) { | 1370 | netdev_for_each_mc_addr(mc_list, dev) { |
1373 | addresses = (char *) &mc_list->dmi_addr; | 1371 | addresses = (char *) &mc_list->dmi_addr; |
1374 | if (mc_list->dmi_addrlen == 6) { | 1372 | status = slic_mcast_add_list(adapter, addresses); |
1375 | status = slic_mcast_add_list(adapter, addresses); | 1373 | if (status != STATUS_SUCCESS) |
1376 | if (status != STATUS_SUCCESS) | ||
1377 | break; | ||
1378 | } else { | ||
1379 | status = -EINVAL; | ||
1380 | break; | 1374 | break; |
1381 | } | ||
1382 | slic_mcast_set_bit(adapter, addresses); | 1375 | slic_mcast_set_bit(adapter, addresses); |
1383 | mc_list = mc_list->next; | ||
1384 | } | 1376 | } |
1385 | 1377 | ||
1386 | if (adapter->devflags_prev != dev->flags) { | 1378 | if (adapter->devflags_prev != dev->flags) { |
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 82b3a6e0b15a..0dadb765fece 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
@@ -3082,8 +3082,7 @@ static void device_set_multi(struct net_device *dev) { | |||
3082 | 3082 | ||
3083 | PSMgmtObject pMgmt = pDevice->pMgmt; | 3083 | PSMgmtObject pMgmt = pDevice->pMgmt; |
3084 | u32 mc_filter[2]; | 3084 | u32 mc_filter[2]; |
3085 | int i; | 3085 | struct dev_mc_list *mclist; |
3086 | struct dev_mc_list *mclist; | ||
3087 | 3086 | ||
3088 | 3087 | ||
3089 | VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode)); | 3088 | VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode)); |
@@ -3103,8 +3102,7 @@ static void device_set_multi(struct net_device *dev) { | |||
3103 | } | 3102 | } |
3104 | else { | 3103 | else { |
3105 | memset(mc_filter, 0, sizeof(mc_filter)); | 3104 | memset(mc_filter, 0, sizeof(mc_filter)); |
3106 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); | 3105 | netdev_for_each_mc_addr(mclist, dev) { |
3107 | i++, mclist = mclist->next) { | ||
3108 | int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; | 3106 | int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; |
3109 | mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31)); | 3107 | mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31)); |
3110 | } | 3108 | } |
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 2c6a5350547c..a8e1adbc9592 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c | |||
@@ -1596,7 +1596,7 @@ static void device_set_multi(struct net_device *dev) { | |||
1596 | PSMgmtObject pMgmt = &(pDevice->sMgmtObj); | 1596 | PSMgmtObject pMgmt = &(pDevice->sMgmtObj); |
1597 | u32 mc_filter[2]; | 1597 | u32 mc_filter[2]; |
1598 | int ii; | 1598 | int ii; |
1599 | struct dev_mc_list *mclist; | 1599 | struct dev_mc_list *mclist; |
1600 | BYTE pbyData[8] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; | 1600 | BYTE pbyData[8] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; |
1601 | BYTE byTmpMode = 0; | 1601 | BYTE byTmpMode = 0; |
1602 | int rc; | 1602 | int rc; |
@@ -1632,8 +1632,7 @@ static void device_set_multi(struct net_device *dev) { | |||
1632 | } | 1632 | } |
1633 | else { | 1633 | else { |
1634 | memset(mc_filter, 0, sizeof(mc_filter)); | 1634 | memset(mc_filter, 0, sizeof(mc_filter)); |
1635 | for (ii = 0, mclist = dev->mc_list; mclist && ii < netdev_mc_count(dev); | 1635 | netdev_for_each_mc_addr(mclist, dev) { |
1636 | ii++, mclist = mclist->next) { | ||
1637 | int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; | 1636 | int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; |
1638 | mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31)); | 1637 | mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31)); |
1639 | } | 1638 | } |
diff --git a/drivers/staging/wavelan/wavelan.c b/drivers/staging/wavelan/wavelan.c index 961f1417fb58..54ca63196fdd 100644 --- a/drivers/staging/wavelan/wavelan.c +++ b/drivers/staging/wavelan/wavelan.c | |||
@@ -1387,7 +1387,7 @@ static void wavelan_set_multicast_list(struct net_device * dev) | |||
1387 | } | 1387 | } |
1388 | } else | 1388 | } else |
1389 | /* Are there multicast addresses to send? */ | 1389 | /* Are there multicast addresses to send? */ |
1390 | if (dev->mc_list != (struct dev_mc_list *) NULL) { | 1390 | if (!netdev_mc_empty(dev)) { |
1391 | /* | 1391 | /* |
1392 | * Disable promiscuous mode, but receive all packets | 1392 | * Disable promiscuous mode, but receive all packets |
1393 | * in multicast list | 1393 | * in multicast list |
@@ -3531,7 +3531,7 @@ static void wv_82586_config(struct net_device * dev) | |||
3531 | 3531 | ||
3532 | /* Any address to set? */ | 3532 | /* Any address to set? */ |
3533 | if (lp->mc_count) { | 3533 | if (lp->mc_count) { |
3534 | for (dmi = dev->mc_list; dmi; dmi = dmi->next) | 3534 | netdev_for_each_mc_addr(dmi, dev) |
3535 | outsw(PIOP1(ioaddr), (u16 *) dmi->dmi_addr, | 3535 | outsw(PIOP1(ioaddr), (u16 *) dmi->dmi_addr, |
3536 | WAVELAN_ADDR_SIZE >> 1); | 3536 | WAVELAN_ADDR_SIZE >> 1); |
3537 | 3537 | ||
@@ -3539,7 +3539,7 @@ static void wv_82586_config(struct net_device * dev) | |||
3539 | printk(KERN_DEBUG | 3539 | printk(KERN_DEBUG |
3540 | "%s: wv_82586_config(): set %d multicast addresses:\n", | 3540 | "%s: wv_82586_config(): set %d multicast addresses:\n", |
3541 | dev->name, lp->mc_count); | 3541 | dev->name, lp->mc_count); |
3542 | for (dmi = dev->mc_list; dmi; dmi = dmi->next) | 3542 | netdev_for_each_mc_addr(dmi, dev) |
3543 | printk(KERN_DEBUG " %pM\n", dmi->dmi_addr); | 3543 | printk(KERN_DEBUG " %pM\n", dmi->dmi_addr); |
3544 | #endif | 3544 | #endif |
3545 | } | 3545 | } |
diff --git a/drivers/staging/wavelan/wavelan_cs.c b/drivers/staging/wavelan/wavelan_cs.c index 08fcb226d7d6..04f691d127b4 100644 --- a/drivers/staging/wavelan/wavelan_cs.c +++ b/drivers/staging/wavelan/wavelan_cs.c | |||
@@ -1410,8 +1410,7 @@ wavelan_set_multicast_list(struct net_device * dev) | |||
1410 | } | 1410 | } |
1411 | else | 1411 | else |
1412 | /* If there is some multicast addresses to send */ | 1412 | /* If there is some multicast addresses to send */ |
1413 | if(dev->mc_list != (struct dev_mc_list *) NULL) | 1413 | if (!netdev_mc_empty(dev)) { |
1414 | { | ||
1415 | /* | 1414 | /* |
1416 | * Disable promiscuous mode, but receive all packets | 1415 | * Disable promiscuous mode, but receive all packets |
1417 | * in multicast list | 1416 | * in multicast list |
@@ -3598,13 +3597,13 @@ wv_82593_config(struct net_device * dev) | |||
3598 | /* If any multicast address to set */ | 3597 | /* If any multicast address to set */ |
3599 | if(lp->mc_count) | 3598 | if(lp->mc_count) |
3600 | { | 3599 | { |
3601 | struct dev_mc_list * dmi; | 3600 | struct dev_mc_list *dmi; |
3602 | int addrs_len = WAVELAN_ADDR_SIZE * lp->mc_count; | 3601 | int addrs_len = WAVELAN_ADDR_SIZE * lp->mc_count; |
3603 | 3602 | ||
3604 | #ifdef DEBUG_CONFIG_INFO | 3603 | #ifdef DEBUG_CONFIG_INFO |
3605 | printk(KERN_DEBUG "%s: wv_hw_config(): set %d multicast addresses:\n", | 3604 | printk(KERN_DEBUG "%s: wv_hw_config(): set %d multicast addresses:\n", |
3606 | dev->name, lp->mc_count); | 3605 | dev->name, lp->mc_count); |
3607 | for(dmi=dev->mc_list; dmi; dmi=dmi->next) | 3606 | netdev_for_each_mc_addr(dmi, dev) |
3608 | printk(KERN_DEBUG " %pM\n", dmi->dmi_addr); | 3607 | printk(KERN_DEBUG " %pM\n", dmi->dmi_addr); |
3609 | #endif | 3608 | #endif |
3610 | 3609 | ||
@@ -3613,7 +3612,7 @@ wv_82593_config(struct net_device * dev) | |||
3613 | outb(((TX_BASE >> 8) & PIORH_MASK) | PIORH_SEL_TX, PIORH(base)); | 3612 | outb(((TX_BASE >> 8) & PIORH_MASK) | PIORH_SEL_TX, PIORH(base)); |
3614 | outb(addrs_len & 0xff, PIOP(base)); /* byte count lsb */ | 3613 | outb(addrs_len & 0xff, PIOP(base)); /* byte count lsb */ |
3615 | outb((addrs_len >> 8), PIOP(base)); /* byte count msb */ | 3614 | outb((addrs_len >> 8), PIOP(base)); /* byte count msb */ |
3616 | for(dmi=dev->mc_list; dmi; dmi=dmi->next) | 3615 | netdev_for_each_mc_addr(dmi, dev) |
3617 | outsb(PIOP(base), dmi->dmi_addr, dmi->dmi_addrlen); | 3616 | outsb(PIOP(base), dmi->dmi_addr, dmi->dmi_addrlen); |
3618 | 3617 | ||
3619 | /* reset transmit DMA pointer */ | 3618 | /* reset transmit DMA pointer */ |
diff --git a/drivers/staging/wlags49_h2/wl_netdev.c b/drivers/staging/wlags49_h2/wl_netdev.c index a95ebf881fcd..c33e225bc0e6 100644 --- a/drivers/staging/wlags49_h2/wl_netdev.c +++ b/drivers/staging/wlags49_h2/wl_netdev.c | |||
@@ -1049,7 +1049,7 @@ void wl_multicast( struct net_device *dev ) | |||
1049 | //;?seems reasonable that even an AP-only driver could afford this small additional footprint | 1049 | //;?seems reasonable that even an AP-only driver could afford this small additional footprint |
1050 | 1050 | ||
1051 | int x; | 1051 | int x; |
1052 | struct dev_mc_list *mclist; | 1052 | struct dev_mc_list *mclist; |
1053 | struct wl_private *lp = wl_priv(dev); | 1053 | struct wl_private *lp = wl_priv(dev); |
1054 | unsigned long flags; | 1054 | unsigned long flags; |
1055 | /*------------------------------------------------------------------------*/ | 1055 | /*------------------------------------------------------------------------*/ |
@@ -1072,11 +1072,9 @@ void wl_multicast( struct net_device *dev ) | |||
1072 | 1072 | ||
1073 | DBG_PRINT( " mc_count: %d\n", netdev_mc_count(dev)); | 1073 | DBG_PRINT( " mc_count: %d\n", netdev_mc_count(dev)); |
1074 | 1074 | ||
1075 | for( x = 0, mclist = dev->mc_list; mclist && x < netdev_mc_count(dev); | 1075 | netdev_for_each_mc_addr(mclist, dev) |
1076 | x++, mclist = mclist->next ) { | ||
1077 | DBG_PRINT( " %s (%d)\n", DbgHwAddr(mclist->dmi_addr), | 1076 | DBG_PRINT( " %s (%d)\n", DbgHwAddr(mclist->dmi_addr), |
1078 | mclist->dmi_addrlen ); | 1077 | mclist->dmi_addrlen ); |
1079 | } | ||
1080 | } | 1078 | } |
1081 | #endif /* DBG */ | 1079 | #endif /* DBG */ |
1082 | 1080 | ||
@@ -1120,12 +1118,10 @@ void wl_multicast( struct net_device *dev ) | |||
1120 | lp->ltvRecord.len = ( netdev_mc_count(dev) * 3 ) + 1; | 1118 | lp->ltvRecord.len = ( netdev_mc_count(dev) * 3 ) + 1; |
1121 | lp->ltvRecord.typ = CFG_GROUP_ADDR; | 1119 | lp->ltvRecord.typ = CFG_GROUP_ADDR; |
1122 | 1120 | ||
1123 | for( x = 0, mclist = dev->mc_list; | 1121 | x = 0; |
1124 | ( x < netdev_mc_count(dev)) && ( mclist != NULL ); | 1122 | netdev_for_each_mc_addr(mclist, dev) |
1125 | x++, mclist = mclist->next ) { | 1123 | memcpy(&(lp->ltvRecord.u.u8[x++ * ETH_ALEN]), |
1126 | memcpy( &( lp->ltvRecord.u.u8[x * ETH_ALEN] ), | 1124 | mclist->dmi_addr, ETH_ALEN); |
1127 | mclist->dmi_addr, ETH_ALEN ); | ||
1128 | } | ||
1129 | DBG_PRINT( "Setting multicast list\n" ); | 1125 | DBG_PRINT( "Setting multicast list\n" ); |
1130 | hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); | 1126 | hcf_put_info( &( lp->hcfCtx ), (LTVP)&( lp->ltvRecord )); |
1131 | } else { | 1127 | } else { |