diff options
author | Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> | 2015-02-17 04:12:18 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-03-03 08:36:02 -0500 |
commit | 97bf861572adacadc7a217487d77ba5c0be4b99d (patch) | |
tree | 6a5ae8dfdec2cce911d480b60977ba4426bafe3a | |
parent | 283dd11994cde99447a6dac203d96c0800e85e82 (diff) |
ath9k: add per-vif TX power capability to TX path
In order to add per-vif TX power capability cap per-packet TX power to vif
configured power if the latter is lower than per-rate TX power and mac80211
per-frame power. Use vif TX power if TPC has been disabled for current the
interface
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/xmit.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 1b8e75c4d2c2..0acd079ba96b 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1103,14 +1103,28 @@ static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf, | |||
1103 | struct sk_buff *skb; | 1103 | struct sk_buff *skb; |
1104 | struct ath_frame_info *fi; | 1104 | struct ath_frame_info *fi; |
1105 | struct ieee80211_tx_info *info; | 1105 | struct ieee80211_tx_info *info; |
1106 | struct ieee80211_vif *vif; | ||
1106 | struct ath_hw *ah = sc->sc_ah; | 1107 | struct ath_hw *ah = sc->sc_ah; |
1107 | 1108 | ||
1108 | if (sc->tx99_state || !ah->tpc_enabled) | 1109 | if (sc->tx99_state || !ah->tpc_enabled) |
1109 | return MAX_RATE_POWER; | 1110 | return MAX_RATE_POWER; |
1110 | 1111 | ||
1111 | skb = bf->bf_mpdu; | 1112 | skb = bf->bf_mpdu; |
1112 | fi = get_frame_info(skb); | ||
1113 | info = IEEE80211_SKB_CB(skb); | 1113 | info = IEEE80211_SKB_CB(skb); |
1114 | vif = info->control.vif; | ||
1115 | |||
1116 | if (!vif) { | ||
1117 | max_power = sc->cur_chan->cur_txpower; | ||
1118 | goto out; | ||
1119 | } | ||
1120 | |||
1121 | if (vif->bss_conf.txpower_type != NL80211_TX_POWER_LIMITED) { | ||
1122 | max_power = min_t(u8, sc->cur_chan->cur_txpower, | ||
1123 | 2 * vif->bss_conf.txpower); | ||
1124 | goto out; | ||
1125 | } | ||
1126 | |||
1127 | fi = get_frame_info(skb); | ||
1114 | 1128 | ||
1115 | if (!AR_SREV_9300_20_OR_LATER(ah)) { | 1129 | if (!AR_SREV_9300_20_OR_LATER(ah)) { |
1116 | int txpower = fi->tx_power; | 1130 | int txpower = fi->tx_power; |
@@ -1147,25 +1161,25 @@ static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf, | |||
1147 | txpower -= 2; | 1161 | txpower -= 2; |
1148 | 1162 | ||
1149 | txpower = max(txpower, 0); | 1163 | txpower = max(txpower, 0); |
1150 | max_power = min_t(u8, ah->tx_power[rateidx], txpower); | 1164 | max_power = min_t(u8, ah->tx_power[rateidx], |
1151 | 1165 | 2 * vif->bss_conf.txpower); | |
1152 | /* XXX: clamp minimum TX power at 1 for AR9160 since if | 1166 | max_power = min_t(u8, max_power, txpower); |
1153 | * max_power is set to 0, frames are transmitted at max | ||
1154 | * TX power | ||
1155 | */ | ||
1156 | if (!max_power && !AR_SREV_9280_20_OR_LATER(ah)) | ||
1157 | max_power = 1; | ||
1158 | } else if (!bf->bf_state.bfs_paprd) { | 1167 | } else if (!bf->bf_state.bfs_paprd) { |
1159 | if (rateidx < 8 && (info->flags & IEEE80211_TX_CTL_STBC)) | 1168 | if (rateidx < 8 && (info->flags & IEEE80211_TX_CTL_STBC)) |
1160 | max_power = min(ah->tx_power_stbc[rateidx], | 1169 | max_power = min_t(u8, ah->tx_power_stbc[rateidx], |
1161 | fi->tx_power); | 1170 | 2 * vif->bss_conf.txpower); |
1162 | else | 1171 | else |
1163 | max_power = min(ah->tx_power[rateidx], fi->tx_power); | 1172 | max_power = min_t(u8, ah->tx_power[rateidx], |
1173 | 2 * vif->bss_conf.txpower); | ||
1174 | max_power = min(max_power, fi->tx_power); | ||
1164 | } else { | 1175 | } else { |
1165 | max_power = ah->paprd_training_power; | 1176 | max_power = ah->paprd_training_power; |
1166 | } | 1177 | } |
1167 | 1178 | out: | |
1168 | return max_power; | 1179 | /* XXX: clamp minimum TX power at 1 for AR9160 since if max_power |
1180 | * is set to 0, frames are transmitted at max TX power | ||
1181 | */ | ||
1182 | return (!max_power && !AR_SREV_9280_20_OR_LATER(ah)) ? 1 : max_power; | ||
1169 | } | 1183 | } |
1170 | 1184 | ||
1171 | static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, | 1185 | static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, |