mac80211: call rate_control_send_low() internally
authorJohannes Berg <johannes.berg@intel.com>
Thu, 16 May 2019 09:44:52 +0000 (11:44 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 14 Jun 2019 12:17:37 +0000 (14:17 +0200)
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>
Documentation/driver-api/80211/mac80211-advanced.rst
drivers/net/wireless/intel/iwlegacy/3945-rs.c
drivers/net/wireless/intel/iwlegacy/4965-rs.c
drivers/net/wireless/intel/iwlwifi/dvm/rs.c
drivers/net/wireless/intel/iwlwifi/mvm/rs.c
drivers/net/wireless/realtek/rtlwifi/rc.c
include/net/mac80211.h
net/mac80211/rate.c
net/mac80211/rc80211_minstrel.c
net/mac80211/rc80211_minstrel_ht.c

index 70a89b2..9f1c5bb 100644 (file)
@@ -226,9 +226,6 @@ TBD
 .. kernel-doc:: include/net/mac80211.h
    :functions: ieee80211_tx_rate_control
 
-.. kernel-doc:: include/net/mac80211.h
-   :functions: rate_control_send_low
-
 TBD
 
 This part of the book describes mac80211 internals.
index a697edd..922f09f 100644 (file)
@@ -646,9 +646,6 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
                il_sta = NULL;
        }
 
-       if (rate_control_send_low(sta, il_sta, txrc))
-               return;
-
        rate_mask = sta->supp_rates[sband->band];
 
        /* get user max rate if set */
index 54ff838..946f352 100644 (file)
@@ -2224,10 +2224,6 @@ il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
                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)
                return;
 
index ef4b9de..838e76a 100644 (file)
@@ -2731,10 +2731,6 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
                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;
 
        if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
index c182821..9107b16 100644 (file)
@@ -2960,10 +2960,6 @@ static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta,
                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)
                return;
 
index cf8e42a..0c7d749 100644 (file)
@@ -173,9 +173,6 @@ static void rtl_get_rate(void *ppriv, struct ieee80211_sta *sta,
        u8 try_per_rate, i, rix;
        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);
        try_per_rate = 1;
        _rtl_rc_rate_set_series(rtlpriv, sta, &rates[0], txrc,
index ed49113..4411120 100644 (file)
@@ -5960,29 +5960,6 @@ static inline int rate_supported(struct ieee80211_sta *sta,
        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
 rate_lowest_index(struct ieee80211_supported_band *sband,
                  struct ieee80211_sta *sta)
index 76f303f..09f89d0 100644 (file)
@@ -369,9 +369,8 @@ static void __rate_control_send_low(struct ieee80211_hw *hw,
 }
 
 
-bool rate_control_send_low(struct ieee80211_sta *pubsta,
-                          void *priv_sta,
-                          struct ieee80211_tx_rate_control *txrc)
+static bool rate_control_send_low(struct ieee80211_sta *pubsta,
+                                 struct ieee80211_tx_rate_control *txrc)
 {
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
        struct ieee80211_supported_band *sband = txrc->sband;
@@ -379,7 +378,7 @@ bool rate_control_send_low(struct ieee80211_sta *pubsta,
        int mcast_rate;
        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,
                                        txrc->rate_idx_mask);
 
@@ -405,7 +404,6 @@ bool rate_control_send_low(struct ieee80211_sta *pubsta,
        }
        return false;
 }
-EXPORT_SYMBOL(rate_control_send_low);
 
 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))
                return;
 
+       if (rate_control_send_low(ista, txrc))
+               return;
+
        if (ista) {
                spin_lock_bh(&sta->rate_ctrl_lock);
                ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
                spin_unlock_bh(&sta->rate_ctrl_lock);
        } 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))
index a34e9c2..ee86c33 100644 (file)
@@ -340,10 +340,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
        int delta;
        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 */
        mrr_capable = mp->has_mrr &&
                      !txrc->rts &&
index 8b16872..da18c6f 100644 (file)
@@ -1098,9 +1098,6 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
        struct minstrel_priv *mp = priv;
        int sample_idx;
 
-       if (rate_control_send_low(sta, priv_sta, txrc))
-               return;
-
        if (!msp->is_ht)
                return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc);