xmit.c (80c1834fc86c2bbacb54a8fc3c04a8b0066b0996) | xmit.c (ef1b6cd9a1ba06a3daf9a03aa8f25d52d1f2c31a) |
---|---|
1/* 2 * Copyright (c) 2008-2011 Atheros Communications Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 91 unchanged lines hidden (view full) --- 100 29616, 59232, 65532, 65532, 65532, 65532, 65532, 65532, 101 } 102}; 103 104/*********************/ 105/* Aggregation logic */ 106/*********************/ 107 | 1/* 2 * Copyright (c) 2008-2011 Atheros Communications Inc. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 91 unchanged lines hidden (view full) --- 100 29616, 59232, 65532, 65532, 65532, 65532, 65532, 65532, 101 } 102}; 103 104/*********************/ 105/* Aggregation logic */ 106/*********************/ 107 |
108static void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq) | 108void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq) |
109 __acquires(&txq->axq_lock) 110{ 111 spin_lock_bh(&txq->axq_lock); 112} 113 | 109 __acquires(&txq->axq_lock) 110{ 111 spin_lock_bh(&txq->axq_lock); 112} 113 |
114static void ath_txq_unlock(struct ath_softc *sc, struct ath_txq *txq) | 114void ath_txq_unlock(struct ath_softc *sc, struct ath_txq *txq) |
115 __releases(&txq->axq_lock) 116{ 117 spin_unlock_bh(&txq->axq_lock); 118} 119 | 115 __releases(&txq->axq_lock) 116{ 117 spin_unlock_bh(&txq->axq_lock); 118} 119 |
120static void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq) | 120void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq) |
121 __releases(&txq->axq_lock) 122{ 123 struct sk_buff_head q; 124 struct sk_buff *skb; 125 126 __skb_queue_head_init(&q); 127 skb_queue_splice_init(&txq->complete_q, &q); 128 spin_unlock_bh(&txq->axq_lock); --- 804 unchanged lines hidden (view full) --- 933 struct ath_tx_info *info, int len) 934{ 935 struct ath_hw *ah = sc->sc_ah; 936 struct sk_buff *skb; 937 struct ieee80211_tx_info *tx_info; 938 struct ieee80211_tx_rate *rates; 939 const struct ieee80211_rate *rate; 940 struct ieee80211_hdr *hdr; | 121 __releases(&txq->axq_lock) 122{ 123 struct sk_buff_head q; 124 struct sk_buff *skb; 125 126 __skb_queue_head_init(&q); 127 skb_queue_splice_init(&txq->complete_q, &q); 128 spin_unlock_bh(&txq->axq_lock); --- 804 unchanged lines hidden (view full) --- 933 struct ath_tx_info *info, int len) 934{ 935 struct ath_hw *ah = sc->sc_ah; 936 struct sk_buff *skb; 937 struct ieee80211_tx_info *tx_info; 938 struct ieee80211_tx_rate *rates; 939 const struct ieee80211_rate *rate; 940 struct ieee80211_hdr *hdr; |
941 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); | |
942 int i; 943 u8 rix = 0; 944 945 skb = bf->bf_mpdu; 946 tx_info = IEEE80211_SKB_CB(skb); 947 rates = tx_info->control.rates; 948 hdr = (struct ieee80211_hdr *)skb->data; 949 950 /* set dur_update_en for l-sig computation except for PS-Poll frames */ 951 info->dur_update = !ieee80211_is_pspoll(hdr->frame_control); | 941 int i; 942 u8 rix = 0; 943 944 skb = bf->bf_mpdu; 945 tx_info = IEEE80211_SKB_CB(skb); 946 rates = tx_info->control.rates; 947 hdr = (struct ieee80211_hdr *)skb->data; 948 949 /* set dur_update_en for l-sig computation except for PS-Poll frames */ 950 info->dur_update = !ieee80211_is_pspoll(hdr->frame_control); |
952 info->rtscts_rate = fi->rtscts_rate; | |
953 | 951 |
952 /* 953 * We check if Short Preamble is needed for the CTS rate by 954 * checking the BSS's global flag. 955 * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used. 956 */ 957 rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info); 958 info->rtscts_rate = rate->hw_value; 959 960 if (tx_info->control.vif && 961 tx_info->control.vif->bss_conf.use_short_preamble) 962 info->rtscts_rate |= rate->hw_value_short; 963 |
|
954 for (i = 0; i < 4; i++) { 955 bool is_40, is_sgi, is_sp; 956 int phy; 957 958 if (!rates[i].count || (rates[i].idx < 0)) 959 continue; 960 961 rix = rates[i].idx; --- 24 unchanged lines hidden (view full) --- 986 info->rates[i].PktDuration = ath_pkt_duration(sc, rix, len, 987 is_40, is_sgi, is_sp); 988 if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC)) 989 info->rates[i].RateFlags |= ATH9K_RATESERIES_STBC; 990 continue; 991 } 992 993 /* legacy rates */ | 964 for (i = 0; i < 4; i++) { 965 bool is_40, is_sgi, is_sp; 966 int phy; 967 968 if (!rates[i].count || (rates[i].idx < 0)) 969 continue; 970 971 rix = rates[i].idx; --- 24 unchanged lines hidden (view full) --- 996 info->rates[i].PktDuration = ath_pkt_duration(sc, rix, len, 997 is_40, is_sgi, is_sp); 998 if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC)) 999 info->rates[i].RateFlags |= ATH9K_RATESERIES_STBC; 1000 continue; 1001 } 1002 1003 /* legacy rates */ |
994 rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx]; | |
995 if ((tx_info->band == IEEE80211_BAND_2GHZ) && 996 !(rate->flags & IEEE80211_RATE_ERP_G)) 997 phy = WLAN_RC_PHY_CCK; 998 else 999 phy = WLAN_RC_PHY_OFDM; 1000 | 1004 if ((tx_info->band == IEEE80211_BAND_2GHZ) && 1005 !(rate->flags & IEEE80211_RATE_ERP_G)) 1006 phy = WLAN_RC_PHY_CCK; 1007 else 1008 phy = WLAN_RC_PHY_OFDM; 1009 |
1010 rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx]; |
|
1001 info->rates[i].Rate = rate->hw_value; 1002 if (rate->hw_value_short) { 1003 if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) 1004 info->rates[i].Rate |= rate->hw_value_short; 1005 } else { 1006 is_sp = false; 1007 } 1008 --- 752 unchanged lines hidden (view full) --- 1761 1762static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb, 1763 int framelen) 1764{ 1765 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 1766 struct ieee80211_sta *sta = tx_info->control.sta; 1767 struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; 1768 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1011 info->rates[i].Rate = rate->hw_value; 1012 if (rate->hw_value_short) { 1013 if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) 1014 info->rates[i].Rate |= rate->hw_value_short; 1015 } else { 1016 is_sp = false; 1017 } 1018 --- 752 unchanged lines hidden (view full) --- 1771 1772static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb, 1773 int framelen) 1774{ 1775 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 1776 struct ieee80211_sta *sta = tx_info->control.sta; 1777 struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; 1778 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1769 const struct ieee80211_rate *rate; | |
1770 struct ath_frame_info *fi = get_frame_info(skb); 1771 struct ath_node *an = NULL; 1772 enum ath9k_key_type keytype; | 1779 struct ath_frame_info *fi = get_frame_info(skb); 1780 struct ath_node *an = NULL; 1781 enum ath9k_key_type keytype; |
1773 bool short_preamble = false; | |
1774 | 1782 |
1775 /* 1776 * We check if Short Preamble is needed for the CTS rate by 1777 * checking the BSS's global flag. 1778 * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used. 1779 */ 1780 if (tx_info->control.vif && 1781 tx_info->control.vif->bss_conf.use_short_preamble) 1782 short_preamble = true; 1783 1784 rate = ieee80211_get_rts_cts_rate(hw, tx_info); | |
1785 keytype = ath9k_cmn_get_hw_crypto_keytype(skb); 1786 1787 if (sta) 1788 an = (struct ath_node *) sta->drv_priv; 1789 1790 memset(fi, 0, sizeof(*fi)); 1791 if (hw_key) 1792 fi->keyix = hw_key->hw_key_idx; 1793 else if (an && ieee80211_is_data(hdr->frame_control) && an->ps_key > 0) 1794 fi->keyix = an->ps_key; 1795 else 1796 fi->keyix = ATH9K_TXKEYIX_INVALID; 1797 fi->keytype = keytype; 1798 fi->framelen = framelen; | 1783 keytype = ath9k_cmn_get_hw_crypto_keytype(skb); 1784 1785 if (sta) 1786 an = (struct ath_node *) sta->drv_priv; 1787 1788 memset(fi, 0, sizeof(*fi)); 1789 if (hw_key) 1790 fi->keyix = hw_key->hw_key_idx; 1791 else if (an && ieee80211_is_data(hdr->frame_control) && an->ps_key > 0) 1792 fi->keyix = an->ps_key; 1793 else 1794 fi->keyix = ATH9K_TXKEYIX_INVALID; 1795 fi->keytype = keytype; 1796 fi->framelen = framelen; |
1799 fi->rtscts_rate = rate->hw_value; 1800 if (short_preamble) 1801 fi->rtscts_rate |= rate->hw_value_short; | |
1802} 1803 1804u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) 1805{ 1806 struct ath_hw *ah = sc->sc_ah; 1807 struct ath9k_channel *curchan = ah->curchan; 1808 if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && 1809 (curchan->channelFlags & CHANNEL_5GHZ) && --- 421 unchanged lines hidden (view full) --- 2231 ath_tx_return_buffer(sc, bf_held); 2232 } 2233 2234 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); 2235 } 2236 ath_txq_unlock_complete(sc, txq); 2237} 2238 | 1797} 1798 1799u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) 1800{ 1801 struct ath_hw *ah = sc->sc_ah; 1802 struct ath9k_channel *curchan = ah->curchan; 1803 if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && 1804 (curchan->channelFlags & CHANNEL_5GHZ) && --- 421 unchanged lines hidden (view full) --- 2226 ath_tx_return_buffer(sc, bf_held); 2227 } 2228 2229 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); 2230 } 2231 ath_txq_unlock_complete(sc, txq); 2232} 2233 |
2239static void ath_tx_complete_poll_work(struct work_struct *work) 2240{ 2241 struct ath_softc *sc = container_of(work, struct ath_softc, 2242 tx_complete_work.work); 2243 struct ath_txq *txq; 2244 int i; 2245 bool needreset = false; 2246#ifdef CONFIG_ATH9K_DEBUGFS 2247 sc->tx_complete_poll_work_seen++; 2248#endif 2249 2250 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) 2251 if (ATH_TXQ_SETUP(sc, i)) { 2252 txq = &sc->tx.txq[i]; 2253 ath_txq_lock(sc, txq); 2254 if (txq->axq_depth) { 2255 if (txq->axq_tx_inprogress) { 2256 needreset = true; 2257 ath_txq_unlock(sc, txq); 2258 break; 2259 } else { 2260 txq->axq_tx_inprogress = true; 2261 } 2262 } 2263 ath_txq_unlock_complete(sc, txq); 2264 } 2265 2266 if (needreset) { 2267 ath_dbg(ath9k_hw_common(sc->sc_ah), RESET, 2268 "tx hung, resetting the chip\n"); 2269 RESET_STAT_INC(sc, RESET_TYPE_TX_HANG); 2270 ieee80211_queue_work(sc->hw, &sc->hw_reset_work); 2271 } 2272 2273 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 2274 msecs_to_jiffies(ATH_TX_COMPLETE_POLL_INT)); 2275} 2276 2277 2278 | |
2279void ath_tx_tasklet(struct ath_softc *sc) 2280{ 2281 struct ath_hw *ah = sc->sc_ah; 2282 u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1) & ah->intr_txqs; 2283 int i; 2284 2285 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 2286 if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i))) --- 221 unchanged lines hidden --- | 2234void ath_tx_tasklet(struct ath_softc *sc) 2235{ 2236 struct ath_hw *ah = sc->sc_ah; 2237 u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1) & ah->intr_txqs; 2238 int i; 2239 2240 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 2241 if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i))) --- 221 unchanged lines hidden --- |