From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TA0bT-0000E5-FI for qemu-devel@nongnu.org; Fri, 07 Sep 2012 11:36:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TA0bP-0003yz-4e for qemu-devel@nongnu.org; Fri, 07 Sep 2012 11:36:19 -0400 Received: from hall.aurel32.net ([88.191.126.93]:36742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TA0bO-0003yj-VD for qemu-devel@nongnu.org; Fri, 07 Sep 2012 11:36:15 -0400 Date: Fri, 7 Sep 2012 17:36:07 +0200 From: Aurelien Jarno Message-ID: <20120907153607.GJ6791@ohm.aurel32.net> References: <1345736379-16101-1-git-send-email-aurelien@aurel32.net> <20120907145624.GI6791@ohm.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH ] lan9118: fix multicast filtering List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org On Fri, Sep 07, 2012 at 04:04:16PM +0100, Peter Maydell wrote: > On 7 September 2012 15:56, Aurelien Jarno wrote: > > On Thu, Aug 23, 2012 at 05:39:39PM +0200, Aurelien Jarno wrote: > >> The lan9118 emulation tries to compute the multicast index by calling > >> directly the crc32() function from zlib, but fails to get the correct > >> result. > >> > >> Use the common compute_mcast_idx() function instead, which gives the > >> correct result. This fixes IPv6 support. > >> > >> Signed-off-by: Aurelien Jarno > >> --- > >> hw/lan9118.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/hw/lan9118.c b/hw/lan9118.c > >> index ff0a50b..ceaf96f 100644 > >> --- a/hw/lan9118.c > >> +++ b/hw/lan9118.c > >> @@ -500,7 +500,7 @@ static int lan9118_filter(lan9118_state *s, const uint8_t *addr) > >> } > >> } else { > >> /* Hash matching */ > >> - hash = (crc32(~0, addr, 6) >> 26); > >> + hash = compute_mcast_idx(addr); > >> if (hash & 0x20) { > >> return (s->mac_hashh >> (hash & 0x1f)) & 1; > >> } else { > > > > Ping? > > > > For the record the Linux kernel uses the ether_crc() function for > > smsc911x.c, but also for 8139cp.c, 8139too.c and ethoc.c, which use > > compute_mcast_idx() on the QEMU side. > > Looks ok to me. I did check the data sheet, which helpfully doesn't > say exactly what the CRC function is, and also the zlib docs (which > suggest we should use something that isn't what we were doing here). > So I guess > > Reviewed-by: Peter Maydell > > Happy for you to commit directly or I can put it in arm-devs.next > if you prefer. > Thanks for the review, I have applied it. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net