diff options
author | bms <bms@FreeBSD.org> | 2006-12-19 17:37:41 +0000 |
---|---|---|
committer | bms <bms@FreeBSD.org> | 2006-12-19 17:37:41 +0000 |
commit | 67bf87cf4e1119299b1ac70dc9c3c4a7392a3849 (patch) | |
tree | a080a5cabbf3615f2a1f98fc907276cba559bd2c /sys/dev | |
parent | 40229d31245e432abbbe2605e3916dfa1ddaa17e (diff) | |
download | FreeBSD-src-67bf87cf4e1119299b1ac70dc9c3c4a7392a3849.zip FreeBSD-src-67bf87cf4e1119299b1ac70dc9c3c4a7392a3849.tar.gz |
Remove dependency on deprecated if_watchdog ABI.
Tested with a Sitecom RT2661 based card.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ral/rt2560.c | 25 | ||||
-rw-r--r-- | sys/dev/ral/rt2560var.h | 1 | ||||
-rw-r--r-- | sys/dev/ral/rt2661.c | 23 | ||||
-rw-r--r-- | sys/dev/ral/rt2661var.h | 1 |
4 files changed, 19 insertions, 31 deletions
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c index d29abdb..3acf8b2 100644 --- a/sys/dev/ral/rt2560.c +++ b/sys/dev/ral/rt2560.c @@ -119,7 +119,7 @@ static struct mbuf *rt2560_get_rts(struct rt2560_softc *, static int rt2560_tx_data(struct rt2560_softc *, struct mbuf *, struct ieee80211_node *); static void rt2560_start(struct ifnet *); -static void rt2560_watchdog(struct ifnet *); +static void rt2560_watchdog(void *); static int rt2560_reset(struct ifnet *); static int rt2560_ioctl(struct ifnet *, u_long, caddr_t); static void rt2560_bbp_write(struct rt2560_softc *, uint8_t, @@ -206,6 +206,7 @@ rt2560_attach(device_t dev, int id) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); + callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); callout_init(&sc->scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0); callout_init(&sc->rssadapt_ch, CALLOUT_MPSAFE); @@ -266,7 +267,6 @@ rt2560_attach(device_t dev, int id) ifp->if_init = rt2560_init; ifp->if_ioctl = rt2560_ioctl; ifp->if_start = rt2560_start; - ifp->if_watchdog = rt2560_watchdog; IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; IFQ_SET_READY(&ifp->if_snd); @@ -386,6 +386,7 @@ rt2560_detach(void *xsc) struct ifnet *ifp = ic->ic_ifp; rt2560_stop(sc); + callout_stop(&sc->watchdog_ch); callout_stop(&sc->scan_ch); callout_stop(&sc->rssadapt_ch); @@ -2080,36 +2081,29 @@ rt2560_start(struct ifnet *ifp) } sc->sc_tx_timer = 5; - ifp->if_timer = 1; + callout_reset(&sc->watchdog_ch, hz, rt2560_watchdog, sc); } RAL_UNLOCK(sc); } static void -rt2560_watchdog(struct ifnet *ifp) +rt2560_watchdog(void *arg) { - struct rt2560_softc *sc = ifp->if_softc; + struct rt2560_softc *sc = (struct rt2560_softc *)arg; struct ieee80211com *ic = &sc->sc_ic; - RAL_LOCK(sc); - - ifp->if_timer = 0; - if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { device_printf(sc->sc_dev, "device timeout\n"); rt2560_init(sc); - ifp->if_oerrors++; - RAL_UNLOCK(sc); + sc->sc_ifp->if_oerrors++; return; } - ifp->if_timer = 1; + callout_reset(&sc->watchdog_ch, hz, rt2560_watchdog, sc); } ieee80211_watchdog(ic); - - RAL_UNLOCK(sc); } /* @@ -2769,7 +2763,6 @@ rt2560_stop(void *priv) struct ifnet *ifp = ic->ic_ifp; sc->sc_tx_timer = 0; - ifp->if_timer = 0; ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); @@ -2837,7 +2830,7 @@ rt2560_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, goto bad; } sc->sc_tx_timer = 5; - ifp->if_timer = 1; + callout_reset(&sc->watchdog_ch, hz, rt2560_watchdog, sc); RAL_UNLOCK(sc); diff --git a/sys/dev/ral/rt2560var.h b/sys/dev/ral/rt2560var.h index 2f202b6..50112b5 100644 --- a/sys/dev/ral/rt2560var.h +++ b/sys/dev/ral/rt2560var.h @@ -108,6 +108,7 @@ struct rt2560_softc { struct mtx sc_mtx; + struct callout watchdog_ch; struct callout scan_ch; struct callout rssadapt_ch; diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c index ae2af21..c780edb 100644 --- a/sys/dev/ral/rt2661.c +++ b/sys/dev/ral/rt2661.c @@ -117,7 +117,7 @@ static int rt2661_tx_data(struct rt2661_softc *, struct mbuf *, static int rt2661_tx_mgt(struct rt2661_softc *, struct mbuf *, struct ieee80211_node *); static void rt2661_start(struct ifnet *); -static void rt2661_watchdog(struct ifnet *); +static void rt2661_watchdog(void *); static int rt2661_reset(struct ifnet *); static int rt2661_ioctl(struct ifnet *, u_long, caddr_t); static void rt2661_bbp_write(struct rt2661_softc *, uint8_t, @@ -209,6 +209,7 @@ rt2661_attach(device_t dev, int id) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); + callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); callout_init(&sc->scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0); callout_init(&sc->rssadapt_ch, CALLOUT_MPSAFE); @@ -293,7 +294,6 @@ rt2661_attach(device_t dev, int id) ifp->if_init = rt2661_init; ifp->if_ioctl = rt2661_ioctl; ifp->if_start = rt2661_start; - ifp->if_watchdog = rt2661_watchdog; IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; IFQ_SET_READY(&ifp->if_snd); @@ -407,6 +407,7 @@ rt2661_detach(void *xsc) struct ifnet *ifp = ic->ic_ifp; rt2661_stop(sc); + callout_stop(&sc->watchdog_ch); callout_stop(&sc->scan_ch); callout_stop(&sc->rssadapt_ch); @@ -1853,36 +1854,29 @@ rt2661_start(struct ifnet *ifp) } sc->sc_tx_timer = 5; - ifp->if_timer = 1; + callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog, sc); } RAL_UNLOCK(sc); } static void -rt2661_watchdog(struct ifnet *ifp) +rt2661_watchdog(void *arg) { - struct rt2661_softc *sc = ifp->if_softc; + struct rt2661_softc *sc = (struct rt2661_softc *)arg; struct ieee80211com *ic = &sc->sc_ic; - RAL_LOCK(sc); - - ifp->if_timer = 0; - if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { device_printf(sc->sc_dev, "device timeout\n"); rt2661_init(sc); - ifp->if_oerrors++; - RAL_UNLOCK(sc); + sc->sc_ifp->if_oerrors++; return; } - ifp->if_timer = 1; + callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog, sc); } ieee80211_watchdog(ic); - - RAL_UNLOCK(sc); } /* @@ -2619,7 +2613,6 @@ rt2661_stop(void *priv) uint32_t tmp; sc->sc_tx_timer = 0; - ifp->if_timer = 0; ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); ieee80211_new_state(ic, IEEE80211_S_INIT, -1); diff --git a/sys/dev/ral/rt2661var.h b/sys/dev/ral/rt2661var.h index 9d95ca6..fab2892 100644 --- a/sys/dev/ral/rt2661var.h +++ b/sys/dev/ral/rt2661var.h @@ -101,6 +101,7 @@ struct rt2661_softc { struct mtx sc_mtx; + struct callout watchdog_ch; struct callout scan_ch; struct callout rssadapt_ch; |