Deleted Added
full compact
27c27
< __FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 220662 2011-04-15 17:10:52Z bschmidt $");
---
> __FBSDID("$FreeBSD: head/sys/dev/iwn/if_iwn.c 220667 2011-04-15 20:17:52Z bschmidt $");
125a126
> static void iwn_calib_timeout(void *);
128,129d128
< static void iwn_timer_timeout(void *);
< static void iwn_calib_reset(struct iwn_softc *);
164c163
< static void iwn_watchdog(struct iwn_softc *sc);
---
> static void iwn_watchdog(void *);
478d476
< callout_init_mtx(&sc->sc_timer_to, &sc->sc_mtx, 0);
670a669,672
>
> callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0);
> callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0);
>
863c865,866
< callout_drain(&sc->sc_timer_to);
---
> callout_drain(&sc->watchdog_to);
> callout_drain(&sc->calib_to);
1945c1948
< callout_stop(&sc->sc_timer_to);
---
> callout_stop(&sc->calib_to);
1962c1965,1966
< iwn_calib_reset(sc);
---
> sc->calib.state = IWN_CALIB_STATE_INIT;
>
1970,1972c1974,1975
< if (vap->iv_state == IEEE80211_S_RUN &&
< vap->iv_opmode != IEEE80211_M_MONITOR) {
< iwn_calib_reset(sc);
---
> if (vap->iv_state == IEEE80211_S_RUN) {
> sc->calib_cnt = 0;
1983a1987,1990
> case IEEE80211_S_INIT:
> sc->calib.state = IWN_CALIB_STATE_INIT;
> break;
>
1991a1999,2019
> static void
> iwn_calib_timeout(void *arg)
> {
> struct iwn_softc *sc = arg;
>
> IWN_LOCK_ASSERT(sc);
>
> /* Force automatic TX power calibration every 60 secs. */
> if (++sc->calib_cnt >= 120) {
> uint32_t flags = 0;
>
> DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s\n",
> "sending request for statistics");
> (void)iwn_cmd(sc, IWN_CMD_GET_STATISTICS, &flags,
> sizeof flags, 1);
> sc->calib_cnt = 0;
> }
> callout_reset(&sc->calib_to, msecs_to_ticks(500), iwn_calib_timeout,
> sc);
> }
>
2010,2035d2037
< static void
< iwn_timer_timeout(void *arg)
< {
< struct iwn_softc *sc = arg;
< uint32_t flags = 0;
<
< IWN_LOCK_ASSERT(sc);
<
< if (sc->calib_cnt && --sc->calib_cnt == 0) {
< DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s\n",
< "send statistics request");
< (void) iwn_cmd(sc, IWN_CMD_GET_STATISTICS, &flags,
< sizeof flags, 1);
< sc->calib_cnt = 60; /* do calibration every 60s */
< }
< iwn_watchdog(sc); /* NB: piggyback tx watchdog */
< callout_reset(&sc->sc_timer_to, hz, iwn_timer_timeout, sc);
< }
<
< static void
< iwn_calib_reset(struct iwn_softc *sc)
< {
< callout_reset(&sc->sc_timer_to, hz, iwn_timer_timeout, sc);
< sc->calib_cnt = 60; /* do calibration every 60s */
< }
<
2225c2227
< iwn_calib_reset(sc); /* Reset TX power calibration timeout. */
---
> sc->calib_cnt = 0; /* Reset TX power calibration timeout. */
3308a3311,3312
> sc->sc_tx_timer = 5;
>
3355c3359
< iwn_watchdog(struct iwn_softc *sc)
---
> iwn_watchdog(void *arg)
3357,3359c3361,3363
< if (sc->sc_tx_timer > 0 && --sc->sc_tx_timer == 0) {
< struct ifnet *ifp = sc->sc_ifp;
< struct ieee80211com *ic = ifp->if_l2com;
---
> struct iwn_softc *sc = arg;
> struct ifnet *ifp = sc->sc_ifp;
> struct ieee80211com *ic = ifp->if_l2com;
3361,3362c3365,3374
< if_printf(ifp, "device timeout\n");
< ieee80211_runtask(ic, &sc->sc_reinit_task);
---
> IWN_LOCK_ASSERT(sc);
>
> KASSERT(ifp->if_drv_flags & IFF_DRV_RUNNING, ("not running"));
>
> if (sc->sc_tx_timer > 0 || counter == 50) {
> if (--sc->sc_tx_timer == 0 || counter == 50) {
> if_printf(ifp, "device timeout\n");
> ieee80211_runtask(ic, &sc->sc_reinit_task);
> return;
> }
3363a3376
> callout_reset(&sc->watchdog_to, hz, iwn_watchdog, sc);
4763,4764d4775
< sc->calib.state = IWN_CALIB_STATE_INIT;
<
4957c4968,4970
< iwn_calib_reset(sc);
---
> sc->calib_cnt = 0;
> callout_reset(&sc->calib_to, msecs_to_ticks(500), iwn_calib_timeout,
> sc);
6408a6422
> callout_reset(&sc->watchdog_to, hz, iwn_watchdog, sc);
6438c6452,6453
< callout_stop(&sc->sc_timer_to);
---
> callout_stop(&sc->watchdog_to);
> callout_stop(&sc->calib_to);