View | Details | Raw Unified | Return to bug 197143 | Differences between
and this patch

Collapse All | Expand All

(-)sys/dev/wpi/if_wpi.c (-14 / +22 lines)
Lines 200-205 Link Here
200
static void	wpi_start(struct ifnet *);
200
static void	wpi_start(struct ifnet *);
201
static void	wpi_start_task(void *, int);
201
static void	wpi_start_task(void *, int);
202
static void	wpi_watchdog_rfkill(void *);
202
static void	wpi_watchdog_rfkill(void *);
203
static void	wpi_scan_timeout(void *);
203
static void	wpi_watchdog(void *);
204
static void	wpi_watchdog(void *);
204
static int	wpi_ioctl(struct ifnet *, u_long, caddr_t);
205
static int	wpi_ioctl(struct ifnet *, u_long, caddr_t);
205
static int	wpi_cmd(struct wpi_softc *, int, const void *, size_t, int);
206
static int	wpi_cmd(struct wpi_softc *, int, const void *, size_t, int);
Lines 520-525 Link Here
520
	wpi_radiotap_attach(sc);
521
	wpi_radiotap_attach(sc);
521
522
522
	callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0);
523
	callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0);
524
	callout_init_mtx(&sc->scan_timeout, &sc->sc_mtx, 0);
523
	callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0);
525
	callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0);
524
	callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0);
526
	callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0);
525
	TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc);
527
	TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc);
Lines 683-690 Link Here
683
685
684
		wpi_stop(sc);
686
		wpi_stop(sc);
685
687
688
		callout_drain(&sc->watchdog_rfkill);
686
		callout_drain(&sc->watchdog_to);
689
		callout_drain(&sc->watchdog_to);
687
		callout_drain(&sc->watchdog_rfkill);
690
		callout_drain(&sc->scan_timeout);
688
		callout_drain(&sc->calib_to);
691
		callout_drain(&sc->calib_to);
689
		ieee80211_ifdetach(ic);
692
		ieee80211_ifdetach(ic);
690
	}
693
	}
Lines 2163-2169 Link Here
2163
			    "scan finished nchan=%d status=%d chan=%d\n",
2166
			    "scan finished nchan=%d status=%d chan=%d\n",
2164
			    scan->nchan, scan->status, scan->chan);
2167
			    scan->nchan, scan->status, scan->chan);
2165
#endif
2168
#endif
2166
			sc->sc_scan_timer = 0;
2169
			callout_stop(&sc->scan_timeout);
2167
			WPI_UNLOCK(sc);
2170
			WPI_UNLOCK(sc);
2168
			ieee80211_scan_next(vap);
2171
			ieee80211_scan_next(vap);
2169
			WPI_LOCK(sc);
2172
			WPI_LOCK(sc);
Lines 2925-2930 Link Here
2925
		ieee80211_runtask(ic, &sc->sc_radioon_task);
2928
		ieee80211_runtask(ic, &sc->sc_radioon_task);
2926
}
2929
}
2927
2930
2931
static void
2932
wpi_scan_timeout(void *arg)
2933
{
2934
	struct wpi_softc *sc = arg;
2935
	struct ifnet *ifp = sc->sc_ifp;
2936
	struct ieee80211com *ic = ifp->if_l2com;
2937
2938
	if_printf(ifp, "scan timeout\n");
2939
	ieee80211_runtask(ic, &sc->sc_reinittask);
2940
}
2941
2928
/**
2942
/**
2929
 * Called every second, wpi_watchdog used by the watch dog timer
2943
 * Called every second, wpi_watchdog used by the watch dog timer
2930
 * to check that the card is still alive
2944
 * to check that the card is still alive
Lines 2946-2960 Link Here
2946
		}
2960
		}
2947
	}
2961
	}
2948
2962
2949
	if (sc->sc_scan_timer > 0) {
2950
		struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
2951
		if (--sc->sc_scan_timer == 0 && vap != NULL) {
2952
			if_printf(ifp, "scan timeout\n");
2953
			ieee80211_cancel_scan(vap);
2954
			ieee80211_runtask(ic, &sc->sc_reinittask);
2955
		}
2956
	}
2957
2958
	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
2963
	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
2959
		callout_reset(&sc->watchdog_to, hz, wpi_watchdog, sc);
2964
		callout_reset(&sc->watchdog_to, hz, wpi_watchdog, sc);
2960
}
2965
}
Lines 3873-3879 Link Here
3873
	 * We are absolutely not allowed to send a scan command when another
3878
	 * We are absolutely not allowed to send a scan command when another
3874
	 * scan command is pending.
3879
	 * scan command is pending.
3875
	 */
3880
	 */
3876
	if (sc->sc_scan_timer) {
3881
	if (callout_pending(&sc->scan_timeout)) {
3877
		device_printf(sc->sc_dev, "%s: called whilst scanning!\n",
3882
		device_printf(sc->sc_dev, "%s: called whilst scanning!\n",
3878
		    __func__);
3883
		    __func__);
3879
3884
Lines 4016-4022 Link Here
4016
	if (error != 0)
4021
	if (error != 0)
4017
		goto fail;
4022
		goto fail;
4018
4023
4019
	sc->sc_scan_timer = 5;
4024
	callout_reset(&sc->scan_timeout, 5*hz, wpi_scan_timeout, sc);
4020
4025
4021
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
4026
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
4022
4027
Lines 5270-5278 Link Here
5270
	sc->txq_active = 0;
5275
	sc->txq_active = 0;
5271
	WPI_TXQ_UNLOCK(sc);
5276
	WPI_TXQ_UNLOCK(sc);
5272
5277
5273
	sc->sc_scan_timer = 0;
5274
	sc->sc_tx_timer = 0;
5278
	sc->sc_tx_timer = 0;
5275
	callout_stop(&sc->watchdog_to);
5279
	callout_stop(&sc->watchdog_to);
5280
	callout_stop(&sc->scan_timeout);
5276
	callout_stop(&sc->calib_to);
5281
	callout_stop(&sc->calib_to);
5277
5282
5278
	IF_LOCK(&ifp->if_snd);
5283
	IF_LOCK(&ifp->if_snd);
Lines 5404-5409 Link Here
5404
5409
5405
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__);
5410
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__);
5406
5411
5412
	if (vap != NULL && (ic->ic_flags & IEEE80211_F_SCAN))
5413
		ieee80211_cancel_scan(vap);
5414
5407
	wpi_stop(sc);
5415
	wpi_stop(sc);
5408
	if (vap != NULL)
5416
	if (vap != NULL)
5409
		ieee80211_stop(vap);
5417
		ieee80211_stop(vap);
(-)sys/dev/wpi/if_wpivar.h (-1 / +2 lines)
Lines 180-185 Link Here
180
	struct callout		calib_to;
180
	struct callout		calib_to;
181
	int			calib_cnt;
181
	int			calib_cnt;
182
182
183
	struct callout		scan_timeout;
184
183
	/* Watch dog timers. */
185
	/* Watch dog timers. */
184
	struct callout		watchdog_to;
186
	struct callout		watchdog_to;
185
	struct callout		watchdog_rfkill;
187
	struct callout		watchdog_rfkill;
Lines 204-210 Link Here
204
	struct mtx		nt_mtx;
206
	struct mtx		nt_mtx;
205
207
206
	int			sc_tx_timer;
208
	int			sc_tx_timer;
207
	int			sc_scan_timer;
208
209
209
	void			(*sc_node_free)(struct ieee80211_node *);
210
	void			(*sc_node_free)(struct ieee80211_node *);
210
	void			(*sc_scan_curchan)(struct ieee80211_scan_state *,
211
	void			(*sc_scan_curchan)(struct ieee80211_scan_state *,

Return to bug 197143