aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/spectmgmt.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-02-15 06:44:28 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:51:42 -0500
commit469002983fc90c2ff0959e2b03335c0fe2e4d5a9 (patch)
treefdcf78dcdaeadba897abd86d39d0275e236803b3 /net/mac80211/spectmgmt.c
parent96f5e66e8a79810e2982cdcfa28e554f3d97da21 (diff)
mac80211: split IBSS/managed code
This patch splits out the ibss code and data from managed (station) mode. The reason to do this is to better separate the state machines, and have the code be contained better so it gets easier to determine what exactly a given change will affect, that in turn makes it easier to understand. This is quite some churn, especially because I split sdata->u.sta into sdata->u.mgd and sdata->u.ibss, but I think it's easier to maintain that way. I've also shuffled around some code -- null function sending is only applicable to managed interfaces so put that into that file, some other functions are needed from various places so put them into util, and also rearranged the prototypes in ieee80211_i.h accordingly. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/spectmgmt.c')
-rw-r--r--net/mac80211/spectmgmt.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c
index 47bb2aed2813..5f7a2624ed74 100644
--- a/net/mac80211/spectmgmt.c
+++ b/net/mac80211/spectmgmt.c
@@ -88,16 +88,16 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
88void ieee80211_chswitch_work(struct work_struct *work) 88void ieee80211_chswitch_work(struct work_struct *work)
89{ 89{
90 struct ieee80211_sub_if_data *sdata = 90 struct ieee80211_sub_if_data *sdata =
91 container_of(work, struct ieee80211_sub_if_data, u.sta.chswitch_work); 91 container_of(work, struct ieee80211_sub_if_data, u.mgd.chswitch_work);
92 struct ieee80211_bss *bss; 92 struct ieee80211_bss *bss;
93 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 93 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
94 94
95 if (!netif_running(sdata->dev)) 95 if (!netif_running(sdata->dev))
96 return; 96 return;
97 97
98 bss = ieee80211_rx_bss_get(sdata->local, ifsta->bssid, 98 bss = ieee80211_rx_bss_get(sdata->local, ifmgd->bssid,
99 sdata->local->hw.conf.channel->center_freq, 99 sdata->local->hw.conf.channel->center_freq,
100 ifsta->ssid, ifsta->ssid_len); 100 ifmgd->ssid, ifmgd->ssid_len);
101 if (!bss) 101 if (!bss)
102 goto exit; 102 goto exit;
103 103
@@ -108,7 +108,7 @@ void ieee80211_chswitch_work(struct work_struct *work)
108 108
109 ieee80211_rx_bss_put(sdata->local, bss); 109 ieee80211_rx_bss_put(sdata->local, bss);
110exit: 110exit:
111 ifsta->flags &= ~IEEE80211_STA_CSA_RECEIVED; 111 ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED;
112 ieee80211_wake_queues_by_reason(&sdata->local->hw, 112 ieee80211_wake_queues_by_reason(&sdata->local->hw,
113 IEEE80211_QUEUE_STOP_REASON_CSA); 113 IEEE80211_QUEUE_STOP_REASON_CSA);
114} 114}
@@ -117,9 +117,9 @@ void ieee80211_chswitch_timer(unsigned long data)
117{ 117{
118 struct ieee80211_sub_if_data *sdata = 118 struct ieee80211_sub_if_data *sdata =
119 (struct ieee80211_sub_if_data *) data; 119 (struct ieee80211_sub_if_data *) data;
120 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 120 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
121 121
122 queue_work(sdata->local->hw.workqueue, &ifsta->chswitch_work); 122 queue_work(sdata->local->hw.workqueue, &ifmgd->chswitch_work);
123} 123}
124 124
125void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata, 125void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
@@ -127,14 +127,14 @@ void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
127 struct ieee80211_bss *bss) 127 struct ieee80211_bss *bss)
128{ 128{
129 struct ieee80211_channel *new_ch; 129 struct ieee80211_channel *new_ch;
130 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 130 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
131 int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num); 131 int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num);
132 132
133 /* FIXME: Handle ADHOC later */ 133 /* FIXME: Handle ADHOC later */
134 if (sdata->vif.type != NL80211_IFTYPE_STATION) 134 if (sdata->vif.type != NL80211_IFTYPE_STATION)
135 return; 135 return;
136 136
137 if (ifsta->state != IEEE80211_STA_MLME_ASSOCIATED) 137 if (ifmgd->state != IEEE80211_STA_MLME_ASSOCIATED)
138 return; 138 return;
139 139
140 if (sdata->local->sw_scanning || sdata->local->hw_scanning) 140 if (sdata->local->sw_scanning || sdata->local->hw_scanning)
@@ -143,7 +143,7 @@ void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
143 /* Disregard subsequent beacons if we are already running a timer 143 /* Disregard subsequent beacons if we are already running a timer
144 processing a CSA */ 144 processing a CSA */
145 145
146 if (ifsta->flags & IEEE80211_STA_CSA_RECEIVED) 146 if (ifmgd->flags & IEEE80211_STA_CSA_RECEIVED)
147 return; 147 return;
148 148
149 new_ch = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq); 149 new_ch = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq);
@@ -153,12 +153,12 @@ void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
153 sdata->local->csa_channel = new_ch; 153 sdata->local->csa_channel = new_ch;
154 154
155 if (sw_elem->count <= 1) { 155 if (sw_elem->count <= 1) {
156 queue_work(sdata->local->hw.workqueue, &ifsta->chswitch_work); 156 queue_work(sdata->local->hw.workqueue, &ifmgd->chswitch_work);
157 } else { 157 } else {
158 ieee80211_stop_queues_by_reason(&sdata->local->hw, 158 ieee80211_stop_queues_by_reason(&sdata->local->hw,
159 IEEE80211_QUEUE_STOP_REASON_CSA); 159 IEEE80211_QUEUE_STOP_REASON_CSA);
160 ifsta->flags |= IEEE80211_STA_CSA_RECEIVED; 160 ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED;
161 mod_timer(&ifsta->chswitch_timer, 161 mod_timer(&ifmgd->chswitch_timer,
162 jiffies + 162 jiffies +
163 msecs_to_jiffies(sw_elem->count * 163 msecs_to_jiffies(sw_elem->count *
164 bss->cbss.beacon_interval)); 164 bss->cbss.beacon_interval));