Subject: Re: [PATCH] at91_ether: multicast packet are not received due to incorrect setting of the multicast hashtable, kernel linux-2.6.17.3

From: Aras Vaichas <[email-masked]>
Date: Mon, 27 Oct 2008 10:51:24 +1100

Leonid Slobodchikov wrote:
> Hello,
>
> Multicast packets are not received by the Ethernet driver for the
> Atmel AT91RM9200. This is due to incorrect mc_filter array index
> evaluation in the at91ether_sethashtable function. The point is that
> AT91_EMAC_HSH and AT91_EMAC_HSL registers are 64-bit length. So when
> evaluating the index the bit number must be diveded at 64, which is
> 2^6, not 2^5.
> The below is a fix for that issue.
>
>
> --- drivers/net/arm/at91_ether.c.orig	2006-06-30 20:37:38.000000000 +0300
> +++ drivers/net/arm/at91_ether.c	2008-10-26 17:35:50.000000000 +0200
> @@ -520,7 +520,7 @@ static void at91ether_sethashtable(struc
>  		if (!curr) break;	/* unexpected end of list */
>
>  		bitnr = hash_get_index(curr->dmi_addr);
> -		mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
> +		mc_filter[bitnr >> 6] |= 1 << (bitnr & 31);
>  	}
>
>  	at91_emac_write(AT91_EMAC_HSH, mc_filter[0]);
>   
Hmm, that is strange. I received a patch quite some time ago from Andrew
Victor to fix just such a problem. Maybe it reappeared? Or maybe I
didn't test my patch patch well enough?

--- SNIP ---

hi Aras,

> I'm using 2.6.16, at91rm9200 with a DM9161 PHY. I can't receive multicast
> packets on eth0 unless I enable "allmulti" using ifconfig - which I
shouldn't
> have to do.

Looks like the bug in the AT91RM9200 Ethernet driver's Multicast support
might have been found.

Since I know you use multicast, could you possibly test this patch
(without enabling "allmulti") and let me know?  Thanks.

Regards.
  Andrew Victor

--- linux-2.6/drivers/net/arm/at91_ether.c.orig  2007-04-25
09:46:29.000000000 +0200
+++ linux-2.6/drivers/net/arm/at91_ether.c      2007-04-25
10:00:25.000000000 +0200
@@ -535,8 +535,8 @@ static void at91ether_sethashtable(struc
                mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
        }

-       at91_emac_write(AT91_EMAC_HSH, mc_filter[0]);
-       at91_emac_write(AT91_EMAC_HSL, mc_filter[1]);
+       at91_emac_write(AT91_EMAC_HSL, mc_filter[0]);
+       at91_emac_write(AT91_EMAC_HSH, mc_filter[1]);
 }

 /*

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php