From nsayer@quack.kfu.com  Mon Nov 19 15:03:28 2001
Return-Path: <nsayer@quack.kfu.com>
Received: from quack.kfu.com (quack.kfu.com [205.178.90.194])
	by hub.freebsd.org (Postfix) with ESMTP id 676E537B416
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Nov 2001 15:03:26 -0800 (PST)
Received: from medusa.kfu.com (medusa.kfu.com [205.178.90.222])
	by quack.kfu.com (8.11.6/8.11.6) with ESMTP id fAJN3KD42566
	(using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified OK)
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Nov 2001 15:03:20 -0800 (PST)
	(envelope-from nsayer@quack.kfu.com)
Received: (from nsayer@localhost)
	by medusa.kfu.com (8.11.6/8.11.6) id fAJFgVD26920;
	Mon, 19 Nov 2001 07:42:31 -0800 (PST)
	(envelope-from nsayer)
Message-Id: <200111191542.fAJFgVD26920@medusa.kfu.com>
Date: Mon, 19 Nov 2001 07:42:31 -0800 (PST)
From: Nick Sayer <nsayer@quack.kfu.com>
Reply-To: Nick Sayer <nsayer@quack.kfu.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: 21143 with dc driver will not select 10baseT/UTP media
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         32118
>Category:       kern
>Synopsis:       [dc] 21143 with dc driver will not select 10baseT/UTP media
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    mbr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 19 15:10:00 PST 2001
>Closed-Date:    Mon Oct 24 08:46:03 GMT 2005
>Last-Modified:  Mon Oct 24 08:46:03 GMT 2005
>Originator:     Nick Sayer
>Release:        FreeBSD 4.4-RELEASE i386
>Organization:
just me
>Environment:
System: FreeBSD medusa.kfu.com 4.4-RELEASE FreeBSD 4.4-RELEASE #12: Tue Nov 13 16:06:42 PST 2001 nsayer@medusa.kfu.com:/usr/obj/usr/src/sys/MEDUSA i386

The card in question is a znyx 4 port card.

[...]
pcib2: <DEC 21152 PCI-PCI bridge> at device 10.0 on pci0
pci2: <PCI bus> on pcib2
[...]
dc0: <Intel 21143 10/100BaseTX> port 0xd800-0xd87f mem 0xdf000000-0xdf0003ff irq 12 at device 4.0 on pci2
dc0: Ethernet address: 00:c0:95:e1:af:10
miibus0: <MII bus> on dc0
dcphy0: <Intel 21143 NWAY media interface> on miibus0
dcphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
dc1: <Intel 21143 10/100BaseTX> port 0xd400-0xd47f mem 0xde800000-0xde8003ff irq 15 at device 5.0 on pci2
dc1: Ethernet address: 00:c0:95:e1:af:11
miibus1: <MII bus> on dc1
dcphy1: <Intel 21143 NWAY media interface> on miibus1
dcphy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
dc2: <Intel 21143 10/100BaseTX> port 0xd000-0xd07f mem 0xde000000-0xde0003ff irq 11 at device 6.0 on pci2
dc2: Ethernet address: 00:c0:95:e1:af:12
miibus2: <MII bus> on dc2
dcphy2: <Intel 21143 NWAY media interface> on miibus2
dcphy2:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
dc3: <Intel 21143 10/100BaseTX> port 0xb800-0xb87f mem 0xdd800000-0xdd8003ff irq 10 at device 7.0 on pci2
dc3: Ethernet address: 00:c0:95:e1:af:13
miibus3: <MII bus> on dc3
dcphy3: <Intel 21143 NWAY media interface> on miibus3
dcphy3:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto


>Description:

I can connect this card to a 100baseTX full- or half-duplex port and it
will autoselect just fine. If I connect this card up to a 10baseT/UTP
hub it will never autoselect. Moreover, if I attempt to force it to
media 10baseT/UTP it will never become active, nor will either device
see a link. If I force 10baseT/UTP mediaopt full-duplex, then it does
get a link and work, but of course every collision becomes an ierr (and
a dropped packet) because it's not really a full-duplex connection.

>How-To-Repeat:

Connect an Intel 21143 chip to a 10baseT/UTP hub.

>Fix:

>Release-Note:
>Audit-Trail:

From: Nick Sayer <nsayer@clicktosecure.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/32118: 21143 with dc driver will not select 10baseT/UTP media
Date: Mon, 26 Nov 2001 10:44:43 -0800

 It turns out we are not reading the SROM correctly in if_dc. If I 
 manually interpret the SROM and put a hack in dc_apply_fixup() with the 
 values I manually picked out, then 10baseT/UTP half duplex works correctly.
 
 The problem is twofold:
 
 1. We are not checking the type of leaf node is present. There are 
 multiple formats with different lengths and data and stuff. The Znyx 
 card uses a format we are not expecting.
 
 2. We are not using all of the data present in the SROM. For example, in 
 the SIA leaf node, we only look at the ctl field, whereas we should 
 first poke the ctl value, then the dat value into the upper 16 bits of 
 DC_WATCHDOG. In that format of leaf node, we should also be overriding 
 the contents of CSR13, 14 and 15 (DC_10BTSTAT, DC_10BTCTL and 
 DC_WATCHDOG) with the values specified in the SROM (however, on my Znyx 
 card, the format is a different one that only has the CTL and DAT 
 values, so the present code is picking garbage data to poke in 
 DC_WATCHDOG in any event).
 
 Andrew Gallatin sent me this sample code:
 
 http://www.tru64unix.compaq.com/docs/dev_doc/DOCUMENTATION/HTML/DDK_R2/usr/opt/OSCB505/src/usr/examples/ddk/src/pci/
 
 
 
Responsible-Changed-From-To: freebsd-bugs->mbr 
Responsible-Changed-By: mbr 
Responsible-Changed-When: Thu Jan 30 15:44:03 PST 2003 
Responsible-Changed-Why:  
I'll look at this. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=32118 
State-Changed-From-To: open->analyzed 
State-Changed-By: mbr 
State-Changed-When: Wed Oct 29 01:58:42 PST 2003 
State-Changed-Why:  
A fix for this problem has been committed. Can you 
confirm it ? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32118 
State-Changed-From-To: analyzed->closed 
State-Changed-By: linimon 
State-Changed-When: Mon Oct 24 08:45:41 GMT 2005 
State-Changed-Why:  
Feedback timeout (> 1 year). 

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