[rdc] fix 015-r6040_fix_multicast.patch not applying
[10.03/openwrt.git] / target / linux / rdc / patches-2.6.30 / 015-r6040_fix_multicast.patch
index f223665..0a14551 100644 (file)
@@ -1,6 +1,6 @@
 --- a/drivers/net/r6040.c
 +++ b/drivers/net/r6040.c
-@@ -70,6 +70,8 @@
+@@ -69,6 +69,8 @@
  
  /* MAC registers */
  #define MCR0          0x00    /* Control register 0 */
@@ -9,7 +9,7 @@
  #define MCR1          0x04    /* Control register 1 */
  #define  MAC_RST      0x0001  /* Reset the MAC */
  #define MBCR          0x08    /* Bus control */
-@@ -837,76 +839,96 @@
+@@ -928,78 +930,96 @@ static void r6040_multicast_list(struct
  {
        struct r6040_private *lp = netdev_priv(dev);
        void __iomem *ioaddr = lp->base;
 +      /* Otherwise, Enable multicast hash table function. */
 +      else {
 +              u32 crc;
-+
-+              lp->mcr0 |= HASH_EN;
  
 -                      if (!(*addrs & 1))
 -                              continue;
++              lp->mcr0 |= HASH_EN;
+-                      crc = ether_crc_le(6, addrs);
 +              for (i = 0; i < MCAST_MAX ; i++) {
 +                      iowrite16(0, ioaddr + MID_1L + 8 * i);
 +                      iowrite16(0, ioaddr + MID_1M + 8 * i);
 +              for (i = 0; i < dev->mc_count; i++) {
 +                      u8 *addrs = dmi->dmi_addr;
 +                      dmi = dmi->next;
--                      crc = ether_crc_le(6, addrs);
++
 +                      crc = ether_crc(ETH_ALEN, addrs);
                        crc >>= 26;
 -                      hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
 +                      hash_table[crc >> 4] |= 1 << (crc & 0xf);
                }
+-              /* Write the index of the hash table */
+-              for (i = 0; i < 4; i++)
+-                      iowrite16(hash_table[i] << 14, ioaddr + MCR1);
 -              /* Fill the MAC hash tables with their values */
-+      }
-+      iowrite16(lp->mcr0, ioaddr + MCR0);
-+
-+      /* Fill the MAC hash tables with their values */
-+      if (lp->mcr0 && HASH_EN) {
-               iowrite16(hash_table[0], ioaddr + MAR0);
-               iowrite16(hash_table[1], ioaddr + MAR1);
-               iowrite16(hash_table[2], ioaddr + MAR2);
-               iowrite16(hash_table[3], ioaddr + MAR3);
-       }
+-              iowrite16(hash_table[0], ioaddr + MAR0);
+-              iowrite16(hash_table[1], ioaddr + MAR1);
+-              iowrite16(hash_table[2], ioaddr + MAR2);
+-              iowrite16(hash_table[3], ioaddr + MAR3);
+-      }
 -      /* Multicast Address 1~4 case */
--      dmi = dev->mc_list;
 -      for (i = 0, dmi; (i < dev->mc_count) && (i < MCAST_MAX); i++) {
 -              adrp = (u16 *)dmi->dmi_addr;
 -              iowrite16(adrp[0], ioaddr + MID_1L + 8*i);
 -              dmi = dmi->next;
 -      }
 -      for (i = dev->mc_count; i < MCAST_MAX; i++) {
--              iowrite16(0xffff, ioaddr + MID_1L + 8*i);
--              iowrite16(0xffff, ioaddr + MID_1M + 8*i);
--              iowrite16(0xffff, ioaddr + MID_1H + 8*i);
--      }
+-              iowrite16(0xffff, ioaddr + MID_0L + 8*i);
+-              iowrite16(0xffff, ioaddr + MID_0M + 8*i);
+-              iowrite16(0xffff, ioaddr + MID_0H + 8*i);
+       }
++      iowrite16(lp->mcr0, ioaddr + MCR0);
++
++      /* Fill the MAC hash tables with their values */
++      if (lp->mcr0 && HASH_EN) {
++              iowrite16(hash_table[0], ioaddr + MAR0);
++              iowrite16(hash_table[1], ioaddr + MAR1);
++              iowrite16(hash_table[2], ioaddr + MAR2);
++              iowrite16(hash_table[3], ioaddr + MAR3);
++      }
 +
 +      spin_unlock_irqrestore(&lp->lock, flags);
  }