aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/xmit.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-04-22 17:11:44 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-04-23 14:14:53 -0400
commit79acac070854883b46e94257a06842eff278dab5 (patch)
tree47ca41341660896e3cbf6f0bcec430b53d7119d6 /drivers/net/wireless/ath/ath9k/xmit.c
parentbdc21457ac2bb75b59e774303edbb623830284ae (diff)
ath9k: add support for the new rate control API
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/xmit.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 108fe5fc1eaa..eab0fcb7ded6 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -157,6 +157,13 @@ static void ath_send_bar(struct ath_atx_tid *tid, u16 seqno)
157 seqno << IEEE80211_SEQ_SEQ_SHIFT); 157 seqno << IEEE80211_SEQ_SEQ_SHIFT);
158} 158}
159 159
160static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
161 struct ath_buf *bf)
162{
163 ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
164 ARRAY_SIZE(bf->rates));
165}
166
160static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) 167static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
161{ 168{
162 struct ath_txq *txq = tid->ac->txq; 169 struct ath_txq *txq = tid->ac->txq;
@@ -189,6 +196,7 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
189 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 196 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
190 sendbar = true; 197 sendbar = true;
191 } else { 198 } else {
199 ath_set_rates(tid->an->vif, tid->an->sta, bf);
192 ath_tx_send_normal(sc, txq, NULL, skb); 200 ath_tx_send_normal(sc, txq, NULL, skb);
193 } 201 }
194 } 202 }
@@ -407,7 +415,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
407 415
408 tx_info = IEEE80211_SKB_CB(skb); 416 tx_info = IEEE80211_SKB_CB(skb);
409 417
410 memcpy(rates, tx_info->control.rates, sizeof(rates)); 418 memcpy(rates, bf->rates, sizeof(rates));
411 419
412 retries = ts->ts_longretry + 1; 420 retries = ts->ts_longretry + 1;
413 for (i = 0; i < ts->ts_rateindex; i++) 421 for (i = 0; i < ts->ts_rateindex; i++)
@@ -736,8 +744,6 @@ static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid,
736 bool first_subfrm) 744 bool first_subfrm)
737{ 745{
738#define FIRST_DESC_NDELIMS 60 746#define FIRST_DESC_NDELIMS 60
739 struct sk_buff *skb = bf->bf_mpdu;
740 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
741 u32 nsymbits, nsymbols; 747 u32 nsymbits, nsymbols;
742 u16 minlen; 748 u16 minlen;
743 u8 flags, rix; 749 u8 flags, rix;
@@ -778,8 +784,8 @@ static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid,
778 if (tid->an->mpdudensity == 0) 784 if (tid->an->mpdudensity == 0)
779 return ndelim; 785 return ndelim;
780 786
781 rix = tx_info->control.rates[0].idx; 787 rix = bf->rates[0].idx;
782 flags = tx_info->control.rates[0].flags; 788 flags = bf->rates[0].flags;
783 width = (flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ? 1 : 0; 789 width = (flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ? 1 : 0;
784 half_gi = (flags & IEEE80211_TX_RC_SHORT_GI) ? 1 : 0; 790 half_gi = (flags & IEEE80211_TX_RC_SHORT_GI) ? 1 : 0;
785 791
@@ -858,6 +864,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
858 bf_first = bf; 864 bf_first = bf;
859 865
860 if (!rl) { 866 if (!rl) {
867 ath_set_rates(tid->an->vif, tid->an->sta, bf);
861 aggr_limit = ath_lookup_rate(sc, bf, tid); 868 aggr_limit = ath_lookup_rate(sc, bf, tid);
862 rl = 1; 869 rl = 1;
863 } 870 }
@@ -998,14 +1005,14 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
998 1005
999 skb = bf->bf_mpdu; 1006 skb = bf->bf_mpdu;
1000 tx_info = IEEE80211_SKB_CB(skb); 1007 tx_info = IEEE80211_SKB_CB(skb);
1001 rates = tx_info->control.rates; 1008 rates = bf->rates;
1002 hdr = (struct ieee80211_hdr *)skb->data; 1009 hdr = (struct ieee80211_hdr *)skb->data;
1003 1010
1004 /* set dur_update_en for l-sig computation except for PS-Poll frames */ 1011 /* set dur_update_en for l-sig computation except for PS-Poll frames */
1005 info->dur_update = !ieee80211_is_pspoll(hdr->frame_control); 1012 info->dur_update = !ieee80211_is_pspoll(hdr->frame_control);
1006 info->rtscts_rate = fi->rtscts_rate; 1013 info->rtscts_rate = fi->rtscts_rate;
1007 1014
1008 for (i = 0; i < 4; i++) { 1015 for (i = 0; i < ARRAY_SIZE(bf->rates); i++) {
1009 bool is_40, is_sgi, is_sp; 1016 bool is_40, is_sgi, is_sp;
1010 int phy; 1017 int phy;
1011 1018
@@ -1743,6 +1750,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
1743 return; 1750 return;
1744 } 1751 }
1745 1752
1753 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1746 bf->bf_state.bf_type = BUF_AMPDU; 1754 bf->bf_state.bf_type = BUF_AMPDU;
1747 INIT_LIST_HEAD(&bf_head); 1755 INIT_LIST_HEAD(&bf_head);
1748 list_add(&bf->list, &bf_head); 1756 list_add(&bf->list, &bf_head);
@@ -1993,6 +2001,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
1993 if (txctl->paprd) 2001 if (txctl->paprd)
1994 bf->bf_state.bfs_paprd_timestamp = jiffies; 2002 bf->bf_state.bfs_paprd_timestamp = jiffies;
1995 2003
2004 ath_set_rates(vif, sta, bf);
1996 ath_tx_send_normal(sc, txctl->txq, tid, skb); 2005 ath_tx_send_normal(sc, txctl->txq, tid, skb);
1997 2006
1998out: 2007out: