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 | |
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')
-rw-r--r-- | net/mac80211/cfg.c | 21 | ||||
-rw-r--r-- | net/mac80211/debugfs_sta.c | 2 | ||||
-rw-r--r-- | net/mac80211/event.c | 5 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 48 | ||||
-rw-r--r-- | net/mac80211/iface.c | 8 | ||||
-rw-r--r-- | net/mac80211/main.c | 16 | ||||
-rw-r--r-- | net/mac80211/mesh.c | 29 | ||||
-rw-r--r-- | net/mac80211/mesh.h | 61 | ||||
-rw-r--r-- | net/mac80211/mesh_hwmp.c | 112 | ||||
-rw-r--r-- | net/mac80211/mesh_pathtbl.c | 76 | ||||
-rw-r--r-- | net/mac80211/mesh_plink.c | 52 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 652 | ||||
-rw-r--r-- | net/mac80211/rx.c | 16 | ||||
-rw-r--r-- | net/mac80211/tx.c | 4 | ||||
-rw-r--r-- | net/mac80211/wext.c | 49 | ||||
-rw-r--r-- | net/mac80211/wpa.c | 2 |
16 files changed, 545 insertions, 608 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 297c257864c..6d2ad2bf3ab 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -66,13 +66,16 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | |||
66 | static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex) | 66 | static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex) |
67 | { | 67 | { |
68 | struct net_device *dev; | 68 | struct net_device *dev; |
69 | struct ieee80211_sub_if_data *sdata; | ||
69 | 70 | ||
70 | /* we're under RTNL */ | 71 | /* we're under RTNL */ |
71 | dev = __dev_get_by_index(&init_net, ifindex); | 72 | dev = __dev_get_by_index(&init_net, ifindex); |
72 | if (!dev) | 73 | if (!dev) |
73 | return -ENODEV; | 74 | return -ENODEV; |
74 | 75 | ||
75 | ieee80211_if_remove(dev); | 76 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
77 | |||
78 | ieee80211_if_remove(sdata); | ||
76 | 79 | ||
77 | return 0; | 80 | return 0; |
78 | } | 81 | } |
@@ -842,13 +845,13 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
842 | return -ENOENT; | 845 | return -ENOENT; |
843 | } | 846 | } |
844 | 847 | ||
845 | err = mesh_path_add(dst, dev); | 848 | err = mesh_path_add(dst, sdata); |
846 | if (err) { | 849 | if (err) { |
847 | rcu_read_unlock(); | 850 | rcu_read_unlock(); |
848 | return err; | 851 | return err; |
849 | } | 852 | } |
850 | 853 | ||
851 | mpath = mesh_path_lookup(dst, dev); | 854 | mpath = mesh_path_lookup(dst, sdata); |
852 | if (!mpath) { | 855 | if (!mpath) { |
853 | rcu_read_unlock(); | 856 | rcu_read_unlock(); |
854 | return -ENXIO; | 857 | return -ENXIO; |
@@ -862,10 +865,12 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
862 | static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev, | 865 | static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev, |
863 | u8 *dst) | 866 | u8 *dst) |
864 | { | 867 | { |
868 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
869 | |||
865 | if (dst) | 870 | if (dst) |
866 | return mesh_path_del(dst, dev); | 871 | return mesh_path_del(dst, sdata); |
867 | 872 | ||
868 | mesh_path_flush(dev); | 873 | mesh_path_flush(sdata); |
869 | return 0; | 874 | return 0; |
870 | } | 875 | } |
871 | 876 | ||
@@ -897,7 +902,7 @@ static int ieee80211_change_mpath(struct wiphy *wiphy, | |||
897 | return -ENOENT; | 902 | return -ENOENT; |
898 | } | 903 | } |
899 | 904 | ||
900 | mpath = mesh_path_lookup(dst, dev); | 905 | mpath = mesh_path_lookup(dst, sdata); |
901 | if (!mpath) { | 906 | if (!mpath) { |
902 | rcu_read_unlock(); | 907 | rcu_read_unlock(); |
903 | return -ENOENT; | 908 | return -ENOENT; |
@@ -965,7 +970,7 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
965 | return -ENOTSUPP; | 970 | return -ENOTSUPP; |
966 | 971 | ||
967 | rcu_read_lock(); | 972 | rcu_read_lock(); |
968 | mpath = mesh_path_lookup(dst, dev); | 973 | mpath = mesh_path_lookup(dst, sdata); |
969 | if (!mpath) { | 974 | if (!mpath) { |
970 | rcu_read_unlock(); | 975 | rcu_read_unlock(); |
971 | return -ENOENT; | 976 | return -ENOENT; |
@@ -993,7 +998,7 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
993 | return -ENOTSUPP; | 998 | return -ENOTSUPP; |
994 | 999 | ||
995 | rcu_read_lock(); | 1000 | rcu_read_lock(); |
996 | mpath = mesh_path_lookup_by_idx(idx, dev); | 1001 | mpath = mesh_path_lookup_by_idx(idx, sdata); |
997 | if (!mpath) { | 1002 | if (!mpath) { |
998 | rcu_read_unlock(); | 1003 | rcu_read_unlock(); |
999 | return -ENOENT; | 1004 | return -ENOENT; |
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index 79a062782d5..6abe5427752 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -201,7 +201,7 @@ static ssize_t sta_agg_status_write(struct file *file, | |||
201 | tid_num = tid_num - 100; | 201 | tid_num = tid_num - 100; |
202 | if (tid_static_rx[tid_num] == 1) { | 202 | if (tid_static_rx[tid_num] == 1) { |
203 | strcpy(state, "off "); | 203 | strcpy(state, "off "); |
204 | ieee80211_sta_stop_rx_ba_session(dev, da, tid_num, 0, | 204 | ieee80211_sta_stop_rx_ba_session(sta->sdata, da, tid_num, 0, |
205 | WLAN_REASON_QSTA_REQUIRE_SETUP); | 205 | WLAN_REASON_QSTA_REQUIRE_SETUP); |
206 | sta->ampdu_mlme.tid_state_rx[tid_num] |= | 206 | sta->ampdu_mlme.tid_state_rx[tid_num] |= |
207 | HT_AGG_STATE_DEBUGFS_CTL; | 207 | HT_AGG_STATE_DEBUGFS_CTL; |
diff --git a/net/mac80211/event.c b/net/mac80211/event.c index 2280f40b456..8de60de70bc 100644 --- a/net/mac80211/event.c +++ b/net/mac80211/event.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * mac80211 - events | 8 | * mac80211 - events |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/netdevice.h> | ||
12 | #include <net/iw_handler.h> | 11 | #include <net/iw_handler.h> |
13 | #include "ieee80211_i.h" | 12 | #include "ieee80211_i.h" |
14 | 13 | ||
@@ -17,7 +16,7 @@ | |||
17 | * (in the variable hdr) must be long enough to extract the TKIP | 16 | * (in the variable hdr) must be long enough to extract the TKIP |
18 | * fields like TSC | 17 | * fields like TSC |
19 | */ | 18 | */ |
20 | void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx, | 19 | void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, |
21 | struct ieee80211_hdr *hdr) | 20 | struct ieee80211_hdr *hdr) |
22 | { | 21 | { |
23 | union iwreq_data wrqu; | 22 | union iwreq_data wrqu; |
@@ -32,7 +31,7 @@ void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx, | |||
32 | print_mac(mac, hdr->addr2)); | 31 | print_mac(mac, hdr->addr2)); |
33 | memset(&wrqu, 0, sizeof(wrqu)); | 32 | memset(&wrqu, 0, sizeof(wrqu)); |
34 | wrqu.data.length = strlen(buf); | 33 | wrqu.data.length = strlen(buf); |
35 | wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); | 34 | wireless_send_event(sdata->dev, IWEVCUSTOM, &wrqu, buf); |
36 | kfree(buf); | 35 | kfree(buf); |
37 | } | 36 | } |
38 | 37 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 168f845c173..b5d3f58a784 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -851,65 +851,65 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, | |||
851 | 851 | ||
852 | /* ieee80211_ioctl.c */ | 852 | /* ieee80211_ioctl.c */ |
853 | extern const struct iw_handler_def ieee80211_iw_handler_def; | 853 | extern const struct iw_handler_def ieee80211_iw_handler_def; |
854 | int ieee80211_set_freq(struct net_device *dev, int freq); | 854 | int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freq); |
855 | 855 | ||
856 | /* ieee80211_sta.c */ | 856 | /* ieee80211_sta.c */ |
857 | void ieee80211_sta_timer(unsigned long data); | 857 | void ieee80211_sta_timer(unsigned long data); |
858 | void ieee80211_sta_work(struct work_struct *work); | 858 | void ieee80211_sta_work(struct work_struct *work); |
859 | void ieee80211_sta_scan_work(struct work_struct *work); | 859 | void ieee80211_sta_scan_work(struct work_struct *work); |
860 | void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, | 860 | void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
861 | struct ieee80211_rx_status *rx_status); | 861 | struct ieee80211_rx_status *rx_status); |
862 | int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len); | 862 | int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len); |
863 | int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len); | 863 | int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len); |
864 | int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid); | 864 | int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid); |
865 | int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len); | 865 | int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len); |
866 | void ieee80211_sta_req_auth(struct net_device *dev, | 866 | void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, |
867 | struct ieee80211_if_sta *ifsta); | 867 | struct ieee80211_if_sta *ifsta); |
868 | int ieee80211_sta_scan_results(struct net_device *dev, | 868 | int ieee80211_sta_scan_results(struct ieee80211_local *local, |
869 | struct iw_request_info *info, | 869 | struct iw_request_info *info, |
870 | char *buf, size_t len); | 870 | char *buf, size_t len); |
871 | ieee80211_rx_result ieee80211_sta_rx_scan( | 871 | ieee80211_rx_result ieee80211_sta_rx_scan( |
872 | struct net_device *dev, struct sk_buff *skb, | 872 | struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
873 | struct ieee80211_rx_status *rx_status); | 873 | struct ieee80211_rx_status *rx_status); |
874 | void ieee80211_rx_bss_list_init(struct ieee80211_local *local); | 874 | void ieee80211_rx_bss_list_init(struct ieee80211_local *local); |
875 | void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local); | 875 | void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local); |
876 | int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len); | 876 | int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len); |
877 | struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, | 877 | struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, |
878 | struct sk_buff *skb, u8 *bssid, | 878 | struct sk_buff *skb, u8 *bssid, |
879 | u8 *addr, u64 supp_rates); | 879 | u8 *addr, u64 supp_rates); |
880 | int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason); | 880 | int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason); |
881 | int ieee80211_sta_disassociate(struct net_device *dev, u16 reason); | 881 | int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason); |
882 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | 882 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, |
883 | u32 changed); | 883 | u32 changed); |
884 | u32 ieee80211_reset_erp_info(struct net_device *dev); | 884 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); |
885 | int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, | 885 | int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, |
886 | struct ieee80211_ht_info *ht_info); | 886 | struct ieee80211_ht_info *ht_info); |
887 | int ieee80211_ht_addt_info_ie_to_ht_bss_info( | 887 | int ieee80211_ht_addt_info_ie_to_ht_bss_info( |
888 | struct ieee80211_ht_addt_info *ht_add_info_ie, | 888 | struct ieee80211_ht_addt_info *ht_add_info_ie, |
889 | struct ieee80211_ht_bss_info *bss_info); | 889 | struct ieee80211_ht_bss_info *bss_info); |
890 | void ieee80211_send_addba_request(struct net_device *dev, const u8 *da, | 890 | void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, const u8 *da, |
891 | u16 tid, u8 dialog_token, u16 start_seq_num, | 891 | u16 tid, u8 dialog_token, u16 start_seq_num, |
892 | u16 agg_size, u16 timeout); | 892 | u16 agg_size, u16 timeout); |
893 | void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, | 893 | void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, const u8 *da, u16 tid, |
894 | u16 initiator, u16 reason_code); | 894 | u16 initiator, u16 reason_code); |
895 | void ieee80211_send_bar(struct net_device *dev, u8 *ra, u16 tid, u16 ssn); | 895 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); |
896 | 896 | ||
897 | void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da, | 897 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, |
898 | u16 tid, u16 initiator, u16 reason); | 898 | u16 tid, u16 initiator, u16 reason); |
899 | void sta_addba_resp_timer_expired(unsigned long data); | 899 | void sta_addba_resp_timer_expired(unsigned long data); |
900 | void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr); | 900 | void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr); |
901 | u64 ieee80211_sta_get_rates(struct ieee80211_local *local, | 901 | u64 ieee80211_sta_get_rates(struct ieee80211_local *local, |
902 | struct ieee802_11_elems *elems, | 902 | struct ieee802_11_elems *elems, |
903 | enum ieee80211_band band); | 903 | enum ieee80211_band band); |
904 | void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb, | 904 | void ieee80211_sta_tx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, |
905 | int encrypt); | 905 | int encrypt); |
906 | void ieee802_11_parse_elems(u8 *start, size_t len, | 906 | void ieee802_11_parse_elems(u8 *start, size_t len, |
907 | struct ieee802_11_elems *elems); | 907 | struct ieee802_11_elems *elems); |
908 | 908 | ||
909 | #ifdef CONFIG_MAC80211_MESH | 909 | #ifdef CONFIG_MAC80211_MESH |
910 | void ieee80211_start_mesh(struct net_device *dev); | 910 | void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata); |
911 | #else | 911 | #else |
912 | static inline void ieee80211_start_mesh(struct net_device *dev) | 912 | static inline void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) |
913 | {} | 913 | {} |
914 | #endif | 914 | #endif |
915 | 915 | ||
@@ -920,7 +920,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
920 | struct vif_params *params); | 920 | struct vif_params *params); |
921 | int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | 921 | int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, |
922 | enum ieee80211_if_types type); | 922 | enum ieee80211_if_types type); |
923 | void ieee80211_if_remove(struct net_device *dev); | 923 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); |
924 | void ieee80211_remove_interfaces(struct ieee80211_local *local); | 924 | void ieee80211_remove_interfaces(struct ieee80211_local *local); |
925 | 925 | ||
926 | /* tx handling */ | 926 | /* tx handling */ |
@@ -938,7 +938,7 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, | |||
938 | enum ieee80211_if_types type); | 938 | enum ieee80211_if_types type); |
939 | int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, | 939 | int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, |
940 | int rate, int erp, int short_preamble); | 940 | int rate, int erp, int short_preamble); |
941 | void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx, | 941 | void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, |
942 | struct ieee80211_hdr *hdr); | 942 | struct ieee80211_hdr *hdr); |
943 | 943 | ||
944 | #ifdef CONFIG_MAC80211_NOINLINE | 944 | #ifdef CONFIG_MAC80211_NOINLINE |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 610ed1d9893..4a623b8e91f 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -56,7 +56,7 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
56 | case IEEE80211_IF_TYPE_MESH_POINT: | 56 | case IEEE80211_IF_TYPE_MESH_POINT: |
57 | /* Allow compiler to elide mesh_rmc_free call. */ | 57 | /* Allow compiler to elide mesh_rmc_free call. */ |
58 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 58 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
59 | mesh_rmc_free(dev); | 59 | mesh_rmc_free(sdata); |
60 | /* fall through */ | 60 | /* fall through */ |
61 | case IEEE80211_IF_TYPE_STA: | 61 | case IEEE80211_IF_TYPE_STA: |
62 | case IEEE80211_IF_TYPE_IBSS: | 62 | case IEEE80211_IF_TYPE_IBSS: |
@@ -241,15 +241,13 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
241 | return ret; | 241 | return ret; |
242 | } | 242 | } |
243 | 243 | ||
244 | void ieee80211_if_remove(struct net_device *dev) | 244 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) |
245 | { | 245 | { |
246 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
247 | |||
248 | ASSERT_RTNL(); | 246 | ASSERT_RTNL(); |
249 | 247 | ||
250 | list_del_rcu(&sdata->list); | 248 | list_del_rcu(&sdata->list); |
251 | synchronize_rcu(); | 249 | synchronize_rcu(); |
252 | unregister_netdevice(dev); | 250 | unregister_netdevice(sdata->dev); |
253 | } | 251 | } |
254 | 252 | ||
255 | /* | 253 | /* |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 93dcdc27254..81963948665 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -347,8 +347,8 @@ static int ieee80211_open(struct net_device *dev) | |||
347 | goto err_stop; | 347 | goto err_stop; |
348 | 348 | ||
349 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 349 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
350 | ieee80211_start_mesh(sdata->dev); | 350 | ieee80211_start_mesh(sdata); |
351 | changed |= ieee80211_reset_erp_info(dev); | 351 | changed |= ieee80211_reset_erp_info(sdata); |
352 | ieee80211_bss_info_change_notify(sdata, changed); | 352 | ieee80211_bss_info_change_notify(sdata, changed); |
353 | ieee80211_enable_keys(sdata); | 353 | ieee80211_enable_keys(sdata); |
354 | 354 | ||
@@ -448,7 +448,7 @@ static int ieee80211_stop(struct net_device *dev) | |||
448 | 448 | ||
449 | list_for_each_entry_rcu(sta, &local->sta_list, list) { | 449 | list_for_each_entry_rcu(sta, &local->sta_list, list) { |
450 | if (sta->sdata == sdata) | 450 | if (sta->sdata == sdata) |
451 | ieee80211_sta_tear_down_BA_sessions(dev, sta->addr); | 451 | ieee80211_sta_tear_down_BA_sessions(sdata, sta->addr); |
452 | } | 452 | } |
453 | 453 | ||
454 | rcu_read_unlock(); | 454 | rcu_read_unlock(); |
@@ -706,7 +706,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |||
706 | sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num; | 706 | sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num; |
707 | 707 | ||
708 | 708 | ||
709 | ieee80211_send_addba_request(sta->sdata->dev, ra, tid, | 709 | ieee80211_send_addba_request(sta->sdata, ra, tid, |
710 | sta->ampdu_mlme.tid_tx[tid]->dialog_token, | 710 | sta->ampdu_mlme.tid_tx[tid]->dialog_token, |
711 | sta->ampdu_mlme.tid_tx[tid]->ssn, | 711 | sta->ampdu_mlme.tid_tx[tid]->ssn, |
712 | 0x40, 5000); | 712 | 0x40, 5000); |
@@ -889,7 +889,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) | |||
889 | } | 889 | } |
890 | 890 | ||
891 | if (*state & HT_AGG_STATE_INITIATOR_MSK) | 891 | if (*state & HT_AGG_STATE_INITIATOR_MSK) |
892 | ieee80211_send_delba(sta->sdata->dev, ra, tid, | 892 | ieee80211_send_delba(sta->sdata, ra, tid, |
893 | WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); | 893 | WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); |
894 | 894 | ||
895 | agg_queue = sta->tid_to_tx_q[tid]; | 895 | agg_queue = sta->tid_to_tx_q[tid]; |
@@ -1200,10 +1200,8 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | |||
1200 | changed); | 1200 | changed); |
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | u32 ieee80211_reset_erp_info(struct net_device *dev) | 1203 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) |
1204 | { | 1204 | { |
1205 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1206 | |||
1207 | sdata->bss_conf.use_cts_prot = 0; | 1205 | sdata->bss_conf.use_cts_prot = 0; |
1208 | sdata->bss_conf.use_short_preamble = 0; | 1206 | sdata->bss_conf.use_short_preamble = 0; |
1209 | return BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_PREAMBLE; | 1207 | return BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_PREAMBLE; |
@@ -1438,7 +1436,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1438 | tid = qc[0] & 0xf; | 1436 | tid = qc[0] & 0xf; |
1439 | ssn = ((le16_to_cpu(hdr->seq_ctrl) + 0x10) | 1437 | ssn = ((le16_to_cpu(hdr->seq_ctrl) + 0x10) |
1440 | & IEEE80211_SCTL_SEQ); | 1438 | & IEEE80211_SCTL_SEQ); |
1441 | ieee80211_send_bar(sta->sdata->dev, hdr->addr1, | 1439 | ieee80211_send_bar(sta->sdata, hdr->addr1, |
1442 | tid, ssn); | 1440 | tid, ssn); |
1443 | } | 1441 | } |
1444 | } | 1442 | } |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index b5933b27149..b631703bcc8 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -39,14 +39,13 @@ void ieee80211s_stop(void) | |||
39 | * mesh_matches_local - check if the config of a mesh point matches ours | 39 | * mesh_matches_local - check if the config of a mesh point matches ours |
40 | * | 40 | * |
41 | * @ie: information elements of a management frame from the mesh peer | 41 | * @ie: information elements of a management frame from the mesh peer |
42 | * @dev: local mesh interface | 42 | * @sdata: local mesh subif |
43 | * | 43 | * |
44 | * This function checks if the mesh configuration of a mesh point matches the | 44 | * This function checks if the mesh configuration of a mesh point matches the |
45 | * local mesh configuration, i.e. if both nodes belong to the same mesh network. | 45 | * local mesh configuration, i.e. if both nodes belong to the same mesh network. |
46 | */ | 46 | */ |
47 | bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev) | 47 | bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_data *sdata) |
48 | { | 48 | { |
49 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
50 | struct ieee80211_if_sta *sta = &sdata->u.sta; | 49 | struct ieee80211_if_sta *sta = &sdata->u.sta; |
51 | 50 | ||
52 | /* | 51 | /* |
@@ -73,10 +72,8 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev) | |||
73 | * mesh_peer_accepts_plinks - check if an mp is willing to establish peer links | 72 | * mesh_peer_accepts_plinks - check if an mp is willing to establish peer links |
74 | * | 73 | * |
75 | * @ie: information elements of a management frame from the mesh peer | 74 | * @ie: information elements of a management frame from the mesh peer |
76 | * @dev: local mesh interface | ||
77 | */ | 75 | */ |
78 | bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie, | 76 | bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) |
79 | struct net_device *dev) | ||
80 | { | 77 | { |
81 | return (*(ie->mesh_config + CAPAB_OFFSET) & ACCEPT_PLINKS) != 0; | 78 | return (*(ie->mesh_config + CAPAB_OFFSET) & ACCEPT_PLINKS) != 0; |
82 | } | 79 | } |
@@ -111,9 +108,8 @@ void mesh_ids_set_default(struct ieee80211_if_sta *sta) | |||
111 | memcpy(sta->mesh_cc_id, def_id, 4); | 108 | memcpy(sta->mesh_cc_id, def_id, 4); |
112 | } | 109 | } |
113 | 110 | ||
114 | int mesh_rmc_init(struct net_device *dev) | 111 | int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) |
115 | { | 112 | { |
116 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
117 | int i; | 113 | int i; |
118 | 114 | ||
119 | sdata->u.sta.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL); | 115 | sdata->u.sta.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL); |
@@ -125,9 +121,8 @@ int mesh_rmc_init(struct net_device *dev) | |||
125 | return 0; | 121 | return 0; |
126 | } | 122 | } |
127 | 123 | ||
128 | void mesh_rmc_free(struct net_device *dev) | 124 | void mesh_rmc_free(struct ieee80211_sub_if_data *sdata) |
129 | { | 125 | { |
130 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
131 | struct mesh_rmc *rmc = sdata->u.sta.rmc; | 126 | struct mesh_rmc *rmc = sdata->u.sta.rmc; |
132 | struct rmc_entry *p, *n; | 127 | struct rmc_entry *p, *n; |
133 | int i; | 128 | int i; |
@@ -158,9 +153,8 @@ void mesh_rmc_free(struct net_device *dev) | |||
158 | * it. | 153 | * it. |
159 | */ | 154 | */ |
160 | int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, | 155 | int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, |
161 | struct net_device *dev) | 156 | struct ieee80211_sub_if_data *sdata) |
162 | { | 157 | { |
163 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
164 | struct mesh_rmc *rmc = sdata->u.sta.rmc; | 158 | struct mesh_rmc *rmc = sdata->u.sta.rmc; |
165 | u32 seqnum = 0; | 159 | u32 seqnum = 0; |
166 | int entries = 0; | 160 | int entries = 0; |
@@ -194,10 +188,9 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, | |||
194 | return 0; | 188 | return 0; |
195 | } | 189 | } |
196 | 190 | ||
197 | void mesh_mgmt_ies_add(struct sk_buff *skb, struct net_device *dev) | 191 | void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) |
198 | { | 192 | { |
199 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 193 | struct ieee80211_local *local = sdata->local; |
200 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
201 | struct ieee80211_supported_band *sband; | 194 | struct ieee80211_supported_band *sband; |
202 | u8 *pos; | 195 | u8 *pos; |
203 | int len, i, rate; | 196 | int len, i, rate; |
@@ -262,10 +255,10 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct net_device *dev) | |||
262 | return; | 255 | return; |
263 | } | 256 | } |
264 | 257 | ||
265 | u32 mesh_table_hash(u8 *addr, struct net_device *dev, struct mesh_table *tbl) | 258 | u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata, struct mesh_table *tbl) |
266 | { | 259 | { |
267 | /* Use last four bytes of hw addr and interface index as hash index */ | 260 | /* Use last four bytes of hw addr and interface index as hash index */ |
268 | return jhash_2words(*(u32 *)(addr+2), dev->ifindex, tbl->hash_rnd) | 261 | return jhash_2words(*(u32 *)(addr+2), sdata->dev->ifindex, tbl->hash_rnd) |
269 | & tbl->hash_mask; | 262 | & tbl->hash_mask; |
270 | } | 263 | } |
271 | 264 | ||
@@ -434,7 +427,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) | |||
434 | ifsta->preq_id = 0; | 427 | ifsta->preq_id = 0; |
435 | ifsta->dsn = 0; | 428 | ifsta->dsn = 0; |
436 | atomic_set(&ifsta->mpaths, 0); | 429 | atomic_set(&ifsta->mpaths, 0); |
437 | mesh_rmc_init(sdata->dev); | 430 | mesh_rmc_init(sdata); |
438 | ifsta->last_preq = jiffies; | 431 | ifsta->last_preq = jiffies; |
439 | /* Allocate all mesh structures when creating the first mesh interface. */ | 432 | /* Allocate all mesh structures when creating the first mesh interface. */ |
440 | if (!mesh_allocated) | 433 | if (!mesh_allocated) |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 7495fbb0d21..84ff5d828fd 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -47,7 +47,7 @@ enum mesh_path_flags { | |||
47 | * struct mesh_path - mac80211 mesh path structure | 47 | * struct mesh_path - mac80211 mesh path structure |
48 | * | 48 | * |
49 | * @dst: mesh path destination mac address | 49 | * @dst: mesh path destination mac address |
50 | * @dev: mesh path device | 50 | * @sdata: mesh subif |
51 | * @next_hop: mesh neighbor to which frames for this destination will be | 51 | * @next_hop: mesh neighbor to which frames for this destination will be |
52 | * forwarded | 52 | * forwarded |
53 | * @timer: mesh path discovery timer | 53 | * @timer: mesh path discovery timer |
@@ -64,14 +64,14 @@ enum mesh_path_flags { | |||
64 | * @state_lock: mesh pat state lock | 64 | * @state_lock: mesh pat state lock |
65 | * | 65 | * |
66 | * | 66 | * |
67 | * The combination of dst and dev is unique in the mesh path table. Since the | 67 | * The combination of dst and sdata is unique in the mesh path table. Since the |
68 | * next_hop STA is only protected by RCU as well, deleting the STA must also | 68 | * next_hop STA is only protected by RCU as well, deleting the STA must also |
69 | * remove/substitute the mesh_path structure and wait until that is no longer | 69 | * remove/substitute the mesh_path structure and wait until that is no longer |
70 | * reachable before destroying the STA completely. | 70 | * reachable before destroying the STA completely. |
71 | */ | 71 | */ |
72 | struct mesh_path { | 72 | struct mesh_path { |
73 | u8 dst[ETH_ALEN]; | 73 | u8 dst[ETH_ALEN]; |
74 | struct net_device *dev; | 74 | struct ieee80211_sub_if_data *sdata; |
75 | struct sta_info *next_hop; | 75 | struct sta_info *next_hop; |
76 | struct timer_list timer; | 76 | struct timer_list timer; |
77 | struct sk_buff_head frame_queue; | 77 | struct sk_buff_head frame_queue; |
@@ -203,59 +203,66 @@ int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); | |||
203 | int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr, | 203 | int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr, |
204 | struct ieee80211_sub_if_data *sdata); | 204 | struct ieee80211_sub_if_data *sdata); |
205 | int mesh_rmc_check(u8 *addr, struct ieee80211s_hdr *mesh_hdr, | 205 | int mesh_rmc_check(u8 *addr, struct ieee80211s_hdr *mesh_hdr, |
206 | struct net_device *dev); | 206 | struct ieee80211_sub_if_data *sdata); |
207 | bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev); | 207 | bool mesh_matches_local(struct ieee802_11_elems *ie, |
208 | struct ieee80211_sub_if_data *sdata); | ||
208 | void mesh_ids_set_default(struct ieee80211_if_sta *sta); | 209 | void mesh_ids_set_default(struct ieee80211_if_sta *sta); |
209 | void mesh_mgmt_ies_add(struct sk_buff *skb, struct net_device *dev); | 210 | void mesh_mgmt_ies_add(struct sk_buff *skb, |
210 | void mesh_rmc_free(struct net_device *dev); | 211 | struct ieee80211_sub_if_data *sdata); |
211 | int mesh_rmc_init(struct net_device *dev); | 212 | void mesh_rmc_free(struct ieee80211_sub_if_data *sdata); |
213 | int mesh_rmc_init(struct ieee80211_sub_if_data *sdata); | ||
212 | void ieee80211s_init(void); | 214 | void ieee80211s_init(void); |
213 | void ieee80211s_stop(void); | 215 | void ieee80211s_stop(void); |
214 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); | 216 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); |
215 | 217 | ||
216 | /* Mesh paths */ | 218 | /* Mesh paths */ |
217 | int mesh_nexthop_lookup(struct sk_buff *skb, struct net_device *dev); | 219 | int mesh_nexthop_lookup(struct sk_buff *skb, |
218 | void mesh_path_start_discovery(struct net_device *dev); | 220 | struct ieee80211_sub_if_data *sdata); |
219 | struct mesh_path *mesh_path_lookup(u8 *dst, struct net_device *dev); | 221 | void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata); |
220 | struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev); | 222 | struct mesh_path *mesh_path_lookup(u8 *dst, |
223 | struct ieee80211_sub_if_data *sdata); | ||
224 | struct mesh_path *mesh_path_lookup_by_idx(int idx, | ||
225 | struct ieee80211_sub_if_data *sdata); | ||
221 | void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop); | 226 | void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop); |
222 | void mesh_path_expire(struct net_device *dev); | 227 | void mesh_path_expire(struct ieee80211_sub_if_data *sdata); |
223 | void mesh_path_flush(struct net_device *dev); | 228 | void mesh_path_flush(struct ieee80211_sub_if_data *sdata); |
224 | void mesh_rx_path_sel_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | 229 | void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata, |
225 | size_t len); | 230 | struct ieee80211_mgmt *mgmt, size_t len); |
226 | int mesh_path_add(u8 *dst, struct net_device *dev); | 231 | int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata); |
227 | /* Mesh plinks */ | 232 | /* Mesh plinks */ |
228 | void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct net_device *dev, | 233 | void mesh_neighbour_update(u8 *hw_addr, u64 rates, |
229 | bool add); | 234 | struct ieee80211_sub_if_data *sdata, bool add); |
230 | bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie, | 235 | bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie); |
231 | struct net_device *dev); | ||
232 | void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata); | 236 | void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata); |
233 | void mesh_plink_broken(struct sta_info *sta); | 237 | void mesh_plink_broken(struct sta_info *sta); |
234 | void mesh_plink_deactivate(struct sta_info *sta); | 238 | void mesh_plink_deactivate(struct sta_info *sta); |
235 | int mesh_plink_open(struct sta_info *sta); | 239 | int mesh_plink_open(struct sta_info *sta); |
236 | int mesh_plink_close(struct sta_info *sta); | 240 | int mesh_plink_close(struct sta_info *sta); |
237 | void mesh_plink_block(struct sta_info *sta); | 241 | void mesh_plink_block(struct sta_info *sta); |
238 | void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | 242 | void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, |
239 | size_t len, struct ieee80211_rx_status *rx_status); | 243 | struct ieee80211_mgmt *mgmt, size_t len, |
244 | struct ieee80211_rx_status *rx_status); | ||
240 | 245 | ||
241 | /* Private interfaces */ | 246 | /* Private interfaces */ |
242 | /* Mesh tables */ | 247 | /* Mesh tables */ |
243 | struct mesh_table *mesh_table_alloc(int size_order); | 248 | struct mesh_table *mesh_table_alloc(int size_order); |
244 | void mesh_table_free(struct mesh_table *tbl, bool free_leafs); | 249 | void mesh_table_free(struct mesh_table *tbl, bool free_leafs); |
245 | struct mesh_table *mesh_table_grow(struct mesh_table *tbl); | 250 | struct mesh_table *mesh_table_grow(struct mesh_table *tbl); |
246 | u32 mesh_table_hash(u8 *addr, struct net_device *dev, struct mesh_table *tbl); | 251 | u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata, |
252 | struct mesh_table *tbl); | ||
247 | /* Mesh paths */ | 253 | /* Mesh paths */ |
248 | int mesh_path_error_tx(u8 *dest, __le32 dest_dsn, u8 *ra, | 254 | int mesh_path_error_tx(u8 *dest, __le32 dest_dsn, u8 *ra, |
249 | struct net_device *dev); | 255 | struct ieee80211_sub_if_data *sdata); |
250 | void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta); | 256 | void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta); |
251 | void mesh_path_flush_pending(struct mesh_path *mpath); | 257 | void mesh_path_flush_pending(struct mesh_path *mpath); |
252 | void mesh_path_tx_pending(struct mesh_path *mpath); | 258 | void mesh_path_tx_pending(struct mesh_path *mpath); |
253 | int mesh_pathtbl_init(void); | 259 | int mesh_pathtbl_init(void); |
254 | void mesh_pathtbl_unregister(void); | 260 | void mesh_pathtbl_unregister(void); |
255 | int mesh_path_del(u8 *addr, struct net_device *dev); | 261 | int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata); |
256 | void mesh_path_timer(unsigned long data); | 262 | void mesh_path_timer(unsigned long data); |
257 | void mesh_path_flush_by_nexthop(struct sta_info *sta); | 263 | void mesh_path_flush_by_nexthop(struct sta_info *sta); |
258 | void mesh_path_discard_frame(struct sk_buff *skb, struct net_device *dev); | 264 | void mesh_path_discard_frame(struct sk_buff *skb, |
265 | struct ieee80211_sub_if_data *sdata); | ||
259 | 266 | ||
260 | #ifdef CONFIG_MAC80211_MESH | 267 | #ifdef CONFIG_MAC80211_MESH |
261 | extern int mesh_allocated; | 268 | extern int mesh_allocated; |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 2cdbd522631..eeb0ce2d5d3 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -82,9 +82,9 @@ enum mpath_frame_type { | |||
82 | static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, | 82 | static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, |
83 | u8 *orig_addr, __le32 orig_dsn, u8 dst_flags, u8 *dst, | 83 | u8 *orig_addr, __le32 orig_dsn, u8 dst_flags, u8 *dst, |
84 | __le32 dst_dsn, u8 *da, u8 hop_count, u8 ttl, __le32 lifetime, | 84 | __le32 dst_dsn, u8 *da, u8 hop_count, u8 ttl, __le32 lifetime, |
85 | __le32 metric, __le32 preq_id, struct net_device *dev) | 85 | __le32 metric, __le32 preq_id, struct ieee80211_sub_if_data *sdata) |
86 | { | 86 | { |
87 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 87 | struct ieee80211_local *local = sdata->local; |
88 | struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); | 88 | struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); |
89 | struct ieee80211_mgmt *mgmt; | 89 | struct ieee80211_mgmt *mgmt; |
90 | u8 *pos; | 90 | u8 *pos; |
@@ -103,7 +103,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, | |||
103 | IEEE80211_STYPE_ACTION); | 103 | IEEE80211_STYPE_ACTION); |
104 | 104 | ||
105 | memcpy(mgmt->da, da, ETH_ALEN); | 105 | memcpy(mgmt->da, da, ETH_ALEN); |
106 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 106 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
107 | /* BSSID is left zeroed, wildcard value */ | 107 | /* BSSID is left zeroed, wildcard value */ |
108 | mgmt->u.action.category = MESH_PATH_SEL_CATEGORY; | 108 | mgmt->u.action.category = MESH_PATH_SEL_CATEGORY; |
109 | mgmt->u.action.u.mesh_action.action_code = action; | 109 | mgmt->u.action.u.mesh_action.action_code = action; |
@@ -149,7 +149,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, | |||
149 | pos += ETH_ALEN; | 149 | pos += ETH_ALEN; |
150 | memcpy(pos, &dst_dsn, 4); | 150 | memcpy(pos, &dst_dsn, 4); |
151 | 151 | ||
152 | ieee80211_sta_tx(dev, skb, 0); | 152 | ieee80211_sta_tx(sdata, skb, 0); |
153 | return 0; | 153 | return 0; |
154 | } | 154 | } |
155 | 155 | ||
@@ -161,9 +161,9 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, | |||
161 | * @ra: node this frame is addressed to | 161 | * @ra: node this frame is addressed to |
162 | */ | 162 | */ |
163 | int mesh_path_error_tx(u8 *dst, __le32 dst_dsn, u8 *ra, | 163 | int mesh_path_error_tx(u8 *dst, __le32 dst_dsn, u8 *ra, |
164 | struct net_device *dev) | 164 | struct ieee80211_sub_if_data *sdata) |
165 | { | 165 | { |
166 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 166 | struct ieee80211_local *local = sdata->local; |
167 | struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); | 167 | struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); |
168 | struct ieee80211_mgmt *mgmt; | 168 | struct ieee80211_mgmt *mgmt; |
169 | u8 *pos; | 169 | u8 *pos; |
@@ -182,7 +182,7 @@ int mesh_path_error_tx(u8 *dst, __le32 dst_dsn, u8 *ra, | |||
182 | IEEE80211_STYPE_ACTION); | 182 | IEEE80211_STYPE_ACTION); |
183 | 183 | ||
184 | memcpy(mgmt->da, ra, ETH_ALEN); | 184 | memcpy(mgmt->da, ra, ETH_ALEN); |
185 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 185 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
186 | /* BSSID is left zeroed, wildcard value */ | 186 | /* BSSID is left zeroed, wildcard value */ |
187 | mgmt->u.action.category = MESH_PATH_SEL_CATEGORY; | 187 | mgmt->u.action.category = MESH_PATH_SEL_CATEGORY; |
188 | mgmt->u.action.u.mesh_action.action_code = MPATH_PERR; | 188 | mgmt->u.action.u.mesh_action.action_code = MPATH_PERR; |
@@ -198,7 +198,7 @@ int mesh_path_error_tx(u8 *dst, __le32 dst_dsn, u8 *ra, | |||
198 | pos += ETH_ALEN; | 198 | pos += ETH_ALEN; |
199 | memcpy(pos, &dst_dsn, 4); | 199 | memcpy(pos, &dst_dsn, 4); |
200 | 200 | ||
201 | ieee80211_sta_tx(dev, skb, 0); | 201 | ieee80211_sta_tx(sdata, skb, 0); |
202 | return 0; | 202 | return 0; |
203 | } | 203 | } |
204 | 204 | ||
@@ -233,7 +233,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local, | |||
233 | /** | 233 | /** |
234 | * hwmp_route_info_get - Update routing info to originator and transmitter | 234 | * hwmp_route_info_get - Update routing info to originator and transmitter |
235 | * | 235 | * |
236 | * @dev: local mesh interface | 236 | * @sdata: local mesh subif |
237 | * @mgmt: mesh management frame | 237 | * @mgmt: mesh management frame |
238 | * @hwmp_ie: hwmp information element (PREP or PREQ) | 238 | * @hwmp_ie: hwmp information element (PREP or PREQ) |
239 | * | 239 | * |
@@ -246,11 +246,11 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local, | |||
246 | * Notes: this function is the only place (besides user-provided info) where | 246 | * Notes: this function is the only place (besides user-provided info) where |
247 | * path routing information is updated. | 247 | * path routing information is updated. |
248 | */ | 248 | */ |
249 | static u32 hwmp_route_info_get(struct net_device *dev, | 249 | static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, |
250 | struct ieee80211_mgmt *mgmt, | 250 | struct ieee80211_mgmt *mgmt, |
251 | u8 *hwmp_ie) | 251 | u8 *hwmp_ie) |
252 | { | 252 | { |
253 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 253 | struct ieee80211_local *local = sdata->local; |
254 | struct mesh_path *mpath; | 254 | struct mesh_path *mpath; |
255 | struct sta_info *sta; | 255 | struct sta_info *sta; |
256 | bool fresh_info; | 256 | bool fresh_info; |
@@ -301,14 +301,14 @@ static u32 hwmp_route_info_get(struct net_device *dev, | |||
301 | new_metric = MAX_METRIC; | 301 | new_metric = MAX_METRIC; |
302 | exp_time = TU_TO_EXP_TIME(orig_lifetime); | 302 | exp_time = TU_TO_EXP_TIME(orig_lifetime); |
303 | 303 | ||
304 | if (memcmp(orig_addr, dev->dev_addr, ETH_ALEN) == 0) { | 304 | if (memcmp(orig_addr, sdata->dev->dev_addr, ETH_ALEN) == 0) { |
305 | /* This MP is the originator, we are not interested in this | 305 | /* This MP is the originator, we are not interested in this |
306 | * frame, except for updating transmitter's path info. | 306 | * frame, except for updating transmitter's path info. |
307 | */ | 307 | */ |
308 | process = false; | 308 | process = false; |
309 | fresh_info = false; | 309 | fresh_info = false; |
310 | } else { | 310 | } else { |
311 | mpath = mesh_path_lookup(orig_addr, dev); | 311 | mpath = mesh_path_lookup(orig_addr, sdata); |
312 | if (mpath) { | 312 | if (mpath) { |
313 | spin_lock_bh(&mpath->state_lock); | 313 | spin_lock_bh(&mpath->state_lock); |
314 | if (mpath->flags & MESH_PATH_FIXED) | 314 | if (mpath->flags & MESH_PATH_FIXED) |
@@ -324,8 +324,8 @@ static u32 hwmp_route_info_get(struct net_device *dev, | |||
324 | } | 324 | } |
325 | } | 325 | } |
326 | } else { | 326 | } else { |
327 | mesh_path_add(orig_addr, dev); | 327 | mesh_path_add(orig_addr, sdata); |
328 | mpath = mesh_path_lookup(orig_addr, dev); | 328 | mpath = mesh_path_lookup(orig_addr, sdata); |
329 | if (!mpath) { | 329 | if (!mpath) { |
330 | rcu_read_unlock(); | 330 | rcu_read_unlock(); |
331 | return 0; | 331 | return 0; |
@@ -357,7 +357,7 @@ static u32 hwmp_route_info_get(struct net_device *dev, | |||
357 | else { | 357 | else { |
358 | fresh_info = true; | 358 | fresh_info = true; |
359 | 359 | ||
360 | mpath = mesh_path_lookup(ta, dev); | 360 | mpath = mesh_path_lookup(ta, sdata); |
361 | if (mpath) { | 361 | if (mpath) { |
362 | spin_lock_bh(&mpath->state_lock); | 362 | spin_lock_bh(&mpath->state_lock); |
363 | if ((mpath->flags & MESH_PATH_FIXED) || | 363 | if ((mpath->flags & MESH_PATH_FIXED) || |
@@ -365,8 +365,8 @@ static u32 hwmp_route_info_get(struct net_device *dev, | |||
365 | (last_hop_metric > mpath->metric))) | 365 | (last_hop_metric > mpath->metric))) |
366 | fresh_info = false; | 366 | fresh_info = false; |
367 | } else { | 367 | } else { |
368 | mesh_path_add(ta, dev); | 368 | mesh_path_add(ta, sdata); |
369 | mpath = mesh_path_lookup(ta, dev); | 369 | mpath = mesh_path_lookup(ta, sdata); |
370 | if (!mpath) { | 370 | if (!mpath) { |
371 | rcu_read_unlock(); | 371 | rcu_read_unlock(); |
372 | return 0; | 372 | return 0; |
@@ -392,10 +392,9 @@ static u32 hwmp_route_info_get(struct net_device *dev, | |||
392 | return process ? new_metric : 0; | 392 | return process ? new_metric : 0; |
393 | } | 393 | } |
394 | 394 | ||
395 | static void hwmp_preq_frame_process(struct net_device *dev, | 395 | static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, |
396 | struct ieee80211_mgmt *mgmt, | 396 | struct ieee80211_mgmt *mgmt, |
397 | u8 *preq_elem, u32 metric) { | 397 | u8 *preq_elem, u32 metric) { |
398 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
399 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 398 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
400 | struct mesh_path *mpath; | 399 | struct mesh_path *mpath; |
401 | u8 *dst_addr, *orig_addr; | 400 | u8 *dst_addr, *orig_addr; |
@@ -411,7 +410,7 @@ static void hwmp_preq_frame_process(struct net_device *dev, | |||
411 | orig_dsn = PREQ_IE_ORIG_DSN(preq_elem); | 410 | orig_dsn = PREQ_IE_ORIG_DSN(preq_elem); |
412 | dst_flags = PREQ_IE_DST_F(preq_elem); | 411 | dst_flags = PREQ_IE_DST_F(preq_elem); |
413 | 412 | ||
414 | if (memcmp(dst_addr, dev->dev_addr, ETH_ALEN) == 0) { | 413 | if (memcmp(dst_addr, sdata->dev->dev_addr, ETH_ALEN) == 0) { |
415 | forward = false; | 414 | forward = false; |
416 | reply = true; | 415 | reply = true; |
417 | metric = 0; | 416 | metric = 0; |
@@ -423,7 +422,7 @@ static void hwmp_preq_frame_process(struct net_device *dev, | |||
423 | } | 422 | } |
424 | } else { | 423 | } else { |
425 | rcu_read_lock(); | 424 | rcu_read_lock(); |
426 | mpath = mesh_path_lookup(dst_addr, dev); | 425 | mpath = mesh_path_lookup(dst_addr, sdata); |
427 | if (mpath) { | 426 | if (mpath) { |
428 | if ((!(mpath->flags & MESH_PATH_DSN_VALID)) || | 427 | if ((!(mpath->flags & MESH_PATH_DSN_VALID)) || |
429 | DSN_LT(mpath->dsn, dst_dsn)) { | 428 | DSN_LT(mpath->dsn, dst_dsn)) { |
@@ -451,7 +450,7 @@ static void hwmp_preq_frame_process(struct net_device *dev, | |||
451 | cpu_to_le32(dst_dsn), 0, orig_addr, | 450 | cpu_to_le32(dst_dsn), 0, orig_addr, |
452 | cpu_to_le32(orig_dsn), mgmt->sa, 0, ttl, | 451 | cpu_to_le32(orig_dsn), mgmt->sa, 0, ttl, |
453 | cpu_to_le32(lifetime), cpu_to_le32(metric), | 452 | cpu_to_le32(lifetime), cpu_to_le32(metric), |
454 | 0, dev); | 453 | 0, sdata); |
455 | else | 454 | else |
456 | ifsta->mshstats.dropped_frames_ttl++; | 455 | ifsta->mshstats.dropped_frames_ttl++; |
457 | } | 456 | } |
@@ -472,20 +471,19 @@ static void hwmp_preq_frame_process(struct net_device *dev, | |||
472 | hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; | 471 | hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; |
473 | mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr, | 472 | mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr, |
474 | cpu_to_le32(orig_dsn), dst_flags, dst_addr, | 473 | cpu_to_le32(orig_dsn), dst_flags, dst_addr, |
475 | cpu_to_le32(dst_dsn), dev->broadcast, | 474 | cpu_to_le32(dst_dsn), sdata->dev->broadcast, |
476 | hopcount, ttl, cpu_to_le32(lifetime), | 475 | hopcount, ttl, cpu_to_le32(lifetime), |
477 | cpu_to_le32(metric), cpu_to_le32(preq_id), | 476 | cpu_to_le32(metric), cpu_to_le32(preq_id), |
478 | dev); | 477 | sdata); |
479 | ifsta->mshstats.fwded_frames++; | 478 | ifsta->mshstats.fwded_frames++; |
480 | } | 479 | } |
481 | } | 480 | } |
482 | 481 | ||
483 | 482 | ||
484 | static void hwmp_prep_frame_process(struct net_device *dev, | 483 | static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, |
485 | struct ieee80211_mgmt *mgmt, | 484 | struct ieee80211_mgmt *mgmt, |
486 | u8 *prep_elem, u32 metric) | 485 | u8 *prep_elem, u32 metric) |
487 | { | 486 | { |
488 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
489 | struct mesh_path *mpath; | 487 | struct mesh_path *mpath; |
490 | u8 *dst_addr, *orig_addr; | 488 | u8 *dst_addr, *orig_addr; |
491 | u8 ttl, hopcount, flags; | 489 | u8 ttl, hopcount, flags; |
@@ -499,7 +497,7 @@ static void hwmp_prep_frame_process(struct net_device *dev, | |||
499 | * replies | 497 | * replies |
500 | */ | 498 | */ |
501 | dst_addr = PREP_IE_DST_ADDR(prep_elem); | 499 | dst_addr = PREP_IE_DST_ADDR(prep_elem); |
502 | if (memcmp(dst_addr, dev->dev_addr, ETH_ALEN) == 0) | 500 | if (memcmp(dst_addr, sdata->dev->dev_addr, ETH_ALEN) == 0) |
503 | /* destination, no forwarding required */ | 501 | /* destination, no forwarding required */ |
504 | return; | 502 | return; |
505 | 503 | ||
@@ -510,7 +508,7 @@ static void hwmp_prep_frame_process(struct net_device *dev, | |||
510 | } | 508 | } |
511 | 509 | ||
512 | rcu_read_lock(); | 510 | rcu_read_lock(); |
513 | mpath = mesh_path_lookup(dst_addr, dev); | 511 | mpath = mesh_path_lookup(dst_addr, sdata); |
514 | if (mpath) | 512 | if (mpath) |
515 | spin_lock_bh(&mpath->state_lock); | 513 | spin_lock_bh(&mpath->state_lock); |
516 | else | 514 | else |
@@ -533,7 +531,7 @@ static void hwmp_prep_frame_process(struct net_device *dev, | |||
533 | cpu_to_le32(orig_dsn), 0, dst_addr, | 531 | cpu_to_le32(orig_dsn), 0, dst_addr, |
534 | cpu_to_le32(dst_dsn), mpath->next_hop->addr, hopcount, ttl, | 532 | cpu_to_le32(dst_dsn), mpath->next_hop->addr, hopcount, ttl, |
535 | cpu_to_le32(lifetime), cpu_to_le32(metric), | 533 | cpu_to_le32(lifetime), cpu_to_le32(metric), |
536 | 0, dev); | 534 | 0, sdata); |
537 | rcu_read_unlock(); | 535 | rcu_read_unlock(); |
538 | sdata->u.sta.mshstats.fwded_frames++; | 536 | sdata->u.sta.mshstats.fwded_frames++; |
539 | return; | 537 | return; |
@@ -544,7 +542,7 @@ fail: | |||
544 | return; | 542 | return; |
545 | } | 543 | } |
546 | 544 | ||
547 | static void hwmp_perr_frame_process(struct net_device *dev, | 545 | static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata, |
548 | struct ieee80211_mgmt *mgmt, u8 *perr_elem) | 546 | struct ieee80211_mgmt *mgmt, u8 *perr_elem) |
549 | { | 547 | { |
550 | struct mesh_path *mpath; | 548 | struct mesh_path *mpath; |
@@ -555,7 +553,7 @@ static void hwmp_perr_frame_process(struct net_device *dev, | |||
555 | dst_addr = PERR_IE_DST_ADDR(perr_elem); | 553 | dst_addr = PERR_IE_DST_ADDR(perr_elem); |
556 | dst_dsn = PERR_IE_DST_DSN(perr_elem); | 554 | dst_dsn = PERR_IE_DST_DSN(perr_elem); |
557 | rcu_read_lock(); | 555 | rcu_read_lock(); |
558 | mpath = mesh_path_lookup(dst_addr, dev); | 556 | mpath = mesh_path_lookup(dst_addr, sdata); |
559 | if (mpath) { | 557 | if (mpath) { |
560 | spin_lock_bh(&mpath->state_lock); | 558 | spin_lock_bh(&mpath->state_lock); |
561 | if (mpath->flags & MESH_PATH_ACTIVE && | 559 | if (mpath->flags & MESH_PATH_ACTIVE && |
@@ -566,7 +564,7 @@ static void hwmp_perr_frame_process(struct net_device *dev, | |||
566 | mpath->dsn = dst_dsn; | 564 | mpath->dsn = dst_dsn; |
567 | spin_unlock_bh(&mpath->state_lock); | 565 | spin_unlock_bh(&mpath->state_lock); |
568 | mesh_path_error_tx(dst_addr, cpu_to_le32(dst_dsn), | 566 | mesh_path_error_tx(dst_addr, cpu_to_le32(dst_dsn), |
569 | dev->broadcast, dev); | 567 | sdata->dev->broadcast, sdata); |
570 | } else | 568 | } else |
571 | spin_unlock_bh(&mpath->state_lock); | 569 | spin_unlock_bh(&mpath->state_lock); |
572 | } | 570 | } |
@@ -575,7 +573,7 @@ static void hwmp_perr_frame_process(struct net_device *dev, | |||
575 | 573 | ||
576 | 574 | ||
577 | 575 | ||
578 | void mesh_rx_path_sel_frame(struct net_device *dev, | 576 | void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata, |
579 | struct ieee80211_mgmt *mgmt, | 577 | struct ieee80211_mgmt *mgmt, |
580 | size_t len) | 578 | size_t len) |
581 | { | 579 | { |
@@ -592,25 +590,25 @@ void mesh_rx_path_sel_frame(struct net_device *dev, | |||
592 | if (!elems.preq || elems.preq_len != 37) | 590 | if (!elems.preq || elems.preq_len != 37) |
593 | /* Right now we support just 1 destination and no AE */ | 591 | /* Right now we support just 1 destination and no AE */ |
594 | return; | 592 | return; |
595 | last_hop_metric = hwmp_route_info_get(dev, mgmt, elems.preq); | 593 | last_hop_metric = hwmp_route_info_get(sdata, mgmt, elems.preq); |
596 | if (!last_hop_metric) | 594 | if (!last_hop_metric) |
597 | return; | 595 | return; |
598 | hwmp_preq_frame_process(dev, mgmt, elems.preq, last_hop_metric); | 596 | hwmp_preq_frame_process(sdata, mgmt, elems.preq, last_hop_metric); |
599 | break; | 597 | break; |
600 | case MPATH_PREP: | 598 | case MPATH_PREP: |
601 | if (!elems.prep || elems.prep_len != 31) | 599 | if (!elems.prep || elems.prep_len != 31) |
602 | /* Right now we support no AE */ | 600 | /* Right now we support no AE */ |
603 | return; | 601 | return; |
604 | last_hop_metric = hwmp_route_info_get(dev, mgmt, elems.prep); | 602 | last_hop_metric = hwmp_route_info_get(sdata, mgmt, elems.prep); |
605 | if (!last_hop_metric) | 603 | if (!last_hop_metric) |
606 | return; | 604 | return; |
607 | hwmp_prep_frame_process(dev, mgmt, elems.prep, last_hop_metric); | 605 | hwmp_prep_frame_process(sdata, mgmt, elems.prep, last_hop_metric); |
608 | break; | 606 | break; |
609 | case MPATH_PERR: | 607 | case MPATH_PERR: |
610 | if (!elems.perr || elems.perr_len != 12) | 608 | if (!elems.perr || elems.perr_len != 12) |
611 | /* Right now we support only one destination per PERR */ | 609 | /* Right now we support only one destination per PERR */ |
612 | return; | 610 | return; |
613 | hwmp_perr_frame_process(dev, mgmt, elems.perr); | 611 | hwmp_perr_frame_process(sdata, mgmt, elems.perr); |
614 | default: | 612 | default: |
615 | return; | 613 | return; |
616 | } | 614 | } |
@@ -628,8 +626,7 @@ void mesh_rx_path_sel_frame(struct net_device *dev, | |||
628 | */ | 626 | */ |
629 | static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) | 627 | static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) |
630 | { | 628 | { |
631 | struct ieee80211_sub_if_data *sdata = | 629 | struct ieee80211_sub_if_data *sdata = mpath->sdata; |
632 | IEEE80211_DEV_TO_SUB_IF(mpath->dev); | ||
633 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 630 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
634 | struct mesh_preq_queue *preq_node; | 631 | struct mesh_preq_queue *preq_node; |
635 | 632 | ||
@@ -672,12 +669,10 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) | |||
672 | /** | 669 | /** |
673 | * mesh_path_start_discovery - launch a path discovery from the PREQ queue | 670 | * mesh_path_start_discovery - launch a path discovery from the PREQ queue |
674 | * | 671 | * |
675 | * @dev: local mesh interface | 672 | * @sdata: local mesh subif |
676 | */ | 673 | */ |
677 | void mesh_path_start_discovery(struct net_device *dev) | 674 | void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) |
678 | { | 675 | { |
679 | struct ieee80211_sub_if_data *sdata = | ||
680 | IEEE80211_DEV_TO_SUB_IF(dev); | ||
681 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 676 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
682 | struct mesh_preq_queue *preq_node; | 677 | struct mesh_preq_queue *preq_node; |
683 | struct mesh_path *mpath; | 678 | struct mesh_path *mpath; |
@@ -699,7 +694,7 @@ void mesh_path_start_discovery(struct net_device *dev) | |||
699 | spin_unlock(&ifsta->mesh_preq_queue_lock); | 694 | spin_unlock(&ifsta->mesh_preq_queue_lock); |
700 | 695 | ||
701 | rcu_read_lock(); | 696 | rcu_read_lock(); |
702 | mpath = mesh_path_lookup(preq_node->dst, dev); | 697 | mpath = mesh_path_lookup(preq_node->dst, sdata); |
703 | if (!mpath) | 698 | if (!mpath) |
704 | goto enddiscovery; | 699 | goto enddiscovery; |
705 | 700 | ||
@@ -743,11 +738,11 @@ void mesh_path_start_discovery(struct net_device *dev) | |||
743 | dst_flags = MP_F_RF; | 738 | dst_flags = MP_F_RF; |
744 | 739 | ||
745 | spin_unlock_bh(&mpath->state_lock); | 740 | spin_unlock_bh(&mpath->state_lock); |
746 | mesh_path_sel_frame_tx(MPATH_PREQ, 0, dev->dev_addr, | 741 | mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->dev->dev_addr, |
747 | cpu_to_le32(ifsta->dsn), dst_flags, mpath->dst, | 742 | cpu_to_le32(ifsta->dsn), dst_flags, mpath->dst, |
748 | cpu_to_le32(mpath->dsn), dev->broadcast, 0, | 743 | cpu_to_le32(mpath->dsn), sdata->dev->broadcast, 0, |
749 | ttl, cpu_to_le32(lifetime), 0, | 744 | ttl, cpu_to_le32(lifetime), 0, |
750 | cpu_to_le32(ifsta->preq_id++), dev); | 745 | cpu_to_le32(ifsta->preq_id++), sdata); |
751 | mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); | 746 | mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); |
752 | 747 | ||
753 | enddiscovery: | 748 | enddiscovery: |
@@ -759,7 +754,7 @@ enddiscovery: | |||
759 | * ieee80211s_lookup_nexthop - put the appropriate next hop on a mesh frame | 754 | * ieee80211s_lookup_nexthop - put the appropriate next hop on a mesh frame |
760 | * | 755 | * |
761 | * @skb: 802.11 frame to be sent | 756 | * @skb: 802.11 frame to be sent |
762 | * @dev: network device the frame will be sent through | 757 | * @sdata: network subif the frame will be sent through |
763 | * @fwd_frame: true if this frame was originally from a different host | 758 | * @fwd_frame: true if this frame was originally from a different host |
764 | * | 759 | * |
765 | * Returns: 0 if the next hop was found. Nonzero otherwise. If no next hop is | 760 | * Returns: 0 if the next hop was found. Nonzero otherwise. If no next hop is |
@@ -767,9 +762,9 @@ enddiscovery: | |||
767 | * sent when the path is resolved. This means the caller must not free the skb | 762 | * sent when the path is resolved. This means the caller must not free the skb |
768 | * in this case. | 763 | * in this case. |
769 | */ | 764 | */ |
770 | int mesh_nexthop_lookup(struct sk_buff *skb, struct net_device *dev) | 765 | int mesh_nexthop_lookup(struct sk_buff *skb, |
766 | struct ieee80211_sub_if_data *sdata) | ||
771 | { | 767 | { |
772 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
773 | struct sk_buff *skb_to_free = NULL; | 768 | struct sk_buff *skb_to_free = NULL; |
774 | struct mesh_path *mpath; | 769 | struct mesh_path *mpath; |
775 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 770 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
@@ -777,11 +772,11 @@ int mesh_nexthop_lookup(struct sk_buff *skb, struct net_device *dev) | |||
777 | int err = 0; | 772 | int err = 0; |
778 | 773 | ||
779 | rcu_read_lock(); | 774 | rcu_read_lock(); |
780 | mpath = mesh_path_lookup(dst_addr, dev); | 775 | mpath = mesh_path_lookup(dst_addr, sdata); |
781 | 776 | ||
782 | if (!mpath) { | 777 | if (!mpath) { |
783 | mesh_path_add(dst_addr, dev); | 778 | mesh_path_add(dst_addr, sdata); |
784 | mpath = mesh_path_lookup(dst_addr, dev); | 779 | mpath = mesh_path_lookup(dst_addr, sdata); |
785 | if (!mpath) { | 780 | if (!mpath) { |
786 | dev_kfree_skb(skb); | 781 | dev_kfree_skb(skb); |
787 | sdata->u.sta.mshstats.dropped_frames_no_route++; | 782 | sdata->u.sta.mshstats.dropped_frames_no_route++; |
@@ -793,7 +788,8 @@ int mesh_nexthop_lookup(struct sk_buff *skb, struct net_device *dev) | |||
793 | if (mpath->flags & MESH_PATH_ACTIVE) { | 788 | if (mpath->flags & MESH_PATH_ACTIVE) { |
794 | if (time_after(jiffies, mpath->exp_time - | 789 | if (time_after(jiffies, mpath->exp_time - |
795 | msecs_to_jiffies(sdata->u.sta.mshcfg.path_refresh_time)) | 790 | msecs_to_jiffies(sdata->u.sta.mshcfg.path_refresh_time)) |
796 | && !memcmp(dev->dev_addr, hdr->addr4, ETH_ALEN) | 791 | && !memcmp(sdata->dev->dev_addr, hdr->addr4, |
792 | ETH_ALEN) | ||
797 | && !(mpath->flags & MESH_PATH_RESOLVING) | 793 | && !(mpath->flags & MESH_PATH_RESOLVING) |
798 | && !(mpath->flags & MESH_PATH_FIXED)) { | 794 | && !(mpath->flags & MESH_PATH_FIXED)) { |
799 | mesh_queue_preq(mpath, | 795 | mesh_queue_preq(mpath, |
@@ -815,7 +811,7 @@ int mesh_nexthop_lookup(struct sk_buff *skb, struct net_device *dev) | |||
815 | 811 | ||
816 | skb_queue_tail(&mpath->frame_queue, skb); | 812 | skb_queue_tail(&mpath->frame_queue, skb); |
817 | if (skb_to_free) | 813 | if (skb_to_free) |
818 | mesh_path_discard_frame(skb_to_free, dev); | 814 | mesh_path_discard_frame(skb_to_free, sdata); |
819 | err = -ENOENT; | 815 | err = -ENOENT; |
820 | } | 816 | } |
821 | 817 | ||
@@ -835,7 +831,7 @@ void mesh_path_timer(unsigned long data) | |||
835 | if (!mpath) | 831 | if (!mpath) |
836 | goto endmpathtimer; | 832 | goto endmpathtimer; |
837 | spin_lock_bh(&mpath->state_lock); | 833 | spin_lock_bh(&mpath->state_lock); |
838 | sdata = IEEE80211_DEV_TO_SUB_IF(mpath->dev); | 834 | sdata = mpath->sdata; |
839 | if (mpath->flags & MESH_PATH_RESOLVED || | 835 | if (mpath->flags & MESH_PATH_RESOLVED || |
840 | (!(mpath->flags & MESH_PATH_RESOLVING))) | 836 | (!(mpath->flags & MESH_PATH_RESOLVING))) |
841 | mpath->flags &= ~(MESH_PATH_RESOLVING | MESH_PATH_RESOLVED); | 837 | mpath->flags &= ~(MESH_PATH_RESOLVING | MESH_PATH_RESOLVED); |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 838ee60492a..0a60f55f32a 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | #include <linux/etherdevice.h> | 10 | #include <linux/etherdevice.h> |
11 | #include <linux/list.h> | 11 | #include <linux/list.h> |
12 | #include <linux/netdevice.h> | ||
13 | #include <linux/random.h> | 12 | #include <linux/random.h> |
14 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
15 | #include <linux/string.h> | 14 | #include <linux/string.h> |
@@ -62,13 +61,13 @@ void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta) | |||
62 | /** | 61 | /** |
63 | * mesh_path_lookup - look up a path in the mesh path table | 62 | * mesh_path_lookup - look up a path in the mesh path table |
64 | * @dst: hardware address (ETH_ALEN length) of destination | 63 | * @dst: hardware address (ETH_ALEN length) of destination |
65 | * @dev: local interface | 64 | * @sdata: local subif |
66 | * | 65 | * |
67 | * Returns: pointer to the mesh path structure, or NULL if not found | 66 | * Returns: pointer to the mesh path structure, or NULL if not found |
68 | * | 67 | * |
69 | * Locking: must be called within a read rcu section. | 68 | * Locking: must be called within a read rcu section. |
70 | */ | 69 | */ |
71 | struct mesh_path *mesh_path_lookup(u8 *dst, struct net_device *dev) | 70 | struct mesh_path *mesh_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata) |
72 | { | 71 | { |
73 | struct mesh_path *mpath; | 72 | struct mesh_path *mpath; |
74 | struct hlist_node *n; | 73 | struct hlist_node *n; |
@@ -78,10 +77,10 @@ struct mesh_path *mesh_path_lookup(u8 *dst, struct net_device *dev) | |||
78 | 77 | ||
79 | tbl = rcu_dereference(mesh_paths); | 78 | tbl = rcu_dereference(mesh_paths); |
80 | 79 | ||
81 | bucket = &tbl->hash_buckets[mesh_table_hash(dst, dev, tbl)]; | 80 | bucket = &tbl->hash_buckets[mesh_table_hash(dst, sdata, tbl)]; |
82 | hlist_for_each_entry_rcu(node, n, bucket, list) { | 81 | hlist_for_each_entry_rcu(node, n, bucket, list) { |
83 | mpath = node->mpath; | 82 | mpath = node->mpath; |
84 | if (mpath->dev == dev && | 83 | if (mpath->sdata == sdata && |
85 | memcmp(dst, mpath->dst, ETH_ALEN) == 0) { | 84 | memcmp(dst, mpath->dst, ETH_ALEN) == 0) { |
86 | if (MPATH_EXPIRED(mpath)) { | 85 | if (MPATH_EXPIRED(mpath)) { |
87 | spin_lock_bh(&mpath->state_lock); | 86 | spin_lock_bh(&mpath->state_lock); |
@@ -98,13 +97,13 @@ struct mesh_path *mesh_path_lookup(u8 *dst, struct net_device *dev) | |||
98 | /** | 97 | /** |
99 | * mesh_path_lookup_by_idx - look up a path in the mesh path table by its index | 98 | * mesh_path_lookup_by_idx - look up a path in the mesh path table by its index |
100 | * @idx: index | 99 | * @idx: index |
101 | * @dev: local interface, or NULL for all entries | 100 | * @sdata: local subif, or NULL for all entries |
102 | * | 101 | * |
103 | * Returns: pointer to the mesh path structure, or NULL if not found. | 102 | * Returns: pointer to the mesh path structure, or NULL if not found. |
104 | * | 103 | * |
105 | * Locking: must be called within a read rcu section. | 104 | * Locking: must be called within a read rcu section. |
106 | */ | 105 | */ |
107 | struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev) | 106 | struct mesh_path *mesh_path_lookup_by_idx(int idx, struct ieee80211_sub_if_data *sdata) |
108 | { | 107 | { |
109 | struct mpath_node *node; | 108 | struct mpath_node *node; |
110 | struct hlist_node *p; | 109 | struct hlist_node *p; |
@@ -112,7 +111,7 @@ struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev) | |||
112 | int j = 0; | 111 | int j = 0; |
113 | 112 | ||
114 | for_each_mesh_entry(mesh_paths, p, node, i) { | 113 | for_each_mesh_entry(mesh_paths, p, node, i) { |
115 | if (dev && node->mpath->dev != dev) | 114 | if (sdata && node->mpath->sdata != sdata) |
116 | continue; | 115 | continue; |
117 | if (j++ == idx) { | 116 | if (j++ == idx) { |
118 | if (MPATH_EXPIRED(node->mpath)) { | 117 | if (MPATH_EXPIRED(node->mpath)) { |
@@ -131,15 +130,14 @@ struct mesh_path *mesh_path_lookup_by_idx(int idx, struct net_device *dev) | |||
131 | /** | 130 | /** |
132 | * mesh_path_add - allocate and add a new path to the mesh path table | 131 | * mesh_path_add - allocate and add a new path to the mesh path table |
133 | * @addr: destination address of the path (ETH_ALEN length) | 132 | * @addr: destination address of the path (ETH_ALEN length) |
134 | * @dev: local interface | 133 | * @sdata: local subif |
135 | * | 134 | * |
136 | * Returns: 0 on sucess | 135 | * Returns: 0 on sucess |
137 | * | 136 | * |
138 | * State: the initial state of the new path is set to 0 | 137 | * State: the initial state of the new path is set to 0 |
139 | */ | 138 | */ |
140 | int mesh_path_add(u8 *dst, struct net_device *dev) | 139 | int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata) |
141 | { | 140 | { |
142 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
143 | struct mesh_path *mpath, *new_mpath; | 141 | struct mesh_path *mpath, *new_mpath; |
144 | struct mpath_node *node, *new_node; | 142 | struct mpath_node *node, *new_node; |
145 | struct hlist_head *bucket; | 143 | struct hlist_head *bucket; |
@@ -148,7 +146,7 @@ int mesh_path_add(u8 *dst, struct net_device *dev) | |||
148 | int err = 0; | 146 | int err = 0; |
149 | u32 hash_idx; | 147 | u32 hash_idx; |
150 | 148 | ||
151 | if (memcmp(dst, dev->dev_addr, ETH_ALEN) == 0) | 149 | if (memcmp(dst, sdata->dev->dev_addr, ETH_ALEN) == 0) |
152 | /* never add ourselves as neighbours */ | 150 | /* never add ourselves as neighbours */ |
153 | return -ENOTSUPP; | 151 | return -ENOTSUPP; |
154 | 152 | ||
@@ -169,7 +167,7 @@ int mesh_path_add(u8 *dst, struct net_device *dev) | |||
169 | 167 | ||
170 | read_lock(&pathtbl_resize_lock); | 168 | read_lock(&pathtbl_resize_lock); |
171 | memcpy(new_mpath->dst, dst, ETH_ALEN); | 169 | memcpy(new_mpath->dst, dst, ETH_ALEN); |
172 | new_mpath->dev = dev; | 170 | new_mpath->sdata = sdata; |
173 | new_mpath->flags = 0; | 171 | new_mpath->flags = 0; |
174 | skb_queue_head_init(&new_mpath->frame_queue); | 172 | skb_queue_head_init(&new_mpath->frame_queue); |
175 | new_node->mpath = new_mpath; | 173 | new_node->mpath = new_mpath; |
@@ -179,7 +177,7 @@ int mesh_path_add(u8 *dst, struct net_device *dev) | |||
179 | spin_lock_init(&new_mpath->state_lock); | 177 | spin_lock_init(&new_mpath->state_lock); |
180 | init_timer(&new_mpath->timer); | 178 | init_timer(&new_mpath->timer); |
181 | 179 | ||
182 | hash_idx = mesh_table_hash(dst, dev, mesh_paths); | 180 | hash_idx = mesh_table_hash(dst, sdata, mesh_paths); |
183 | bucket = &mesh_paths->hash_buckets[hash_idx]; | 181 | bucket = &mesh_paths->hash_buckets[hash_idx]; |
184 | 182 | ||
185 | spin_lock(&mesh_paths->hashwlock[hash_idx]); | 183 | spin_lock(&mesh_paths->hashwlock[hash_idx]); |
@@ -187,7 +185,7 @@ int mesh_path_add(u8 *dst, struct net_device *dev) | |||
187 | err = -EEXIST; | 185 | err = -EEXIST; |
188 | hlist_for_each_entry(node, n, bucket, list) { | 186 | hlist_for_each_entry(node, n, bucket, list) { |
189 | mpath = node->mpath; | 187 | mpath = node->mpath; |
190 | if (mpath->dev == dev && memcmp(dst, mpath->dst, ETH_ALEN) == 0) | 188 | if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0) |
191 | goto err_exists; | 189 | goto err_exists; |
192 | } | 190 | } |
193 | 191 | ||
@@ -241,7 +239,7 @@ void mesh_plink_broken(struct sta_info *sta) | |||
241 | struct mesh_path *mpath; | 239 | struct mesh_path *mpath; |
242 | struct mpath_node *node; | 240 | struct mpath_node *node; |
243 | struct hlist_node *p; | 241 | struct hlist_node *p; |
244 | struct net_device *dev = sta->sdata->dev; | 242 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
245 | int i; | 243 | int i; |
246 | 244 | ||
247 | rcu_read_lock(); | 245 | rcu_read_lock(); |
@@ -256,7 +254,7 @@ void mesh_plink_broken(struct sta_info *sta) | |||
256 | spin_unlock_bh(&mpath->state_lock); | 254 | spin_unlock_bh(&mpath->state_lock); |
257 | mesh_path_error_tx(mpath->dst, | 255 | mesh_path_error_tx(mpath->dst, |
258 | cpu_to_le32(mpath->dsn), | 256 | cpu_to_le32(mpath->dsn), |
259 | dev->broadcast, dev); | 257 | sdata->dev->broadcast, sdata); |
260 | } else | 258 | } else |
261 | spin_unlock_bh(&mpath->state_lock); | 259 | spin_unlock_bh(&mpath->state_lock); |
262 | } | 260 | } |
@@ -284,11 +282,11 @@ void mesh_path_flush_by_nexthop(struct sta_info *sta) | |||
284 | for_each_mesh_entry(mesh_paths, p, node, i) { | 282 | for_each_mesh_entry(mesh_paths, p, node, i) { |
285 | mpath = node->mpath; | 283 | mpath = node->mpath; |
286 | if (mpath->next_hop == sta) | 284 | if (mpath->next_hop == sta) |
287 | mesh_path_del(mpath->dst, mpath->dev); | 285 | mesh_path_del(mpath->dst, mpath->sdata); |
288 | } | 286 | } |
289 | } | 287 | } |
290 | 288 | ||
291 | void mesh_path_flush(struct net_device *dev) | 289 | void mesh_path_flush(struct ieee80211_sub_if_data *sdata) |
292 | { | 290 | { |
293 | struct mesh_path *mpath; | 291 | struct mesh_path *mpath; |
294 | struct mpath_node *node; | 292 | struct mpath_node *node; |
@@ -297,16 +295,15 @@ void mesh_path_flush(struct net_device *dev) | |||
297 | 295 | ||
298 | for_each_mesh_entry(mesh_paths, p, node, i) { | 296 | for_each_mesh_entry(mesh_paths, p, node, i) { |
299 | mpath = node->mpath; | 297 | mpath = node->mpath; |
300 | if (mpath->dev == dev) | 298 | if (mpath->sdata == sdata) |
301 | mesh_path_del(mpath->dst, mpath->dev); | 299 | mesh_path_del(mpath->dst, mpath->sdata); |
302 | } | 300 | } |
303 | } | 301 | } |
304 | 302 | ||
305 | static void mesh_path_node_reclaim(struct rcu_head *rp) | 303 | static void mesh_path_node_reclaim(struct rcu_head *rp) |
306 | { | 304 | { |
307 | struct mpath_node *node = container_of(rp, struct mpath_node, rcu); | 305 | struct mpath_node *node = container_of(rp, struct mpath_node, rcu); |
308 | struct ieee80211_sub_if_data *sdata = | 306 | struct ieee80211_sub_if_data *sdata = node->mpath->sdata; |
309 | IEEE80211_DEV_TO_SUB_IF(node->mpath->dev); | ||
310 | 307 | ||
311 | del_timer_sync(&node->mpath->timer); | 308 | del_timer_sync(&node->mpath->timer); |
312 | atomic_dec(&sdata->u.sta.mpaths); | 309 | atomic_dec(&sdata->u.sta.mpaths); |
@@ -318,11 +315,11 @@ static void mesh_path_node_reclaim(struct rcu_head *rp) | |||
318 | * mesh_path_del - delete a mesh path from the table | 315 | * mesh_path_del - delete a mesh path from the table |
319 | * | 316 | * |
320 | * @addr: dst address (ETH_ALEN length) | 317 | * @addr: dst address (ETH_ALEN length) |
321 | * @dev: local interface | 318 | * @sdata: local subif |
322 | * | 319 | * |
323 | * Returns: 0 if succesful | 320 | * Returns: 0 if succesful |
324 | */ | 321 | */ |
325 | int mesh_path_del(u8 *addr, struct net_device *dev) | 322 | int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata) |
326 | { | 323 | { |
327 | struct mesh_path *mpath; | 324 | struct mesh_path *mpath; |
328 | struct mpath_node *node; | 325 | struct mpath_node *node; |
@@ -332,13 +329,13 @@ int mesh_path_del(u8 *addr, struct net_device *dev) | |||
332 | int err = 0; | 329 | int err = 0; |
333 | 330 | ||
334 | read_lock(&pathtbl_resize_lock); | 331 | read_lock(&pathtbl_resize_lock); |
335 | hash_idx = mesh_table_hash(addr, dev, mesh_paths); | 332 | hash_idx = mesh_table_hash(addr, sdata, mesh_paths); |
336 | bucket = &mesh_paths->hash_buckets[hash_idx]; | 333 | bucket = &mesh_paths->hash_buckets[hash_idx]; |
337 | 334 | ||
338 | spin_lock(&mesh_paths->hashwlock[hash_idx]); | 335 | spin_lock(&mesh_paths->hashwlock[hash_idx]); |
339 | hlist_for_each_entry(node, n, bucket, list) { | 336 | hlist_for_each_entry(node, n, bucket, list) { |
340 | mpath = node->mpath; | 337 | mpath = node->mpath; |
341 | if (mpath->dev == dev && | 338 | if (mpath->sdata == sdata && |
342 | memcmp(addr, mpath->dst, ETH_ALEN) == 0) { | 339 | memcmp(addr, mpath->dst, ETH_ALEN) == 0) { |
343 | spin_lock_bh(&mpath->state_lock); | 340 | spin_lock_bh(&mpath->state_lock); |
344 | mpath->flags |= MESH_PATH_RESOLVING; | 341 | mpath->flags |= MESH_PATH_RESOLVING; |
@@ -378,29 +375,29 @@ void mesh_path_tx_pending(struct mesh_path *mpath) | |||
378 | * mesh_path_discard_frame - discard a frame whose path could not be resolved | 375 | * mesh_path_discard_frame - discard a frame whose path could not be resolved |
379 | * | 376 | * |
380 | * @skb: frame to discard | 377 | * @skb: frame to discard |
381 | * @dev: network device the frame was to be sent through | 378 | * @sdata: network subif the frame was to be sent through |
382 | * | 379 | * |
383 | * If the frame was beign forwarded from another MP, a PERR frame will be sent | 380 | * If the frame was beign forwarded from another MP, a PERR frame will be sent |
384 | * to the precursor. | 381 | * to the precursor. |
385 | * | 382 | * |
386 | * Locking: the function must me called within a rcu_read_lock region | 383 | * Locking: the function must me called within a rcu_read_lock region |
387 | */ | 384 | */ |
388 | void mesh_path_discard_frame(struct sk_buff *skb, struct net_device *dev) | 385 | void mesh_path_discard_frame(struct sk_buff *skb, |
386 | struct ieee80211_sub_if_data *sdata) | ||
389 | { | 387 | { |
390 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
391 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 388 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
392 | struct mesh_path *mpath; | 389 | struct mesh_path *mpath; |
393 | u32 dsn = 0; | 390 | u32 dsn = 0; |
394 | 391 | ||
395 | if (memcmp(hdr->addr4, dev->dev_addr, ETH_ALEN) != 0) { | 392 | if (memcmp(hdr->addr4, sdata->dev->dev_addr, ETH_ALEN) != 0) { |
396 | u8 *ra, *da; | 393 | u8 *ra, *da; |
397 | 394 | ||
398 | da = hdr->addr3; | 395 | da = hdr->addr3; |
399 | ra = hdr->addr2; | 396 | ra = hdr->addr2; |
400 | mpath = mesh_path_lookup(da, dev); | 397 | mpath = mesh_path_lookup(da, sdata); |
401 | if (mpath) | 398 | if (mpath) |
402 | dsn = ++mpath->dsn; | 399 | dsn = ++mpath->dsn; |
403 | mesh_path_error_tx(skb->data, cpu_to_le32(dsn), ra, dev); | 400 | mesh_path_error_tx(skb->data, cpu_to_le32(dsn), ra, sdata); |
404 | } | 401 | } |
405 | 402 | ||
406 | kfree_skb(skb); | 403 | kfree_skb(skb); |
@@ -416,14 +413,11 @@ void mesh_path_discard_frame(struct sk_buff *skb, struct net_device *dev) | |||
416 | */ | 413 | */ |
417 | void mesh_path_flush_pending(struct mesh_path *mpath) | 414 | void mesh_path_flush_pending(struct mesh_path *mpath) |
418 | { | 415 | { |
419 | struct ieee80211_sub_if_data *sdata; | ||
420 | struct sk_buff *skb; | 416 | struct sk_buff *skb; |
421 | 417 | ||
422 | sdata = IEEE80211_DEV_TO_SUB_IF(mpath->dev); | ||
423 | |||
424 | while ((skb = skb_dequeue(&mpath->frame_queue)) && | 418 | while ((skb = skb_dequeue(&mpath->frame_queue)) && |
425 | (mpath->flags & MESH_PATH_ACTIVE)) | 419 | (mpath->flags & MESH_PATH_ACTIVE)) |
426 | mesh_path_discard_frame(skb, mpath->dev); | 420 | mesh_path_discard_frame(skb, mpath->sdata); |
427 | } | 421 | } |
428 | 422 | ||
429 | /** | 423 | /** |
@@ -472,7 +466,7 @@ static int mesh_path_node_copy(struct hlist_node *p, struct mesh_table *newtbl) | |||
472 | node = hlist_entry(p, struct mpath_node, list); | 466 | node = hlist_entry(p, struct mpath_node, list); |
473 | mpath = node->mpath; | 467 | mpath = node->mpath; |
474 | new_node->mpath = mpath; | 468 | new_node->mpath = mpath; |
475 | hash_idx = mesh_table_hash(mpath->dst, mpath->dev, newtbl); | 469 | hash_idx = mesh_table_hash(mpath->dst, mpath->sdata, newtbl); |
476 | hlist_add_head(&new_node->list, | 470 | hlist_add_head(&new_node->list, |
477 | &newtbl->hash_buckets[hash_idx]); | 471 | &newtbl->hash_buckets[hash_idx]); |
478 | return 0; | 472 | return 0; |
@@ -489,7 +483,7 @@ int mesh_pathtbl_init(void) | |||
489 | return 0; | 483 | return 0; |
490 | } | 484 | } |
491 | 485 | ||
492 | void mesh_path_expire(struct net_device *dev) | 486 | void mesh_path_expire(struct ieee80211_sub_if_data *sdata) |
493 | { | 487 | { |
494 | struct mesh_path *mpath; | 488 | struct mesh_path *mpath; |
495 | struct mpath_node *node; | 489 | struct mpath_node *node; |
@@ -498,7 +492,7 @@ void mesh_path_expire(struct net_device *dev) | |||
498 | 492 | ||
499 | read_lock(&pathtbl_resize_lock); | 493 | read_lock(&pathtbl_resize_lock); |
500 | for_each_mesh_entry(mesh_paths, p, node, i) { | 494 | for_each_mesh_entry(mesh_paths, p, node, i) { |
501 | if (node->mpath->dev != dev) | 495 | if (node->mpath->sdata != sdata) |
502 | continue; | 496 | continue; |
503 | mpath = node->mpath; | 497 | mpath = node->mpath; |
504 | spin_lock_bh(&mpath->state_lock); | 498 | spin_lock_bh(&mpath->state_lock); |
@@ -507,7 +501,7 @@ void mesh_path_expire(struct net_device *dev) | |||
507 | time_after(jiffies, | 501 | time_after(jiffies, |
508 | mpath->exp_time + MESH_PATH_EXPIRE)) { | 502 | mpath->exp_time + MESH_PATH_EXPIRE)) { |
509 | spin_unlock_bh(&mpath->state_lock); | 503 | spin_unlock_bh(&mpath->state_lock); |
510 | mesh_path_del(mpath->dst, mpath->dev); | 504 | mesh_path_del(mpath->dst, mpath->sdata); |
511 | } else | 505 | } else |
512 | spin_unlock_bh(&mpath->state_lock); | 506 | spin_unlock_bh(&mpath->state_lock); |
513 | } | 507 | } |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 4a7e6d094ff..7714b0e6e4d 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -144,10 +144,10 @@ void mesh_plink_deactivate(struct sta_info *sta) | |||
144 | spin_unlock_bh(&sta->lock); | 144 | spin_unlock_bh(&sta->lock); |
145 | } | 145 | } |
146 | 146 | ||
147 | static int mesh_plink_frame_tx(struct net_device *dev, | 147 | static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, |
148 | enum plink_frame_type action, u8 *da, __le16 llid, __le16 plid, | 148 | enum plink_frame_type action, u8 *da, __le16 llid, __le16 plid, |
149 | __le16 reason) { | 149 | __le16 reason) { |
150 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 150 | struct ieee80211_local *local = sdata->local; |
151 | struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); | 151 | struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); |
152 | struct ieee80211_mgmt *mgmt; | 152 | struct ieee80211_mgmt *mgmt; |
153 | bool include_plid = false; | 153 | bool include_plid = false; |
@@ -166,7 +166,7 @@ static int mesh_plink_frame_tx(struct net_device *dev, | |||
166 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 166 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
167 | IEEE80211_STYPE_ACTION); | 167 | IEEE80211_STYPE_ACTION); |
168 | memcpy(mgmt->da, da, ETH_ALEN); | 168 | memcpy(mgmt->da, da, ETH_ALEN); |
169 | memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); | 169 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); |
170 | /* BSSID is left zeroed, wildcard value */ | 170 | /* BSSID is left zeroed, wildcard value */ |
171 | mgmt->u.action.category = PLINK_CATEGORY; | 171 | mgmt->u.action.category = PLINK_CATEGORY; |
172 | mgmt->u.action.u.plink_action.action_code = action; | 172 | mgmt->u.action.u.plink_action.action_code = action; |
@@ -180,7 +180,7 @@ static int mesh_plink_frame_tx(struct net_device *dev, | |||
180 | /* two-byte status code followed by two-byte AID */ | 180 | /* two-byte status code followed by two-byte AID */ |
181 | memset(pos, 0, 4); | 181 | memset(pos, 0, 4); |
182 | } | 182 | } |
183 | mesh_mgmt_ies_add(skb, dev); | 183 | mesh_mgmt_ies_add(skb, sdata); |
184 | } | 184 | } |
185 | 185 | ||
186 | /* Add Peer Link Management element */ | 186 | /* Add Peer Link Management element */ |
@@ -217,15 +217,14 @@ static int mesh_plink_frame_tx(struct net_device *dev, | |||
217 | memcpy(pos, &reason, 2); | 217 | memcpy(pos, &reason, 2); |
218 | } | 218 | } |
219 | 219 | ||
220 | ieee80211_sta_tx(dev, skb, 0); | 220 | ieee80211_sta_tx(sdata, skb, 0); |
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
223 | 223 | ||
224 | void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct net_device *dev, | 224 | void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct ieee80211_sub_if_data *sdata, |
225 | bool peer_accepting_plinks) | 225 | bool peer_accepting_plinks) |
226 | { | 226 | { |
227 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 227 | struct ieee80211_local *local = sdata->local; |
228 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
229 | struct sta_info *sta; | 228 | struct sta_info *sta; |
230 | 229 | ||
231 | rcu_read_lock(); | 230 | rcu_read_lock(); |
@@ -257,7 +256,6 @@ static void mesh_plink_timer(unsigned long data) | |||
257 | { | 256 | { |
258 | struct sta_info *sta; | 257 | struct sta_info *sta; |
259 | __le16 llid, plid, reason; | 258 | __le16 llid, plid, reason; |
260 | struct net_device *dev = NULL; | ||
261 | struct ieee80211_sub_if_data *sdata; | 259 | struct ieee80211_sub_if_data *sdata; |
262 | #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG | 260 | #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG |
263 | DECLARE_MAC_BUF(mac); | 261 | DECLARE_MAC_BUF(mac); |
@@ -282,7 +280,6 @@ static void mesh_plink_timer(unsigned long data) | |||
282 | llid = sta->llid; | 280 | llid = sta->llid; |
283 | plid = sta->plid; | 281 | plid = sta->plid; |
284 | sdata = sta->sdata; | 282 | sdata = sta->sdata; |
285 | dev = sdata->dev; | ||
286 | 283 | ||
287 | switch (sta->plink_state) { | 284 | switch (sta->plink_state) { |
288 | case PLINK_OPN_RCVD: | 285 | case PLINK_OPN_RCVD: |
@@ -299,7 +296,7 @@ static void mesh_plink_timer(unsigned long data) | |||
299 | ++sta->plink_retries; | 296 | ++sta->plink_retries; |
300 | mod_plink_timer(sta, sta->plink_timeout); | 297 | mod_plink_timer(sta, sta->plink_timeout); |
301 | spin_unlock_bh(&sta->lock); | 298 | spin_unlock_bh(&sta->lock); |
302 | mesh_plink_frame_tx(dev, PLINK_OPEN, sta->addr, llid, | 299 | mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->addr, llid, |
303 | 0, 0); | 300 | 0, 0); |
304 | break; | 301 | break; |
305 | } | 302 | } |
@@ -312,7 +309,7 @@ static void mesh_plink_timer(unsigned long data) | |||
312 | sta->plink_state = PLINK_HOLDING; | 309 | sta->plink_state = PLINK_HOLDING; |
313 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); | 310 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); |
314 | spin_unlock_bh(&sta->lock); | 311 | spin_unlock_bh(&sta->lock); |
315 | mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid, plid, | 312 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, plid, |
316 | reason); | 313 | reason); |
317 | break; | 314 | break; |
318 | case PLINK_HOLDING: | 315 | case PLINK_HOLDING: |
@@ -357,7 +354,7 @@ int mesh_plink_open(struct sta_info *sta) | |||
357 | mpl_dbg("Mesh plink: starting establishment with %s\n", | 354 | mpl_dbg("Mesh plink: starting establishment with %s\n", |
358 | print_mac(mac, sta->addr)); | 355 | print_mac(mac, sta->addr)); |
359 | 356 | ||
360 | return mesh_plink_frame_tx(sdata->dev, PLINK_OPEN, | 357 | return mesh_plink_frame_tx(sdata, PLINK_OPEN, |
361 | sta->addr, llid, 0, 0); | 358 | sta->addr, llid, 0, 0); |
362 | } | 359 | } |
363 | 360 | ||
@@ -403,15 +400,14 @@ int mesh_plink_close(struct sta_info *sta) | |||
403 | llid = sta->llid; | 400 | llid = sta->llid; |
404 | plid = sta->plid; | 401 | plid = sta->plid; |
405 | spin_unlock_bh(&sta->lock); | 402 | spin_unlock_bh(&sta->lock); |
406 | mesh_plink_frame_tx(sta->sdata->dev, PLINK_CLOSE, sta->addr, llid, | 403 | mesh_plink_frame_tx(sta->sdata, PLINK_CLOSE, sta->addr, llid, |
407 | plid, reason); | 404 | plid, reason); |
408 | return 0; | 405 | return 0; |
409 | } | 406 | } |
410 | 407 | ||
411 | void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | 408 | void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, |
412 | size_t len, struct ieee80211_rx_status *rx_status) | 409 | size_t len, struct ieee80211_rx_status *rx_status) |
413 | { | 410 | { |
414 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
415 | struct ieee80211_local *local = sdata->local; | 411 | struct ieee80211_local *local = sdata->local; |
416 | struct ieee802_11_elems elems; | 412 | struct ieee802_11_elems elems; |
417 | struct sta_info *sta; | 413 | struct sta_info *sta; |
@@ -478,7 +474,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
478 | 474 | ||
479 | /* Now we will figure out the appropriate event... */ | 475 | /* Now we will figure out the appropriate event... */ |
480 | event = PLINK_UNDEFINED; | 476 | event = PLINK_UNDEFINED; |
481 | if (ftype != PLINK_CLOSE && (!mesh_matches_local(&elems, dev))) { | 477 | if (ftype != PLINK_CLOSE && (!mesh_matches_local(&elems, sdata))) { |
482 | switch (ftype) { | 478 | switch (ftype) { |
483 | case PLINK_OPEN: | 479 | case PLINK_OPEN: |
484 | event = OPN_RJCT; | 480 | event = OPN_RJCT; |
@@ -577,9 +573,9 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
577 | sta->llid = llid; | 573 | sta->llid = llid; |
578 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); | 574 | mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); |
579 | spin_unlock_bh(&sta->lock); | 575 | spin_unlock_bh(&sta->lock); |
580 | mesh_plink_frame_tx(dev, PLINK_OPEN, sta->addr, llid, | 576 | mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->addr, llid, |
581 | 0, 0); | 577 | 0, 0); |
582 | mesh_plink_frame_tx(dev, PLINK_CONFIRM, sta->addr, | 578 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, |
583 | llid, plid, 0); | 579 | llid, plid, 0); |
584 | break; | 580 | break; |
585 | default: | 581 | default: |
@@ -604,7 +600,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
604 | 600 | ||
605 | llid = sta->llid; | 601 | llid = sta->llid; |
606 | spin_unlock_bh(&sta->lock); | 602 | spin_unlock_bh(&sta->lock); |
607 | mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid, | 603 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, |
608 | plid, reason); | 604 | plid, reason); |
609 | break; | 605 | break; |
610 | case OPN_ACPT: | 606 | case OPN_ACPT: |
@@ -613,7 +609,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
613 | sta->plid = plid; | 609 | sta->plid = plid; |
614 | llid = sta->llid; | 610 | llid = sta->llid; |
615 | spin_unlock_bh(&sta->lock); | 611 | spin_unlock_bh(&sta->lock); |
616 | mesh_plink_frame_tx(dev, PLINK_CONFIRM, sta->addr, llid, | 612 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, llid, |
617 | plid, 0); | 613 | plid, 0); |
618 | break; | 614 | break; |
619 | case CNF_ACPT: | 615 | case CNF_ACPT: |
@@ -646,13 +642,13 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
646 | 642 | ||
647 | llid = sta->llid; | 643 | llid = sta->llid; |
648 | spin_unlock_bh(&sta->lock); | 644 | spin_unlock_bh(&sta->lock); |
649 | mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid, | 645 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, |
650 | plid, reason); | 646 | plid, reason); |
651 | break; | 647 | break; |
652 | case OPN_ACPT: | 648 | case OPN_ACPT: |
653 | llid = sta->llid; | 649 | llid = sta->llid; |
654 | spin_unlock_bh(&sta->lock); | 650 | spin_unlock_bh(&sta->lock); |
655 | mesh_plink_frame_tx(dev, PLINK_CONFIRM, sta->addr, llid, | 651 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, llid, |
656 | plid, 0); | 652 | plid, 0); |
657 | break; | 653 | break; |
658 | case CNF_ACPT: | 654 | case CNF_ACPT: |
@@ -685,7 +681,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
685 | 681 | ||
686 | llid = sta->llid; | 682 | llid = sta->llid; |
687 | spin_unlock_bh(&sta->lock); | 683 | spin_unlock_bh(&sta->lock); |
688 | mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid, | 684 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, |
689 | plid, reason); | 685 | plid, reason); |
690 | break; | 686 | break; |
691 | case OPN_ACPT: | 687 | case OPN_ACPT: |
@@ -695,7 +691,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
695 | spin_unlock_bh(&sta->lock); | 691 | spin_unlock_bh(&sta->lock); |
696 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", | 692 | mpl_dbg("Mesh plink with %s ESTABLISHED\n", |
697 | print_mac(mac, sta->addr)); | 693 | print_mac(mac, sta->addr)); |
698 | mesh_plink_frame_tx(dev, PLINK_CONFIRM, sta->addr, llid, | 694 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, llid, |
699 | plid, 0); | 695 | plid, 0); |
700 | break; | 696 | break; |
701 | default: | 697 | default: |
@@ -714,13 +710,13 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
714 | llid = sta->llid; | 710 | llid = sta->llid; |
715 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); | 711 | mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); |
716 | spin_unlock_bh(&sta->lock); | 712 | spin_unlock_bh(&sta->lock); |
717 | mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid, | 713 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, |
718 | plid, reason); | 714 | plid, reason); |
719 | break; | 715 | break; |
720 | case OPN_ACPT: | 716 | case OPN_ACPT: |
721 | llid = sta->llid; | 717 | llid = sta->llid; |
722 | spin_unlock_bh(&sta->lock); | 718 | spin_unlock_bh(&sta->lock); |
723 | mesh_plink_frame_tx(dev, PLINK_CONFIRM, sta->addr, llid, | 719 | mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->addr, llid, |
724 | plid, 0); | 720 | plid, 0); |
725 | break; | 721 | break; |
726 | default: | 722 | default: |
@@ -743,7 +739,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, | |||
743 | llid = sta->llid; | 739 | llid = sta->llid; |
744 | reason = sta->reason; | 740 | reason = sta->reason; |
745 | spin_unlock_bh(&sta->lock); | 741 | spin_unlock_bh(&sta->lock); |
746 | mesh_plink_frame_tx(dev, PLINK_CLOSE, sta->addr, llid, | 742 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->addr, llid, |
747 | plid, reason); | 743 | plid, reason); |
748 | break; | 744 | break; |
749 | default: | 745 | default: |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index ac776c9d48f..fb8e1e742ca 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; |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 2464263cb7a..fd83ef760a3 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -404,11 +404,11 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx) | |||
404 | struct sk_buff *skb = rx->skb; | 404 | struct sk_buff *skb = rx->skb; |
405 | 405 | ||
406 | if (unlikely(local->sta_hw_scanning)) | 406 | if (unlikely(local->sta_hw_scanning)) |
407 | return ieee80211_sta_rx_scan(rx->dev, skb, rx->status); | 407 | return ieee80211_sta_rx_scan(rx->sdata, skb, rx->status); |
408 | 408 | ||
409 | if (unlikely(local->sta_sw_scanning)) { | 409 | if (unlikely(local->sta_sw_scanning)) { |
410 | /* drop all the other packets during a software scan anyway */ | 410 | /* drop all the other packets during a software scan anyway */ |
411 | if (ieee80211_sta_rx_scan(rx->dev, skb, rx->status) | 411 | if (ieee80211_sta_rx_scan(rx->sdata, skb, rx->status) |
412 | != RX_QUEUED) | 412 | != RX_QUEUED) |
413 | dev_kfree_skb(skb); | 413 | dev_kfree_skb(skb); |
414 | return RX_QUEUED; | 414 | return RX_QUEUED; |
@@ -466,7 +466,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx) | |||
466 | 466 | ||
467 | if (ieee80211_is_data(hdr->frame_control) && | 467 | if (ieee80211_is_data(hdr->frame_control) && |
468 | is_multicast_ether_addr(hdr->addr1) && | 468 | is_multicast_ether_addr(hdr->addr1) && |
469 | mesh_rmc_check(hdr->addr4, msh_h_get(hdr, hdrlen), rx->dev)) | 469 | mesh_rmc_check(hdr->addr4, msh_h_get(hdr, hdrlen), rx->sdata)) |
470 | return RX_DROP_MONITOR; | 470 | return RX_DROP_MONITOR; |
471 | #undef msh_h_get | 471 | #undef msh_h_get |
472 | 472 | ||
@@ -1523,7 +1523,7 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) | |||
1523 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS || | 1523 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS || |
1524 | sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) && | 1524 | sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) && |
1525 | !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)) | 1525 | !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)) |
1526 | ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->status); | 1526 | ieee80211_sta_rx_mgmt(sdata, rx->skb, rx->status); |
1527 | else | 1527 | else |
1528 | return RX_DROP_MONITOR; | 1528 | return RX_DROP_MONITOR; |
1529 | 1529 | ||
@@ -1570,7 +1570,7 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, | |||
1570 | !ieee80211_is_auth(hdr->frame_control)) | 1570 | !ieee80211_is_auth(hdr->frame_control)) |
1571 | goto ignore; | 1571 | goto ignore; |
1572 | 1572 | ||
1573 | mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr); | 1573 | mac80211_ev_michael_mic_failure(rx->sdata, keyidx, hdr); |
1574 | ignore: | 1574 | ignore: |
1575 | dev_kfree_skb(rx->skb); | 1575 | dev_kfree_skb(rx->skb); |
1576 | rx->skb = NULL; | 1576 | rx->skb = NULL; |
@@ -1744,7 +1744,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1744 | return 0; | 1744 | return 0; |
1745 | if (ieee80211_is_beacon(hdr->frame_control)) { | 1745 | if (ieee80211_is_beacon(hdr->frame_control)) { |
1746 | if (!rx->sta) | 1746 | if (!rx->sta) |
1747 | rx->sta = ieee80211_ibss_add_sta(sdata->dev, | 1747 | rx->sta = ieee80211_ibss_add_sta(sdata, |
1748 | rx->skb, bssid, hdr->addr2, | 1748 | rx->skb, bssid, hdr->addr2, |
1749 | BIT(rx->status->rate_idx)); | 1749 | BIT(rx->status->rate_idx)); |
1750 | return 1; | 1750 | return 1; |
@@ -1760,7 +1760,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1760 | return 0; | 1760 | return 0; |
1761 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 1761 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
1762 | } else if (!rx->sta) | 1762 | } else if (!rx->sta) |
1763 | rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, | 1763 | rx->sta = ieee80211_ibss_add_sta(sdata, rx->skb, |
1764 | bssid, hdr->addr2, | 1764 | bssid, hdr->addr2, |
1765 | BIT(rx->status->rate_idx)); | 1765 | BIT(rx->status->rate_idx)); |
1766 | break; | 1766 | break; |
@@ -2066,7 +2066,7 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local, | |||
2066 | /* if this mpdu is fragmented - terminate rx aggregation session */ | 2066 | /* if this mpdu is fragmented - terminate rx aggregation session */ |
2067 | sc = le16_to_cpu(hdr->seq_ctrl); | 2067 | sc = le16_to_cpu(hdr->seq_ctrl); |
2068 | if (sc & IEEE80211_SCTL_FRAG) { | 2068 | if (sc & IEEE80211_SCTL_FRAG) { |
2069 | ieee80211_sta_stop_rx_ba_session(sta->sdata->dev, sta->addr, | 2069 | ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->addr, |
2070 | tid, 0, WLAN_REASON_QSTA_REQUIRE_SETUP); | 2070 | tid, 0, WLAN_REASON_QSTA_REQUIRE_SETUP); |
2071 | ret = 1; | 2071 | ret = 1; |
2072 | goto end_reorder; | 2072 | goto end_reorder; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 85f3ba85c13..c413d4836af 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1327,7 +1327,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1327 | if (is_multicast_ether_addr(hdr->addr3)) | 1327 | if (is_multicast_ether_addr(hdr->addr3)) |
1328 | memcpy(hdr->addr1, hdr->addr3, ETH_ALEN); | 1328 | memcpy(hdr->addr1, hdr->addr3, ETH_ALEN); |
1329 | else | 1329 | else |
1330 | if (mesh_nexthop_lookup(skb, odev)) | 1330 | if (mesh_nexthop_lookup(skb, osdata)) |
1331 | return 0; | 1331 | return 0; |
1332 | if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) | 1332 | if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) |
1333 | IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.sta, | 1333 | IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.sta, |
@@ -1908,7 +1908,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1908 | *pos++ = WLAN_EID_SSID; | 1908 | *pos++ = WLAN_EID_SSID; |
1909 | *pos++ = 0x0; | 1909 | *pos++ = 0x0; |
1910 | 1910 | ||
1911 | mesh_mgmt_ies_add(skb, sdata->dev); | 1911 | mesh_mgmt_ies_add(skb, sdata); |
1912 | 1912 | ||
1913 | num_beacons = &sdata->u.sta.num_beacons; | 1913 | num_beacons = &sdata->u.sta.num_beacons; |
1914 | } else { | 1914 | } else { |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 34fa8ed1e78..735daa355c3 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -27,22 +27,19 @@ | |||
27 | #include "aes_ccm.h" | 27 | #include "aes_ccm.h" |
28 | 28 | ||
29 | 29 | ||
30 | static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, | 30 | static int ieee80211_set_encryption(struct ieee80211_sub_if_data *sdata, u8 *sta_addr, |
31 | int idx, int alg, int remove, | 31 | int idx, int alg, int remove, |
32 | int set_tx_key, const u8 *_key, | 32 | int set_tx_key, const u8 *_key, |
33 | size_t key_len) | 33 | size_t key_len) |
34 | { | 34 | { |
35 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 35 | struct ieee80211_local *local = sdata->local; |
36 | struct sta_info *sta; | 36 | struct sta_info *sta; |
37 | struct ieee80211_key *key; | 37 | struct ieee80211_key *key; |
38 | struct ieee80211_sub_if_data *sdata; | ||
39 | int err; | 38 | int err; |
40 | 39 | ||
41 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
42 | |||
43 | if (idx < 0 || idx >= NUM_DEFAULT_KEYS) { | 40 | if (idx < 0 || idx >= NUM_DEFAULT_KEYS) { |
44 | printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n", | 41 | printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n", |
45 | dev->name, idx); | 42 | sdata->dev->name, idx); |
46 | return -EINVAL; | 43 | return -EINVAL; |
47 | } | 44 | } |
48 | 45 | ||
@@ -127,11 +124,11 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev, | |||
127 | 124 | ||
128 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 125 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
129 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 126 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
130 | int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length); | 127 | int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length); |
131 | if (ret) | 128 | if (ret) |
132 | return ret; | 129 | return ret; |
133 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; | 130 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
134 | ieee80211_sta_req_auth(dev, &sdata->u.sta); | 131 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
135 | return 0; | 132 | return 0; |
136 | } | 133 | } |
137 | 134 | ||
@@ -333,12 +330,11 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
333 | return 0; | 330 | return 0; |
334 | } | 331 | } |
335 | 332 | ||
336 | int ieee80211_set_freq(struct net_device *dev, int freqMHz) | 333 | int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz) |
337 | { | 334 | { |
338 | int ret = -EINVAL; | 335 | int ret = -EINVAL; |
339 | struct ieee80211_channel *chan; | 336 | struct ieee80211_channel *chan; |
340 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 337 | struct ieee80211_local *local = sdata->local; |
341 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
342 | 338 | ||
343 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); | 339 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); |
344 | 340 | ||
@@ -346,7 +342,7 @@ int ieee80211_set_freq(struct net_device *dev, int freqMHz) | |||
346 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | 342 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && |
347 | chan->flags & IEEE80211_CHAN_NO_IBSS) { | 343 | chan->flags & IEEE80211_CHAN_NO_IBSS) { |
348 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | 344 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " |
349 | "%d MHz\n", dev->name, chan->center_freq); | 345 | "%d MHz\n", sdata->dev->name, chan->center_freq); |
350 | return ret; | 346 | return ret; |
351 | } | 347 | } |
352 | local->oper_channel = chan; | 348 | local->oper_channel = chan; |
@@ -379,14 +375,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
379 | IEEE80211_STA_AUTO_CHANNEL_SEL; | 375 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
380 | return 0; | 376 | return 0; |
381 | } else | 377 | } else |
382 | return ieee80211_set_freq(dev, | 378 | return ieee80211_set_freq(sdata, |
383 | ieee80211_channel_to_frequency(freq->m)); | 379 | ieee80211_channel_to_frequency(freq->m)); |
384 | } else { | 380 | } else { |
385 | int i, div = 1000000; | 381 | int i, div = 1000000; |
386 | for (i = 0; i < freq->e; i++) | 382 | for (i = 0; i < freq->e; i++) |
387 | div /= 10; | 383 | div /= 10; |
388 | if (div > 0) | 384 | if (div > 0) |
389 | return ieee80211_set_freq(dev, freq->m / div); | 385 | return ieee80211_set_freq(sdata, freq->m / div); |
390 | else | 386 | else |
391 | return -EINVAL; | 387 | return -EINVAL; |
392 | } | 388 | } |
@@ -432,10 +428,10 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, | |||
432 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; | 428 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; |
433 | else | 429 | else |
434 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL; | 430 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL; |
435 | ret = ieee80211_sta_set_ssid(dev, ssid, len); | 431 | ret = ieee80211_sta_set_ssid(sdata, ssid, len); |
436 | if (ret) | 432 | if (ret) |
437 | return ret; | 433 | return ret; |
438 | ieee80211_sta_req_auth(dev, &sdata->u.sta); | 434 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
439 | return 0; | 435 | return 0; |
440 | } | 436 | } |
441 | 437 | ||
@@ -460,7 +456,7 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, | |||
460 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 456 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
461 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 457 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
462 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 458 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
463 | int res = ieee80211_sta_get_ssid(dev, ssid, &len); | 459 | int res = ieee80211_sta_get_ssid(sdata, ssid, &len); |
464 | if (res == 0) { | 460 | if (res == 0) { |
465 | data->length = len; | 461 | data->length = len; |
466 | data->flags = 1; | 462 | data->flags = 1; |
@@ -504,10 +500,10 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, | |||
504 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL; | 500 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL; |
505 | else | 501 | else |
506 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; | 502 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
507 | ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data); | 503 | ret = ieee80211_sta_set_bssid(sdata, (u8 *) &ap_addr->sa_data); |
508 | if (ret) | 504 | if (ret) |
509 | return ret; | 505 | return ret; |
510 | ieee80211_sta_req_auth(dev, &sdata->u.sta); | 506 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
511 | return 0; | 507 | return 0; |
512 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 508 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { |
513 | /* | 509 | /* |
@@ -584,7 +580,7 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev, | |||
584 | ssid_len = req->essid_len; | 580 | ssid_len = req->essid_len; |
585 | } | 581 | } |
586 | 582 | ||
587 | return ieee80211_sta_req_scan(dev, ssid, ssid_len); | 583 | return ieee80211_sta_req_scan(sdata, ssid, ssid_len); |
588 | } | 584 | } |
589 | 585 | ||
590 | 586 | ||
@@ -594,11 +590,14 @@ static int ieee80211_ioctl_giwscan(struct net_device *dev, | |||
594 | { | 590 | { |
595 | int res; | 591 | int res; |
596 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 592 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
593 | struct ieee80211_sub_if_data *sdata; | ||
594 | |||
595 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
597 | 596 | ||
598 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 597 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
599 | return -EAGAIN; | 598 | return -EAGAIN; |
600 | 599 | ||
601 | res = ieee80211_sta_scan_results(dev, info, extra, data->length); | 600 | res = ieee80211_sta_scan_results(local, info, extra, data->length); |
602 | if (res >= 0) { | 601 | if (res >= 0) { |
603 | data->length = res; | 602 | data->length = res; |
604 | return 0; | 603 | return 0; |
@@ -894,10 +893,10 @@ static int ieee80211_ioctl_siwmlme(struct net_device *dev, | |||
894 | switch (mlme->cmd) { | 893 | switch (mlme->cmd) { |
895 | case IW_MLME_DEAUTH: | 894 | case IW_MLME_DEAUTH: |
896 | /* TODO: mlme->addr.sa_data */ | 895 | /* TODO: mlme->addr.sa_data */ |
897 | return ieee80211_sta_deauthenticate(dev, mlme->reason_code); | 896 | return ieee80211_sta_deauthenticate(sdata, mlme->reason_code); |
898 | case IW_MLME_DISASSOC: | 897 | case IW_MLME_DISASSOC: |
899 | /* TODO: mlme->addr.sa_data */ | 898 | /* TODO: mlme->addr.sa_data */ |
900 | return ieee80211_sta_disassociate(dev, mlme->reason_code); | 899 | return ieee80211_sta_disassociate(sdata, mlme->reason_code); |
901 | default: | 900 | default: |
902 | return -EOPNOTSUPP; | 901 | return -EOPNOTSUPP; |
903 | } | 902 | } |
@@ -938,7 +937,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev, | |||
938 | } | 937 | } |
939 | 938 | ||
940 | return ieee80211_set_encryption( | 939 | return ieee80211_set_encryption( |
941 | dev, bcaddr, | 940 | sdata, bcaddr, |
942 | idx, alg, remove, | 941 | idx, alg, remove, |
943 | !sdata->default_key, | 942 | !sdata->default_key, |
944 | keybuf, erq->length); | 943 | keybuf, erq->length); |
@@ -1184,7 +1183,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev, | |||
1184 | } else | 1183 | } else |
1185 | idx--; | 1184 | idx--; |
1186 | 1185 | ||
1187 | return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg, | 1186 | return ieee80211_set_encryption(sdata, ext->addr.sa_data, idx, alg, |
1188 | remove, | 1187 | remove, |
1189 | ext->ext_flags & | 1188 | ext->ext_flags & |
1190 | IW_ENCODE_EXT_SET_TX_KEY, | 1189 | IW_ENCODE_EXT_SET_TX_KEY, |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index 2f33df0dccc..78021780b88 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -127,7 +127,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) | |||
127 | if (!(rx->flags & IEEE80211_RX_RA_MATCH)) | 127 | if (!(rx->flags & IEEE80211_RX_RA_MATCH)) |
128 | return RX_DROP_UNUSABLE; | 128 | return RX_DROP_UNUSABLE; |
129 | 129 | ||
130 | mac80211_ev_michael_mic_failure(rx->dev, rx->key->conf.keyidx, | 130 | mac80211_ev_michael_mic_failure(rx->sdata, rx->key->conf.keyidx, |
131 | (void *) skb->data); | 131 | (void *) skb->data); |
132 | return RX_DROP_UNUSABLE; | 132 | return RX_DROP_UNUSABLE; |
133 | } | 133 | } |