ath9k: clean up the code that wakes the mac80211 queues
PATCH v4 1/5 ath9k: clean up the code that wakes the mac80211 queues
Instead of spreading ath_wake_mac80211_queue() calls over multiple places in the tx path that process the tx queue for completion, call it only where the pending frames counter gets decremented, eliminating some redundant checks.
To prevent queue draining from waking the queues prematurely (e.g. during a hardware reset), reset the queue stop state when draining all queues, as the caller in main.c will run ieee80211_wake_queues(hw) anyway.
--- drivers/net/wireless/ath/ath9k/main.c | 2 + drivers/net/wireless/ath/ath9k/xmit.c | 39 +++++++++++++------------------- 2 files changed, 18 insertions(+), 23 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +2 -0
@@ -295,6 +295,8 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, } ps_restore: +ieee80211_wake_queues (hw); +spin_unlock_bh (&sc->sc_pcu_lock);ath9k_ps_restore (sc);
drivers/net/wireless/ath/ath9k/xmit.c +16 -23
@@ -1209,8 +1209,17 @@ bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)ath_err (common,"Failed to stop TX DMA!\n" );for (i =0 ; i <ATH9K_NUM_TX_QUEUES ; i++) { -if (ATH_TXQ_SETUP (sc, i)) -ath_draintxq (sc, &sc->tx.txq[i], retry_tx); +if (!ATH_TXQ_SETUP (sc, i)) +continue ; + +/* +* The caller will resume queues with ieee80211_wake_queues. +* Mark the queue as not stopped to prevent ath_tx_complete +* from waking the queue too early. +*/ + txq = &sc->tx.txq[i]; + txq->stopped = false; +ath_draintxq (sc, txq, retry_tx); }return !npend;
@@ -1878,6 +1887,11 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,spin_lock_bh (&txq->axq_lock);if (WARN_ON (--txq->pending_frames <0 )) txq->pending_frames =0 ; + +if (txq->stopped && txq->pending_frames <ATH_MAX_QDEPTH ) { +if (ath_mac80211_start_queue (sc, q)) + txq->stopped =0 ; + }spin_unlock_bh (&txq->axq_lock); }
@@ -1987,18 +2001,6 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, tx_info->status.rates[tx_rateindex].count = ts->ts_longretry +1 ; } -/* Has no locking. Must hold spin_lock_bh(&txq->axq_lock) -* before calling this. -*/ -static void __ath_wake_mac80211_queue (struct ath_softc *sc,struct ath_txq *txq) -{ -if (txq->mac80211_qnum >=0 && - txq->stopped && txq->pending_frames <ATH_MAX_QDEPTH ) { -if (ath_mac80211_start_queue (sc, txq->mac80211_qnum)) - txq->stopped =0 ; - } -} -static void ath_tx_processq (struct ath_softc *sc,struct ath_txq *txq) {struct ath_hw *ah = sc->sc_ah;
@@ -2009,7 +2011,6 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)struct ath_tx_status ts;int txok;int status; -int qnum; ath_dbg(common, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n", txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum),
@@ -2091,8 +2092,6 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)ath_tx_rc_status (bf, &ts,1 , txok ?0 :1 , txok, true); } - qnum =skb_get_queue_mapping (bf->bf_mpdu); -if (bf_isampdu (bf))ath_tx_complete_aggr (sc, txq, bf, &bf_head, &ts, txok, true);
@@ -2100,7 +2099,6 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)ath_tx_complete_buf (sc, bf, txq, &bf_head, &ts, txok,0 );spin_lock_bh (&txq->axq_lock); -__ath_wake_mac80211_queue (sc, txq);if (sc->sc_flags &SC_OP_TXAGGR )ath_txq_schedule (sc, txq);
@@ -2156,7 +2154,6 @@ static void ath_tx_complete_poll_work(struct work_struct *work) txq->pending_frames,list_empty (&txq->axq_acq), txq->stopped); -__ath_wake_mac80211_queue (sc, txq);ath_txq_schedule (sc, txq); } }
@@ -2198,7 +2195,6 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)struct list_head bf_head;int status;int txok; -int qnum;for (;;) { status =ath9k_hw_txprocdesc (ah,NULL , (void *)&txs);
@@ -2244,8 +2240,6 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)ath_tx_rc_status (bf, &txs,1 , txok ?0 :1 , txok, true); } - qnum =skb_get_queue_mapping (bf->bf_mpdu); -if (bf_isampdu (bf))ath_tx_complete_aggr (sc, txq, bf, &bf_head, &txs, txok, true);
@@ -2254,7 +2248,6 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) &txs, txok, 0);spin_lock_bh (&txq->axq_lock); -__ath_wake_mac80211_queue (sc, txq);if (!list_empty (&txq->txq_fifo_pending)) {INIT_LIST_HEAD (&bf_head);
Signature · 1 line
1.7.3.2
PATCH v4 2/5 ath9k: remove the virtual wiphy debugfs interface
It does not make much sense to keep the current virtual wiphy implementation any longer - it adds significant complexity, has very few users and is still very experimental. At some point in time, it will be replaced by a proper implementation in mac80211.
By making the code easier to read and maintain, removing virtual wiphy support helps with fixing the remaining driver issues and adding further improvements.
--- drivers/net/wireless/ath/ath9k/debug.c | 137 +------------------------------- 1 files changed, 4 insertions(+), 133 deletions(-)
drivers/net/wireless/ath/ath9k/debug.c +4 -133
@@ -381,41 +381,21 @@ static const struct file_operations fops_interrupt = { .llseek = default_llseek, }; -static const char *ath_wiphy_state_str (enum ath_wiphy_state state) -{ -switch (state) { -case ATH_WIPHY_INACTIVE : -return "INACTIVE" ; -case ATH_WIPHY_ACTIVE : -return "ACTIVE" ; -case ATH_WIPHY_PAUSING : -return "PAUSING" ; -case ATH_WIPHY_PAUSED : -return "PAUSED" ; -case ATH_WIPHY_SCAN : -return "SCAN" ; - } -return "?" ; -} -static ssize_t read_file_wiphy (struct file *file,char __user *user_buf,size_t count,loff_t *ppos) {struct ath_softc *sc = file->private_data; -struct ath_wiphy *aphy = sc->pri_wiphy; -struct ieee80211_channel *chan = aphy->hw->conf.channel; +struct ieee80211_channel *chan = sc->hw->conf.channel;char buf[512 ];unsigned int len =0 ; -int i;u8 addr[ETH_ALEN ];u32 tmp; len +=snprintf (buf + len,sizeof (buf) - len, -"primary: %s (%s chan=%d ht=%d)\n" , -wiphy_name (sc->pri_wiphy->hw->wiphy), -ath_wiphy_state_str (sc->pri_wiphy->state), +"%s (chan=%d ht=%d)\n" , +wiphy_name (sc->hw->wiphy),ieee80211_frequency_to_channel (chan->center_freq), - aphy->chan_is_ht); +conf_is_ht (&sc->hw->conf));put_unaligned_le32 (REG_READ_D (sc->sc_ah,AR_STA_ID0 ), addr);put_unaligned_le16 (REG_READ_D (sc->sc_ah,AR_STA_ID1 ) &0xffff , addr +4 );
@@ -457,123 +437,14 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,else len +=snprintf (buf + len,sizeof (buf) - len,"\n" ); -/* Put variable-length stuff down here, and check for overflows. */ -for (i =0 ; i < sc->num_sec_wiphy; i++) { -struct ath_wiphy *aphy_tmp = sc->sec_wiphy[i]; -if (aphy_tmp ==NULL ) -continue ; - chan = aphy_tmp->hw->conf.channel; - len +=snprintf (buf + len,sizeof (buf) - len, -"secondary: %s (%s chan=%d ht=%d)\n" , -wiphy_name (aphy_tmp->hw->wiphy), -ath_wiphy_state_str (aphy_tmp->state), -ieee80211_frequency_to_channel (chan->center_freq), - aphy_tmp->chan_is_ht); - }if (len >sizeof (buf)) len =sizeof (buf);return simple_read_from_buffer (user_buf, count, ppos, buf, len); } -static struct ath_wiphy *get_wiphy (struct ath_softc *sc,const char *name) -{ -int i; -if (strcmp (name,wiphy_name (sc->pri_wiphy->hw->wiphy)) ==0 ) -return sc->pri_wiphy; -for (i =0 ; i < sc->num_sec_wiphy; i++) { -struct ath_wiphy *aphy = sc->sec_wiphy[i]; -if (aphy &&strcmp (name,wiphy_name (aphy->hw->wiphy)) ==0 ) -return aphy; - } -return NULL ; -} - -static int del_wiphy (struct ath_softc *sc,const char *name) -{ -struct ath_wiphy *aphy =get_wiphy (sc, name); -if (!aphy) -return -ENOENT ; -return ath9k_wiphy_del (aphy); -} - -static int pause_wiphy (struct ath_softc *sc,const char *name) -{ -struct ath_wiphy *aphy =get_wiphy (sc, name); -if (!aphy) -return -ENOENT ; -return ath9k_wiphy_pause (aphy); -} - -static int unpause_wiphy (struct ath_softc *sc,const char *name) -{ -struct ath_wiphy *aphy =get_wiphy (sc, name); -if (!aphy) -return -ENOENT ; -return ath9k_wiphy_unpause (aphy); -} - -static int select_wiphy (struct ath_softc *sc,const char *name) -{ -struct ath_wiphy *aphy =get_wiphy (sc, name); -if (!aphy) -return -ENOENT ; -return ath9k_wiphy_select (aphy); -} - -static int schedule_wiphy (struct ath_softc *sc,const char *msec) -{ -ath9k_wiphy_set_scheduler (sc,simple_strtoul (msec,NULL ,0 )); -return 0 ; -} - -static ssize_t write_file_wiphy (struct file *file,const char __user *user_buf, -size_t count,loff_t *ppos) -{ -struct ath_softc *sc = file->private_data; -char buf[50 ]; -size_t len; - - len =min (count,sizeof (buf) -1 ); -if (copy_from_user (buf, user_buf, len)) -return -EFAULT ; - buf[len] ='\0' ; -if (len >0 && buf[len -1 ] =='\n' ) - buf[len -1 ] ='\0' ; - -if (strncmp (buf,"add" ,3 ) ==0 ) { -int res =ath9k_wiphy_add (sc); -if (res <0 ) -return res; - }else if (strncmp (buf,"del=" ,4 ) ==0 ) { -int res =del_wiphy (sc, buf +4 ); -if (res <0 ) -return res; - }else if (strncmp (buf,"pause=" ,6 ) ==0 ) { -int res =pause_wiphy (sc, buf +6 ); -if (res <0 ) -return res; - }else if (strncmp (buf,"unpause=" ,8 ) ==0 ) { -int res =unpause_wiphy (sc, buf +8 ); -if (res <0 ) -return res; - }else if (strncmp (buf,"select=" ,7 ) ==0 ) { -int res =select_wiphy (sc, buf +7 ); -if (res <0 ) -return res; - }else if (strncmp (buf,"schedule=" ,9 ) ==0 ) { -int res =schedule_wiphy (sc, buf +9 ); -if (res <0 ) -return res; - }else -return -EOPNOTSUPP ; - -return count; -} -static const struct file_operations fops_wiphy = { .read = read_file_wiphy, - .write = write_file_wiphy, .open = ath9k_debugfs_open, .owner =THIS_MODULE , .llseek = default_llseek,
Signature · 1 line
1.7.3.2
PATCH v4 3/5 ath9k: remove support for virtual wiphys
--- drivers/net/wireless/ath/ath9k/Makefile | 1 - drivers/net/wireless/ath/ath9k/ahb.c | 1 - drivers/net/wireless/ath/ath9k/ath9k.h | 41 -- drivers/net/wireless/ath/ath9k/beacon.c | 9 +- drivers/net/wireless/ath/ath9k/init.c | 19 +- drivers/net/wireless/ath/ath9k/main.c | 141 +------ drivers/net/wireless/ath/ath9k/pci.c | 2 - drivers/net/wireless/ath/ath9k/recv.c | 63 +--- drivers/net/wireless/ath/ath9k/virtual.c | 669 ------------------------------ drivers/net/wireless/ath/ath9k/xmit.c | 28 +- 10 files changed, 23 insertions(+), 951 deletions(-) delete mode 100644 drivers/net/wireless/ath/ath9k/virtual.c
drivers/net/wireless/ath/ath9k/Makefile +0 -1
@@ -4,7 +4,6 @@ ath9k-y += beacon.o \ main.o \ recv.o \ xmit.o \ - virtual.o \ ath9k-$(CONFIG_ATH9K_RATE_CONTROL) += rc.o ath9k-$(CONFIG_PCI) += pci.o
drivers/net/wireless/ath/ath9k/ahb.c +0 -1
@@ -107,7 +107,6 @@ static int ath_ahb_probe(struct platform_device *pdev) sc = (struct ath_softc *) (aphy +1 ); aphy->sc = sc; aphy->hw = hw; - sc->pri_wiphy = aphy; sc->hw = hw; sc->dev = &pdev->dev; sc->mem = mem;
drivers/net/wireless/ath/ath9k/ath9k.h +0 -41
67 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/beacon.c +1 -8
@@ -142,9 +142,6 @@ static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw,struct ieee80211_tx_info *info;int cabq_depth; -if (aphy->state !=ATH_WIPHY_ACTIVE ) -return NULL ; - avp = (void *)vif->drv_priv; cabq = sc->beacon.cabq;
@@ -261,7 +258,6 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif) }BUG_ON (sc->beacon.bslot[avp->av_bslot] !=NULL ); sc->beacon.bslot[avp->av_bslot] = vif; - sc->beacon.bslot_aphy[avp->av_bslot] = aphy; sc->nbcnvifs++; } }
@@ -332,7 +328,6 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp)if (avp->av_bslot !=-1 ) { sc->beacon.bslot[avp->av_bslot] =NULL ; - sc->beacon.bslot_aphy[avp->av_bslot] =NULL ; sc->nbcnvifs--; }
@@ -358,7 +353,6 @@ void ath_beacon_tasklet(unsigned long data)struct ath_common *common =ath9k_hw_common (ah);struct ath_buf *bf =NULL ;struct ieee80211_vif *vif; -struct ath_wiphy *aphy;int slot;u32 bfaddr, bc =0 , tsftu;u64 tsf;
@@ -416,7 +410,6 @@ void ath_beacon_tasklet(unsigned long data)*/ slot =ATH_BCBUF - slot -1 ; vif = sc->beacon.bslot[slot]; - aphy = sc->beacon.bslot_aphy[slot]; ath_dbg(common, ATH_DBG_BEACON, "slot %d [tsf %llu tsftu %u intval %u] vif %p\n",
@@ -424,7 +417,7 @@ void ath_beacon_tasklet(unsigned long data) bfaddr =0 ;if (vif) { - bf =ath_beacon_generate (aphy->hw, vif); + bf =ath_beacon_generate (sc->hw, vif);if (bf !=NULL ) { bfaddr = bf->bf_daddr; bc =1 ;
drivers/net/wireless/ath/ath9k/init.c +1 -18
@@ -517,10 +517,8 @@ static void ath9k_init_misc(struct ath_softc *sc) sc->beacon.slottime =ATH9K_SLOT_TIME_9 ; -for (i =0 ; i <ARRAY_SIZE (sc->beacon.bslot); i++) { +for (i =0 ; i <ARRAY_SIZE (sc->beacon.bslot); i++) sc->beacon.bslot[i] =NULL ; - sc->beacon.bslot_aphy[i] =NULL ; - }if (sc->sc_ah->caps.hw_caps &ATH9K_HW_CAP_ANT_DIV_COMB ) sc->ant_comb.count =ATH_ANT_DIV_COMB_INIT_COUNT ;
@@ -556,7 +554,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, common->btcoex_enabled = ath9k_btcoex_enable ==1 ;spin_lock_init (&common->cc_lock); -spin_lock_init (&sc->wiphy_lock);spin_lock_init (&sc->sc_serial_rw);spin_lock_init (&sc->sc_pm_lock);mutex_init (&sc->mutex);
@@ -762,9 +759,6 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,INIT_WORK (&sc->hw_check_work, ath_hw_check);INIT_WORK (&sc->paprd_work, ath_paprd_calibrate); -INIT_WORK (&sc->chan_work, ath9k_wiphy_chan_work); -INIT_DELAYED_WORK (&sc->wiphy_work, ath9k_wiphy_work); - sc->wiphy_scheduler_int =msecs_to_jiffies (500 ); aphy->last_rssi =ATH_RSSI_DUMMY_MARKER ;ath_init_leds (sc);
@@ -823,28 +817,17 @@ static void ath9k_deinit_softc(struct ath_softc *sc)void ath9k_deinit_device (struct ath_softc *sc) {struct ieee80211_hw *hw = sc->hw; -int i =0 ;ath9k_ps_wakeup (sc);wiphy_rfkill_stop_polling (sc->hw->wiphy);ath_deinit_leds (sc); -for (i =0 ; i < sc->num_sec_wiphy; i++) { -struct ath_wiphy *aphy = sc->sec_wiphy[i]; -if (aphy ==NULL ) -continue ; - sc->sec_wiphy[i] =NULL ; -ieee80211_unregister_hw (aphy->hw); -ieee80211_free_hw (aphy->hw); - } -ieee80211_unregister_hw (hw);pm_qos_remove_request (&sc->pm_qos_req);ath_rx_cleanup (sc);ath_tx_cleanup (sc);ath9k_deinit_softc (sc); -kfree (sc->sec_wiphy); } void ath_descdma_cleanup(struct ath_softc *sc,
drivers/net/wireless/ath/ath9k/main.c +5 -136
247 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/pci.c +0 -2
@@ -213,7 +213,6 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) sc = (struct ath_softc *) (aphy +1 ); aphy->sc = sc; aphy->hw = hw; - sc->pri_wiphy = aphy; sc->hw = hw; sc->dev = &pdev->dev; sc->mem = mem;
@@ -320,7 +319,6 @@ static int ath_pci_resume(struct device *device)ath9k_ps_restore (sc); sc->ps_idle = true; -ath9k_set_wiphy_idle (aphy, true);ath_radio_disable (sc, hw);return 0 ;
drivers/net/wireless/ath/ath9k/recv.c +4 -59
105 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/virtual.c deleted +0 -669
669 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/xmit.c +12 -16
@@ -1821,7 +1821,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,spin_lock_bh (&txq->axq_lock);if (txq == sc->tx.txq_map[q] && ++txq->pending_frames >ATH_MAX_QDEPTH && !txq->stopped) { -ath_mac80211_stop_queue (sc, q); +ieee80211_stop_queue (sc->hw, q); txq->stopped =1 ; }spin_unlock_bh (&txq->axq_lock);
@@ -1879,24 +1879,20 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, PS_WAIT_FOR_TX_ACK)); } -if (unlikely (ftype)) -ath9k_tx_status (hw, skb, ftype); -else { - q =skb_get_queue_mapping (skb); -if (txq == sc->tx.txq_map[q]) { -spin_lock_bh (&txq->axq_lock); -if (WARN_ON (--txq->pending_frames <0 )) - txq->pending_frames =0 ; + q =skb_get_queue_mapping (skb); +if (txq == sc->tx.txq_map[q]) { +spin_lock_bh (&txq->axq_lock); +if (WARN_ON (--txq->pending_frames <0 )) + txq->pending_frames =0 ; -if (txq->stopped && txq->pending_frames <ATH_MAX_QDEPTH ) { -if (ath_mac80211_start_queue (sc, q)) - txq->stopped =0 ; - } -spin_unlock_bh (&txq->axq_lock); +if (txq->stopped && txq->pending_frames <ATH_MAX_QDEPTH ) { +ieee80211_wake_queue (sc->hw, q); + txq->stopped =0 ; } - -ieee80211_tx_status (hw, skb); +spin_unlock_bh (&txq->axq_lock); } + +ieee80211_tx_status (hw, skb); } static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
Signature · 1 line
1.7.3.2
PATCH v4 4/5 ath9k: remove the bf->aphy field
--- drivers/net/wireless/ath/ath9k/ath9k.h | 3 +- drivers/net/wireless/ath/ath9k/xmit.c | 38 +++++++++++++------------------ 2 files changed, 17 insertions(+), 24 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -2
@@ -32,6 +32,7 @@*/ struct ath_node ; +struct ath_wiphy ;/* Macro to expand scalars to 64-bit objects */
@@ -234,7 +235,6 @@ struct ath_buf {bool bf_stale;u16 bf_flags;struct ath_buf_state bf_state; -struct ath_wiphy *aphy; };struct ath_atx_tid {
@@ -564,7 +564,6 @@ struct ath_ant_comb {#define PS_WAIT_FOR_TX_ACK BIT(3)#define PS_BEACON_SYNC BIT(4) -struct ath_wiphy ;struct ath_rate_table ;struct ath9k_vif_iter_data {
drivers/net/wireless/ath/ath9k/xmit.c +16 -22
@@ -57,8 +57,9 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,static void ath_tx_txqaddbuf (struct ath_softc *sc,struct ath_txq *txq,struct list_head *head);static void ath_buf_set_rate (struct ath_softc *sc,struct ath_buf *bf,int len); -static void ath_tx_rc_status (struct ath_buf *bf,struct ath_tx_status *ts, -int nframes,int nbad,int txok,bool update_rc); +static void ath_tx_rc_status (struct ath_softc *sc,struct ath_buf *bf, +struct ath_tx_status *ts,int nframes,int nbad, +int txok,bool update_rc);static void ath_tx_update_baw (struct ath_softc *sc,struct ath_atx_tid *tid,int seqno);
@@ -297,7 +298,6 @@ static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf)ATH_TXBUF_RESET (tbf); - tbf->aphy = bf->aphy; tbf->bf_mpdu = bf->bf_mpdu; tbf->bf_buf_addr = bf->bf_buf_addr;memcpy (tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len);
@@ -345,7 +345,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,struct ath_node *an =NULL ;struct sk_buff *skb;struct ieee80211_sta *sta; -struct ieee80211_hw *hw; +struct ieee80211_hw *hw = sc->hw;struct ieee80211_hdr *hdr;struct ieee80211_tx_info *tx_info;struct ath_atx_tid *tid =NULL ;
@@ -364,7 +364,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, hdr = (struct ieee80211_hdr *)skb->data; tx_info =IEEE80211_SKB_CB (skb); - hw = bf->aphy->hw;memcpy (rates, tx_info->control.rates,sizeof (rates));
@@ -383,7 +382,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, !bf->bf_stale || bf_next != NULL)list_move_tail (&bf->list, &bf_head); -ath_tx_rc_status (bf, ts,1 ,1 ,0 , false); +ath_tx_rc_status (sc, bf, ts,1 ,1 ,0 , false);ath_tx_complete_buf (sc, bf, txq, &bf_head, ts,0 ,0 );
@@ -489,10 +488,10 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,if (rc_update && (acked_cnt ==1 || txfail_cnt ==1 )) {memcpy (tx_info->control.rates, rates,sizeof (rates)); -ath_tx_rc_status (bf, ts, nframes, nbad, txok, true); +ath_tx_rc_status (sc, bf, ts, nframes, nbad, txok, true); rc_update = false; }else { -ath_tx_rc_status (bf, ts, nframes, nbad, txok, false); +ath_tx_rc_status (sc, bf, ts, nframes, nbad, txok, false); } ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
@@ -516,7 +515,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, bf->bf_state.bf_type |=BUF_XRETRY ; -ath_tx_rc_status (bf, ts, nframes, +ath_tx_rc_status (sc, bf, ts, nframes, nbad,0 , false); ath_tx_complete_buf(sc, bf, txq, &bf_head,
@@ -1682,7 +1681,6 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,ATH_TXBUF_RESET (bf); - bf->aphy = aphy; bf->bf_flags =setup_tx_flags (skb); bf->bf_mpdu = skb;
@@ -1836,8 +1834,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,/*****************/ static void ath_tx_complete (struct ath_softc *sc,struct sk_buff *skb, -struct ath_wiphy *aphy,int tx_flags,int ftype, -struct ath_txq *txq) +int tx_flags,int ftype,struct ath_txq *txq) {struct ieee80211_hw *hw = sc->hw;struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb);
@@ -1847,9 +1844,6 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,ath_dbg (common,ATH_DBG_XMIT ,"TX complete: skb: %p\n" , skb); -if (aphy) - hw = aphy->hw; -if (tx_flags &ATH_TX_BAR ) tx_info->flags |=IEEE80211_TX_STAT_AMPDU_NO_BACK ;
@@ -1923,7 +1917,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,complete (&sc->paprd_complete); }else {ath_debug_stat_tx (sc, bf, ts); -ath_tx_complete (sc, skb, bf->aphy, tx_flags, +ath_tx_complete (sc, skb, tx_flags, bf->bf_state.bfs_ftype, txq); }/* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
@@ -1939,14 +1933,14 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,spin_unlock_irqrestore (&sc->tx.txbuflock, flags); } -static void ath_tx_rc_status (struct ath_buf *bf,struct ath_tx_status *ts, -int nframes,int nbad,int txok,bool update_rc) +static void ath_tx_rc_status (struct ath_softc *sc,struct ath_buf *bf, +struct ath_tx_status *ts,int nframes,int nbad, +int txok,bool update_rc) {struct sk_buff *skb = bf->bf_mpdu;struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb); -struct ieee80211_hw *hw = bf->aphy->hw; -struct ath_softc *sc = bf->aphy->sc; +struct ieee80211_hw *hw = sc->hw;struct ath_hw *ah = sc->sc_ah;u8 i, tx_rateindex;
@@ -2085,7 +2079,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)*/ if (ts.ts_status &ATH9K_TXERR_XRETRY ) bf->bf_state.bf_type |=BUF_XRETRY ; -ath_tx_rc_status (bf, &ts,1 , txok ?0 :1 , txok, true); +ath_tx_rc_status (sc, bf, &ts,1 , txok ?0 :1 , txok, true); }if (bf_isampdu (bf))
@@ -2233,7 +2227,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)if (!bf_isampdu (bf)) {if (txs.ts_status &ATH9K_TXERR_XRETRY ) bf->bf_state.bf_type |=BUF_XRETRY ; -ath_tx_rc_status (bf, &txs,1 , txok ?0 :1 , txok, true); +ath_tx_rc_status (sc, bf, &txs,1 , txok ?0 :1 , txok, true); }if (bf_isampdu (bf))
Signature · 1 line
1.7.3.2
PATCH v4 5/5 ath9k: fold struct ath_wiphy into struct ath_softc
--- drivers/net/wireless/ath/ath9k/ahb.c | 12 +---- drivers/net/wireless/ath/ath9k/ath9k.h | 13 ++---- drivers/net/wireless/ath/ath9k/beacon.c | 9 +-- drivers/net/wireless/ath/ath9k/gpio.c | 3 +- drivers/net/wireless/ath/ath9k/init.c | 6 +-- drivers/net/wireless/ath/ath9k/main.c | 78 +++++++++++-------------------- drivers/net/wireless/ath/ath9k/pci.c | 18 ++----- drivers/net/wireless/ath/ath9k/rc.c | 3 +- drivers/net/wireless/ath/ath9k/recv.c | 6 +- drivers/net/wireless/ath/ath9k/xmit.c | 9 +-- 10 files changed, 52 insertions(+), 105 deletions(-)
drivers/net/wireless/ath/ath9k/ahb.c +3 -9
@@ -54,7 +54,6 @@ static struct ath_bus_ops ath_ahb_bus_ops = {static int ath_ahb_probe (struct platform_device *pdev) {void __iomem *mem; -struct ath_wiphy *aphy;struct ath_softc *sc;struct ieee80211_hw *hw;struct resource *res;
@@ -92,8 +91,7 @@ static int ath_ahb_probe(struct platform_device *pdev) irq = res->start; - hw =ieee80211_alloc_hw (sizeof (struct ath_wiphy ) + -sizeof (struct ath_softc ), &ath9k_ops); + hw =ieee80211_alloc_hw (sizeof (struct ath_softc ), &ath9k_ops);if (hw ==NULL ) {dev_err (&pdev->dev,"no memory for ieee80211_hw\n" ); ret = -ENOMEM ;
@@ -103,10 +101,7 @@ static int ath_ahb_probe(struct platform_device *pdev)SET_IEEE80211_DEV (hw, &pdev->dev);platform_set_drvdata (pdev, hw); - aphy = hw->priv; - sc = (struct ath_softc *) (aphy +1 ); - aphy->sc = sc; - aphy->hw = hw; + sc = hw->priv; sc->hw = hw; sc->dev = &pdev->dev; sc->mem = mem;
@@ -150,8 +145,7 @@ static int ath_ahb_remove(struct platform_device *pdev)struct ieee80211_hw *hw =platform_get_drvdata (pdev);if (hw) { -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;void __iomem *mem = sc->mem;ath9k_deinit_device (sc);
drivers/net/wireless/ath/ath9k/ath9k.h +4 -9
@@ -32,7 +32,6 @@*/ struct ath_node ; -struct ath_wiphy ;/* Macro to expand scalars to 64-bit objects */
@@ -399,7 +398,7 @@ struct ath_beacon {void ath_beacon_tasklet (unsigned long data);void ath_beacon_config (struct ath_softc *sc,struct ieee80211_vif *vif); -int ath_beacon_alloc (struct ath_wiphy *aphy,struct ieee80211_vif *vif); +int ath_beacon_alloc (struct ath_softc *sc,struct ieee80211_vif *vif);void ath_beacon_return (struct ath_softc *sc,struct ath_vif *avp);int ath_beaconq_config (struct ath_softc *sc);
@@ -629,6 +628,9 @@ struct ath_softc {int led_on_cnt;int led_off_cnt; +struct ath9k_hw_cal_data caldata; +int last_rssi; +int beacon_interval;#ifdef CONFIG_ATH9K_DEBUGFS
@@ -648,13 +650,6 @@ struct ath_softc {struct pm_qos_request_list pm_qos_req; }; -struct ath_wiphy { -struct ath_softc *sc;/* shared for all virtual wiphys */ -struct ieee80211_hw *hw; -struct ath9k_hw_cal_data caldata; -int last_rssi; -}; -void ath9k_tasklet (unsigned long data);int ath_reset (struct ath_softc *sc,bool retry_tx);int ath_cabq_update (struct ath_softc *);
drivers/net/wireless/ath/ath9k/beacon.c +3 -6
@@ -112,8 +112,7 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp,static void ath_tx_cabq (struct ieee80211_hw *hw,struct sk_buff *skb) { -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_tx_control txctl;
@@ -132,8 +131,7 @@ static void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)static struct ath_buf *ath_beacon_generate (struct ieee80211_hw *hw,struct ieee80211_vif *vif) { -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_buf *bf;struct ath_vif *avp;
@@ -222,9 +220,8 @@ static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw,return bf; } -int ath_beacon_alloc (struct ath_wiphy *aphy,struct ieee80211_vif *vif) +int ath_beacon_alloc (struct ath_softc *sc,struct ieee80211_vif *vif) { -struct ath_softc *sc = aphy->sc;struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_vif *avp;struct ath_buf *bf;
drivers/net/wireless/ath/ath9k/gpio.c +1 -2
@@ -201,8 +201,7 @@ static bool ath_is_rfkill_set(struct ath_softc *sc)void ath9k_rfkill_poll_state (struct ieee80211_hw *hw) { -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;bool blocked = !!ath_is_rfkill_set (sc);wiphy_rfkill_set_hw_state (hw->wiphy, blocked);
drivers/net/wireless/ath/ath9k/init.c +2 -4
@@ -254,8 +254,7 @@ static int ath9k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) {struct ieee80211_hw *hw =wiphy_to_ieee80211_hw (wiphy); -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;struct ath_regulatory *reg =ath9k_hw_regulatory (sc->sc_ah);return ath_reg_notifier_apply (wiphy, request, reg);
@@ -704,7 +703,6 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid, const struct ath_bus_ops *bus_ops) {struct ieee80211_hw *hw = sc->hw; -struct ath_wiphy *aphy = hw->priv;struct ath_common *common;struct ath_hw *ah;int error =0 ;
@@ -759,7 +757,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,INIT_WORK (&sc->hw_check_work, ath_hw_check);INIT_WORK (&sc->paprd_work, ath_paprd_calibrate); - aphy->last_rssi =ATH_RSSI_DUMMY_MARKER ; + sc->last_rssi =ATH_RSSI_DUMMY_MARKER ;ath_init_leds (sc);ath_start_rfkill_poll (sc);
drivers/net/wireless/ath/ath9k/main.c +27 -51
253 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/pci.c +5 -13
@@ -126,7 +126,6 @@ static const struct ath_bus_ops ath_pci_bus_ops = {static int ath_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) {void __iomem *mem; -struct ath_wiphy *aphy;struct ath_softc *sc;struct ieee80211_hw *hw;u8 csz;
@@ -198,8 +197,7 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_iomap; } - hw =ieee80211_alloc_hw (sizeof (struct ath_wiphy ) + -sizeof (struct ath_softc ), &ath9k_ops); + hw =ieee80211_alloc_hw (sizeof (struct ath_softc ), &ath9k_ops);if (!hw) {dev_err (&pdev->dev,"No memory for ieee80211_hw\n" ); ret = -ENOMEM ;
@@ -209,10 +207,7 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)SET_IEEE80211_DEV (hw, &pdev->dev);pci_set_drvdata (pdev, hw); - aphy = hw->priv; - sc = (struct ath_softc *) (aphy +1 ); - aphy->sc = sc; - aphy->hw = hw; + sc = hw->priv; sc->hw = hw; sc->dev = &pdev->dev; sc->mem = mem;
@@ -259,8 +254,7 @@ err_dma:static void ath_pci_remove (struct pci_dev *pdev) {struct ieee80211_hw *hw =pci_get_drvdata (pdev); -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;void __iomem *mem = sc->mem;if (!is_ath9k_unloaded)
@@ -280,8 +274,7 @@ static int ath_pci_suspend(struct device *device) {struct pci_dev *pdev =to_pci_dev (device);struct ieee80211_hw *hw =pci_get_drvdata (pdev); -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;ath9k_hw_set_gpio (sc->sc_ah, sc->sc_ah->led_pin,1 );
@@ -292,8 +285,7 @@ static int ath_pci_resume(struct device *device) {struct pci_dev *pdev =to_pci_dev (device);struct ieee80211_hw *hw =pci_get_drvdata (pdev); -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;u32 val;/*
drivers/net/wireless/ath/ath9k/rc.c +1 -2
@@ -1560,8 +1560,7 @@ static void ath_rate_add_sta_debugfs(void *priv, void *priv_sta,static void *ath_rate_alloc (struct ieee80211_hw *hw,struct dentry *debugfsdir) { -struct ath_wiphy *aphy = hw->priv; -return aphy->sc; +return hw->priv; }static void ath_rate_free (void *priv)
drivers/net/wireless/ath/ath9k/recv.c +3 -3
@@ -927,7 +927,7 @@ static void ath9k_process_rssi(struct ath_common *common,struct ieee80211_hdr *hdr, struct ath_rx_status *rx_stats) { - struct ath_wiphy *aphy = hw->priv; + struct ath_softc *sc = hw->priv;struct ath_hw *ah = common->ah;int last_rssi;__le16 fc;
@@ -947,9 +947,9 @@ static void ath9k_process_rssi(struct ath_common *common, }if (rx_stats->rs_rssi !=ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr) -ATH_RSSI_LPF (aphy->last_rssi, rx_stats->rs_rssi); +ATH_RSSI_LPF (sc->last_rssi, rx_stats->rs_rssi); - last_rssi = aphy->last_rssi; + last_rssi = sc->last_rssi;if (likely (last_rssi !=ATH_RSSI_DUMMY_MARKER )) rx_stats->rs_rssi =ATH_EP_RND (last_rssi,ATH_RSSI_EP_MULTIPLIER );
drivers/net/wireless/ath/ath9k/xmit.c +3 -6
@@ -1445,8 +1445,7 @@ static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb)static void setup_frame_info (struct ieee80211_hw *hw,struct sk_buff *skb,int framelen) { -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb);struct ieee80211_sta *sta = tx_info->control.sta;struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
@@ -1664,8 +1663,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,struct ath_txq *txq, struct sk_buff *skb) { - struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; + struct ath_softc *sc = hw->priv;struct ath_hw *ah = sc->sc_ah;struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_frame_info *fi =get_frame_info (skb);
@@ -1766,8 +1764,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_sta *sta = info->control.sta; -struct ath_wiphy *aphy = hw->priv; -struct ath_softc *sc = aphy->sc; +struct ath_softc *sc = hw->priv;struct ath_txq *txq = txctl->txq;struct ath_buf *bf;int padpos, padsize;
Signature · 1 line
1.7.3.2