diff options
author | Johannes Berg <johannes.berg@intel.com> | 2019-05-16 05:44:52 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2019-06-14 08:17:37 -0400 |
commit | 1e87fec9fa52a6f7c223998d6bfbd3464eb37e31 (patch) | |
tree | cf0ed29354439264496250104807143bffd1231e | |
parent | cd6f34110285742ec5570f07aa2229e29f4d2092 (diff) |
mac80211: call rate_control_send_low() internally
There's no rate control algorithm that *doesn't* want to call
it internally, and calling it internally will let us modify
its behaviour in the future.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | Documentation/driver-api/80211/mac80211-advanced.rst | 3 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlegacy/3945-rs.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlegacy/4965-rs.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/dvm/rs.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/realtek/rtlwifi/rc.c | 3 | ||||
-rw-r--r-- | include/net/mac80211.h | 23 | ||||
-rw-r--r-- | net/mac80211/rate.c | 13 | ||||
-rw-r--r-- | net/mac80211/rc80211_minstrel.c | 4 | ||||
-rw-r--r-- | net/mac80211/rc80211_minstrel_ht.c | 3 |
10 files changed, 7 insertions, 57 deletions
diff --git a/Documentation/driver-api/80211/mac80211-advanced.rst b/Documentation/driver-api/80211/mac80211-advanced.rst index 70a89b2163c2..9f1c5bb7ac35 100644 --- a/Documentation/driver-api/80211/mac80211-advanced.rst +++ b/Documentation/driver-api/80211/mac80211-advanced.rst | |||
@@ -226,9 +226,6 @@ TBD | |||
226 | .. kernel-doc:: include/net/mac80211.h | 226 | .. kernel-doc:: include/net/mac80211.h |
227 | :functions: ieee80211_tx_rate_control | 227 | :functions: ieee80211_tx_rate_control |
228 | 228 | ||
229 | .. kernel-doc:: include/net/mac80211.h | ||
230 | :functions: rate_control_send_low | ||
231 | |||
232 | TBD | 229 | TBD |
233 | 230 | ||
234 | This part of the book describes mac80211 internals. | 231 | This part of the book describes mac80211 internals. |
diff --git a/drivers/net/wireless/intel/iwlegacy/3945-rs.c b/drivers/net/wireless/intel/iwlegacy/3945-rs.c index a697edd46e7f..922f09f7ea3e 100644 --- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c +++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c | |||
@@ -646,9 +646,6 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta, | |||
646 | il_sta = NULL; | 646 | il_sta = NULL; |
647 | } | 647 | } |
648 | 648 | ||
649 | if (rate_control_send_low(sta, il_sta, txrc)) | ||
650 | return; | ||
651 | |||
652 | rate_mask = sta->supp_rates[sband->band]; | 649 | rate_mask = sta->supp_rates[sband->band]; |
653 | 650 | ||
654 | /* get user max rate if set */ | 651 | /* get user max rate if set */ |
diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wireless/intel/iwlegacy/4965-rs.c index 54ff83829afb..946f352fd9a4 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c | |||
@@ -2224,10 +2224,6 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta, | |||
2224 | il_sta = NULL; | 2224 | il_sta = NULL; |
2225 | } | 2225 | } |
2226 | 2226 | ||
2227 | /* Send management frames and NO_ACK data using lowest rate. */ | ||
2228 | if (rate_control_send_low(sta, il_sta, txrc)) | ||
2229 | return; | ||
2230 | |||
2231 | if (!lq_sta) | 2227 | if (!lq_sta) |
2232 | return; | 2228 | return; |
2233 | 2229 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c index ef4b9de256f7..838e76a5db68 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/rs.c | |||
@@ -2731,10 +2731,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2731 | priv_sta = NULL; | 2731 | priv_sta = NULL; |
2732 | } | 2732 | } |
2733 | 2733 | ||
2734 | /* Send management frames and NO_ACK data using lowest rate. */ | ||
2735 | if (rate_control_send_low(sta, priv_sta, txrc)) | ||
2736 | return; | ||
2737 | |||
2738 | rate_idx = lq_sta->last_txrate_idx; | 2734 | rate_idx = lq_sta->last_txrate_idx; |
2739 | 2735 | ||
2740 | if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { | 2736 | if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c index c182821ab22b..9107b1698b0f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c | |||
@@ -2960,10 +2960,6 @@ static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta, | |||
2960 | mvm_sta = NULL; | 2960 | mvm_sta = NULL; |
2961 | } | 2961 | } |
2962 | 2962 | ||
2963 | /* Send management frames and NO_ACK data using lowest rate. */ | ||
2964 | if (rate_control_send_low(sta, mvm_sta, txrc)) | ||
2965 | return; | ||
2966 | |||
2967 | if (!mvm_sta) | 2963 | if (!mvm_sta) |
2968 | return; | 2964 | return; |
2969 | 2965 | ||
diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.c b/drivers/net/wireless/realtek/rtlwifi/rc.c index cf8e42a01015..0c7d74902d33 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rc.c +++ b/drivers/net/wireless/realtek/rtlwifi/rc.c | |||
@@ -173,9 +173,6 @@ static void rtl_get_rate(void *ppriv, struct ieee80211_sta *sta, | |||
173 | u8 try_per_rate, i, rix; | 173 | u8 try_per_rate, i, rix; |
174 | bool not_data = !ieee80211_is_data(fc); | 174 | bool not_data = !ieee80211_is_data(fc); |
175 | 175 | ||
176 | if (rate_control_send_low(sta, priv_sta, txrc)) | ||
177 | return; | ||
178 | |||
179 | rix = _rtl_rc_get_highest_rix(rtlpriv, sta, skb, not_data); | 176 | rix = _rtl_rc_get_highest_rix(rtlpriv, sta, skb, not_data); |
180 | try_per_rate = 1; | 177 | try_per_rate = 1; |
181 | _rtl_rc_rate_set_series(rtlpriv, sta, &rates[0], txrc, | 178 | _rtl_rc_rate_set_series(rtlpriv, sta, &rates[0], txrc, |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index ed4911306f03..4411120e5a9a 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -5960,29 +5960,6 @@ static inline int rate_supported(struct ieee80211_sta *sta, | |||
5960 | return (sta == NULL || sta->supp_rates[band] & BIT(index)); | 5960 | return (sta == NULL || sta->supp_rates[band] & BIT(index)); |
5961 | } | 5961 | } |
5962 | 5962 | ||
5963 | /** | ||
5964 | * rate_control_send_low - helper for drivers for management/no-ack frames | ||
5965 | * | ||
5966 | * Rate control algorithms that agree to use the lowest rate to | ||
5967 | * send management frames and NO_ACK data with the respective hw | ||
5968 | * retries should use this in the beginning of their mac80211 get_rate | ||
5969 | * callback. If true is returned the rate control can simply return. | ||
5970 | * If false is returned we guarantee that sta and sta and priv_sta is | ||
5971 | * not null. | ||
5972 | * | ||
5973 | * Rate control algorithms wishing to do more intelligent selection of | ||
5974 | * rate for multicast/broadcast frames may choose to not use this. | ||
5975 | * | ||
5976 | * @sta: &struct ieee80211_sta pointer to the target destination. Note | ||
5977 | * that this may be null. | ||
5978 | * @priv_sta: private rate control structure. This may be null. | ||
5979 | * @txrc: rate control information we sholud populate for mac80211. | ||
5980 | */ | ||
5981 | bool rate_control_send_low(struct ieee80211_sta *sta, | ||
5982 | void *priv_sta, | ||
5983 | struct ieee80211_tx_rate_control *txrc); | ||
5984 | |||
5985 | |||
5986 | static inline s8 | 5963 | static inline s8 |
5987 | rate_lowest_index(struct ieee80211_supported_band *sband, | 5964 | rate_lowest_index(struct ieee80211_supported_band *sband, |
5988 | struct ieee80211_sta *sta) | 5965 | struct ieee80211_sta *sta) |
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 76f303fda3ed..09f89d004a70 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -369,9 +369,8 @@ static void __rate_control_send_low(struct ieee80211_hw *hw, | |||
369 | } | 369 | } |
370 | 370 | ||
371 | 371 | ||
372 | bool rate_control_send_low(struct ieee80211_sta *pubsta, | 372 | static bool rate_control_send_low(struct ieee80211_sta *pubsta, |
373 | void *priv_sta, | 373 | struct ieee80211_tx_rate_control *txrc) |
374 | struct ieee80211_tx_rate_control *txrc) | ||
375 | { | 374 | { |
376 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); | 375 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); |
377 | struct ieee80211_supported_band *sband = txrc->sband; | 376 | struct ieee80211_supported_band *sband = txrc->sband; |
@@ -379,7 +378,7 @@ bool rate_control_send_low(struct ieee80211_sta *pubsta, | |||
379 | int mcast_rate; | 378 | int mcast_rate; |
380 | bool use_basicrate = false; | 379 | bool use_basicrate = false; |
381 | 380 | ||
382 | if (!pubsta || !priv_sta || rc_no_data_or_no_ack_use_min(txrc)) { | 381 | if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) { |
383 | __rate_control_send_low(txrc->hw, sband, pubsta, info, | 382 | __rate_control_send_low(txrc->hw, sband, pubsta, info, |
384 | txrc->rate_idx_mask); | 383 | txrc->rate_idx_mask); |
385 | 384 | ||
@@ -405,7 +404,6 @@ bool rate_control_send_low(struct ieee80211_sta *pubsta, | |||
405 | } | 404 | } |
406 | return false; | 405 | return false; |
407 | } | 406 | } |
408 | EXPORT_SYMBOL(rate_control_send_low); | ||
409 | 407 | ||
410 | static bool rate_idx_match_legacy_mask(s8 *rate_idx, int n_bitrates, u32 mask) | 408 | static bool rate_idx_match_legacy_mask(s8 *rate_idx, int n_bitrates, u32 mask) |
411 | { | 409 | { |
@@ -902,12 +900,15 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, | |||
902 | if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL)) | 900 | if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL)) |
903 | return; | 901 | return; |
904 | 902 | ||
903 | if (rate_control_send_low(ista, txrc)) | ||
904 | return; | ||
905 | |||
905 | if (ista) { | 906 | if (ista) { |
906 | spin_lock_bh(&sta->rate_ctrl_lock); | 907 | spin_lock_bh(&sta->rate_ctrl_lock); |
907 | ref->ops->get_rate(ref->priv, ista, priv_sta, txrc); | 908 | ref->ops->get_rate(ref->priv, ista, priv_sta, txrc); |
908 | spin_unlock_bh(&sta->rate_ctrl_lock); | 909 | spin_unlock_bh(&sta->rate_ctrl_lock); |
909 | } else { | 910 | } else { |
910 | ref->ops->get_rate(ref->priv, NULL, NULL, txrc); | 911 | rate_control_send_low(NULL, txrc); |
911 | } | 912 | } |
912 | 913 | ||
913 | if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE)) | 914 | if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE)) |
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index a34e9c2ca626..ee86c3333999 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
@@ -340,10 +340,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, | |||
340 | int delta; | 340 | int delta; |
341 | int sampling_ratio; | 341 | int sampling_ratio; |
342 | 342 | ||
343 | /* management/no-ack frames do not use rate control */ | ||
344 | if (rate_control_send_low(sta, priv_sta, txrc)) | ||
345 | return; | ||
346 | |||
347 | /* check multi-rate-retry capabilities & adjust lookaround_rate */ | 343 | /* check multi-rate-retry capabilities & adjust lookaround_rate */ |
348 | mrr_capable = mp->has_mrr && | 344 | mrr_capable = mp->has_mrr && |
349 | !txrc->rts && | 345 | !txrc->rts && |
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 8b168724c5e7..da18c6fb6c1d 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -1098,9 +1098,6 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
1098 | struct minstrel_priv *mp = priv; | 1098 | struct minstrel_priv *mp = priv; |
1099 | int sample_idx; | 1099 | int sample_idx; |
1100 | 1100 | ||
1101 | if (rate_control_send_low(sta, priv_sta, txrc)) | ||
1102 | return; | ||
1103 | |||
1104 | if (!msp->is_ht) | 1101 | if (!msp->is_ht) |
1105 | return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc); | 1102 | return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc); |
1106 | 1103 | ||