diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-17 22:34:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-18 17:47:50 -0500 |
commit | 4302b67e041ea81c8fc233bee1296516e1294a27 (patch) | |
tree | c6160bcf70f321c7436f34033d39180c9043bfd9 /drivers/net/tulip/dmfe.c | |
parent | 5508590c193661bc1484ad7b952af5fceacea40d (diff) |
tulip: convert to use netdev_for_each_mc_addr
also bug in de2104x.c was corrected:
for (i = 0; i < 32; i++) loop should be outside mc_list iteration.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tulip/dmfe.c')
-rw-r--r-- | drivers/net/tulip/dmfe.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index 534afbdb9c91..95b38d803e9b 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -330,8 +330,8 @@ static void poll_dmfe (struct net_device *dev); | |||
330 | static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long); | 330 | static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long); |
331 | static void allocate_rx_buffer(struct dmfe_board_info *); | 331 | static void allocate_rx_buffer(struct dmfe_board_info *); |
332 | static void update_cr6(u32, unsigned long); | 332 | static void update_cr6(u32, unsigned long); |
333 | static void send_filter_frame(struct DEVICE * ,int); | 333 | static void send_filter_frame(struct DEVICE *); |
334 | static void dm9132_id_table(struct DEVICE * ,int); | 334 | static void dm9132_id_table(struct DEVICE *); |
335 | static u16 phy_read(unsigned long, u8, u8, u32); | 335 | static u16 phy_read(unsigned long, u8, u8, u32); |
336 | static void phy_write(unsigned long, u8, u8, u16, u32); | 336 | static void phy_write(unsigned long, u8, u8, u16, u32); |
337 | static void phy_write_1bit(unsigned long, u32); | 337 | static void phy_write_1bit(unsigned long, u32); |
@@ -658,9 +658,9 @@ static void dmfe_init_dm910x(struct DEVICE *dev) | |||
658 | 658 | ||
659 | /* Send setup frame */ | 659 | /* Send setup frame */ |
660 | if (db->chip_id == PCI_DM9132_ID) | 660 | if (db->chip_id == PCI_DM9132_ID) |
661 | dm9132_id_table(dev, netdev_mc_count(dev)); /* DM9132 */ | 661 | dm9132_id_table(dev); /* DM9132 */ |
662 | else | 662 | else |
663 | send_filter_frame(dev, netdev_mc_count(dev)); /* DM9102/DM9102A */ | 663 | send_filter_frame(dev); /* DM9102/DM9102A */ |
664 | 664 | ||
665 | /* Init CR7, interrupt active bit */ | 665 | /* Init CR7, interrupt active bit */ |
666 | db->cr7_data = CR7_DEFAULT; | 666 | db->cr7_data = CR7_DEFAULT; |
@@ -1075,9 +1075,9 @@ static void dmfe_set_filter_mode(struct DEVICE * dev) | |||
1075 | 1075 | ||
1076 | DMFE_DBUG(0, "Set multicast address", mc_count); | 1076 | DMFE_DBUG(0, "Set multicast address", mc_count); |
1077 | if (db->chip_id == PCI_DM9132_ID) | 1077 | if (db->chip_id == PCI_DM9132_ID) |
1078 | dm9132_id_table(dev, mc_count); /* DM9132 */ | 1078 | dm9132_id_table(dev); /* DM9132 */ |
1079 | else | 1079 | else |
1080 | send_filter_frame(dev, mc_count); /* DM9102/DM9102A */ | 1080 | send_filter_frame(dev); /* DM9102/DM9102A */ |
1081 | spin_unlock_irqrestore(&db->lock, flags); | 1081 | spin_unlock_irqrestore(&db->lock, flags); |
1082 | } | 1082 | } |
1083 | 1083 | ||
@@ -1452,7 +1452,7 @@ static void update_cr6(u32 cr6_data, unsigned long ioaddr) | |||
1452 | * This setup frame initilize DM910X address filter mode | 1452 | * This setup frame initilize DM910X address filter mode |
1453 | */ | 1453 | */ |
1454 | 1454 | ||
1455 | static void dm9132_id_table(struct DEVICE *dev, int mc_cnt) | 1455 | static void dm9132_id_table(struct DEVICE *dev) |
1456 | { | 1456 | { |
1457 | struct dev_mc_list *mcptr; | 1457 | struct dev_mc_list *mcptr; |
1458 | u16 * addrptr; | 1458 | u16 * addrptr; |
@@ -1472,15 +1472,14 @@ static void dm9132_id_table(struct DEVICE *dev, int mc_cnt) | |||
1472 | ioaddr += 4; | 1472 | ioaddr += 4; |
1473 | 1473 | ||
1474 | /* Clear Hash Table */ | 1474 | /* Clear Hash Table */ |
1475 | for (i = 0; i < 4; i++) | 1475 | memset(hash_table, 0, sizeof(hash_table)); |
1476 | hash_table[i] = 0x0; | ||
1477 | 1476 | ||
1478 | /* broadcast address */ | 1477 | /* broadcast address */ |
1479 | hash_table[3] = 0x8000; | 1478 | hash_table[3] = 0x8000; |
1480 | 1479 | ||
1481 | /* the multicast address in Hash Table : 64 bits */ | 1480 | /* the multicast address in Hash Table : 64 bits */ |
1482 | for (mcptr = dev->mc_list, i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { | 1481 | netdev_for_each_mc_addr(mcptr, dev) { |
1483 | hash_val = cal_CRC( (char *) mcptr->dmi_addr, 6, 0) & 0x3f; | 1482 | hash_val = cal_CRC((char *) mcptr->dmi_addr, 6, 0) & 0x3f; |
1484 | hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16); | 1483 | hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16); |
1485 | } | 1484 | } |
1486 | 1485 | ||
@@ -1495,7 +1494,7 @@ static void dm9132_id_table(struct DEVICE *dev, int mc_cnt) | |||
1495 | * This setup frame initilize DM910X address filter mode | 1494 | * This setup frame initilize DM910X address filter mode |
1496 | */ | 1495 | */ |
1497 | 1496 | ||
1498 | static void send_filter_frame(struct DEVICE *dev, int mc_cnt) | 1497 | static void send_filter_frame(struct DEVICE *dev) |
1499 | { | 1498 | { |
1500 | struct dmfe_board_info *db = netdev_priv(dev); | 1499 | struct dmfe_board_info *db = netdev_priv(dev); |
1501 | struct dev_mc_list *mcptr; | 1500 | struct dev_mc_list *mcptr; |
@@ -1521,14 +1520,14 @@ static void send_filter_frame(struct DEVICE *dev, int mc_cnt) | |||
1521 | *suptr++ = 0xffff; | 1520 | *suptr++ = 0xffff; |
1522 | 1521 | ||
1523 | /* fit the multicast address */ | 1522 | /* fit the multicast address */ |
1524 | for (mcptr = dev->mc_list, i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { | 1523 | netdev_for_each_mc_addr(mcptr, dev) { |
1525 | addrptr = (u16 *) mcptr->dmi_addr; | 1524 | addrptr = (u16 *) mcptr->dmi_addr; |
1526 | *suptr++ = addrptr[0]; | 1525 | *suptr++ = addrptr[0]; |
1527 | *suptr++ = addrptr[1]; | 1526 | *suptr++ = addrptr[1]; |
1528 | *suptr++ = addrptr[2]; | 1527 | *suptr++ = addrptr[2]; |
1529 | } | 1528 | } |
1530 | 1529 | ||
1531 | for (; i<14; i++) { | 1530 | for (i = netdev_mc_count(dev); i < 14; i++) { |
1532 | *suptr++ = 0xffff; | 1531 | *suptr++ = 0xffff; |
1533 | *suptr++ = 0xffff; | 1532 | *suptr++ = 0xffff; |
1534 | *suptr++ = 0xffff; | 1533 | *suptr++ = 0xffff; |