Subject: Upgrade snag with tlp0 in Alpha PWS 433
To: None <current-users@netbsd.org, port-alpha@netbsd.org>
From: Rhialto <rhialto@azenomei.knuffel.net>
List: current-users
Date: 12/29/2004 17:03:34
I'm not sure if this is a generic problem or just Alpha PWS. I
encountered it after upgrading to 2.0 but I suspect it's in -current
too.  (Apart from this the upgrade went perfectly! I didn't even have to
merge my old config files with the new, and my system came up multiuser
fine, although I haven't looked if there are any improvements I can make
now.)

Simply put, my ethernet interface (tlp0, built-in) would not work
anymore after upgrading, claiming "no carrier". Since I had to fiddle
with the media before (my /etc/ifconfig.tlp0 contains "media 10baseT"),
I suspected I had to look in this direction.

While trying to select the various media from ifconfig -m:

tlp0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
        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
 
I got console messages like these:

ifmedia_match: multiple match for 0x23/0xfffffff, selected instance 0
ifmedia_match: multiple match for 0x10000023/0xfffffff, selected instance 0
ifmedia_match: multiple match for 0x20000023/0xfffffff, selected instance 0

The upper nybble appeared to be my "instance" number, if I specified
one. However it was obviously being ignored, the mask being too small to
cover the different values.

The message comes from /sys/net/if_media.c:ifmedia_match() so I added
this little hack:

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

and tadaaaa.. now my tlp0 worked again (with 10baseT instance 1).

In the past, on 1.6.x, I also used to get the message "ifmedia_match:
multiple match for 0x10000023/0xfffffff", but I suppose that back then
instance 0 was indeed the correct one, and that for some reason the
numbering changed with 2.0.

So, I don't know where the mask is coming from exactly, but it's wrong
and should be fixed.

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
tlp0: 10baseT, 10baseT-FDX, 10base2, 10base5

-Olaf.
-- 
                           -- Ceterum censeo "authored[1]" delendum esse.
___ Olaf 'Rhialto' Seibert -- [1] Ugly English neologism[2].
\X/ rhialto/at/xs4all.nl   -- [2] For lawyers whose English/Latin is below par.