Locking Data Structures in MadWifi
This page will collect all information about locking procedures in madwifi. The idea is to document which lock protects what data structure, under what context, in what function and why. That way, all the devs will have a consistent view of what lock behaviors to change when needed. Also, we have to define a pecking order for the locks so we won't have live locks. We should also make sure the locks are unlocked in LIFO order so we don't have weird messes.
ath
struct ath_node - spinlock_t an_uapsd_lock
ATH_NODE_UAPSD_LOCK_IRQ/ATH_NODE_UAPSD_UNLOCK_IRQ/ATH_NODE_UAPSD_UNLOCK_IRQ_EARLY
struct ath_softc - struct semaphore sc_lock
ATH_LOCK/ATH_UNLOCK
struct ath_txq - spinlock_t axq_lock
Locks everything of ath_txq
ATH_TXQ_LOCK_IRQ/ATH_TXQ_UNLOCK_IRQ/ATH_TXQ_UNLOCK_IRQ_EARLY/ATH_TXQ_LOCK_IRQ_INSDE/ATH_TXQ_UNLOCK_IRQ_INSIDE
ath_uapsd_processtriggers() - locks uapsd_xmit_q ath_tx_txqaddbuf() ath_ff_stageq_flush() ath_hardstart() ath_beacon_generate() - locks sc->sc_cabq and avp->av_mcastq ath_node_move_data() ath_grppoll_start() ath_tx_processq() ath_tx_draintxq()
Queues include ath_vap's av_mcastq, softc's sc_txq[HAL_NUM_TX_QUEUES], sc_ac2q[WME_NUM_AC], sc_cabq, sc_grpplq, sc_xrtxq, sc_uapsdq
-- struct ath_node an_tx_ffbuf ??
struct ath_softc - spinlock_t sc_rxbuflock
ATH_RXBUF_LOCK_IRQ/ATH_RXBUF_UNLOCK_IRQ/ATH_RXBUF_UNLOCK_EARLY
Protection for sc->sc_rxbufcur, sc_rxbuf, sc_rxlink(?)
struct ath_softc - spinlock_t sc_txbuflock
ATH_TXBUF_LOCK_IRQ/ATH_TXBUF_UNLOCK_IRQ/ATH_TXBUF_UNLOCK_EARLY
Protection for sc->sc_txbuf
struct ath_softc - spinlock_t sc_hal_lock
All accesses to the HAL needs to hold this lock. Check ath/if_ath_hal.h for function list.
net80211
http://www.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/index.html
