Create an RX queue lock.
Ideally these locks would go away and there'd be a single driver lock, like what iwn(4) does. I'll worry about that later.
This commit is contained in:
parent
39abbd9bd2
commit
2fe91baa92
|
@ -193,11 +193,13 @@ ath_ahb_attach(device_t dev)
|
|||
|
||||
ATH_LOCK_INIT(sc);
|
||||
ATH_PCU_LOCK_INIT(sc);
|
||||
ATH_RX_LOCK_INIT(sc);
|
||||
|
||||
error = ath_attach(AR9130_DEVID, sc);
|
||||
if (error == 0) /* success */
|
||||
return 0;
|
||||
|
||||
ATH_RX_LOCK_DESTROY(sc);
|
||||
ATH_PCU_LOCK_DESTROY(sc);
|
||||
ATH_LOCK_DESTROY(sc);
|
||||
bus_dma_tag_destroy(sc->sc_dmat);
|
||||
|
@ -238,6 +240,7 @@ ath_ahb_detach(device_t dev)
|
|||
if (sc->sc_eepromdata)
|
||||
free(sc->sc_eepromdata, M_TEMP);
|
||||
|
||||
ATH_RX_LOCK_DESTROY(sc);
|
||||
ATH_PCU_LOCK_DESTROY(sc);
|
||||
ATH_LOCK_DESTROY(sc);
|
||||
|
||||
|
|
|
@ -249,12 +249,14 @@ ath_pci_attach(device_t dev)
|
|||
|
||||
ATH_LOCK_INIT(sc);
|
||||
ATH_PCU_LOCK_INIT(sc);
|
||||
ATH_RX_LOCK_INIT(sc);
|
||||
|
||||
error = ath_attach(pci_get_device(dev), sc);
|
||||
if (error == 0) /* success */
|
||||
return 0;
|
||||
|
||||
ATH_PCU_LOCK_DESTROY(sc);
|
||||
ATH_RX_LOCK_DESTROY(sc);
|
||||
ATH_LOCK_DESTROY(sc);
|
||||
bus_dma_tag_destroy(sc->sc_dmat);
|
||||
bad3:
|
||||
|
@ -294,6 +296,7 @@ ath_pci_detach(device_t dev)
|
|||
free(sc->sc_eepromdata, M_TEMP);
|
||||
|
||||
ATH_PCU_LOCK_DESTROY(sc);
|
||||
ATH_RX_LOCK_DESTROY(sc);
|
||||
ATH_LOCK_DESTROY(sc);
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -425,6 +425,8 @@ struct ath_softc {
|
|||
struct mtx sc_mtx; /* master lock (recursive) */
|
||||
struct mtx sc_pcu_mtx; /* PCU access mutex */
|
||||
char sc_pcu_mtx_name[32];
|
||||
struct mtx sc_rx_mtx; /* RX access mutex */
|
||||
char sc_rx_mtx_name[32];
|
||||
struct taskqueue *sc_tq; /* private task queue */
|
||||
struct ath_hal *sc_ah; /* Atheros HAL */
|
||||
struct ath_ratectrl *sc_rc; /* tx rate control support */
|
||||
|
@ -696,6 +698,28 @@ struct ath_softc {
|
|||
#define ATH_PCU_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_pcu_mtx, \
|
||||
MA_NOTOWNED)
|
||||
|
||||
/*
|
||||
* The RX lock is primarily a(nother) workaround to ensure that the
|
||||
* RX FIFO/list isn't modified by various execution paths.
|
||||
* Even though RX occurs in a single context (the ath taskqueue), the
|
||||
* RX path can be executed via various reset/channel change paths.
|
||||
*/
|
||||
#define ATH_RX_LOCK_INIT(_sc) do {\
|
||||
snprintf((_sc)->sc_rx_mtx_name, \
|
||||
sizeof((_sc)->sc_rx_mtx_name), \
|
||||
"%s RX lock", \
|
||||
device_get_nameunit((_sc)->sc_dev)); \
|
||||
mtx_init(&(_sc)->sc_rx_mtx, (_sc)->sc_rx_mtx_name, \
|
||||
NULL, MTX_DEF); \
|
||||
} while (0)
|
||||
#define ATH_RX_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_rx_mtx)
|
||||
#define ATH_RX_LOCK(_sc) mtx_lock(&(_sc)->sc_rx_mtx)
|
||||
#define ATH_RX_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_rx_mtx)
|
||||
#define ATH_RX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_rx_mtx, \
|
||||
MA_OWNED)
|
||||
#define ATH_RX_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_rx_mtx, \
|
||||
MA_NOTOWNED)
|
||||
|
||||
#define ATH_TXQ_SETUP(sc, i) ((sc)->sc_txqsetup & (1<<i))
|
||||
|
||||
#define ATH_TXBUF_LOCK_INIT(_sc) do { \
|
||||
|
|
Loading…
Reference in New Issue