aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c7
-rw-r--r--include/net/mac80211.h23
-rw-r--r--net/mac80211/rate.c29
-rw-r--r--net/mac80211/rc80211_minstrel.c22
-rw-r--r--net/mac80211/rc80211_pid_algo.c11
7 files changed, 59 insertions, 60 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 2c72901adbee..630fcf46e0dd 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1518,23 +1518,11 @@ exit:
1518static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, 1518static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
1519 struct ieee80211_tx_rate_control *txrc) 1519 struct ieee80211_tx_rate_control *txrc)
1520{ 1520{
1521 struct ieee80211_supported_band *sband = txrc->sband;
1522 struct sk_buff *skb = txrc->skb;
1523 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1524 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1525 struct ath_softc *sc = priv; 1521 struct ath_softc *sc = priv;
1526 struct ath_rate_priv *ath_rc_priv = priv_sta; 1522 struct ath_rate_priv *ath_rc_priv = priv_sta;
1527 __le16 fc = hdr->frame_control;
1528 1523
1529 /* lowest rate for management and NO_ACK frames */ 1524 if (rate_control_send_low(sta, priv_sta, txrc))
1530 if (!ieee80211_is_data(fc) ||
1531 tx_info->flags & IEEE80211_TX_CTL_NO_ACK || !sta) {
1532 tx_info->control.rates[0].idx = rate_lowest_index(sband, sta);
1533 tx_info->control.rates[0].count =
1534 (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) ?
1535 1 : ATH_MGT_TXMAXTRY;
1536 return; 1525 return;
1537 }
1538 1526
1539 /* Find tx rate for unicast frames */ 1527 /* Find tx rate for unicast frames */
1540 ath_rc_ratefind(sc, ath_rc_priv, txrc); 1528 ath_rc_ratefind(sc, ath_rc_priv, txrc);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 2b776924d5e7..a16bd4147eac 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -673,7 +673,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
673 s8 scale_action = 0; 673 s8 scale_action = 0;
674 unsigned long flags; 674 unsigned long flags;
675 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 675 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
676 __le16 fc;
677 u16 rate_mask = sta ? sta->supp_rates[sband->band] : 0; 676 u16 rate_mask = sta ? sta->supp_rates[sband->band] : 0;
678 s8 max_rate_idx = -1; 677 s8 max_rate_idx = -1;
679 struct iwl_priv *priv = (struct iwl_priv *)priv_r; 678 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
@@ -681,16 +680,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
681 680
682 IWL_DEBUG_RATE(priv, "enter\n"); 681 IWL_DEBUG_RATE(priv, "enter\n");
683 682
684 /* Send management frames and NO_ACK data using lowest rate. */ 683 if (rate_control_send_low(sta, priv_sta, txrc))
685 fc = hdr->frame_control;
686 if (!ieee80211_is_data(fc) || info->flags & IEEE80211_TX_CTL_NO_ACK ||
687 !sta || !priv_sta) {
688 IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
689 info->control.rates[0].idx = rate_lowest_index(sband, sta);
690 if (info->flags & IEEE80211_TX_CTL_NO_ACK)
691 info->control.rates[0].count = 1;
692 return; 684 return;
693 } 685
686 rate_mask = sta->supp_rates[sband->band];
694 687
695 /* get user max rate if set */ 688 /* get user max rate if set */
696 max_rate_idx = txrc->max_rate_idx; 689 max_rate_idx = txrc->max_rate_idx;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 3fea027f35d1..63280411fd58 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -2481,13 +2481,8 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2481 } 2481 }
2482 2482
2483 /* Send management frames and NO_ACK data using lowest rate. */ 2483 /* Send management frames and NO_ACK data using lowest rate. */
2484 if (!ieee80211_is_data(hdr->frame_control) || 2484 if (rate_control_send_low(sta, priv_sta, txrc))
2485 info->flags & IEEE80211_TX_CTL_NO_ACK || !sta || !lq_sta) {
2486 info->control.rates[0].idx = rate_lowest_index(sband, sta);
2487 if (info->flags & IEEE80211_TX_CTL_NO_ACK)
2488 info->control.rates[0].count = 1;
2489 return; 2485 return;
2490 }
2491 2486
2492 rate_idx = lq_sta->last_txrate_idx; 2487 rate_idx = lq_sta->last_txrate_idx;
2493 2488
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d98fac54577b..a861259c3050 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2094,6 +2094,29 @@ static inline int rate_supported(struct ieee80211_sta *sta,
2094 return (sta == NULL || sta->supp_rates[band] & BIT(index)); 2094 return (sta == NULL || sta->supp_rates[band] & BIT(index));
2095} 2095}
2096 2096
2097/**
2098 * rate_control_send_low - helper for drivers for management/no-ack frames
2099 *
2100 * Rate control algorithms that agree to use the lowest rate to
2101 * send management frames and NO_ACK data with the respective hw
2102 * retries should use this in the beginning of their mac80211 get_rate
2103 * callback. If true is returned the rate control can simply return.
2104 * If false is returned we guarantee that sta and sta and priv_sta is
2105 * not null.
2106 *
2107 * Rate control algorithms wishing to do more intelligent selection of
2108 * rate for multicast/broadcast frames may choose to not use this.
2109 *
2110 * @sta: &struct ieee80211_sta pointer to the target destination. Note
2111 * that this may be null.
2112 * @priv_sta: private rate control structure. This may be null.
2113 * @txrc: rate control information we sholud populate for mac80211.
2114 */
2115bool rate_control_send_low(struct ieee80211_sta *sta,
2116 void *priv_sta,
2117 struct ieee80211_tx_rate_control *txrc);
2118
2119
2097static inline s8 2120static inline s8
2098rate_lowest_index(struct ieee80211_supported_band *sband, 2121rate_lowest_index(struct ieee80211_supported_band *sband,
2099 struct ieee80211_sta *sta) 2122 struct ieee80211_sta *sta)
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 4641f00a1e5c..8ac7a984d886 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -198,6 +198,35 @@ static void rate_control_release(struct kref *kref)
198 kfree(ctrl_ref); 198 kfree(ctrl_ref);
199} 199}
200 200
201static bool rc_no_data_or_no_ack(struct ieee80211_tx_rate_control *txrc)
202{
203 struct sk_buff *skb = txrc->skb;
204 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
205 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
206 __le16 fc;
207
208 fc = hdr->frame_control;
209
210 return ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc));
211}
212
213bool rate_control_send_low(struct ieee80211_sta *sta,
214 void *priv_sta,
215 struct ieee80211_tx_rate_control *txrc)
216{
217 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
218
219 if (!sta || !priv_sta || rc_no_data_or_no_ack(txrc)) {
220 info->control.rates[0].idx = rate_lowest_index(txrc->sband, sta);
221 info->control.rates[0].count =
222 (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
223 1 : txrc->hw->max_rate_tries;
224 return true;
225 }
226 return false;
227}
228EXPORT_SYMBOL(rate_control_send_low);
229
201void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, 230void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
202 struct sta_info *sta, 231 struct sta_info *sta,
203 struct ieee80211_tx_rate_control *txrc) 232 struct ieee80211_tx_rate_control *txrc)
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 5bdce0c951dd..7c5142988bbb 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -70,19 +70,6 @@ rix_to_ndx(struct minstrel_sta_info *mi, int rix)
70 return i; 70 return i;
71} 71}
72 72
73static inline bool
74use_low_rate(struct sk_buff *skb)
75{
76 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
77 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
78 __le16 fc;
79
80 fc = hdr->frame_control;
81
82 return ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !ieee80211_is_data(fc));
83}
84
85
86static void 73static void
87minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi) 74minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi)
88{ 75{
@@ -231,7 +218,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
231 void *priv_sta, struct ieee80211_tx_rate_control *txrc) 218 void *priv_sta, struct ieee80211_tx_rate_control *txrc)
232{ 219{
233 struct sk_buff *skb = txrc->skb; 220 struct sk_buff *skb = txrc->skb;
234 struct ieee80211_supported_band *sband = txrc->sband;
235 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 221 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
236 struct minstrel_sta_info *mi = priv_sta; 222 struct minstrel_sta_info *mi = priv_sta;
237 struct minstrel_priv *mp = priv; 223 struct minstrel_priv *mp = priv;
@@ -244,14 +230,8 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
244 int mrr_ndx[3]; 230 int mrr_ndx[3];
245 int sample_rate; 231 int sample_rate;
246 232
247 if (!sta || !mi || use_low_rate(skb)) { 233 if (rate_control_send_low(sta, priv_sta, txrc))
248 ar[0].idx = rate_lowest_index(sband, sta);
249 if (info->flags & IEEE80211_TX_CTL_NO_ACK)
250 ar[0].count = 1;
251 else
252 ar[0].count = mp->max_retry;
253 return; 234 return;
254 }
255 235
256 mrr = mp->has_mrr && !txrc->rts && !txrc->bss_conf->use_cts_prot; 236 mrr = mp->has_mrr && !txrc->rts && !txrc->bss_conf->use_cts_prot;
257 237
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 549607703bd8..8c053be9dc24 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -276,11 +276,9 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta,
276{ 276{
277 struct sk_buff *skb = txrc->skb; 277 struct sk_buff *skb = txrc->skb;
278 struct ieee80211_supported_band *sband = txrc->sband; 278 struct ieee80211_supported_band *sband = txrc->sband;
279 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
280 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 279 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
281 struct rc_pid_sta_info *spinfo = priv_sta; 280 struct rc_pid_sta_info *spinfo = priv_sta;
282 int rateidx; 281 int rateidx;
283 __le16 fc;
284 282
285 if (txrc->rts) 283 if (txrc->rts)
286 info->control.rates[0].count = 284 info->control.rates[0].count =
@@ -290,15 +288,8 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta,
290 txrc->hw->conf.short_frame_max_tx_count; 288 txrc->hw->conf.short_frame_max_tx_count;
291 289
292 /* Send management frames and NO_ACK data using lowest rate. */ 290 /* Send management frames and NO_ACK data using lowest rate. */
293 fc = hdr->frame_control; 291 if (rate_control_send_low(sta, priv_sta, txrc))
294 if (!sta || !spinfo || !ieee80211_is_data(fc) ||
295 info->flags & IEEE80211_TX_CTL_NO_ACK) {
296 info->control.rates[0].idx = rate_lowest_index(sband, sta);
297 if (info->flags & IEEE80211_TX_CTL_NO_ACK)
298 info->control.rates[0].count = 1;
299
300 return; 292 return;
301 }
302 293
303 rateidx = spinfo->txrate_idx; 294 rateidx = spinfo->txrate_idx;
304 295