net/pcmcia: convert to use netdev_for_each_mc_addr
Subsystems (2)
PATCH 1/1 net/pcmcia: convert to use netdev_for_each_mc_addr
removed fill_multicast_tbl function in smc91c92_cs and do the work inline
rewritten set_addresses function in xirc2ps_cs. This was kinda headache. Simulated the original and new functions and they bahave the same.
Signed-off-by Jiri Pirko <[email protected]>
--- drivers/net/pcmcia/axnet_cs.c | 7 +-- drivers/net/pcmcia/fmvj18x_cs.c | 6 +-- drivers/net/pcmcia/nmclan_cs.c | 6 +-- drivers/net/pcmcia/smc91c92_cs.c | 33 +++++---------- drivers/net/pcmcia/xirc2ps_cs.c | 84 ++++++++++++++++++++++--------------- 5 files changed, 67 insertions(+), 69 deletions(-)
drivers/net/pcmcia/axnet_cs.c +3 -4
@@ -1625,8 +1625,7 @@ static inline void make_mc_bits(u8 *bits, struct net_device *dev)struct dev_mc_list *dmi;u32 crc; -for (dmi=dev->mc_list; dmi; dmi=dmi->next) { - +netdev_for_each_mc_addr (dmi, dev) { crc =ether_crc (ETH_ALEN , dmi->dmi_addr);/* * The 8390 uses the 6 most significant bits of the
@@ -1652,7 +1651,7 @@ static void do_set_multicast_list(struct net_device *dev)if (!(dev->flags&(IFF_PROMISC |IFF_ALLMULTI ))) {memset (ei_local->mcfilter,0 ,8 ); -if (dev->mc_list) +if (!netdev_mc_empty (dev))make_mc_bits (ei_local->mcfilter, dev); }else {/* set to accept-all */
@@ -1668,7 +1667,7 @@ static void do_set_multicast_list(struct net_device *dev)if (dev->flags&IFF_PROMISC )outb_p (E8390_RXCONFIG |0x58 , e8390_base +EN0_RXCR ); -else if (dev->flags&IFF_ALLMULTI || dev->mc_list) +else if (dev->flags &IFF_ALLMULTI || !netdev_mc_empty (dev))outb_p (E8390_RXCONFIG |0x48 , e8390_base +EN0_RXCR );else outb_p (E8390_RXCONFIG |0x40 , e8390_base +EN0_RXCR );
drivers/net/pcmcia/fmvj18x_cs.c +2 -4
@@ -1199,10 +1199,8 @@ static void set_rx_mode(struct net_device *dev)struct dev_mc_list *mclist;memset (mc_filter,0 ,sizeof (mc_filter)); -for (i =0 , mclist = dev->mc_list; mclist && i <netdev_mc_count (dev); - i++, mclist = mclist->next) { -unsigned int bit = -ether_crc_le (ETH_ALEN , mclist->dmi_addr) >>26 ; +netdev_for_each_mc_addr (mclist, dev) { +unsigned int bit =ether_crc_le (ETH_ALEN , mclist->dmi_addr) >>26 ; mc_filter[bit >>3 ] |= (1 << (bit &7 )); }outb (2 , ioaddr +RX_MODE );/* Use normal mode. */
drivers/net/pcmcia/nmclan_cs.c +2 -4
@@ -1475,8 +1475,7 @@ static void set_multicast_list(struct net_device *dev) {mace_private *lp =netdev_priv (dev);int adr[ETHER_ADDR_LEN ] = {0 };/* Ethernet address */ -int i; -struct dev_mc_list *dmi = dev->mc_list; +struct dev_mc_list *dmi;#ifdef PCMCIA_DEBUG {
@@ -1496,9 +1495,8 @@ static void set_multicast_list(struct net_device *dev)if (num_addrs >0 ) {/* Calculate multicast logical address filter */ memset (lp->multicast_ladrf,0 ,MACE_LADRF_LEN ); -for (i =0 ; i <netdev_mc_count (dev); i++) { +netdev_for_each_mc_addr (dmi, dev) {memcpy (adr, dmi->dmi_addr,ETHER_ADDR_LEN ); - dmi = dmi->next;BuildLAF (lp->multicast_ladrf, adr); } }
drivers/net/pcmcia/smc91c92_cs.c +10 -23
@@ -1595,27 +1595,6 @@ static void smc_rx(struct net_device *dev)/*====================================================================== -Calculate values for the hardware multicast filter hash table. - -======================================================================*/ - -static void fill_multicast_tbl (int count,struct dev_mc_list *addrs, -u_char *multicast_table) -{ -struct dev_mc_list *mc_addr; - -for (mc_addr = addrs; mc_addr && count-- >0 ; mc_addr = mc_addr->next) { -u_int position =ether_crc (6 , mc_addr->dmi_addr); -#ifndef final_version/* Verify multicast address. */ -if ((mc_addr->dmi_addr[0 ] &1 ) ==0 ) -continue ; -#endif - multicast_table[position >>29 ] |=1 << ((position >>26 ) &7 ); - } -} - -/*====================================================================== -Set the receive mode. This routine is used by both the protocol level to notify us of
@@ -1639,8 +1618,16 @@ static void set_rx_mode(struct net_device *dev) rx_cfg_setting = RxStripCRC | RxEnable | RxAllMulti; else {if (!netdev_mc_empty (dev)) { -fill_multicast_tbl (netdev_mc_count (dev), dev->mc_list, - (u_char *)multicast_table); +struct dev_mc_list *mc_addr; + +netdev_for_each_mc_addr (mc_addr, dev) { +u_int position =ether_crc (6 , mc_addr->dmi_addr); +#ifndef final_version/* Verify multicast address. */ +if ((mc_addr->dmi_addr[0 ] &1 ) ==0 ) +continue ; +#endif + multicast_table[position >>29 ] |=1 << ((position >>26 ) &7 ); + } } rx_cfg_setting = RxStripCRC | RxEnable; }
drivers/net/pcmcia/xirc2ps_cs.c +50 -34
97 lines not on this page · raw message
Signature · 1 line
1.6.6
From: Jiri Pirko <[email protected]>
Date: Fri, 19 Feb 2010 19:48:47 +0100
Quoted 6 lines
removed
fill_multicast_tblfunction insmc91c92_csand do the work inlinerewritten
set_addressesfunction inxirc2ps_cs. This was kinda headache. Simulated the original and new functions and they bahave the same.Signed-off-by Jiri Pirko <[email protected]>
Applied.