Skip to content

Commit 1e87fec

Browse files
committed
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>
1 parent cd6f341 commit 1e87fec

10 files changed

Lines changed: 7 additions & 57 deletions

File tree

‎Documentation/driver-api/80211/mac80211-advanced.rst‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,6 @@ TBD
226226
.. kernel-doc:: include/net/mac80211.h
227227
:functions: ieee80211_tx_rate_control
228228

229-
.. kernel-doc:: include/net/mac80211.h
230-
:functions: rate_control_send_low
231-
232229
TBD
233230

234231
This part of the book describes mac80211 internals.

‎drivers/net/wireless/intel/iwlegacy/3945-rs.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,6 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
646646
il_sta = NULL;
647647
}
648648

649-
if (rate_control_send_low(sta, il_sta, txrc))
650-
return;
651-
652649
rate_mask = sta->supp_rates[sband->band];
653650

654651
/* get user max rate if set */

‎drivers/net/wireless/intel/iwlegacy/4965-rs.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,10 +2224,6 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
22242224
il_sta = NULL;
22252225
}
22262226

2227-
/* Send management frames and NO_ACK data using lowest rate. */
2228-
if (rate_control_send_low(sta, il_sta, txrc))
2229-
return;
2230-
22312227
if (!lq_sta)
22322228
return;
22332229

‎drivers/net/wireless/intel/iwlwifi/dvm/rs.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,10 +2731,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
27312731
priv_sta = NULL;
27322732
}
27332733

2734-
/* Send management frames and NO_ACK data using lowest rate. */
2735-
if (rate_control_send_low(sta, priv_sta, txrc))
2736-
return;
2737-
27382734
rate_idx = lq_sta->last_txrate_idx;
27392735

27402736
if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {

‎drivers/net/wireless/intel/iwlwifi/mvm/rs.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2960,10 +2960,6 @@ static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta,
29602960
mvm_sta = NULL;
29612961
}
29622962

2963-
/* Send management frames and NO_ACK data using lowest rate. */
2964-
if (rate_control_send_low(sta, mvm_sta, txrc))
2965-
return;
2966-
29672963
if (!mvm_sta)
29682964
return;
29692965

‎drivers/net/wireless/realtek/rtlwifi/rc.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ static void rtl_get_rate(void *ppriv, struct ieee80211_sta *sta,
173173
u8 try_per_rate, i, rix;
174174
bool not_data = !ieee80211_is_data(fc);
175175

176-
if (rate_control_send_low(sta, priv_sta, txrc))
177-
return;
178-
179176
rix = _rtl_rc_get_highest_rix(rtlpriv, sta, skb, not_data);
180177
try_per_rate = 1;
181178
_rtl_rc_rate_set_series(rtlpriv, sta, &rates[0], txrc,

‎include/net/mac80211.h‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5960,29 +5960,6 @@ static inline int rate_supported(struct ieee80211_sta *sta,
59605960
return (sta == NULL || sta->supp_rates[band] & BIT(index));
59615961
}
59625962

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-
59865963
static inline s8
59875964
rate_lowest_index(struct ieee80211_supported_band *sband,
59885965
struct ieee80211_sta *sta)

‎net/mac80211/rate.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,17 +369,16 @@ static void __rate_control_send_low(struct ieee80211_hw *hw,
369369
}
370370

371371

372-
bool rate_control_send_low(struct ieee80211_sta *pubsta,
373-
void *priv_sta,
374-
struct ieee80211_tx_rate_control *txrc)
372+
static bool rate_control_send_low(struct ieee80211_sta *pubsta,
373+
struct ieee80211_tx_rate_control *txrc)
375374
{
376375
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
377376
struct ieee80211_supported_band *sband = txrc->sband;
378377
struct sta_info *sta;
379378
int mcast_rate;
380379
bool use_basicrate = false;
381380

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)) {
383382
__rate_control_send_low(txrc->hw, sband, pubsta, info,
384383
txrc->rate_idx_mask);
385384

@@ -405,7 +404,6 @@ bool rate_control_send_low(struct ieee80211_sta *pubsta,
405404
}
406405
return false;
407406
}
408-
EXPORT_SYMBOL(rate_control_send_low);
409407

410408
static bool rate_idx_match_legacy_mask(s8 *rate_idx, int n_bitrates, u32 mask)
411409
{
@@ -902,12 +900,15 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
902900
if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL))
903901
return;
904902

903+
if (rate_control_send_low(ista, txrc))
904+
return;
905+
905906
if (ista) {
906907
spin_lock_bh(&sta->rate_ctrl_lock);
907908
ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
908909
spin_unlock_bh(&sta->rate_ctrl_lock);
909910
} else {
910-
ref->ops->get_rate(ref->priv, NULL, NULL, txrc);
911+
rate_control_send_low(NULL, txrc);
911912
}
912913

913914
if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE))

‎net/mac80211/rc80211_minstrel.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
340340
int delta;
341341
int sampling_ratio;
342342

343-
/* management/no-ack frames do not use rate control */
344-
if (rate_control_send_low(sta, priv_sta, txrc))
345-
return;
346-
347343
/* check multi-rate-retry capabilities & adjust lookaround_rate */
348344
mrr_capable = mp->has_mrr &&
349345
!txrc->rts &&

‎net/mac80211/rc80211_minstrel_ht.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,9 +1098,6 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
10981098
struct minstrel_priv *mp = priv;
10991099
int sample_idx;
11001100

1101-
if (rate_control_send_low(sta, priv_sta, txrc))
1102-
return;
1103-
11041101
if (!msp->is_ht)
11051102
return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc);
11061103

0 commit comments

Comments
 (0)