ath9k: Use bitfields for sc operations
PATCH 8/10 ath9k: Use bitfields for sc operations
Signed-off-by Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath9k/beacon.c | 4 +- drivers/net/wireless/ath9k/core.c | 45 ++++++++++++++++++----------------- drivers/net/wireless/ath9k/core.h | 24 ++++++++++-------- drivers/net/wireless/ath9k/main.c | 14 +++++----- drivers/net/wireless/ath9k/rc.c | 2 +- drivers/net/wireless/ath9k/recv.c | 8 +++--- drivers/net/wireless/ath9k/xmit.c | 31 ++++++++++++----------- 7 files changed, 66 insertions(+), 62 deletions(-)
drivers/net/wireless/ath9k/beacon.c +2 -2
@@ -111,7 +111,7 @@ static void ath_beacon_setup(struct ath_softc *sc, rix =0 ; rt = sc->sc_currates; rate = rt->info[rix].rateCode; -if (sc->sc_flags &ATH_PREAMBLE_SHORT ) +if (sc->sc_flags &SC_OP_PREAMBLE_SHORT ) rate |= rt->info[rix].shortPreamble; ath9k_hw_set11n_txdesc(ah, ds
@@ -975,5 +975,5 @@ void ath_beacon_sync(struct ath_softc *sc, int if_id)* beacon frame we just received. */ ath_beacon_config (sc, if_id); - sc->sc_beacons =1 ; + sc->sc_flags |=SC_OP_BEACONS ; }
drivers/net/wireless/ath9k/core.c +23 -22
150 lines not on this page · raw message
drivers/net/wireless/ath9k/core.h +13 -11
@@ -830,8 +830,6 @@ void ath_setdefantenna(void *sc, u32 antenna);#define ATH_DEFAULT_NOISE_FLOOR -95#define ATH_REGCLASSIDS_MAX 10#define ATH_CABQ_READY_TIME 80/* % of beacon interval */ -#define ATH_PREAMBLE_SHORT (1<<0) -#define ATH_PROTECT_ENABLE (1<<1)#define ATH_MAX_SW_RETRIES 10#define ATH_CHAN_MAX 255#define IEEE80211_WEP_NKID 4/* number of key ids */
@@ -892,25 +890,30 @@ struct ath_ht_info {u8 ext_chan_offset; }; +#define SC_OP_INVALID BIT(0) +#define SC_OP_BEACONS BIT(1) +#define SC_OP_RXAGGR BIT(2) +#define SC_OP_TXAGGR BIT(3) +#define SC_OP_CHAINMASK_UPDATE BIT(4) +#define SC_OP_FULL_RESET BIT(5) +#define SC_OP_PREAMBLE_SHORT BIT(6) +#define SC_OP_PROTECT_ENABLE BIT(7) +struct ath_softc {struct ieee80211_hw *hw;struct pci_dev *pdev;struct tasklet_struct intr_tq;struct tasklet_struct bcon_tasklet; -struct ath_config sc_config;/* load-time parameters */ +struct ath_config sc_config;struct ath_hal *sc_ah; -struct ath_rate_softc *sc_rc;/* tx rate control support */ +struct ath_rate_softc *sc_rc;void __iomem *mem;int sc_debug;u32 sc_intrstatus; +u32 sc_flags;/* SC_OP_* */ unsigned int rx_filter; -u8 sc_invalid;/* being detached */ -u8 sc_beacons;/* beacons running */ -u8 sc_txaggr;/* enable 11n tx aggregation */ -u8 sc_rxaggr;/* enable 11n rx aggregation */ -u8 sc_update_chainmask;/* change chain mask */ -u8 sc_full_reset;/* force full reset */ +enum wireless_mode sc_curmode;/* current phy mode */ u16 sc_curtxpow;u16 sc_curaid;
@@ -944,7 +947,6 @@ struct ath_softc {u8 sc_rxchaindetect_delta5GHz;u8 sc_rxchaindetect_delta2GHz;u32 sc_rtsaggrlimit;/* Chipset specific aggr limit */ -u32 sc_flags;#ifdef CONFIG_SLOW_ANT_DIV struct ath_antdiv sc_antdiv;#endif
drivers/net/wireless/ath9k/main.c +7 -7
@@ -481,7 +481,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,/* Set interrupt mask */ sc->sc_imask &= ~(ATH9K_INT_SWBA |ATH9K_INT_BMISS );ath9k_hw_set_interrupts (sc->sc_ah, sc->sc_imask & ~ATH9K_INT_GLOBAL ); - sc->sc_beacons =0 ; + sc->sc_flags &= ~SC_OP_BEACONS ; error =ath_vap_detach (sc,0 );if (error)
@@ -582,7 +582,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw, print_mac(mac, sc->sc_curbssid), sc->sc_curaid);/* need to reconfigure the beacon */ - sc->sc_beacons =0 ; + sc->sc_flags &= ~SC_OP_BEACONS ;break ;default :
@@ -833,7 +833,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,/* Configure the beacon */ ath_beacon_config (sc,0 ); - sc->sc_beacons =1 ; + sc->sc_flags |=SC_OP_BEACONS ;/* Reset rssi stats */ sc->sc_halstats.ns_avgbrssi =ATH_RSSI_DUMMY_MARKER ;
@@ -896,9 +896,9 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, __func__, bss_conf->use_short_preamble);if (bss_conf->use_short_preamble) - sc->sc_flags |=ATH_PREAMBLE_SHORT ; + sc->sc_flags |=SC_OP_PREAMBLE_SHORT ;else - sc->sc_flags &= ~ATH_PREAMBLE_SHORT ; + sc->sc_flags &= ~SC_OP_PREAMBLE_SHORT ; }if (changed &BSS_CHANGED_ERP_CTS_PROT ) {
@@ -907,9 +907,9 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, bss_conf->use_cts_prot);if (bss_conf->use_cts_prot && hw->conf.channel->band !=IEEE80211_BAND_5GHZ ) - sc->sc_flags |=ATH_PROTECT_ENABLE ; + sc->sc_flags |=SC_OP_PROTECT_ENABLE ;else - sc->sc_flags &= ~ATH_PROTECT_ENABLE ; + sc->sc_flags &= ~SC_OP_PROTECT_ENABLE ; }if (changed &BSS_CHANGED_HT ) {
drivers/net/wireless/ath9k/rc.c +1 -1
@@ -1903,7 +1903,7 @@ static void ath_tx_aggr_resp(struct ath_softc *sc,int state;DECLARE_MAC_BUF (mac); -if (!sc->sc_txaggr) +if (!(sc->sc_flags &SC_OP_TXAGGR ))return ; txtid =ATH_AN_2_TID (an, tidno);
drivers/net/wireless/ath9k/recv.c +4 -4
@@ -724,7 +724,7 @@ int ath_rx_input(struct ath_softc *sc, struct ath_recv_status *rx_status, enum ATH_RX_TYPE *status) { -if (is_ampdu && sc->sc_rxaggr) { +if (is_ampdu && (sc->sc_flags &SC_OP_RXAGGR )) { *status =ATH_RX_CONSUMED ;return ath_ampdu_input (sc, an, skb, rx_status); }else {
@@ -1132,7 +1132,7 @@ int ath_rx_aggr_start(struct ath_softc *sc, rxtid = &an->an_aggr.rx.tid[tid];spin_lock_bh (&rxtid->tidlock); -if (sc->sc_rxaggr) { +if (sc->sc_flags &SC_OP_RXAGGR ) {/* Allow aggregation reception * Adjust rx BA window size. Peer might indicate a * zero buffer size for a _dont_care_ condition.
@@ -1232,7 +1232,7 @@ void ath_rx_aggr_teardown(struct ath_softc *sc,void ath_rx_node_init (struct ath_softc *sc,struct ath_node *an) { -if (sc->sc_rxaggr) { +if (sc->sc_flags &SC_OP_RXAGGR ) {struct ath_arx_tid *rxtid;int tidno;
@@ -1264,7 +1264,7 @@ void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an)void ath_rx_node_cleanup (struct ath_softc *sc,struct ath_node *an) { -if (sc->sc_rxaggr) { +if (sc->sc_flags &SC_OP_RXAGGR ) {struct ath_arx_tid *rxtid;int tidno, i;
drivers/net/wireless/ath9k/xmit.c +16 -15
@@ -392,7 +392,7 @@ static int ath_tx_prepare(struct ath_softc *sc,* incremented by the fragmentation routine. */ if (likely (!(txctl->flags &ATH9K_TXDESC_FRAG_IS_ON )) && - txctl->ht && sc->sc_txaggr) { + txctl->ht && (sc->sc_flags &SC_OP_TXAGGR )) {struct ath_atx_tid *tid; tid =ATH_AN_2_TID (txctl->an, txctl->tidno);
@@ -422,7 +422,7 @@ static int ath_tx_prepare(struct ath_softc *sc,/* * XXX not right with fragmentation. */ -if (sc->sc_flags &ATH_PREAMBLE_SHORT ) +if (sc->sc_flags &SC_OP_PREAMBLE_SHORT ) dur = rt->info[rix].spAckDuration;else dur = rt->info[rix].lpAckDuration;
@@ -438,8 +438,9 @@ static int ath_tx_prepare(struct ath_softc *sc,** Add time for next fragment. */ dur +=ath9k_hw_computetxtime (sc->sc_ah, rt, - txctl->nextfraglen, - rix, sc->sc_flags &ATH_PREAMBLE_SHORT ); + txctl->nextfraglen, + rix, + (sc->sc_flags &SC_OP_PREAMBLE_SHORT )); } if (ieee80211_has_morefrags(fc) ||
@@ -1406,7 +1407,7 @@ static int ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)/* * schedule any pending packets if aggregation is enabled */ -if (sc->sc_txaggr) +if (sc->sc_flags &SC_OP_TXAGGR )ath_txq_schedule (sc, txq);spin_unlock_bh (&txq->axq_lock); }
@@ -1433,7 +1434,7 @@ static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx)enum ath9k_ht_macmode ht_macmode =ath_cwm_macmode (sc);/* XXX return value */ -if (!sc->sc_invalid) { +if (!(sc->sc_flags &SC_OP_INVALID )) {for (i =0 ; i <ATH9K_NUM_TX_QUEUES ; i++) {if (ATH_TXQ_SETUP (sc, i)) {ath_tx_stopdma (sc, &sc->sc_txq[i]);
@@ -2024,7 +2025,7 @@ static int ath_tx_start_dma(struct ath_softc *sc,ieee80211_is_pspoll (fc) ? (bf->bf_state.bf_type |=BUF_PSPOLL ) : (bf->bf_state.bf_type &= ~BUF_PSPOLL ); - (sc->sc_flags &ATH_PREAMBLE_SHORT ) ? + (sc->sc_flags &SC_OP_PREAMBLE_SHORT ) ? (bf->bf_state.bf_type |=BUF_SHORT_PREAMBLE ) : (bf->bf_state.bf_type &= ~BUF_SHORT_PREAMBLE );
@@ -2076,7 +2077,7 @@ static int ath_tx_start_dma(struct ath_softc *sc,spin_lock_bh (&txq->axq_lock); -if (txctl->ht && sc->sc_txaggr) { +if (txctl->ht && (sc->sc_flags &SC_OP_TXAGGR )) {struct ath_atx_tid *tid =ATH_AN_2_TID (an, txctl->tidno);if (ath_aggr_query (sc, an, txctl->tidno)) {/*
@@ -2153,7 +2154,7 @@ static void xmit_map_sg(struct ath_softc *sc, tx_status.retries =0 ; tx_status.flags =ATH_TX_ERROR ; -if (txctl->ht && sc->sc_txaggr) { +if (txctl->ht && (sc->sc_flags &SC_OP_TXAGGR )) {/* Reclaim the seqno. */ tid =ATH_AN_2_TID ((struct ath_node *) txctl->an, txctl->tidno);
@@ -2505,7 +2506,7 @@ void ath_tx_draintxq(struct ath_softc *sc, }/* flush any pending frames if aggregation is enabled */ -if (sc->sc_txaggr) { +if (sc->sc_flags &SC_OP_TXAGGR ) {if (!retry_tx) {spin_lock_bh (&txq->axq_lock); ath_txq_drain_pending_buffers(sc, txq,
@@ -2521,7 +2522,7 @@ void ath_draintxq(struct ath_softc *sc, bool retry_tx) {/* stop beacon queue. The beacon will be freed when * we go to INIT state */ -if (!sc->sc_invalid) { +if (!(sc->sc_flags &SC_OP_INVALID )) { (void )ath9k_hw_stoptxdma (sc->sc_ah, sc->sc_bhalq);DPRINTF (sc,ATH_DBG_XMIT ,"%s: beacon queue %x\n" , __func__,ath9k_hw_gettxbuf (sc->sc_ah, sc->sc_bhalq));
@@ -2548,7 +2549,7 @@ enum ATH_AGGR_CHECK ath_tx_aggr_check(struct ath_softc *sc,struct ath_atx_tid *txtid;DECLARE_MAC_BUF (mac); -if (!sc->sc_txaggr) +if (!(sc->sc_flags &SC_OP_TXAGGR ))return AGGR_NOT_REQUIRED ;/* ADDBA exchange must be completed before sending aggregates */
@@ -2595,7 +2596,7 @@ int ath_tx_aggr_start(struct ath_softc *sc,return -1 ; } -if (sc->sc_txaggr) { +if (sc->sc_flags &SC_OP_TXAGGR ) { txtid =ATH_AN_2_TID (an, tid); txtid->addba_exchangeinprogress =1 ;ath_tx_pause_tid (sc, txtid);
@@ -2755,7 +2756,7 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)void ath_tx_node_init (struct ath_softc *sc,struct ath_node *an) { -if (sc->sc_txaggr) { +if (sc->sc_flags &SC_OP_TXAGGR ) {struct ath_atx_tid *tid;struct ath_atx_ac *ac;int tidno, acno;
@@ -2867,7 +2868,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc,void ath_tx_node_free (struct ath_softc *sc,struct ath_node *an) { -if (sc->sc_txaggr) { +if (sc->sc_flags &SC_OP_TXAGGR ) {struct ath_atx_tid *tid;int tidno, i;
Signature · 1 line
1.5.6.5