diff options
author | sam <sam@FreeBSD.org> | 2004-12-08 05:45:59 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2004-12-08 05:45:59 +0000 |
commit | 2c929f635e2ee240aed007e68c7125eeb4f0426f (patch) | |
tree | ae5e1de46e56e4d1d92c6e394de8f5b9ec0353cc /sys/dev/mii | |
parent | bc6df700aa4860ce07ae94d1afda16fa44002a88 (diff) | |
download | FreeBSD-src-2c929f635e2ee240aed007e68c7125eeb4f0426f.zip FreeBSD-src-2c929f635e2ee240aed007e68c7125eeb4f0426f.tar.gz |
Cleanup link state change notification:
o add new if_link_state_change routine that deals with link state changes
o change mii to use if_link_state_change
Diffstat (limited to 'sys/dev/mii')
-rw-r--r-- | sys/dev/mii/mii.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c index 4a5b07c..e3bd5d4 100644 --- a/sys/dev/mii/mii.c +++ b/sys/dev/mii/mii.c @@ -228,47 +228,30 @@ miibus_statchg(dev) return; } -void (*vlan_link_state_p)(struct ifnet *, int); /* XXX: private from if_vlan */ - static void miibus_linkchg(dev) - device_t dev; + device_t dev; { - struct mii_data *mii; - struct ifnet *ifp; - device_t parent; - int link, link_state; + struct mii_data *mii; + device_t parent; + int link_state; parent = device_get_parent(dev); MIIBUS_LINKCHG(parent); mii = device_get_softc(dev); - /* - * Note that each NIC's softc must start with an ifnet structure. - */ - ifp = device_get_softc(parent); if (mii->mii_media_status & IFM_AVALID) { - if (mii->mii_media_status & IFM_ACTIVE) { - link = NOTE_LINKUP; + if (mii->mii_media_status & IFM_ACTIVE) link_state = LINK_STATE_UP; - } else { - link = NOTE_LINKDOWN; + else link_state = LINK_STATE_DOWN; - } - } else { - link = NOTE_LINKINV; + } else link_state = LINK_STATE_UNKNOWN; - } - - /* Notify that the link state has changed. */ - if (ifp->if_link_state != link_state) { - ifp->if_link_state = link_state; - rt_ifmsg(ifp); - KNOTE_UNLOCKED(&ifp->if_klist, link); - if (ifp->if_nvlans != 0) - (*vlan_link_state_p)(ifp, link); - } + /* + * Note that each NIC's softc must start with an ifnet structure. + */ + if_link_state_change(device_get_softc(parent), link_state); } static void |