Commit 57eebdf3 authored by Johannes Berg's avatar Johannes Berg

mac80211: clean up CSA handling code

Clean up the CSA handling code by moving some
of it out of the if and using a C99 initializer
for the struct passed to the driver method.

While at it, also add a comment that we should
wait for a beacon after switching the channel.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 90bcf867
...@@ -712,6 +712,7 @@ static void ieee80211_chswitch_work(struct work_struct *work) ...@@ -712,6 +712,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 = sdata->local->oper_channel; ifmgd->associated->channel = sdata->local->oper_channel;
/* XXX: wait for a beacon first? */
ieee80211_wake_queues_by_reason(&sdata->local->hw, ieee80211_wake_queues_by_reason(&sdata->local->hw,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
out: out:
...@@ -788,36 +789,33 @@ void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, ...@@ -788,36 +789,33 @@ void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
sdata->local->csa_channel = new_ch; sdata->local->csa_channel = new_ch;
if (sdata->local->ops->channel_switch) { ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED;
/* use driver's channel switch callback */
struct ieee80211_channel_switch ch_switch; if (sw_elem->mode)
memset(&ch_switch, 0, sizeof(ch_switch));
ch_switch.timestamp = timestamp;
if (sw_elem->mode) {
ch_switch.block_tx = true;
ieee80211_stop_queues_by_reason(&sdata->local->hw, ieee80211_stop_queues_by_reason(&sdata->local->hw,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
}
ch_switch.channel = new_ch; if (sdata->local->ops->channel_switch) {
ch_switch.count = sw_elem->count; /* use driver's channel switch callback */
ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; struct ieee80211_channel_switch ch_switch = {
.timestamp = timestamp,
.block_tx = sw_elem->mode,
.channel = new_ch,
.count = sw_elem->count,
};
drv_channel_switch(sdata->local, &ch_switch); drv_channel_switch(sdata->local, &ch_switch);
return; return;
} }
/* channel switch handled in software */ /* channel switch handled in software */
if (sw_elem->count <= 1) { if (sw_elem->count <= 1)
ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work);
} else { else
if (sw_elem->mode)
ieee80211_stop_queues_by_reason(&sdata->local->hw,
IEEE80211_QUEUE_STOP_REASON_CSA);
ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED;
mod_timer(&ifmgd->chswitch_timer, mod_timer(&ifmgd->chswitch_timer,
jiffies + jiffies +
msecs_to_jiffies(sw_elem->count * msecs_to_jiffies(sw_elem->count *
cbss->beacon_interval)); cbss->beacon_interval));
}
} }
static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
......
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