diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-08-01 09:50:46 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-08-20 07:57:48 -0400 |
commit | 57eebdf3c28fe7134597acad529fc40f99b76601 (patch) | |
tree | 4fa9810bc4956f5787255170b0994c936bee097c /net/mac80211/mlme.c | |
parent | 90bcf867ceef50155a1a14af4dc248061f6b8b94 (diff) |
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: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index b7c05bb3b672..ae524c9081ee 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -712,6 +712,7 @@ static void ieee80211_chswitch_work(struct work_struct *work) | |||
712 | /* XXX: shouldn't really modify cfg80211-owned data! */ | 712 | /* XXX: shouldn't really modify cfg80211-owned data! */ |
713 | ifmgd->associated->channel = sdata->local->oper_channel; | 713 | ifmgd->associated->channel = sdata->local->oper_channel; |
714 | 714 | ||
715 | /* XXX: wait for a beacon first? */ | ||
715 | ieee80211_wake_queues_by_reason(&sdata->local->hw, | 716 | ieee80211_wake_queues_by_reason(&sdata->local->hw, |
716 | IEEE80211_QUEUE_STOP_REASON_CSA); | 717 | IEEE80211_QUEUE_STOP_REASON_CSA); |
717 | out: | 718 | out: |
@@ -788,36 +789,33 @@ void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
788 | 789 | ||
789 | sdata->local->csa_channel = new_ch; | 790 | sdata->local->csa_channel = new_ch; |
790 | 791 | ||
792 | ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; | ||
793 | |||
794 | if (sw_elem->mode) | ||
795 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | ||
796 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
797 | |||
791 | if (sdata->local->ops->channel_switch) { | 798 | if (sdata->local->ops->channel_switch) { |
792 | /* use driver's channel switch callback */ | 799 | /* use driver's channel switch callback */ |
793 | struct ieee80211_channel_switch ch_switch; | 800 | struct ieee80211_channel_switch ch_switch = { |
794 | memset(&ch_switch, 0, sizeof(ch_switch)); | 801 | .timestamp = timestamp, |
795 | ch_switch.timestamp = timestamp; | 802 | .block_tx = sw_elem->mode, |
796 | if (sw_elem->mode) { | 803 | .channel = new_ch, |
797 | ch_switch.block_tx = true; | 804 | .count = sw_elem->count, |
798 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | 805 | }; |
799 | IEEE80211_QUEUE_STOP_REASON_CSA); | 806 | |
800 | } | ||
801 | ch_switch.channel = new_ch; | ||
802 | ch_switch.count = sw_elem->count; | ||
803 | ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; | ||
804 | drv_channel_switch(sdata->local, &ch_switch); | 807 | drv_channel_switch(sdata->local, &ch_switch); |
805 | return; | 808 | return; |
806 | } | 809 | } |
807 | 810 | ||
808 | /* channel switch handled in software */ | 811 | /* channel switch handled in software */ |
809 | if (sw_elem->count <= 1) { | 812 | if (sw_elem->count <= 1) |
810 | ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); | 813 | ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); |
811 | } else { | 814 | else |
812 | if (sw_elem->mode) | ||
813 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | ||
814 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
815 | ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; | ||
816 | mod_timer(&ifmgd->chswitch_timer, | 815 | mod_timer(&ifmgd->chswitch_timer, |
817 | jiffies + | 816 | jiffies + |
818 | msecs_to_jiffies(sw_elem->count * | 817 | msecs_to_jiffies(sw_elem->count * |
819 | cbss->beacon_interval)); | 818 | cbss->beacon_interval)); |
820 | } | ||
821 | } | 819 | } |
822 | 820 | ||
823 | static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, | 821 | static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, |