Date: Fri, 12 Jan 2007 14:37:09 +0100 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-hackers@freebsd.org Subject: mii_bus problem Message-ID: <200701121437.10273.hselasky@c2i.net>
next in thread | raw e-mail | index | archive | help
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. My ifmedia status callback looks like this: static void aue_ifmedia_sts_cb(struct ifnet *ifp, struct ifmediareq *ifmr) { printf("%s:%d\n", __FUNCTION__, __LINE__); struct aue_softc *sc = ifp->if_softc; mtx_lock(&(sc->sc_mtx)); //mii_pollstat(mii); I don't want this here hence it sleeps! ifmr->ifm_active = sc->sc_media_active; ifmr->ifm_status = sc->sc_media_status; mtx_unlock(&(sc->sc_mtx)); return; } The question is, is it at all possible to poll the MII status outside the ifmedia status callback ? And if yes, how? Thanks --HPS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701121437.10273.hselasky>