Subject: kern/29228: tlp0 problem on Alpha PWS (with a fix)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Rhialto <rhialto@azenomei.knuffel.net>
List: netbsd-bugs
Date: 02/04/2005 10:36:00
>Number:         29228
>Category:       kern
>Synopsis:       tlp0 problem on Alpha PWS (with a fix)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 04 10:36:00 +0000 2005
>Originator:     Rhialto
>Release:        NetBSD 2.0
>Organization:
>Environment:
System: NetBSD azenomei.falu.nl 2.0 NetBSD 2.0 (AZENOMEI) #1: Wed Dec 29 16:09:12 CET 2004 root@azenomei.falu.nl:/usr/src/sys/arch/alpha/compile/AZENOMEI alpha
Architecture: alpha
Machine: alpha
>Description:
This was partly discussed on current-users in the thread "Upgrade snag
with tlp0 in Alpha PWS 433" starting 29 december 2004:
http://mail-index.netbsd.org/current-users/2004/12/29/0005.html .

In my Alpha PWS I have this ethernet built in:

tlp0 at pci0 dev 3 function 0: DECchip 21143 Ethernet, pass 3.0
tlp0: interrupting at dec 550 irq 0
tlp0: DEC , Ethernet address xx:xx:xx:xx:xx:xx
nsphy0 at tlp0 phy 5: DP83840 10/100 media interface, rev. 1
nsphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
increased mask to 0xffffffff	(this is a debug message of my own)
tlp0: 10baseT, 10baseT-FDX, 10base2, 10base5

        supported Ethernet media:
                media 10baseT
                media 10baseT mediaopt full-duplex
                media 10base2
                media 10base5
                media none instance 1
                media 10baseT instance 1
                media 10baseT mediaopt full-duplex instance 1
                media 100baseTX instance 1
                media 100baseTX mediaopt full-duplex instance 1
                media autoselect instance 1

It does not work at 10baseT. There is "no carrier" according to ifconfig.
Trying to select 10baseT media with an instance other than 0 fails.

The debug message is produced in net/if_media.c where I added this test
in ifmedia_match():

	if (mask == 0x0fffffff) {
	    mask  = 0xffffffff;
#if defined(IFMEDIA_DEBUG)
	    printf("increased mask to 0x%08x\n", mask);
#endif
	}

The mask appears to be originating from IFM_IMASK here:

In dev/ic/tulip.c there is this comment in tlp_2114x_isv_tmsw_init():

	/*
	 * Ignore `instance'; we may get a mixture of SIA and MII
	 * media, and `instance' is used to isolate or select the
	 * PHY on the MII as appropriate.  Note that duplicate media
	 * are disallowed, so ignoring `instance' is safe.
	 */
	ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, tlp_mediachange,
	    tlp_mediastatus);

The use of IFM_IMASK must apparently be changed to 0.

Duplicate media, while apparently disallowed, do occur in my type of
machine.  Ignoring the instance selects the wrong one, and the network
does not work at 10baseT. It only works if I (don't ignore the instance
and) include this in /etc/ifconfig.tlp0:

media 10baseT instance 1

In NetBSD versions before 2.0 it apparently worked by accident, since
the working instance happened to be the first one that was found.

A better fix that omits non-working instances would be nice but is
unfortunately not within my field of knowledge.

>How-To-Repeat:

Boot NetBSD 2.0 on an Alpha PWS 433au, try to use the tulip network adaptor at
10 mbit/s, and see it fail.

>Fix:

As above: The use of IFM_IMASK must apparently be changed to 0.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            --  rhialto/at/falu.nl
\X/ Hi! I'm a signature virus! Copy me to your .signature to help me spread!