From efd19b8fd01ab0d5b10c78c8eddbd9bed512b11f Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Tue, 14 Feb 2006 12:10:03 +0000 Subject: - Introduce ifmedia_baudrate(), which returns correct baudrate of the given media status. [1] - Utilize ifmedia_baudrate() in miibus_statchg() to update ifp->if_baudrate. Obtained from: NetBSD [1] --- sys/dev/mii/mii.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sys/dev') diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c index c640e1358eba9..25110687b6c2c 100644 --- a/sys/dev/mii/mii.c +++ b/sys/dev/mii/mii.c @@ -240,9 +240,20 @@ static void miibus_statchg(device_t dev) { device_t parent; + struct mii_data *mii; + struct ifnet *ifp; parent = device_get_parent(dev); MIIBUS_STATCHG(parent); + + mii = device_get_softc(dev); + + /* + * Note that each NIC's softc must start with an ifnet pointer. + * XXX: EVIL HACK! + */ + ifp = *(struct ifnet **)device_get_softc(parent); + ifp->if_baudrate = ifmedia_baudrate(mii->mii_media_active); return; } -- cgit v1.3