aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ibss.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-12-23 07:15:39 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-12-28 16:54:59 -0500
commit0c1ad2cac1cb54db38fd4cc1822965071ee83f6e (patch)
treed5af632483584b7579ad8b24ba870f9b18e1aaa7 /net/mac80211/ibss.c
parent8e664fb3fd2b04e3ac5fad7f046000ba54e0e275 (diff)
mac80211: proper bss private data handling
cfg80211 offers private data for each BSS struct, which mac80211 uses. However, mac80211 uses internal and external (cfg80211) BSS pointers interchangeably and has a hack to put the cfg80211 bss struct into the private struct. Remove this hack, properly converting between the pointers wherever necessary. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r--net/mac80211/ibss.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 3a61f3ba85c9..621a54c0573a 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -187,15 +187,17 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
187static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, 187static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
188 struct ieee80211_bss *bss) 188 struct ieee80211_bss *bss)
189{ 189{
190 struct cfg80211_bss *cbss =
191 container_of((void *)bss, struct cfg80211_bss, priv);
190 struct ieee80211_supported_band *sband; 192 struct ieee80211_supported_band *sband;
191 u32 basic_rates; 193 u32 basic_rates;
192 int i, j; 194 int i, j;
193 u16 beacon_int = bss->cbss.beacon_interval; 195 u16 beacon_int = cbss->beacon_interval;
194 196
195 if (beacon_int < 10) 197 if (beacon_int < 10)
196 beacon_int = 10; 198 beacon_int = 10;
197 199
198 sband = sdata->local->hw.wiphy->bands[bss->cbss.channel->band]; 200 sband = sdata->local->hw.wiphy->bands[cbss->channel->band];
199 201
200 basic_rates = 0; 202 basic_rates = 0;
201 203
@@ -212,12 +214,12 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
212 } 214 }
213 } 215 }
214 216
215 __ieee80211_sta_join_ibss(sdata, bss->cbss.bssid, 217 __ieee80211_sta_join_ibss(sdata, cbss->bssid,
216 beacon_int, 218 beacon_int,
217 bss->cbss.channel, 219 cbss->channel,
218 basic_rates, 220 basic_rates,
219 bss->cbss.capability, 221 cbss->capability,
220 bss->cbss.tsf); 222 cbss->tsf);
221} 223}
222 224
223static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, 225static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
@@ -229,6 +231,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
229{ 231{
230 struct ieee80211_local *local = sdata->local; 232 struct ieee80211_local *local = sdata->local;
231 int freq; 233 int freq;
234 struct cfg80211_bss *cbss;
232 struct ieee80211_bss *bss; 235 struct ieee80211_bss *bss;
233 struct sta_info *sta; 236 struct sta_info *sta;
234 struct ieee80211_channel *channel; 237 struct ieee80211_channel *channel;
@@ -283,8 +286,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
283 if (!bss) 286 if (!bss)
284 return; 287 return;
285 288
289 cbss = container_of((void *)bss, struct cfg80211_bss, priv);
290
286 /* was just updated in ieee80211_bss_info_update */ 291 /* was just updated in ieee80211_bss_info_update */
287 beacon_timestamp = bss->cbss.tsf; 292 beacon_timestamp = cbss->tsf;
288 293
289 /* check if we need to merge IBSS */ 294 /* check if we need to merge IBSS */
290 295
@@ -297,11 +302,11 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
297 goto put_bss; 302 goto put_bss;
298 303
299 /* not an IBSS */ 304 /* not an IBSS */
300 if (!(bss->cbss.capability & WLAN_CAPABILITY_IBSS)) 305 if (!(cbss->capability & WLAN_CAPABILITY_IBSS))
301 goto put_bss; 306 goto put_bss;
302 307
303 /* different channel */ 308 /* different channel */
304 if (bss->cbss.channel != local->oper_channel) 309 if (cbss->channel != local->oper_channel)
305 goto put_bss; 310 goto put_bss;
306 311
307 /* different SSID */ 312 /* different SSID */
@@ -311,7 +316,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
311 goto put_bss; 316 goto put_bss;
312 317
313 /* same BSSID */ 318 /* same BSSID */
314 if (memcmp(bss->cbss.bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) 319 if (memcmp(cbss->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0)
315 goto put_bss; 320 goto put_bss;
316 321
317 if (rx_status->flag & RX_FLAG_TSFT) { 322 if (rx_status->flag & RX_FLAG_TSFT) {
@@ -514,7 +519,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
514{ 519{
515 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; 520 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
516 struct ieee80211_local *local = sdata->local; 521 struct ieee80211_local *local = sdata->local;
517 struct ieee80211_bss *bss; 522 struct cfg80211_bss *cbss;
518 struct ieee80211_channel *chan = NULL; 523 struct ieee80211_channel *chan = NULL;
519 const u8 *bssid = NULL; 524 const u8 *bssid = NULL;
520 int active_ibss; 525 int active_ibss;
@@ -538,21 +543,23 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
538 chan = ifibss->channel; 543 chan = ifibss->channel;
539 if (!is_zero_ether_addr(ifibss->bssid)) 544 if (!is_zero_ether_addr(ifibss->bssid))
540 bssid = ifibss->bssid; 545 bssid = ifibss->bssid;
541 bss = (void *)cfg80211_get_bss(local->hw.wiphy, chan, bssid, 546 cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid,
542 ifibss->ssid, ifibss->ssid_len, 547 ifibss->ssid, ifibss->ssid_len,
543 WLAN_CAPABILITY_IBSS | 548 WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_PRIVACY,
544 WLAN_CAPABILITY_PRIVACY, 549 capability);
545 capability); 550
551 if (cbss) {
552 struct ieee80211_bss *bss;
546 553
547 if (bss) { 554 bss = (void *)cbss->priv;
548#ifdef CONFIG_MAC80211_IBSS_DEBUG 555#ifdef CONFIG_MAC80211_IBSS_DEBUG
549 printk(KERN_DEBUG " sta_find_ibss: selected %pM current " 556 printk(KERN_DEBUG " sta_find_ibss: selected %pM current "
550 "%pM\n", bss->cbss.bssid, ifibss->bssid); 557 "%pM\n", cbss->bssid, ifibss->bssid);
551#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 558#endif /* CONFIG_MAC80211_IBSS_DEBUG */
552 559
553 printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" 560 printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM"
554 " based on configured SSID\n", 561 " based on configured SSID\n",
555 sdata->name, bss->cbss.bssid); 562 sdata->name, cbss->bssid);
556 563
557 ieee80211_sta_join_ibss(sdata, bss); 564 ieee80211_sta_join_ibss(sdata, bss);
558 ieee80211_rx_bss_put(local, bss); 565 ieee80211_rx_bss_put(local, bss);