Commit 33787fc4 authored by Luciano Coelho's avatar Luciano Coelho Committed by Johannes Berg

mac80211: move csa_chandef to sdata

There is no reason why we should have only one channel switch
announcement at a time for a single phy.  When support for channel
switch with multiple contexts and multiple vifs per context is
implemented, we will need the chandef data for each vif.  Move the
csa_chandef structure to sdata to prepare for this.
Reviewed-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuciano Coelho <luciano.coelho@intel.com>
[Fixed compilation with mesh]
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent f63f8421
...@@ -2990,13 +2990,12 @@ void ieee80211_csa_finalize_work(struct work_struct *work) ...@@ -2990,13 +2990,12 @@ void ieee80211_csa_finalize_work(struct work_struct *work)
return; return;
sdata->radar_required = sdata->csa_radar_required; sdata->radar_required = sdata->csa_radar_required;
err = ieee80211_vif_change_channel(sdata, &local->csa_chandef, err = ieee80211_vif_change_channel(sdata, &changed);
&changed);
if (WARN_ON(err < 0)) if (WARN_ON(err < 0))
return; return;
if (!local->use_chanctx) { if (!local->use_chanctx) {
local->_oper_chandef = local->csa_chandef; local->_oper_chandef = sdata->csa_chandef;
ieee80211_hw_config(local, 0); ieee80211_hw_config(local, 0);
} }
...@@ -3033,7 +3032,7 @@ void ieee80211_csa_finalize_work(struct work_struct *work) ...@@ -3033,7 +3032,7 @@ void ieee80211_csa_finalize_work(struct work_struct *work)
IEEE80211_MAX_QUEUE_MAP, IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
cfg80211_ch_switch_notify(sdata->dev, &local->csa_chandef); cfg80211_ch_switch_notify(sdata->dev, &sdata->csa_chandef);
} }
static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
...@@ -3158,7 +3157,7 @@ static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, ...@@ -3158,7 +3157,7 @@ static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
IEEE80211_MAX_QUEUE_MAP, IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
local->csa_chandef = params->chandef; sdata->csa_chandef = params->chandef;
sdata->vif.csa_active = true; sdata->vif.csa_active = true;
ieee80211_bss_info_change_notify(sdata, err); ieee80211_bss_info_change_notify(sdata, err);
......
...@@ -411,12 +411,12 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, ...@@ -411,12 +411,12 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
} }
int ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata, int ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata,
const struct cfg80211_chan_def *chandef,
u32 *changed) u32 *changed)
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct ieee80211_chanctx_conf *conf; struct ieee80211_chanctx_conf *conf;
struct ieee80211_chanctx *ctx; struct ieee80211_chanctx *ctx;
const struct cfg80211_chan_def *chandef = &sdata->csa_chandef;
int ret; int ret;
u32 chanctx_changed = 0; u32 chanctx_changed = 0;
......
...@@ -550,12 +550,12 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata) ...@@ -550,12 +550,12 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata)
capability); capability);
/* XXX: should not really modify cfg80211 data */ /* XXX: should not really modify cfg80211 data */
if (cbss) { if (cbss) {
cbss->channel = sdata->local->csa_chandef.chan; cbss->channel = sdata->csa_chandef.chan;
cfg80211_put_bss(sdata->local->hw.wiphy, cbss); cfg80211_put_bss(sdata->local->hw.wiphy, cbss);
} }
} }
ifibss->chandef = sdata->local->csa_chandef; ifibss->chandef = sdata->csa_chandef;
/* generate the beacon */ /* generate the beacon */
err = ieee80211_ibss_csa_beacon(sdata, NULL); err = ieee80211_ibss_csa_beacon(sdata, NULL);
...@@ -922,7 +922,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, ...@@ -922,7 +922,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata,
IEEE80211_MAX_QUEUE_MAP, IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
sdata->local->csa_chandef = params.chandef; sdata->csa_chandef = params.chandef;
sdata->vif.csa_active = true; sdata->vif.csa_active = true;
ieee80211_bss_info_change_notify(sdata, err); ieee80211_bss_info_change_notify(sdata, err);
......
...@@ -736,6 +736,7 @@ struct ieee80211_sub_if_data { ...@@ -736,6 +736,7 @@ struct ieee80211_sub_if_data {
int csa_counter_offset_beacon; int csa_counter_offset_beacon;
int csa_counter_offset_presp; int csa_counter_offset_presp;
bool csa_radar_required; bool csa_radar_required;
struct cfg80211_chan_def csa_chandef;
/* used to reconfigure hardware SM PS */ /* used to reconfigure hardware SM PS */
struct work_struct recalc_smps; struct work_struct recalc_smps;
...@@ -1094,7 +1095,6 @@ struct ieee80211_local { ...@@ -1094,7 +1095,6 @@ struct ieee80211_local {
enum mac80211_scan_state next_scan_state; enum mac80211_scan_state next_scan_state;
struct delayed_work scan_work; struct delayed_work scan_work;
struct ieee80211_sub_if_data __rcu *scan_sdata; struct ieee80211_sub_if_data __rcu *scan_sdata;
struct cfg80211_chan_def csa_chandef;
/* For backward compatibility only -- do not use */ /* For backward compatibility only -- do not use */
struct cfg80211_chan_def _oper_chandef; struct cfg80211_chan_def _oper_chandef;
...@@ -1731,7 +1731,6 @@ ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata, ...@@ -1731,7 +1731,6 @@ ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata,
/* NOTE: only use ieee80211_vif_change_channel() for channel switch */ /* NOTE: only use ieee80211_vif_change_channel() for channel switch */
int __must_check int __must_check
ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata, ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata,
const struct cfg80211_chan_def *chandef,
u32 *changed); u32 *changed);
void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata); void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata); void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata);
......
...@@ -956,7 +956,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, ...@@ -956,7 +956,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
IEEE80211_MAX_QUEUE_MAP, IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
sdata->local->csa_chandef = params.chandef; sdata->csa_chandef = params.chandef;
sdata->vif.csa_active = true; sdata->vif.csa_active = true;
ieee80211_bss_info_change_notify(sdata, err); ieee80211_bss_info_change_notify(sdata, err);
......
...@@ -886,8 +886,7 @@ static void ieee80211_chswitch_work(struct work_struct *work) ...@@ -886,8 +886,7 @@ static void ieee80211_chswitch_work(struct work_struct *work)
if (!ifmgd->associated) if (!ifmgd->associated)
goto out; goto out;
ret = ieee80211_vif_change_channel(sdata, &local->csa_chandef, ret = ieee80211_vif_change_channel(sdata, &changed);
&changed);
if (ret) { if (ret) {
sdata_info(sdata, sdata_info(sdata,
"vif channel switch failed, disconnecting\n"); "vif channel switch failed, disconnecting\n");
...@@ -897,7 +896,7 @@ static void ieee80211_chswitch_work(struct work_struct *work) ...@@ -897,7 +896,7 @@ static void ieee80211_chswitch_work(struct work_struct *work)
} }
if (!local->use_chanctx) { if (!local->use_chanctx) {
local->_oper_chandef = local->csa_chandef; local->_oper_chandef = sdata->csa_chandef;
/* Call "hw_config" only if doing sw channel switch. /* Call "hw_config" only if doing sw channel switch.
* Otherwise update the channel directly * Otherwise update the channel directly
*/ */
...@@ -908,7 +907,7 @@ static void ieee80211_chswitch_work(struct work_struct *work) ...@@ -908,7 +907,7 @@ static void ieee80211_chswitch_work(struct work_struct *work)
} }
/* XXX: shouldn't really modify cfg80211-owned data! */ /* XXX: shouldn't really modify cfg80211-owned data! */
ifmgd->associated->channel = local->csa_chandef.chan; ifmgd->associated->channel = sdata->csa_chandef.chan;
/* XXX: wait for a beacon first? */ /* XXX: wait for a beacon first? */
ieee80211_wake_queues_by_reason(&local->hw, ieee80211_wake_queues_by_reason(&local->hw,
...@@ -1035,7 +1034,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, ...@@ -1035,7 +1034,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
} }
mutex_unlock(&local->chanctx_mtx); mutex_unlock(&local->chanctx_mtx);
local->csa_chandef = csa_ie.chandef; sdata->csa_chandef = csa_ie.chandef;
if (csa_ie.mode) if (csa_ie.mode)
ieee80211_stop_queues_by_reason(&local->hw, ieee80211_stop_queues_by_reason(&local->hw,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment