mlme.c (cc32abd494c0a8f76f2638e3f3a76e01c68bc9ea) mlme.c (5bb644a0fd25a5e083ecbfaa92a211db99aa6ef7)
1/*
2 * BSS client mode implementation
3 * Copyright 2003-2008, Jouni Malinen <j@w1.fi>
4 * Copyright 2004, Instant802 Networks, Inc.
5 * Copyright 2005, Devicescape Software, Inc.
6 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
7 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
8 *

--- 23 unchanged lines hidden (view full) ---

32#define IEEE80211_AUTH_MAX_TRIES 3
33#define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
34#define IEEE80211_ASSOC_MAX_TRIES 3
35#define IEEE80211_MONITORING_INTERVAL (2 * HZ)
36#define IEEE80211_PROBE_WAIT (HZ / 20)
37#define IEEE80211_PROBE_IDLE_TIME (60 * HZ)
38#define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ)
39
1/*
2 * BSS client mode implementation
3 * Copyright 2003-2008, Jouni Malinen <j@w1.fi>
4 * Copyright 2004, Instant802 Networks, Inc.
5 * Copyright 2005, Devicescape Software, Inc.
6 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
7 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
8 *

--- 23 unchanged lines hidden (view full) ---

32#define IEEE80211_AUTH_MAX_TRIES 3
33#define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
34#define IEEE80211_ASSOC_MAX_TRIES 3
35#define IEEE80211_MONITORING_INTERVAL (2 * HZ)
36#define IEEE80211_PROBE_WAIT (HZ / 20)
37#define IEEE80211_PROBE_IDLE_TIME (60 * HZ)
38#define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ)
39
40#define TMR_RUNNING_TIMER 0
41#define TMR_RUNNING_CHANSW 1
42
40/* utils */
41static int ecw2cw(int ecw)
42{
43 return (1 << ecw) - 1;
44}
45
46static u8 *ieee80211_bss_get_ie(struct ieee80211_bss *bss, u8 ie)
47{

--- 468 unchanged lines hidden (view full) ---

516}
517
518static void ieee80211_chswitch_timer(unsigned long data)
519{
520 struct ieee80211_sub_if_data *sdata =
521 (struct ieee80211_sub_if_data *) data;
522 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
523
43/* utils */
44static int ecw2cw(int ecw)
45{
46 return (1 << ecw) - 1;
47}
48
49static u8 *ieee80211_bss_get_ie(struct ieee80211_bss *bss, u8 ie)
50{

--- 468 unchanged lines hidden (view full) ---

519}
520
521static void ieee80211_chswitch_timer(unsigned long data)
522{
523 struct ieee80211_sub_if_data *sdata =
524 (struct ieee80211_sub_if_data *) data;
525 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
526
527 if (sdata->local->quiescing) {
528 set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running);
529 return;
530 }
531
524 queue_work(sdata->local->hw.workqueue, &ifmgd->chswitch_work);
525}
526
527void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
528 struct ieee80211_channel_sw_ie *sw_elem,
529 struct ieee80211_bss *bss)
530{
531 struct ieee80211_channel *new_ch;

--- 177 unchanged lines hidden (view full) ---

709 local->hw.conf.flags |= IEEE80211_CONF_PS;
710 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
711}
712
713void ieee80211_dynamic_ps_timer(unsigned long data)
714{
715 struct ieee80211_local *local = (void *) data;
716
532 queue_work(sdata->local->hw.workqueue, &ifmgd->chswitch_work);
533}
534
535void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,
536 struct ieee80211_channel_sw_ie *sw_elem,
537 struct ieee80211_bss *bss)
538{
539 struct ieee80211_channel *new_ch;

--- 177 unchanged lines hidden (view full) ---

717 local->hw.conf.flags |= IEEE80211_CONF_PS;
718 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
719}
720
721void ieee80211_dynamic_ps_timer(unsigned long data)
722{
723 struct ieee80211_local *local = (void *) data;
724
725 if (local->quiescing)
726 return;
727
717 queue_work(local->hw.workqueue, &local->dynamic_ps_enable_work);
718}
719
720/* MLME */
721static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
722 struct ieee80211_if_managed *ifmgd,
723 u8 *wmm_param, size_t wmm_param_len)
724{

--- 1378 unchanged lines hidden (view full) ---

2103
2104static void ieee80211_sta_timer(unsigned long data)
2105{
2106 struct ieee80211_sub_if_data *sdata =
2107 (struct ieee80211_sub_if_data *) data;
2108 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2109 struct ieee80211_local *local = sdata->local;
2110
728 queue_work(local->hw.workqueue, &local->dynamic_ps_enable_work);
729}
730
731/* MLME */
732static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
733 struct ieee80211_if_managed *ifmgd,
734 u8 *wmm_param, size_t wmm_param_len)
735{

--- 1378 unchanged lines hidden (view full) ---

2114
2115static void ieee80211_sta_timer(unsigned long data)
2116{
2117 struct ieee80211_sub_if_data *sdata =
2118 (struct ieee80211_sub_if_data *) data;
2119 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2120 struct ieee80211_local *local = sdata->local;
2121
2122 if (local->quiescing) {
2123 set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running);
2124 return;
2125 }
2126
2111 set_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request);
2112 queue_work(local->hw.workqueue, &ifmgd->work);
2113}
2114
2115static void ieee80211_sta_reset_auth(struct ieee80211_sub_if_data *sdata)
2116{
2117 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2118 struct ieee80211_local *local = sdata->local;

--- 116 unchanged lines hidden (view full) ---

2235 if (!netif_running(sdata->dev))
2236 return;
2237
2238 if (local->sw_scanning || local->hw_scanning)
2239 return;
2240
2241 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
2242 return;
2127 set_bit(IEEE80211_STA_REQ_RUN, &ifmgd->request);
2128 queue_work(local->hw.workqueue, &ifmgd->work);
2129}
2130
2131static void ieee80211_sta_reset_auth(struct ieee80211_sub_if_data *sdata)
2132{
2133 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2134 struct ieee80211_local *local = sdata->local;

--- 116 unchanged lines hidden (view full) ---

2251 if (!netif_running(sdata->dev))
2252 return;
2253
2254 if (local->sw_scanning || local->hw_scanning)
2255 return;
2256
2257 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
2258 return;
2259
2260 /*
2261 * Nothing should have been stuffed into the workqueue during
2262 * the suspend->resume cycle. If this WARN is seen then there
2263 * is a bug with either the driver suspend or something in
2264 * mac80211 stuffing into the workqueue which we haven't yet
2265 * cleared during mac80211's suspend cycle.
2266 */
2267 if (WARN_ON(local->suspended))
2268 return;
2269
2243 ifmgd = &sdata->u.mgd;
2244
2245 while ((skb = skb_dequeue(&ifmgd->skb_queue)))
2246 ieee80211_sta_rx_queued_mgmt(sdata, skb);
2247
2248 if (ifmgd->state != IEEE80211_STA_MLME_DIRECT_PROBE &&
2249 ifmgd->state != IEEE80211_STA_MLME_AUTHENTICATE &&
2250 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE &&

--- 51 unchanged lines hidden (view full) ---

2302 sdata->u.mgd.last_beacon = jiffies;
2303
2304
2305 queue_work(sdata->local->hw.workqueue,
2306 &sdata->u.mgd.work);
2307 }
2308}
2309
2270 ifmgd = &sdata->u.mgd;
2271
2272 while ((skb = skb_dequeue(&ifmgd->skb_queue)))
2273 ieee80211_sta_rx_queued_mgmt(sdata, skb);
2274
2275 if (ifmgd->state != IEEE80211_STA_MLME_DIRECT_PROBE &&
2276 ifmgd->state != IEEE80211_STA_MLME_AUTHENTICATE &&
2277 ifmgd->state != IEEE80211_STA_MLME_ASSOCIATE &&

--- 51 unchanged lines hidden (view full) ---

2329 sdata->u.mgd.last_beacon = jiffies;
2330
2331
2332 queue_work(sdata->local->hw.workqueue,
2333 &sdata->u.mgd.work);
2334 }
2335}
2336
2337#ifdef CONFIG_PM
2338void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata)
2339{
2340 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2341
2342 /*
2343 * we need to use atomic bitops for the running bits
2344 * only because both timers might fire at the same
2345 * time -- the code here is properly synchronised.
2346 */
2347
2348 cancel_work_sync(&ifmgd->work);
2349 cancel_work_sync(&ifmgd->beacon_loss_work);
2350 if (del_timer_sync(&ifmgd->timer))
2351 set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running);
2352
2353 cancel_work_sync(&ifmgd->chswitch_work);
2354 if (del_timer_sync(&ifmgd->chswitch_timer))
2355 set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running);
2356}
2357
2358void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
2359{
2360 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2361
2362 if (test_and_clear_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running))
2363 add_timer(&ifmgd->timer);
2364 if (test_and_clear_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running))
2365 add_timer(&ifmgd->chswitch_timer);
2366}
2367#endif
2368
2310/* interface setup */
2311void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
2312{
2313 struct ieee80211_if_managed *ifmgd;
2314 u32 hw_flags;
2315
2316 ifmgd = &sdata->u.mgd;
2317 INIT_WORK(&ifmgd->work, ieee80211_sta_work);

--- 182 unchanged lines hidden ---
2369/* interface setup */
2370void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
2371{
2372 struct ieee80211_if_managed *ifmgd;
2373 u32 hw_flags;
2374
2375 ifmgd = &sdata->u.mgd;
2376 INIT_WORK(&ifmgd->work, ieee80211_sta_work);

--- 182 unchanged lines hidden ---