Subject: Re: 100baseTX-FDX on HME and the generic MII code
To: None <tech-net@netbsd.org, port-sparc64@netbsd.org>
From: Darren Reed <darrenr@reed.wattle.id.au>
List: tech-net
Date: 05/18/2002 11:16:04
Do in depth discussions about behaviour and patches made to work around
problems end up anywhere but in the mailing list archives ?  Stuff like
the below seems pretty important and doesn't seem to make it into the
source code...(that I can see)

In some email I received from Jason R Thorpe, sie wrote:
> So, after fixing a bug in hme_init() (it wasn't telling the MII code
> to bring up the link), I needed to make one more hack to mii_set_media()
> to make the HME negotiate 100baseTX-FDX.
> 
> Basically, the firmware on my CP1500 seems to disable full-duplex in
> the ANAR, and then enables AUTONEG.  Thus, we get a 100baseTX link.
> 
> Now, as it stands now, mii_set_media() sees that AUTONEG is already set,
> and thus skips starting the Nway cycle again.  This, however, isn't what
> we want.  We want to make sure the ANAR gets the new media bits.
> 
> This is pretty easy to do -- just remove the test for AUTONEG from
> mii_set_media().  Unfortunately, this means a busy-loop delay of
> several milliseconds every time an MII-using Ethernet interface's
> "init" routine is called (hackish patch attached).
> 
> However, it does work:
> 
> cp1500-1:thorpej 1$ ifconfig -a
> hme0: flags=8a63<UP,BROADCAST,NOTRAILERS,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
>         address: 08:00:20:9f:1c:9a
>         media: Ethernet autoselect (100baseTX full-duplex)
>         status: active
>         inet 192.168.2.3 netmask 0xffffff00 broadcast 192.168.2.255
>         inet6 fe80::a00:20ff:fe9f:1c9a%hme0 prefixlen 64 scopeid 0x1
>         inet6 3ffe:507:183:3::3 prefixlen 64
>         inet6 3ffe:507:183:3:a00:20ff:fe9f:1c9a prefixlen 64
> lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 33184
>         inet 127.0.0.1 netmask 0xff000000
>         inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
>         inet6 ::1 prefixlen 128
> cp1500-1:thorpej 2$ 
> 
> So, should I go ahead and commit this (well, a cleaned up version,
> anyway :-)?  Any discussion to be had here?
> 
> -- 
>         -- Jason R. Thorpe <thorpej@wasabisystems.com>

[Attachment, skipping...]