diff options
author | Jasper Bryant-Greene <jasper@amiton.co.nz> | 2008-08-02 20:04:37 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-22 16:29:58 -0400 |
commit | f698d856f65c3fea091cc303a135967965c5b880 (patch) | |
tree | 94c7c2d561e5191646dc5798683c0aca97973773 /net/mac80211/mlme.c | |
parent | fef1643bf0cdd092a52dc3378479e4811fd65152 (diff) |
replace net_device arguments with ieee80211_{local,sub_if_data} as appropriate
This patch replaces net_device arguments to mac80211 internal functions
with ieee80211_{local,sub_if_data} as appropriate.
It also does the same for many 802.11s mesh functions, and changes the
mesh path table to be indexed on sub_if_data rather than net_device.
If the mesh part needs to be a separate patch let me know, but since
mesh uses a lot of mac80211 functions which were being converted anyway,
the changes go hand-in-hand somewhat.
This patch probably does not convert all the functions which could be
converted, but it is a large chunk and followup patches will be
provided.
Signed-off-by: Jasper Bryant-Greene <jasper@amiton.co.nz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 652 |
1 files changed, 302 insertions, 350 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index ac776c9d48fa..fb8e1e742ca6 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -73,19 +73,19 @@ | |||
73 | #define IEEE80211_MIN_AMPDU_BUF 0x8 | 73 | #define IEEE80211_MIN_AMPDU_BUF 0x8 |
74 | #define IEEE80211_MAX_AMPDU_BUF 0x40 | 74 | #define IEEE80211_MAX_AMPDU_BUF 0x40 |
75 | 75 | ||
76 | static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, | 76 | static void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
77 | u8 *ssid, size_t ssid_len); | 77 | u8 *ssid, size_t ssid_len); |
78 | static struct ieee80211_sta_bss * | 78 | static struct ieee80211_sta_bss * |
79 | ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int freq, | 79 | ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, |
80 | u8 *ssid, u8 ssid_len); | 80 | u8 *ssid, u8 ssid_len); |
81 | static void ieee80211_rx_bss_put(struct ieee80211_local *local, | 81 | static void ieee80211_rx_bss_put(struct ieee80211_local *local, |
82 | struct ieee80211_sta_bss *bss); | 82 | struct ieee80211_sta_bss *bss); |
83 | static int ieee80211_sta_find_ibss(struct net_device *dev, | 83 | static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, |
84 | struct ieee80211_if_sta *ifsta); | 84 | struct ieee80211_if_sta *ifsta); |
85 | static int ieee80211_sta_wep_configured(struct net_device *dev); | 85 | static int ieee80211_sta_wep_configured(struct ieee80211_sub_if_data *sdata); |
86 | static int ieee80211_sta_start_scan(struct net_device *dev, | 86 | static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *sdata, |
87 | u8 *ssid, size_t ssid_len); | 87 | u8 *ssid, size_t ssid_len); |
88 | static int ieee80211_sta_config_auth(struct net_device *dev, | 88 | static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, |
89 | struct ieee80211_if_sta *ifsta); | 89 | struct ieee80211_if_sta *ifsta); |
90 | static void sta_rx_agg_session_timer_expired(unsigned long data); | 90 | static void sta_rx_agg_session_timer_expired(unsigned long data); |
91 | 91 | ||
@@ -239,11 +239,10 @@ static int ecw2cw(int ecw) | |||
239 | } | 239 | } |
240 | 240 | ||
241 | 241 | ||
242 | static void ieee80211_sta_def_wmm_params(struct net_device *dev, | 242 | static void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, |
243 | struct ieee80211_sta_bss *bss, | 243 | struct ieee80211_sta_bss *bss, |
244 | int ibss) | 244 | int ibss) |
245 | { | 245 | { |
246 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
247 | struct ieee80211_local *local = sdata->local; | 246 | struct ieee80211_local *local = sdata->local; |
248 | int i, have_higher_than_11mbit = 0; | 247 | int i, have_higher_than_11mbit = 0; |
249 | 248 | ||
@@ -281,11 +280,10 @@ static void ieee80211_sta_def_wmm_params(struct net_device *dev, | |||
281 | } | 280 | } |
282 | } | 281 | } |
283 | 282 | ||
284 | static void ieee80211_sta_wmm_params(struct net_device *dev, | 283 | static void ieee80211_sta_wmm_params(struct ieee80211_local *local, |
285 | struct ieee80211_if_sta *ifsta, | 284 | struct ieee80211_if_sta *ifsta, |
286 | u8 *wmm_param, size_t wmm_param_len) | 285 | u8 *wmm_param, size_t wmm_param_len) |
287 | { | 286 | { |
288 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
289 | struct ieee80211_tx_queue_params params; | 287 | struct ieee80211_tx_queue_params params; |
290 | size_t left; | 288 | size_t left; |
291 | int count; | 289 | int count; |
@@ -349,14 +347,14 @@ static void ieee80211_sta_wmm_params(struct net_device *dev, | |||
349 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 347 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
350 | printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d " | 348 | printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d " |
351 | "cWmin=%d cWmax=%d txop=%d\n", | 349 | "cWmin=%d cWmax=%d txop=%d\n", |
352 | dev->name, queue, aci, acm, params.aifs, params.cw_min, | 350 | local->mdev->name, queue, aci, acm, params.aifs, params.cw_min, |
353 | params.cw_max, params.txop); | 351 | params.cw_max, params.txop); |
354 | #endif | 352 | #endif |
355 | /* TODO: handle ACM (block TX, fallback to next lowest allowed | 353 | /* TODO: handle ACM (block TX, fallback to next lowest allowed |
356 | * AC for now) */ | 354 | * AC for now) */ |
357 | if (local->ops->conf_tx(local_to_hw(local), queue, ¶ms)) { | 355 | if (local->ops->conf_tx(local_to_hw(local), queue, ¶ms)) { |
358 | printk(KERN_DEBUG "%s: failed to set TX queue " | 356 | printk(KERN_DEBUG "%s: failed to set TX queue " |
359 | "parameters for queue %d\n", dev->name, queue); | 357 | "parameters for queue %d\n", local->mdev->name, queue); |
360 | } | 358 | } |
361 | } | 359 | } |
362 | } | 360 | } |
@@ -475,7 +473,7 @@ int ieee80211_ht_addt_info_ie_to_ht_bss_info( | |||
475 | return 0; | 473 | return 0; |
476 | } | 474 | } |
477 | 475 | ||
478 | static void ieee80211_sta_send_associnfo(struct net_device *dev, | 476 | static void ieee80211_sta_send_associnfo(struct ieee80211_sub_if_data *sdata, |
479 | struct ieee80211_if_sta *ifsta) | 477 | struct ieee80211_if_sta *ifsta) |
480 | { | 478 | { |
481 | char *buf; | 479 | char *buf; |
@@ -520,17 +518,16 @@ static void ieee80211_sta_send_associnfo(struct net_device *dev, | |||
520 | 518 | ||
521 | memset(&wrqu, 0, sizeof(wrqu)); | 519 | memset(&wrqu, 0, sizeof(wrqu)); |
522 | wrqu.data.length = len; | 520 | wrqu.data.length = len; |
523 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); | 521 | wireless_send_event(sdata->dev, IWEVCUSTOM, &wrqu, buf); |
524 | 522 | ||
525 | kfree(buf); | 523 | kfree(buf); |
526 | } | 524 | } |
527 | 525 | ||
528 | 526 | ||
529 | static void ieee80211_set_associated(struct net_device *dev, | 527 | static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, |
530 | struct ieee80211_if_sta *ifsta, | 528 | struct ieee80211_if_sta *ifsta, |
531 | bool assoc) | 529 | bool assoc) |
532 | { | 530 | { |
533 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
534 | struct ieee80211_local *local = sdata->local; | 531 | struct ieee80211_local *local = sdata->local; |
535 | struct ieee80211_conf *conf = &local_to_hw(local)->conf; | 532 | struct ieee80211_conf *conf = &local_to_hw(local)->conf; |
536 | union iwreq_data wrqu; | 533 | union iwreq_data wrqu; |
@@ -544,7 +541,7 @@ static void ieee80211_set_associated(struct net_device *dev, | |||
544 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 541 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
545 | return; | 542 | return; |
546 | 543 | ||
547 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, | 544 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, |
548 | conf->channel->center_freq, | 545 | conf->channel->center_freq, |
549 | ifsta->ssid, ifsta->ssid_len); | 546 | ifsta->ssid, ifsta->ssid_len); |
550 | if (bss) { | 547 | if (bss) { |
@@ -568,12 +565,12 @@ static void ieee80211_set_associated(struct net_device *dev, | |||
568 | ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET; | 565 | ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET; |
569 | memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); | 566 | memcpy(ifsta->prev_bssid, sdata->u.sta.bssid, ETH_ALEN); |
570 | memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN); | 567 | memcpy(wrqu.ap_addr.sa_data, sdata->u.sta.bssid, ETH_ALEN); |
571 | ieee80211_sta_send_associnfo(dev, ifsta); | 568 | ieee80211_sta_send_associnfo(sdata, ifsta); |
572 | } else { | 569 | } else { |
573 | netif_carrier_off(dev); | 570 | netif_carrier_off(sdata->dev); |
574 | ieee80211_sta_tear_down_BA_sessions(dev, ifsta->bssid); | 571 | ieee80211_sta_tear_down_BA_sessions(sdata, ifsta->bssid); |
575 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; | 572 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; |
576 | changed |= ieee80211_reset_erp_info(dev); | 573 | changed |= ieee80211_reset_erp_info(sdata); |
577 | 574 | ||
578 | sdata->bss_conf.assoc_ht = 0; | 575 | sdata->bss_conf.assoc_ht = 0; |
579 | sdata->bss_conf.ht_conf = NULL; | 576 | sdata->bss_conf.ht_conf = NULL; |
@@ -588,27 +585,24 @@ static void ieee80211_set_associated(struct net_device *dev, | |||
588 | ieee80211_bss_info_change_notify(sdata, changed); | 585 | ieee80211_bss_info_change_notify(sdata, changed); |
589 | 586 | ||
590 | if (assoc) | 587 | if (assoc) |
591 | netif_carrier_on(dev); | 588 | netif_carrier_on(sdata->dev); |
592 | 589 | ||
593 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 590 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
594 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | 591 | wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL); |
595 | } | 592 | } |
596 | 593 | ||
597 | static void ieee80211_set_disassoc(struct net_device *dev, | 594 | static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, |
598 | struct ieee80211_if_sta *ifsta, int deauth) | 595 | struct ieee80211_if_sta *ifsta, int deauth) |
599 | { | 596 | { |
600 | if (deauth) | 597 | if (deauth) |
601 | ifsta->auth_tries = 0; | 598 | ifsta->auth_tries = 0; |
602 | ifsta->assoc_tries = 0; | 599 | ifsta->assoc_tries = 0; |
603 | ieee80211_set_associated(dev, ifsta, 0); | 600 | ieee80211_set_associated(sdata, ifsta, 0); |
604 | } | 601 | } |
605 | 602 | ||
606 | void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb, | 603 | void ieee80211_sta_tx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
607 | int encrypt) | 604 | int encrypt) |
608 | { | 605 | { |
609 | struct ieee80211_sub_if_data *sdata; | ||
610 | |||
611 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
612 | skb->dev = sdata->local->mdev; | 606 | skb->dev = sdata->local->mdev; |
613 | skb_set_mac_header(skb, 0); | 607 | skb_set_mac_header(skb, 0); |
614 | skb_set_network_header(skb, 0); | 608 | skb_set_network_header(skb, 0); |
@@ -621,12 +615,12 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb, | |||
621 | } | 615 | } |
622 | 616 | ||
623 | 617 | ||
624 | static void ieee80211_send_auth(struct net_device *dev, | 618 | static void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, |
625 | struct ieee80211_if_sta *ifsta, | 619 | struct ieee80211_if_sta *ifsta, |
626 | int transaction, u8 *extra, size_t extra_len, | 620 | int transaction, u8 *extra, size_t extra_len, |
627 | int encrypt) | 621 | int encrypt) |
628 | { | 622 | { |
629 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 623 | struct ieee80211_local *local = sdata->local; |
630 | struct sk_buff *skb; | 624 | struct sk_buff *skb; |
631 | struct ieee80211_mgmt *mgmt; | 625 | struct ieee80211_mgmt *mgmt; |
632 | 626 | ||
@@ -634,7 +628,7 @@ static void ieee80211_send_auth(struct net_device *dev, | |||
634 | sizeof(*mgmt) + 6 + extra_len); | 628 | sizeof(*mgmt) + 6 + extra_len); |
635 | if (!skb) { | 629 | if (!skb) { |
636 | printk(KERN_DEBUG "%s: failed to allocate buffer for auth " | 630 | printk(KERN_DEBUG "%s: failed to allocate buffer for auth " |
637 | "frame\n", dev->name); | 631 | "frame\n", sdata->dev->name); |
638 | return; | 632 | return; |
639 | } | 633 | } |
640 | skb_reserve(skb, local->hw.extra_tx_headroom); | 634 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -646,7 +640,7 @@ static void ieee80211_send_auth(struct net_device *dev, | |||
646 | if (encrypt) | 640 | if (encrypt) |
647 | mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 641 | mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
648 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | 642 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); |
649 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 643 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
650 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 644 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
651 | mgmt->u.auth.auth_alg = cpu_to_le16(ifsta->auth_alg); | 645 | mgmt->u.auth.auth_alg = cpu_to_le16(ifsta->auth_alg); |
652 | mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); | 646 | mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); |
@@ -655,11 +649,11 @@ static void ieee80211_send_auth(struct net_device *dev, | |||
655 | if (extra) | 649 | if (extra) |
656 | memcpy(skb_put(skb, extra_len), extra, extra_len); | 650 | memcpy(skb_put(skb, extra_len), extra, extra_len); |
657 | 651 | ||
658 | ieee80211_sta_tx(dev, skb, encrypt); | 652 | ieee80211_sta_tx(sdata, skb, encrypt); |
659 | } | 653 | } |
660 | 654 | ||
661 | 655 | ||
662 | static void ieee80211_authenticate(struct net_device *dev, | 656 | static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata, |
663 | struct ieee80211_if_sta *ifsta) | 657 | struct ieee80211_if_sta *ifsta) |
664 | { | 658 | { |
665 | DECLARE_MAC_BUF(mac); | 659 | DECLARE_MAC_BUF(mac); |
@@ -668,16 +662,16 @@ static void ieee80211_authenticate(struct net_device *dev, | |||
668 | if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) { | 662 | if (ifsta->auth_tries > IEEE80211_AUTH_MAX_TRIES) { |
669 | printk(KERN_DEBUG "%s: authentication with AP %s" | 663 | printk(KERN_DEBUG "%s: authentication with AP %s" |
670 | " timed out\n", | 664 | " timed out\n", |
671 | dev->name, print_mac(mac, ifsta->bssid)); | 665 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
672 | ifsta->state = IEEE80211_DISABLED; | 666 | ifsta->state = IEEE80211_DISABLED; |
673 | return; | 667 | return; |
674 | } | 668 | } |
675 | 669 | ||
676 | ifsta->state = IEEE80211_AUTHENTICATE; | 670 | ifsta->state = IEEE80211_AUTHENTICATE; |
677 | printk(KERN_DEBUG "%s: authenticate with AP %s\n", | 671 | printk(KERN_DEBUG "%s: authenticate with AP %s\n", |
678 | dev->name, print_mac(mac, ifsta->bssid)); | 672 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
679 | 673 | ||
680 | ieee80211_send_auth(dev, ifsta, 1, NULL, 0, 0); | 674 | ieee80211_send_auth(sdata, ifsta, 1, NULL, 0, 0); |
681 | 675 | ||
682 | mod_timer(&ifsta->timer, jiffies + IEEE80211_AUTH_TIMEOUT); | 676 | mod_timer(&ifsta->timer, jiffies + IEEE80211_AUTH_TIMEOUT); |
683 | } | 677 | } |
@@ -703,10 +697,10 @@ static int ieee80211_compatible_rates(struct ieee80211_sta_bss *bss, | |||
703 | return count; | 697 | return count; |
704 | } | 698 | } |
705 | 699 | ||
706 | static void ieee80211_send_assoc(struct net_device *dev, | 700 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, |
707 | struct ieee80211_if_sta *ifsta) | 701 | struct ieee80211_if_sta *ifsta) |
708 | { | 702 | { |
709 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 703 | struct ieee80211_local *local = sdata->local; |
710 | struct sk_buff *skb; | 704 | struct sk_buff *skb; |
711 | struct ieee80211_mgmt *mgmt; | 705 | struct ieee80211_mgmt *mgmt; |
712 | u8 *pos, *ies; | 706 | u8 *pos, *ies; |
@@ -722,7 +716,7 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
722 | ifsta->ssid_len); | 716 | ifsta->ssid_len); |
723 | if (!skb) { | 717 | if (!skb) { |
724 | printk(KERN_DEBUG "%s: failed to allocate buffer for assoc " | 718 | printk(KERN_DEBUG "%s: failed to allocate buffer for assoc " |
725 | "frame\n", dev->name); | 719 | "frame\n", sdata->dev->name); |
726 | return; | 720 | return; |
727 | } | 721 | } |
728 | skb_reserve(skb, local->hw.extra_tx_headroom); | 722 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -738,7 +732,7 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
738 | capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; | 732 | capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; |
739 | } | 733 | } |
740 | 734 | ||
741 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, | 735 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, |
742 | local->hw.conf.channel->center_freq, | 736 | local->hw.conf.channel->center_freq, |
743 | ifsta->ssid, ifsta->ssid_len); | 737 | ifsta->ssid, ifsta->ssid_len); |
744 | if (bss) { | 738 | if (bss) { |
@@ -766,7 +760,7 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
766 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 760 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
767 | memset(mgmt, 0, 24); | 761 | memset(mgmt, 0, 24); |
768 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | 762 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); |
769 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 763 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
770 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 764 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
771 | 765 | ||
772 | if (ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) { | 766 | if (ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) { |
@@ -907,21 +901,21 @@ static void ieee80211_send_assoc(struct net_device *dev, | |||
907 | if (ifsta->assocreq_ies) | 901 | if (ifsta->assocreq_ies) |
908 | memcpy(ifsta->assocreq_ies, ies, ifsta->assocreq_ies_len); | 902 | memcpy(ifsta->assocreq_ies, ies, ifsta->assocreq_ies_len); |
909 | 903 | ||
910 | ieee80211_sta_tx(dev, skb, 0); | 904 | ieee80211_sta_tx(sdata, skb, 0); |
911 | } | 905 | } |
912 | 906 | ||
913 | 907 | ||
914 | static void ieee80211_send_deauth(struct net_device *dev, | 908 | static void ieee80211_send_deauth(struct ieee80211_sub_if_data *sdata, |
915 | struct ieee80211_if_sta *ifsta, u16 reason) | 909 | struct ieee80211_if_sta *ifsta, u16 reason) |
916 | { | 910 | { |
917 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 911 | struct ieee80211_local *local = sdata->local; |
918 | struct sk_buff *skb; | 912 | struct sk_buff *skb; |
919 | struct ieee80211_mgmt *mgmt; | 913 | struct ieee80211_mgmt *mgmt; |
920 | 914 | ||
921 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); | 915 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); |
922 | if (!skb) { | 916 | if (!skb) { |
923 | printk(KERN_DEBUG "%s: failed to allocate buffer for deauth " | 917 | printk(KERN_DEBUG "%s: failed to allocate buffer for deauth " |
924 | "frame\n", dev->name); | 918 | "frame\n", sdata->dev->name); |
925 | return; | 919 | return; |
926 | } | 920 | } |
927 | skb_reserve(skb, local->hw.extra_tx_headroom); | 921 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -929,28 +923,28 @@ static void ieee80211_send_deauth(struct net_device *dev, | |||
929 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 923 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
930 | memset(mgmt, 0, 24); | 924 | memset(mgmt, 0, 24); |
931 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | 925 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); |
932 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 926 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
933 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 927 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
934 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 928 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
935 | IEEE80211_STYPE_DEAUTH); | 929 | IEEE80211_STYPE_DEAUTH); |
936 | skb_put(skb, 2); | 930 | skb_put(skb, 2); |
937 | mgmt->u.deauth.reason_code = cpu_to_le16(reason); | 931 | mgmt->u.deauth.reason_code = cpu_to_le16(reason); |
938 | 932 | ||
939 | ieee80211_sta_tx(dev, skb, 0); | 933 | ieee80211_sta_tx(sdata, skb, 0); |
940 | } | 934 | } |
941 | 935 | ||
942 | 936 | ||
943 | static void ieee80211_send_disassoc(struct net_device *dev, | 937 | static void ieee80211_send_disassoc(struct ieee80211_sub_if_data *sdata, |
944 | struct ieee80211_if_sta *ifsta, u16 reason) | 938 | struct ieee80211_if_sta *ifsta, u16 reason) |
945 | { | 939 | { |
946 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 940 | struct ieee80211_local *local = sdata->local; |
947 | struct sk_buff *skb; | 941 | struct sk_buff *skb; |
948 | struct ieee80211_mgmt *mgmt; | 942 | struct ieee80211_mgmt *mgmt; |
949 | 943 | ||
950 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); | 944 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); |
951 | if (!skb) { | 945 | if (!skb) { |
952 | printk(KERN_DEBUG "%s: failed to allocate buffer for disassoc " | 946 | printk(KERN_DEBUG "%s: failed to allocate buffer for disassoc " |
953 | "frame\n", dev->name); | 947 | "frame\n", sdata->dev->name); |
954 | return; | 948 | return; |
955 | } | 949 | } |
956 | skb_reserve(skb, local->hw.extra_tx_headroom); | 950 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -958,21 +952,21 @@ static void ieee80211_send_disassoc(struct net_device *dev, | |||
958 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 952 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
959 | memset(mgmt, 0, 24); | 953 | memset(mgmt, 0, 24); |
960 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); | 954 | memcpy(mgmt->da, ifsta->bssid, ETH_ALEN); |
961 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 955 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
962 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 956 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
963 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 957 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
964 | IEEE80211_STYPE_DISASSOC); | 958 | IEEE80211_STYPE_DISASSOC); |
965 | skb_put(skb, 2); | 959 | skb_put(skb, 2); |
966 | mgmt->u.disassoc.reason_code = cpu_to_le16(reason); | 960 | mgmt->u.disassoc.reason_code = cpu_to_le16(reason); |
967 | 961 | ||
968 | ieee80211_sta_tx(dev, skb, 0); | 962 | ieee80211_sta_tx(sdata, skb, 0); |
969 | } | 963 | } |
970 | 964 | ||
971 | 965 | ||
972 | static int ieee80211_privacy_mismatch(struct net_device *dev, | 966 | static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata, |
973 | struct ieee80211_if_sta *ifsta) | 967 | struct ieee80211_if_sta *ifsta) |
974 | { | 968 | { |
975 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 969 | struct ieee80211_local *local = sdata->local; |
976 | struct ieee80211_sta_bss *bss; | 970 | struct ieee80211_sta_bss *bss; |
977 | int bss_privacy; | 971 | int bss_privacy; |
978 | int wep_privacy; | 972 | int wep_privacy; |
@@ -981,14 +975,14 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, | |||
981 | if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL)) | 975 | if (!ifsta || (ifsta->flags & IEEE80211_STA_MIXED_CELL)) |
982 | return 0; | 976 | return 0; |
983 | 977 | ||
984 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, | 978 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, |
985 | local->hw.conf.channel->center_freq, | 979 | local->hw.conf.channel->center_freq, |
986 | ifsta->ssid, ifsta->ssid_len); | 980 | ifsta->ssid, ifsta->ssid_len); |
987 | if (!bss) | 981 | if (!bss) |
988 | return 0; | 982 | return 0; |
989 | 983 | ||
990 | bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY); | 984 | bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY); |
991 | wep_privacy = !!ieee80211_sta_wep_configured(dev); | 985 | wep_privacy = !!ieee80211_sta_wep_configured(sdata); |
992 | privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED); | 986 | privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED); |
993 | 987 | ||
994 | ieee80211_rx_bss_put(local, bss); | 988 | ieee80211_rx_bss_put(local, bss); |
@@ -1000,7 +994,7 @@ static int ieee80211_privacy_mismatch(struct net_device *dev, | |||
1000 | } | 994 | } |
1001 | 995 | ||
1002 | 996 | ||
1003 | static void ieee80211_associate(struct net_device *dev, | 997 | static void ieee80211_associate(struct ieee80211_sub_if_data *sdata, |
1004 | struct ieee80211_if_sta *ifsta) | 998 | struct ieee80211_if_sta *ifsta) |
1005 | { | 999 | { |
1006 | DECLARE_MAC_BUF(mac); | 1000 | DECLARE_MAC_BUF(mac); |
@@ -1009,31 +1003,31 @@ static void ieee80211_associate(struct net_device *dev, | |||
1009 | if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) { | 1003 | if (ifsta->assoc_tries > IEEE80211_ASSOC_MAX_TRIES) { |
1010 | printk(KERN_DEBUG "%s: association with AP %s" | 1004 | printk(KERN_DEBUG "%s: association with AP %s" |
1011 | " timed out\n", | 1005 | " timed out\n", |
1012 | dev->name, print_mac(mac, ifsta->bssid)); | 1006 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
1013 | ifsta->state = IEEE80211_DISABLED; | 1007 | ifsta->state = IEEE80211_DISABLED; |
1014 | return; | 1008 | return; |
1015 | } | 1009 | } |
1016 | 1010 | ||
1017 | ifsta->state = IEEE80211_ASSOCIATE; | 1011 | ifsta->state = IEEE80211_ASSOCIATE; |
1018 | printk(KERN_DEBUG "%s: associate with AP %s\n", | 1012 | printk(KERN_DEBUG "%s: associate with AP %s\n", |
1019 | dev->name, print_mac(mac, ifsta->bssid)); | 1013 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
1020 | if (ieee80211_privacy_mismatch(dev, ifsta)) { | 1014 | if (ieee80211_privacy_mismatch(sdata, ifsta)) { |
1021 | printk(KERN_DEBUG "%s: mismatch in privacy configuration and " | 1015 | printk(KERN_DEBUG "%s: mismatch in privacy configuration and " |
1022 | "mixed-cell disabled - abort association\n", dev->name); | 1016 | "mixed-cell disabled - abort association\n", sdata->dev->name); |
1023 | ifsta->state = IEEE80211_DISABLED; | 1017 | ifsta->state = IEEE80211_DISABLED; |
1024 | return; | 1018 | return; |
1025 | } | 1019 | } |
1026 | 1020 | ||
1027 | ieee80211_send_assoc(dev, ifsta); | 1021 | ieee80211_send_assoc(sdata, ifsta); |
1028 | 1022 | ||
1029 | mod_timer(&ifsta->timer, jiffies + IEEE80211_ASSOC_TIMEOUT); | 1023 | mod_timer(&ifsta->timer, jiffies + IEEE80211_ASSOC_TIMEOUT); |
1030 | } | 1024 | } |
1031 | 1025 | ||
1032 | 1026 | ||
1033 | static void ieee80211_associated(struct net_device *dev, | 1027 | static void ieee80211_associated(struct ieee80211_sub_if_data *sdata, |
1034 | struct ieee80211_if_sta *ifsta) | 1028 | struct ieee80211_if_sta *ifsta) |
1035 | { | 1029 | { |
1036 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1030 | struct ieee80211_local *local = sdata->local; |
1037 | struct sta_info *sta; | 1031 | struct sta_info *sta; |
1038 | int disassoc; | 1032 | int disassoc; |
1039 | DECLARE_MAC_BUF(mac); | 1033 | DECLARE_MAC_BUF(mac); |
@@ -1050,7 +1044,7 @@ static void ieee80211_associated(struct net_device *dev, | |||
1050 | sta = sta_info_get(local, ifsta->bssid); | 1044 | sta = sta_info_get(local, ifsta->bssid); |
1051 | if (!sta) { | 1045 | if (!sta) { |
1052 | printk(KERN_DEBUG "%s: No STA entry for own AP %s\n", | 1046 | printk(KERN_DEBUG "%s: No STA entry for own AP %s\n", |
1053 | dev->name, print_mac(mac, ifsta->bssid)); | 1047 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
1054 | disassoc = 1; | 1048 | disassoc = 1; |
1055 | } else { | 1049 | } else { |
1056 | disassoc = 0; | 1050 | disassoc = 0; |
@@ -1060,11 +1054,11 @@ static void ieee80211_associated(struct net_device *dev, | |||
1060 | printk(KERN_DEBUG "%s: No ProbeResp from " | 1054 | printk(KERN_DEBUG "%s: No ProbeResp from " |
1061 | "current AP %s - assume out of " | 1055 | "current AP %s - assume out of " |
1062 | "range\n", | 1056 | "range\n", |
1063 | dev->name, print_mac(mac, ifsta->bssid)); | 1057 | sdata->dev->name, print_mac(mac, ifsta->bssid)); |
1064 | disassoc = 1; | 1058 | disassoc = 1; |
1065 | sta_info_unlink(&sta); | 1059 | sta_info_unlink(&sta); |
1066 | } else | 1060 | } else |
1067 | ieee80211_send_probe_req(dev, ifsta->bssid, | 1061 | ieee80211_send_probe_req(sdata, ifsta->bssid, |
1068 | local->scan_ssid, | 1062 | local->scan_ssid, |
1069 | local->scan_ssid_len); | 1063 | local->scan_ssid_len); |
1070 | ifsta->flags ^= IEEE80211_STA_PROBEREQ_POLL; | 1064 | ifsta->flags ^= IEEE80211_STA_PROBEREQ_POLL; |
@@ -1073,7 +1067,7 @@ static void ieee80211_associated(struct net_device *dev, | |||
1073 | if (time_after(jiffies, ifsta->last_probe + | 1067 | if (time_after(jiffies, ifsta->last_probe + |
1074 | IEEE80211_PROBE_INTERVAL)) { | 1068 | IEEE80211_PROBE_INTERVAL)) { |
1075 | ifsta->last_probe = jiffies; | 1069 | ifsta->last_probe = jiffies; |
1076 | ieee80211_send_probe_req(dev, ifsta->bssid, | 1070 | ieee80211_send_probe_req(sdata, ifsta->bssid, |
1077 | ifsta->ssid, | 1071 | ifsta->ssid, |
1078 | ifsta->ssid_len); | 1072 | ifsta->ssid_len); |
1079 | } | 1073 | } |
@@ -1087,7 +1081,7 @@ static void ieee80211_associated(struct net_device *dev, | |||
1087 | 1081 | ||
1088 | if (disassoc) { | 1082 | if (disassoc) { |
1089 | ifsta->state = IEEE80211_DISABLED; | 1083 | ifsta->state = IEEE80211_DISABLED; |
1090 | ieee80211_set_associated(dev, ifsta, 0); | 1084 | ieee80211_set_associated(sdata, ifsta, 0); |
1091 | } else { | 1085 | } else { |
1092 | mod_timer(&ifsta->timer, jiffies + | 1086 | mod_timer(&ifsta->timer, jiffies + |
1093 | IEEE80211_MONITORING_INTERVAL); | 1087 | IEEE80211_MONITORING_INTERVAL); |
@@ -1095,10 +1089,10 @@ static void ieee80211_associated(struct net_device *dev, | |||
1095 | } | 1089 | } |
1096 | 1090 | ||
1097 | 1091 | ||
1098 | static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, | 1092 | static void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
1099 | u8 *ssid, size_t ssid_len) | 1093 | u8 *ssid, size_t ssid_len) |
1100 | { | 1094 | { |
1101 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1095 | struct ieee80211_local *local = sdata->local; |
1102 | struct ieee80211_supported_band *sband; | 1096 | struct ieee80211_supported_band *sband; |
1103 | struct sk_buff *skb; | 1097 | struct sk_buff *skb; |
1104 | struct ieee80211_mgmt *mgmt; | 1098 | struct ieee80211_mgmt *mgmt; |
@@ -1108,7 +1102,7 @@ static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, | |||
1108 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200); | 1102 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200); |
1109 | if (!skb) { | 1103 | if (!skb) { |
1110 | printk(KERN_DEBUG "%s: failed to allocate buffer for probe " | 1104 | printk(KERN_DEBUG "%s: failed to allocate buffer for probe " |
1111 | "request\n", dev->name); | 1105 | "request\n", sdata->dev->name); |
1112 | return; | 1106 | return; |
1113 | } | 1107 | } |
1114 | skb_reserve(skb, local->hw.extra_tx_headroom); | 1108 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -1117,7 +1111,7 @@ static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, | |||
1117 | memset(mgmt, 0, 24); | 1111 | memset(mgmt, 0, 24); |
1118 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1112 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1119 | IEEE80211_STYPE_PROBE_REQ); | 1113 | IEEE80211_STYPE_PROBE_REQ); |
1120 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1114 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
1121 | if (dst) { | 1115 | if (dst) { |
1122 | memcpy(mgmt->da, dst, ETH_ALEN); | 1116 | memcpy(mgmt->da, dst, ETH_ALEN); |
1123 | memcpy(mgmt->bssid, dst, ETH_ALEN); | 1117 | memcpy(mgmt->bssid, dst, ETH_ALEN); |
@@ -1152,13 +1146,12 @@ static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, | |||
1152 | *pos = rate->bitrate / 5; | 1146 | *pos = rate->bitrate / 5; |
1153 | } | 1147 | } |
1154 | 1148 | ||
1155 | ieee80211_sta_tx(dev, skb, 0); | 1149 | ieee80211_sta_tx(sdata, skb, 0); |
1156 | } | 1150 | } |
1157 | 1151 | ||
1158 | 1152 | ||
1159 | static int ieee80211_sta_wep_configured(struct net_device *dev) | 1153 | static int ieee80211_sta_wep_configured(struct ieee80211_sub_if_data *sdata) |
1160 | { | 1154 | { |
1161 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1162 | if (!sdata || !sdata->default_key || | 1155 | if (!sdata || !sdata->default_key || |
1163 | sdata->default_key->conf.alg != ALG_WEP) | 1156 | sdata->default_key->conf.alg != ALG_WEP) |
1164 | return 0; | 1157 | return 0; |
@@ -1166,16 +1159,16 @@ static int ieee80211_sta_wep_configured(struct net_device *dev) | |||
1166 | } | 1159 | } |
1167 | 1160 | ||
1168 | 1161 | ||
1169 | static void ieee80211_auth_completed(struct net_device *dev, | 1162 | static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata, |
1170 | struct ieee80211_if_sta *ifsta) | 1163 | struct ieee80211_if_sta *ifsta) |
1171 | { | 1164 | { |
1172 | printk(KERN_DEBUG "%s: authenticated\n", dev->name); | 1165 | printk(KERN_DEBUG "%s: authenticated\n", sdata->dev->name); |
1173 | ifsta->flags |= IEEE80211_STA_AUTHENTICATED; | 1166 | ifsta->flags |= IEEE80211_STA_AUTHENTICATED; |
1174 | ieee80211_associate(dev, ifsta); | 1167 | ieee80211_associate(sdata, ifsta); |
1175 | } | 1168 | } |
1176 | 1169 | ||
1177 | 1170 | ||
1178 | static void ieee80211_auth_challenge(struct net_device *dev, | 1171 | static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata, |
1179 | struct ieee80211_if_sta *ifsta, | 1172 | struct ieee80211_if_sta *ifsta, |
1180 | struct ieee80211_mgmt *mgmt, | 1173 | struct ieee80211_mgmt *mgmt, |
1181 | size_t len) | 1174 | size_t len) |
@@ -1187,17 +1180,16 @@ static void ieee80211_auth_challenge(struct net_device *dev, | |||
1187 | ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); | 1180 | ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); |
1188 | if (!elems.challenge) | 1181 | if (!elems.challenge) |
1189 | return; | 1182 | return; |
1190 | ieee80211_send_auth(dev, ifsta, 3, elems.challenge - 2, | 1183 | ieee80211_send_auth(sdata, ifsta, 3, elems.challenge - 2, |
1191 | elems.challenge_len + 2, 1); | 1184 | elems.challenge_len + 2, 1); |
1192 | } | 1185 | } |
1193 | 1186 | ||
1194 | static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid, | 1187 | static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid, |
1195 | u8 dialog_token, u16 status, u16 policy, | 1188 | u8 dialog_token, u16 status, u16 policy, |
1196 | u16 buf_size, u16 timeout) | 1189 | u16 buf_size, u16 timeout) |
1197 | { | 1190 | { |
1198 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1199 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 1191 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
1200 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1192 | struct ieee80211_local *local = sdata->local; |
1201 | struct sk_buff *skb; | 1193 | struct sk_buff *skb; |
1202 | struct ieee80211_mgmt *mgmt; | 1194 | struct ieee80211_mgmt *mgmt; |
1203 | u16 capab; | 1195 | u16 capab; |
@@ -1206,7 +1198,7 @@ static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid, | |||
1206 | 1198 | ||
1207 | if (!skb) { | 1199 | if (!skb) { |
1208 | printk(KERN_DEBUG "%s: failed to allocate buffer " | 1200 | printk(KERN_DEBUG "%s: failed to allocate buffer " |
1209 | "for addba resp frame\n", dev->name); | 1201 | "for addba resp frame\n", sdata->dev->name); |
1210 | return; | 1202 | return; |
1211 | } | 1203 | } |
1212 | 1204 | ||
@@ -1214,9 +1206,9 @@ static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid, | |||
1214 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 1206 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
1215 | memset(mgmt, 0, 24); | 1207 | memset(mgmt, 0, 24); |
1216 | memcpy(mgmt->da, da, ETH_ALEN); | 1208 | memcpy(mgmt->da, da, ETH_ALEN); |
1217 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1209 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
1218 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) | 1210 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) |
1219 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); | 1211 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); |
1220 | else | 1212 | else |
1221 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 1213 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
1222 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1214 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
@@ -1235,17 +1227,16 @@ static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid, | |||
1235 | mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); | 1227 | mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); |
1236 | mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); | 1228 | mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); |
1237 | 1229 | ||
1238 | ieee80211_sta_tx(dev, skb, 0); | 1230 | ieee80211_sta_tx(sdata, skb, 0); |
1239 | 1231 | ||
1240 | return; | 1232 | return; |
1241 | } | 1233 | } |
1242 | 1234 | ||
1243 | void ieee80211_send_addba_request(struct net_device *dev, const u8 *da, | 1235 | void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, const u8 *da, |
1244 | u16 tid, u8 dialog_token, u16 start_seq_num, | 1236 | u16 tid, u8 dialog_token, u16 start_seq_num, |
1245 | u16 agg_size, u16 timeout) | 1237 | u16 agg_size, u16 timeout) |
1246 | { | 1238 | { |
1247 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1239 | struct ieee80211_local *local = sdata->local; |
1248 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1249 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 1240 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
1250 | struct sk_buff *skb; | 1241 | struct sk_buff *skb; |
1251 | struct ieee80211_mgmt *mgmt; | 1242 | struct ieee80211_mgmt *mgmt; |
@@ -1255,16 +1246,16 @@ void ieee80211_send_addba_request(struct net_device *dev, const u8 *da, | |||
1255 | 1246 | ||
1256 | if (!skb) { | 1247 | if (!skb) { |
1257 | printk(KERN_ERR "%s: failed to allocate buffer " | 1248 | printk(KERN_ERR "%s: failed to allocate buffer " |
1258 | "for addba request frame\n", dev->name); | 1249 | "for addba request frame\n", sdata->dev->name); |
1259 | return; | 1250 | return; |
1260 | } | 1251 | } |
1261 | skb_reserve(skb, local->hw.extra_tx_headroom); | 1252 | skb_reserve(skb, local->hw.extra_tx_headroom); |
1262 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 1253 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
1263 | memset(mgmt, 0, 24); | 1254 | memset(mgmt, 0, 24); |
1264 | memcpy(mgmt->da, da, ETH_ALEN); | 1255 | memcpy(mgmt->da, da, ETH_ALEN); |
1265 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1256 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
1266 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) | 1257 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) |
1267 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); | 1258 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); |
1268 | else | 1259 | else |
1269 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 1260 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
1270 | 1261 | ||
@@ -1287,14 +1278,13 @@ void ieee80211_send_addba_request(struct net_device *dev, const u8 *da, | |||
1287 | mgmt->u.action.u.addba_req.start_seq_num = | 1278 | mgmt->u.action.u.addba_req.start_seq_num = |
1288 | cpu_to_le16(start_seq_num << 4); | 1279 | cpu_to_le16(start_seq_num << 4); |
1289 | 1280 | ||
1290 | ieee80211_sta_tx(dev, skb, 0); | 1281 | ieee80211_sta_tx(sdata, skb, 0); |
1291 | } | 1282 | } |
1292 | 1283 | ||
1293 | static void ieee80211_sta_process_addba_request(struct net_device *dev, | 1284 | static void ieee80211_sta_process_addba_request(struct ieee80211_local *local, |
1294 | struct ieee80211_mgmt *mgmt, | 1285 | struct ieee80211_mgmt *mgmt, |
1295 | size_t len) | 1286 | size_t len) |
1296 | { | 1287 | { |
1297 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
1298 | struct ieee80211_hw *hw = &local->hw; | 1288 | struct ieee80211_hw *hw = &local->hw; |
1299 | struct ieee80211_conf *conf = &hw->conf; | 1289 | struct ieee80211_conf *conf = &hw->conf; |
1300 | struct sta_info *sta; | 1290 | struct sta_info *sta; |
@@ -1426,16 +1416,15 @@ end: | |||
1426 | spin_unlock_bh(&sta->lock); | 1416 | spin_unlock_bh(&sta->lock); |
1427 | 1417 | ||
1428 | end_no_lock: | 1418 | end_no_lock: |
1429 | ieee80211_send_addba_resp(sta->sdata->dev, sta->addr, tid, | 1419 | ieee80211_send_addba_resp(sta->sdata, sta->addr, tid, |
1430 | dialog_token, status, 1, buf_size, timeout); | 1420 | dialog_token, status, 1, buf_size, timeout); |
1431 | rcu_read_unlock(); | 1421 | rcu_read_unlock(); |
1432 | } | 1422 | } |
1433 | 1423 | ||
1434 | static void ieee80211_sta_process_addba_resp(struct net_device *dev, | 1424 | static void ieee80211_sta_process_addba_resp(struct ieee80211_local *local, |
1435 | struct ieee80211_mgmt *mgmt, | 1425 | struct ieee80211_mgmt *mgmt, |
1436 | size_t len) | 1426 | size_t len) |
1437 | { | 1427 | { |
1438 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
1439 | struct ieee80211_hw *hw = &local->hw; | 1428 | struct ieee80211_hw *hw = &local->hw; |
1440 | struct sta_info *sta; | 1429 | struct sta_info *sta; |
1441 | u16 capab; | 1430 | u16 capab; |
@@ -1497,11 +1486,10 @@ addba_resp_exit: | |||
1497 | rcu_read_unlock(); | 1486 | rcu_read_unlock(); |
1498 | } | 1487 | } |
1499 | 1488 | ||
1500 | void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | 1489 | void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, const u8 *da, u16 tid, |
1501 | u16 initiator, u16 reason_code) | 1490 | u16 initiator, u16 reason_code) |
1502 | { | 1491 | { |
1503 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1492 | struct ieee80211_local *local = sdata->local; |
1504 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1505 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 1493 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
1506 | struct sk_buff *skb; | 1494 | struct sk_buff *skb; |
1507 | struct ieee80211_mgmt *mgmt; | 1495 | struct ieee80211_mgmt *mgmt; |
@@ -1511,7 +1499,7 @@ void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | |||
1511 | 1499 | ||
1512 | if (!skb) { | 1500 | if (!skb) { |
1513 | printk(KERN_ERR "%s: failed to allocate buffer " | 1501 | printk(KERN_ERR "%s: failed to allocate buffer " |
1514 | "for delba frame\n", dev->name); | 1502 | "for delba frame\n", sdata->dev->name); |
1515 | return; | 1503 | return; |
1516 | } | 1504 | } |
1517 | 1505 | ||
@@ -1519,9 +1507,9 @@ void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | |||
1519 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 1507 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
1520 | memset(mgmt, 0, 24); | 1508 | memset(mgmt, 0, 24); |
1521 | memcpy(mgmt->da, da, ETH_ALEN); | 1509 | memcpy(mgmt->da, da, ETH_ALEN); |
1522 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 1510 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
1523 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) | 1511 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) |
1524 | memcpy(mgmt->bssid, dev->dev_addr, ETH_ALEN); | 1512 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); |
1525 | else | 1513 | else |
1526 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 1514 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
1527 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1515 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
@@ -1537,12 +1525,12 @@ void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | |||
1537 | mgmt->u.action.u.delba.params = cpu_to_le16(params); | 1525 | mgmt->u.action.u.delba.params = cpu_to_le16(params); |
1538 | mgmt->u.action.u.delba.reason_code = cpu_to_le16(reason_code); | 1526 | mgmt->u.action.u.delba.reason_code = cpu_to_le16(reason_code); |
1539 | 1527 | ||
1540 | ieee80211_sta_tx(dev, skb, 0); | 1528 | ieee80211_sta_tx(sdata, skb, 0); |
1541 | } | 1529 | } |
1542 | 1530 | ||
1543 | void ieee80211_send_bar(struct net_device *dev, u8 *ra, u16 tid, u16 ssn) | 1531 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn) |
1544 | { | 1532 | { |
1545 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1533 | struct ieee80211_local *local = sdata->local; |
1546 | struct sk_buff *skb; | 1534 | struct sk_buff *skb; |
1547 | struct ieee80211_bar *bar; | 1535 | struct ieee80211_bar *bar; |
1548 | u16 bar_control = 0; | 1536 | u16 bar_control = 0; |
@@ -1550,7 +1538,7 @@ void ieee80211_send_bar(struct net_device *dev, u8 *ra, u16 tid, u16 ssn) | |||
1550 | skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); | 1538 | skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); |
1551 | if (!skb) { | 1539 | if (!skb) { |
1552 | printk(KERN_ERR "%s: failed to allocate buffer for " | 1540 | printk(KERN_ERR "%s: failed to allocate buffer for " |
1553 | "bar frame\n", dev->name); | 1541 | "bar frame\n", sdata->dev->name); |
1554 | return; | 1542 | return; |
1555 | } | 1543 | } |
1556 | skb_reserve(skb, local->hw.extra_tx_headroom); | 1544 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -1559,20 +1547,20 @@ void ieee80211_send_bar(struct net_device *dev, u8 *ra, u16 tid, u16 ssn) | |||
1559 | bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | | 1547 | bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | |
1560 | IEEE80211_STYPE_BACK_REQ); | 1548 | IEEE80211_STYPE_BACK_REQ); |
1561 | memcpy(bar->ra, ra, ETH_ALEN); | 1549 | memcpy(bar->ra, ra, ETH_ALEN); |
1562 | memcpy(bar->ta, dev->dev_addr, ETH_ALEN); | 1550 | memcpy(bar->ta, sdata->dev->dev_addr, ETH_ALEN); |
1563 | bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL; | 1551 | bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL; |
1564 | bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA; | 1552 | bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA; |
1565 | bar_control |= (u16)(tid << 12); | 1553 | bar_control |= (u16)(tid << 12); |
1566 | bar->control = cpu_to_le16(bar_control); | 1554 | bar->control = cpu_to_le16(bar_control); |
1567 | bar->start_seq_num = cpu_to_le16(ssn); | 1555 | bar->start_seq_num = cpu_to_le16(ssn); |
1568 | 1556 | ||
1569 | ieee80211_sta_tx(dev, skb, 0); | 1557 | ieee80211_sta_tx(sdata, skb, 0); |
1570 | } | 1558 | } |
1571 | 1559 | ||
1572 | void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid, | 1560 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, |
1573 | u16 initiator, u16 reason) | 1561 | u16 initiator, u16 reason) |
1574 | { | 1562 | { |
1575 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1563 | struct ieee80211_local *local = sdata->local; |
1576 | struct ieee80211_hw *hw = &local->hw; | 1564 | struct ieee80211_hw *hw = &local->hw; |
1577 | struct sta_info *sta; | 1565 | struct sta_info *sta; |
1578 | int ret, i; | 1566 | int ret, i; |
@@ -1620,7 +1608,7 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid, | |||
1620 | 1608 | ||
1621 | /* check if this is a self generated aggregation halt */ | 1609 | /* check if this is a self generated aggregation halt */ |
1622 | if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER) | 1610 | if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER) |
1623 | ieee80211_send_delba(dev, ra, tid, 0, reason); | 1611 | ieee80211_send_delba(sdata, ra, tid, 0, reason); |
1624 | 1612 | ||
1625 | /* free the reordering buffer */ | 1613 | /* free the reordering buffer */ |
1626 | for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) { | 1614 | for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) { |
@@ -1641,10 +1629,10 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *ra, u16 tid, | |||
1641 | } | 1629 | } |
1642 | 1630 | ||
1643 | 1631 | ||
1644 | static void ieee80211_sta_process_delba(struct net_device *dev, | 1632 | static void ieee80211_sta_process_delba(struct ieee80211_sub_if_data *sdata, |
1645 | struct ieee80211_mgmt *mgmt, size_t len) | 1633 | struct ieee80211_mgmt *mgmt, size_t len) |
1646 | { | 1634 | { |
1647 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1635 | struct ieee80211_local *local = sdata->local; |
1648 | struct sta_info *sta; | 1636 | struct sta_info *sta; |
1649 | u16 tid, params; | 1637 | u16 tid, params; |
1650 | u16 initiator; | 1638 | u16 initiator; |
@@ -1671,7 +1659,7 @@ static void ieee80211_sta_process_delba(struct net_device *dev, | |||
1671 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 1659 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
1672 | 1660 | ||
1673 | if (initiator == WLAN_BACK_INITIATOR) | 1661 | if (initiator == WLAN_BACK_INITIATOR) |
1674 | ieee80211_sta_stop_rx_ba_session(dev, sta->addr, tid, | 1662 | ieee80211_sta_stop_rx_ba_session(sdata, sta->addr, tid, |
1675 | WLAN_BACK_INITIATOR, 0); | 1663 | WLAN_BACK_INITIATOR, 0); |
1676 | else { /* WLAN_BACK_RECIPIENT */ | 1664 | else { /* WLAN_BACK_RECIPIENT */ |
1677 | spin_lock_bh(&sta->lock); | 1665 | spin_lock_bh(&sta->lock); |
@@ -1758,31 +1746,31 @@ static void sta_rx_agg_session_timer_expired(unsigned long data) | |||
1758 | #ifdef CONFIG_MAC80211_HT_DEBUG | 1746 | #ifdef CONFIG_MAC80211_HT_DEBUG |
1759 | printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); | 1747 | printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); |
1760 | #endif | 1748 | #endif |
1761 | ieee80211_sta_stop_rx_ba_session(sta->sdata->dev, sta->addr, | 1749 | ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->addr, |
1762 | (u16)*ptid, WLAN_BACK_TIMER, | 1750 | (u16)*ptid, WLAN_BACK_TIMER, |
1763 | WLAN_REASON_QSTA_TIMEOUT); | 1751 | WLAN_REASON_QSTA_TIMEOUT); |
1764 | } | 1752 | } |
1765 | 1753 | ||
1766 | void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr) | 1754 | void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr) |
1767 | { | 1755 | { |
1768 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1756 | struct ieee80211_local *local = sdata->local; |
1769 | int i; | 1757 | int i; |
1770 | 1758 | ||
1771 | for (i = 0; i < STA_TID_NUM; i++) { | 1759 | for (i = 0; i < STA_TID_NUM; i++) { |
1772 | ieee80211_stop_tx_ba_session(&local->hw, addr, i, | 1760 | ieee80211_stop_tx_ba_session(&local->hw, addr, i, |
1773 | WLAN_BACK_INITIATOR); | 1761 | WLAN_BACK_INITIATOR); |
1774 | ieee80211_sta_stop_rx_ba_session(dev, addr, i, | 1762 | ieee80211_sta_stop_rx_ba_session(sdata, addr, i, |
1775 | WLAN_BACK_RECIPIENT, | 1763 | WLAN_BACK_RECIPIENT, |
1776 | WLAN_REASON_QSTA_LEAVE_QBSS); | 1764 | WLAN_REASON_QSTA_LEAVE_QBSS); |
1777 | } | 1765 | } |
1778 | } | 1766 | } |
1779 | 1767 | ||
1780 | static void ieee80211_send_refuse_measurement_request(struct net_device *dev, | 1768 | static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_data *sdata, |
1781 | struct ieee80211_msrment_ie *request_ie, | 1769 | struct ieee80211_msrment_ie *request_ie, |
1782 | const u8 *da, const u8 *bssid, | 1770 | const u8 *da, const u8 *bssid, |
1783 | u8 dialog_token) | 1771 | u8 dialog_token) |
1784 | { | 1772 | { |
1785 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1773 | struct ieee80211_local *local = sdata->local; |
1786 | struct sk_buff *skb; | 1774 | struct sk_buff *skb; |
1787 | struct ieee80211_mgmt *msr_report; | 1775 | struct ieee80211_mgmt *msr_report; |
1788 | 1776 | ||
@@ -1791,7 +1779,7 @@ static void ieee80211_send_refuse_measurement_request(struct net_device *dev, | |||
1791 | 1779 | ||
1792 | if (!skb) { | 1780 | if (!skb) { |
1793 | printk(KERN_ERR "%s: failed to allocate buffer for " | 1781 | printk(KERN_ERR "%s: failed to allocate buffer for " |
1794 | "measurement report frame\n", dev->name); | 1782 | "measurement report frame\n", sdata->dev->name); |
1795 | return; | 1783 | return; |
1796 | } | 1784 | } |
1797 | 1785 | ||
@@ -1799,7 +1787,7 @@ static void ieee80211_send_refuse_measurement_request(struct net_device *dev, | |||
1799 | msr_report = (struct ieee80211_mgmt *)skb_put(skb, 24); | 1787 | msr_report = (struct ieee80211_mgmt *)skb_put(skb, 24); |
1800 | memset(msr_report, 0, 24); | 1788 | memset(msr_report, 0, 24); |
1801 | memcpy(msr_report->da, da, ETH_ALEN); | 1789 | memcpy(msr_report->da, da, ETH_ALEN); |
1802 | memcpy(msr_report->sa, dev->dev_addr, ETH_ALEN); | 1790 | memcpy(msr_report->sa, sdata->dev->dev_addr, ETH_ALEN); |
1803 | memcpy(msr_report->bssid, bssid, ETH_ALEN); | 1791 | memcpy(msr_report->bssid, bssid, ETH_ALEN); |
1804 | msr_report->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1792 | msr_report->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1805 | IEEE80211_STYPE_ACTION); | 1793 | IEEE80211_STYPE_ACTION); |
@@ -1821,10 +1809,10 @@ static void ieee80211_send_refuse_measurement_request(struct net_device *dev, | |||
1821 | IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED; | 1809 | IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED; |
1822 | msr_report->u.action.u.measurement.msr_elem.type = request_ie->type; | 1810 | msr_report->u.action.u.measurement.msr_elem.type = request_ie->type; |
1823 | 1811 | ||
1824 | ieee80211_sta_tx(dev, skb, 0); | 1812 | ieee80211_sta_tx(sdata, skb, 0); |
1825 | } | 1813 | } |
1826 | 1814 | ||
1827 | static void ieee80211_sta_process_measurement_req(struct net_device *dev, | 1815 | static void ieee80211_sta_process_measurement_req(struct ieee80211_sub_if_data *sdata, |
1828 | struct ieee80211_mgmt *mgmt, | 1816 | struct ieee80211_mgmt *mgmt, |
1829 | size_t len) | 1817 | size_t len) |
1830 | { | 1818 | { |
@@ -1835,19 +1823,18 @@ static void ieee80211_sta_process_measurement_req(struct net_device *dev, | |||
1835 | * For now just refuse | 1823 | * For now just refuse |
1836 | * TODO: Answer basic measurement as unmeasured | 1824 | * TODO: Answer basic measurement as unmeasured |
1837 | */ | 1825 | */ |
1838 | ieee80211_send_refuse_measurement_request(dev, | 1826 | ieee80211_send_refuse_measurement_request(sdata, |
1839 | &mgmt->u.action.u.measurement.msr_elem, | 1827 | &mgmt->u.action.u.measurement.msr_elem, |
1840 | mgmt->sa, mgmt->bssid, | 1828 | mgmt->sa, mgmt->bssid, |
1841 | mgmt->u.action.u.measurement.dialog_token); | 1829 | mgmt->u.action.u.measurement.dialog_token); |
1842 | } | 1830 | } |
1843 | 1831 | ||
1844 | 1832 | ||
1845 | static void ieee80211_rx_mgmt_auth(struct net_device *dev, | 1833 | static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, |
1846 | struct ieee80211_if_sta *ifsta, | 1834 | struct ieee80211_if_sta *ifsta, |
1847 | struct ieee80211_mgmt *mgmt, | 1835 | struct ieee80211_mgmt *mgmt, |
1848 | size_t len) | 1836 | size_t len) |
1849 | { | 1837 | { |
1850 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1851 | u16 auth_alg, auth_transaction, status_code; | 1838 | u16 auth_alg, auth_transaction, status_code; |
1852 | DECLARE_MAC_BUF(mac); | 1839 | DECLARE_MAC_BUF(mac); |
1853 | 1840 | ||
@@ -1879,7 +1866,7 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1879 | */ | 1866 | */ |
1880 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) | 1867 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) |
1881 | return; | 1868 | return; |
1882 | ieee80211_send_auth(dev, ifsta, 2, NULL, 0, 0); | 1869 | ieee80211_send_auth(sdata, ifsta, 2, NULL, 0, 0); |
1883 | } | 1870 | } |
1884 | 1871 | ||
1885 | if (auth_alg != ifsta->auth_alg || | 1872 | if (auth_alg != ifsta->auth_alg || |
@@ -1912,7 +1899,7 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1912 | algs[pos] == 0xff) | 1899 | algs[pos] == 0xff) |
1913 | continue; | 1900 | continue; |
1914 | if (algs[pos] == WLAN_AUTH_SHARED_KEY && | 1901 | if (algs[pos] == WLAN_AUTH_SHARED_KEY && |
1915 | !ieee80211_sta_wep_configured(dev)) | 1902 | !ieee80211_sta_wep_configured(sdata)) |
1916 | continue; | 1903 | continue; |
1917 | ifsta->auth_alg = algs[pos]; | 1904 | ifsta->auth_alg = algs[pos]; |
1918 | break; | 1905 | break; |
@@ -1924,19 +1911,19 @@ static void ieee80211_rx_mgmt_auth(struct net_device *dev, | |||
1924 | switch (ifsta->auth_alg) { | 1911 | switch (ifsta->auth_alg) { |
1925 | case WLAN_AUTH_OPEN: | 1912 | case WLAN_AUTH_OPEN: |
1926 | case WLAN_AUTH_LEAP: | 1913 | case WLAN_AUTH_LEAP: |
1927 | ieee80211_auth_completed(dev, ifsta); | 1914 | ieee80211_auth_completed(sdata, ifsta); |
1928 | break; | 1915 | break; |
1929 | case WLAN_AUTH_SHARED_KEY: | 1916 | case WLAN_AUTH_SHARED_KEY: |
1930 | if (ifsta->auth_transaction == 4) | 1917 | if (ifsta->auth_transaction == 4) |
1931 | ieee80211_auth_completed(dev, ifsta); | 1918 | ieee80211_auth_completed(sdata, ifsta); |
1932 | else | 1919 | else |
1933 | ieee80211_auth_challenge(dev, ifsta, mgmt, len); | 1920 | ieee80211_auth_challenge(sdata, ifsta, mgmt, len); |
1934 | break; | 1921 | break; |
1935 | } | 1922 | } |
1936 | } | 1923 | } |
1937 | 1924 | ||
1938 | 1925 | ||
1939 | static void ieee80211_rx_mgmt_deauth(struct net_device *dev, | 1926 | static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, |
1940 | struct ieee80211_if_sta *ifsta, | 1927 | struct ieee80211_if_sta *ifsta, |
1941 | struct ieee80211_mgmt *mgmt, | 1928 | struct ieee80211_mgmt *mgmt, |
1942 | size_t len) | 1929 | size_t len) |
@@ -1953,7 +1940,7 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev, | |||
1953 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); | 1940 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); |
1954 | 1941 | ||
1955 | if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) | 1942 | if (ifsta->flags & IEEE80211_STA_AUTHENTICATED) |
1956 | printk(KERN_DEBUG "%s: deauthenticated\n", dev->name); | 1943 | printk(KERN_DEBUG "%s: deauthenticated\n", sdata->dev->name); |
1957 | 1944 | ||
1958 | if (ifsta->state == IEEE80211_AUTHENTICATE || | 1945 | if (ifsta->state == IEEE80211_AUTHENTICATE || |
1959 | ifsta->state == IEEE80211_ASSOCIATE || | 1946 | ifsta->state == IEEE80211_ASSOCIATE || |
@@ -1963,12 +1950,12 @@ static void ieee80211_rx_mgmt_deauth(struct net_device *dev, | |||
1963 | IEEE80211_RETRY_AUTH_INTERVAL); | 1950 | IEEE80211_RETRY_AUTH_INTERVAL); |
1964 | } | 1951 | } |
1965 | 1952 | ||
1966 | ieee80211_set_disassoc(dev, ifsta, 1); | 1953 | ieee80211_set_disassoc(sdata, ifsta, 1); |
1967 | ifsta->flags &= ~IEEE80211_STA_AUTHENTICATED; | 1954 | ifsta->flags &= ~IEEE80211_STA_AUTHENTICATED; |
1968 | } | 1955 | } |
1969 | 1956 | ||
1970 | 1957 | ||
1971 | static void ieee80211_rx_mgmt_disassoc(struct net_device *dev, | 1958 | static void ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, |
1972 | struct ieee80211_if_sta *ifsta, | 1959 | struct ieee80211_if_sta *ifsta, |
1973 | struct ieee80211_mgmt *mgmt, | 1960 | struct ieee80211_mgmt *mgmt, |
1974 | size_t len) | 1961 | size_t len) |
@@ -1985,7 +1972,7 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev, | |||
1985 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); | 1972 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); |
1986 | 1973 | ||
1987 | if (ifsta->flags & IEEE80211_STA_ASSOCIATED) | 1974 | if (ifsta->flags & IEEE80211_STA_ASSOCIATED) |
1988 | printk(KERN_DEBUG "%s: disassociated\n", dev->name); | 1975 | printk(KERN_DEBUG "%s: disassociated\n", sdata->dev->name); |
1989 | 1976 | ||
1990 | if (ifsta->state == IEEE80211_ASSOCIATED) { | 1977 | if (ifsta->state == IEEE80211_ASSOCIATED) { |
1991 | ifsta->state = IEEE80211_ASSOCIATE; | 1978 | ifsta->state = IEEE80211_ASSOCIATE; |
@@ -1993,7 +1980,7 @@ static void ieee80211_rx_mgmt_disassoc(struct net_device *dev, | |||
1993 | IEEE80211_RETRY_AUTH_INTERVAL); | 1980 | IEEE80211_RETRY_AUTH_INTERVAL); |
1994 | } | 1981 | } |
1995 | 1982 | ||
1996 | ieee80211_set_disassoc(dev, ifsta, 0); | 1983 | ieee80211_set_disassoc(sdata, ifsta, 0); |
1997 | } | 1984 | } |
1998 | 1985 | ||
1999 | 1986 | ||
@@ -2004,7 +1991,6 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2004 | int reassoc) | 1991 | int reassoc) |
2005 | { | 1992 | { |
2006 | struct ieee80211_local *local = sdata->local; | 1993 | struct ieee80211_local *local = sdata->local; |
2007 | struct net_device *dev = sdata->dev; | ||
2008 | struct ieee80211_supported_band *sband; | 1994 | struct ieee80211_supported_band *sband; |
2009 | struct sta_info *sta; | 1995 | struct sta_info *sta; |
2010 | u64 rates, basic_rates; | 1996 | u64 rates, basic_rates; |
@@ -2034,12 +2020,12 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2034 | 2020 | ||
2035 | printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x " | 2021 | printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x " |
2036 | "status=%d aid=%d)\n", | 2022 | "status=%d aid=%d)\n", |
2037 | dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa), | 2023 | sdata->dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa), |
2038 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); | 2024 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); |
2039 | 2025 | ||
2040 | if (status_code != WLAN_STATUS_SUCCESS) { | 2026 | if (status_code != WLAN_STATUS_SUCCESS) { |
2041 | printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", | 2027 | printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", |
2042 | dev->name, status_code); | 2028 | sdata->dev->name, status_code); |
2043 | /* if this was a reassociation, ensure we try a "full" | 2029 | /* if this was a reassociation, ensure we try a "full" |
2044 | * association next time. This works around some broken APs | 2030 | * association next time. This works around some broken APs |
2045 | * which do not correctly reject reassociation requests. */ | 2031 | * which do not correctly reject reassociation requests. */ |
@@ -2049,7 +2035,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2049 | 2035 | ||
2050 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) | 2036 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) |
2051 | printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not " | 2037 | printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not " |
2052 | "set\n", dev->name, aid); | 2038 | "set\n", sdata->dev->name, aid); |
2053 | aid &= ~(BIT(15) | BIT(14)); | 2039 | aid &= ~(BIT(15) | BIT(14)); |
2054 | 2040 | ||
2055 | pos = mgmt->u.assoc_resp.variable; | 2041 | pos = mgmt->u.assoc_resp.variable; |
@@ -2057,11 +2043,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2057 | 2043 | ||
2058 | if (!elems.supp_rates) { | 2044 | if (!elems.supp_rates) { |
2059 | printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n", | 2045 | printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n", |
2060 | dev->name); | 2046 | sdata->dev->name); |
2061 | return; | 2047 | return; |
2062 | } | 2048 | } |
2063 | 2049 | ||
2064 | printk(KERN_DEBUG "%s: associated\n", dev->name); | 2050 | printk(KERN_DEBUG "%s: associated\n", sdata->dev->name); |
2065 | ifsta->aid = aid; | 2051 | ifsta->aid = aid; |
2066 | ifsta->ap_capab = capab_info; | 2052 | ifsta->ap_capab = capab_info; |
2067 | 2053 | ||
@@ -2082,11 +2068,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2082 | sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC); | 2068 | sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC); |
2083 | if (!sta) { | 2069 | if (!sta) { |
2084 | printk(KERN_DEBUG "%s: failed to alloc STA entry for" | 2070 | printk(KERN_DEBUG "%s: failed to alloc STA entry for" |
2085 | " the AP\n", dev->name); | 2071 | " the AP\n", sdata->dev->name); |
2086 | rcu_read_unlock(); | 2072 | rcu_read_unlock(); |
2087 | return; | 2073 | return; |
2088 | } | 2074 | } |
2089 | bss = ieee80211_rx_bss_get(dev, ifsta->bssid, | 2075 | bss = ieee80211_rx_bss_get(local, ifsta->bssid, |
2090 | local->hw.conf.channel->center_freq, | 2076 | local->hw.conf.channel->center_freq, |
2091 | ifsta->ssid, ifsta->ssid_len); | 2077 | ifsta->ssid, ifsta->ssid_len); |
2092 | if (bss) { | 2078 | if (bss) { |
@@ -2099,7 +2085,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2099 | err = sta_info_insert(sta); | 2085 | err = sta_info_insert(sta); |
2100 | if (err) { | 2086 | if (err) { |
2101 | printk(KERN_DEBUG "%s: failed to insert STA entry for" | 2087 | printk(KERN_DEBUG "%s: failed to insert STA entry for" |
2102 | " the AP (error %d)\n", dev->name, err); | 2088 | " the AP (error %d)\n", sdata->dev->name, err); |
2103 | rcu_read_unlock(); | 2089 | rcu_read_unlock(); |
2104 | return; | 2090 | return; |
2105 | } | 2091 | } |
@@ -2179,7 +2165,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2179 | if (elems.wmm_param) { | 2165 | if (elems.wmm_param) { |
2180 | set_sta_flags(sta, WLAN_STA_WME); | 2166 | set_sta_flags(sta, WLAN_STA_WME); |
2181 | rcu_read_unlock(); | 2167 | rcu_read_unlock(); |
2182 | ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, | 2168 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, |
2183 | elems.wmm_param_len); | 2169 | elems.wmm_param_len); |
2184 | } else | 2170 | } else |
2185 | rcu_read_unlock(); | 2171 | rcu_read_unlock(); |
@@ -2188,17 +2174,16 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
2188 | * ieee80211_set_associated() will tell the driver */ | 2174 | * ieee80211_set_associated() will tell the driver */ |
2189 | bss_conf->aid = aid; | 2175 | bss_conf->aid = aid; |
2190 | bss_conf->assoc_capability = capab_info; | 2176 | bss_conf->assoc_capability = capab_info; |
2191 | ieee80211_set_associated(dev, ifsta, 1); | 2177 | ieee80211_set_associated(sdata, ifsta, 1); |
2192 | 2178 | ||
2193 | ieee80211_associated(dev, ifsta); | 2179 | ieee80211_associated(sdata, ifsta); |
2194 | } | 2180 | } |
2195 | 2181 | ||
2196 | 2182 | ||
2197 | /* Caller must hold local->sta_bss_lock */ | 2183 | /* Caller must hold local->sta_bss_lock */ |
2198 | static void __ieee80211_rx_bss_hash_add(struct net_device *dev, | 2184 | static void __ieee80211_rx_bss_hash_add(struct ieee80211_local *local, |
2199 | struct ieee80211_sta_bss *bss) | 2185 | struct ieee80211_sta_bss *bss) |
2200 | { | 2186 | { |
2201 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
2202 | u8 hash_idx; | 2187 | u8 hash_idx; |
2203 | 2188 | ||
2204 | if (bss_mesh_cfg(bss)) | 2189 | if (bss_mesh_cfg(bss)) |
@@ -2234,10 +2219,10 @@ static void __ieee80211_rx_bss_hash_del(struct ieee80211_local *local, | |||
2234 | 2219 | ||
2235 | 2220 | ||
2236 | static struct ieee80211_sta_bss * | 2221 | static struct ieee80211_sta_bss * |
2237 | ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid, int freq, | 2222 | ieee80211_rx_bss_add(struct ieee80211_sub_if_data *sdata, u8 *bssid, int freq, |
2238 | u8 *ssid, u8 ssid_len) | 2223 | u8 *ssid, u8 ssid_len) |
2239 | { | 2224 | { |
2240 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2225 | struct ieee80211_local *local = sdata->local; |
2241 | struct ieee80211_sta_bss *bss; | 2226 | struct ieee80211_sta_bss *bss; |
2242 | 2227 | ||
2243 | bss = kzalloc(sizeof(*bss), GFP_ATOMIC); | 2228 | bss = kzalloc(sizeof(*bss), GFP_ATOMIC); |
@@ -2255,16 +2240,15 @@ ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid, int freq, | |||
2255 | spin_lock_bh(&local->sta_bss_lock); | 2240 | spin_lock_bh(&local->sta_bss_lock); |
2256 | /* TODO: order by RSSI? */ | 2241 | /* TODO: order by RSSI? */ |
2257 | list_add_tail(&bss->list, &local->sta_bss_list); | 2242 | list_add_tail(&bss->list, &local->sta_bss_list); |
2258 | __ieee80211_rx_bss_hash_add(dev, bss); | 2243 | __ieee80211_rx_bss_hash_add(local, bss); |
2259 | spin_unlock_bh(&local->sta_bss_lock); | 2244 | spin_unlock_bh(&local->sta_bss_lock); |
2260 | return bss; | 2245 | return bss; |
2261 | } | 2246 | } |
2262 | 2247 | ||
2263 | static struct ieee80211_sta_bss * | 2248 | static struct ieee80211_sta_bss * |
2264 | ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int freq, | 2249 | ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, |
2265 | u8 *ssid, u8 ssid_len) | 2250 | u8 *ssid, u8 ssid_len) |
2266 | { | 2251 | { |
2267 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
2268 | struct ieee80211_sta_bss *bss; | 2252 | struct ieee80211_sta_bss *bss; |
2269 | 2253 | ||
2270 | spin_lock_bh(&local->sta_bss_lock); | 2254 | spin_lock_bh(&local->sta_bss_lock); |
@@ -2286,10 +2270,9 @@ ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int freq, | |||
2286 | 2270 | ||
2287 | #ifdef CONFIG_MAC80211_MESH | 2271 | #ifdef CONFIG_MAC80211_MESH |
2288 | static struct ieee80211_sta_bss * | 2272 | static struct ieee80211_sta_bss * |
2289 | ieee80211_rx_mesh_bss_get(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | 2273 | ieee80211_rx_mesh_bss_get(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, |
2290 | u8 *mesh_cfg, int freq) | 2274 | u8 *mesh_cfg, int freq) |
2291 | { | 2275 | { |
2292 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
2293 | struct ieee80211_sta_bss *bss; | 2276 | struct ieee80211_sta_bss *bss; |
2294 | 2277 | ||
2295 | spin_lock_bh(&local->sta_bss_lock); | 2278 | spin_lock_bh(&local->sta_bss_lock); |
@@ -2311,10 +2294,9 @@ ieee80211_rx_mesh_bss_get(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | |||
2311 | } | 2294 | } |
2312 | 2295 | ||
2313 | static struct ieee80211_sta_bss * | 2296 | static struct ieee80211_sta_bss * |
2314 | ieee80211_rx_mesh_bss_add(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | 2297 | ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len, |
2315 | u8 *mesh_cfg, int mesh_config_len, int freq) | 2298 | u8 *mesh_cfg, int mesh_config_len, int freq) |
2316 | { | 2299 | { |
2317 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
2318 | struct ieee80211_sta_bss *bss; | 2300 | struct ieee80211_sta_bss *bss; |
2319 | 2301 | ||
2320 | if (mesh_config_len != MESH_CFG_LEN) | 2302 | if (mesh_config_len != MESH_CFG_LEN) |
@@ -2348,7 +2330,7 @@ ieee80211_rx_mesh_bss_add(struct net_device *dev, u8 *mesh_id, int mesh_id_len, | |||
2348 | spin_lock_bh(&local->sta_bss_lock); | 2330 | spin_lock_bh(&local->sta_bss_lock); |
2349 | /* TODO: order by RSSI? */ | 2331 | /* TODO: order by RSSI? */ |
2350 | list_add_tail(&bss->list, &local->sta_bss_list); | 2332 | list_add_tail(&bss->list, &local->sta_bss_list); |
2351 | __ieee80211_rx_bss_hash_add(dev, bss); | 2333 | __ieee80211_rx_bss_hash_add(local, bss); |
2352 | spin_unlock_bh(&local->sta_bss_lock); | 2334 | spin_unlock_bh(&local->sta_bss_lock); |
2353 | return bss; | 2335 | return bss; |
2354 | } | 2336 | } |
@@ -2399,23 +2381,20 @@ void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local) | |||
2399 | } | 2381 | } |
2400 | 2382 | ||
2401 | 2383 | ||
2402 | static int ieee80211_sta_join_ibss(struct net_device *dev, | 2384 | static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, |
2403 | struct ieee80211_if_sta *ifsta, | 2385 | struct ieee80211_if_sta *ifsta, |
2404 | struct ieee80211_sta_bss *bss) | 2386 | struct ieee80211_sta_bss *bss) |
2405 | { | 2387 | { |
2406 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2388 | struct ieee80211_local *local = sdata->local; |
2407 | int res, rates, i, j; | 2389 | int res, rates, i, j; |
2408 | struct sk_buff *skb; | 2390 | struct sk_buff *skb; |
2409 | struct ieee80211_mgmt *mgmt; | 2391 | struct ieee80211_mgmt *mgmt; |
2410 | u8 *pos; | 2392 | u8 *pos; |
2411 | struct ieee80211_sub_if_data *sdata; | ||
2412 | struct ieee80211_supported_band *sband; | 2393 | struct ieee80211_supported_band *sband; |
2413 | union iwreq_data wrqu; | 2394 | union iwreq_data wrqu; |
2414 | 2395 | ||
2415 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 2396 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
2416 | 2397 | ||
2417 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
2418 | |||
2419 | /* Remove possible STA entries from other IBSS networks. */ | 2398 | /* Remove possible STA entries from other IBSS networks. */ |
2420 | sta_info_flush_delayed(sdata); | 2399 | sta_info_flush_delayed(sdata); |
2421 | 2400 | ||
@@ -2433,7 +2412,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2433 | sdata->drop_unencrypted = bss->capability & | 2412 | sdata->drop_unencrypted = bss->capability & |
2434 | WLAN_CAPABILITY_PRIVACY ? 1 : 0; | 2413 | WLAN_CAPABILITY_PRIVACY ? 1 : 0; |
2435 | 2414 | ||
2436 | res = ieee80211_set_freq(dev, bss->freq); | 2415 | res = ieee80211_set_freq(sdata, bss->freq); |
2437 | 2416 | ||
2438 | if (res) | 2417 | if (res) |
2439 | return res; | 2418 | return res; |
@@ -2449,7 +2428,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2449 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 2428 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
2450 | IEEE80211_STYPE_PROBE_RESP); | 2429 | IEEE80211_STYPE_PROBE_RESP); |
2451 | memset(mgmt->da, 0xff, ETH_ALEN); | 2430 | memset(mgmt->da, 0xff, ETH_ALEN); |
2452 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 2431 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
2453 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); | 2432 | memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN); |
2454 | mgmt->u.beacon.beacon_int = | 2433 | mgmt->u.beacon.beacon_int = |
2455 | cpu_to_le16(local->hw.conf.beacon_int); | 2434 | cpu_to_le16(local->hw.conf.beacon_int); |
@@ -2506,14 +2485,14 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
2506 | } | 2485 | } |
2507 | ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates; | 2486 | ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates; |
2508 | 2487 | ||
2509 | ieee80211_sta_def_wmm_params(dev, bss, 1); | 2488 | ieee80211_sta_def_wmm_params(sdata, bss, 1); |
2510 | 2489 | ||
2511 | ifsta->state = IEEE80211_IBSS_JOINED; | 2490 | ifsta->state = IEEE80211_IBSS_JOINED; |
2512 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); | 2491 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); |
2513 | 2492 | ||
2514 | memset(&wrqu, 0, sizeof(wrqu)); | 2493 | memset(&wrqu, 0, sizeof(wrqu)); |
2515 | memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN); | 2494 | memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN); |
2516 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | 2495 | wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL); |
2517 | 2496 | ||
2518 | return res; | 2497 | return res; |
2519 | } | 2498 | } |
@@ -2555,35 +2534,34 @@ u64 ieee80211_sta_get_rates(struct ieee80211_local *local, | |||
2555 | } | 2534 | } |
2556 | 2535 | ||
2557 | 2536 | ||
2558 | static void ieee80211_rx_bss_info(struct net_device *dev, | 2537 | static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, |
2559 | struct ieee80211_mgmt *mgmt, | 2538 | struct ieee80211_mgmt *mgmt, |
2560 | size_t len, | 2539 | size_t len, |
2561 | struct ieee80211_rx_status *rx_status, | 2540 | struct ieee80211_rx_status *rx_status, |
2562 | struct ieee802_11_elems *elems, | 2541 | struct ieee802_11_elems *elems, |
2563 | int beacon) | 2542 | int beacon) |
2564 | { | 2543 | { |
2565 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2544 | struct ieee80211_local *local = sdata->local; |
2566 | int freq, clen; | 2545 | int freq, clen; |
2567 | struct ieee80211_sta_bss *bss; | 2546 | struct ieee80211_sta_bss *bss; |
2568 | struct sta_info *sta; | 2547 | struct sta_info *sta; |
2569 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
2570 | u64 beacon_timestamp, rx_timestamp; | 2548 | u64 beacon_timestamp, rx_timestamp; |
2571 | struct ieee80211_channel *channel; | 2549 | struct ieee80211_channel *channel; |
2572 | DECLARE_MAC_BUF(mac); | 2550 | DECLARE_MAC_BUF(mac); |
2573 | DECLARE_MAC_BUF(mac2); | 2551 | DECLARE_MAC_BUF(mac2); |
2574 | 2552 | ||
2575 | if (!beacon && memcmp(mgmt->da, dev->dev_addr, ETH_ALEN)) | 2553 | if (!beacon && memcmp(mgmt->da, sdata->dev->dev_addr, ETH_ALEN)) |
2576 | return; /* ignore ProbeResp to foreign address */ | 2554 | return; /* ignore ProbeResp to foreign address */ |
2577 | 2555 | ||
2578 | beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); | 2556 | beacon_timestamp = le64_to_cpu(mgmt->u.beacon.timestamp); |
2579 | 2557 | ||
2580 | if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id && | 2558 | if (ieee80211_vif_is_mesh(&sdata->vif) && elems->mesh_id && |
2581 | elems->mesh_config && mesh_matches_local(elems, dev)) { | 2559 | elems->mesh_config && mesh_matches_local(elems, sdata)) { |
2582 | u64 rates = ieee80211_sta_get_rates(local, elems, | 2560 | u64 rates = ieee80211_sta_get_rates(local, elems, |
2583 | rx_status->band); | 2561 | rx_status->band); |
2584 | 2562 | ||
2585 | mesh_neighbour_update(mgmt->sa, rates, dev, | 2563 | mesh_neighbour_update(mgmt->sa, rates, sdata, |
2586 | mesh_peer_accepts_plinks(elems, dev)); | 2564 | mesh_peer_accepts_plinks(elems)); |
2587 | } | 2565 | } |
2588 | 2566 | ||
2589 | rcu_read_lock(); | 2567 | rcu_read_lock(); |
@@ -2620,21 +2598,21 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2620 | 2598 | ||
2621 | #ifdef CONFIG_MAC80211_MESH | 2599 | #ifdef CONFIG_MAC80211_MESH |
2622 | if (elems->mesh_config) | 2600 | if (elems->mesh_config) |
2623 | bss = ieee80211_rx_mesh_bss_get(dev, elems->mesh_id, | 2601 | bss = ieee80211_rx_mesh_bss_get(local, elems->mesh_id, |
2624 | elems->mesh_id_len, elems->mesh_config, freq); | 2602 | elems->mesh_id_len, elems->mesh_config, freq); |
2625 | else | 2603 | else |
2626 | #endif | 2604 | #endif |
2627 | bss = ieee80211_rx_bss_get(dev, mgmt->bssid, freq, | 2605 | bss = ieee80211_rx_bss_get(local, mgmt->bssid, freq, |
2628 | elems->ssid, elems->ssid_len); | 2606 | elems->ssid, elems->ssid_len); |
2629 | if (!bss) { | 2607 | if (!bss) { |
2630 | #ifdef CONFIG_MAC80211_MESH | 2608 | #ifdef CONFIG_MAC80211_MESH |
2631 | if (elems->mesh_config) | 2609 | if (elems->mesh_config) |
2632 | bss = ieee80211_rx_mesh_bss_add(dev, elems->mesh_id, | 2610 | bss = ieee80211_rx_mesh_bss_add(local, elems->mesh_id, |
2633 | elems->mesh_id_len, elems->mesh_config, | 2611 | elems->mesh_id_len, elems->mesh_config, |
2634 | elems->mesh_config_len, freq); | 2612 | elems->mesh_config_len, freq); |
2635 | else | 2613 | else |
2636 | #endif | 2614 | #endif |
2637 | bss = ieee80211_rx_bss_add(dev, mgmt->bssid, freq, | 2615 | bss = ieee80211_rx_bss_add(sdata, mgmt->bssid, freq, |
2638 | elems->ssid, elems->ssid_len); | 2616 | elems->ssid, elems->ssid_len); |
2639 | if (!bss) | 2617 | if (!bss) |
2640 | return; | 2618 | return; |
@@ -2871,10 +2849,10 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2871 | #ifndef CONFIG_MAC80211_IBSS_DEBUG | 2849 | #ifndef CONFIG_MAC80211_IBSS_DEBUG |
2872 | printk(KERN_DEBUG "%s: beacon TSF higher than " | 2850 | printk(KERN_DEBUG "%s: beacon TSF higher than " |
2873 | "local TSF - IBSS merge with BSSID %s\n", | 2851 | "local TSF - IBSS merge with BSSID %s\n", |
2874 | dev->name, print_mac(mac, mgmt->bssid)); | 2852 | sdata->dev->name, print_mac(mac, mgmt->bssid)); |
2875 | #endif | 2853 | #endif |
2876 | ieee80211_sta_join_ibss(dev, &sdata->u.sta, bss); | 2854 | ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss); |
2877 | ieee80211_ibss_add_sta(dev, NULL, | 2855 | ieee80211_ibss_add_sta(sdata, NULL, |
2878 | mgmt->bssid, mgmt->sa, | 2856 | mgmt->bssid, mgmt->sa, |
2879 | BIT(rx_status->rate_idx)); | 2857 | BIT(rx_status->rate_idx)); |
2880 | } | 2858 | } |
@@ -2884,7 +2862,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev, | |||
2884 | } | 2862 | } |
2885 | 2863 | ||
2886 | 2864 | ||
2887 | static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev, | 2865 | static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, |
2888 | struct ieee80211_mgmt *mgmt, | 2866 | struct ieee80211_mgmt *mgmt, |
2889 | size_t len, | 2867 | size_t len, |
2890 | struct ieee80211_rx_status *rx_status) | 2868 | struct ieee80211_rx_status *rx_status) |
@@ -2899,20 +2877,19 @@ static void ieee80211_rx_mgmt_probe_resp(struct net_device *dev, | |||
2899 | ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, | 2877 | ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, |
2900 | &elems); | 2878 | &elems); |
2901 | 2879 | ||
2902 | ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems, 0); | 2880 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, 0); |
2903 | } | 2881 | } |
2904 | 2882 | ||
2905 | 2883 | ||
2906 | static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | 2884 | static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, |
2907 | struct ieee80211_mgmt *mgmt, | 2885 | struct ieee80211_mgmt *mgmt, |
2908 | size_t len, | 2886 | size_t len, |
2909 | struct ieee80211_rx_status *rx_status) | 2887 | struct ieee80211_rx_status *rx_status) |
2910 | { | 2888 | { |
2911 | struct ieee80211_sub_if_data *sdata; | ||
2912 | struct ieee80211_if_sta *ifsta; | 2889 | struct ieee80211_if_sta *ifsta; |
2913 | size_t baselen; | 2890 | size_t baselen; |
2914 | struct ieee802_11_elems elems; | 2891 | struct ieee802_11_elems elems; |
2915 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2892 | struct ieee80211_local *local = sdata->local; |
2916 | struct ieee80211_conf *conf = &local->hw.conf; | 2893 | struct ieee80211_conf *conf = &local->hw.conf; |
2917 | u32 changed = 0; | 2894 | u32 changed = 0; |
2918 | 2895 | ||
@@ -2923,9 +2900,8 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
2923 | 2900 | ||
2924 | ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); | 2901 | ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); |
2925 | 2902 | ||
2926 | ieee80211_rx_bss_info(dev, mgmt, len, rx_status, &elems, 1); | 2903 | ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, 1); |
2927 | 2904 | ||
2928 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
2929 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 2905 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
2930 | return; | 2906 | return; |
2931 | ifsta = &sdata->u.sta; | 2907 | ifsta = &sdata->u.sta; |
@@ -2934,7 +2910,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
2934 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) | 2910 | memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0) |
2935 | return; | 2911 | return; |
2936 | 2912 | ||
2937 | ieee80211_sta_wmm_params(dev, ifsta, elems.wmm_param, | 2913 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, |
2938 | elems.wmm_param_len); | 2914 | elems.wmm_param_len); |
2939 | 2915 | ||
2940 | /* Do not send changes to driver if we are scanning. This removes | 2916 | /* Do not send changes to driver if we are scanning. This removes |
@@ -2966,14 +2942,13 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev, | |||
2966 | } | 2942 | } |
2967 | 2943 | ||
2968 | 2944 | ||
2969 | static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | 2945 | static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, |
2970 | struct ieee80211_if_sta *ifsta, | 2946 | struct ieee80211_if_sta *ifsta, |
2971 | struct ieee80211_mgmt *mgmt, | 2947 | struct ieee80211_mgmt *mgmt, |
2972 | size_t len, | 2948 | size_t len, |
2973 | struct ieee80211_rx_status *rx_status) | 2949 | struct ieee80211_rx_status *rx_status) |
2974 | { | 2950 | { |
2975 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2951 | struct ieee80211_local *local = sdata->local; |
2976 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
2977 | int tx_last_beacon; | 2952 | int tx_last_beacon; |
2978 | struct sk_buff *skb; | 2953 | struct sk_buff *skb; |
2979 | struct ieee80211_mgmt *resp; | 2954 | struct ieee80211_mgmt *resp; |
@@ -2997,7 +2972,7 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
2997 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2972 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
2998 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%s DA=%s BSSID=" | 2973 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%s DA=%s BSSID=" |
2999 | "%s (tx_last_beacon=%d)\n", | 2974 | "%s (tx_last_beacon=%d)\n", |
3000 | dev->name, print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da), | 2975 | sdata->dev->name, print_mac(mac, mgmt->sa), print_mac(mac2, mgmt->da), |
3001 | print_mac(mac3, mgmt->bssid), tx_last_beacon); | 2976 | print_mac(mac3, mgmt->bssid), tx_last_beacon); |
3002 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 2977 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
3003 | 2978 | ||
@@ -3015,7 +2990,7 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
3015 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 2990 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3016 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " | 2991 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " |
3017 | "from %s\n", | 2992 | "from %s\n", |
3018 | dev->name, print_mac(mac, mgmt->sa)); | 2993 | sdata->dev->name, print_mac(mac, mgmt->sa)); |
3019 | #endif | 2994 | #endif |
3020 | return; | 2995 | return; |
3021 | } | 2996 | } |
@@ -3035,19 +3010,18 @@ static void ieee80211_rx_mgmt_probe_req(struct net_device *dev, | |||
3035 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 3010 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
3036 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 3011 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3037 | printk(KERN_DEBUG "%s: Sending ProbeResp to %s\n", | 3012 | printk(KERN_DEBUG "%s: Sending ProbeResp to %s\n", |
3038 | dev->name, print_mac(mac, resp->da)); | 3013 | sdata->dev->name, print_mac(mac, resp->da)); |
3039 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 3014 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
3040 | ieee80211_sta_tx(dev, skb, 0); | 3015 | ieee80211_sta_tx(sdata, skb, 0); |
3041 | } | 3016 | } |
3042 | 3017 | ||
3043 | static void ieee80211_rx_mgmt_action(struct net_device *dev, | 3018 | static void ieee80211_rx_mgmt_action(struct ieee80211_sub_if_data *sdata, |
3044 | struct ieee80211_if_sta *ifsta, | 3019 | struct ieee80211_if_sta *ifsta, |
3045 | struct ieee80211_mgmt *mgmt, | 3020 | struct ieee80211_mgmt *mgmt, |
3046 | size_t len, | 3021 | size_t len, |
3047 | struct ieee80211_rx_status *rx_status) | 3022 | struct ieee80211_rx_status *rx_status) |
3048 | { | 3023 | { |
3049 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 3024 | struct ieee80211_local *local = sdata->local; |
3050 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
3051 | 3025 | ||
3052 | if (len < IEEE80211_MIN_ACTION_SIZE) | 3026 | if (len < IEEE80211_MIN_ACTION_SIZE) |
3053 | return; | 3027 | return; |
@@ -3061,7 +3035,7 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev, | |||
3061 | if (len < (IEEE80211_MIN_ACTION_SIZE + | 3035 | if (len < (IEEE80211_MIN_ACTION_SIZE + |
3062 | sizeof(mgmt->u.action.u.measurement))) | 3036 | sizeof(mgmt->u.action.u.measurement))) |
3063 | break; | 3037 | break; |
3064 | ieee80211_sta_process_measurement_req(dev, mgmt, len); | 3038 | ieee80211_sta_process_measurement_req(sdata, mgmt, len); |
3065 | break; | 3039 | break; |
3066 | } | 3040 | } |
3067 | break; | 3041 | break; |
@@ -3071,38 +3045,37 @@ static void ieee80211_rx_mgmt_action(struct net_device *dev, | |||
3071 | if (len < (IEEE80211_MIN_ACTION_SIZE + | 3045 | if (len < (IEEE80211_MIN_ACTION_SIZE + |
3072 | sizeof(mgmt->u.action.u.addba_req))) | 3046 | sizeof(mgmt->u.action.u.addba_req))) |
3073 | break; | 3047 | break; |
3074 | ieee80211_sta_process_addba_request(dev, mgmt, len); | 3048 | ieee80211_sta_process_addba_request(local, mgmt, len); |
3075 | break; | 3049 | break; |
3076 | case WLAN_ACTION_ADDBA_RESP: | 3050 | case WLAN_ACTION_ADDBA_RESP: |
3077 | if (len < (IEEE80211_MIN_ACTION_SIZE + | 3051 | if (len < (IEEE80211_MIN_ACTION_SIZE + |
3078 | sizeof(mgmt->u.action.u.addba_resp))) | 3052 | sizeof(mgmt->u.action.u.addba_resp))) |
3079 | break; | 3053 | break; |
3080 | ieee80211_sta_process_addba_resp(dev, mgmt, len); | 3054 | ieee80211_sta_process_addba_resp(local, mgmt, len); |
3081 | break; | 3055 | break; |
3082 | case WLAN_ACTION_DELBA: | 3056 | case WLAN_ACTION_DELBA: |
3083 | if (len < (IEEE80211_MIN_ACTION_SIZE + | 3057 | if (len < (IEEE80211_MIN_ACTION_SIZE + |
3084 | sizeof(mgmt->u.action.u.delba))) | 3058 | sizeof(mgmt->u.action.u.delba))) |
3085 | break; | 3059 | break; |
3086 | ieee80211_sta_process_delba(dev, mgmt, len); | 3060 | ieee80211_sta_process_delba(sdata, mgmt, len); |
3087 | break; | 3061 | break; |
3088 | } | 3062 | } |
3089 | break; | 3063 | break; |
3090 | case PLINK_CATEGORY: | 3064 | case PLINK_CATEGORY: |
3091 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 3065 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
3092 | mesh_rx_plink_frame(dev, mgmt, len, rx_status); | 3066 | mesh_rx_plink_frame(sdata, mgmt, len, rx_status); |
3093 | break; | 3067 | break; |
3094 | case MESH_PATH_SEL_CATEGORY: | 3068 | case MESH_PATH_SEL_CATEGORY: |
3095 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 3069 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
3096 | mesh_rx_path_sel_frame(dev, mgmt, len); | 3070 | mesh_rx_path_sel_frame(sdata, mgmt, len); |
3097 | break; | 3071 | break; |
3098 | } | 3072 | } |
3099 | } | 3073 | } |
3100 | 3074 | ||
3101 | void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, | 3075 | void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
3102 | struct ieee80211_rx_status *rx_status) | 3076 | struct ieee80211_rx_status *rx_status) |
3103 | { | 3077 | { |
3104 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3078 | struct ieee80211_local *local = sdata->local; |
3105 | struct ieee80211_sub_if_data *sdata; | ||
3106 | struct ieee80211_if_sta *ifsta; | 3079 | struct ieee80211_if_sta *ifsta; |
3107 | struct ieee80211_mgmt *mgmt; | 3080 | struct ieee80211_mgmt *mgmt; |
3108 | u16 fc; | 3081 | u16 fc; |
@@ -3110,7 +3083,6 @@ void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, | |||
3110 | if (skb->len < 24) | 3083 | if (skb->len < 24) |
3111 | goto fail; | 3084 | goto fail; |
3112 | 3085 | ||
3113 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3114 | ifsta = &sdata->u.sta; | 3086 | ifsta = &sdata->u.sta; |
3115 | 3087 | ||
3116 | mgmt = (struct ieee80211_mgmt *) skb->data; | 3088 | mgmt = (struct ieee80211_mgmt *) skb->data; |
@@ -3137,16 +3109,14 @@ void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, | |||
3137 | } | 3109 | } |
3138 | 3110 | ||
3139 | 3111 | ||
3140 | static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev, | 3112 | static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, |
3141 | struct sk_buff *skb) | 3113 | struct sk_buff *skb) |
3142 | { | 3114 | { |
3143 | struct ieee80211_rx_status *rx_status; | 3115 | struct ieee80211_rx_status *rx_status; |
3144 | struct ieee80211_sub_if_data *sdata; | ||
3145 | struct ieee80211_if_sta *ifsta; | 3116 | struct ieee80211_if_sta *ifsta; |
3146 | struct ieee80211_mgmt *mgmt; | 3117 | struct ieee80211_mgmt *mgmt; |
3147 | u16 fc; | 3118 | u16 fc; |
3148 | 3119 | ||
3149 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3150 | ifsta = &sdata->u.sta; | 3120 | ifsta = &sdata->u.sta; |
3151 | 3121 | ||
3152 | rx_status = (struct ieee80211_rx_status *) skb->cb; | 3122 | rx_status = (struct ieee80211_rx_status *) skb->cb; |
@@ -3155,17 +3125,17 @@ static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev, | |||
3155 | 3125 | ||
3156 | switch (fc & IEEE80211_FCTL_STYPE) { | 3126 | switch (fc & IEEE80211_FCTL_STYPE) { |
3157 | case IEEE80211_STYPE_PROBE_REQ: | 3127 | case IEEE80211_STYPE_PROBE_REQ: |
3158 | ieee80211_rx_mgmt_probe_req(dev, ifsta, mgmt, skb->len, | 3128 | ieee80211_rx_mgmt_probe_req(sdata, ifsta, mgmt, skb->len, |
3159 | rx_status); | 3129 | rx_status); |
3160 | break; | 3130 | break; |
3161 | case IEEE80211_STYPE_PROBE_RESP: | 3131 | case IEEE80211_STYPE_PROBE_RESP: |
3162 | ieee80211_rx_mgmt_probe_resp(dev, mgmt, skb->len, rx_status); | 3132 | ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len, rx_status); |
3163 | break; | 3133 | break; |
3164 | case IEEE80211_STYPE_BEACON: | 3134 | case IEEE80211_STYPE_BEACON: |
3165 | ieee80211_rx_mgmt_beacon(dev, mgmt, skb->len, rx_status); | 3135 | ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len, rx_status); |
3166 | break; | 3136 | break; |
3167 | case IEEE80211_STYPE_AUTH: | 3137 | case IEEE80211_STYPE_AUTH: |
3168 | ieee80211_rx_mgmt_auth(dev, ifsta, mgmt, skb->len); | 3138 | ieee80211_rx_mgmt_auth(sdata, ifsta, mgmt, skb->len); |
3169 | break; | 3139 | break; |
3170 | case IEEE80211_STYPE_ASSOC_RESP: | 3140 | case IEEE80211_STYPE_ASSOC_RESP: |
3171 | ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 0); | 3141 | ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 0); |
@@ -3174,13 +3144,13 @@ static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev, | |||
3174 | ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 1); | 3144 | ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 1); |
3175 | break; | 3145 | break; |
3176 | case IEEE80211_STYPE_DEAUTH: | 3146 | case IEEE80211_STYPE_DEAUTH: |
3177 | ieee80211_rx_mgmt_deauth(dev, ifsta, mgmt, skb->len); | 3147 | ieee80211_rx_mgmt_deauth(sdata, ifsta, mgmt, skb->len); |
3178 | break; | 3148 | break; |
3179 | case IEEE80211_STYPE_DISASSOC: | 3149 | case IEEE80211_STYPE_DISASSOC: |
3180 | ieee80211_rx_mgmt_disassoc(dev, ifsta, mgmt, skb->len); | 3150 | ieee80211_rx_mgmt_disassoc(sdata, ifsta, mgmt, skb->len); |
3181 | break; | 3151 | break; |
3182 | case IEEE80211_STYPE_ACTION: | 3152 | case IEEE80211_STYPE_ACTION: |
3183 | ieee80211_rx_mgmt_action(dev, ifsta, mgmt, skb->len, rx_status); | 3153 | ieee80211_rx_mgmt_action(sdata, ifsta, mgmt, skb->len, rx_status); |
3184 | break; | 3154 | break; |
3185 | } | 3155 | } |
3186 | 3156 | ||
@@ -3189,7 +3159,7 @@ static void ieee80211_sta_rx_queued_mgmt(struct net_device *dev, | |||
3189 | 3159 | ||
3190 | 3160 | ||
3191 | ieee80211_rx_result | 3161 | ieee80211_rx_result |
3192 | ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb, | 3162 | ieee80211_sta_rx_scan(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
3193 | struct ieee80211_rx_status *rx_status) | 3163 | struct ieee80211_rx_status *rx_status) |
3194 | { | 3164 | { |
3195 | struct ieee80211_mgmt *mgmt; | 3165 | struct ieee80211_mgmt *mgmt; |
@@ -3208,13 +3178,13 @@ ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb, | |||
3208 | return RX_DROP_MONITOR; | 3178 | return RX_DROP_MONITOR; |
3209 | 3179 | ||
3210 | if (ieee80211_is_probe_resp(fc)) { | 3180 | if (ieee80211_is_probe_resp(fc)) { |
3211 | ieee80211_rx_mgmt_probe_resp(dev, mgmt, skb->len, rx_status); | 3181 | ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len, rx_status); |
3212 | dev_kfree_skb(skb); | 3182 | dev_kfree_skb(skb); |
3213 | return RX_QUEUED; | 3183 | return RX_QUEUED; |
3214 | } | 3184 | } |
3215 | 3185 | ||
3216 | if (ieee80211_is_beacon(fc)) { | 3186 | if (ieee80211_is_beacon(fc)) { |
3217 | ieee80211_rx_mgmt_beacon(dev, mgmt, skb->len, rx_status); | 3187 | ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len, rx_status); |
3218 | dev_kfree_skb(skb); | 3188 | dev_kfree_skb(skb); |
3219 | return RX_QUEUED; | 3189 | return RX_QUEUED; |
3220 | } | 3190 | } |
@@ -3223,12 +3193,11 @@ ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb, | |||
3223 | } | 3193 | } |
3224 | 3194 | ||
3225 | 3195 | ||
3226 | static int ieee80211_sta_active_ibss(struct net_device *dev) | 3196 | static int ieee80211_sta_active_ibss(struct ieee80211_sub_if_data *sdata) |
3227 | { | 3197 | { |
3228 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3198 | struct ieee80211_local *local = sdata->local; |
3229 | int active = 0; | 3199 | int active = 0; |
3230 | struct sta_info *sta; | 3200 | struct sta_info *sta; |
3231 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3232 | 3201 | ||
3233 | rcu_read_lock(); | 3202 | rcu_read_lock(); |
3234 | 3203 | ||
@@ -3247,9 +3216,9 @@ static int ieee80211_sta_active_ibss(struct net_device *dev) | |||
3247 | } | 3216 | } |
3248 | 3217 | ||
3249 | 3218 | ||
3250 | static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time) | 3219 | static void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, unsigned long exp_time) |
3251 | { | 3220 | { |
3252 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3221 | struct ieee80211_local *local = sdata->local; |
3253 | struct sta_info *sta, *tmp; | 3222 | struct sta_info *sta, *tmp; |
3254 | LIST_HEAD(tmp_list); | 3223 | LIST_HEAD(tmp_list); |
3255 | DECLARE_MAC_BUF(mac); | 3224 | DECLARE_MAC_BUF(mac); |
@@ -3260,7 +3229,7 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time) | |||
3260 | if (time_after(jiffies, sta->last_rx + exp_time)) { | 3229 | if (time_after(jiffies, sta->last_rx + exp_time)) { |
3261 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 3230 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3262 | printk(KERN_DEBUG "%s: expiring inactive STA %s\n", | 3231 | printk(KERN_DEBUG "%s: expiring inactive STA %s\n", |
3263 | dev->name, print_mac(mac, sta->addr)); | 3232 | sdata->dev->name, print_mac(mac, sta->addr)); |
3264 | #endif | 3233 | #endif |
3265 | __sta_info_unlink(&sta); | 3234 | __sta_info_unlink(&sta); |
3266 | if (sta) | 3235 | if (sta) |
@@ -3273,30 +3242,29 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time) | |||
3273 | } | 3242 | } |
3274 | 3243 | ||
3275 | 3244 | ||
3276 | static void ieee80211_sta_merge_ibss(struct net_device *dev, | 3245 | static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata, |
3277 | struct ieee80211_if_sta *ifsta) | 3246 | struct ieee80211_if_sta *ifsta) |
3278 | { | 3247 | { |
3279 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); | 3248 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); |
3280 | 3249 | ||
3281 | ieee80211_sta_expire(dev, IEEE80211_IBSS_INACTIVITY_LIMIT); | 3250 | ieee80211_sta_expire(sdata, IEEE80211_IBSS_INACTIVITY_LIMIT); |
3282 | if (ieee80211_sta_active_ibss(dev)) | 3251 | if (ieee80211_sta_active_ibss(sdata)) |
3283 | return; | 3252 | return; |
3284 | 3253 | ||
3285 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " | 3254 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " |
3286 | "IBSS networks with same SSID (merge)\n", dev->name); | 3255 | "IBSS networks with same SSID (merge)\n", sdata->dev->name); |
3287 | ieee80211_sta_req_scan(dev, ifsta->ssid, ifsta->ssid_len); | 3256 | ieee80211_sta_req_scan(sdata, ifsta->ssid, ifsta->ssid_len); |
3288 | } | 3257 | } |
3289 | 3258 | ||
3290 | 3259 | ||
3291 | #ifdef CONFIG_MAC80211_MESH | 3260 | #ifdef CONFIG_MAC80211_MESH |
3292 | static void ieee80211_mesh_housekeeping(struct net_device *dev, | 3261 | static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, |
3293 | struct ieee80211_if_sta *ifsta) | 3262 | struct ieee80211_if_sta *ifsta) |
3294 | { | 3263 | { |
3295 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3296 | bool free_plinks; | 3264 | bool free_plinks; |
3297 | 3265 | ||
3298 | ieee80211_sta_expire(dev, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); | 3266 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); |
3299 | mesh_path_expire(dev); | 3267 | mesh_path_expire(sdata); |
3300 | 3268 | ||
3301 | free_plinks = mesh_plink_availables(sdata); | 3269 | free_plinks = mesh_plink_availables(sdata); |
3302 | if (free_plinks != sdata->u.sta.accepting_plinks) | 3270 | if (free_plinks != sdata->u.sta.accepting_plinks) |
@@ -3307,10 +3275,9 @@ static void ieee80211_mesh_housekeeping(struct net_device *dev, | |||
3307 | } | 3275 | } |
3308 | 3276 | ||
3309 | 3277 | ||
3310 | void ieee80211_start_mesh(struct net_device *dev) | 3278 | void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) |
3311 | { | 3279 | { |
3312 | struct ieee80211_if_sta *ifsta; | 3280 | struct ieee80211_if_sta *ifsta; |
3313 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3314 | ifsta = &sdata->u.sta; | 3281 | ifsta = &sdata->u.sta; |
3315 | ifsta->state = IEEE80211_MESH_UP; | 3282 | ifsta->state = IEEE80211_MESH_UP; |
3316 | ieee80211_sta_timer((unsigned long)sdata); | 3283 | ieee80211_sta_timer((unsigned long)sdata); |
@@ -3324,7 +3291,7 @@ void ieee80211_sta_timer(unsigned long data) | |||
3324 | struct ieee80211_sub_if_data *sdata = | 3291 | struct ieee80211_sub_if_data *sdata = |
3325 | (struct ieee80211_sub_if_data *) data; | 3292 | (struct ieee80211_sub_if_data *) data; |
3326 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 3293 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
3327 | struct ieee80211_local *local = wdev_priv(&sdata->wdev); | 3294 | struct ieee80211_local *local = sdata->local; |
3328 | 3295 | ||
3329 | set_bit(IEEE80211_STA_REQ_RUN, &ifsta->request); | 3296 | set_bit(IEEE80211_STA_REQ_RUN, &ifsta->request); |
3330 | queue_work(local->hw.workqueue, &ifsta->work); | 3297 | queue_work(local->hw.workqueue, &ifsta->work); |
@@ -3334,12 +3301,11 @@ void ieee80211_sta_work(struct work_struct *work) | |||
3334 | { | 3301 | { |
3335 | struct ieee80211_sub_if_data *sdata = | 3302 | struct ieee80211_sub_if_data *sdata = |
3336 | container_of(work, struct ieee80211_sub_if_data, u.sta.work); | 3303 | container_of(work, struct ieee80211_sub_if_data, u.sta.work); |
3337 | struct net_device *dev = sdata->dev; | 3304 | struct ieee80211_local *local = sdata->local; |
3338 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
3339 | struct ieee80211_if_sta *ifsta; | 3305 | struct ieee80211_if_sta *ifsta; |
3340 | struct sk_buff *skb; | 3306 | struct sk_buff *skb; |
3341 | 3307 | ||
3342 | if (!netif_running(dev)) | 3308 | if (!netif_running(sdata->dev)) |
3343 | return; | 3309 | return; |
3344 | 3310 | ||
3345 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 3311 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
@@ -3352,27 +3318,27 @@ void ieee80211_sta_work(struct work_struct *work) | |||
3352 | ifsta = &sdata->u.sta; | 3318 | ifsta = &sdata->u.sta; |
3353 | 3319 | ||
3354 | while ((skb = skb_dequeue(&ifsta->skb_queue))) | 3320 | while ((skb = skb_dequeue(&ifsta->skb_queue))) |
3355 | ieee80211_sta_rx_queued_mgmt(dev, skb); | 3321 | ieee80211_sta_rx_queued_mgmt(sdata, skb); |
3356 | 3322 | ||
3357 | #ifdef CONFIG_MAC80211_MESH | 3323 | #ifdef CONFIG_MAC80211_MESH |
3358 | if (ifsta->preq_queue_len && | 3324 | if (ifsta->preq_queue_len && |
3359 | time_after(jiffies, | 3325 | time_after(jiffies, |
3360 | ifsta->last_preq + msecs_to_jiffies(ifsta->mshcfg.dot11MeshHWMPpreqMinInterval))) | 3326 | ifsta->last_preq + msecs_to_jiffies(ifsta->mshcfg.dot11MeshHWMPpreqMinInterval))) |
3361 | mesh_path_start_discovery(dev); | 3327 | mesh_path_start_discovery(sdata); |
3362 | #endif | 3328 | #endif |
3363 | 3329 | ||
3364 | if (ifsta->state != IEEE80211_AUTHENTICATE && | 3330 | if (ifsta->state != IEEE80211_AUTHENTICATE && |
3365 | ifsta->state != IEEE80211_ASSOCIATE && | 3331 | ifsta->state != IEEE80211_ASSOCIATE && |
3366 | test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { | 3332 | test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) { |
3367 | if (ifsta->scan_ssid_len) | 3333 | if (ifsta->scan_ssid_len) |
3368 | ieee80211_sta_start_scan(dev, ifsta->scan_ssid, ifsta->scan_ssid_len); | 3334 | ieee80211_sta_start_scan(sdata, ifsta->scan_ssid, ifsta->scan_ssid_len); |
3369 | else | 3335 | else |
3370 | ieee80211_sta_start_scan(dev, NULL, 0); | 3336 | ieee80211_sta_start_scan(sdata, NULL, 0); |
3371 | return; | 3337 | return; |
3372 | } | 3338 | } |
3373 | 3339 | ||
3374 | if (test_and_clear_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request)) { | 3340 | if (test_and_clear_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request)) { |
3375 | if (ieee80211_sta_config_auth(dev, ifsta)) | 3341 | if (ieee80211_sta_config_auth(sdata, ifsta)) |
3376 | return; | 3342 | return; |
3377 | clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request); | 3343 | clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request); |
3378 | } else if (!test_and_clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request)) | 3344 | } else if (!test_and_clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request)) |
@@ -3382,23 +3348,23 @@ void ieee80211_sta_work(struct work_struct *work) | |||
3382 | case IEEE80211_DISABLED: | 3348 | case IEEE80211_DISABLED: |
3383 | break; | 3349 | break; |
3384 | case IEEE80211_AUTHENTICATE: | 3350 | case IEEE80211_AUTHENTICATE: |
3385 | ieee80211_authenticate(dev, ifsta); | 3351 | ieee80211_authenticate(sdata, ifsta); |
3386 | break; | 3352 | break; |
3387 | case IEEE80211_ASSOCIATE: | 3353 | case IEEE80211_ASSOCIATE: |
3388 | ieee80211_associate(dev, ifsta); | 3354 | ieee80211_associate(sdata, ifsta); |
3389 | break; | 3355 | break; |
3390 | case IEEE80211_ASSOCIATED: | 3356 | case IEEE80211_ASSOCIATED: |
3391 | ieee80211_associated(dev, ifsta); | 3357 | ieee80211_associated(sdata, ifsta); |
3392 | break; | 3358 | break; |
3393 | case IEEE80211_IBSS_SEARCH: | 3359 | case IEEE80211_IBSS_SEARCH: |
3394 | ieee80211_sta_find_ibss(dev, ifsta); | 3360 | ieee80211_sta_find_ibss(sdata, ifsta); |
3395 | break; | 3361 | break; |
3396 | case IEEE80211_IBSS_JOINED: | 3362 | case IEEE80211_IBSS_JOINED: |
3397 | ieee80211_sta_merge_ibss(dev, ifsta); | 3363 | ieee80211_sta_merge_ibss(sdata, ifsta); |
3398 | break; | 3364 | break; |
3399 | #ifdef CONFIG_MAC80211_MESH | 3365 | #ifdef CONFIG_MAC80211_MESH |
3400 | case IEEE80211_MESH_UP: | 3366 | case IEEE80211_MESH_UP: |
3401 | ieee80211_mesh_housekeeping(dev, ifsta); | 3367 | ieee80211_mesh_housekeeping(sdata, ifsta); |
3402 | break; | 3368 | break; |
3403 | #endif | 3369 | #endif |
3404 | default: | 3370 | default: |
@@ -3406,20 +3372,20 @@ void ieee80211_sta_work(struct work_struct *work) | |||
3406 | break; | 3372 | break; |
3407 | } | 3373 | } |
3408 | 3374 | ||
3409 | if (ieee80211_privacy_mismatch(dev, ifsta)) { | 3375 | if (ieee80211_privacy_mismatch(sdata, ifsta)) { |
3410 | printk(KERN_DEBUG "%s: privacy configuration mismatch and " | 3376 | printk(KERN_DEBUG "%s: privacy configuration mismatch and " |
3411 | "mixed-cell disabled - disassociate\n", dev->name); | 3377 | "mixed-cell disabled - disassociate\n", sdata->dev->name); |
3412 | 3378 | ||
3413 | ieee80211_send_disassoc(dev, ifsta, WLAN_REASON_UNSPECIFIED); | 3379 | ieee80211_send_disassoc(sdata, ifsta, WLAN_REASON_UNSPECIFIED); |
3414 | ieee80211_set_disassoc(dev, ifsta, 0); | 3380 | ieee80211_set_disassoc(sdata, ifsta, 0); |
3415 | } | 3381 | } |
3416 | } | 3382 | } |
3417 | 3383 | ||
3418 | 3384 | ||
3419 | static void ieee80211_sta_reset_auth(struct net_device *dev, | 3385 | static void ieee80211_sta_reset_auth(struct ieee80211_sub_if_data *sdata, |
3420 | struct ieee80211_if_sta *ifsta) | 3386 | struct ieee80211_if_sta *ifsta) |
3421 | { | 3387 | { |
3422 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3388 | struct ieee80211_local *local = sdata->local; |
3423 | 3389 | ||
3424 | if (local->ops->reset_tsf) { | 3390 | if (local->ops->reset_tsf) { |
3425 | /* Reset own TSF to allow time synchronization work. */ | 3391 | /* Reset own TSF to allow time synchronization work. */ |
@@ -3440,15 +3406,14 @@ static void ieee80211_sta_reset_auth(struct net_device *dev, | |||
3440 | ifsta->auth_transaction = -1; | 3406 | ifsta->auth_transaction = -1; |
3441 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; | 3407 | ifsta->flags &= ~IEEE80211_STA_ASSOCIATED; |
3442 | ifsta->auth_tries = ifsta->assoc_tries = 0; | 3408 | ifsta->auth_tries = ifsta->assoc_tries = 0; |
3443 | netif_carrier_off(dev); | 3409 | netif_carrier_off(sdata->dev); |
3444 | } | 3410 | } |
3445 | 3411 | ||
3446 | 3412 | ||
3447 | void ieee80211_sta_req_auth(struct net_device *dev, | 3413 | void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, |
3448 | struct ieee80211_if_sta *ifsta) | 3414 | struct ieee80211_if_sta *ifsta) |
3449 | { | 3415 | { |
3450 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3416 | struct ieee80211_local *local = sdata->local; |
3451 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3452 | 3417 | ||
3453 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 3418 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
3454 | return; | 3419 | return; |
@@ -3492,11 +3457,10 @@ static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta, | |||
3492 | return 0; | 3457 | return 0; |
3493 | } | 3458 | } |
3494 | 3459 | ||
3495 | static int ieee80211_sta_config_auth(struct net_device *dev, | 3460 | static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata, |
3496 | struct ieee80211_if_sta *ifsta) | 3461 | struct ieee80211_if_sta *ifsta) |
3497 | { | 3462 | { |
3498 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3463 | struct ieee80211_local *local = sdata->local; |
3499 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3500 | struct ieee80211_sta_bss *bss, *selected = NULL; | 3464 | struct ieee80211_sta_bss *bss, *selected = NULL; |
3501 | int top_rssi = 0, freq; | 3465 | int top_rssi = 0, freq; |
3502 | 3466 | ||
@@ -3535,22 +3499,22 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
3535 | spin_unlock_bh(&local->sta_bss_lock); | 3499 | spin_unlock_bh(&local->sta_bss_lock); |
3536 | 3500 | ||
3537 | if (selected) { | 3501 | if (selected) { |
3538 | ieee80211_set_freq(dev, selected->freq); | 3502 | ieee80211_set_freq(sdata, selected->freq); |
3539 | if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) | 3503 | if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) |
3540 | ieee80211_sta_set_ssid(dev, selected->ssid, | 3504 | ieee80211_sta_set_ssid(sdata, selected->ssid, |
3541 | selected->ssid_len); | 3505 | selected->ssid_len); |
3542 | ieee80211_sta_set_bssid(dev, selected->bssid); | 3506 | ieee80211_sta_set_bssid(sdata, selected->bssid); |
3543 | ieee80211_sta_def_wmm_params(dev, selected, 0); | 3507 | ieee80211_sta_def_wmm_params(sdata, selected, 0); |
3544 | ieee80211_rx_bss_put(local, selected); | 3508 | ieee80211_rx_bss_put(local, selected); |
3545 | ifsta->state = IEEE80211_AUTHENTICATE; | 3509 | ifsta->state = IEEE80211_AUTHENTICATE; |
3546 | ieee80211_sta_reset_auth(dev, ifsta); | 3510 | ieee80211_sta_reset_auth(sdata, ifsta); |
3547 | return 0; | 3511 | return 0; |
3548 | } else { | 3512 | } else { |
3549 | if (ifsta->state != IEEE80211_AUTHENTICATE) { | 3513 | if (ifsta->state != IEEE80211_AUTHENTICATE) { |
3550 | if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) | 3514 | if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) |
3551 | ieee80211_sta_start_scan(dev, NULL, 0); | 3515 | ieee80211_sta_start_scan(sdata, NULL, 0); |
3552 | else | 3516 | else |
3553 | ieee80211_sta_start_scan(dev, ifsta->ssid, | 3517 | ieee80211_sta_start_scan(sdata, ifsta->ssid, |
3554 | ifsta->ssid_len); | 3518 | ifsta->ssid_len); |
3555 | ifsta->state = IEEE80211_AUTHENTICATE; | 3519 | ifsta->state = IEEE80211_AUTHENTICATE; |
3556 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); | 3520 | set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); |
@@ -3561,12 +3525,11 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
3561 | } | 3525 | } |
3562 | 3526 | ||
3563 | 3527 | ||
3564 | static int ieee80211_sta_create_ibss(struct net_device *dev, | 3528 | static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata, |
3565 | struct ieee80211_if_sta *ifsta) | 3529 | struct ieee80211_if_sta *ifsta) |
3566 | { | 3530 | { |
3567 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3531 | struct ieee80211_local *local = sdata->local; |
3568 | struct ieee80211_sta_bss *bss; | 3532 | struct ieee80211_sta_bss *bss; |
3569 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3570 | struct ieee80211_supported_band *sband; | 3533 | struct ieee80211_supported_band *sband; |
3571 | u8 bssid[ETH_ALEN], *pos; | 3534 | u8 bssid[ETH_ALEN], *pos; |
3572 | int i; | 3535 | int i; |
@@ -3582,15 +3545,15 @@ static int ieee80211_sta_create_ibss(struct net_device *dev, | |||
3582 | * random number generator get different BSSID. */ | 3545 | * random number generator get different BSSID. */ |
3583 | get_random_bytes(bssid, ETH_ALEN); | 3546 | get_random_bytes(bssid, ETH_ALEN); |
3584 | for (i = 0; i < ETH_ALEN; i++) | 3547 | for (i = 0; i < ETH_ALEN; i++) |
3585 | bssid[i] ^= dev->dev_addr[i]; | 3548 | bssid[i] ^= sdata->dev->dev_addr[i]; |
3586 | bssid[0] &= ~0x01; | 3549 | bssid[0] &= ~0x01; |
3587 | bssid[0] |= 0x02; | 3550 | bssid[0] |= 0x02; |
3588 | #endif | 3551 | #endif |
3589 | 3552 | ||
3590 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n", | 3553 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n", |
3591 | dev->name, print_mac(mac, bssid)); | 3554 | sdata->dev->name, print_mac(mac, bssid)); |
3592 | 3555 | ||
3593 | bss = ieee80211_rx_bss_add(dev, bssid, | 3556 | bss = ieee80211_rx_bss_add(sdata, bssid, |
3594 | local->hw.conf.channel->center_freq, | 3557 | local->hw.conf.channel->center_freq, |
3595 | sdata->u.sta.ssid, sdata->u.sta.ssid_len); | 3558 | sdata->u.sta.ssid, sdata->u.sta.ssid_len); |
3596 | if (!bss) | 3559 | if (!bss) |
@@ -3617,16 +3580,16 @@ static int ieee80211_sta_create_ibss(struct net_device *dev, | |||
3617 | *pos++ = (u8) (rate / 5); | 3580 | *pos++ = (u8) (rate / 5); |
3618 | } | 3581 | } |
3619 | 3582 | ||
3620 | ret = ieee80211_sta_join_ibss(dev, ifsta, bss); | 3583 | ret = ieee80211_sta_join_ibss(sdata, ifsta, bss); |
3621 | ieee80211_rx_bss_put(local, bss); | 3584 | ieee80211_rx_bss_put(local, bss); |
3622 | return ret; | 3585 | return ret; |
3623 | } | 3586 | } |
3624 | 3587 | ||
3625 | 3588 | ||
3626 | static int ieee80211_sta_find_ibss(struct net_device *dev, | 3589 | static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata, |
3627 | struct ieee80211_if_sta *ifsta) | 3590 | struct ieee80211_if_sta *ifsta) |
3628 | { | 3591 | { |
3629 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3592 | struct ieee80211_local *local = sdata->local; |
3630 | struct ieee80211_sta_bss *bss; | 3593 | struct ieee80211_sta_bss *bss; |
3631 | int found = 0; | 3594 | int found = 0; |
3632 | u8 bssid[ETH_ALEN]; | 3595 | u8 bssid[ETH_ALEN]; |
@@ -3637,10 +3600,10 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
3637 | if (ifsta->ssid_len == 0) | 3600 | if (ifsta->ssid_len == 0) |
3638 | return -EINVAL; | 3601 | return -EINVAL; |
3639 | 3602 | ||
3640 | active_ibss = ieee80211_sta_active_ibss(dev); | 3603 | active_ibss = ieee80211_sta_active_ibss(sdata); |
3641 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 3604 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3642 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", | 3605 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", |
3643 | dev->name, active_ibss); | 3606 | sdata->dev->name, active_ibss); |
3644 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 3607 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
3645 | spin_lock_bh(&local->sta_bss_lock); | 3608 | spin_lock_bh(&local->sta_bss_lock); |
3646 | list_for_each_entry(bss, &local->sta_bss_list, list) { | 3609 | list_for_each_entry(bss, &local->sta_bss_list, list) { |
@@ -3675,15 +3638,15 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
3675 | else | 3638 | else |
3676 | search_freq = local->hw.conf.channel->center_freq; | 3639 | search_freq = local->hw.conf.channel->center_freq; |
3677 | 3640 | ||
3678 | bss = ieee80211_rx_bss_get(dev, bssid, search_freq, | 3641 | bss = ieee80211_rx_bss_get(local, bssid, search_freq, |
3679 | ifsta->ssid, ifsta->ssid_len); | 3642 | ifsta->ssid, ifsta->ssid_len); |
3680 | if (!bss) | 3643 | if (!bss) |
3681 | goto dont_join; | 3644 | goto dont_join; |
3682 | 3645 | ||
3683 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" | 3646 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" |
3684 | " based on configured SSID\n", | 3647 | " based on configured SSID\n", |
3685 | dev->name, print_mac(mac, bssid)); | 3648 | sdata->dev->name, print_mac(mac, bssid)); |
3686 | ret = ieee80211_sta_join_ibss(dev, ifsta, bss); | 3649 | ret = ieee80211_sta_join_ibss(sdata, ifsta, bss); |
3687 | ieee80211_rx_bss_put(local, bss); | 3650 | ieee80211_rx_bss_put(local, bss); |
3688 | return ret; | 3651 | return ret; |
3689 | } | 3652 | } |
@@ -3695,14 +3658,14 @@ dont_join: | |||
3695 | 3658 | ||
3696 | /* Selected IBSS not found in current scan results - try to scan */ | 3659 | /* Selected IBSS not found in current scan results - try to scan */ |
3697 | if (ifsta->state == IEEE80211_IBSS_JOINED && | 3660 | if (ifsta->state == IEEE80211_IBSS_JOINED && |
3698 | !ieee80211_sta_active_ibss(dev)) { | 3661 | !ieee80211_sta_active_ibss(sdata)) { |
3699 | mod_timer(&ifsta->timer, jiffies + | 3662 | mod_timer(&ifsta->timer, jiffies + |
3700 | IEEE80211_IBSS_MERGE_INTERVAL); | 3663 | IEEE80211_IBSS_MERGE_INTERVAL); |
3701 | } else if (time_after(jiffies, local->last_scan_completed + | 3664 | } else if (time_after(jiffies, local->last_scan_completed + |
3702 | IEEE80211_SCAN_INTERVAL)) { | 3665 | IEEE80211_SCAN_INTERVAL)) { |
3703 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " | 3666 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " |
3704 | "join\n", dev->name); | 3667 | "join\n", sdata->dev->name); |
3705 | return ieee80211_sta_req_scan(dev, ifsta->ssid, | 3668 | return ieee80211_sta_req_scan(sdata, ifsta->ssid, |
3706 | ifsta->ssid_len); | 3669 | ifsta->ssid_len); |
3707 | } else if (ifsta->state != IEEE80211_IBSS_JOINED) { | 3670 | } else if (ifsta->state != IEEE80211_IBSS_JOINED) { |
3708 | int interval = IEEE80211_SCAN_INTERVAL; | 3671 | int interval = IEEE80211_SCAN_INTERVAL; |
@@ -3712,10 +3675,10 @@ dont_join: | |||
3712 | if ((ifsta->flags & IEEE80211_STA_CREATE_IBSS) && | 3675 | if ((ifsta->flags & IEEE80211_STA_CREATE_IBSS) && |
3713 | (!(local->oper_channel->flags & | 3676 | (!(local->oper_channel->flags & |
3714 | IEEE80211_CHAN_NO_IBSS))) | 3677 | IEEE80211_CHAN_NO_IBSS))) |
3715 | return ieee80211_sta_create_ibss(dev, ifsta); | 3678 | return ieee80211_sta_create_ibss(sdata, ifsta); |
3716 | if (ifsta->flags & IEEE80211_STA_CREATE_IBSS) { | 3679 | if (ifsta->flags & IEEE80211_STA_CREATE_IBSS) { |
3717 | printk(KERN_DEBUG "%s: IBSS not allowed on" | 3680 | printk(KERN_DEBUG "%s: IBSS not allowed on" |
3718 | " %d MHz\n", dev->name, | 3681 | " %d MHz\n", sdata->dev->name, |
3719 | local->hw.conf.channel->center_freq); | 3682 | local->hw.conf.channel->center_freq); |
3720 | } | 3683 | } |
3721 | 3684 | ||
@@ -3733,9 +3696,8 @@ dont_join: | |||
3733 | } | 3696 | } |
3734 | 3697 | ||
3735 | 3698 | ||
3736 | int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len) | 3699 | int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len) |
3737 | { | 3700 | { |
3738 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3739 | struct ieee80211_if_sta *ifsta; | 3701 | struct ieee80211_if_sta *ifsta; |
3740 | int res; | 3702 | int res; |
3741 | 3703 | ||
@@ -3759,7 +3721,7 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len) | |||
3759 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_SSID); | 3721 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_SSID); |
3760 | if (res) { | 3722 | if (res) { |
3761 | printk(KERN_DEBUG "%s: Failed to config new SSID to " | 3723 | printk(KERN_DEBUG "%s: Failed to config new SSID to " |
3762 | "the low-level driver\n", dev->name); | 3724 | "the low-level driver\n", sdata->dev->name); |
3763 | return res; | 3725 | return res; |
3764 | } | 3726 | } |
3765 | } | 3727 | } |
@@ -3773,16 +3735,15 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len) | |||
3773 | !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { | 3735 | !(ifsta->flags & IEEE80211_STA_BSSID_SET)) { |
3774 | ifsta->ibss_join_req = jiffies; | 3736 | ifsta->ibss_join_req = jiffies; |
3775 | ifsta->state = IEEE80211_IBSS_SEARCH; | 3737 | ifsta->state = IEEE80211_IBSS_SEARCH; |
3776 | return ieee80211_sta_find_ibss(dev, ifsta); | 3738 | return ieee80211_sta_find_ibss(sdata, ifsta); |
3777 | } | 3739 | } |
3778 | 3740 | ||
3779 | return 0; | 3741 | return 0; |
3780 | } | 3742 | } |
3781 | 3743 | ||
3782 | 3744 | ||
3783 | int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len) | 3745 | int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len) |
3784 | { | 3746 | { |
3785 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3786 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 3747 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
3787 | memcpy(ssid, ifsta->ssid, ifsta->ssid_len); | 3748 | memcpy(ssid, ifsta->ssid, ifsta->ssid_len); |
3788 | *len = ifsta->ssid_len; | 3749 | *len = ifsta->ssid_len; |
@@ -3790,13 +3751,11 @@ int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len) | |||
3790 | } | 3751 | } |
3791 | 3752 | ||
3792 | 3753 | ||
3793 | int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid) | 3754 | int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid) |
3794 | { | 3755 | { |
3795 | struct ieee80211_sub_if_data *sdata; | ||
3796 | struct ieee80211_if_sta *ifsta; | 3756 | struct ieee80211_if_sta *ifsta; |
3797 | int res; | 3757 | int res; |
3798 | 3758 | ||
3799 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
3800 | ifsta = &sdata->u.sta; | 3759 | ifsta = &sdata->u.sta; |
3801 | 3760 | ||
3802 | if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { | 3761 | if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { |
@@ -3809,7 +3768,7 @@ int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid) | |||
3809 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID); | 3768 | res = ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID); |
3810 | if (res) { | 3769 | if (res) { |
3811 | printk(KERN_DEBUG "%s: Failed to config new BSSID to " | 3770 | printk(KERN_DEBUG "%s: Failed to config new BSSID to " |
3812 | "the low-level driver\n", dev->name); | 3771 | "the low-level driver\n", sdata->dev->name); |
3813 | return res; | 3772 | return res; |
3814 | } | 3773 | } |
3815 | } | 3774 | } |
@@ -3850,7 +3809,7 @@ static void ieee80211_send_nullfunc(struct ieee80211_local *local, | |||
3850 | memcpy(nullfunc->addr2, sdata->dev->dev_addr, ETH_ALEN); | 3809 | memcpy(nullfunc->addr2, sdata->dev->dev_addr, ETH_ALEN); |
3851 | memcpy(nullfunc->addr3, sdata->u.sta.bssid, ETH_ALEN); | 3810 | memcpy(nullfunc->addr3, sdata->u.sta.bssid, ETH_ALEN); |
3852 | 3811 | ||
3853 | ieee80211_sta_tx(sdata->dev, skb, 0); | 3812 | ieee80211_sta_tx(sdata, skb, 0); |
3854 | } | 3813 | } |
3855 | 3814 | ||
3856 | 3815 | ||
@@ -3923,8 +3882,8 @@ done: | |||
3923 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 3882 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
3924 | if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || | 3883 | if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) || |
3925 | (!(ifsta->state == IEEE80211_IBSS_JOINED) && | 3884 | (!(ifsta->state == IEEE80211_IBSS_JOINED) && |
3926 | !ieee80211_sta_active_ibss(dev))) | 3885 | !ieee80211_sta_active_ibss(sdata))) |
3927 | ieee80211_sta_find_ibss(dev, ifsta); | 3886 | ieee80211_sta_find_ibss(sdata, ifsta); |
3928 | } | 3887 | } |
3929 | } | 3888 | } |
3930 | EXPORT_SYMBOL(ieee80211_scan_completed); | 3889 | EXPORT_SYMBOL(ieee80211_scan_completed); |
@@ -4013,7 +3972,7 @@ void ieee80211_sta_scan_work(struct work_struct *work) | |||
4013 | 3972 | ||
4014 | if (local->scan_channel->flags & IEEE80211_CHAN_PASSIVE_SCAN) | 3973 | if (local->scan_channel->flags & IEEE80211_CHAN_PASSIVE_SCAN) |
4015 | break; | 3974 | break; |
4016 | ieee80211_send_probe_req(dev, NULL, local->scan_ssid, | 3975 | ieee80211_send_probe_req(sdata, NULL, local->scan_ssid, |
4017 | local->scan_ssid_len); | 3976 | local->scan_ssid_len); |
4018 | next_delay = IEEE80211_CHANNEL_TIME; | 3977 | next_delay = IEEE80211_CHANNEL_TIME; |
4019 | break; | 3978 | break; |
@@ -4025,10 +3984,10 @@ void ieee80211_sta_scan_work(struct work_struct *work) | |||
4025 | } | 3984 | } |
4026 | 3985 | ||
4027 | 3986 | ||
4028 | static int ieee80211_sta_start_scan(struct net_device *dev, | 3987 | static int ieee80211_sta_start_scan(struct ieee80211_sub_if_data *scan_sdata, |
4029 | u8 *ssid, size_t ssid_len) | 3988 | u8 *ssid, size_t ssid_len) |
4030 | { | 3989 | { |
4031 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 3990 | struct ieee80211_local *local = scan_sdata->local; |
4032 | struct ieee80211_sub_if_data *sdata; | 3991 | struct ieee80211_sub_if_data *sdata; |
4033 | 3992 | ||
4034 | if (ssid_len > IEEE80211_MAX_SSID_LEN) | 3993 | if (ssid_len > IEEE80211_MAX_SSID_LEN) |
@@ -4052,7 +4011,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
4052 | */ | 4011 | */ |
4053 | 4012 | ||
4054 | if (local->sta_sw_scanning || local->sta_hw_scanning) { | 4013 | if (local->sta_sw_scanning || local->sta_hw_scanning) { |
4055 | if (local->scan_dev == dev) | 4014 | if (local->scan_dev == scan_sdata->dev) |
4056 | return 0; | 4015 | return 0; |
4057 | return -EBUSY; | 4016 | return -EBUSY; |
4058 | } | 4017 | } |
@@ -4062,7 +4021,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
4062 | ssid, ssid_len); | 4021 | ssid, ssid_len); |
4063 | if (!rc) { | 4022 | if (!rc) { |
4064 | local->sta_hw_scanning = 1; | 4023 | local->sta_hw_scanning = 1; |
4065 | local->scan_dev = dev; | 4024 | local->scan_dev = scan_sdata->dev; |
4066 | } | 4025 | } |
4067 | return rc; | 4026 | return rc; |
4068 | } | 4027 | } |
@@ -4086,7 +4045,7 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
4086 | local->scan_state = SCAN_SET_CHANNEL; | 4045 | local->scan_state = SCAN_SET_CHANNEL; |
4087 | local->scan_channel_idx = 0; | 4046 | local->scan_channel_idx = 0; |
4088 | local->scan_band = IEEE80211_BAND_2GHZ; | 4047 | local->scan_band = IEEE80211_BAND_2GHZ; |
4089 | local->scan_dev = dev; | 4048 | local->scan_dev = scan_sdata->dev; |
4090 | 4049 | ||
4091 | netif_addr_lock_bh(local->mdev); | 4050 | netif_addr_lock_bh(local->mdev); |
4092 | local->filter_flags |= FIF_BCN_PRBRESP_PROMISC; | 4051 | local->filter_flags |= FIF_BCN_PRBRESP_PROMISC; |
@@ -4105,17 +4064,16 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
4105 | } | 4064 | } |
4106 | 4065 | ||
4107 | 4066 | ||
4108 | int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len) | 4067 | int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len) |
4109 | { | 4068 | { |
4110 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4111 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 4069 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
4112 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 4070 | struct ieee80211_local *local = sdata->local; |
4113 | 4071 | ||
4114 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 4072 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
4115 | return ieee80211_sta_start_scan(dev, ssid, ssid_len); | 4073 | return ieee80211_sta_start_scan(sdata, ssid, ssid_len); |
4116 | 4074 | ||
4117 | if (local->sta_sw_scanning || local->sta_hw_scanning) { | 4075 | if (local->sta_sw_scanning || local->sta_hw_scanning) { |
4118 | if (local->scan_dev == dev) | 4076 | if (local->scan_dev == sdata->dev) |
4119 | return 0; | 4077 | return 0; |
4120 | return -EBUSY; | 4078 | return -EBUSY; |
4121 | } | 4079 | } |
@@ -4129,12 +4087,11 @@ int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len) | |||
4129 | } | 4087 | } |
4130 | 4088 | ||
4131 | static char * | 4089 | static char * |
4132 | ieee80211_sta_scan_result(struct net_device *dev, | 4090 | ieee80211_sta_scan_result(struct ieee80211_local *local, |
4133 | struct iw_request_info *info, | 4091 | struct iw_request_info *info, |
4134 | struct ieee80211_sta_bss *bss, | 4092 | struct ieee80211_sta_bss *bss, |
4135 | char *current_ev, char *end_buf) | 4093 | char *current_ev, char *end_buf) |
4136 | { | 4094 | { |
4137 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
4138 | struct iw_event iwe; | 4095 | struct iw_event iwe; |
4139 | 4096 | ||
4140 | if (time_after(jiffies, | 4097 | if (time_after(jiffies, |
@@ -4321,11 +4278,10 @@ ieee80211_sta_scan_result(struct net_device *dev, | |||
4321 | } | 4278 | } |
4322 | 4279 | ||
4323 | 4280 | ||
4324 | int ieee80211_sta_scan_results(struct net_device *dev, | 4281 | int ieee80211_sta_scan_results(struct ieee80211_local *local, |
4325 | struct iw_request_info *info, | 4282 | struct iw_request_info *info, |
4326 | char *buf, size_t len) | 4283 | char *buf, size_t len) |
4327 | { | 4284 | { |
4328 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
4329 | char *current_ev = buf; | 4285 | char *current_ev = buf; |
4330 | char *end_buf = buf + len; | 4286 | char *end_buf = buf + len; |
4331 | struct ieee80211_sta_bss *bss; | 4287 | struct ieee80211_sta_bss *bss; |
@@ -4336,7 +4292,7 @@ int ieee80211_sta_scan_results(struct net_device *dev, | |||
4336 | spin_unlock_bh(&local->sta_bss_lock); | 4292 | spin_unlock_bh(&local->sta_bss_lock); |
4337 | return -E2BIG; | 4293 | return -E2BIG; |
4338 | } | 4294 | } |
4339 | current_ev = ieee80211_sta_scan_result(dev, info, bss, | 4295 | current_ev = ieee80211_sta_scan_result(local, info, bss, |
4340 | current_ev, end_buf); | 4296 | current_ev, end_buf); |
4341 | } | 4297 | } |
4342 | spin_unlock_bh(&local->sta_bss_lock); | 4298 | spin_unlock_bh(&local->sta_bss_lock); |
@@ -4344,9 +4300,8 @@ int ieee80211_sta_scan_results(struct net_device *dev, | |||
4344 | } | 4300 | } |
4345 | 4301 | ||
4346 | 4302 | ||
4347 | int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len) | 4303 | int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len) |
4348 | { | 4304 | { |
4349 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4350 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 4305 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
4351 | 4306 | ||
4352 | kfree(ifsta->extra_ie); | 4307 | kfree(ifsta->extra_ie); |
@@ -4366,13 +4321,12 @@ int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len) | |||
4366 | } | 4321 | } |
4367 | 4322 | ||
4368 | 4323 | ||
4369 | struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | 4324 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, |
4370 | struct sk_buff *skb, u8 *bssid, | 4325 | struct sk_buff *skb, u8 *bssid, |
4371 | u8 *addr, u64 supp_rates) | 4326 | u8 *addr, u64 supp_rates) |
4372 | { | 4327 | { |
4373 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 4328 | struct ieee80211_local *local = sdata->local; |
4374 | struct sta_info *sta; | 4329 | struct sta_info *sta; |
4375 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4376 | DECLARE_MAC_BUF(mac); | 4330 | DECLARE_MAC_BUF(mac); |
4377 | int band = local->hw.conf.channel->band; | 4331 | int band = local->hw.conf.channel->band; |
4378 | 4332 | ||
@@ -4381,7 +4335,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | |||
4381 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | 4335 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { |
4382 | if (net_ratelimit()) { | 4336 | if (net_ratelimit()) { |
4383 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " | 4337 | printk(KERN_DEBUG "%s: No room for a new IBSS STA " |
4384 | "entry %s\n", dev->name, print_mac(mac, addr)); | 4338 | "entry %s\n", sdata->dev->name, print_mac(mac, addr)); |
4385 | } | 4339 | } |
4386 | return NULL; | 4340 | return NULL; |
4387 | } | 4341 | } |
@@ -4391,7 +4345,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | |||
4391 | 4345 | ||
4392 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 4346 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
4393 | printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", | 4347 | printk(KERN_DEBUG "%s: Adding new IBSS station %s (dev=%s)\n", |
4394 | wiphy_name(local->hw.wiphy), print_mac(mac, addr), dev->name); | 4348 | wiphy_name(local->hw.wiphy), print_mac(mac, addr), sdata->dev->name); |
4395 | #endif | 4349 | #endif |
4396 | 4350 | ||
4397 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); | 4351 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); |
@@ -4414,31 +4368,29 @@ struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | |||
4414 | } | 4368 | } |
4415 | 4369 | ||
4416 | 4370 | ||
4417 | int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason) | 4371 | int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason) |
4418 | { | 4372 | { |
4419 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4420 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 4373 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
4421 | 4374 | ||
4422 | printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n", | 4375 | printk(KERN_DEBUG "%s: deauthenticating by local choice (reason=%d)\n", |
4423 | dev->name, reason); | 4376 | sdata->dev->name, reason); |
4424 | 4377 | ||
4425 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 4378 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && |
4426 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | 4379 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) |
4427 | return -EINVAL; | 4380 | return -EINVAL; |
4428 | 4381 | ||
4429 | ieee80211_send_deauth(dev, ifsta, reason); | 4382 | ieee80211_send_deauth(sdata, ifsta, reason); |
4430 | ieee80211_set_disassoc(dev, ifsta, 1); | 4383 | ieee80211_set_disassoc(sdata, ifsta, 1); |
4431 | return 0; | 4384 | return 0; |
4432 | } | 4385 | } |
4433 | 4386 | ||
4434 | 4387 | ||
4435 | int ieee80211_sta_disassociate(struct net_device *dev, u16 reason) | 4388 | int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason) |
4436 | { | 4389 | { |
4437 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
4438 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 4390 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
4439 | 4391 | ||
4440 | printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n", | 4392 | printk(KERN_DEBUG "%s: disassociating by local choice (reason=%d)\n", |
4441 | dev->name, reason); | 4393 | sdata->dev->name, reason); |
4442 | 4394 | ||
4443 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 4395 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
4444 | return -EINVAL; | 4396 | return -EINVAL; |
@@ -4446,8 +4398,8 @@ int ieee80211_sta_disassociate(struct net_device *dev, u16 reason) | |||
4446 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED)) | 4398 | if (!(ifsta->flags & IEEE80211_STA_ASSOCIATED)) |
4447 | return -1; | 4399 | return -1; |
4448 | 4400 | ||
4449 | ieee80211_send_disassoc(dev, ifsta, reason); | 4401 | ieee80211_send_disassoc(sdata, ifsta, reason); |
4450 | ieee80211_set_disassoc(dev, ifsta, 0); | 4402 | ieee80211_set_disassoc(sdata, ifsta, 0); |
4451 | return 0; | 4403 | return 0; |
4452 | } | 4404 | } |
4453 | 4405 | ||
@@ -4464,7 +4416,7 @@ void ieee80211_notify_mac(struct ieee80211_hw *hw, | |||
4464 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 4416 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
4465 | continue; | 4417 | continue; |
4466 | 4418 | ||
4467 | ieee80211_sta_req_auth(sdata->dev, &sdata->u.sta); | 4419 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
4468 | } | 4420 | } |
4469 | rcu_read_unlock(); | 4421 | rcu_read_unlock(); |
4470 | break; | 4422 | break; |