From nobody@FreeBSD.org  Tue Dec 11 08:32:07 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 3CB6237B416
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Dec 2001 08:32:07 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id fBBGW7w67855;
	Tue, 11 Dec 2001 08:32:07 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200112111632.fBBGW7w67855@freefall.freebsd.org>
Date: Tue, 11 Dec 2001 08:32:07 -0800 (PST)
From: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Tulip ether card EN2242 (if_dc.c) use wrong multicast table
X-Send-Pr-Version: www-1.0

>Number:         32699
>Category:       misc
>Synopsis:       Tulip ether card EN2242 (if_dc.c) use wrong multicast table
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    mbr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 11 08:40:01 PST 2001
>Closed-Date:    Thu May 01 02:32:06 PDT 2003
>Last-Modified:  Thu May 01 02:32:06 PDT 2003
>Originator:     Jean-Luc Richier
>Release:        4.4
>Organization:
LSR-IMAG, Grenoble, France
>Environment:
FreeBSD sonate.imag.fr 4.4-RELEASE FreeBSD 4.4-RELEASE #36: Fri Dec  7 18:44:42 CET 2001     root@sonate.imag.fr:/usr/src/sys/compile/SONATE  i386
>Description:
The ether multicast filter table is incorrectly initialized in the
driver if_dc.c for the ether card of a XE3 HP portable computer..
Therefore multicast are not received and IPv6 does not not work
correctly.
The card is recognized as:
dc0: <Accton EN2242 MiniPCI 10/100BaseTX> port 0x1c00-0x1cff
mem 0xe8000000-0xe80003ff irq 11 at device 16.0 on pci0

>How-To-Repeat:
Configure IPv6 on the computer and try to ping6 hosts not on the local
network. This does not work. ndp -a show that the IPv6 router is not
in the ndp table.
Put the interface in promisc mode using tcpdump and try ping6 again.
This time everything works well, until promisc mode is turned off and
the NDP cache expires.
>Fix:
When looking in the driver source (if_dc.c), one can see that tulip like
cards have two different algorithms to initialize the muticast filter
table.Comparing FreeBSD code which fails and linux 2.4.9 driver
(tulip_core.c) which works, one can see that the function invoked for
the EN2242 card is the incorrect one. Changing the function corrects
the bug. See proposed patch.
The correction is also done for AN985, as the linux code says that the
two cards are similar (but the AN985 is not tested)

Proposed correction:
*** sys/pci/if_dc.c.DIST	Fri Jul 20 04:01:26 2001
--- sys/pci/if_dc.c	Wed Oct 31 13:30:00 2001
***************
*** 1083,1089 ****
  	    ifma = ifma->ifma_link.le_next) {
  		if (ifma->ifma_addr->sa_family != AF_LINK)
  			continue;
! 		h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
  		if (h < 32)
  			hashes[0] |= (1 << h);
  		else
--- 1083,1093 ----
  	    ifma = ifma->ifma_link.le_next) {
  		if (ifma->ifma_addr->sa_family != AF_LINK)
  			continue;
! 		if (DC_IS_CENTAUR(sc))
! 			h = dc_crc_le(sc,
! 				LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
! 		else
! 			h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
  		if (h < 32)
  			hashes[0] |= (1 << h);
  		else
***************
*** 1753,1758 ****
--- 1757,1763 ----
  	case DC_DEVICEID_AN985:
  	case DC_DEVICEID_EN2242:
  		sc->dc_type = DC_TYPE_AN985;
+ 		sc->dc_flags |= DC_64BIT_HASH;
  		sc->dc_flags |= DC_TX_USE_TX_INTR;
  		sc->dc_flags |= DC_TX_ADMTEK_WAR;
  		sc->dc_pmode = DC_PMODE_MII;


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->mbr 
Responsible-Changed-By: mbr 
Responsible-Changed-When: Thu Jan 30 15:45:12 PST 2003 
Responsible-Changed-Why:  
I'll look at this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32699 

From: Scott Mitchell <scott+freebsd@fishballoon.org>
To: freebsd-gnats-submit@FreeBSD.org, Jean-Luc.Richier@imag.fr
Cc:  
Subject: Re: misc/32699: Tulip ether card EN2242 (if_dc.c) use wrong multicast table
Date: Sat, 29 Mar 2003 17:52:58 +0000

 I can confirm that the same problem exists with my AN985-based card on
 -STABLE from March 1st 2003.  It's some kind of Linksys card, can't say
 which one without pulling the machine apart:
 
 dc0: <ADMtek AN985 10/100BaseTX> port 0xb400-0xb4ff mem 0xd9002000-0xd90023ff irq 10 at device 11.0 on pci0
 dc0: Ethernet address: 00:20:78:0d:6b:6b
 
 Jean-Luc's patch still seems to work just fine, although I had to apply it
 by hand since the driver has changed quite a lot since it was posted.
 
 	Scott
State-Changed-From-To: open->closed 
State-Changed-By: mbr 
State-Changed-When: Thu May 1 02:31:46 PDT 2003 
State-Changed-Why:  
Committed, thanks ! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32699 
>Unformatted:
