Static void url_txeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) { struct url_chain *c = priv; struct url_softc *sc = c->url_sc; struct ifnet *ifp = GET_IFP(sc); int s; if (sc->sc_dying) return; s = splnet(); DPRINTF(("%s: %s: enter\n", device_xname(sc->sc_dev), __func__)); ifp->if_timer = 0; ifp->if_flags &= ~IFF_OACTIVE; if (status != USBD_NORMAL_COMPLETION) { if (status == USBD_NOT_STARTED || status == USBD_CANCELLED) { splx(s); return; } ifp->if_oerrors++; printf("%s: usb error on tx: %s\n", device_xname(sc->sc_dev), usbd_errstr(status)); if (status == USBD_STALLED) { sc->sc_refcnt++; usbd_clear_endpoint_stall_async(sc->sc_pipe_tx); if (--sc->sc_refcnt < 0) usb_detach_wakeupold(sc->sc_dev); } splx(s); return; } ifp->if_opackets++; m_freem(c->url_mbuf); c->url_mbuf = NULL; if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) url_start(ifp); splx(s); }
Static void url_tick_task(void *xsc) { struct url_softc *sc = xsc; struct ifnet *ifp; struct mii_data *mii; int s; if (sc == NULL) return; DPRINTFN(0xff, ("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); if (sc->sc_dying) return; ifp = GET_IFP(sc); mii = GET_MII(sc); if (mii == NULL) return; s = splnet(); mii_tick(mii); if (!sc->sc_link) { mii_pollstat(mii); if (mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { DPRINTF(("%s: %s: got link\n", USBDEVNAME(sc->sc_dev), __func__)); sc->sc_link++; if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) url_start(ifp); } } usb_callout(sc->sc_stat_ch, hz, url_tick, sc); splx(s); }
Static void url_watchdog(struct ifnet *ifp) { struct url_softc *sc = ifp->if_softc; struct url_chain *c; usbd_status stat; int s; DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__)); ifp->if_oerrors++; printf("%s: watchdog timeout\n", USBDEVNAME(sc->sc_dev)); s = splusb(); c = &sc->sc_cdata.url_tx_chain[0]; usbd_get_xfer_status(c->url_xfer, NULL, NULL, NULL, &stat); url_txeof(c->url_xfer, c, stat); if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) url_start(ifp); splx(s); }