提交 3de805cf 编写于 作者: S Simon Wunderlich 提交者: Johannes Berg

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: NSimon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: NMathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
上级 dcd6eac1
...@@ -1275,6 +1275,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, ...@@ -1275,6 +1275,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
} }
static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta) struct ieee80211_sta *sta, void *priv_sta)
{ {
struct ath_softc *sc = priv; struct ath_softc *sc = priv;
...@@ -1313,6 +1314,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, ...@@ -1313,6 +1314,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
} }
static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta, struct ieee80211_sta *sta, void *priv_sta,
u32 changed) u32 changed)
{ {
......
...@@ -887,6 +887,7 @@ il3945_remove_debugfs(void *il, void *il_sta) ...@@ -887,6 +887,7 @@ il3945_remove_debugfs(void *il, void *il_sta)
*/ */
static void static void
il3945_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, il3945_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *il_sta) struct ieee80211_sta *sta, void *il_sta)
{ {
} }
......
...@@ -2803,6 +2803,7 @@ il4965_rs_remove_debugfs(void *il, void *il_sta) ...@@ -2803,6 +2803,7 @@ il4965_rs_remove_debugfs(void *il, void *il_sta)
*/ */
static void static void
il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *il_sta) struct ieee80211_sta *sta, void *il_sta)
{ {
} }
......
...@@ -3319,7 +3319,8 @@ static void rs_remove_debugfs(void *priv, void *priv_sta) ...@@ -3319,7 +3319,8 @@ static void rs_remove_debugfs(void *priv, void *priv_sta)
* station is added we ignore it. * station is added we ignore it.
*/ */
static void rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, static void rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband,
struct ieee80211_sta *sta, void *priv_sta) struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta)
{ {
} }
static struct rate_control_ops rs_ops = { static struct rate_control_ops rs_ops = {
......
...@@ -3159,8 +3159,9 @@ static void rs_remove_debugfs(void *mvm, void *mvm_sta) ...@@ -3159,8 +3159,9 @@ static void rs_remove_debugfs(void *mvm, void *mvm_sta)
* station is added we ignore it. * station is added we ignore it.
*/ */
static void rs_rate_init_stub(void *mvm_r, static void rs_rate_init_stub(void *mvm_r,
struct ieee80211_supported_band *sband, struct ieee80211_supported_band *sband,
struct ieee80211_sta *sta, void *mvm_sta) struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *mvm_sta)
{ {
} }
static struct rate_control_ops rs_mvm_ops = { static struct rate_control_ops rs_mvm_ops = {
......
...@@ -218,6 +218,7 @@ static void rtl_tx_status(void *ppriv, ...@@ -218,6 +218,7 @@ static void rtl_tx_status(void *ppriv,
static void rtl_rate_init(void *ppriv, static void rtl_rate_init(void *ppriv,
struct ieee80211_supported_band *sband, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta) struct ieee80211_sta *sta, void *priv_sta)
{ {
} }
......
...@@ -4204,8 +4204,10 @@ struct rate_control_ops { ...@@ -4204,8 +4204,10 @@ struct rate_control_ops {
void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta); struct ieee80211_sta *sta, void *priv_sta);
void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta, struct ieee80211_sta *sta, void *priv_sta,
u32 changed); u32 changed);
void (*free_sta)(void *priv, struct ieee80211_sta *sta, void (*free_sta)(void *priv, struct ieee80211_sta *sta,
......
...@@ -66,11 +66,12 @@ static inline void rate_control_rate_init(struct sta_info *sta) ...@@ -66,11 +66,12 @@ static inline void rate_control_rate_init(struct sta_info *sta)
} }
sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band]; sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
rcu_read_unlock();
ieee80211_sta_set_rx_nss(sta); ieee80211_sta_set_rx_nss(sta);
ref->ops->rate_init(ref->priv, sband, ista, priv_sta); ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
priv_sta);
rcu_read_unlock();
set_sta_flag(sta, WLAN_STA_RATE_CONTROL); set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
} }
...@@ -81,10 +82,21 @@ static inline void rate_control_rate_update(struct ieee80211_local *local, ...@@ -81,10 +82,21 @@ static inline void rate_control_rate_update(struct ieee80211_local *local,
struct rate_control_ref *ref = local->rate_ctrl; struct rate_control_ref *ref = local->rate_ctrl;
struct ieee80211_sta *ista = &sta->sta; struct ieee80211_sta *ista = &sta->sta;
void *priv_sta = sta->rate_ctrl_priv; void *priv_sta = sta->rate_ctrl_priv;
struct ieee80211_chanctx_conf *chanctx_conf;
if (ref && ref->ops->rate_update) {
rcu_read_lock();
if (ref && ref->ops->rate_update) chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
ref->ops->rate_update(ref->priv, sband, ista, if (WARN_ON(!chanctx_conf)) {
priv_sta, changed); rcu_read_unlock();
return;
}
ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
ista, priv_sta, changed);
rcu_read_unlock();
}
drv_sta_rc_update(local, sta->sdata, &sta->sta, changed); drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
} }
......
...@@ -417,7 +417,8 @@ init_sample_table(struct minstrel_sta_info *mi) ...@@ -417,7 +417,8 @@ init_sample_table(struct minstrel_sta_info *mi)
static void static void
minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,
struct ieee80211_sta *sta, void *priv_sta) struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta)
{ {
struct minstrel_sta_info *mi = priv_sta; struct minstrel_sta_info *mi = priv_sta;
struct minstrel_priv *mp = priv; struct minstrel_priv *mp = priv;
......
...@@ -836,6 +836,7 @@ minstrel_ht_update_cck(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, ...@@ -836,6 +836,7 @@ minstrel_ht_update_cck(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
static void static void
minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta) struct ieee80211_sta *sta, void *priv_sta)
{ {
struct minstrel_priv *mp = priv; struct minstrel_priv *mp = priv;
...@@ -931,22 +932,25 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, ...@@ -931,22 +932,25 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
memset(&msp->legacy, 0, sizeof(msp->legacy)); memset(&msp->legacy, 0, sizeof(msp->legacy));
msp->legacy.r = msp->ratelist; msp->legacy.r = msp->ratelist;
msp->legacy.sample_table = msp->sample_table; msp->legacy.sample_table = msp->sample_table;
return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy); return mac80211_minstrel.rate_init(priv, sband, chandef, sta,
&msp->legacy);
} }
static void static void
minstrel_ht_rate_init(void *priv, struct ieee80211_supported_band *sband, minstrel_ht_rate_init(void *priv, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta) struct ieee80211_sta *sta, void *priv_sta)
{ {
minstrel_ht_update_caps(priv, sband, sta, priv_sta); minstrel_ht_update_caps(priv, sband, chandef, sta, priv_sta);
} }
static void static void
minstrel_ht_rate_update(void *priv, struct ieee80211_supported_band *sband, minstrel_ht_rate_update(void *priv, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta, struct ieee80211_sta *sta, void *priv_sta,
u32 changed) u32 changed)
{ {
minstrel_ht_update_caps(priv, sband, sta, priv_sta); minstrel_ht_update_caps(priv, sband, chandef, sta, priv_sta);
} }
static void * static void *
......
...@@ -293,6 +293,7 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta, ...@@ -293,6 +293,7 @@ rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta,
static void static void
rate_control_pid_rate_init(void *priv, struct ieee80211_supported_band *sband, rate_control_pid_rate_init(void *priv, struct ieee80211_supported_band *sband,
struct cfg80211_chan_def *chandef,
struct ieee80211_sta *sta, void *priv_sta) struct ieee80211_sta *sta, void *priv_sta)
{ {
struct rc_pid_sta_info *spinfo = priv_sta; struct rc_pid_sta_info *spinfo = priv_sta;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册