Date: Sat, 13 Jan 2007 11:49:19 +0100 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-hackers@freebsd.org Subject: Re: mii_bus problem Message-ID: <200701131149.20182.hselasky@c2i.net> In-Reply-To: <200701121437.10273.hselasky@c2i.net> References: <200701121437.10273.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 12 January 2007 14:37, Hans Petter Selasky wrote: > Hi, > > Can someone here explain from where I can call "mii_pollstat()". I read > somewhere on the internet that I cannot call this function from the so > called "tick" routine, where "mii_tick()" is called. I currently have the > following code: > > static void > aue_cfg_tick(struct aue_softc *sc, > struct aue_config_copy *cc, u_int16_t refcount) > { > printf("%s:%d\n", __FUNCTION__, __LINE__); > > struct ifnet * ifp = sc->sc_ifp; > struct mii_data * mii = GET_MII(sc); > > if ((cc == NULL) || > (ifp == NULL) || > (mii == NULL)) { > /* not ready */ > return; > } > > mii_tick(mii); > > mii_pollstat(mii); > > if ((sc->sc_flags & AUE_FLAG_WAIT_LINK) && > (mii->mii_media_status & IFM_ACTIVE) && > (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)) { > sc->sc_flags &= ~AUE_FLAG_WAIT_LINK; > } > > sc->sc_media_active = mii->mii_media_active; > sc->sc_media_status = mii->mii_media_status; > > /* start stopped transfers, if any */ > > aue_start_transfers(sc); > > return; > } > > > But after this function returns, the kernel corrupts, and it pagefaults in > the "swi6 taskqueue". Commenting out "mii_pollstat()" fixes the kernel > panic. After some debugging I found out that the kernel corrupted because there was not a pointer to "struct ifnet" at the beginning of the softc. I see that some parts of the MII code uses an "EVIL HACK" to get the "struct ifnet" pointer. This should be fixed. Now calling mii_pollstat() works. --HPS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701131149.20182.hselasky>