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>
This commit is contained in:
parent
cd6f341102
commit
1e87fec9fa
|
@ -226,9 +226,6 @@ TBD
|
||||||
.. kernel-doc:: include/net/mac80211.h
|
.. kernel-doc:: include/net/mac80211.h
|
||||||
:functions: ieee80211_tx_rate_control
|
:functions: ieee80211_tx_rate_control
|
||||||
|
|
||||||
.. kernel-doc:: include/net/mac80211.h
|
|
||||||
:functions: rate_control_send_low
|
|
||||||
|
|
||||||
TBD
|
TBD
|
||||||
|
|
||||||
This part of the book describes mac80211 internals.
|
This part of the book describes mac80211 internals.
|
||||||
|
|
|
@ -646,9 +646,6 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
|
||||||
il_sta = NULL;
|
il_sta = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rate_control_send_low(sta, il_sta, txrc))
|
|
||||||
return;
|
|
||||||
|
|
||||||
rate_mask = sta->supp_rates[sband->band];
|
rate_mask = sta->supp_rates[sband->band];
|
||||||
|
|
||||||
/* get user max rate if set */
|
/* get user max rate if set */
|
||||||
|
|
|
@ -2224,10 +2224,6 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
|
||||||
il_sta = NULL;
|
il_sta = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send management frames and NO_ACK data using lowest rate. */
|
|
||||||
if (rate_control_send_low(sta, il_sta, txrc))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!lq_sta)
|
if (!lq_sta)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -2731,10 +2731,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
|
||||||
priv_sta = NULL;
|
priv_sta = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send management frames and NO_ACK data using lowest rate. */
|
|
||||||
if (rate_control_send_low(sta, priv_sta, txrc))
|
|
||||||
return;
|
|
||||||
|
|
||||||
rate_idx = lq_sta->last_txrate_idx;
|
rate_idx = lq_sta->last_txrate_idx;
|
||||||
|
|
||||||
if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
|
if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
|
||||||
|
|
|
@ -2960,10 +2960,6 @@ static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta,
|
||||||
mvm_sta = NULL;
|
mvm_sta = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send management frames and NO_ACK data using lowest rate. */
|
|
||||||
if (rate_control_send_low(sta, mvm_sta, txrc))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!mvm_sta)
|
if (!mvm_sta)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -173,9 +173,6 @@ static void rtl_get_rate(void *ppriv, struct ieee80211_sta *sta,
|
||||||
u8 try_per_rate, i, rix;
|
u8 try_per_rate, i, rix;
|
||||||
bool not_data = !ieee80211_is_data(fc);
|
bool not_data = !ieee80211_is_data(fc);
|
||||||
|
|
||||||
if (rate_control_send_low(sta, priv_sta, txrc))
|
|
||||||
return;
|
|
||||||
|
|
||||||
rix = _rtl_rc_get_highest_rix(rtlpriv, sta, skb, not_data);
|
rix = _rtl_rc_get_highest_rix(rtlpriv, sta, skb, not_data);
|
||||||
try_per_rate = 1;
|
try_per_rate = 1;
|
||||||
_rtl_rc_rate_set_series(rtlpriv, sta, &rates[0], txrc,
|
_rtl_rc_rate_set_series(rtlpriv, sta, &rates[0], txrc,
|
||||||
|
|
|
@ -5960,29 +5960,6 @@ static inline int rate_supported(struct ieee80211_sta *sta,
|
||||||
return (sta == NULL || sta->supp_rates[band] & BIT(index));
|
return (sta == NULL || sta->supp_rates[band] & BIT(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* rate_control_send_low - helper for drivers for management/no-ack frames
|
|
||||||
*
|
|
||||||
* Rate control algorithms that agree to use the lowest rate to
|
|
||||||
* send management frames and NO_ACK data with the respective hw
|
|
||||||
* retries should use this in the beginning of their mac80211 get_rate
|
|
||||||
* callback. If true is returned the rate control can simply return.
|
|
||||||
* If false is returned we guarantee that sta and sta and priv_sta is
|
|
||||||
* not null.
|
|
||||||
*
|
|
||||||
* Rate control algorithms wishing to do more intelligent selection of
|
|
||||||
* rate for multicast/broadcast frames may choose to not use this.
|
|
||||||
*
|
|
||||||
* @sta: &struct ieee80211_sta pointer to the target destination. Note
|
|
||||||
* that this may be null.
|
|
||||||
* @priv_sta: private rate control structure. This may be null.
|
|
||||||
* @txrc: rate control information we sholud populate for mac80211.
|
|
||||||
*/
|
|
||||||
bool rate_control_send_low(struct ieee80211_sta *sta,
|
|
||||||
void *priv_sta,
|
|
||||||
struct ieee80211_tx_rate_control *txrc);
|
|
||||||
|
|
||||||
|
|
||||||
static inline s8
|
static inline s8
|
||||||
rate_lowest_index(struct ieee80211_supported_band *sband,
|
rate_lowest_index(struct ieee80211_supported_band *sband,
|
||||||
struct ieee80211_sta *sta)
|
struct ieee80211_sta *sta)
|
||||||
|
|
|
@ -369,9 +369,8 @@ static void __rate_control_send_low(struct ieee80211_hw *hw,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool rate_control_send_low(struct ieee80211_sta *pubsta,
|
static bool rate_control_send_low(struct ieee80211_sta *pubsta,
|
||||||
void *priv_sta,
|
struct ieee80211_tx_rate_control *txrc)
|
||||||
struct ieee80211_tx_rate_control *txrc)
|
|
||||||
{
|
{
|
||||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
|
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
|
||||||
struct ieee80211_supported_band *sband = txrc->sband;
|
struct ieee80211_supported_band *sband = txrc->sband;
|
||||||
|
@ -379,7 +378,7 @@ bool rate_control_send_low(struct ieee80211_sta *pubsta,
|
||||||
int mcast_rate;
|
int mcast_rate;
|
||||||
bool use_basicrate = false;
|
bool use_basicrate = false;
|
||||||
|
|
||||||
if (!pubsta || !priv_sta || rc_no_data_or_no_ack_use_min(txrc)) {
|
if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) {
|
||||||
__rate_control_send_low(txrc->hw, sband, pubsta, info,
|
__rate_control_send_low(txrc->hw, sband, pubsta, info,
|
||||||
txrc->rate_idx_mask);
|
txrc->rate_idx_mask);
|
||||||
|
|
||||||
|
@ -405,7 +404,6 @@ bool rate_control_send_low(struct ieee80211_sta *pubsta,
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(rate_control_send_low);
|
|
||||||
|
|
||||||
static bool rate_idx_match_legacy_mask(s8 *rate_idx, int n_bitrates, u32 mask)
|
static bool rate_idx_match_legacy_mask(s8 *rate_idx, int n_bitrates, u32 mask)
|
||||||
{
|
{
|
||||||
|
@ -902,12 +900,15 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
|
||||||
if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL))
|
if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (rate_control_send_low(ista, txrc))
|
||||||
|
return;
|
||||||
|
|
||||||
if (ista) {
|
if (ista) {
|
||||||
spin_lock_bh(&sta->rate_ctrl_lock);
|
spin_lock_bh(&sta->rate_ctrl_lock);
|
||||||
ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
|
ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
|
||||||
spin_unlock_bh(&sta->rate_ctrl_lock);
|
spin_unlock_bh(&sta->rate_ctrl_lock);
|
||||||
} else {
|
} else {
|
||||||
ref->ops->get_rate(ref->priv, NULL, NULL, txrc);
|
rate_control_send_low(NULL, txrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE))
|
if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE))
|
||||||
|
|
|
@ -340,10 +340,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
|
||||||
int delta;
|
int delta;
|
||||||
int sampling_ratio;
|
int sampling_ratio;
|
||||||
|
|
||||||
/* management/no-ack frames do not use rate control */
|
|
||||||
if (rate_control_send_low(sta, priv_sta, txrc))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* check multi-rate-retry capabilities & adjust lookaround_rate */
|
/* check multi-rate-retry capabilities & adjust lookaround_rate */
|
||||||
mrr_capable = mp->has_mrr &&
|
mrr_capable = mp->has_mrr &&
|
||||||
!txrc->rts &&
|
!txrc->rts &&
|
||||||
|
|
|
@ -1098,9 +1098,6 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
|
||||||
struct minstrel_priv *mp = priv;
|
struct minstrel_priv *mp = priv;
|
||||||
int sample_idx;
|
int sample_idx;
|
||||||
|
|
||||||
if (rate_control_send_low(sta, priv_sta, txrc))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!msp->is_ht)
|
if (!msp->is_ht)
|
||||||
return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc);
|
return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue