e1000: convert to use netdev_for_each_mc_addr
authorJiri Pirko <jpirko@redhat.com>
Mon, 22 Feb 2010 09:10:44 +0000 (09:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Feb 2010 23:45:51 +0000 (15:45 -0800)
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/e1000/e1000_main.c

index 3b14dd718ab48f63a0a6c0fe47dbdc52bf177c36..c99f95c1b418e5218a25a9e80aeee0b0fcd441ff 100644 (file)
@@ -2161,29 +2161,26 @@ static void e1000_set_rx_mode(struct net_device *netdev)
 
        WARN_ON(i == rar_entries);
 
-       mc_ptr = netdev->mc_list;
-
-       for (; i < rar_entries; i++) {
-               if (mc_ptr) {
-                       e1000_rar_set(hw, mc_ptr->da_addr, i);
-                       mc_ptr = mc_ptr->next;
-               } else {
-                       E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0);
-                       E1000_WRITE_FLUSH();
-                       E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0);
-                       E1000_WRITE_FLUSH();
+       netdev_for_each_mc_addr(mc_ptr, netdev) {
+               if (i == rar_entries) {
+                       /* load any remaining addresses into the hash table */
+                       u32 hash_reg, hash_bit, mta;
+                       hash_value = e1000_hash_mc_addr(hw, mc_ptr->da_addr);
+                       hash_reg = (hash_value >> 5) & 0x7F;
+                       hash_bit = hash_value & 0x1F;
+                       mta = (1 << hash_bit);
+                       mcarray[hash_reg] |= mta;
+               }
+               else {
+                       e1000_rar_set(hw, mc_ptr->da_addr, i++);
                }
        }
 
-       /* load any remaining addresses into the hash table */
-
-       for (; mc_ptr; mc_ptr = mc_ptr->next) {
-               u32 hash_reg, hash_bit, mta;
-               hash_value = e1000_hash_mc_addr(hw, mc_ptr->da_addr);
-               hash_reg = (hash_value >> 5) & 0x7F;
-               hash_bit = hash_value & 0x1F;
-               mta = (1 << hash_bit);
-               mcarray[hash_reg] |= mta;
+       for (; i < rar_entries; i++) {
+               E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0);
+               E1000_WRITE_FLUSH();
+               E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0);
+               E1000_WRITE_FLUSH();
        }
 
        /* write the hash table completely, write from bottom to avoid