Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211/rc80211: add chandef to rate initialization

5 and 10 MHz support needs to know the current operating channel width,
add the chandef to the rate control API.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

authored by

Simon Wunderlich and committed by
Johannes Berg
3de805cf dcd6eac1

+39 -12
+2
drivers/net/wireless/ath/ath9k/rc.c
··· 1275 1275 } 1276 1276 1277 1277 static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, 1278 + struct cfg80211_chan_def *chandef, 1278 1279 struct ieee80211_sta *sta, void *priv_sta) 1279 1280 { 1280 1281 struct ath_softc *sc = priv; ··· 1314 1313 } 1315 1314 1316 1315 static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, 1316 + struct cfg80211_chan_def *chandef, 1317 1317 struct ieee80211_sta *sta, void *priv_sta, 1318 1318 u32 changed) 1319 1319 {
+1
drivers/net/wireless/iwlegacy/3945-rs.c
··· 887 887 */ 888 888 static void 889 889 il3945_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, 890 + struct cfg80211_chan_def *chandef, 890 891 struct ieee80211_sta *sta, void *il_sta) 891 892 { 892 893 }
+1
drivers/net/wireless/iwlegacy/4965-rs.c
··· 2803 2803 */ 2804 2804 static void 2805 2805 il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, 2806 + struct cfg80211_chan_def *chandef, 2806 2807 struct ieee80211_sta *sta, void *il_sta) 2807 2808 { 2808 2809 }
+2 -1
drivers/net/wireless/iwlwifi/dvm/rs.c
··· 3319 3319 * station is added we ignore it. 3320 3320 */ 3321 3321 static void rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, 3322 - struct ieee80211_sta *sta, void *priv_sta) 3322 + struct cfg80211_chan_def *chandef, 3323 + struct ieee80211_sta *sta, void *priv_sta) 3323 3324 { 3324 3325 } 3325 3326 static struct rate_control_ops rs_ops = {
+3 -2
drivers/net/wireless/iwlwifi/mvm/rs.c
··· 3159 3159 * station is added we ignore it. 3160 3160 */ 3161 3161 static void rs_rate_init_stub(void *mvm_r, 3162 - struct ieee80211_supported_band *sband, 3163 - struct ieee80211_sta *sta, void *mvm_sta) 3162 + struct ieee80211_supported_band *sband, 3163 + struct cfg80211_chan_def *chandef, 3164 + struct ieee80211_sta *sta, void *mvm_sta) 3164 3165 { 3165 3166 } 3166 3167 static struct rate_control_ops rs_mvm_ops = {
+1
drivers/net/wireless/rtlwifi/rc.c
··· 218 218 219 219 static void rtl_rate_init(void *ppriv, 220 220 struct ieee80211_supported_band *sband, 221 + struct cfg80211_chan_def *chandef, 221 222 struct ieee80211_sta *sta, void *priv_sta) 222 223 { 223 224 }
+2
include/net/mac80211.h
··· 4204 4204 4205 4205 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); 4206 4206 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, 4207 + struct cfg80211_chan_def *chandef, 4207 4208 struct ieee80211_sta *sta, void *priv_sta); 4208 4209 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, 4210 + struct cfg80211_chan_def *chandef, 4209 4211 struct ieee80211_sta *sta, void *priv_sta, 4210 4212 u32 changed); 4211 4213 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
+17 -5
net/mac80211/rate.h
··· 66 66 } 67 67 68 68 sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band]; 69 - rcu_read_unlock(); 70 69 71 70 ieee80211_sta_set_rx_nss(sta); 72 71 73 - ref->ops->rate_init(ref->priv, sband, ista, priv_sta); 72 + ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista, 73 + priv_sta); 74 + rcu_read_unlock(); 74 75 set_sta_flag(sta, WLAN_STA_RATE_CONTROL); 75 76 } 76 77 ··· 82 81 struct rate_control_ref *ref = local->rate_ctrl; 83 82 struct ieee80211_sta *ista = &sta->sta; 84 83 void *priv_sta = sta->rate_ctrl_priv; 84 + struct ieee80211_chanctx_conf *chanctx_conf; 85 85 86 - if (ref && ref->ops->rate_update) 87 - ref->ops->rate_update(ref->priv, sband, ista, 88 - priv_sta, changed); 86 + if (ref && ref->ops->rate_update) { 87 + rcu_read_lock(); 88 + 89 + chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf); 90 + if (WARN_ON(!chanctx_conf)) { 91 + rcu_read_unlock(); 92 + return; 93 + } 94 + 95 + ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def, 96 + ista, priv_sta, changed); 97 + rcu_read_unlock(); 98 + } 89 99 drv_sta_rc_update(local, sta->sdata, &sta->sta, changed); 90 100 } 91 101
+2 -1
net/mac80211/rc80211_minstrel.c
··· 417 417 418 418 static void 419 419 minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, 420 - struct ieee80211_sta *sta, void *priv_sta) 420 + struct cfg80211_chan_def *chandef, 421 + struct ieee80211_sta *sta, void *priv_sta) 421 422 { 422 423 struct minstrel_sta_info *mi = priv_sta; 423 424 struct minstrel_priv *mp = priv;
+7 -3
net/mac80211/rc80211_minstrel_ht.c
··· 836 836 837 837 static void 838 838 minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, 839 + struct cfg80211_chan_def *chandef, 839 840 struct ieee80211_sta *sta, void *priv_sta) 840 841 { 841 842 struct minstrel_priv *mp = priv; ··· 932 931 memset(&msp->legacy, 0, sizeof(msp->legacy)); 933 932 msp->legacy.r = msp->ratelist; 934 933 msp->legacy.sample_table = msp->sample_table; 935 - return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy); 934 + return mac80211_minstrel.rate_init(priv, sband, chandef, sta, 935 + &msp->legacy); 936 936 } 937 937 938 938 static void 939 939 minstrel_ht_rate_init(void *priv, struct ieee80211_supported_band *sband, 940 + struct cfg80211_chan_def *chandef, 940 941 struct ieee80211_sta *sta, void *priv_sta) 941 942 { 942 - minstrel_ht_update_caps(priv, sband, sta, priv_sta); 943 + minstrel_ht_update_caps(priv, sband, chandef, sta, priv_sta); 943 944 } 944 945 945 946 static void 946 947 minstrel_ht_rate_update(void *priv, struct ieee80211_supported_band *sband, 948 + struct cfg80211_chan_def *chandef, 947 949 struct ieee80211_sta *sta, void *priv_sta, 948 950 u32 changed) 949 951 { 950 - minstrel_ht_update_caps(priv, sband, sta, priv_sta); 952 + minstrel_ht_update_caps(priv, sband, chandef, sta, priv_sta); 951 953 } 952 954 953 955 static void *
+1
net/mac80211/rc80211_pid_algo.c
··· 293 293 294 294 static void 295 295 rate_control_pid_rate_init(void *priv, struct ieee80211_supported_band *sband, 296 + struct cfg80211_chan_def *chandef, 296 297 struct ieee80211_sta *sta, void *priv_sta) 297 298 { 298 299 struct rc_pid_sta_info *spinfo = priv_sta;