Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jan 2011 13:32:08 -0800
From:      Pyun YongHyeon <pyunyh@gmail.com>
To:        Lev Serebryakov <lev@serebryakov.spb.ru>
Cc:        freebsd-net@freebsd.org
Subject:   Re: [patch] re(4) problems on networks with disabled autonegotiation "solver" (WAS: Juniper e3k with ports limitied to...) -- REQUEST FOR REVIEW
Message-ID:  <20110112213208.GD12920@michelle.cdnetworks.com>
In-Reply-To: <36074996.20110112192009@serebryakov.spb.ru>
References:  <36074996.20110112192009@serebryakov.spb.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 12, 2011 at 07:20:09PM +0300, Lev Serebryakov wrote:
> Hello, Freebsd-net.
> 
>   Thanks to Pyun YongHyeon, who point me at fact, that rgephy(4) used
> with re(4) does autonegotiation always and all other, who helps me
> diagnose problem!
> 
>   I've prepared patch, which adds tunable/sysctl for rgephy(4) which
> allows not to sue autonegotiation by this PHY (at user responsibility,
> as here is PHYs which CAN NOT live without autonegotiation). It is OFF
> by default, and in such case behavior of driver IS NOT CHANGED.
> 
>   But if it is set ON (non-zero value) before "media / mediopt"
> changes via "ifconfig" autonegotiation IS NOT set with 10/100Mbit
> settings.
> 
>   I've documented this new tunable in re(4) manpage, as here is no
> rgephy(4) manpage.
> 
>   Tunable is per-device, not global one.
> 
>   Sysctl can be set after boot, but will affect only future ifconfig
>  calls, it doesn't change anything in PHY settings by itself.
> 
>   It allows fully manual setup on non-buggy hardware, which allows to
> use Hetzner dedicated servers with FreeBSD without additional NIC or
> gigabit connection.
> 
>   I've tested this patch on FreeBSD 8-STABLE on Hetzner server and it
> allows me to get full-duplex 100Mbit connection and I got 11MiB/s from
> local NFS with it.
> 
>   Without this patch FreeBSD is unusable on Hetzner dedicated servers
> in newer DCs (DC 13 and DC 14).
> 
>   Patch is attached. I think, it worths to include it to base system,
> as it allows use FreeBSD at least on one very large and popular
> hosting provider without additional costs :)
> 

Thanks for your work. After reading commit log of rgephy(4) I now
refreshed my memory. The issue came from the reverse usage case.
Suppose link partner announces auto-negotiation but you want to use
100baseTX/full-duplex. As you know this results in duplex mismatch
and sometimes it couldn't establish a link on some RealTek PHYs.
(Now I'm not entirely sure it was caused by the specific switch or
rgephy(4) or both)
And frequently, link partner(switch) is out of control from your
domain and most switches are configured to use auto-negotiation by
default. Using auto-negotiation in manual media configuration
seemed to address the issue at that time. 1000baseT link always
requires auto-negotiation but too many switches were broken with
auto-negotiation so some switches are forced to use manual media
configuration even in 1000baseT mode. Using auto-negotiation on
rgephy(4) will also solve that case.

So I have mixed feelings on how to handle both cases. Traditional
way, which your patch does, used in manual configuration was to
strictly honor specified manual media configuration even if it can
break in some edge cases. Programming PHYs with traditional way
shall also trigger other problems to drivers which correctly keep
track of valid link state changes. Normally speed/duplex/flow-control
changes require MAC reprogramming such that monitoring PHY's state
change is essential to modern ethernet controllers. Forcing manual
media configuration can make PHY drivers fail to report link state
changes which in turn shall make ethernet controller not to work
due to speed/duplex mismatches between PHY and MAC of ethernet
controller. re(4) does not require MAC reprogramming but many other
drivers that use regephy(4) may not work. However regphy(4)
hardware I have still seem to correctly report link state change
with manual link configuration. Not sure about old controllers
though.

I'm under the impression that rgephy(4)'s behavior seem to confuse
users a lot since it unconditionally use auto-negotiation so I
think it's better not to use auto-negotiation at all during manual
media configuration and provides a way to use auto-negotiation in
manual media configuration if administrator want to do that.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110112213208.GD12920>