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

Collapse All | Expand All

(-)sys/dev/wpi/if_wpi.c (-27 / +16 lines)
Lines 201-207 Link Here
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_scan_timeout(void *);
204
static void	wpi_watchdog(void *);
204
static void	wpi_tx_timeout(void *);
205
static int	wpi_ioctl(struct ifnet *, u_long, caddr_t);
205
static int	wpi_ioctl(struct ifnet *, u_long, caddr_t);
206
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);
207
static int	wpi_mrr_setup(struct wpi_softc *);
207
static int	wpi_mrr_setup(struct wpi_softc *);
Lines 523-529 Link Here
523
523
524
	callout_init_mtx(&sc->calib_to, &sc->rxon_mtx, 0);
524
	callout_init_mtx(&sc->calib_to, &sc->rxon_mtx, 0);
525
	callout_init_mtx(&sc->scan_timeout, &sc->rxon_mtx, 0);
525
	callout_init_mtx(&sc->scan_timeout, &sc->rxon_mtx, 0);
526
	callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0);
526
	callout_init_mtx(&sc->tx_timeout, &sc->sc_mtx, 0);
527
	callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0);
527
	callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0);
528
	TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc);
528
	TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc);
529
	TASK_INIT(&sc->sc_radiooff_task, 0, wpi_radio_off, sc);
529
	TASK_INIT(&sc->sc_radiooff_task, 0, wpi_radio_off, sc);
Lines 687-693 Link Here
687
		wpi_stop(sc);
687
		wpi_stop(sc);
688
688
689
		callout_drain(&sc->watchdog_rfkill);
689
		callout_drain(&sc->watchdog_rfkill);
690
		callout_drain(&sc->watchdog_to);
690
		callout_drain(&sc->tx_timeout);
691
		callout_drain(&sc->scan_timeout);
691
		callout_drain(&sc->scan_timeout);
692
		callout_drain(&sc->calib_to);
692
		callout_drain(&sc->calib_to);
693
		ieee80211_ifdetach(ic);
693
		ieee80211_ifdetach(ic);
Lines 1970-1977 Link Here
1970
	ieee80211_tx_complete(ni, m, (status & 0xff) != 1);
1970
	ieee80211_tx_complete(ni, m, (status & 0xff) != 1);
1971
	WPI_LOCK(sc);
1971
	WPI_LOCK(sc);
1972
1972
1973
	sc->sc_tx_timer = 0;
1973
	ring->queued -= 1;
1974
	if (--ring->queued < WPI_TX_RING_LOMARK) {
1974
	if (ring->queued > 0)
1975
		callout_reset(&sc->tx_timeout, 5*hz, wpi_tx_timeout, sc);
1976
	else
1977
		callout_stop(&sc->tx_timeout);
1978
1979
	if (ring->queued < WPI_TX_RING_LOMARK) {
1975
		sc->qfullmsk &= ~(1 << ring->qid);
1980
		sc->qfullmsk &= ~(1 << ring->qid);
1976
		IF_LOCK(&ifp->if_snd);
1981
		IF_LOCK(&ifp->if_snd);
1977
		if (sc->qfullmsk == 0 &&
1982
		if (sc->qfullmsk == 0 &&
Lines 2520-2526 Link Here
2520
		if (++ring->queued > WPI_TX_RING_HIMARK)
2525
		if (++ring->queued > WPI_TX_RING_HIMARK)
2521
			sc->qfullmsk |= 1 << ring->qid;
2526
			sc->qfullmsk |= 1 << ring->qid;
2522
2527
2523
		sc->sc_tx_timer = 5;
2528
		callout_reset(&sc->tx_timeout, 5*hz, wpi_tx_timeout, sc);
2524
	}
2529
	}
2525
2530
2526
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
2531
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
Lines 2940-2968 Link Here
2940
	ieee80211_runtask(ic, &sc->sc_reinittask);
2945
	ieee80211_runtask(ic, &sc->sc_reinittask);
2941
}
2946
}
2942
2947
2943
/**
2944
 * Called every second, wpi_watchdog used by the watch dog timer
2945
 * to check that the card is still alive
2946
 */
2947
static void
2948
static void
2948
wpi_watchdog(void *arg)
2949
wpi_tx_timeout(void *arg)
2949
{
2950
{
2950
	struct wpi_softc *sc = arg;
2951
	struct wpi_softc *sc = arg;
2951
	struct ifnet *ifp = sc->sc_ifp;
2952
	struct ifnet *ifp = sc->sc_ifp;
2952
	struct ieee80211com *ic = ifp->if_l2com;
2953
	struct ieee80211com *ic = ifp->if_l2com;
2953
2954
2954
	DPRINTF(sc, WPI_DEBUG_WATCHDOG, "Watchdog: tick\n");
2955
	if_printf(ifp, "device timeout\n");
2955
2956
	if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
2956
	if (sc->sc_tx_timer > 0) {
2957
	ieee80211_runtask(ic, &sc->sc_reinittask);
2957
		if (--sc->sc_tx_timer == 0) {
2958
			if_printf(ifp, "device timeout\n");
2959
			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
2960
			ieee80211_runtask(ic, &sc->sc_reinittask);
2961
		}
2962
	}
2963
2964
	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
2965
		callout_reset(&sc->watchdog_to, hz, wpi_watchdog, sc);
2966
}
2958
}
2967
2959
2968
static int
2960
static int
Lines 5260-5267 Link Here
5260
	ifp->if_drv_flags |= IFF_DRV_RUNNING;
5252
	ifp->if_drv_flags |= IFF_DRV_RUNNING;
5261
	IF_UNLOCK(&ifp->if_snd);
5253
	IF_UNLOCK(&ifp->if_snd);
5262
5254
5263
	callout_reset(&sc->watchdog_to, hz, wpi_watchdog, sc);
5264
5265
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
5255
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
5266
5256
5267
	WPI_UNLOCK(sc);
5257
	WPI_UNLOCK(sc);
Lines 5286-5293 Link Here
5286
	sc->txq_active = 0;
5276
	sc->txq_active = 0;
5287
	WPI_TXQ_UNLOCK(sc);
5277
	WPI_TXQ_UNLOCK(sc);
5288
5278
5289
	sc->sc_tx_timer = 0;
5279
	callout_stop(&sc->tx_timeout);
5290
	callout_stop(&sc->watchdog_to);
5291
5280
5292
	WPI_RXON_LOCK(sc);
5281
	WPI_RXON_LOCK(sc);
5293
	callout_stop(&sc->scan_timeout);
5282
	callout_stop(&sc->scan_timeout);
(-)sys/dev/wpi/if_wpivar.h (-4 / +2 lines)
Lines 181-189 Link Here
181
	int			calib_cnt;
181
	int			calib_cnt;
182
182
183
	struct callout		scan_timeout;
183
	struct callout		scan_timeout;
184
	struct callout		tx_timeout;
184
185
185
	/* Watch dog timers. */
186
	/* Watch dog timer. */
186
	struct callout		watchdog_to;
187
	struct callout		watchdog_rfkill;
187
	struct callout		watchdog_rfkill;
188
188
189
	/* Firmware image. */
189
	/* Firmware image. */
Lines 207-214 Link Here
207
	uint32_t		nodesmsk;
207
	uint32_t		nodesmsk;
208
	struct mtx		nt_mtx;
208
	struct mtx		nt_mtx;
209
209
210
	int			sc_tx_timer;
211
212
	void			(*sc_node_free)(struct ieee80211_node *);
210
	void			(*sc_node_free)(struct ieee80211_node *);
213
	void			(*sc_scan_curchan)(struct ieee80211_scan_state *,
211
	void			(*sc_scan_curchan)(struct ieee80211_scan_state *,
214
				    unsigned long);
212
				    unsigned long);

Return to bug 197143