Commit patch to supress spurious link change events. Apparently, with
copper NICs, a link change event is posted whenever MII autopolling is toggled off and on, which happens whenever someone calls bge_miibus_readreg() or bge_miibus_writereg() to access the PHY registers. This means anytime someone called the SIOCGIFMEDIA ioctl on a bge interface, the link would reset. Even a simple "ifconfig bge0" would do it, though other apps like dhclient or the PPPoE daemon could trigger it as well. An obvious symptom of this problem is lots of "bgeX: gigabit link up" messages appearing on the console for no apparent reason. Through experimentation, I determined that when a real link change event occurs, the BGE_MIMODE_AUTOPOLL in the BGE_MI_MODE register is always set, so now if we have a copper NIC and an link change event occurs and the BGE_MIMODE_AUTOPOLL bit is clear, we ignore the event. Note that this does not apply to the original BCM5700 chip since we use a different method for sensing link changes with that chip (the status block method was broken), nor to fiber optic NICs since they don't use the GMII PHY access registers.
This commit is contained in:
parent
d6970563b6
commit
dc961de0b4
@ -2802,7 +2802,7 @@ bge_intr(xsc)
|
||||
struct bge_softc *sc;
|
||||
struct ifnet *ifp;
|
||||
u_int32_t statusword;
|
||||
u_int32_t status;
|
||||
u_int32_t status, mimode;
|
||||
|
||||
sc = xsc;
|
||||
ifp = &sc->arpcom.ac_if;
|
||||
@ -2863,10 +2863,19 @@ bge_intr(xsc)
|
||||
* that sometimes appear on fiber NICs during
|
||||
* periods of heavy traffic. (There should be no
|
||||
* effect on copper NICs.)
|
||||
*
|
||||
* If we do have a copper NIC (bge_tbi == 0) then
|
||||
* check that the AUTOPOLL bit is set before
|
||||
* processing the event as a real link change.
|
||||
* Turning AUTOPOLL on and off in the MII read/write
|
||||
* functions will often trigger a link status
|
||||
* interrupt for no reason.
|
||||
*/
|
||||
status = CSR_READ_4(sc, BGE_MAC_STS);
|
||||
mimode = CSR_READ_4(sc, BGE_MI_MODE);
|
||||
if (!(status & (BGE_MACSTAT_PORT_DECODE_ERROR|
|
||||
BGE_MACSTAT_MI_COMPLETE))) {
|
||||
BGE_MACSTAT_MI_COMPLETE)) && (!sc->bge_tbi &&
|
||||
(mimode & BGE_MIMODE_AUTOPOLL))) {
|
||||
sc->bge_link = 0;
|
||||
callout_stop(&sc->bge_stat_ch);
|
||||
bge_tick_locked(sc);
|
||||
|
Loading…
Reference in New Issue
Block a user