diff options
author | Sam Leffler <sam@FreeBSD.org> | 2004-12-08 05:45:59 +0000 |
---|---|---|
committer | Sam Leffler <sam@FreeBSD.org> | 2004-12-08 05:45:59 +0000 |
commit | 94f5c9cfc05215658b60484ae2dd437ada265d92 (patch) | |
tree | ae5e1de46e56e4d1d92c6e394de8f5b9ec0353cc /sys/dev/mii/mii.c | |
parent | 4873d1754f5c86f966a816a4b79693b9ef211fae (diff) |
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
Notes
Notes:
svn path=/head/; revision=138542
Diffstat (limited to 'sys/dev/mii/mii.c')
-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 4a5b07c46f5e..e3bd5d463861 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 |