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

Collapse All | Expand All

(-)sys/dev/wpi/if_wpi.c (-1 / +9 lines)
Lines 399-404 Link Here
399
	WPI_RXON_LOCK_INIT(sc);
399
	WPI_RXON_LOCK_INIT(sc);
400
	WPI_NT_LOCK_INIT(sc);
400
	WPI_NT_LOCK_INIT(sc);
401
	WPI_TXQ_LOCK_INIT(sc);
401
	WPI_TXQ_LOCK_INIT(sc);
402
	WPI_TXQ_STATE_LOCK_INIT(sc);
402
403
403
	/* Allocate DMA memory for firmware transfers. */
404
	/* Allocate DMA memory for firmware transfers. */
404
	if ((error = wpi_alloc_fwmem(sc)) != 0) {
405
	if ((error = wpi_alloc_fwmem(sc)) != 0) {
Lines 523-529 Link Here
523
524
524
	callout_init_mtx(&sc->calib_to, &sc->rxon_mtx, 0);
525
	callout_init_mtx(&sc->calib_to, &sc->rxon_mtx, 0);
525
	callout_init_mtx(&sc->scan_timeout, &sc->rxon_mtx, 0);
526
	callout_init_mtx(&sc->scan_timeout, &sc->rxon_mtx, 0);
526
	callout_init_mtx(&sc->tx_timeout, &sc->sc_mtx, 0);
527
	callout_init_mtx(&sc->tx_timeout, &sc->txq_state_mtx, 0);
527
	callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0);
528
	callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0);
528
	TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc);
529
	TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc);
529
	TASK_INIT(&sc->sc_radiooff_task, 0, wpi_radio_off, sc);
530
	TASK_INIT(&sc->sc_radiooff_task, 0, wpi_radio_off, sc);
Lines 721-726 Link Here
721
		if_free(ifp);
722
		if_free(ifp);
722
723
723
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
724
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
725
	WPI_TXQ_STATE_LOCK_DESTROY(sc);
724
	WPI_TXQ_LOCK_DESTROY(sc);
726
	WPI_TXQ_LOCK_DESTROY(sc);
725
	WPI_NT_LOCK_DESTROY(sc);
727
	WPI_NT_LOCK_DESTROY(sc);
726
	WPI_RXON_LOCK_DESTROY(sc);
728
	WPI_RXON_LOCK_DESTROY(sc);
Lines 1970-1975 Link Here
1970
	ieee80211_tx_complete(ni, m, (status & 0xff) != 1);
1972
	ieee80211_tx_complete(ni, m, (status & 0xff) != 1);
1971
	WPI_LOCK(sc);
1973
	WPI_LOCK(sc);
1972
1974
1975
	WPI_TXQ_STATE_LOCK(sc);
1973
	ring->queued -= 1;
1976
	ring->queued -= 1;
1974
	if (ring->queued > 0) {
1977
	if (ring->queued > 0) {
1975
		callout_reset(&sc->tx_timeout, 5*hz, wpi_tx_timeout, sc);
1978
		callout_reset(&sc->tx_timeout, 5*hz, wpi_tx_timeout, sc);
Lines 1988-1993 Link Here
1988
		}
1991
		}
1989
	} else
1992
	} else
1990
		callout_stop(&sc->tx_timeout);
1993
		callout_stop(&sc->tx_timeout);
1994
	WPI_TXQ_STATE_UNLOCK(sc);
1991
1995
1992
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
1996
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
1993
}
1997
}
Lines 2524-2529 Link Here
2524
2528
2525
	if (ring->qid < WPI_CMD_QUEUE_NUM) {
2529
	if (ring->qid < WPI_CMD_QUEUE_NUM) {
2526
		/* Mark TX ring as full if we reach a certain threshold. */
2530
		/* Mark TX ring as full if we reach a certain threshold. */
2531
		WPI_TXQ_STATE_LOCK(sc);
2527
		if (++ring->queued > WPI_TX_RING_HIMARK) {
2532
		if (++ring->queued > WPI_TX_RING_HIMARK) {
2528
			sc->qfullmsk |= 1 << ring->qid;
2533
			sc->qfullmsk |= 1 << ring->qid;
2529
2534
Lines 2533-2538 Link Here
2533
		}
2538
		}
2534
2539
2535
		callout_reset(&sc->tx_timeout, 5*hz, wpi_tx_timeout, sc);
2540
		callout_reset(&sc->tx_timeout, 5*hz, wpi_tx_timeout, sc);
2541
		WPI_TXQ_STATE_UNLOCK(sc);
2536
	}
2542
	}
2537
2543
2538
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
2544
	DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
Lines 5277-5283 Link Here
5277
	sc->txq_active = 0;
5283
	sc->txq_active = 0;
5278
	WPI_TXQ_UNLOCK(sc);
5284
	WPI_TXQ_UNLOCK(sc);
5279
5285
5286
	WPI_TXQ_STATE_LOCK(sc);
5280
	callout_stop(&sc->tx_timeout);
5287
	callout_stop(&sc->tx_timeout);
5288
	WPI_TXQ_STATE_UNLOCK(sc);
5281
5289
5282
	WPI_RXON_LOCK(sc);
5290
	WPI_RXON_LOCK(sc);
5283
	callout_stop(&sc->scan_timeout);
5291
	callout_stop(&sc->scan_timeout);
(-)sys/dev/wpi/if_wpivar.h (-1 / +15 lines)
Lines 172-177 Link Here
172
172
173
	struct wpi_tx_ring	txq[WPI_NTXQUEUES];
173
	struct wpi_tx_ring	txq[WPI_NTXQUEUES];
174
	struct mtx		txq_mtx;
174
	struct mtx		txq_mtx;
175
	struct mtx		txq_state_mtx;
175
	uint32_t		txq_active;
176
	uint32_t		txq_active;
176
177
177
	struct wpi_rx_ring	rxq;
178
	struct wpi_rx_ring	rxq;
Lines 237-243 Link Here
237
	char			domain[4];	/* Regulatory domain. */
238
	char			domain[4];	/* Regulatory domain. */
238
};
239
};
239
240
240
/* WPI_LOCK > WPI_RXON_LOCK > WPI_NT_LOCK / WPI_VAP_LOCK > WPI_TXQ_LOCK */
241
/*
242
 * Locking order:
243
 * 1. WPI_LOCK;
244
 * 2. WPI_RXON_LOCK;
245
 * 3. WPI_NT_LOCK / WPI_VAP_LOCK;
246
 * 4. WPI_TXQ_LOCK;
247
 * 5. WPI_TXQ_STATE_LOCK;
248
 */
241
249
242
#define WPI_LOCK_INIT(_sc) \
250
#define WPI_LOCK_INIT(_sc) \
243
	mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
251
	mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
Lines 265-267 Link Here
265
#define WPI_TXQ_LOCK(_sc)		mtx_lock(&(_sc)->txq_mtx)
273
#define WPI_TXQ_LOCK(_sc)		mtx_lock(&(_sc)->txq_mtx)
266
#define WPI_TXQ_UNLOCK(_sc)		mtx_unlock(&(_sc)->txq_mtx)
274
#define WPI_TXQ_UNLOCK(_sc)		mtx_unlock(&(_sc)->txq_mtx)
267
#define WPI_TXQ_LOCK_DESTROY(_sc)	mtx_destroy(&(_sc)->txq_mtx)
275
#define WPI_TXQ_LOCK_DESTROY(_sc)	mtx_destroy(&(_sc)->txq_mtx)
276
277
#define WPI_TXQ_STATE_LOCK_INIT(_sc) \
278
	mtx_init(&(_sc)->txq_state_mtx, "txq state lock", NULL, MTX_DEF)
279
#define WPI_TXQ_STATE_LOCK(_sc)		mtx_lock(&(_sc)->txq_state_mtx)
280
#define WPI_TXQ_STATE_UNLOCK(_sc)	mtx_unlock(&(_sc)->txq_state_mtx)
281
#define WPI_TXQ_STATE_LOCK_DESTROY(_sc)	mtx_destroy(&(_sc)->txq_state_mtx)

Return to bug 197143