diff options
Diffstat (limited to 'net/mac80211')
32 files changed, 990 insertions, 544 deletions
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index a10d508b07e1..a952b7f8c648 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -96,18 +96,6 @@ menuconfig MAC80211_DEBUG_MENU | |||
96 | ---help--- | 96 | ---help--- |
97 | This option collects various mac80211 debug settings. | 97 | This option collects various mac80211 debug settings. |
98 | 98 | ||
99 | config MAC80211_DEBUG_PACKET_ALIGNMENT | ||
100 | bool "Enable packet alignment debugging" | ||
101 | depends on MAC80211_DEBUG_MENU | ||
102 | ---help--- | ||
103 | This option is recommended for driver authors and strongly | ||
104 | discouraged for everybody else, it will trigger a warning | ||
105 | when a driver hands mac80211 a buffer that is aligned in | ||
106 | a way that will cause problems with the IP stack on some | ||
107 | architectures. | ||
108 | |||
109 | Say N unless you're writing a mac80211 based driver. | ||
110 | |||
111 | config MAC80211_NOINLINE | 99 | config MAC80211_NOINLINE |
112 | bool "Do not inline TX/RX handlers" | 100 | bool "Do not inline TX/RX handlers" |
113 | depends on MAC80211_DEBUG_MENU | 101 | depends on MAC80211_DEBUG_MENU |
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c index 51c7dc3c4c3b..a978e666ed6f 100644 --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c | |||
@@ -41,8 +41,7 @@ void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, | |||
41 | sta->sta.addr, tid); | 41 | sta->sta.addr, tid); |
42 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 42 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
43 | 43 | ||
44 | if (drv_ampdu_action(local, &sta->sdata->vif, | 44 | if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP, |
45 | IEEE80211_AMPDU_RX_STOP, | ||
46 | &sta->sta, tid, NULL)) | 45 | &sta->sta, tid, NULL)) |
47 | printk(KERN_DEBUG "HW problem - can not stop rx " | 46 | printk(KERN_DEBUG "HW problem - can not stop rx " |
48 | "aggregation for tid %d\n", tid); | 47 | "aggregation for tid %d\n", tid); |
@@ -83,12 +82,11 @@ void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, | |||
83 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, | 82 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, |
84 | u16 initiator, u16 reason) | 83 | u16 initiator, u16 reason) |
85 | { | 84 | { |
86 | struct ieee80211_local *local = sdata->local; | ||
87 | struct sta_info *sta; | 85 | struct sta_info *sta; |
88 | 86 | ||
89 | rcu_read_lock(); | 87 | rcu_read_lock(); |
90 | 88 | ||
91 | sta = sta_info_get(local, ra); | 89 | sta = sta_info_get(sdata, ra); |
92 | if (!sta) { | 90 | if (!sta) { |
93 | rcu_read_unlock(); | 91 | rcu_read_unlock(); |
94 | return; | 92 | return; |
@@ -136,7 +134,7 @@ static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *d | |||
136 | 134 | ||
137 | if (!skb) { | 135 | if (!skb) { |
138 | printk(KERN_DEBUG "%s: failed to allocate buffer " | 136 | printk(KERN_DEBUG "%s: failed to allocate buffer " |
139 | "for addba resp frame\n", sdata->dev->name); | 137 | "for addba resp frame\n", sdata->name); |
140 | return; | 138 | return; |
141 | } | 139 | } |
142 | 140 | ||
@@ -144,10 +142,10 @@ static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *d | |||
144 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 142 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
145 | memset(mgmt, 0, 24); | 143 | memset(mgmt, 0, 24); |
146 | memcpy(mgmt->da, da, ETH_ALEN); | 144 | memcpy(mgmt->da, da, ETH_ALEN); |
147 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 145 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
148 | if (sdata->vif.type == NL80211_IFTYPE_AP || | 146 | if (sdata->vif.type == NL80211_IFTYPE_AP || |
149 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 147 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
150 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | 148 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); |
151 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) | 149 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) |
152 | memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); | 150 | memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); |
153 | 151 | ||
@@ -281,8 +279,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
281 | goto end; | 279 | goto end; |
282 | } | 280 | } |
283 | 281 | ||
284 | ret = drv_ampdu_action(local, &sta->sdata->vif, | 282 | ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START, |
285 | IEEE80211_AMPDU_RX_START, | ||
286 | &sta->sta, tid, &start_seq_num); | 283 | &sta->sta, tid, &start_seq_num); |
287 | #ifdef CONFIG_MAC80211_HT_DEBUG | 284 | #ifdef CONFIG_MAC80211_HT_DEBUG |
288 | printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret); | 285 | printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret); |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index 5e3a7eccef5a..ceda36618d3c 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
@@ -58,17 +58,17 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, | |||
58 | 58 | ||
59 | if (!skb) { | 59 | if (!skb) { |
60 | printk(KERN_ERR "%s: failed to allocate buffer " | 60 | printk(KERN_ERR "%s: failed to allocate buffer " |
61 | "for addba request frame\n", sdata->dev->name); | 61 | "for addba request frame\n", sdata->name); |
62 | return; | 62 | return; |
63 | } | 63 | } |
64 | skb_reserve(skb, local->hw.extra_tx_headroom); | 64 | skb_reserve(skb, local->hw.extra_tx_headroom); |
65 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 65 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
66 | memset(mgmt, 0, 24); | 66 | memset(mgmt, 0, 24); |
67 | memcpy(mgmt->da, da, ETH_ALEN); | 67 | memcpy(mgmt->da, da, ETH_ALEN); |
68 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 68 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
69 | if (sdata->vif.type == NL80211_IFTYPE_AP || | 69 | if (sdata->vif.type == NL80211_IFTYPE_AP || |
70 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 70 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
71 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | 71 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); |
72 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) | 72 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) |
73 | memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); | 73 | memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); |
74 | 74 | ||
@@ -104,7 +104,7 @@ void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u1 | |||
104 | skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); | 104 | skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); |
105 | if (!skb) { | 105 | if (!skb) { |
106 | printk(KERN_ERR "%s: failed to allocate buffer for " | 106 | printk(KERN_ERR "%s: failed to allocate buffer for " |
107 | "bar frame\n", sdata->dev->name); | 107 | "bar frame\n", sdata->name); |
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | skb_reserve(skb, local->hw.extra_tx_headroom); | 110 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -113,7 +113,7 @@ void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u1 | |||
113 | bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | | 113 | bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | |
114 | IEEE80211_STYPE_BACK_REQ); | 114 | IEEE80211_STYPE_BACK_REQ); |
115 | memcpy(bar->ra, ra, ETH_ALEN); | 115 | memcpy(bar->ra, ra, ETH_ALEN); |
116 | memcpy(bar->ta, sdata->dev->dev_addr, ETH_ALEN); | 116 | memcpy(bar->ta, sdata->vif.addr, ETH_ALEN); |
117 | bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL; | 117 | bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL; |
118 | bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA; | 118 | bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA; |
119 | bar_control |= (u16)(tid << 12); | 119 | bar_control |= (u16)(tid << 12); |
@@ -144,7 +144,7 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
144 | *state = HT_AGG_STATE_REQ_STOP_BA_MSK | | 144 | *state = HT_AGG_STATE_REQ_STOP_BA_MSK | |
145 | (initiator << HT_AGG_STATE_INITIATOR_SHIFT); | 145 | (initiator << HT_AGG_STATE_INITIATOR_SHIFT); |
146 | 146 | ||
147 | ret = drv_ampdu_action(local, &sta->sdata->vif, | 147 | ret = drv_ampdu_action(local, sta->sdata, |
148 | IEEE80211_AMPDU_TX_STOP, | 148 | IEEE80211_AMPDU_TX_STOP, |
149 | &sta->sta, tid, NULL); | 149 | &sta->sta, tid, NULL); |
150 | 150 | ||
@@ -303,8 +303,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid) | |||
303 | 303 | ||
304 | start_seq_num = sta->tid_seq[tid]; | 304 | start_seq_num = sta->tid_seq[tid]; |
305 | 305 | ||
306 | ret = drv_ampdu_action(local, &sdata->vif, | 306 | ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START, |
307 | IEEE80211_AMPDU_TX_START, | ||
308 | pubsta, tid, &start_seq_num); | 307 | pubsta, tid, &start_seq_num); |
309 | 308 | ||
310 | if (ret) { | 309 | if (ret) { |
@@ -420,7 +419,7 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local, | |||
420 | ieee80211_agg_splice_finish(local, sta, tid); | 419 | ieee80211_agg_splice_finish(local, sta, tid); |
421 | spin_unlock(&local->ampdu_lock); | 420 | spin_unlock(&local->ampdu_lock); |
422 | 421 | ||
423 | drv_ampdu_action(local, &sta->sdata->vif, | 422 | drv_ampdu_action(local, sta->sdata, |
424 | IEEE80211_AMPDU_TX_OPERATIONAL, | 423 | IEEE80211_AMPDU_TX_OPERATIONAL, |
425 | &sta->sta, tid, NULL); | 424 | &sta->sta, tid, NULL); |
426 | } | 425 | } |
@@ -441,7 +440,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) | |||
441 | } | 440 | } |
442 | 441 | ||
443 | rcu_read_lock(); | 442 | rcu_read_lock(); |
444 | sta = sta_info_get(local, ra); | 443 | sta = sta_info_get(sdata, ra); |
445 | if (!sta) { | 444 | if (!sta) { |
446 | rcu_read_unlock(); | 445 | rcu_read_unlock(); |
447 | #ifdef CONFIG_MAC80211_HT_DEBUG | 446 | #ifdef CONFIG_MAC80211_HT_DEBUG |
@@ -489,7 +488,7 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, | |||
489 | #ifdef CONFIG_MAC80211_HT_DEBUG | 488 | #ifdef CONFIG_MAC80211_HT_DEBUG |
490 | if (net_ratelimit()) | 489 | if (net_ratelimit()) |
491 | printk(KERN_WARNING "%s: Not enough memory, " | 490 | printk(KERN_WARNING "%s: Not enough memory, " |
492 | "dropping start BA session", skb->dev->name); | 491 | "dropping start BA session", sdata->name); |
493 | #endif | 492 | #endif |
494 | return; | 493 | return; |
495 | } | 494 | } |
@@ -564,7 +563,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid) | |||
564 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 563 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
565 | 564 | ||
566 | rcu_read_lock(); | 565 | rcu_read_lock(); |
567 | sta = sta_info_get(local, ra); | 566 | sta = sta_info_get(sdata, ra); |
568 | if (!sta) { | 567 | if (!sta) { |
569 | #ifdef CONFIG_MAC80211_HT_DEBUG | 568 | #ifdef CONFIG_MAC80211_HT_DEBUG |
570 | printk(KERN_DEBUG "Could not find station: %pM\n", ra); | 569 | printk(KERN_DEBUG "Could not find station: %pM\n", ra); |
@@ -621,7 +620,7 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, | |||
621 | #ifdef CONFIG_MAC80211_HT_DEBUG | 620 | #ifdef CONFIG_MAC80211_HT_DEBUG |
622 | if (net_ratelimit()) | 621 | if (net_ratelimit()) |
623 | printk(KERN_WARNING "%s: Not enough memory, " | 622 | printk(KERN_WARNING "%s: Not enough memory, " |
624 | "dropping stop BA session", skb->dev->name); | 623 | "dropping stop BA session", sdata->name); |
625 | #endif | 624 | #endif |
626 | return; | 625 | return; |
627 | } | 626 | } |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 6dc3579c0ac5..63843e3e576a 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -150,7 +150,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
150 | rcu_read_lock(); | 150 | rcu_read_lock(); |
151 | 151 | ||
152 | if (mac_addr) { | 152 | if (mac_addr) { |
153 | sta = sta_info_get(sdata->local, mac_addr); | 153 | sta = sta_info_get(sdata, mac_addr); |
154 | if (!sta) { | 154 | if (!sta) { |
155 | ieee80211_key_free(key); | 155 | ieee80211_key_free(key); |
156 | err = -ENOENT; | 156 | err = -ENOENT; |
@@ -181,7 +181,7 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |||
181 | if (mac_addr) { | 181 | if (mac_addr) { |
182 | ret = -ENOENT; | 182 | ret = -ENOENT; |
183 | 183 | ||
184 | sta = sta_info_get(sdata->local, mac_addr); | 184 | sta = sta_info_get(sdata, mac_addr); |
185 | if (!sta) | 185 | if (!sta) |
186 | goto out_unlock; | 186 | goto out_unlock; |
187 | 187 | ||
@@ -228,7 +228,7 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev, | |||
228 | rcu_read_lock(); | 228 | rcu_read_lock(); |
229 | 229 | ||
230 | if (mac_addr) { | 230 | if (mac_addr) { |
231 | sta = sta_info_get(sdata->local, mac_addr); | 231 | sta = sta_info_get(sdata, mac_addr); |
232 | if (!sta) | 232 | if (!sta) |
233 | goto out; | 233 | goto out; |
234 | 234 | ||
@@ -415,15 +415,13 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, | |||
415 | static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, | 415 | static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
416 | u8 *mac, struct station_info *sinfo) | 416 | u8 *mac, struct station_info *sinfo) |
417 | { | 417 | { |
418 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 418 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
419 | struct sta_info *sta; | 419 | struct sta_info *sta; |
420 | int ret = -ENOENT; | 420 | int ret = -ENOENT; |
421 | 421 | ||
422 | rcu_read_lock(); | 422 | rcu_read_lock(); |
423 | 423 | ||
424 | /* XXX: verify sta->dev == dev */ | 424 | sta = sta_info_get(sdata, mac); |
425 | |||
426 | sta = sta_info_get(local, mac); | ||
427 | if (sta) { | 425 | if (sta) { |
428 | ret = 0; | 426 | ret = 0; |
429 | sta_set_sinfo(sta, sinfo); | 427 | sta_set_sinfo(sta, sinfo); |
@@ -732,7 +730,7 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, | |||
732 | } else | 730 | } else |
733 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 731 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
734 | 732 | ||
735 | if (compare_ether_addr(mac, dev->dev_addr) == 0) | 733 | if (compare_ether_addr(mac, sdata->vif.addr) == 0) |
736 | return -EINVAL; | 734 | return -EINVAL; |
737 | 735 | ||
738 | if (is_multicast_ether_addr(mac)) | 736 | if (is_multicast_ether_addr(mac)) |
@@ -779,8 +777,7 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, | |||
779 | if (mac) { | 777 | if (mac) { |
780 | rcu_read_lock(); | 778 | rcu_read_lock(); |
781 | 779 | ||
782 | /* XXX: get sta belonging to dev */ | 780 | sta = sta_info_get(sdata, mac); |
783 | sta = sta_info_get(local, mac); | ||
784 | if (!sta) { | 781 | if (!sta) { |
785 | rcu_read_unlock(); | 782 | rcu_read_unlock(); |
786 | return -ENOENT; | 783 | return -ENOENT; |
@@ -801,14 +798,14 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
801 | u8 *mac, | 798 | u8 *mac, |
802 | struct station_parameters *params) | 799 | struct station_parameters *params) |
803 | { | 800 | { |
801 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
804 | struct ieee80211_local *local = wiphy_priv(wiphy); | 802 | struct ieee80211_local *local = wiphy_priv(wiphy); |
805 | struct sta_info *sta; | 803 | struct sta_info *sta; |
806 | struct ieee80211_sub_if_data *vlansdata; | 804 | struct ieee80211_sub_if_data *vlansdata; |
807 | 805 | ||
808 | rcu_read_lock(); | 806 | rcu_read_lock(); |
809 | 807 | ||
810 | /* XXX: get sta belonging to dev */ | 808 | sta = sta_info_get(sdata, mac); |
811 | sta = sta_info_get(local, mac); | ||
812 | if (!sta) { | 809 | if (!sta) { |
813 | rcu_read_unlock(); | 810 | rcu_read_unlock(); |
814 | return -ENOENT; | 811 | return -ENOENT; |
@@ -847,7 +844,6 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
847 | static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, | 844 | static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, |
848 | u8 *dst, u8 *next_hop) | 845 | u8 *dst, u8 *next_hop) |
849 | { | 846 | { |
850 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
851 | struct ieee80211_sub_if_data *sdata; | 847 | struct ieee80211_sub_if_data *sdata; |
852 | struct mesh_path *mpath; | 848 | struct mesh_path *mpath; |
853 | struct sta_info *sta; | 849 | struct sta_info *sta; |
@@ -856,7 +852,7 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
856 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 852 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
857 | 853 | ||
858 | rcu_read_lock(); | 854 | rcu_read_lock(); |
859 | sta = sta_info_get(local, next_hop); | 855 | sta = sta_info_get(sdata, next_hop); |
860 | if (!sta) { | 856 | if (!sta) { |
861 | rcu_read_unlock(); | 857 | rcu_read_unlock(); |
862 | return -ENOENT; | 858 | return -ENOENT; |
@@ -895,7 +891,6 @@ static int ieee80211_change_mpath(struct wiphy *wiphy, | |||
895 | struct net_device *dev, | 891 | struct net_device *dev, |
896 | u8 *dst, u8 *next_hop) | 892 | u8 *dst, u8 *next_hop) |
897 | { | 893 | { |
898 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
899 | struct ieee80211_sub_if_data *sdata; | 894 | struct ieee80211_sub_if_data *sdata; |
900 | struct mesh_path *mpath; | 895 | struct mesh_path *mpath; |
901 | struct sta_info *sta; | 896 | struct sta_info *sta; |
@@ -904,7 +899,7 @@ static int ieee80211_change_mpath(struct wiphy *wiphy, | |||
904 | 899 | ||
905 | rcu_read_lock(); | 900 | rcu_read_lock(); |
906 | 901 | ||
907 | sta = sta_info_get(local, next_hop); | 902 | sta = sta_info_get(sdata, next_hop); |
908 | if (!sta) { | 903 | if (!sta) { |
909 | rcu_read_unlock(); | 904 | rcu_read_unlock(); |
910 | return -ENOENT; | 905 | return -ENOENT; |
@@ -1324,6 +1319,50 @@ static int ieee80211_testmode_cmd(struct wiphy *wiphy, void *data, int len) | |||
1324 | } | 1319 | } |
1325 | #endif | 1320 | #endif |
1326 | 1321 | ||
1322 | int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata, | ||
1323 | enum ieee80211_smps_mode smps_mode) | ||
1324 | { | ||
1325 | const u8 *ap; | ||
1326 | enum ieee80211_smps_mode old_req; | ||
1327 | int err; | ||
1328 | |||
1329 | old_req = sdata->u.mgd.req_smps; | ||
1330 | sdata->u.mgd.req_smps = smps_mode; | ||
1331 | |||
1332 | if (old_req == smps_mode && | ||
1333 | smps_mode != IEEE80211_SMPS_AUTOMATIC) | ||
1334 | return 0; | ||
1335 | |||
1336 | /* | ||
1337 | * If not associated, or current association is not an HT | ||
1338 | * association, there's no need to send an action frame. | ||
1339 | */ | ||
1340 | if (!sdata->u.mgd.associated || | ||
1341 | sdata->local->oper_channel_type == NL80211_CHAN_NO_HT) { | ||
1342 | mutex_lock(&sdata->local->iflist_mtx); | ||
1343 | ieee80211_recalc_smps(sdata->local, sdata); | ||
1344 | mutex_unlock(&sdata->local->iflist_mtx); | ||
1345 | return 0; | ||
1346 | } | ||
1347 | |||
1348 | ap = sdata->u.mgd.associated->cbss.bssid; | ||
1349 | |||
1350 | if (smps_mode == IEEE80211_SMPS_AUTOMATIC) { | ||
1351 | if (sdata->u.mgd.powersave) | ||
1352 | smps_mode = IEEE80211_SMPS_DYNAMIC; | ||
1353 | else | ||
1354 | smps_mode = IEEE80211_SMPS_OFF; | ||
1355 | } | ||
1356 | |||
1357 | /* send SM PS frame to AP */ | ||
1358 | err = ieee80211_send_smps_action(sdata, smps_mode, | ||
1359 | ap, ap); | ||
1360 | if (err) | ||
1361 | sdata->u.mgd.req_smps = old_req; | ||
1362 | |||
1363 | return err; | ||
1364 | } | ||
1365 | |||
1327 | static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | 1366 | static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, |
1328 | bool enabled, int timeout) | 1367 | bool enabled, int timeout) |
1329 | { | 1368 | { |
@@ -1341,6 +1380,11 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
1341 | sdata->u.mgd.powersave = enabled; | 1380 | sdata->u.mgd.powersave = enabled; |
1342 | conf->dynamic_ps_timeout = timeout; | 1381 | conf->dynamic_ps_timeout = timeout; |
1343 | 1382 | ||
1383 | /* no change, but if automatic follow powersave */ | ||
1384 | mutex_lock(&sdata->u.mgd.mtx); | ||
1385 | __ieee80211_request_smps(sdata, sdata->u.mgd.req_smps); | ||
1386 | mutex_unlock(&sdata->u.mgd.mtx); | ||
1387 | |||
1344 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) | 1388 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) |
1345 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); | 1389 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
1346 | 1390 | ||
@@ -1356,15 +1400,25 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | |||
1356 | { | 1400 | { |
1357 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1401 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1358 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1402 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1359 | int i, err = -EINVAL; | 1403 | int i; |
1360 | u32 target_rate; | 1404 | u32 target_rate; |
1361 | struct ieee80211_supported_band *sband; | 1405 | struct ieee80211_supported_band *sband; |
1362 | 1406 | ||
1407 | /* | ||
1408 | * This _could_ be supported by providing a hook for | ||
1409 | * drivers for this function, but at this point it | ||
1410 | * doesn't seem worth bothering. | ||
1411 | */ | ||
1412 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) | ||
1413 | return -EOPNOTSUPP; | ||
1414 | |||
1363 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1415 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
1364 | 1416 | ||
1365 | /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates | 1417 | /* |
1418 | * target_rate = -1, rate->fixed = 0 means auto only, so use all rates | ||
1366 | * target_rate = X, rate->fixed = 1 means only rate X | 1419 | * target_rate = X, rate->fixed = 1 means only rate X |
1367 | * target_rate = X, rate->fixed = 0 means all rates <= X */ | 1420 | * target_rate = X, rate->fixed = 0 means all rates <= X |
1421 | */ | ||
1368 | sdata->max_ratectrl_rateidx = -1; | 1422 | sdata->max_ratectrl_rateidx = -1; |
1369 | sdata->force_unicast_rateidx = -1; | 1423 | sdata->force_unicast_rateidx = -1; |
1370 | 1424 | ||
@@ -1375,20 +1429,18 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | |||
1375 | else | 1429 | else |
1376 | return 0; | 1430 | return 0; |
1377 | 1431 | ||
1378 | for (i=0; i< sband->n_bitrates; i++) { | 1432 | for (i = 0; i< sband->n_bitrates; i++) { |
1379 | struct ieee80211_rate *brate = &sband->bitrates[i]; | 1433 | if (target_rate != sband->bitrates[i].bitrate) |
1380 | int this_rate = brate->bitrate; | 1434 | continue; |
1381 | 1435 | ||
1382 | if (target_rate == this_rate) { | 1436 | /* requested bitrate found */ |
1383 | sdata->max_ratectrl_rateidx = i; | 1437 | sdata->max_ratectrl_rateidx = i; |
1384 | if (mask->fixed) | 1438 | if (mask->fixed) |
1385 | sdata->force_unicast_rateidx = i; | 1439 | sdata->force_unicast_rateidx = i; |
1386 | err = 0; | 1440 | return 0; |
1387 | break; | ||
1388 | } | ||
1389 | } | 1441 | } |
1390 | 1442 | ||
1391 | return err; | 1443 | return -EINVAL; |
1392 | } | 1444 | } |
1393 | 1445 | ||
1394 | struct cfg80211_ops mac80211_config_ops = { | 1446 | struct cfg80211_ops mac80211_config_ops = { |
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index e0f5224630da..d12e743cb4e1 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -56,7 +56,7 @@ KEY_CONF_FILE(keyidx, D); | |||
56 | KEY_CONF_FILE(hw_key_idx, D); | 56 | KEY_CONF_FILE(hw_key_idx, D); |
57 | KEY_FILE(flags, X); | 57 | KEY_FILE(flags, X); |
58 | KEY_FILE(tx_rx_count, D); | 58 | KEY_FILE(tx_rx_count, D); |
59 | KEY_READ(ifindex, sdata->dev->ifindex, 20, "%d\n"); | 59 | KEY_READ(ifindex, sdata->name, IFNAMSIZ + 2, "%s\n"); |
60 | KEY_OPS(ifindex); | 60 | KEY_OPS(ifindex); |
61 | 61 | ||
62 | static ssize_t key_algorithm_read(struct file *file, | 62 | static ssize_t key_algorithm_read(struct file *file, |
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 472b2039906c..355983503885 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -41,6 +41,30 @@ static ssize_t ieee80211_if_read( | |||
41 | return ret; | 41 | return ret; |
42 | } | 42 | } |
43 | 43 | ||
44 | static ssize_t ieee80211_if_write( | ||
45 | struct ieee80211_sub_if_data *sdata, | ||
46 | const char __user *userbuf, | ||
47 | size_t count, loff_t *ppos, | ||
48 | ssize_t (*write)(struct ieee80211_sub_if_data *, const char *, int)) | ||
49 | { | ||
50 | u8 *buf; | ||
51 | ssize_t ret = -ENODEV; | ||
52 | |||
53 | buf = kzalloc(count, GFP_KERNEL); | ||
54 | if (!buf) | ||
55 | return -ENOMEM; | ||
56 | |||
57 | if (copy_from_user(buf, userbuf, count)) | ||
58 | return -EFAULT; | ||
59 | |||
60 | rtnl_lock(); | ||
61 | if (sdata->dev->reg_state == NETREG_REGISTERED) | ||
62 | ret = (*write)(sdata, buf, count); | ||
63 | rtnl_unlock(); | ||
64 | |||
65 | return ret; | ||
66 | } | ||
67 | |||
44 | #define IEEE80211_IF_FMT(name, field, format_string) \ | 68 | #define IEEE80211_IF_FMT(name, field, format_string) \ |
45 | static ssize_t ieee80211_if_fmt_##name( \ | 69 | static ssize_t ieee80211_if_fmt_##name( \ |
46 | const struct ieee80211_sub_if_data *sdata, char *buf, \ | 70 | const struct ieee80211_sub_if_data *sdata, char *buf, \ |
@@ -71,7 +95,7 @@ static ssize_t ieee80211_if_fmt_##name( \ | |||
71 | return scnprintf(buf, buflen, "%pM\n", sdata->field); \ | 95 | return scnprintf(buf, buflen, "%pM\n", sdata->field); \ |
72 | } | 96 | } |
73 | 97 | ||
74 | #define __IEEE80211_IF_FILE(name) \ | 98 | #define __IEEE80211_IF_FILE(name, _write) \ |
75 | static ssize_t ieee80211_if_read_##name(struct file *file, \ | 99 | static ssize_t ieee80211_if_read_##name(struct file *file, \ |
76 | char __user *userbuf, \ | 100 | char __user *userbuf, \ |
77 | size_t count, loff_t *ppos) \ | 101 | size_t count, loff_t *ppos) \ |
@@ -82,12 +106,24 @@ static ssize_t ieee80211_if_read_##name(struct file *file, \ | |||
82 | } \ | 106 | } \ |
83 | static const struct file_operations name##_ops = { \ | 107 | static const struct file_operations name##_ops = { \ |
84 | .read = ieee80211_if_read_##name, \ | 108 | .read = ieee80211_if_read_##name, \ |
109 | .write = (_write), \ | ||
85 | .open = mac80211_open_file_generic, \ | 110 | .open = mac80211_open_file_generic, \ |
86 | } | 111 | } |
87 | 112 | ||
113 | #define __IEEE80211_IF_FILE_W(name) \ | ||
114 | static ssize_t ieee80211_if_write_##name(struct file *file, \ | ||
115 | const char __user *userbuf, \ | ||
116 | size_t count, loff_t *ppos) \ | ||
117 | { \ | ||
118 | return ieee80211_if_write(file->private_data, userbuf, count, \ | ||
119 | ppos, ieee80211_if_parse_##name); \ | ||
120 | } \ | ||
121 | __IEEE80211_IF_FILE(name, ieee80211_if_write_##name) | ||
122 | |||
123 | |||
88 | #define IEEE80211_IF_FILE(name, field, format) \ | 124 | #define IEEE80211_IF_FILE(name, field, format) \ |
89 | IEEE80211_IF_FMT_##format(name, field) \ | 125 | IEEE80211_IF_FMT_##format(name, field) \ |
90 | __IEEE80211_IF_FILE(name) | 126 | __IEEE80211_IF_FILE(name, NULL) |
91 | 127 | ||
92 | /* common attributes */ | 128 | /* common attributes */ |
93 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); | 129 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); |
@@ -99,6 +135,70 @@ IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC); | |||
99 | IEEE80211_IF_FILE(aid, u.mgd.aid, DEC); | 135 | IEEE80211_IF_FILE(aid, u.mgd.aid, DEC); |
100 | IEEE80211_IF_FILE(capab, u.mgd.capab, HEX); | 136 | IEEE80211_IF_FILE(capab, u.mgd.capab, HEX); |
101 | 137 | ||
138 | static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata, | ||
139 | enum ieee80211_smps_mode smps_mode) | ||
140 | { | ||
141 | struct ieee80211_local *local = sdata->local; | ||
142 | int err; | ||
143 | |||
144 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_STATIC_SMPS) && | ||
145 | smps_mode == IEEE80211_SMPS_STATIC) | ||
146 | return -EINVAL; | ||
147 | |||
148 | /* auto should be dynamic if in PS mode */ | ||
149 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS) && | ||
150 | (smps_mode == IEEE80211_SMPS_DYNAMIC || | ||
151 | smps_mode == IEEE80211_SMPS_AUTOMATIC)) | ||
152 | return -EINVAL; | ||
153 | |||
154 | /* supported only on managed interfaces for now */ | ||
155 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | ||
156 | return -EOPNOTSUPP; | ||
157 | |||
158 | mutex_lock(&local->iflist_mtx); | ||
159 | err = __ieee80211_request_smps(sdata, smps_mode); | ||
160 | mutex_unlock(&local->iflist_mtx); | ||
161 | |||
162 | return err; | ||
163 | } | ||
164 | |||
165 | static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = { | ||
166 | [IEEE80211_SMPS_AUTOMATIC] = "auto", | ||
167 | [IEEE80211_SMPS_OFF] = "off", | ||
168 | [IEEE80211_SMPS_STATIC] = "static", | ||
169 | [IEEE80211_SMPS_DYNAMIC] = "dynamic", | ||
170 | }; | ||
171 | |||
172 | static ssize_t ieee80211_if_fmt_smps(const struct ieee80211_sub_if_data *sdata, | ||
173 | char *buf, int buflen) | ||
174 | { | ||
175 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | ||
176 | return -EOPNOTSUPP; | ||
177 | |||
178 | return snprintf(buf, buflen, "request: %s\nused: %s\n", | ||
179 | smps_modes[sdata->u.mgd.req_smps], | ||
180 | smps_modes[sdata->u.mgd.ap_smps]); | ||
181 | } | ||
182 | |||
183 | static ssize_t ieee80211_if_parse_smps(struct ieee80211_sub_if_data *sdata, | ||
184 | const char *buf, int buflen) | ||
185 | { | ||
186 | enum ieee80211_smps_mode mode; | ||
187 | |||
188 | for (mode = 0; mode < IEEE80211_SMPS_NUM_MODES; mode++) { | ||
189 | if (strncmp(buf, smps_modes[mode], buflen) == 0) { | ||
190 | int err = ieee80211_set_smps(sdata, mode); | ||
191 | if (!err) | ||
192 | return buflen; | ||
193 | return err; | ||
194 | } | ||
195 | } | ||
196 | |||
197 | return -EINVAL; | ||
198 | } | ||
199 | |||
200 | __IEEE80211_IF_FILE_W(smps); | ||
201 | |||
102 | /* AP attributes */ | 202 | /* AP attributes */ |
103 | IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC); | 203 | IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC); |
104 | IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC); | 204 | IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC); |
@@ -109,7 +209,7 @@ static ssize_t ieee80211_if_fmt_num_buffered_multicast( | |||
109 | return scnprintf(buf, buflen, "%u\n", | 209 | return scnprintf(buf, buflen, "%u\n", |
110 | skb_queue_len(&sdata->u.ap.ps_bc_buf)); | 210 | skb_queue_len(&sdata->u.ap.ps_bc_buf)); |
111 | } | 211 | } |
112 | __IEEE80211_IF_FILE(num_buffered_multicast); | 212 | __IEEE80211_IF_FILE(num_buffered_multicast, NULL); |
113 | 213 | ||
114 | /* WDS attributes */ | 214 | /* WDS attributes */ |
115 | IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC); | 215 | IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC); |
@@ -158,6 +258,10 @@ IEEE80211_IF_FILE(dot11MeshHWMPRootMode, | |||
158 | debugfs_create_file(#name, 0400, sdata->debugfs.dir, \ | 258 | debugfs_create_file(#name, 0400, sdata->debugfs.dir, \ |
159 | sdata, &name##_ops); | 259 | sdata, &name##_ops); |
160 | 260 | ||
261 | #define DEBUGFS_ADD_MODE(name, mode) \ | ||
262 | debugfs_create_file(#name, mode, sdata->debugfs.dir, \ | ||
263 | sdata, &name##_ops); | ||
264 | |||
161 | static void add_sta_files(struct ieee80211_sub_if_data *sdata) | 265 | static void add_sta_files(struct ieee80211_sub_if_data *sdata) |
162 | { | 266 | { |
163 | DEBUGFS_ADD(drop_unencrypted, sta); | 267 | DEBUGFS_ADD(drop_unencrypted, sta); |
@@ -167,6 +271,7 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata) | |||
167 | DEBUGFS_ADD(bssid, sta); | 271 | DEBUGFS_ADD(bssid, sta); |
168 | DEBUGFS_ADD(aid, sta); | 272 | DEBUGFS_ADD(aid, sta); |
169 | DEBUGFS_ADD(capab, sta); | 273 | DEBUGFS_ADD(capab, sta); |
274 | DEBUGFS_ADD_MODE(smps, 0600); | ||
170 | } | 275 | } |
171 | 276 | ||
172 | static void add_ap_files(struct ieee80211_sub_if_data *sdata) | 277 | static void add_ap_files(struct ieee80211_sub_if_data *sdata) |
@@ -280,16 +385,11 @@ static void add_files(struct ieee80211_sub_if_data *sdata) | |||
280 | } | 385 | } |
281 | } | 386 | } |
282 | 387 | ||
283 | static int notif_registered; | ||
284 | |||
285 | void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata) | 388 | void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata) |
286 | { | 389 | { |
287 | char buf[10+IFNAMSIZ]; | 390 | char buf[10+IFNAMSIZ]; |
288 | 391 | ||
289 | if (!notif_registered) | 392 | sprintf(buf, "netdev:%s", sdata->name); |
290 | return; | ||
291 | |||
292 | sprintf(buf, "netdev:%s", sdata->dev->name); | ||
293 | sdata->debugfs.dir = debugfs_create_dir(buf, | 393 | sdata->debugfs.dir = debugfs_create_dir(buf, |
294 | sdata->local->hw.wiphy->debugfsdir); | 394 | sdata->local->hw.wiphy->debugfsdir); |
295 | add_files(sdata); | 395 | add_files(sdata); |
@@ -304,58 +404,18 @@ void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) | |||
304 | sdata->debugfs.dir = NULL; | 404 | sdata->debugfs.dir = NULL; |
305 | } | 405 | } |
306 | 406 | ||
307 | static int netdev_notify(struct notifier_block *nb, | 407 | void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) |
308 | unsigned long state, | ||
309 | void *ndev) | ||
310 | { | 408 | { |
311 | struct net_device *dev = ndev; | ||
312 | struct dentry *dir; | 409 | struct dentry *dir; |
313 | struct ieee80211_sub_if_data *sdata; | 410 | char buf[10 + IFNAMSIZ]; |
314 | char buf[10+IFNAMSIZ]; | ||
315 | |||
316 | if (state != NETDEV_CHANGENAME) | ||
317 | return 0; | ||
318 | |||
319 | if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) | ||
320 | return 0; | ||
321 | |||
322 | if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) | ||
323 | return 0; | ||
324 | |||
325 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
326 | 411 | ||
327 | dir = sdata->debugfs.dir; | 412 | dir = sdata->debugfs.dir; |
328 | 413 | ||
329 | if (!dir) | 414 | if (!dir) |
330 | return 0; | 415 | return; |
331 | 416 | ||
332 | sprintf(buf, "netdev:%s", dev->name); | 417 | sprintf(buf, "netdev:%s", sdata->name); |
333 | if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) | 418 | if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) |
334 | printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs " | 419 | printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs " |
335 | "dir to %s\n", buf); | 420 | "dir to %s\n", buf); |
336 | |||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | static struct notifier_block mac80211_debugfs_netdev_notifier = { | ||
341 | .notifier_call = netdev_notify, | ||
342 | }; | ||
343 | |||
344 | void ieee80211_debugfs_netdev_init(void) | ||
345 | { | ||
346 | int err; | ||
347 | |||
348 | err = register_netdevice_notifier(&mac80211_debugfs_netdev_notifier); | ||
349 | if (err) { | ||
350 | printk(KERN_ERR | ||
351 | "mac80211: failed to install netdev notifier," | ||
352 | " disabling per-netdev debugfs!\n"); | ||
353 | } else | ||
354 | notif_registered = 1; | ||
355 | } | ||
356 | |||
357 | void ieee80211_debugfs_netdev_exit(void) | ||
358 | { | ||
359 | unregister_netdevice_notifier(&mac80211_debugfs_netdev_notifier); | ||
360 | notif_registered = 0; | ||
361 | } | 421 | } |
diff --git a/net/mac80211/debugfs_netdev.h b/net/mac80211/debugfs_netdev.h index 7af731f0b731..79025e79f4d6 100644 --- a/net/mac80211/debugfs_netdev.h +++ b/net/mac80211/debugfs_netdev.h | |||
@@ -6,8 +6,7 @@ | |||
6 | #ifdef CONFIG_MAC80211_DEBUGFS | 6 | #ifdef CONFIG_MAC80211_DEBUGFS |
7 | void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata); | 7 | void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata); |
8 | void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata); | 8 | void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata); |
9 | void ieee80211_debugfs_netdev_init(void); | 9 | void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata); |
10 | void ieee80211_debugfs_netdev_exit(void); | ||
11 | #else | 10 | #else |
12 | static inline void ieee80211_debugfs_add_netdev( | 11 | static inline void ieee80211_debugfs_add_netdev( |
13 | struct ieee80211_sub_if_data *sdata) | 12 | struct ieee80211_sub_if_data *sdata) |
@@ -15,10 +14,8 @@ static inline void ieee80211_debugfs_add_netdev( | |||
15 | static inline void ieee80211_debugfs_remove_netdev( | 14 | static inline void ieee80211_debugfs_remove_netdev( |
16 | struct ieee80211_sub_if_data *sdata) | 15 | struct ieee80211_sub_if_data *sdata) |
17 | {} | 16 | {} |
18 | static inline void ieee80211_debugfs_netdev_init(void) | 17 | static inline void ieee80211_debugfs_rename_netdev( |
19 | {} | 18 | struct ieee80211_sub_if_data *sdata) |
20 | |||
21 | static inline void ieee80211_debugfs_netdev_exit(void) | ||
22 | {} | 19 | {} |
23 | #endif | 20 | #endif |
24 | 21 | ||
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index 3f41608c8081..0d4a759ba72c 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -44,7 +44,7 @@ static const struct file_operations sta_ ##name## _ops = { \ | |||
44 | STA_OPS(name) | 44 | STA_OPS(name) |
45 | 45 | ||
46 | STA_FILE(aid, sta.aid, D); | 46 | STA_FILE(aid, sta.aid, D); |
47 | STA_FILE(dev, sdata->dev->name, S); | 47 | STA_FILE(dev, sdata->name, S); |
48 | STA_FILE(rx_packets, rx_packets, LU); | 48 | STA_FILE(rx_packets, rx_packets, LU); |
49 | STA_FILE(tx_packets, tx_packets, LU); | 49 | STA_FILE(tx_packets, tx_packets, LU); |
50 | STA_FILE(rx_bytes, rx_bytes, LU); | 50 | STA_FILE(rx_bytes, rx_bytes, LU); |
@@ -160,7 +160,12 @@ STA_OPS(agg_status); | |||
160 | static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf, | 160 | static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf, |
161 | size_t count, loff_t *ppos) | 161 | size_t count, loff_t *ppos) |
162 | { | 162 | { |
163 | char buf[200], *p = buf; | 163 | #define PRINT_HT_CAP(_cond, _str) \ |
164 | do { \ | ||
165 | if (_cond) \ | ||
166 | p += scnprintf(p, sizeof(buf)+buf-p, "\t" _str "\n"); \ | ||
167 | } while (0) | ||
168 | char buf[1024], *p = buf; | ||
164 | int i; | 169 | int i; |
165 | struct sta_info *sta = file->private_data; | 170 | struct sta_info *sta = file->private_data; |
166 | struct ieee80211_sta_ht_cap *htc = &sta->sta.ht_cap; | 171 | struct ieee80211_sta_ht_cap *htc = &sta->sta.ht_cap; |
@@ -168,15 +173,64 @@ static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf, | |||
168 | p += scnprintf(p, sizeof(buf) + buf - p, "ht %ssupported\n", | 173 | p += scnprintf(p, sizeof(buf) + buf - p, "ht %ssupported\n", |
169 | htc->ht_supported ? "" : "not "); | 174 | htc->ht_supported ? "" : "not "); |
170 | if (htc->ht_supported) { | 175 | if (htc->ht_supported) { |
171 | p += scnprintf(p, sizeof(buf)+buf-p, "cap: %#.2x\n", htc->cap); | 176 | p += scnprintf(p, sizeof(buf)+buf-p, "cap: %#.4x\n", htc->cap); |
177 | |||
178 | PRINT_HT_CAP((htc->cap & BIT(0)), "RX LDCP"); | ||
179 | PRINT_HT_CAP((htc->cap & BIT(1)), "HT20/HT40"); | ||
180 | PRINT_HT_CAP(!(htc->cap & BIT(1)), "HT20"); | ||
181 | |||
182 | PRINT_HT_CAP(((htc->cap >> 2) & 0x3) == 0, "Static SM Power Save"); | ||
183 | PRINT_HT_CAP(((htc->cap >> 2) & 0x3) == 1, "Dynamic SM Power Save"); | ||
184 | PRINT_HT_CAP(((htc->cap >> 2) & 0x3) == 3, "SM Power Save disabled"); | ||
185 | |||
186 | PRINT_HT_CAP((htc->cap & BIT(4)), "RX Greenfield"); | ||
187 | PRINT_HT_CAP((htc->cap & BIT(5)), "RX HT20 SGI"); | ||
188 | PRINT_HT_CAP((htc->cap & BIT(6)), "RX HT40 SGI"); | ||
189 | PRINT_HT_CAP((htc->cap & BIT(7)), "TX STBC"); | ||
190 | |||
191 | PRINT_HT_CAP(((htc->cap >> 8) & 0x3) == 0, "No RX STBC"); | ||
192 | PRINT_HT_CAP(((htc->cap >> 8) & 0x3) == 1, "RX STBC 1-stream"); | ||
193 | PRINT_HT_CAP(((htc->cap >> 8) & 0x3) == 2, "RX STBC 2-streams"); | ||
194 | PRINT_HT_CAP(((htc->cap >> 8) & 0x3) == 3, "RX STBC 3-streams"); | ||
195 | |||
196 | PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack"); | ||
197 | |||
198 | PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: " | ||
199 | "3839 bytes"); | ||
200 | PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: " | ||
201 | "7935 bytes"); | ||
202 | |||
203 | /* | ||
204 | * For beacons and probe response this would mean the BSS | ||
205 | * does or does not allow the usage of DSSS/CCK HT40. | ||
206 | * Otherwise it means the STA does or does not use | ||
207 | * DSSS/CCK HT40. | ||
208 | */ | ||
209 | PRINT_HT_CAP((htc->cap & BIT(12)), "DSSS/CCK HT40"); | ||
210 | PRINT_HT_CAP(!(htc->cap & BIT(12)), "No DSSS/CCK HT40"); | ||
211 | |||
212 | /* BIT(13) is reserved */ | ||
213 | |||
214 | PRINT_HT_CAP((htc->cap & BIT(14)), "40 MHz Intolerant"); | ||
215 | |||
216 | PRINT_HT_CAP((htc->cap & BIT(15)), "L-SIG TXOP protection"); | ||
217 | |||
172 | p += scnprintf(p, sizeof(buf)+buf-p, "ampdu factor/density: %d/%d\n", | 218 | p += scnprintf(p, sizeof(buf)+buf-p, "ampdu factor/density: %d/%d\n", |
173 | htc->ampdu_factor, htc->ampdu_density); | 219 | htc->ampdu_factor, htc->ampdu_density); |
174 | p += scnprintf(p, sizeof(buf)+buf-p, "MCS mask:"); | 220 | p += scnprintf(p, sizeof(buf)+buf-p, "MCS mask:"); |
221 | |||
175 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) | 222 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) |
176 | p += scnprintf(p, sizeof(buf)+buf-p, " %.2x", | 223 | p += scnprintf(p, sizeof(buf)+buf-p, " %.2x", |
177 | htc->mcs.rx_mask[i]); | 224 | htc->mcs.rx_mask[i]); |
178 | p += scnprintf(p, sizeof(buf)+buf-p, "\nMCS rx highest: %d\n", | 225 | p += scnprintf(p, sizeof(buf)+buf-p, "\n"); |
179 | le16_to_cpu(htc->mcs.rx_highest)); | 226 | |
227 | /* If not set this is meaningless */ | ||
228 | if (le16_to_cpu(htc->mcs.rx_highest)) { | ||
229 | p += scnprintf(p, sizeof(buf)+buf-p, | ||
230 | "MCS rx highest: %d Mbps\n", | ||
231 | le16_to_cpu(htc->mcs.rx_highest)); | ||
232 | } | ||
233 | |||
180 | p += scnprintf(p, sizeof(buf)+buf-p, "MCS tx params: %x\n", | 234 | p += scnprintf(p, sizeof(buf)+buf-p, "MCS tx params: %x\n", |
181 | htc->mcs.tx_params); | 235 | htc->mcs.tx_params); |
182 | } | 236 | } |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 921dd9c9ff62..727e4cf7b8a6 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -39,7 +39,7 @@ static inline int drv_add_interface(struct ieee80211_local *local, | |||
39 | struct ieee80211_if_init_conf *conf) | 39 | struct ieee80211_if_init_conf *conf) |
40 | { | 40 | { |
41 | int ret = local->ops->add_interface(&local->hw, conf); | 41 | int ret = local->ops->add_interface(&local->hw, conf); |
42 | trace_drv_add_interface(local, conf->mac_addr, conf->vif, ret); | 42 | trace_drv_add_interface(local, vif_to_sdata(conf->vif), ret); |
43 | return ret; | 43 | return ret; |
44 | } | 44 | } |
45 | 45 | ||
@@ -47,7 +47,7 @@ static inline void drv_remove_interface(struct ieee80211_local *local, | |||
47 | struct ieee80211_if_init_conf *conf) | 47 | struct ieee80211_if_init_conf *conf) |
48 | { | 48 | { |
49 | local->ops->remove_interface(&local->hw, conf); | 49 | local->ops->remove_interface(&local->hw, conf); |
50 | trace_drv_remove_interface(local, conf->mac_addr, conf->vif); | 50 | trace_drv_remove_interface(local, vif_to_sdata(conf->vif)); |
51 | } | 51 | } |
52 | 52 | ||
53 | static inline int drv_config(struct ieee80211_local *local, u32 changed) | 53 | static inline int drv_config(struct ieee80211_local *local, u32 changed) |
@@ -58,13 +58,13 @@ static inline int drv_config(struct ieee80211_local *local, u32 changed) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | static inline void drv_bss_info_changed(struct ieee80211_local *local, | 60 | static inline void drv_bss_info_changed(struct ieee80211_local *local, |
61 | struct ieee80211_vif *vif, | 61 | struct ieee80211_sub_if_data *sdata, |
62 | struct ieee80211_bss_conf *info, | 62 | struct ieee80211_bss_conf *info, |
63 | u32 changed) | 63 | u32 changed) |
64 | { | 64 | { |
65 | if (local->ops->bss_info_changed) | 65 | if (local->ops->bss_info_changed) |
66 | local->ops->bss_info_changed(&local->hw, vif, info, changed); | 66 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
67 | trace_drv_bss_info_changed(local, vif, info, changed); | 67 | trace_drv_bss_info_changed(local, sdata, info, changed); |
68 | } | 68 | } |
69 | 69 | ||
70 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, | 70 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, |
@@ -106,12 +106,13 @@ static inline int drv_set_tim(struct ieee80211_local *local, | |||
106 | } | 106 | } |
107 | 107 | ||
108 | static inline int drv_set_key(struct ieee80211_local *local, | 108 | static inline int drv_set_key(struct ieee80211_local *local, |
109 | enum set_key_cmd cmd, struct ieee80211_vif *vif, | 109 | enum set_key_cmd cmd, |
110 | struct ieee80211_sub_if_data *sdata, | ||
110 | struct ieee80211_sta *sta, | 111 | struct ieee80211_sta *sta, |
111 | struct ieee80211_key_conf *key) | 112 | struct ieee80211_key_conf *key) |
112 | { | 113 | { |
113 | int ret = local->ops->set_key(&local->hw, cmd, vif, sta, key); | 114 | int ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); |
114 | trace_drv_set_key(local, cmd, vif, sta, key, ret); | 115 | trace_drv_set_key(local, cmd, sdata, sta, key, ret); |
115 | return ret; | 116 | return ret; |
116 | } | 117 | } |
117 | 118 | ||
@@ -179,13 +180,13 @@ static inline int drv_set_rts_threshold(struct ieee80211_local *local, | |||
179 | } | 180 | } |
180 | 181 | ||
181 | static inline void drv_sta_notify(struct ieee80211_local *local, | 182 | static inline void drv_sta_notify(struct ieee80211_local *local, |
182 | struct ieee80211_vif *vif, | 183 | struct ieee80211_sub_if_data *sdata, |
183 | enum sta_notify_cmd cmd, | 184 | enum sta_notify_cmd cmd, |
184 | struct ieee80211_sta *sta) | 185 | struct ieee80211_sta *sta) |
185 | { | 186 | { |
186 | if (local->ops->sta_notify) | 187 | if (local->ops->sta_notify) |
187 | local->ops->sta_notify(&local->hw, vif, cmd, sta); | 188 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
188 | trace_drv_sta_notify(local, vif, cmd, sta); | 189 | trace_drv_sta_notify(local, sdata, cmd, sta); |
189 | } | 190 | } |
190 | 191 | ||
191 | static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue, | 192 | static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue, |
@@ -239,16 +240,16 @@ static inline int drv_tx_last_beacon(struct ieee80211_local *local) | |||
239 | } | 240 | } |
240 | 241 | ||
241 | static inline int drv_ampdu_action(struct ieee80211_local *local, | 242 | static inline int drv_ampdu_action(struct ieee80211_local *local, |
242 | struct ieee80211_vif *vif, | 243 | struct ieee80211_sub_if_data *sdata, |
243 | enum ieee80211_ampdu_mlme_action action, | 244 | enum ieee80211_ampdu_mlme_action action, |
244 | struct ieee80211_sta *sta, u16 tid, | 245 | struct ieee80211_sta *sta, u16 tid, |
245 | u16 *ssn) | 246 | u16 *ssn) |
246 | { | 247 | { |
247 | int ret = -EOPNOTSUPP; | 248 | int ret = -EOPNOTSUPP; |
248 | if (local->ops->ampdu_action) | 249 | if (local->ops->ampdu_action) |
249 | ret = local->ops->ampdu_action(&local->hw, vif, action, | 250 | ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, |
250 | sta, tid, ssn); | 251 | sta, tid, ssn); |
251 | trace_drv_ampdu_action(local, vif, action, sta, tid, ssn, ret); | 252 | trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, ret); |
252 | return ret; | 253 | return ret; |
253 | } | 254 | } |
254 | 255 | ||
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index ee94ea0c67e9..7a849b920165 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h | |||
@@ -25,10 +25,12 @@ static inline void trace_ ## name(proto) {} | |||
25 | #define STA_PR_FMT " sta:%pM" | 25 | #define STA_PR_FMT " sta:%pM" |
26 | #define STA_PR_ARG __entry->sta_addr | 26 | #define STA_PR_ARG __entry->sta_addr |
27 | 27 | ||
28 | #define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, vif) | 28 | #define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \ |
29 | #define VIF_ASSIGN __entry->vif_type = vif ? vif->type : 0; __entry->vif = vif | 29 | __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") |
30 | #define VIF_PR_FMT " vif:%p(%d)" | 30 | #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ |
31 | #define VIF_PR_ARG __entry->vif, __entry->vif_type | 31 | __assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") |
32 | #define VIF_PR_FMT " vif:%s(%d)" | ||
33 | #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type | ||
32 | 34 | ||
33 | TRACE_EVENT(drv_start, | 35 | TRACE_EVENT(drv_start, |
34 | TP_PROTO(struct ieee80211_local *local, int ret), | 36 | TP_PROTO(struct ieee80211_local *local, int ret), |
@@ -70,11 +72,10 @@ TRACE_EVENT(drv_stop, | |||
70 | 72 | ||
71 | TRACE_EVENT(drv_add_interface, | 73 | TRACE_EVENT(drv_add_interface, |
72 | TP_PROTO(struct ieee80211_local *local, | 74 | TP_PROTO(struct ieee80211_local *local, |
73 | const u8 *addr, | 75 | struct ieee80211_sub_if_data *sdata, |
74 | struct ieee80211_vif *vif, | ||
75 | int ret), | 76 | int ret), |
76 | 77 | ||
77 | TP_ARGS(local, addr, vif, ret), | 78 | TP_ARGS(local, sdata, ret), |
78 | 79 | ||
79 | TP_STRUCT__entry( | 80 | TP_STRUCT__entry( |
80 | LOCAL_ENTRY | 81 | LOCAL_ENTRY |
@@ -86,7 +87,7 @@ TRACE_EVENT(drv_add_interface, | |||
86 | TP_fast_assign( | 87 | TP_fast_assign( |
87 | LOCAL_ASSIGN; | 88 | LOCAL_ASSIGN; |
88 | VIF_ASSIGN; | 89 | VIF_ASSIGN; |
89 | memcpy(__entry->addr, addr, 6); | 90 | memcpy(__entry->addr, sdata->vif.addr, 6); |
90 | __entry->ret = ret; | 91 | __entry->ret = ret; |
91 | ), | 92 | ), |
92 | 93 | ||
@@ -97,10 +98,9 @@ TRACE_EVENT(drv_add_interface, | |||
97 | ); | 98 | ); |
98 | 99 | ||
99 | TRACE_EVENT(drv_remove_interface, | 100 | TRACE_EVENT(drv_remove_interface, |
100 | TP_PROTO(struct ieee80211_local *local, | 101 | TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata), |
101 | const u8 *addr, struct ieee80211_vif *vif), | ||
102 | 102 | ||
103 | TP_ARGS(local, addr, vif), | 103 | TP_ARGS(local, sdata), |
104 | 104 | ||
105 | TP_STRUCT__entry( | 105 | TP_STRUCT__entry( |
106 | LOCAL_ENTRY | 106 | LOCAL_ENTRY |
@@ -111,7 +111,7 @@ TRACE_EVENT(drv_remove_interface, | |||
111 | TP_fast_assign( | 111 | TP_fast_assign( |
112 | LOCAL_ASSIGN; | 112 | LOCAL_ASSIGN; |
113 | VIF_ASSIGN; | 113 | VIF_ASSIGN; |
114 | memcpy(__entry->addr, addr, 6); | 114 | memcpy(__entry->addr, sdata->vif.addr, 6); |
115 | ), | 115 | ), |
116 | 116 | ||
117 | TP_printk( | 117 | TP_printk( |
@@ -140,6 +140,7 @@ TRACE_EVENT(drv_config, | |||
140 | __field(u8, short_frame_max_tx_count) | 140 | __field(u8, short_frame_max_tx_count) |
141 | __field(int, center_freq) | 141 | __field(int, center_freq) |
142 | __field(int, channel_type) | 142 | __field(int, channel_type) |
143 | __field(int, smps) | ||
143 | ), | 144 | ), |
144 | 145 | ||
145 | TP_fast_assign( | 146 | TP_fast_assign( |
@@ -155,6 +156,7 @@ TRACE_EVENT(drv_config, | |||
155 | __entry->short_frame_max_tx_count = local->hw.conf.short_frame_max_tx_count; | 156 | __entry->short_frame_max_tx_count = local->hw.conf.short_frame_max_tx_count; |
156 | __entry->center_freq = local->hw.conf.channel->center_freq; | 157 | __entry->center_freq = local->hw.conf.channel->center_freq; |
157 | __entry->channel_type = local->hw.conf.channel_type; | 158 | __entry->channel_type = local->hw.conf.channel_type; |
159 | __entry->smps = local->hw.conf.smps_mode; | ||
158 | ), | 160 | ), |
159 | 161 | ||
160 | TP_printk( | 162 | TP_printk( |
@@ -165,11 +167,11 @@ TRACE_EVENT(drv_config, | |||
165 | 167 | ||
166 | TRACE_EVENT(drv_bss_info_changed, | 168 | TRACE_EVENT(drv_bss_info_changed, |
167 | TP_PROTO(struct ieee80211_local *local, | 169 | TP_PROTO(struct ieee80211_local *local, |
168 | struct ieee80211_vif *vif, | 170 | struct ieee80211_sub_if_data *sdata, |
169 | struct ieee80211_bss_conf *info, | 171 | struct ieee80211_bss_conf *info, |
170 | u32 changed), | 172 | u32 changed), |
171 | 173 | ||
172 | TP_ARGS(local, vif, info, changed), | 174 | TP_ARGS(local, sdata, info, changed), |
173 | 175 | ||
174 | TP_STRUCT__entry( | 176 | TP_STRUCT__entry( |
175 | LOCAL_ENTRY | 177 | LOCAL_ENTRY |
@@ -293,11 +295,11 @@ TRACE_EVENT(drv_set_tim, | |||
293 | 295 | ||
294 | TRACE_EVENT(drv_set_key, | 296 | TRACE_EVENT(drv_set_key, |
295 | TP_PROTO(struct ieee80211_local *local, | 297 | TP_PROTO(struct ieee80211_local *local, |
296 | enum set_key_cmd cmd, struct ieee80211_vif *vif, | 298 | enum set_key_cmd cmd, struct ieee80211_sub_if_data *sdata, |
297 | struct ieee80211_sta *sta, | 299 | struct ieee80211_sta *sta, |
298 | struct ieee80211_key_conf *key, int ret), | 300 | struct ieee80211_key_conf *key, int ret), |
299 | 301 | ||
300 | TP_ARGS(local, cmd, vif, sta, key, ret), | 302 | TP_ARGS(local, cmd, sdata, sta, key, ret), |
301 | 303 | ||
302 | TP_STRUCT__entry( | 304 | TP_STRUCT__entry( |
303 | LOCAL_ENTRY | 305 | LOCAL_ENTRY |
@@ -491,11 +493,11 @@ TRACE_EVENT(drv_set_rts_threshold, | |||
491 | 493 | ||
492 | TRACE_EVENT(drv_sta_notify, | 494 | TRACE_EVENT(drv_sta_notify, |
493 | TP_PROTO(struct ieee80211_local *local, | 495 | TP_PROTO(struct ieee80211_local *local, |
494 | struct ieee80211_vif *vif, | 496 | struct ieee80211_sub_if_data *sdata, |
495 | enum sta_notify_cmd cmd, | 497 | enum sta_notify_cmd cmd, |
496 | struct ieee80211_sta *sta), | 498 | struct ieee80211_sta *sta), |
497 | 499 | ||
498 | TP_ARGS(local, vif, cmd, sta), | 500 | TP_ARGS(local, sdata, cmd, sta), |
499 | 501 | ||
500 | TP_STRUCT__entry( | 502 | TP_STRUCT__entry( |
501 | LOCAL_ENTRY | 503 | LOCAL_ENTRY |
@@ -656,12 +658,12 @@ TRACE_EVENT(drv_tx_last_beacon, | |||
656 | 658 | ||
657 | TRACE_EVENT(drv_ampdu_action, | 659 | TRACE_EVENT(drv_ampdu_action, |
658 | TP_PROTO(struct ieee80211_local *local, | 660 | TP_PROTO(struct ieee80211_local *local, |
659 | struct ieee80211_vif *vif, | 661 | struct ieee80211_sub_if_data *sdata, |
660 | enum ieee80211_ampdu_mlme_action action, | 662 | enum ieee80211_ampdu_mlme_action action, |
661 | struct ieee80211_sta *sta, u16 tid, | 663 | struct ieee80211_sta *sta, u16 tid, |
662 | u16 *ssn, int ret), | 664 | u16 *ssn, int ret), |
663 | 665 | ||
664 | TP_ARGS(local, vif, action, sta, tid, ssn, ret), | 666 | TP_ARGS(local, sdata, action, sta, tid, ssn, ret), |
665 | 667 | ||
666 | TP_STRUCT__entry( | 668 | TP_STRUCT__entry( |
667 | LOCAL_ENTRY | 669 | LOCAL_ENTRY |
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index d7dcee680728..bb677a73b7c9 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -125,7 +125,7 @@ void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, | |||
125 | 125 | ||
126 | if (!skb) { | 126 | if (!skb) { |
127 | printk(KERN_ERR "%s: failed to allocate buffer " | 127 | printk(KERN_ERR "%s: failed to allocate buffer " |
128 | "for delba frame\n", sdata->dev->name); | 128 | "for delba frame\n", sdata->name); |
129 | return; | 129 | return; |
130 | } | 130 | } |
131 | 131 | ||
@@ -133,10 +133,10 @@ void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, | |||
133 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 133 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
134 | memset(mgmt, 0, 24); | 134 | memset(mgmt, 0, 24); |
135 | memcpy(mgmt->da, da, ETH_ALEN); | 135 | memcpy(mgmt->da, da, ETH_ALEN); |
136 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 136 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
137 | if (sdata->vif.type == NL80211_IFTYPE_AP || | 137 | if (sdata->vif.type == NL80211_IFTYPE_AP || |
138 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 138 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
139 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | 139 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); |
140 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) | 140 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) |
141 | memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); | 141 | memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); |
142 | 142 | ||
@@ -185,3 +185,50 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, | |||
185 | spin_unlock_bh(&sta->lock); | 185 | spin_unlock_bh(&sta->lock); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | |||
189 | int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, | ||
190 | enum ieee80211_smps_mode smps, const u8 *da, | ||
191 | const u8 *bssid) | ||
192 | { | ||
193 | struct ieee80211_local *local = sdata->local; | ||
194 | struct sk_buff *skb; | ||
195 | struct ieee80211_mgmt *action_frame; | ||
196 | |||
197 | /* 27 = header + category + action + smps mode */ | ||
198 | skb = dev_alloc_skb(27 + local->hw.extra_tx_headroom); | ||
199 | if (!skb) | ||
200 | return -ENOMEM; | ||
201 | |||
202 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
203 | action_frame = (void *)skb_put(skb, 27); | ||
204 | memcpy(action_frame->da, da, ETH_ALEN); | ||
205 | memcpy(action_frame->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
206 | memcpy(action_frame->bssid, bssid, ETH_ALEN); | ||
207 | action_frame->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | ||
208 | IEEE80211_STYPE_ACTION); | ||
209 | action_frame->u.action.category = WLAN_CATEGORY_HT; | ||
210 | action_frame->u.action.u.ht_smps.action = WLAN_HT_ACTION_SMPS; | ||
211 | switch (smps) { | ||
212 | case IEEE80211_SMPS_AUTOMATIC: | ||
213 | case IEEE80211_SMPS_NUM_MODES: | ||
214 | WARN_ON(1); | ||
215 | case IEEE80211_SMPS_OFF: | ||
216 | action_frame->u.action.u.ht_smps.smps_control = | ||
217 | WLAN_HT_SMPS_CONTROL_DISABLED; | ||
218 | break; | ||
219 | case IEEE80211_SMPS_STATIC: | ||
220 | action_frame->u.action.u.ht_smps.smps_control = | ||
221 | WLAN_HT_SMPS_CONTROL_STATIC; | ||
222 | break; | ||
223 | case IEEE80211_SMPS_DYNAMIC: | ||
224 | action_frame->u.action.u.ht_smps.smps_control = | ||
225 | WLAN_HT_SMPS_CONTROL_DYNAMIC; | ||
226 | break; | ||
227 | } | ||
228 | |||
229 | /* we'll do more on status of this frame */ | ||
230 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; | ||
231 | ieee80211_tx_skb(sdata, skb); | ||
232 | |||
233 | return 0; | ||
234 | } | ||
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 10d13856f86c..ef6c6b2401d1 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -117,7 +117,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
117 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 117 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
118 | IEEE80211_STYPE_PROBE_RESP); | 118 | IEEE80211_STYPE_PROBE_RESP); |
119 | memset(mgmt->da, 0xff, ETH_ALEN); | 119 | memset(mgmt->da, 0xff, ETH_ALEN); |
120 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 120 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
121 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); | 121 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); |
122 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); | 122 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); |
123 | mgmt->u.beacon.timestamp = cpu_to_le64(tsf); | 123 | mgmt->u.beacon.timestamp = cpu_to_le64(tsf); |
@@ -252,7 +252,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
252 | 252 | ||
253 | rcu_read_lock(); | 253 | rcu_read_lock(); |
254 | 254 | ||
255 | sta = sta_info_get(local, mgmt->sa); | 255 | sta = sta_info_get(sdata, mgmt->sa); |
256 | if (sta) { | 256 | if (sta) { |
257 | u32 prev_rates; | 257 | u32 prev_rates; |
258 | 258 | ||
@@ -266,7 +266,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
266 | printk(KERN_DEBUG "%s: updated supp_rates set " | 266 | printk(KERN_DEBUG "%s: updated supp_rates set " |
267 | "for %pM based on beacon info (0x%llx | " | 267 | "for %pM based on beacon info (0x%llx | " |
268 | "0x%llx -> 0x%llx)\n", | 268 | "0x%llx -> 0x%llx)\n", |
269 | sdata->dev->name, | 269 | sdata->name, |
270 | sta->sta.addr, | 270 | sta->sta.addr, |
271 | (unsigned long long) prev_rates, | 271 | (unsigned long long) prev_rates, |
272 | (unsigned long long) supp_rates, | 272 | (unsigned long long) supp_rates, |
@@ -364,7 +364,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
364 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 364 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
365 | printk(KERN_DEBUG "%s: beacon TSF higher than " | 365 | printk(KERN_DEBUG "%s: beacon TSF higher than " |
366 | "local TSF - IBSS merge with BSSID %pM\n", | 366 | "local TSF - IBSS merge with BSSID %pM\n", |
367 | sdata->dev->name, mgmt->bssid); | 367 | sdata->name, mgmt->bssid); |
368 | #endif | 368 | #endif |
369 | ieee80211_sta_join_ibss(sdata, bss); | 369 | ieee80211_sta_join_ibss(sdata, bss); |
370 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates); | 370 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates); |
@@ -393,7 +393,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
393 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { | 393 | if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { |
394 | if (net_ratelimit()) | 394 | if (net_ratelimit()) |
395 | printk(KERN_DEBUG "%s: No room for a new IBSS STA entry %pM\n", | 395 | printk(KERN_DEBUG "%s: No room for a new IBSS STA entry %pM\n", |
396 | sdata->dev->name, addr); | 396 | sdata->name, addr); |
397 | return NULL; | 397 | return NULL; |
398 | } | 398 | } |
399 | 399 | ||
@@ -402,7 +402,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
402 | 402 | ||
403 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 403 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
404 | printk(KERN_DEBUG "%s: Adding new IBSS station %pM (dev=%s)\n", | 404 | printk(KERN_DEBUG "%s: Adding new IBSS station %pM (dev=%s)\n", |
405 | wiphy_name(local->hw.wiphy), addr, sdata->dev->name); | 405 | wiphy_name(local->hw.wiphy), addr, sdata->name); |
406 | #endif | 406 | #endif |
407 | 407 | ||
408 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); | 408 | sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); |
@@ -466,7 +466,7 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) | |||
466 | return; | 466 | return; |
467 | 467 | ||
468 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " | 468 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " |
469 | "IBSS networks with same SSID (merge)\n", sdata->dev->name); | 469 | "IBSS networks with same SSID (merge)\n", sdata->name); |
470 | 470 | ||
471 | ieee80211_request_internal_scan(sdata, ifibss->ssid, ifibss->ssid_len); | 471 | ieee80211_request_internal_scan(sdata, ifibss->ssid, ifibss->ssid_len); |
472 | } | 472 | } |
@@ -488,13 +488,13 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) | |||
488 | * random number generator get different BSSID. */ | 488 | * random number generator get different BSSID. */ |
489 | get_random_bytes(bssid, ETH_ALEN); | 489 | get_random_bytes(bssid, ETH_ALEN); |
490 | for (i = 0; i < ETH_ALEN; i++) | 490 | for (i = 0; i < ETH_ALEN; i++) |
491 | bssid[i] ^= sdata->dev->dev_addr[i]; | 491 | bssid[i] ^= sdata->vif.addr[i]; |
492 | bssid[0] &= ~0x01; | 492 | bssid[0] &= ~0x01; |
493 | bssid[0] |= 0x02; | 493 | bssid[0] |= 0x02; |
494 | } | 494 | } |
495 | 495 | ||
496 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n", | 496 | printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n", |
497 | sdata->dev->name, bssid); | 497 | sdata->name, bssid); |
498 | 498 | ||
499 | sband = local->hw.wiphy->bands[ifibss->channel->band]; | 499 | sband = local->hw.wiphy->bands[ifibss->channel->band]; |
500 | 500 | ||
@@ -523,7 +523,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
523 | active_ibss = ieee80211_sta_active_ibss(sdata); | 523 | active_ibss = ieee80211_sta_active_ibss(sdata); |
524 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 524 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
525 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", | 525 | printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", |
526 | sdata->dev->name, active_ibss); | 526 | sdata->name, active_ibss); |
527 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 527 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
528 | 528 | ||
529 | if (active_ibss) | 529 | if (active_ibss) |
@@ -552,7 +552,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
552 | 552 | ||
553 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" | 553 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" |
554 | " based on configured SSID\n", | 554 | " based on configured SSID\n", |
555 | sdata->dev->name, bss->cbss.bssid); | 555 | sdata->name, bss->cbss.bssid); |
556 | 556 | ||
557 | ieee80211_sta_join_ibss(sdata, bss); | 557 | ieee80211_sta_join_ibss(sdata, bss); |
558 | ieee80211_rx_bss_put(local, bss); | 558 | ieee80211_rx_bss_put(local, bss); |
@@ -571,7 +571,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
571 | } else if (time_after(jiffies, ifibss->last_scan_completed + | 571 | } else if (time_after(jiffies, ifibss->last_scan_completed + |
572 | IEEE80211_SCAN_INTERVAL)) { | 572 | IEEE80211_SCAN_INTERVAL)) { |
573 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " | 573 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " |
574 | "join\n", sdata->dev->name); | 574 | "join\n", sdata->name); |
575 | 575 | ||
576 | ieee80211_request_internal_scan(sdata, ifibss->ssid, | 576 | ieee80211_request_internal_scan(sdata, ifibss->ssid, |
577 | ifibss->ssid_len); | 577 | ifibss->ssid_len); |
@@ -585,7 +585,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
585 | return; | 585 | return; |
586 | } | 586 | } |
587 | printk(KERN_DEBUG "%s: IBSS not allowed on" | 587 | printk(KERN_DEBUG "%s: IBSS not allowed on" |
588 | " %d MHz\n", sdata->dev->name, | 588 | " %d MHz\n", sdata->name, |
589 | local->hw.conf.channel->center_freq); | 589 | local->hw.conf.channel->center_freq); |
590 | 590 | ||
591 | /* No IBSS found - decrease scan interval and continue | 591 | /* No IBSS found - decrease scan interval and continue |
@@ -619,7 +619,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
619 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 619 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
620 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM" | 620 | printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM" |
621 | " (tx_last_beacon=%d)\n", | 621 | " (tx_last_beacon=%d)\n", |
622 | sdata->dev->name, mgmt->sa, mgmt->da, | 622 | sdata->name, mgmt->sa, mgmt->da, |
623 | mgmt->bssid, tx_last_beacon); | 623 | mgmt->bssid, tx_last_beacon); |
624 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 624 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
625 | 625 | ||
@@ -637,7 +637,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
637 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 637 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
638 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " | 638 | printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " |
639 | "from %pM\n", | 639 | "from %pM\n", |
640 | sdata->dev->name, mgmt->sa); | 640 | sdata->name, mgmt->sa); |
641 | #endif | 641 | #endif |
642 | return; | 642 | return; |
643 | } | 643 | } |
@@ -657,7 +657,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
657 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 657 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
658 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 658 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
659 | printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n", | 659 | printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n", |
660 | sdata->dev->name, resp->da); | 660 | sdata->name, resp->da); |
661 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 661 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
662 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 662 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
663 | ieee80211_tx_skb(sdata, skb); | 663 | ieee80211_tx_skb(sdata, skb); |
@@ -671,7 +671,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
671 | size_t baselen; | 671 | size_t baselen; |
672 | struct ieee802_11_elems elems; | 672 | struct ieee802_11_elems elems; |
673 | 673 | ||
674 | if (memcmp(mgmt->da, sdata->dev->dev_addr, ETH_ALEN)) | 674 | if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN)) |
675 | return; /* ignore ProbeResp to foreign address */ | 675 | return; /* ignore ProbeResp to foreign address */ |
676 | 676 | ||
677 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; | 677 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 91dc8636d644..88b0ba6c7484 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -140,7 +140,6 @@ typedef unsigned __bitwise__ ieee80211_tx_result; | |||
140 | 140 | ||
141 | struct ieee80211_tx_data { | 141 | struct ieee80211_tx_data { |
142 | struct sk_buff *skb; | 142 | struct sk_buff *skb; |
143 | struct net_device *dev; | ||
144 | struct ieee80211_local *local; | 143 | struct ieee80211_local *local; |
145 | struct ieee80211_sub_if_data *sdata; | 144 | struct ieee80211_sub_if_data *sdata; |
146 | struct sta_info *sta; | 145 | struct sta_info *sta; |
@@ -298,6 +297,8 @@ struct ieee80211_if_managed { | |||
298 | 297 | ||
299 | unsigned long timers_running; /* used for quiesce/restart */ | 298 | unsigned long timers_running; /* used for quiesce/restart */ |
300 | bool powersave; /* powersave requested for this iface */ | 299 | bool powersave; /* powersave requested for this iface */ |
300 | enum ieee80211_smps_mode req_smps, /* requested smps mode */ | ||
301 | ap_smps; /* smps mode AP thinks we're in */ | ||
301 | 302 | ||
302 | unsigned long request; | 303 | unsigned long request; |
303 | 304 | ||
@@ -433,6 +434,8 @@ struct ieee80211_sub_if_data { | |||
433 | 434 | ||
434 | int drop_unencrypted; | 435 | int drop_unencrypted; |
435 | 436 | ||
437 | char name[IFNAMSIZ]; | ||
438 | |||
436 | /* | 439 | /* |
437 | * keep track of whether the HT opmode (stored in | 440 | * keep track of whether the HT opmode (stored in |
438 | * vif.bss_info.ht_operation_mode) is valid. | 441 | * vif.bss_info.ht_operation_mode) is valid. |
@@ -586,6 +589,9 @@ struct ieee80211_local { | |||
586 | /* used for uploading changed mc list */ | 589 | /* used for uploading changed mc list */ |
587 | struct work_struct reconfig_filter; | 590 | struct work_struct reconfig_filter; |
588 | 591 | ||
592 | /* used to reconfigure hardware SM PS */ | ||
593 | struct work_struct recalc_smps; | ||
594 | |||
589 | /* aggregated multicast list */ | 595 | /* aggregated multicast list */ |
590 | struct dev_addr_list *mc_list; | 596 | struct dev_addr_list *mc_list; |
591 | int mc_count; | 597 | int mc_count; |
@@ -760,6 +766,8 @@ struct ieee80211_local { | |||
760 | int user_power_level; /* in dBm */ | 766 | int user_power_level; /* in dBm */ |
761 | int power_constr_level; /* in dBm */ | 767 | int power_constr_level; /* in dBm */ |
762 | 768 | ||
769 | enum ieee80211_smps_mode smps_mode; | ||
770 | |||
763 | struct work_struct restart_work; | 771 | struct work_struct restart_work; |
764 | 772 | ||
765 | #ifdef CONFIG_MAC80211_DEBUGFS | 773 | #ifdef CONFIG_MAC80211_DEBUGFS |
@@ -874,6 +882,8 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | |||
874 | void ieee80211_configure_filter(struct ieee80211_local *local); | 882 | void ieee80211_configure_filter(struct ieee80211_local *local); |
875 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); | 883 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); |
876 | 884 | ||
885 | extern bool ieee80211_disable_40mhz_24ghz; | ||
886 | |||
877 | /* STA code */ | 887 | /* STA code */ |
878 | void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); | 888 | void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); |
879 | int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, | 889 | int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, |
@@ -938,6 +948,8 @@ void ieee80211_rx_bss_put(struct ieee80211_local *local, | |||
938 | struct ieee80211_bss *bss); | 948 | struct ieee80211_bss *bss); |
939 | 949 | ||
940 | /* interface handling */ | 950 | /* interface handling */ |
951 | int ieee80211_iface_init(void); | ||
952 | void ieee80211_iface_exit(void); | ||
941 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, | 953 | int ieee80211_if_add(struct ieee80211_local *local, const char *name, |
942 | struct net_device **new_dev, enum nl80211_iftype type, | 954 | struct net_device **new_dev, enum nl80211_iftype type, |
943 | struct vif_params *params); | 955 | struct vif_params *params); |
@@ -976,6 +988,9 @@ void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u1 | |||
976 | void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, | 988 | void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, |
977 | const u8 *da, u16 tid, | 989 | const u8 *da, u16 tid, |
978 | u16 initiator, u16 reason_code); | 990 | u16 initiator, u16 reason_code); |
991 | int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, | ||
992 | enum ieee80211_smps_mode smps, const u8 *da, | ||
993 | const u8 *bssid); | ||
979 | 994 | ||
980 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, | 995 | void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, |
981 | u16 tid, u16 initiator, u16 reason); | 996 | u16 tid, u16 initiator, u16 reason); |
@@ -1086,6 +1101,10 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | |||
1086 | u32 ieee80211_sta_get_rates(struct ieee80211_local *local, | 1101 | u32 ieee80211_sta_get_rates(struct ieee80211_local *local, |
1087 | struct ieee802_11_elems *elems, | 1102 | struct ieee802_11_elems *elems, |
1088 | enum ieee80211_band band); | 1103 | enum ieee80211_band band); |
1104 | int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata, | ||
1105 | enum ieee80211_smps_mode smps_mode); | ||
1106 | void ieee80211_recalc_smps(struct ieee80211_local *local, | ||
1107 | struct ieee80211_sub_if_data *forsdata); | ||
1089 | 1108 | ||
1090 | #ifdef CONFIG_MAC80211_NOINLINE | 1109 | #ifdef CONFIG_MAC80211_NOINLINE |
1091 | #define debug_noinline noinline | 1110 | #define debug_noinline noinline |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 80c16f6e2af6..a6e6da3cab70 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -60,6 +60,22 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) | |||
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | static int ieee80211_change_mac(struct net_device *dev, void *addr) | ||
64 | { | ||
65 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
66 | int ret; | ||
67 | |||
68 | if (netif_running(dev)) | ||
69 | return -EBUSY; | ||
70 | |||
71 | ret = eth_mac_addr(dev, addr); | ||
72 | |||
73 | if (ret == 0) | ||
74 | memcpy(sdata->vif.addr, addr, ETH_ALEN); | ||
75 | |||
76 | return ret; | ||
77 | } | ||
78 | |||
63 | static inline int identical_mac_addr_allowed(int type1, int type2) | 79 | static inline int identical_mac_addr_allowed(int type1, int type2) |
64 | { | 80 | { |
65 | return type1 == NL80211_IFTYPE_MONITOR || | 81 | return type1 == NL80211_IFTYPE_MONITOR || |
@@ -234,7 +250,7 @@ static int ieee80211_open(struct net_device *dev) | |||
234 | default: | 250 | default: |
235 | conf.vif = &sdata->vif; | 251 | conf.vif = &sdata->vif; |
236 | conf.type = sdata->vif.type; | 252 | conf.type = sdata->vif.type; |
237 | conf.mac_addr = dev->dev_addr; | 253 | conf.mac_addr = sdata->vif.addr; |
238 | res = drv_add_interface(local, &conf); | 254 | res = drv_add_interface(local, &conf); |
239 | if (res) | 255 | if (res) |
240 | goto err_stop; | 256 | goto err_stop; |
@@ -514,7 +530,7 @@ static int ieee80211_stop(struct net_device *dev) | |||
514 | 530 | ||
515 | conf.vif = &sdata->vif; | 531 | conf.vif = &sdata->vif; |
516 | conf.type = sdata->vif.type; | 532 | conf.type = sdata->vif.type; |
517 | conf.mac_addr = dev->dev_addr; | 533 | conf.mac_addr = sdata->vif.addr; |
518 | /* disable all keys for as long as this netdev is down */ | 534 | /* disable all keys for as long as this netdev is down */ |
519 | ieee80211_disable_keys(sdata); | 535 | ieee80211_disable_keys(sdata); |
520 | drv_remove_interface(local, &conf); | 536 | drv_remove_interface(local, &conf); |
@@ -651,7 +667,7 @@ static const struct net_device_ops ieee80211_dataif_ops = { | |||
651 | .ndo_start_xmit = ieee80211_subif_start_xmit, | 667 | .ndo_start_xmit = ieee80211_subif_start_xmit, |
652 | .ndo_set_multicast_list = ieee80211_set_multicast_list, | 668 | .ndo_set_multicast_list = ieee80211_set_multicast_list, |
653 | .ndo_change_mtu = ieee80211_change_mtu, | 669 | .ndo_change_mtu = ieee80211_change_mtu, |
654 | .ndo_set_mac_address = eth_mac_addr, | 670 | .ndo_set_mac_address = ieee80211_change_mac, |
655 | }; | 671 | }; |
656 | 672 | ||
657 | static const struct net_device_ops ieee80211_monitorif_ops = { | 673 | static const struct net_device_ops ieee80211_monitorif_ops = { |
@@ -794,6 +810,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
794 | /* don't use IEEE80211_DEV_TO_SUB_IF because it checks too much */ | 810 | /* don't use IEEE80211_DEV_TO_SUB_IF because it checks too much */ |
795 | sdata = netdev_priv(ndev); | 811 | sdata = netdev_priv(ndev); |
796 | ndev->ieee80211_ptr = &sdata->wdev; | 812 | ndev->ieee80211_ptr = &sdata->wdev; |
813 | memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN); | ||
814 | memcpy(sdata->name, ndev->name, IFNAMSIZ); | ||
797 | 815 | ||
798 | /* initialise type-independent data */ | 816 | /* initialise type-independent data */ |
799 | sdata->wdev.wiphy = local->hw.wiphy; | 817 | sdata->wdev.wiphy = local->hw.wiphy; |
@@ -945,3 +963,41 @@ void ieee80211_recalc_idle(struct ieee80211_local *local) | |||
945 | if (chg) | 963 | if (chg) |
946 | ieee80211_hw_config(local, chg); | 964 | ieee80211_hw_config(local, chg); |
947 | } | 965 | } |
966 | |||
967 | static int netdev_notify(struct notifier_block *nb, | ||
968 | unsigned long state, | ||
969 | void *ndev) | ||
970 | { | ||
971 | struct net_device *dev = ndev; | ||
972 | struct ieee80211_sub_if_data *sdata; | ||
973 | |||
974 | if (state != NETDEV_CHANGENAME) | ||
975 | return 0; | ||
976 | |||
977 | if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) | ||
978 | return 0; | ||
979 | |||
980 | if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) | ||
981 | return 0; | ||
982 | |||
983 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
984 | |||
985 | memcpy(sdata->name, sdata->name, IFNAMSIZ); | ||
986 | |||
987 | ieee80211_debugfs_rename_netdev(sdata); | ||
988 | return 0; | ||
989 | } | ||
990 | |||
991 | static struct notifier_block mac80211_netdev_notifier = { | ||
992 | .notifier_call = netdev_notify, | ||
993 | }; | ||
994 | |||
995 | int ieee80211_iface_init(void) | ||
996 | { | ||
997 | return register_netdevice_notifier(&mac80211_netdev_notifier); | ||
998 | } | ||
999 | |||
1000 | void ieee80211_iface_exit(void) | ||
1001 | { | ||
1002 | unregister_netdevice_notifier(&mac80211_netdev_notifier); | ||
1003 | } | ||
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 659a42d529e3..32ee6d0ee34d 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -139,7 +139,7 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | |||
139 | struct ieee80211_sub_if_data, | 139 | struct ieee80211_sub_if_data, |
140 | u.ap); | 140 | u.ap); |
141 | 141 | ||
142 | ret = drv_set_key(key->local, SET_KEY, &sdata->vif, sta, &key->conf); | 142 | ret = drv_set_key(key->local, SET_KEY, sdata, sta, &key->conf); |
143 | 143 | ||
144 | if (!ret) { | 144 | if (!ret) { |
145 | spin_lock_bh(&todo_lock); | 145 | spin_lock_bh(&todo_lock); |
@@ -181,7 +181,7 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) | |||
181 | struct ieee80211_sub_if_data, | 181 | struct ieee80211_sub_if_data, |
182 | u.ap); | 182 | u.ap); |
183 | 183 | ||
184 | ret = drv_set_key(key->local, DISABLE_KEY, &sdata->vif, | 184 | ret = drv_set_key(key->local, DISABLE_KEY, sdata, |
185 | sta, &key->conf); | 185 | sta, &key->conf); |
186 | 186 | ||
187 | if (ret) | 187 | if (ret) |
@@ -421,7 +421,7 @@ void ieee80211_key_link(struct ieee80211_key *key, | |||
421 | */ | 421 | */ |
422 | 422 | ||
423 | /* same here, the AP could be using QoS */ | 423 | /* same here, the AP could be using QoS */ |
424 | ap = sta_info_get(key->local, key->sdata->u.mgd.bssid); | 424 | ap = sta_info_get(key->sdata, key->sdata->u.mgd.bssid); |
425 | if (ap) { | 425 | if (ap) { |
426 | if (test_sta_flags(ap, WLAN_STA_WME)) | 426 | if (test_sta_flags(ap, WLAN_STA_WME)) |
427 | key->conf.flags |= | 427 | key->conf.flags |= |
diff --git a/net/mac80211/key.h b/net/mac80211/key.h index a49f93b79e92..bdc2968c2bbe 100644 --- a/net/mac80211/key.h +++ b/net/mac80211/key.h | |||
@@ -59,11 +59,17 @@ enum ieee80211_internal_key_flags { | |||
59 | KEY_FLAG_TODO_DEFMGMTKEY = BIT(6), | 59 | KEY_FLAG_TODO_DEFMGMTKEY = BIT(6), |
60 | }; | 60 | }; |
61 | 61 | ||
62 | enum ieee80211_internal_tkip_state { | ||
63 | TKIP_STATE_NOT_INIT, | ||
64 | TKIP_STATE_PHASE1_DONE, | ||
65 | TKIP_STATE_PHASE1_HW_UPLOADED, | ||
66 | }; | ||
67 | |||
62 | struct tkip_ctx { | 68 | struct tkip_ctx { |
63 | u32 iv32; | 69 | u32 iv32; |
64 | u16 iv16; | 70 | u16 iv16; |
65 | u16 p1k[5]; | 71 | u16 p1k[5]; |
66 | int initialized; | 72 | enum ieee80211_internal_tkip_state state; |
67 | }; | 73 | }; |
68 | 74 | ||
69 | struct ieee80211_key { | 75 | struct ieee80211_key { |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 0d2d94881f1f..d4426748ab10 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -32,7 +32,12 @@ | |||
32 | #include "led.h" | 32 | #include "led.h" |
33 | #include "cfg.h" | 33 | #include "cfg.h" |
34 | #include "debugfs.h" | 34 | #include "debugfs.h" |
35 | #include "debugfs_netdev.h" | 35 | |
36 | |||
37 | bool ieee80211_disable_40mhz_24ghz; | ||
38 | module_param(ieee80211_disable_40mhz_24ghz, bool, 0644); | ||
39 | MODULE_PARM_DESC(ieee80211_disable_40mhz_24ghz, | ||
40 | "Disable 40MHz support in the 2.4GHz band"); | ||
36 | 41 | ||
37 | void ieee80211_configure_filter(struct ieee80211_local *local) | 42 | void ieee80211_configure_filter(struct ieee80211_local *local) |
38 | { | 43 | { |
@@ -114,6 +119,18 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) | |||
114 | changed |= IEEE80211_CONF_CHANGE_CHANNEL; | 119 | changed |= IEEE80211_CONF_CHANGE_CHANNEL; |
115 | } | 120 | } |
116 | 121 | ||
122 | if (!conf_is_ht(&local->hw.conf)) { | ||
123 | /* | ||
124 | * mac80211.h documents that this is only valid | ||
125 | * when the channel is set to an HT type, and | ||
126 | * that otherwise STATIC is used. | ||
127 | */ | ||
128 | local->hw.conf.smps_mode = IEEE80211_SMPS_STATIC; | ||
129 | } else if (local->hw.conf.smps_mode != local->smps_mode) { | ||
130 | local->hw.conf.smps_mode = local->smps_mode; | ||
131 | changed |= IEEE80211_CONF_CHANGE_SMPS; | ||
132 | } | ||
133 | |||
117 | if (scan_chan) | 134 | if (scan_chan) |
118 | power = chan->max_power; | 135 | power = chan->max_power; |
119 | else | 136 | else |
@@ -173,7 +190,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | |||
173 | } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) | 190 | } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
174 | sdata->vif.bss_conf.bssid = sdata->u.ibss.bssid; | 191 | sdata->vif.bss_conf.bssid = sdata->u.ibss.bssid; |
175 | else if (sdata->vif.type == NL80211_IFTYPE_AP) | 192 | else if (sdata->vif.type == NL80211_IFTYPE_AP) |
176 | sdata->vif.bss_conf.bssid = sdata->dev->dev_addr; | 193 | sdata->vif.bss_conf.bssid = sdata->vif.addr; |
177 | else if (ieee80211_vif_is_mesh(&sdata->vif)) { | 194 | else if (ieee80211_vif_is_mesh(&sdata->vif)) { |
178 | sdata->vif.bss_conf.bssid = zero; | 195 | sdata->vif.bss_conf.bssid = zero; |
179 | } else { | 196 | } else { |
@@ -223,8 +240,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | |||
223 | } | 240 | } |
224 | } | 241 | } |
225 | 242 | ||
226 | drv_bss_info_changed(local, &sdata->vif, | 243 | drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed); |
227 | &sdata->vif.bss_conf, changed); | ||
228 | } | 244 | } |
229 | 245 | ||
230 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) | 246 | u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) |
@@ -299,6 +315,16 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw) | |||
299 | } | 315 | } |
300 | EXPORT_SYMBOL(ieee80211_restart_hw); | 316 | EXPORT_SYMBOL(ieee80211_restart_hw); |
301 | 317 | ||
318 | static void ieee80211_recalc_smps_work(struct work_struct *work) | ||
319 | { | ||
320 | struct ieee80211_local *local = | ||
321 | container_of(work, struct ieee80211_local, recalc_smps); | ||
322 | |||
323 | mutex_lock(&local->iflist_mtx); | ||
324 | ieee80211_recalc_smps(local, NULL); | ||
325 | mutex_unlock(&local->iflist_mtx); | ||
326 | } | ||
327 | |||
302 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | 328 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, |
303 | const struct ieee80211_ops *ops) | 329 | const struct ieee80211_ops *ops) |
304 | { | 330 | { |
@@ -372,6 +398,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
372 | INIT_WORK(&local->restart_work, ieee80211_restart_work); | 398 | INIT_WORK(&local->restart_work, ieee80211_restart_work); |
373 | 399 | ||
374 | INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter); | 400 | INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter); |
401 | INIT_WORK(&local->recalc_smps, ieee80211_recalc_smps_work); | ||
402 | local->smps_mode = IEEE80211_SMPS_OFF; | ||
375 | 403 | ||
376 | INIT_WORK(&local->dynamic_ps_enable_work, | 404 | INIT_WORK(&local->dynamic_ps_enable_work, |
377 | ieee80211_dynamic_ps_enable_work); | 405 | ieee80211_dynamic_ps_enable_work); |
@@ -674,11 +702,19 @@ static int __init ieee80211_init(void) | |||
674 | 702 | ||
675 | ret = rc80211_pid_init(); | 703 | ret = rc80211_pid_init(); |
676 | if (ret) | 704 | if (ret) |
677 | return ret; | 705 | goto err_pid; |
678 | 706 | ||
679 | ieee80211_debugfs_netdev_init(); | 707 | ret = ieee80211_iface_init(); |
708 | if (ret) | ||
709 | goto err_netdev; | ||
680 | 710 | ||
681 | return 0; | 711 | return 0; |
712 | err_netdev: | ||
713 | rc80211_pid_exit(); | ||
714 | err_pid: | ||
715 | rc80211_minstrel_exit(); | ||
716 | |||
717 | return ret; | ||
682 | } | 718 | } |
683 | 719 | ||
684 | static void __exit ieee80211_exit(void) | 720 | static void __exit ieee80211_exit(void) |
@@ -695,7 +731,7 @@ static void __exit ieee80211_exit(void) | |||
695 | if (mesh_allocated) | 731 | if (mesh_allocated) |
696 | ieee80211s_stop(); | 732 | ieee80211s_stop(); |
697 | 733 | ||
698 | ieee80211_debugfs_netdev_exit(); | 734 | ieee80211_iface_exit(); |
699 | } | 735 | } |
700 | 736 | ||
701 | 737 | ||
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 6a4331429598..e0bd85e3d4b6 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -457,7 +457,7 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, | |||
457 | 457 | ||
458 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 458 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
459 | printk(KERN_DEBUG "%s: running mesh housekeeping\n", | 459 | printk(KERN_DEBUG "%s: running mesh housekeeping\n", |
460 | sdata->dev->name); | 460 | sdata->name); |
461 | #endif | 461 | #endif |
462 | 462 | ||
463 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); | 463 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); |
@@ -565,7 +565,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, | |||
565 | 565 | ||
566 | /* ignore ProbeResp to foreign address */ | 566 | /* ignore ProbeResp to foreign address */ |
567 | if (stype == IEEE80211_STYPE_PROBE_RESP && | 567 | if (stype == IEEE80211_STYPE_PROBE_RESP && |
568 | compare_ether_addr(mgmt->da, sdata->dev->dev_addr)) | 568 | compare_ether_addr(mgmt->da, sdata->vif.addr)) |
569 | return; | 569 | return; |
570 | 570 | ||
571 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; | 571 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index d28acb6b1f81..ce84237ebad3 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -128,9 +128,9 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, | |||
128 | IEEE80211_STYPE_ACTION); | 128 | IEEE80211_STYPE_ACTION); |
129 | 129 | ||
130 | memcpy(mgmt->da, da, ETH_ALEN); | 130 | memcpy(mgmt->da, da, ETH_ALEN); |
131 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 131 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
132 | /* BSSID == SA */ | 132 | /* BSSID == SA */ |
133 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | 133 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); |
134 | mgmt->u.action.category = MESH_PATH_SEL_CATEGORY; | 134 | mgmt->u.action.category = MESH_PATH_SEL_CATEGORY; |
135 | mgmt->u.action.u.mesh_action.action_code = MESH_PATH_SEL_ACTION; | 135 | mgmt->u.action.u.mesh_action.action_code = MESH_PATH_SEL_ACTION; |
136 | 136 | ||
@@ -222,7 +222,7 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, | |||
222 | IEEE80211_STYPE_ACTION); | 222 | IEEE80211_STYPE_ACTION); |
223 | 223 | ||
224 | memcpy(mgmt->da, ra, ETH_ALEN); | 224 | memcpy(mgmt->da, ra, ETH_ALEN); |
225 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 225 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
226 | /* BSSID is left zeroed, wildcard value */ | 226 | /* BSSID is left zeroed, wildcard value */ |
227 | mgmt->u.action.category = MESH_PATH_SEL_CATEGORY; | 227 | mgmt->u.action.category = MESH_PATH_SEL_CATEGORY; |
228 | mgmt->u.action.u.mesh_action.action_code = MESH_PATH_SEL_ACTION; | 228 | mgmt->u.action.u.mesh_action.action_code = MESH_PATH_SEL_ACTION; |
@@ -335,7 +335,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, | |||
335 | bool process = true; | 335 | bool process = true; |
336 | 336 | ||
337 | rcu_read_lock(); | 337 | rcu_read_lock(); |
338 | sta = sta_info_get(local, mgmt->sa); | 338 | sta = sta_info_get(sdata, mgmt->sa); |
339 | if (!sta) { | 339 | if (!sta) { |
340 | rcu_read_unlock(); | 340 | rcu_read_unlock(); |
341 | return 0; | 341 | return 0; |
@@ -374,7 +374,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, | |||
374 | new_metric = MAX_METRIC; | 374 | new_metric = MAX_METRIC; |
375 | exp_time = TU_TO_EXP_TIME(orig_lifetime); | 375 | exp_time = TU_TO_EXP_TIME(orig_lifetime); |
376 | 376 | ||
377 | if (memcmp(orig_addr, sdata->dev->dev_addr, ETH_ALEN) == 0) { | 377 | if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0) { |
378 | /* This MP is the originator, we are not interested in this | 378 | /* This MP is the originator, we are not interested in this |
379 | * frame, except for updating transmitter's path info. | 379 | * frame, except for updating transmitter's path info. |
380 | */ | 380 | */ |
@@ -486,7 +486,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
486 | 486 | ||
487 | mhwmp_dbg("received PREQ from %pM\n", orig_addr); | 487 | mhwmp_dbg("received PREQ from %pM\n", orig_addr); |
488 | 488 | ||
489 | if (memcmp(target_addr, sdata->dev->dev_addr, ETH_ALEN) == 0) { | 489 | if (memcmp(target_addr, sdata->vif.addr, ETH_ALEN) == 0) { |
490 | mhwmp_dbg("PREQ is for us\n"); | 490 | mhwmp_dbg("PREQ is for us\n"); |
491 | forward = false; | 491 | forward = false; |
492 | reply = true; | 492 | reply = true; |
@@ -579,7 +579,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
579 | * replies | 579 | * replies |
580 | */ | 580 | */ |
581 | target_addr = PREP_IE_TARGET_ADDR(prep_elem); | 581 | target_addr = PREP_IE_TARGET_ADDR(prep_elem); |
582 | if (memcmp(target_addr, sdata->dev->dev_addr, ETH_ALEN) == 0) | 582 | if (memcmp(target_addr, sdata->vif.addr, ETH_ALEN) == 0) |
583 | /* destination, no forwarding required */ | 583 | /* destination, no forwarding required */ |
584 | return; | 584 | return; |
585 | 585 | ||
@@ -890,7 +890,7 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) | |||
890 | target_flags = MP_F_RF; | 890 | target_flags = MP_F_RF; |
891 | 891 | ||
892 | spin_unlock_bh(&mpath->state_lock); | 892 | spin_unlock_bh(&mpath->state_lock); |
893 | mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->dev->dev_addr, | 893 | mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->vif.addr, |
894 | cpu_to_le32(ifmsh->sn), target_flags, mpath->dst, | 894 | cpu_to_le32(ifmsh->sn), target_flags, mpath->dst, |
895 | cpu_to_le32(mpath->sn), broadcast_addr, 0, | 895 | cpu_to_le32(mpath->sn), broadcast_addr, 0, |
896 | ttl, cpu_to_le32(lifetime), 0, | 896 | ttl, cpu_to_le32(lifetime), 0, |
@@ -939,7 +939,7 @@ int mesh_nexthop_lookup(struct sk_buff *skb, | |||
939 | if (time_after(jiffies, | 939 | if (time_after(jiffies, |
940 | mpath->exp_time - | 940 | mpath->exp_time - |
941 | msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && | 941 | msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && |
942 | !memcmp(sdata->dev->dev_addr, hdr->addr4, ETH_ALEN) && | 942 | !memcmp(sdata->vif.addr, hdr->addr4, ETH_ALEN) && |
943 | !(mpath->flags & MESH_PATH_RESOLVING) && | 943 | !(mpath->flags & MESH_PATH_RESOLVING) && |
944 | !(mpath->flags & MESH_PATH_FIXED)) { | 944 | !(mpath->flags & MESH_PATH_FIXED)) { |
945 | mesh_queue_preq(mpath, | 945 | mesh_queue_preq(mpath, |
@@ -1010,7 +1010,7 @@ mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata) | |||
1010 | { | 1010 | { |
1011 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | 1011 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
1012 | 1012 | ||
1013 | mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->dev->dev_addr, | 1013 | mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->vif.addr, |
1014 | cpu_to_le32(++ifmsh->sn), | 1014 | cpu_to_le32(++ifmsh->sn), |
1015 | 0, NULL, 0, broadcast_addr, | 1015 | 0, NULL, 0, broadcast_addr, |
1016 | 0, MESH_TTL, 0, 0, 0, sdata); | 1016 | 0, MESH_TTL, 0, 0, 0, sdata); |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 0192cfdacae4..2312efe04c62 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -260,7 +260,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata) | |||
260 | int err = 0; | 260 | int err = 0; |
261 | u32 hash_idx; | 261 | u32 hash_idx; |
262 | 262 | ||
263 | if (memcmp(dst, sdata->dev->dev_addr, ETH_ALEN) == 0) | 263 | if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) |
264 | /* never add ourselves as neighbours */ | 264 | /* never add ourselves as neighbours */ |
265 | return -ENOTSUPP; | 265 | return -ENOTSUPP; |
266 | 266 | ||
@@ -377,7 +377,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata) | |||
377 | int err = 0; | 377 | int err = 0; |
378 | u32 hash_idx; | 378 | u32 hash_idx; |
379 | 379 | ||
380 | if (memcmp(dst, sdata->dev->dev_addr, ETH_ALEN) == 0) | 380 | if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) |
381 | /* never add ourselves as neighbours */ | 381 | /* never add ourselves as neighbours */ |
382 | return -ENOTSUPP; | 382 | return -ENOTSUPP; |
383 | 383 | ||
@@ -605,7 +605,7 @@ void mesh_path_discard_frame(struct sk_buff *skb, | |||
605 | struct mesh_path *mpath; | 605 | struct mesh_path *mpath; |
606 | u32 sn = 0; | 606 | u32 sn = 0; |
607 | 607 | ||
608 | if (memcmp(hdr->addr4, sdata->dev->dev_addr, ETH_ALEN) != 0) { | 608 | if (memcmp(hdr->addr4, sdata->vif.addr, ETH_ALEN) != 0) { |
609 | u8 *ra, *da; | 609 | u8 *ra, *da; |
610 | 610 | ||
611 | da = hdr->addr3; | 611 | da = hdr->addr3; |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 0f7c6e6a4248..7985e5150898 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -169,7 +169,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
169 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 169 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
170 | IEEE80211_STYPE_ACTION); | 170 | IEEE80211_STYPE_ACTION); |
171 | memcpy(mgmt->da, da, ETH_ALEN); | 171 | memcpy(mgmt->da, da, ETH_ALEN); |
172 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 172 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
173 | /* BSSID is left zeroed, wildcard value */ | 173 | /* BSSID is left zeroed, wildcard value */ |
174 | mgmt->u.action.category = MESH_PLINK_CATEGORY; | 174 | mgmt->u.action.category = MESH_PLINK_CATEGORY; |
175 | mgmt->u.action.u.plink_action.action_code = action; | 175 | mgmt->u.action.u.plink_action.action_code = action; |
@@ -234,7 +234,7 @@ void mesh_neighbour_update(u8 *hw_addr, u32 rates, struct ieee80211_sub_if_data | |||
234 | 234 | ||
235 | rcu_read_lock(); | 235 | rcu_read_lock(); |
236 | 236 | ||
237 | sta = sta_info_get(local, hw_addr); | 237 | sta = sta_info_get(sdata, hw_addr); |
238 | if (!sta) { | 238 | if (!sta) { |
239 | sta = mesh_plink_alloc(sdata, hw_addr, rates); | 239 | sta = mesh_plink_alloc(sdata, hw_addr, rates); |
240 | if (!sta) { | 240 | if (!sta) { |
@@ -455,7 +455,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
455 | 455 | ||
456 | rcu_read_lock(); | 456 | rcu_read_lock(); |
457 | 457 | ||
458 | sta = sta_info_get(local, mgmt->sa); | 458 | sta = sta_info_get(sdata, mgmt->sa); |
459 | if (!sta && ftype != PLINK_OPEN) { | 459 | if (!sta && ftype != PLINK_OPEN) { |
460 | mpl_dbg("Mesh plink: cls or cnf from unknown peer\n"); | 460 | mpl_dbg("Mesh plink: cls or cnf from unknown peer\n"); |
461 | rcu_read_unlock(); | 461 | rcu_read_unlock(); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index c79e59f82fd9..2f9ed8b9c3f0 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -75,6 +75,9 @@ enum rx_mgmt_action { | |||
75 | /* caller must call cfg80211_send_disassoc() */ | 75 | /* caller must call cfg80211_send_disassoc() */ |
76 | RX_MGMT_CFG80211_DISASSOC, | 76 | RX_MGMT_CFG80211_DISASSOC, |
77 | 77 | ||
78 | /* caller must tell cfg80211 about internal error */ | ||
79 | RX_MGMT_CFG80211_ASSOC_ERROR, | ||
80 | |||
78 | /* caller must call cfg80211_auth_timeout() & free work */ | 81 | /* caller must call cfg80211_auth_timeout() & free work */ |
79 | RX_MGMT_CFG80211_AUTH_TO, | 82 | RX_MGMT_CFG80211_AUTH_TO, |
80 | 83 | ||
@@ -202,7 +205,7 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | |||
202 | ieee80211_hw_config(local, 0); | 205 | ieee80211_hw_config(local, 0); |
203 | 206 | ||
204 | rcu_read_lock(); | 207 | rcu_read_lock(); |
205 | sta = sta_info_get(local, bssid); | 208 | sta = sta_info_get(sdata, bssid); |
206 | if (sta) | 209 | if (sta) |
207 | rate_control_rate_update(local, sband, sta, | 210 | rate_control_rate_update(local, sband, sta, |
208 | IEEE80211_RC_HT_CHANGED); | 211 | IEEE80211_RC_HT_CHANGED); |
@@ -248,7 +251,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, | |||
248 | wk->ssid_len); | 251 | wk->ssid_len); |
249 | if (!skb) { | 252 | if (!skb) { |
250 | printk(KERN_DEBUG "%s: failed to allocate buffer for assoc " | 253 | printk(KERN_DEBUG "%s: failed to allocate buffer for assoc " |
251 | "frame\n", sdata->dev->name); | 254 | "frame\n", sdata->name); |
252 | return; | 255 | return; |
253 | } | 256 | } |
254 | skb_reserve(skb, local->hw.extra_tx_headroom); | 257 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -282,7 +285,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, | |||
282 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 285 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
283 | memset(mgmt, 0, 24); | 286 | memset(mgmt, 0, 24); |
284 | memcpy(mgmt->da, wk->bss->cbss.bssid, ETH_ALEN); | 287 | memcpy(mgmt->da, wk->bss->cbss.bssid, ETH_ALEN); |
285 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 288 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
286 | memcpy(mgmt->bssid, wk->bss->cbss.bssid, ETH_ALEN); | 289 | memcpy(mgmt->bssid, wk->bss->cbss.bssid, ETH_ALEN); |
287 | 290 | ||
288 | if (!is_zero_ether_addr(wk->prev_bssid)) { | 291 | if (!is_zero_ether_addr(wk->prev_bssid)) { |
@@ -398,6 +401,14 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, | |||
398 | __le16 tmp; | 401 | __le16 tmp; |
399 | u32 flags = local->hw.conf.channel->flags; | 402 | u32 flags = local->hw.conf.channel->flags; |
400 | 403 | ||
404 | /* determine capability flags */ | ||
405 | |||
406 | if (ieee80211_disable_40mhz_24ghz && | ||
407 | sband->band == IEEE80211_BAND_2GHZ) { | ||
408 | cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; | ||
409 | cap &= ~IEEE80211_HT_CAP_SGI_40; | ||
410 | } | ||
411 | |||
401 | switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { | 412 | switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { |
402 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: | 413 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: |
403 | if (flags & IEEE80211_CHAN_NO_HT40PLUS) { | 414 | if (flags & IEEE80211_CHAN_NO_HT40PLUS) { |
@@ -413,17 +424,64 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata, | |||
413 | break; | 424 | break; |
414 | } | 425 | } |
415 | 426 | ||
416 | tmp = cpu_to_le16(cap); | 427 | /* set SM PS mode properly */ |
417 | pos = skb_put(skb, sizeof(struct ieee80211_ht_cap)+2); | 428 | cap &= ~IEEE80211_HT_CAP_SM_PS; |
429 | /* new association always uses requested smps mode */ | ||
430 | if (ifmgd->req_smps == IEEE80211_SMPS_AUTOMATIC) { | ||
431 | if (ifmgd->powersave) | ||
432 | ifmgd->ap_smps = IEEE80211_SMPS_DYNAMIC; | ||
433 | else | ||
434 | ifmgd->ap_smps = IEEE80211_SMPS_OFF; | ||
435 | } else | ||
436 | ifmgd->ap_smps = ifmgd->req_smps; | ||
437 | |||
438 | switch (ifmgd->ap_smps) { | ||
439 | case IEEE80211_SMPS_AUTOMATIC: | ||
440 | case IEEE80211_SMPS_NUM_MODES: | ||
441 | WARN_ON(1); | ||
442 | case IEEE80211_SMPS_OFF: | ||
443 | cap |= WLAN_HT_CAP_SM_PS_DISABLED << | ||
444 | IEEE80211_HT_CAP_SM_PS_SHIFT; | ||
445 | break; | ||
446 | case IEEE80211_SMPS_STATIC: | ||
447 | cap |= WLAN_HT_CAP_SM_PS_STATIC << | ||
448 | IEEE80211_HT_CAP_SM_PS_SHIFT; | ||
449 | break; | ||
450 | case IEEE80211_SMPS_DYNAMIC: | ||
451 | cap |= WLAN_HT_CAP_SM_PS_DYNAMIC << | ||
452 | IEEE80211_HT_CAP_SM_PS_SHIFT; | ||
453 | break; | ||
454 | } | ||
455 | |||
456 | /* reserve and fill IE */ | ||
457 | |||
458 | pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2); | ||
418 | *pos++ = WLAN_EID_HT_CAPABILITY; | 459 | *pos++ = WLAN_EID_HT_CAPABILITY; |
419 | *pos++ = sizeof(struct ieee80211_ht_cap); | 460 | *pos++ = sizeof(struct ieee80211_ht_cap); |
420 | memset(pos, 0, sizeof(struct ieee80211_ht_cap)); | 461 | memset(pos, 0, sizeof(struct ieee80211_ht_cap)); |
462 | |||
463 | /* capability flags */ | ||
464 | tmp = cpu_to_le16(cap); | ||
421 | memcpy(pos, &tmp, sizeof(u16)); | 465 | memcpy(pos, &tmp, sizeof(u16)); |
422 | pos += sizeof(u16); | 466 | pos += sizeof(u16); |
423 | /* TODO: needs a define here for << 2 */ | 467 | |
468 | /* AMPDU parameters */ | ||
424 | *pos++ = sband->ht_cap.ampdu_factor | | 469 | *pos++ = sband->ht_cap.ampdu_factor | |
425 | (sband->ht_cap.ampdu_density << 2); | 470 | (sband->ht_cap.ampdu_density << |
471 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); | ||
472 | |||
473 | /* MCS set */ | ||
426 | memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs)); | 474 | memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs)); |
475 | pos += sizeof(sband->ht_cap.mcs); | ||
476 | |||
477 | /* extended capabilities */ | ||
478 | pos += sizeof(__le16); | ||
479 | |||
480 | /* BF capabilities */ | ||
481 | pos += sizeof(__le32); | ||
482 | |||
483 | /* antenna selection */ | ||
484 | pos += sizeof(u8); | ||
427 | } | 485 | } |
428 | 486 | ||
429 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 487 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
@@ -443,7 +501,7 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, | |||
443 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); | 501 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt)); |
444 | if (!skb) { | 502 | if (!skb) { |
445 | printk(KERN_DEBUG "%s: failed to allocate buffer for " | 503 | printk(KERN_DEBUG "%s: failed to allocate buffer for " |
446 | "deauth/disassoc frame\n", sdata->dev->name); | 504 | "deauth/disassoc frame\n", sdata->name); |
447 | return; | 505 | return; |
448 | } | 506 | } |
449 | skb_reserve(skb, local->hw.extra_tx_headroom); | 507 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -451,7 +509,7 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, | |||
451 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); | 509 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); |
452 | memset(mgmt, 0, 24); | 510 | memset(mgmt, 0, 24); |
453 | memcpy(mgmt->da, bssid, ETH_ALEN); | 511 | memcpy(mgmt->da, bssid, ETH_ALEN); |
454 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 512 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
455 | memcpy(mgmt->bssid, bssid, ETH_ALEN); | 513 | memcpy(mgmt->bssid, bssid, ETH_ALEN); |
456 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); | 514 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); |
457 | skb_put(skb, 2); | 515 | skb_put(skb, 2); |
@@ -484,7 +542,7 @@ void ieee80211_send_pspoll(struct ieee80211_local *local, | |||
484 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*pspoll)); | 542 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*pspoll)); |
485 | if (!skb) { | 543 | if (!skb) { |
486 | printk(KERN_DEBUG "%s: failed to allocate buffer for " | 544 | printk(KERN_DEBUG "%s: failed to allocate buffer for " |
487 | "pspoll frame\n", sdata->dev->name); | 545 | "pspoll frame\n", sdata->name); |
488 | return; | 546 | return; |
489 | } | 547 | } |
490 | skb_reserve(skb, local->hw.extra_tx_headroom); | 548 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -499,7 +557,7 @@ void ieee80211_send_pspoll(struct ieee80211_local *local, | |||
499 | pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14); | 557 | pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14); |
500 | 558 | ||
501 | memcpy(pspoll->bssid, ifmgd->bssid, ETH_ALEN); | 559 | memcpy(pspoll->bssid, ifmgd->bssid, ETH_ALEN); |
502 | memcpy(pspoll->ta, sdata->dev->dev_addr, ETH_ALEN); | 560 | memcpy(pspoll->ta, sdata->vif.addr, ETH_ALEN); |
503 | 561 | ||
504 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 562 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
505 | ieee80211_tx_skb(sdata, skb); | 563 | ieee80211_tx_skb(sdata, skb); |
@@ -519,7 +577,7 @@ void ieee80211_send_nullfunc(struct ieee80211_local *local, | |||
519 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24); | 577 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24); |
520 | if (!skb) { | 578 | if (!skb) { |
521 | printk(KERN_DEBUG "%s: failed to allocate buffer for nullfunc " | 579 | printk(KERN_DEBUG "%s: failed to allocate buffer for nullfunc " |
522 | "frame\n", sdata->dev->name); | 580 | "frame\n", sdata->name); |
523 | return; | 581 | return; |
524 | } | 582 | } |
525 | skb_reserve(skb, local->hw.extra_tx_headroom); | 583 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -532,7 +590,7 @@ void ieee80211_send_nullfunc(struct ieee80211_local *local, | |||
532 | fc |= cpu_to_le16(IEEE80211_FCTL_PM); | 590 | fc |= cpu_to_le16(IEEE80211_FCTL_PM); |
533 | nullfunc->frame_control = fc; | 591 | nullfunc->frame_control = fc; |
534 | memcpy(nullfunc->addr1, sdata->u.mgd.bssid, ETH_ALEN); | 592 | memcpy(nullfunc->addr1, sdata->u.mgd.bssid, ETH_ALEN); |
535 | memcpy(nullfunc->addr2, sdata->dev->dev_addr, ETH_ALEN); | 593 | memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); |
536 | memcpy(nullfunc->addr3, sdata->u.mgd.bssid, ETH_ALEN); | 594 | memcpy(nullfunc->addr3, sdata->u.mgd.bssid, ETH_ALEN); |
537 | 595 | ||
538 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 596 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
@@ -940,6 +998,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
940 | 998 | ||
941 | mutex_lock(&local->iflist_mtx); | 999 | mutex_lock(&local->iflist_mtx); |
942 | ieee80211_recalc_ps(local, -1); | 1000 | ieee80211_recalc_ps(local, -1); |
1001 | ieee80211_recalc_smps(local, sdata); | ||
943 | mutex_unlock(&local->iflist_mtx); | 1002 | mutex_unlock(&local->iflist_mtx); |
944 | 1003 | ||
945 | netif_start_queue(sdata->dev); | 1004 | netif_start_queue(sdata->dev); |
@@ -956,7 +1015,7 @@ ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata, | |||
956 | wk->tries++; | 1015 | wk->tries++; |
957 | if (wk->tries > IEEE80211_AUTH_MAX_TRIES) { | 1016 | if (wk->tries > IEEE80211_AUTH_MAX_TRIES) { |
958 | printk(KERN_DEBUG "%s: direct probe to AP %pM timed out\n", | 1017 | printk(KERN_DEBUG "%s: direct probe to AP %pM timed out\n", |
959 | sdata->dev->name, wk->bss->cbss.bssid); | 1018 | sdata->name, wk->bss->cbss.bssid); |
960 | 1019 | ||
961 | /* | 1020 | /* |
962 | * Most likely AP is not in the range so remove the | 1021 | * Most likely AP is not in the range so remove the |
@@ -974,7 +1033,7 @@ ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata, | |||
974 | } | 1033 | } |
975 | 1034 | ||
976 | printk(KERN_DEBUG "%s: direct probe to AP %pM (try %d)\n", | 1035 | printk(KERN_DEBUG "%s: direct probe to AP %pM (try %d)\n", |
977 | sdata->dev->name, wk->bss->cbss.bssid, | 1036 | sdata->name, wk->bss->cbss.bssid, |
978 | wk->tries); | 1037 | wk->tries); |
979 | 1038 | ||
980 | /* | 1039 | /* |
@@ -1001,7 +1060,7 @@ ieee80211_authenticate(struct ieee80211_sub_if_data *sdata, | |||
1001 | if (wk->tries > IEEE80211_AUTH_MAX_TRIES) { | 1060 | if (wk->tries > IEEE80211_AUTH_MAX_TRIES) { |
1002 | printk(KERN_DEBUG "%s: authentication with AP %pM" | 1061 | printk(KERN_DEBUG "%s: authentication with AP %pM" |
1003 | " timed out\n", | 1062 | " timed out\n", |
1004 | sdata->dev->name, wk->bss->cbss.bssid); | 1063 | sdata->name, wk->bss->cbss.bssid); |
1005 | 1064 | ||
1006 | /* | 1065 | /* |
1007 | * Most likely AP is not in the range so remove the | 1066 | * Most likely AP is not in the range so remove the |
@@ -1019,7 +1078,7 @@ ieee80211_authenticate(struct ieee80211_sub_if_data *sdata, | |||
1019 | } | 1078 | } |
1020 | 1079 | ||
1021 | printk(KERN_DEBUG "%s: authenticate with AP %pM (try %d)\n", | 1080 | printk(KERN_DEBUG "%s: authenticate with AP %pM (try %d)\n", |
1022 | sdata->dev->name, wk->bss->cbss.bssid, wk->tries); | 1081 | sdata->name, wk->bss->cbss.bssid, wk->tries); |
1023 | 1082 | ||
1024 | ieee80211_send_auth(sdata, 1, wk->auth_alg, wk->ie, wk->ie_len, | 1083 | ieee80211_send_auth(sdata, 1, wk->auth_alg, wk->ie, wk->ie_len, |
1025 | wk->bss->cbss.bssid, NULL, 0, 0); | 1084 | wk->bss->cbss.bssid, NULL, 0, 0); |
@@ -1078,7 +1137,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1078 | netif_carrier_off(sdata->dev); | 1137 | netif_carrier_off(sdata->dev); |
1079 | 1138 | ||
1080 | rcu_read_lock(); | 1139 | rcu_read_lock(); |
1081 | sta = sta_info_get(local, bssid); | 1140 | sta = sta_info_get(sdata, bssid); |
1082 | if (sta) | 1141 | if (sta) |
1083 | ieee80211_sta_tear_down_BA_sessions(sta); | 1142 | ieee80211_sta_tear_down_BA_sessions(sta); |
1084 | rcu_read_unlock(); | 1143 | rcu_read_unlock(); |
@@ -1115,7 +1174,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1115 | 1174 | ||
1116 | rcu_read_lock(); | 1175 | rcu_read_lock(); |
1117 | 1176 | ||
1118 | sta = sta_info_get(local, bssid); | 1177 | sta = sta_info_get(sdata, bssid); |
1119 | if (!sta) { | 1178 | if (!sta) { |
1120 | rcu_read_unlock(); | 1179 | rcu_read_unlock(); |
1121 | return; | 1180 | return; |
@@ -1139,7 +1198,7 @@ ieee80211_associate(struct ieee80211_sub_if_data *sdata, | |||
1139 | if (wk->tries > IEEE80211_ASSOC_MAX_TRIES) { | 1198 | if (wk->tries > IEEE80211_ASSOC_MAX_TRIES) { |
1140 | printk(KERN_DEBUG "%s: association with AP %pM" | 1199 | printk(KERN_DEBUG "%s: association with AP %pM" |
1141 | " timed out\n", | 1200 | " timed out\n", |
1142 | sdata->dev->name, wk->bss->cbss.bssid); | 1201 | sdata->name, wk->bss->cbss.bssid); |
1143 | 1202 | ||
1144 | /* | 1203 | /* |
1145 | * Most likely AP is not in the range so remove the | 1204 | * Most likely AP is not in the range so remove the |
@@ -1157,7 +1216,7 @@ ieee80211_associate(struct ieee80211_sub_if_data *sdata, | |||
1157 | } | 1216 | } |
1158 | 1217 | ||
1159 | printk(KERN_DEBUG "%s: associate with AP %pM (try %d)\n", | 1218 | printk(KERN_DEBUG "%s: associate with AP %pM (try %d)\n", |
1160 | sdata->dev->name, wk->bss->cbss.bssid, wk->tries); | 1219 | sdata->name, wk->bss->cbss.bssid, wk->tries); |
1161 | ieee80211_send_assoc(sdata, wk); | 1220 | ieee80211_send_assoc(sdata, wk); |
1162 | 1221 | ||
1163 | wk->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; | 1222 | wk->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; |
@@ -1218,7 +1277,7 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, | |||
1218 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1277 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1219 | if (beacon && net_ratelimit()) | 1278 | if (beacon && net_ratelimit()) |
1220 | printk(KERN_DEBUG "%s: detected beacon loss from AP " | 1279 | printk(KERN_DEBUG "%s: detected beacon loss from AP " |
1221 | "- sending probe request\n", sdata->dev->name); | 1280 | "- sending probe request\n", sdata->name); |
1222 | #endif | 1281 | #endif |
1223 | 1282 | ||
1224 | /* | 1283 | /* |
@@ -1275,7 +1334,7 @@ static void ieee80211_auth_completed(struct ieee80211_sub_if_data *sdata, | |||
1275 | struct ieee80211_mgd_work *wk) | 1334 | struct ieee80211_mgd_work *wk) |
1276 | { | 1335 | { |
1277 | wk->state = IEEE80211_MGD_STATE_IDLE; | 1336 | wk->state = IEEE80211_MGD_STATE_IDLE; |
1278 | printk(KERN_DEBUG "%s: authenticated\n", sdata->dev->name); | 1337 | printk(KERN_DEBUG "%s: authenticated\n", sdata->name); |
1279 | } | 1338 | } |
1280 | 1339 | ||
1281 | 1340 | ||
@@ -1372,7 +1431,7 @@ ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, | |||
1372 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); | 1431 | reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); |
1373 | 1432 | ||
1374 | printk(KERN_DEBUG "%s: deauthenticated from %pM (Reason: %u)\n", | 1433 | printk(KERN_DEBUG "%s: deauthenticated from %pM (Reason: %u)\n", |
1375 | sdata->dev->name, bssid, reason_code); | 1434 | sdata->name, bssid, reason_code); |
1376 | 1435 | ||
1377 | if (!wk) { | 1436 | if (!wk) { |
1378 | ieee80211_set_disassoc(sdata, true); | 1437 | ieee80211_set_disassoc(sdata, true); |
@@ -1407,7 +1466,7 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1407 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); | 1466 | reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); |
1408 | 1467 | ||
1409 | printk(KERN_DEBUG "%s: disassociated from %pM (Reason: %u)\n", | 1468 | printk(KERN_DEBUG "%s: disassociated from %pM (Reason: %u)\n", |
1410 | sdata->dev->name, mgmt->sa, reason_code); | 1469 | sdata->name, mgmt->sa, reason_code); |
1411 | 1470 | ||
1412 | ieee80211_set_disassoc(sdata, false); | 1471 | ieee80211_set_disassoc(sdata, false); |
1413 | ieee80211_recalc_idle(sdata->local); | 1472 | ieee80211_recalc_idle(sdata->local); |
@@ -1431,8 +1490,8 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1431 | struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; | 1490 | struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; |
1432 | u8 *pos; | 1491 | u8 *pos; |
1433 | u32 changed = 0; | 1492 | u32 changed = 0; |
1434 | int i, j; | 1493 | int i, j, err; |
1435 | bool have_higher_than_11mbit = false, newsta = false; | 1494 | bool have_higher_than_11mbit = false; |
1436 | u16 ap_ht_cap_flags; | 1495 | u16 ap_ht_cap_flags; |
1437 | 1496 | ||
1438 | /* | 1497 | /* |
@@ -1452,7 +1511,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1452 | 1511 | ||
1453 | printk(KERN_DEBUG "%s: RX %sssocResp from %pM (capab=0x%x " | 1512 | printk(KERN_DEBUG "%s: RX %sssocResp from %pM (capab=0x%x " |
1454 | "status=%d aid=%d)\n", | 1513 | "status=%d aid=%d)\n", |
1455 | sdata->dev->name, reassoc ? "Rea" : "A", mgmt->sa, | 1514 | sdata->name, reassoc ? "Rea" : "A", mgmt->sa, |
1456 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); | 1515 | capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); |
1457 | 1516 | ||
1458 | pos = mgmt->u.assoc_resp.variable; | 1517 | pos = mgmt->u.assoc_resp.variable; |
@@ -1466,7 +1525,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1466 | ms = tu * 1024 / 1000; | 1525 | ms = tu * 1024 / 1000; |
1467 | printk(KERN_DEBUG "%s: AP rejected association temporarily; " | 1526 | printk(KERN_DEBUG "%s: AP rejected association temporarily; " |
1468 | "comeback duration %u TU (%u ms)\n", | 1527 | "comeback duration %u TU (%u ms)\n", |
1469 | sdata->dev->name, tu, ms); | 1528 | sdata->name, tu, ms); |
1470 | wk->timeout = jiffies + msecs_to_jiffies(ms); | 1529 | wk->timeout = jiffies + msecs_to_jiffies(ms); |
1471 | if (ms > IEEE80211_ASSOC_TIMEOUT) | 1530 | if (ms > IEEE80211_ASSOC_TIMEOUT) |
1472 | run_again(ifmgd, jiffies + msecs_to_jiffies(ms)); | 1531 | run_again(ifmgd, jiffies + msecs_to_jiffies(ms)); |
@@ -1475,49 +1534,37 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1475 | 1534 | ||
1476 | if (status_code != WLAN_STATUS_SUCCESS) { | 1535 | if (status_code != WLAN_STATUS_SUCCESS) { |
1477 | printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", | 1536 | printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", |
1478 | sdata->dev->name, status_code); | 1537 | sdata->name, status_code); |
1479 | wk->state = IEEE80211_MGD_STATE_IDLE; | 1538 | wk->state = IEEE80211_MGD_STATE_IDLE; |
1480 | return RX_MGMT_CFG80211_ASSOC; | 1539 | return RX_MGMT_CFG80211_ASSOC; |
1481 | } | 1540 | } |
1482 | 1541 | ||
1483 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) | 1542 | if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) |
1484 | printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not " | 1543 | printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not " |
1485 | "set\n", sdata->dev->name, aid); | 1544 | "set\n", sdata->name, aid); |
1486 | aid &= ~(BIT(15) | BIT(14)); | 1545 | aid &= ~(BIT(15) | BIT(14)); |
1487 | 1546 | ||
1488 | if (!elems.supp_rates) { | 1547 | if (!elems.supp_rates) { |
1489 | printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n", | 1548 | printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n", |
1490 | sdata->dev->name); | 1549 | sdata->name); |
1491 | return RX_MGMT_NONE; | 1550 | return RX_MGMT_NONE; |
1492 | } | 1551 | } |
1493 | 1552 | ||
1494 | printk(KERN_DEBUG "%s: associated\n", sdata->dev->name); | 1553 | printk(KERN_DEBUG "%s: associated\n", sdata->name); |
1495 | ifmgd->aid = aid; | 1554 | ifmgd->aid = aid; |
1496 | 1555 | ||
1497 | rcu_read_lock(); | 1556 | sta = sta_info_alloc(sdata, wk->bss->cbss.bssid, GFP_KERNEL); |
1498 | |||
1499 | /* Add STA entry for the AP */ | ||
1500 | sta = sta_info_get(local, wk->bss->cbss.bssid); | ||
1501 | if (!sta) { | 1557 | if (!sta) { |
1502 | newsta = true; | 1558 | printk(KERN_DEBUG "%s: failed to alloc STA entry for" |
1503 | 1559 | " the AP\n", sdata->name); | |
1504 | rcu_read_unlock(); | 1560 | return RX_MGMT_CFG80211_ASSOC_ERROR; |
1505 | |||
1506 | sta = sta_info_alloc(sdata, wk->bss->cbss.bssid, GFP_KERNEL); | ||
1507 | if (!sta) { | ||
1508 | printk(KERN_DEBUG "%s: failed to alloc STA entry for" | ||
1509 | " the AP\n", sdata->dev->name); | ||
1510 | return RX_MGMT_NONE; | ||
1511 | } | ||
1512 | |||
1513 | set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC | | ||
1514 | WLAN_STA_ASSOC_AP); | ||
1515 | if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) | ||
1516 | set_sta_flags(sta, WLAN_STA_AUTHORIZED); | ||
1517 | |||
1518 | rcu_read_lock(); | ||
1519 | } | 1561 | } |
1520 | 1562 | ||
1563 | set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC | | ||
1564 | WLAN_STA_ASSOC_AP); | ||
1565 | if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) | ||
1566 | set_sta_flags(sta, WLAN_STA_AUTHORIZED); | ||
1567 | |||
1521 | rates = 0; | 1568 | rates = 0; |
1522 | basic_rates = 0; | 1569 | basic_rates = 0; |
1523 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1570 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
@@ -1580,18 +1627,14 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1580 | if (elems.wmm_param) | 1627 | if (elems.wmm_param) |
1581 | set_sta_flags(sta, WLAN_STA_WME); | 1628 | set_sta_flags(sta, WLAN_STA_WME); |
1582 | 1629 | ||
1583 | if (newsta) { | 1630 | err = sta_info_insert(sta); |
1584 | int err = sta_info_insert(sta); | 1631 | sta = NULL; |
1585 | if (err) { | 1632 | if (err) { |
1586 | printk(KERN_DEBUG "%s: failed to insert STA entry for" | 1633 | printk(KERN_DEBUG "%s: failed to insert STA entry for" |
1587 | " the AP (error %d)\n", sdata->dev->name, err); | 1634 | " the AP (error %d)\n", sdata->name, err); |
1588 | rcu_read_unlock(); | 1635 | return RX_MGMT_CFG80211_ASSOC_ERROR; |
1589 | return RX_MGMT_NONE; | ||
1590 | } | ||
1591 | } | 1636 | } |
1592 | 1637 | ||
1593 | rcu_read_unlock(); | ||
1594 | |||
1595 | if (elems.wmm_param) | 1638 | if (elems.wmm_param) |
1596 | ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param, | 1639 | ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param, |
1597 | elems.wmm_param_len); | 1640 | elems.wmm_param_len); |
@@ -1679,7 +1722,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
1679 | 1722 | ||
1680 | ASSERT_MGD_MTX(ifmgd); | 1723 | ASSERT_MGD_MTX(ifmgd); |
1681 | 1724 | ||
1682 | if (memcmp(mgmt->da, sdata->dev->dev_addr, ETH_ALEN)) | 1725 | if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN)) |
1683 | return; /* ignore ProbeResp to foreign address */ | 1726 | return; /* ignore ProbeResp to foreign address */ |
1684 | 1727 | ||
1685 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; | 1728 | baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; |
@@ -1694,7 +1737,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
1694 | /* direct probe may be part of the association flow */ | 1737 | /* direct probe may be part of the association flow */ |
1695 | if (wk && wk->state == IEEE80211_MGD_STATE_PROBE) { | 1738 | if (wk && wk->state == IEEE80211_MGD_STATE_PROBE) { |
1696 | printk(KERN_DEBUG "%s: direct probe responded\n", | 1739 | printk(KERN_DEBUG "%s: direct probe responded\n", |
1697 | sdata->dev->name); | 1740 | sdata->name); |
1698 | wk->tries = 0; | 1741 | wk->tries = 0; |
1699 | wk->state = IEEE80211_MGD_STATE_AUTH; | 1742 | wk->state = IEEE80211_MGD_STATE_AUTH; |
1700 | WARN_ON(ieee80211_authenticate(sdata, wk) != RX_MGMT_NONE); | 1743 | WARN_ON(ieee80211_authenticate(sdata, wk) != RX_MGMT_NONE); |
@@ -1787,7 +1830,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1787 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1830 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1788 | if (net_ratelimit()) { | 1831 | if (net_ratelimit()) { |
1789 | printk(KERN_DEBUG "%s: cancelling probereq poll due " | 1832 | printk(KERN_DEBUG "%s: cancelling probereq poll due " |
1790 | "to a received beacon\n", sdata->dev->name); | 1833 | "to a received beacon\n", sdata->name); |
1791 | } | 1834 | } |
1792 | #endif | 1835 | #endif |
1793 | ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL; | 1836 | ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL; |
@@ -1865,7 +1908,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1865 | 1908 | ||
1866 | rcu_read_lock(); | 1909 | rcu_read_lock(); |
1867 | 1910 | ||
1868 | sta = sta_info_get(local, bssid); | 1911 | sta = sta_info_get(sdata, bssid); |
1869 | if (WARN_ON(!sta)) { | 1912 | if (WARN_ON(!sta)) { |
1870 | rcu_read_unlock(); | 1913 | rcu_read_unlock(); |
1871 | return; | 1914 | return; |
@@ -2036,6 +2079,10 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
2036 | case RX_MGMT_CFG80211_DEAUTH: | 2079 | case RX_MGMT_CFG80211_DEAUTH: |
2037 | cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len); | 2080 | cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len); |
2038 | break; | 2081 | break; |
2082 | case RX_MGMT_CFG80211_ASSOC_ERROR: | ||
2083 | /* an internal error -- pretend timeout for now */ | ||
2084 | cfg80211_send_assoc_timeout(sdata->dev, mgmt->bssid); | ||
2085 | break; | ||
2039 | default: | 2086 | default: |
2040 | WARN(1, "unexpected: %d", rma); | 2087 | WARN(1, "unexpected: %d", rma); |
2041 | } | 2088 | } |
@@ -2336,6 +2383,11 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata) | |||
2336 | ifmgd->flags |= IEEE80211_STA_WMM_ENABLED; | 2383 | ifmgd->flags |= IEEE80211_STA_WMM_ENABLED; |
2337 | 2384 | ||
2338 | mutex_init(&ifmgd->mtx); | 2385 | mutex_init(&ifmgd->mtx); |
2386 | |||
2387 | if (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS) | ||
2388 | ifmgd->req_smps = IEEE80211_SMPS_AUTOMATIC; | ||
2389 | else | ||
2390 | ifmgd->req_smps = IEEE80211_SMPS_OFF; | ||
2339 | } | 2391 | } |
2340 | 2392 | ||
2341 | /* scan finished notification */ | 2393 | /* scan finished notification */ |
@@ -2563,7 +2615,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
2563 | mutex_unlock(&ifmgd->mtx); | 2615 | mutex_unlock(&ifmgd->mtx); |
2564 | 2616 | ||
2565 | printk(KERN_DEBUG "%s: deauthenticating from %pM by local choice (reason=%d)\n", | 2617 | printk(KERN_DEBUG "%s: deauthenticating from %pM by local choice (reason=%d)\n", |
2566 | sdata->dev->name, bssid, req->reason_code); | 2618 | sdata->name, bssid, req->reason_code); |
2567 | 2619 | ||
2568 | ieee80211_send_deauth_disassoc(sdata, bssid, | 2620 | ieee80211_send_deauth_disassoc(sdata, bssid, |
2569 | IEEE80211_STYPE_DEAUTH, req->reason_code, | 2621 | IEEE80211_STYPE_DEAUTH, req->reason_code, |
@@ -2594,7 +2646,7 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
2594 | } | 2646 | } |
2595 | 2647 | ||
2596 | printk(KERN_DEBUG "%s: disassociating from %pM by local choice (reason=%d)\n", | 2648 | printk(KERN_DEBUG "%s: disassociating from %pM by local choice (reason=%d)\n", |
2597 | sdata->dev->name, req->bss->bssid, req->reason_code); | 2649 | sdata->name, req->bss->bssid, req->reason_code); |
2598 | 2650 | ||
2599 | ieee80211_set_disassoc(sdata, false); | 2651 | ieee80211_set_disassoc(sdata, false); |
2600 | 2652 | ||
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index e535f1c988fe..05e161c3cbc5 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c | |||
@@ -65,7 +65,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw) | |||
65 | struct ieee80211_sub_if_data, | 65 | struct ieee80211_sub_if_data, |
66 | u.ap); | 66 | u.ap); |
67 | 67 | ||
68 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE, | 68 | drv_sta_notify(local, sdata, STA_NOTIFY_REMOVE, |
69 | &sta->sta); | 69 | &sta->sta); |
70 | } | 70 | } |
71 | 71 | ||
@@ -102,7 +102,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw) | |||
102 | 102 | ||
103 | conf.vif = &sdata->vif; | 103 | conf.vif = &sdata->vif; |
104 | conf.type = sdata->vif.type; | 104 | conf.type = sdata->vif.type; |
105 | conf.mac_addr = sdata->dev->dev_addr; | 105 | conf.mac_addr = sdata->vif.addr; |
106 | drv_remove_interface(local, &conf); | 106 | drv_remove_interface(local, &conf); |
107 | } | 107 | } |
108 | 108 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 9f2807aeaf52..6cbf1a7b3157 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -283,15 +283,15 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
283 | skb->protocol = htons(ETH_P_802_2); | 283 | skb->protocol = htons(ETH_P_802_2); |
284 | 284 | ||
285 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 285 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
286 | if (!netif_running(sdata->dev)) | ||
287 | continue; | ||
288 | |||
289 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) | 286 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) |
290 | continue; | 287 | continue; |
291 | 288 | ||
292 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) | 289 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) |
293 | continue; | 290 | continue; |
294 | 291 | ||
292 | if (!netif_running(sdata->dev)) | ||
293 | continue; | ||
294 | |||
295 | if (prev_dev) { | 295 | if (prev_dev) { |
296 | skb2 = skb_clone(skb, GFP_ATOMIC); | 296 | skb2 = skb_clone(skb, GFP_ATOMIC); |
297 | if (skb2) { | 297 | if (skb2) { |
@@ -361,7 +361,9 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx) | |||
361 | * boundary. In the case of regular frames, this simply means aligning the | 361 | * boundary. In the case of regular frames, this simply means aligning the |
362 | * payload to a four-byte boundary (because either the IP header is directly | 362 | * payload to a four-byte boundary (because either the IP header is directly |
363 | * contained, or IV/RFC1042 headers that have a length divisible by four are | 363 | * contained, or IV/RFC1042 headers that have a length divisible by four are |
364 | * in front of it). | 364 | * in front of it). If the payload data is not properly aligned and the |
365 | * architecture doesn't support efficient unaligned operations, mac80211 | ||
366 | * will align the data. | ||
365 | * | 367 | * |
366 | * With A-MSDU frames, however, the payload data address must yield two modulo | 368 | * With A-MSDU frames, however, the payload data address must yield two modulo |
367 | * four because there are 14-byte 802.3 headers within the A-MSDU frames that | 369 | * four because there are 14-byte 802.3 headers within the A-MSDU frames that |
@@ -375,25 +377,10 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx) | |||
375 | */ | 377 | */ |
376 | static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx) | 378 | static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx) |
377 | { | 379 | { |
378 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 380 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
379 | int hdrlen; | 381 | WARN_ONCE((unsigned long)rx->skb->data & 1, |
380 | 382 | "unaligned packet at 0x%p\n", rx->skb->data); | |
381 | #ifndef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT | ||
382 | return; | ||
383 | #endif | 383 | #endif |
384 | |||
385 | if (WARN_ONCE((unsigned long)rx->skb->data & 1, | ||
386 | "unaligned packet at 0x%p\n", rx->skb->data)) | ||
387 | return; | ||
388 | |||
389 | if (!ieee80211_is_data_present(hdr->frame_control)) | ||
390 | return; | ||
391 | |||
392 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | ||
393 | if (rx->flags & IEEE80211_RX_AMSDU) | ||
394 | hdrlen += ETH_HLEN; | ||
395 | WARN_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3, | ||
396 | "unaligned IP payload at 0x%p\n", rx->skb->data + hdrlen); | ||
397 | } | 384 | } |
398 | 385 | ||
399 | 386 | ||
@@ -476,7 +463,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx) | |||
476 | { | 463 | { |
477 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 464 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
478 | unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); | 465 | unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control); |
479 | char *dev_addr = rx->sdata->dev->dev_addr; | 466 | char *dev_addr = rx->sdata->vif.addr; |
480 | 467 | ||
481 | if (ieee80211_is_data(hdr->frame_control)) { | 468 | if (ieee80211_is_data(hdr->frame_control)) { |
482 | if (is_multicast_ether_addr(hdr->addr1)) { | 469 | if (is_multicast_ether_addr(hdr->addr1)) { |
@@ -1021,10 +1008,10 @@ static void ap_sta_ps_start(struct sta_info *sta) | |||
1021 | 1008 | ||
1022 | atomic_inc(&sdata->bss->num_sta_ps); | 1009 | atomic_inc(&sdata->bss->num_sta_ps); |
1023 | set_sta_flags(sta, WLAN_STA_PS_STA); | 1010 | set_sta_flags(sta, WLAN_STA_PS_STA); |
1024 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_SLEEP, &sta->sta); | 1011 | drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta); |
1025 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1012 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
1026 | printk(KERN_DEBUG "%s: STA %pM aid %d enters power save mode\n", | 1013 | printk(KERN_DEBUG "%s: STA %pM aid %d enters power save mode\n", |
1027 | sdata->dev->name, sta->sta.addr, sta->sta.aid); | 1014 | sdata->name, sta->sta.addr, sta->sta.aid); |
1028 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1015 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1029 | } | 1016 | } |
1030 | 1017 | ||
@@ -1038,13 +1025,13 @@ static void ap_sta_ps_end(struct sta_info *sta) | |||
1038 | 1025 | ||
1039 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1026 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
1040 | printk(KERN_DEBUG "%s: STA %pM aid %d exits power save mode\n", | 1027 | printk(KERN_DEBUG "%s: STA %pM aid %d exits power save mode\n", |
1041 | sdata->dev->name, sta->sta.addr, sta->sta.aid); | 1028 | sdata->name, sta->sta.addr, sta->sta.aid); |
1042 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1029 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1043 | 1030 | ||
1044 | if (test_sta_flags(sta, WLAN_STA_PS_DRIVER)) { | 1031 | if (test_sta_flags(sta, WLAN_STA_PS_DRIVER)) { |
1045 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 1032 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
1046 | printk(KERN_DEBUG "%s: STA %pM aid %d driver-ps-blocked\n", | 1033 | printk(KERN_DEBUG "%s: STA %pM aid %d driver-ps-blocked\n", |
1047 | sdata->dev->name, sta->sta.addr, sta->sta.aid); | 1034 | sdata->name, sta->sta.addr, sta->sta.aid); |
1048 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1035 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1049 | return; | 1036 | return; |
1050 | } | 1037 | } |
@@ -1156,7 +1143,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, | |||
1156 | printk(KERN_DEBUG "%s: RX reassembly removed oldest " | 1143 | printk(KERN_DEBUG "%s: RX reassembly removed oldest " |
1157 | "fragment entry (idx=%d age=%lu seq=%d last_frag=%d " | 1144 | "fragment entry (idx=%d age=%lu seq=%d last_frag=%d " |
1158 | "addr1=%pM addr2=%pM\n", | 1145 | "addr1=%pM addr2=%pM\n", |
1159 | sdata->dev->name, idx, | 1146 | sdata->name, idx, |
1160 | jiffies - entry->first_frag_time, entry->seq, | 1147 | jiffies - entry->first_frag_time, entry->seq, |
1161 | entry->last_frag, hdr->addr1, hdr->addr2); | 1148 | entry->last_frag, hdr->addr1, hdr->addr2); |
1162 | #endif | 1149 | #endif |
@@ -1424,7 +1411,6 @@ static int | |||
1424 | __ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | 1411 | __ieee80211_data_to_8023(struct ieee80211_rx_data *rx) |
1425 | { | 1412 | { |
1426 | struct ieee80211_sub_if_data *sdata = rx->sdata; | 1413 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1427 | struct net_device *dev = sdata->dev; | ||
1428 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 1414 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
1429 | 1415 | ||
1430 | if (ieee80211_has_a4(hdr->frame_control) && | 1416 | if (ieee80211_has_a4(hdr->frame_control) && |
@@ -1436,7 +1422,7 @@ __ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1436 | (sdata->vif.type == NL80211_IFTYPE_STATION && sdata->u.mgd.use_4addr))) | 1422 | (sdata->vif.type == NL80211_IFTYPE_STATION && sdata->u.mgd.use_4addr))) |
1437 | return -1; | 1423 | return -1; |
1438 | 1424 | ||
1439 | return ieee80211_data_to_8023(rx->skb, dev->dev_addr, sdata->vif.type); | 1425 | return ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type); |
1440 | } | 1426 | } |
1441 | 1427 | ||
1442 | /* | 1428 | /* |
@@ -1453,7 +1439,7 @@ static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) | |||
1453 | * of whether the frame was encrypted or not. | 1439 | * of whether the frame was encrypted or not. |
1454 | */ | 1440 | */ |
1455 | if (ehdr->h_proto == htons(ETH_P_PAE) && | 1441 | if (ehdr->h_proto == htons(ETH_P_PAE) && |
1456 | (compare_ether_addr(ehdr->h_dest, rx->sdata->dev->dev_addr) == 0 || | 1442 | (compare_ether_addr(ehdr->h_dest, rx->sdata->vif.addr) == 0 || |
1457 | compare_ether_addr(ehdr->h_dest, pae_group_addr) == 0)) | 1443 | compare_ether_addr(ehdr->h_dest, pae_group_addr) == 0)) |
1458 | return true; | 1444 | return true; |
1459 | 1445 | ||
@@ -1472,7 +1458,6 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1472 | { | 1458 | { |
1473 | struct ieee80211_sub_if_data *sdata = rx->sdata; | 1459 | struct ieee80211_sub_if_data *sdata = rx->sdata; |
1474 | struct net_device *dev = sdata->dev; | 1460 | struct net_device *dev = sdata->dev; |
1475 | struct ieee80211_local *local = rx->local; | ||
1476 | struct sk_buff *skb, *xmit_skb; | 1461 | struct sk_buff *skb, *xmit_skb; |
1477 | struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; | 1462 | struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; |
1478 | struct sta_info *dsta; | 1463 | struct sta_info *dsta; |
@@ -1495,8 +1480,8 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1495 | printk(KERN_DEBUG "%s: failed to clone " | 1480 | printk(KERN_DEBUG "%s: failed to clone " |
1496 | "multicast frame\n", dev->name); | 1481 | "multicast frame\n", dev->name); |
1497 | } else { | 1482 | } else { |
1498 | dsta = sta_info_get(local, skb->data); | 1483 | dsta = sta_info_get(sdata, skb->data); |
1499 | if (dsta && dsta->sdata->dev == dev) { | 1484 | if (dsta) { |
1500 | /* | 1485 | /* |
1501 | * The destination station is associated to | 1486 | * The destination station is associated to |
1502 | * this AP (in this VLAN), so send the frame | 1487 | * this AP (in this VLAN), so send the frame |
@@ -1512,7 +1497,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1512 | if (skb) { | 1497 | if (skb) { |
1513 | int align __maybe_unused; | 1498 | int align __maybe_unused; |
1514 | 1499 | ||
1515 | #if defined(CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT) || !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 1500 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
1516 | /* | 1501 | /* |
1517 | * 'align' will only take the values 0 or 2 here | 1502 | * 'align' will only take the values 0 or 2 here |
1518 | * since all frames are required to be aligned | 1503 | * since all frames are required to be aligned |
@@ -1556,16 +1541,10 @@ static ieee80211_rx_result debug_noinline | |||
1556 | ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | 1541 | ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) |
1557 | { | 1542 | { |
1558 | struct net_device *dev = rx->sdata->dev; | 1543 | struct net_device *dev = rx->sdata->dev; |
1559 | struct ieee80211_local *local = rx->local; | 1544 | struct sk_buff *skb = rx->skb; |
1560 | u16 ethertype; | ||
1561 | u8 *payload; | ||
1562 | struct sk_buff *skb = rx->skb, *frame = NULL; | ||
1563 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1545 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1564 | __le16 fc = hdr->frame_control; | 1546 | __le16 fc = hdr->frame_control; |
1565 | const struct ethhdr *eth; | 1547 | struct sk_buff_head frame_list; |
1566 | int remaining, err; | ||
1567 | u8 dst[ETH_ALEN]; | ||
1568 | u8 src[ETH_ALEN]; | ||
1569 | 1548 | ||
1570 | if (unlikely(!ieee80211_is_data(fc))) | 1549 | if (unlikely(!ieee80211_is_data(fc))) |
1571 | return RX_CONTINUE; | 1550 | return RX_CONTINUE; |
@@ -1576,94 +1555,34 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
1576 | if (!(rx->flags & IEEE80211_RX_AMSDU)) | 1555 | if (!(rx->flags & IEEE80211_RX_AMSDU)) |
1577 | return RX_CONTINUE; | 1556 | return RX_CONTINUE; |
1578 | 1557 | ||
1579 | err = __ieee80211_data_to_8023(rx); | 1558 | if (ieee80211_has_a4(hdr->frame_control) && |
1580 | if (unlikely(err)) | 1559 | rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && |
1560 | !rx->sdata->u.vlan.sta) | ||
1581 | return RX_DROP_UNUSABLE; | 1561 | return RX_DROP_UNUSABLE; |
1582 | 1562 | ||
1583 | skb->dev = dev; | 1563 | if (is_multicast_ether_addr(hdr->addr1) && |
1584 | 1564 | ((rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && | |
1585 | dev->stats.rx_packets++; | 1565 | rx->sdata->u.vlan.sta) || |
1586 | dev->stats.rx_bytes += skb->len; | 1566 | (rx->sdata->vif.type == NL80211_IFTYPE_STATION && |
1587 | 1567 | rx->sdata->u.mgd.use_4addr))) | |
1588 | /* skip the wrapping header */ | ||
1589 | eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr)); | ||
1590 | if (!eth) | ||
1591 | return RX_DROP_UNUSABLE; | 1568 | return RX_DROP_UNUSABLE; |
1592 | 1569 | ||
1593 | while (skb != frame) { | 1570 | skb->dev = dev; |
1594 | u8 padding; | 1571 | __skb_queue_head_init(&frame_list); |
1595 | __be16 len = eth->h_proto; | ||
1596 | unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len); | ||
1597 | |||
1598 | remaining = skb->len; | ||
1599 | memcpy(dst, eth->h_dest, ETH_ALEN); | ||
1600 | memcpy(src, eth->h_source, ETH_ALEN); | ||
1601 | |||
1602 | padding = ((4 - subframe_len) & 0x3); | ||
1603 | /* the last MSDU has no padding */ | ||
1604 | if (subframe_len > remaining) | ||
1605 | return RX_DROP_UNUSABLE; | ||
1606 | 1572 | ||
1607 | skb_pull(skb, sizeof(struct ethhdr)); | 1573 | ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, |
1608 | /* if last subframe reuse skb */ | 1574 | rx->sdata->vif.type, |
1609 | if (remaining <= subframe_len + padding) | 1575 | rx->local->hw.extra_tx_headroom); |
1610 | frame = skb; | ||
1611 | else { | ||
1612 | /* | ||
1613 | * Allocate and reserve two bytes more for payload | ||
1614 | * alignment since sizeof(struct ethhdr) is 14. | ||
1615 | */ | ||
1616 | frame = dev_alloc_skb( | ||
1617 | ALIGN(local->hw.extra_tx_headroom, 4) + | ||
1618 | subframe_len + 2); | ||
1619 | |||
1620 | if (frame == NULL) | ||
1621 | return RX_DROP_UNUSABLE; | ||
1622 | |||
1623 | skb_reserve(frame, | ||
1624 | ALIGN(local->hw.extra_tx_headroom, 4) + | ||
1625 | sizeof(struct ethhdr) + 2); | ||
1626 | memcpy(skb_put(frame, ntohs(len)), skb->data, | ||
1627 | ntohs(len)); | ||
1628 | |||
1629 | eth = (struct ethhdr *) skb_pull(skb, ntohs(len) + | ||
1630 | padding); | ||
1631 | if (!eth) { | ||
1632 | dev_kfree_skb(frame); | ||
1633 | return RX_DROP_UNUSABLE; | ||
1634 | } | ||
1635 | } | ||
1636 | 1576 | ||
1637 | skb_reset_network_header(frame); | 1577 | while (!skb_queue_empty(&frame_list)) { |
1638 | frame->dev = dev; | 1578 | rx->skb = __skb_dequeue(&frame_list); |
1639 | frame->priority = skb->priority; | ||
1640 | rx->skb = frame; | ||
1641 | |||
1642 | payload = frame->data; | ||
1643 | ethertype = (payload[6] << 8) | payload[7]; | ||
1644 | |||
1645 | if (likely((compare_ether_addr(payload, rfc1042_header) == 0 && | ||
1646 | ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || | ||
1647 | compare_ether_addr(payload, | ||
1648 | bridge_tunnel_header) == 0)) { | ||
1649 | /* remove RFC1042 or Bridge-Tunnel | ||
1650 | * encapsulation and replace EtherType */ | ||
1651 | skb_pull(frame, 6); | ||
1652 | memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN); | ||
1653 | memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); | ||
1654 | } else { | ||
1655 | memcpy(skb_push(frame, sizeof(__be16)), | ||
1656 | &len, sizeof(__be16)); | ||
1657 | memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN); | ||
1658 | memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); | ||
1659 | } | ||
1660 | 1579 | ||
1661 | if (!ieee80211_frame_allowed(rx, fc)) { | 1580 | if (!ieee80211_frame_allowed(rx, fc)) { |
1662 | if (skb == frame) /* last frame */ | 1581 | dev_kfree_skb(rx->skb); |
1663 | return RX_DROP_UNUSABLE; | ||
1664 | dev_kfree_skb(frame); | ||
1665 | continue; | 1582 | continue; |
1666 | } | 1583 | } |
1584 | dev->stats.rx_packets++; | ||
1585 | dev->stats.rx_bytes += rx->skb->len; | ||
1667 | 1586 | ||
1668 | ieee80211_deliver_skb(rx); | 1587 | ieee80211_deliver_skb(rx); |
1669 | } | 1588 | } |
@@ -1721,7 +1640,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1721 | 1640 | ||
1722 | /* Frame has reached destination. Don't forward */ | 1641 | /* Frame has reached destination. Don't forward */ |
1723 | if (!is_multicast_ether_addr(hdr->addr1) && | 1642 | if (!is_multicast_ether_addr(hdr->addr1) && |
1724 | compare_ether_addr(sdata->dev->dev_addr, hdr->addr3) == 0) | 1643 | compare_ether_addr(sdata->vif.addr, hdr->addr3) == 0) |
1725 | return RX_CONTINUE; | 1644 | return RX_CONTINUE; |
1726 | 1645 | ||
1727 | mesh_hdr->ttl--; | 1646 | mesh_hdr->ttl--; |
@@ -1738,10 +1657,10 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1738 | 1657 | ||
1739 | if (!fwd_skb && net_ratelimit()) | 1658 | if (!fwd_skb && net_ratelimit()) |
1740 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", | 1659 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", |
1741 | sdata->dev->name); | 1660 | sdata->name); |
1742 | 1661 | ||
1743 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; | 1662 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; |
1744 | memcpy(fwd_hdr->addr2, sdata->dev->dev_addr, ETH_ALEN); | 1663 | memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); |
1745 | info = IEEE80211_SKB_CB(fwd_skb); | 1664 | info = IEEE80211_SKB_CB(fwd_skb); |
1746 | memset(info, 0, sizeof(*info)); | 1665 | memset(info, 0, sizeof(*info)); |
1747 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; | 1666 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; |
@@ -1870,7 +1789,7 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, | |||
1870 | struct sk_buff *skb; | 1789 | struct sk_buff *skb; |
1871 | struct ieee80211_mgmt *resp; | 1790 | struct ieee80211_mgmt *resp; |
1872 | 1791 | ||
1873 | if (compare_ether_addr(mgmt->da, sdata->dev->dev_addr) != 0) { | 1792 | if (compare_ether_addr(mgmt->da, sdata->vif.addr) != 0) { |
1874 | /* Not to own unicast address */ | 1793 | /* Not to own unicast address */ |
1875 | return; | 1794 | return; |
1876 | } | 1795 | } |
@@ -1894,7 +1813,7 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, | |||
1894 | resp = (struct ieee80211_mgmt *) skb_put(skb, 24); | 1813 | resp = (struct ieee80211_mgmt *) skb_put(skb, 24); |
1895 | memset(resp, 0, 24); | 1814 | memset(resp, 0, 24); |
1896 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 1815 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
1897 | memcpy(resp->sa, sdata->dev->dev_addr, ETH_ALEN); | 1816 | memcpy(resp->sa, sdata->vif.addr, ETH_ALEN); |
1898 | memcpy(resp->bssid, sdata->u.mgd.bssid, ETH_ALEN); | 1817 | memcpy(resp->bssid, sdata->u.mgd.bssid, ETH_ALEN); |
1899 | resp->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1818 | resp->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1900 | IEEE80211_STYPE_ACTION); | 1819 | IEEE80211_STYPE_ACTION); |
@@ -2274,7 +2193,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2274 | if (!bssid && !sdata->u.mgd.use_4addr) | 2193 | if (!bssid && !sdata->u.mgd.use_4addr) |
2275 | return 0; | 2194 | return 0; |
2276 | if (!multicast && | 2195 | if (!multicast && |
2277 | compare_ether_addr(sdata->dev->dev_addr, hdr->addr1) != 0) { | 2196 | compare_ether_addr(sdata->vif.addr, hdr->addr1) != 0) { |
2278 | if (!(sdata->dev->flags & IFF_PROMISC)) | 2197 | if (!(sdata->dev->flags & IFF_PROMISC)) |
2279 | return 0; | 2198 | return 0; |
2280 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 2199 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
@@ -2291,7 +2210,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2291 | return 0; | 2210 | return 0; |
2292 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 2211 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
2293 | } else if (!multicast && | 2212 | } else if (!multicast && |
2294 | compare_ether_addr(sdata->dev->dev_addr, | 2213 | compare_ether_addr(sdata->vif.addr, |
2295 | hdr->addr1) != 0) { | 2214 | hdr->addr1) != 0) { |
2296 | if (!(sdata->dev->flags & IFF_PROMISC)) | 2215 | if (!(sdata->dev->flags & IFF_PROMISC)) |
2297 | return 0; | 2216 | return 0; |
@@ -2308,7 +2227,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2308 | break; | 2227 | break; |
2309 | case NL80211_IFTYPE_MESH_POINT: | 2228 | case NL80211_IFTYPE_MESH_POINT: |
2310 | if (!multicast && | 2229 | if (!multicast && |
2311 | compare_ether_addr(sdata->dev->dev_addr, | 2230 | compare_ether_addr(sdata->vif.addr, |
2312 | hdr->addr1) != 0) { | 2231 | hdr->addr1) != 0) { |
2313 | if (!(sdata->dev->flags & IFF_PROMISC)) | 2232 | if (!(sdata->dev->flags & IFF_PROMISC)) |
2314 | return 0; | 2233 | return 0; |
@@ -2319,11 +2238,11 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
2319 | case NL80211_IFTYPE_AP_VLAN: | 2238 | case NL80211_IFTYPE_AP_VLAN: |
2320 | case NL80211_IFTYPE_AP: | 2239 | case NL80211_IFTYPE_AP: |
2321 | if (!bssid) { | 2240 | if (!bssid) { |
2322 | if (compare_ether_addr(sdata->dev->dev_addr, | 2241 | if (compare_ether_addr(sdata->vif.addr, |
2323 | hdr->addr1)) | 2242 | hdr->addr1)) |
2324 | return 0; | 2243 | return 0; |
2325 | } else if (!ieee80211_bssid_match(bssid, | 2244 | } else if (!ieee80211_bssid_match(bssid, |
2326 | sdata->dev->dev_addr)) { | 2245 | sdata->vif.addr)) { |
2327 | if (!(rx->flags & IEEE80211_RX_IN_SCAN)) | 2246 | if (!(rx->flags & IEEE80211_RX_IN_SCAN)) |
2328 | return 0; | 2247 | return 0; |
2329 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 2248 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
@@ -2362,6 +2281,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2362 | int prepares; | 2281 | int prepares; |
2363 | struct ieee80211_sub_if_data *prev = NULL; | 2282 | struct ieee80211_sub_if_data *prev = NULL; |
2364 | struct sk_buff *skb_new; | 2283 | struct sk_buff *skb_new; |
2284 | struct sta_info *sta, *tmp; | ||
2285 | bool found_sta = false; | ||
2365 | 2286 | ||
2366 | hdr = (struct ieee80211_hdr *)skb->data; | 2287 | hdr = (struct ieee80211_hdr *)skb->data; |
2367 | memset(&rx, 0, sizeof(rx)); | 2288 | memset(&rx, 0, sizeof(rx)); |
@@ -2378,68 +2299,76 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2378 | ieee80211_parse_qos(&rx); | 2299 | ieee80211_parse_qos(&rx); |
2379 | ieee80211_verify_alignment(&rx); | 2300 | ieee80211_verify_alignment(&rx); |
2380 | 2301 | ||
2381 | rx.sta = sta_info_get(local, hdr->addr2); | 2302 | if (ieee80211_is_data(hdr->frame_control)) { |
2382 | if (rx.sta) | 2303 | for_each_sta_info(local, hdr->addr2, sta, tmp) { |
2383 | rx.sdata = rx.sta->sdata; | 2304 | rx.sta = sta; |
2384 | 2305 | found_sta = true; | |
2385 | if (rx.sdata && ieee80211_is_data(hdr->frame_control)) { | 2306 | rx.sdata = sta->sdata; |
2386 | rx.flags |= IEEE80211_RX_RA_MATCH; | 2307 | |
2387 | prepares = prepare_for_handlers(rx.sdata, &rx, hdr); | 2308 | rx.flags |= IEEE80211_RX_RA_MATCH; |
2388 | if (prepares) { | 2309 | prepares = prepare_for_handlers(rx.sdata, &rx, hdr); |
2389 | if (status->flag & RX_FLAG_MMIC_ERROR) { | 2310 | if (prepares) { |
2390 | if (rx.flags & IEEE80211_RX_RA_MATCH) | 2311 | if (status->flag & RX_FLAG_MMIC_ERROR) { |
2391 | ieee80211_rx_michael_mic_report(hdr, &rx); | 2312 | if (rx.flags & IEEE80211_RX_RA_MATCH) |
2392 | } else | 2313 | ieee80211_rx_michael_mic_report(hdr, &rx); |
2393 | prev = rx.sdata; | 2314 | } else |
2315 | prev = rx.sdata; | ||
2316 | } | ||
2394 | } | 2317 | } |
2395 | } else list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 2318 | } |
2396 | if (!netif_running(sdata->dev)) | 2319 | if (!found_sta) { |
2397 | continue; | 2320 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
2321 | if (!netif_running(sdata->dev)) | ||
2322 | continue; | ||
2398 | 2323 | ||
2399 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || | 2324 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || |
2400 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 2325 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
2401 | continue; | 2326 | continue; |
2402 | 2327 | ||
2403 | rx.flags |= IEEE80211_RX_RA_MATCH; | 2328 | rx.sta = sta_info_get(sdata, hdr->addr2); |
2404 | prepares = prepare_for_handlers(sdata, &rx, hdr); | ||
2405 | 2329 | ||
2406 | if (!prepares) | 2330 | rx.flags |= IEEE80211_RX_RA_MATCH; |
2407 | continue; | 2331 | prepares = prepare_for_handlers(sdata, &rx, hdr); |
2408 | 2332 | ||
2409 | if (status->flag & RX_FLAG_MMIC_ERROR) { | 2333 | if (!prepares) |
2410 | rx.sdata = sdata; | 2334 | continue; |
2411 | if (rx.flags & IEEE80211_RX_RA_MATCH) | ||
2412 | ieee80211_rx_michael_mic_report(hdr, &rx); | ||
2413 | continue; | ||
2414 | } | ||
2415 | 2335 | ||
2416 | /* | 2336 | if (status->flag & RX_FLAG_MMIC_ERROR) { |
2417 | * frame is destined for this interface, but if it's not | 2337 | rx.sdata = sdata; |
2418 | * also for the previous one we handle that after the | 2338 | if (rx.flags & IEEE80211_RX_RA_MATCH) |
2419 | * loop to avoid copying the SKB once too much | 2339 | ieee80211_rx_michael_mic_report(hdr, |
2420 | */ | 2340 | &rx); |
2341 | continue; | ||
2342 | } | ||
2421 | 2343 | ||
2422 | if (!prev) { | 2344 | /* |
2423 | prev = sdata; | 2345 | * frame is destined for this interface, but if it's |
2424 | continue; | 2346 | * not also for the previous one we handle that after |
2425 | } | 2347 | * the loop to avoid copying the SKB once too much |
2348 | */ | ||
2426 | 2349 | ||
2427 | /* | 2350 | if (!prev) { |
2428 | * frame was destined for the previous interface | 2351 | prev = sdata; |
2429 | * so invoke RX handlers for it | 2352 | continue; |
2430 | */ | 2353 | } |
2431 | 2354 | ||
2432 | skb_new = skb_copy(skb, GFP_ATOMIC); | 2355 | /* |
2433 | if (!skb_new) { | 2356 | * frame was destined for the previous interface |
2434 | if (net_ratelimit()) | 2357 | * so invoke RX handlers for it |
2435 | printk(KERN_DEBUG "%s: failed to copy " | 2358 | */ |
2436 | "multicast frame for %s\n", | 2359 | |
2437 | wiphy_name(local->hw.wiphy), | 2360 | skb_new = skb_copy(skb, GFP_ATOMIC); |
2438 | prev->dev->name); | 2361 | if (!skb_new) { |
2439 | continue; | 2362 | if (net_ratelimit()) |
2363 | printk(KERN_DEBUG "%s: failed to copy " | ||
2364 | "multicast frame for %s\n", | ||
2365 | wiphy_name(local->hw.wiphy), | ||
2366 | prev->name); | ||
2367 | continue; | ||
2368 | } | ||
2369 | ieee80211_invoke_rx_handlers(prev, &rx, skb_new, rate); | ||
2370 | prev = sdata; | ||
2440 | } | 2371 | } |
2441 | ieee80211_invoke_rx_handlers(prev, &rx, skb_new, rate); | ||
2442 | prev = sdata; | ||
2443 | } | 2372 | } |
2444 | if (prev) | 2373 | if (prev) |
2445 | ieee80211_invoke_rx_handlers(prev, &rx, skb, rate); | 2374 | ieee80211_invoke_rx_handlers(prev, &rx, skb, rate); |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index f1a4c7160300..66da0ab1d8fa 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -147,7 +147,7 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) | |||
147 | presp = ieee80211_is_probe_resp(fc); | 147 | presp = ieee80211_is_probe_resp(fc); |
148 | if (presp) { | 148 | if (presp) { |
149 | /* ignore ProbeResp to foreign address */ | 149 | /* ignore ProbeResp to foreign address */ |
150 | if (memcmp(mgmt->da, sdata->dev->dev_addr, ETH_ALEN)) | 150 | if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN)) |
151 | return RX_DROP_MONITOR; | 151 | return RX_DROP_MONITOR; |
152 | 152 | ||
153 | presp = true; | 153 | presp = true; |
diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c index aa743a895cf9..7733f66ee2c4 100644 --- a/net/mac80211/spectmgmt.c +++ b/net/mac80211/spectmgmt.c | |||
@@ -35,7 +35,7 @@ static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_da | |||
35 | 35 | ||
36 | if (!skb) { | 36 | if (!skb) { |
37 | printk(KERN_ERR "%s: failed to allocate buffer for " | 37 | printk(KERN_ERR "%s: failed to allocate buffer for " |
38 | "measurement report frame\n", sdata->dev->name); | 38 | "measurement report frame\n", sdata->name); |
39 | return; | 39 | return; |
40 | } | 40 | } |
41 | 41 | ||
@@ -43,7 +43,7 @@ static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_da | |||
43 | msr_report = (struct ieee80211_mgmt *)skb_put(skb, 24); | 43 | msr_report = (struct ieee80211_mgmt *)skb_put(skb, 24); |
44 | memset(msr_report, 0, 24); | 44 | memset(msr_report, 0, 24); |
45 | memcpy(msr_report->da, da, ETH_ALEN); | 45 | memcpy(msr_report->da, da, ETH_ALEN); |
46 | memcpy(msr_report->sa, sdata->dev->dev_addr, ETH_ALEN); | 46 | memcpy(msr_report->sa, sdata->vif.addr, ETH_ALEN); |
47 | memcpy(msr_report->bssid, bssid, ETH_ALEN); | 47 | memcpy(msr_report->bssid, bssid, ETH_ALEN); |
48 | msr_report->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 48 | msr_report->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
49 | IEEE80211_STYPE_ACTION); | 49 | IEEE80211_STYPE_ACTION); |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 71f370dd24bc..d1a77e79d7a9 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -103,13 +103,16 @@ static int sta_info_hash_del(struct ieee80211_local *local, | |||
103 | } | 103 | } |
104 | 104 | ||
105 | /* protected by RCU */ | 105 | /* protected by RCU */ |
106 | struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr) | 106 | struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, |
107 | const u8 *addr) | ||
107 | { | 108 | { |
109 | struct ieee80211_local *local = sdata->local; | ||
108 | struct sta_info *sta; | 110 | struct sta_info *sta; |
109 | 111 | ||
110 | sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); | 112 | sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]); |
111 | while (sta) { | 113 | while (sta) { |
112 | if (memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) | 114 | if (sta->sdata == sdata && |
115 | memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) | ||
113 | break; | 116 | break; |
114 | sta = rcu_dereference(sta->hnext); | 117 | sta = rcu_dereference(sta->hnext); |
115 | } | 118 | } |
@@ -369,7 +372,7 @@ int sta_info_insert(struct sta_info *sta) | |||
369 | goto out_free; | 372 | goto out_free; |
370 | } | 373 | } |
371 | 374 | ||
372 | if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 || | 375 | if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->vif.addr) == 0 || |
373 | is_multicast_ether_addr(sta->sta.addr))) { | 376 | is_multicast_ether_addr(sta->sta.addr))) { |
374 | err = -EINVAL; | 377 | err = -EINVAL; |
375 | goto out_free; | 378 | goto out_free; |
@@ -377,7 +380,7 @@ int sta_info_insert(struct sta_info *sta) | |||
377 | 380 | ||
378 | spin_lock_irqsave(&local->sta_lock, flags); | 381 | spin_lock_irqsave(&local->sta_lock, flags); |
379 | /* check if STA exists already */ | 382 | /* check if STA exists already */ |
380 | if (sta_info_get(local, sta->sta.addr)) { | 383 | if (sta_info_get(sdata, sta->sta.addr)) { |
381 | spin_unlock_irqrestore(&local->sta_lock, flags); | 384 | spin_unlock_irqrestore(&local->sta_lock, flags); |
382 | err = -EEXIST; | 385 | err = -EEXIST; |
383 | goto out_free; | 386 | goto out_free; |
@@ -394,7 +397,7 @@ int sta_info_insert(struct sta_info *sta) | |||
394 | struct ieee80211_sub_if_data, | 397 | struct ieee80211_sub_if_data, |
395 | u.ap); | 398 | u.ap); |
396 | 399 | ||
397 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta); | 400 | drv_sta_notify(local, sdata, STA_NOTIFY_ADD, &sta->sta); |
398 | sdata = sta->sdata; | 401 | sdata = sta->sdata; |
399 | } | 402 | } |
400 | 403 | ||
@@ -534,7 +537,7 @@ static void __sta_info_unlink(struct sta_info **sta) | |||
534 | struct ieee80211_sub_if_data, | 537 | struct ieee80211_sub_if_data, |
535 | u.ap); | 538 | u.ap); |
536 | 539 | ||
537 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE, | 540 | drv_sta_notify(local, sdata, STA_NOTIFY_REMOVE, |
538 | &(*sta)->sta); | 541 | &(*sta)->sta); |
539 | sdata = (*sta)->sdata; | 542 | sdata = (*sta)->sdata; |
540 | } | 543 | } |
@@ -828,7 +831,7 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, | |||
828 | if (time_after(jiffies, sta->last_rx + exp_time)) { | 831 | if (time_after(jiffies, sta->last_rx + exp_time)) { |
829 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 832 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
830 | printk(KERN_DEBUG "%s: expiring inactive STA %pM\n", | 833 | printk(KERN_DEBUG "%s: expiring inactive STA %pM\n", |
831 | sdata->dev->name, sta->sta.addr); | 834 | sdata->name, sta->sta.addr); |
832 | #endif | 835 | #endif |
833 | __sta_info_unlink(&sta); | 836 | __sta_info_unlink(&sta); |
834 | if (sta) | 837 | if (sta) |
@@ -843,11 +846,12 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, | |||
843 | struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw, | 846 | struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw, |
844 | const u8 *addr) | 847 | const u8 *addr) |
845 | { | 848 | { |
846 | struct sta_info *sta = sta_info_get(hw_to_local(hw), addr); | 849 | struct sta_info *sta, *nxt; |
847 | 850 | ||
848 | if (!sta) | 851 | /* Just return a random station ... first in list ... */ |
849 | return NULL; | 852 | for_each_sta_info(hw_to_local(hw), addr, sta, nxt) |
850 | return &sta->sta; | 853 | return &sta->sta; |
854 | return NULL; | ||
851 | } | 855 | } |
852 | EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw); | 856 | EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw); |
853 | 857 | ||
@@ -872,7 +876,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | |||
872 | struct ieee80211_local *local = sdata->local; | 876 | struct ieee80211_local *local = sdata->local; |
873 | int sent, buffered; | 877 | int sent, buffered; |
874 | 878 | ||
875 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_AWAKE, &sta->sta); | 879 | drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta); |
876 | 880 | ||
877 | if (!skb_queue_empty(&sta->ps_tx_buf)) | 881 | if (!skb_queue_empty(&sta->ps_tx_buf)) |
878 | sta_info_clear_tim_bit(sta); | 882 | sta_info_clear_tim_bit(sta); |
@@ -885,7 +889,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | |||
885 | 889 | ||
886 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 890 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
887 | printk(KERN_DEBUG "%s: STA %pM aid %d sending %d filtered/%d PS frames " | 891 | printk(KERN_DEBUG "%s: STA %pM aid %d sending %d filtered/%d PS frames " |
888 | "since STA not sleeping anymore\n", sdata->dev->name, | 892 | "since STA not sleeping anymore\n", sdata->name, |
889 | sta->sta.addr, sta->sta.aid, sent - buffered, buffered); | 893 | sta->sta.addr, sta->sta.aid, sent - buffered, buffered); |
890 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 894 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
891 | } | 895 | } |
@@ -944,7 +948,7 @@ void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta) | |||
944 | */ | 948 | */ |
945 | printk(KERN_DEBUG "%s: STA %pM sent PS Poll even " | 949 | printk(KERN_DEBUG "%s: STA %pM sent PS Poll even " |
946 | "though there are no buffered frames for it\n", | 950 | "though there are no buffered frames for it\n", |
947 | sdata->dev->name, sta->sta.addr); | 951 | sdata->name, sta->sta.addr); |
948 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 952 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
949 | } | 953 | } |
950 | } | 954 | } |
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index b4810f6aa94f..c8208236e896 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -403,9 +403,34 @@ static inline u32 get_sta_flags(struct sta_info *sta) | |||
403 | #define STA_INFO_CLEANUP_INTERVAL (10 * HZ) | 403 | #define STA_INFO_CLEANUP_INTERVAL (10 * HZ) |
404 | 404 | ||
405 | /* | 405 | /* |
406 | * Get a STA info, must have be under RCU read lock. | 406 | * Get a STA info, must be under RCU read lock. |
407 | */ | 407 | */ |
408 | struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr); | 408 | struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, |
409 | const u8 *addr); | ||
410 | |||
411 | static inline | ||
412 | void for_each_sta_info_type_check(struct ieee80211_local *local, | ||
413 | const u8 *addr, | ||
414 | struct sta_info *sta, | ||
415 | struct sta_info *nxt) | ||
416 | { | ||
417 | } | ||
418 | |||
419 | #define for_each_sta_info(local, _addr, sta, nxt) \ | ||
420 | for ( /* initialise loop */ \ | ||
421 | sta = rcu_dereference(local->sta_hash[STA_HASH(_addr)]),\ | ||
422 | nxt = sta ? rcu_dereference(sta->hnext) : NULL; \ | ||
423 | /* typecheck */ \ | ||
424 | for_each_sta_info_type_check(local, (_addr), sta, nxt), \ | ||
425 | /* continue condition */ \ | ||
426 | sta; \ | ||
427 | /* advance loop */ \ | ||
428 | sta = nxt, \ | ||
429 | nxt = sta ? rcu_dereference(sta->hnext) : NULL \ | ||
430 | ) \ | ||
431 | /* compare address and run code only if it matches */ \ | ||
432 | if (memcmp(sta->sta.addr, (_addr), ETH_ALEN) == 0) | ||
433 | |||
409 | /* | 434 | /* |
410 | * Get STA info by index, BROKEN! | 435 | * Get STA info by index, BROKEN! |
411 | */ | 436 | */ |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index d78f36c64c7b..0c0850d37dda 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -134,6 +134,40 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
134 | dev_kfree_skb(skb); | 134 | dev_kfree_skb(skb); |
135 | } | 135 | } |
136 | 136 | ||
137 | static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb) | ||
138 | { | ||
139 | struct ieee80211_mgmt *mgmt = (void *) skb->data; | ||
140 | struct ieee80211_local *local = sta->local; | ||
141 | struct ieee80211_sub_if_data *sdata = sta->sdata; | ||
142 | |||
143 | if (ieee80211_is_action(mgmt->frame_control) && | ||
144 | sdata->vif.type == NL80211_IFTYPE_STATION && | ||
145 | mgmt->u.action.category == WLAN_CATEGORY_HT && | ||
146 | mgmt->u.action.u.ht_smps.action == WLAN_HT_ACTION_SMPS) { | ||
147 | /* | ||
148 | * This update looks racy, but isn't -- if we come | ||
149 | * here we've definitely got a station that we're | ||
150 | * talking to, and on a managed interface that can | ||
151 | * only be the AP. And the only other place updating | ||
152 | * this variable is before we're associated. | ||
153 | */ | ||
154 | switch (mgmt->u.action.u.ht_smps.smps_control) { | ||
155 | case WLAN_HT_SMPS_CONTROL_DYNAMIC: | ||
156 | sta->sdata->u.mgd.ap_smps = IEEE80211_SMPS_DYNAMIC; | ||
157 | break; | ||
158 | case WLAN_HT_SMPS_CONTROL_STATIC: | ||
159 | sta->sdata->u.mgd.ap_smps = IEEE80211_SMPS_STATIC; | ||
160 | break; | ||
161 | case WLAN_HT_SMPS_CONTROL_DISABLED: | ||
162 | default: /* shouldn't happen since we don't send that */ | ||
163 | sta->sdata->u.mgd.ap_smps = IEEE80211_SMPS_OFF; | ||
164 | break; | ||
165 | } | ||
166 | |||
167 | ieee80211_queue_work(&local->hw, &local->recalc_smps); | ||
168 | } | ||
169 | } | ||
170 | |||
137 | void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | 171 | void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) |
138 | { | 172 | { |
139 | struct sk_buff *skb2; | 173 | struct sk_buff *skb2; |
@@ -146,7 +180,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
146 | struct ieee80211_tx_status_rtap_hdr *rthdr; | 180 | struct ieee80211_tx_status_rtap_hdr *rthdr; |
147 | struct ieee80211_sub_if_data *sdata; | 181 | struct ieee80211_sub_if_data *sdata; |
148 | struct net_device *prev_dev = NULL; | 182 | struct net_device *prev_dev = NULL; |
149 | struct sta_info *sta; | 183 | struct sta_info *sta, *tmp; |
150 | int retry_count = -1, i; | 184 | int retry_count = -1, i; |
151 | bool injected; | 185 | bool injected; |
152 | 186 | ||
@@ -166,9 +200,11 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
166 | 200 | ||
167 | sband = local->hw.wiphy->bands[info->band]; | 201 | sband = local->hw.wiphy->bands[info->band]; |
168 | 202 | ||
169 | sta = sta_info_get(local, hdr->addr1); | 203 | for_each_sta_info(local, hdr->addr1, sta, tmp) { |
204 | /* skip wrong virtual interface */ | ||
205 | if (memcmp(hdr->addr2, sta->sdata->vif.addr, ETH_ALEN)) | ||
206 | continue; | ||
170 | 207 | ||
171 | if (sta) { | ||
172 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && | 208 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && |
173 | test_sta_flags(sta, WLAN_STA_PS_STA)) { | 209 | test_sta_flags(sta, WLAN_STA_PS_STA)) { |
174 | /* | 210 | /* |
@@ -208,6 +244,10 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
208 | rate_control_tx_status(local, sband, sta, skb); | 244 | rate_control_tx_status(local, sband, sta, skb); |
209 | if (ieee80211_vif_is_mesh(&sta->sdata->vif)) | 245 | if (ieee80211_vif_is_mesh(&sta->sdata->vif)) |
210 | ieee80211s_update_metric(local, sta, skb); | 246 | ieee80211s_update_metric(local, sta, skb); |
247 | |||
248 | if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && | ||
249 | (info->flags & IEEE80211_TX_STAT_ACK)) | ||
250 | ieee80211_frame_acked(sta, skb); | ||
211 | } | 251 | } |
212 | 252 | ||
213 | rcu_read_unlock(); | 253 | rcu_read_unlock(); |
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c index 4921d724b6c7..b73454a507f9 100644 --- a/net/mac80211/tkip.c +++ b/net/mac80211/tkip.c | |||
@@ -100,7 +100,7 @@ static void tkip_mixing_phase1(const u8 *tk, struct tkip_ctx *ctx, | |||
100 | p1k[3] += tkipS(p1k[2] ^ get_unaligned_le16(tk + 12 + j)); | 100 | p1k[3] += tkipS(p1k[2] ^ get_unaligned_le16(tk + 12 + j)); |
101 | p1k[4] += tkipS(p1k[3] ^ get_unaligned_le16(tk + 0 + j)) + i; | 101 | p1k[4] += tkipS(p1k[3] ^ get_unaligned_le16(tk + 0 + j)) + i; |
102 | } | 102 | } |
103 | ctx->initialized = 1; | 103 | ctx->state = TKIP_STATE_PHASE1_DONE; |
104 | } | 104 | } |
105 | 105 | ||
106 | static void tkip_mixing_phase2(const u8 *tk, struct tkip_ctx *ctx, | 106 | static void tkip_mixing_phase2(const u8 *tk, struct tkip_ctx *ctx, |
@@ -183,7 +183,7 @@ void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, | |||
183 | /* Update the p1k only when the iv16 in the packet wraps around, this | 183 | /* Update the p1k only when the iv16 in the packet wraps around, this |
184 | * might occur after the wrap around of iv16 in the key in case of | 184 | * might occur after the wrap around of iv16 in the key in case of |
185 | * fragmented packets. */ | 185 | * fragmented packets. */ |
186 | if (iv16 == 0 || !ctx->initialized) | 186 | if (iv16 == 0 || ctx->state == TKIP_STATE_NOT_INIT) |
187 | tkip_mixing_phase1(tk, ctx, hdr->addr2, iv32); | 187 | tkip_mixing_phase1(tk, ctx, hdr->addr2, iv32); |
188 | 188 | ||
189 | if (type == IEEE80211_TKIP_P1_KEY) { | 189 | if (type == IEEE80211_TKIP_P1_KEY) { |
@@ -209,7 +209,7 @@ void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm, | |||
209 | const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; | 209 | const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; |
210 | 210 | ||
211 | /* Calculate per-packet key */ | 211 | /* Calculate per-packet key */ |
212 | if (ctx->iv16 == 0 || !ctx->initialized) | 212 | if (ctx->iv16 == 0 || ctx->state == TKIP_STATE_NOT_INIT) |
213 | tkip_mixing_phase1(tk, ctx, ta, ctx->iv32); | 213 | tkip_mixing_phase1(tk, ctx, ta, ctx->iv32); |
214 | 214 | ||
215 | tkip_mixing_phase2(tk, ctx, ctx->iv16, rc4key); | 215 | tkip_mixing_phase2(tk, ctx, ctx->iv16, rc4key); |
@@ -259,7 +259,7 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
259 | if ((keyid >> 6) != key->conf.keyidx) | 259 | if ((keyid >> 6) != key->conf.keyidx) |
260 | return TKIP_DECRYPT_INVALID_KEYIDX; | 260 | return TKIP_DECRYPT_INVALID_KEYIDX; |
261 | 261 | ||
262 | if (key->u.tkip.rx[queue].initialized && | 262 | if (key->u.tkip.rx[queue].state != TKIP_STATE_NOT_INIT && |
263 | (iv32 < key->u.tkip.rx[queue].iv32 || | 263 | (iv32 < key->u.tkip.rx[queue].iv32 || |
264 | (iv32 == key->u.tkip.rx[queue].iv32 && | 264 | (iv32 == key->u.tkip.rx[queue].iv32 && |
265 | iv16 <= key->u.tkip.rx[queue].iv16))) { | 265 | iv16 <= key->u.tkip.rx[queue].iv16))) { |
@@ -275,11 +275,11 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
275 | 275 | ||
276 | if (only_iv) { | 276 | if (only_iv) { |
277 | res = TKIP_DECRYPT_OK; | 277 | res = TKIP_DECRYPT_OK; |
278 | key->u.tkip.rx[queue].initialized = 1; | 278 | key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED; |
279 | goto done; | 279 | goto done; |
280 | } | 280 | } |
281 | 281 | ||
282 | if (!key->u.tkip.rx[queue].initialized || | 282 | if (key->u.tkip.rx[queue].state == TKIP_STATE_NOT_INIT || |
283 | key->u.tkip.rx[queue].iv32 != iv32) { | 283 | key->u.tkip.rx[queue].iv32 != iv32) { |
284 | /* IV16 wrapped around - perform TKIP phase 1 */ | 284 | /* IV16 wrapped around - perform TKIP phase 1 */ |
285 | tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); | 285 | tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); |
@@ -299,18 +299,20 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm, | |||
299 | printk("\n"); | 299 | printk("\n"); |
300 | } | 300 | } |
301 | #endif | 301 | #endif |
302 | if (key->local->ops->update_tkip_key && | 302 | } |
303 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { | 303 | if (key->local->ops->update_tkip_key && |
304 | static const u8 bcast[ETH_ALEN] = | 304 | key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && |
305 | {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | 305 | key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) { |
306 | const u8 *sta_addr = key->sta->sta.addr; | 306 | static const u8 bcast[ETH_ALEN] = |
307 | 307 | {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | |
308 | if (is_multicast_ether_addr(ra)) | 308 | const u8 *sta_addr = key->sta->sta.addr; |
309 | sta_addr = bcast; | 309 | |
310 | 310 | if (is_multicast_ether_addr(ra)) | |
311 | drv_update_tkip_key(key->local, &key->conf, sta_addr, | 311 | sta_addr = bcast; |
312 | iv32, key->u.tkip.rx[queue].p1k); | 312 | |
313 | } | 313 | drv_update_tkip_key(key->local, &key->conf, sta_addr, |
314 | iv32, key->u.tkip.rx[queue].p1k); | ||
315 | key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED; | ||
314 | } | 316 | } |
315 | 317 | ||
316 | tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); | 318 | tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 8834cc93c716..ac48c86ae6b3 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -223,7 +223,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
223 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 223 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
224 | printk(KERN_DEBUG "%s: dropped data frame to not " | 224 | printk(KERN_DEBUG "%s: dropped data frame to not " |
225 | "associated station %pM\n", | 225 | "associated station %pM\n", |
226 | tx->dev->name, hdr->addr1); | 226 | tx->sdata->name, hdr->addr1); |
227 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 227 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
228 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); | 228 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); |
229 | return TX_DROP; | 229 | return TX_DROP; |
@@ -331,7 +331,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) | |||
331 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 331 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
332 | if (net_ratelimit()) | 332 | if (net_ratelimit()) |
333 | printk(KERN_DEBUG "%s: BC TX buffer full - dropping the oldest frame\n", | 333 | printk(KERN_DEBUG "%s: BC TX buffer full - dropping the oldest frame\n", |
334 | tx->dev->name); | 334 | tx->sdata->name); |
335 | #endif | 335 | #endif |
336 | dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); | 336 | dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); |
337 | } else | 337 | } else |
@@ -391,7 +391,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
391 | if (net_ratelimit()) { | 391 | if (net_ratelimit()) { |
392 | printk(KERN_DEBUG "%s: STA %pM TX " | 392 | printk(KERN_DEBUG "%s: STA %pM TX " |
393 | "buffer full - dropping oldest frame\n", | 393 | "buffer full - dropping oldest frame\n", |
394 | tx->dev->name, sta->sta.addr); | 394 | tx->sdata->name, sta->sta.addr); |
395 | } | 395 | } |
396 | #endif | 396 | #endif |
397 | dev_kfree_skb(old); | 397 | dev_kfree_skb(old); |
@@ -416,7 +416,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
416 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 416 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
417 | else if (unlikely(staflags & WLAN_STA_PS_STA)) { | 417 | else if (unlikely(staflags & WLAN_STA_PS_STA)) { |
418 | printk(KERN_DEBUG "%s: STA %pM in PS mode, but pspoll " | 418 | printk(KERN_DEBUG "%s: STA %pM in PS mode, but pspoll " |
419 | "set -> send frame\n", tx->dev->name, | 419 | "set -> send frame\n", tx->sdata->name, |
420 | sta->sta.addr); | 420 | sta->sta.addr); |
421 | } | 421 | } |
422 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 422 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
@@ -549,7 +549,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
549 | "%s: Dropped data frame as no usable bitrate found while " | 549 | "%s: Dropped data frame as no usable bitrate found while " |
550 | "scanning and associated. Target station: " | 550 | "scanning and associated. Target station: " |
551 | "%pM on %d GHz band\n", | 551 | "%pM on %d GHz band\n", |
552 | tx->dev->name, hdr->addr1, | 552 | tx->sdata->name, hdr->addr1, |
553 | tx->channel->band ? 5 : 2)) | 553 | tx->channel->band ? 5 : 2)) |
554 | return TX_DROP; | 554 | return TX_DROP; |
555 | 555 | ||
@@ -1021,7 +1021,6 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1021 | 1021 | ||
1022 | memset(tx, 0, sizeof(*tx)); | 1022 | memset(tx, 0, sizeof(*tx)); |
1023 | tx->skb = skb; | 1023 | tx->skb = skb; |
1024 | tx->dev = sdata->dev; /* use original interface */ | ||
1025 | tx->local = local; | 1024 | tx->local = local; |
1026 | tx->sdata = sdata; | 1025 | tx->sdata = sdata; |
1027 | tx->channel = local->hw.conf.channel; | 1026 | tx->channel = local->hw.conf.channel; |
@@ -1055,7 +1054,7 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1055 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 1054 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
1056 | tx->sta = rcu_dereference(sdata->u.vlan.sta); | 1055 | tx->sta = rcu_dereference(sdata->u.vlan.sta); |
1057 | if (!tx->sta) | 1056 | if (!tx->sta) |
1058 | tx->sta = sta_info_get(local, hdr->addr1); | 1057 | tx->sta = sta_info_get(sdata, hdr->addr1); |
1059 | 1058 | ||
1060 | if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && | 1059 | if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && |
1061 | (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION)) { | 1060 | (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION)) { |
@@ -1474,7 +1473,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, | |||
1474 | continue; | 1473 | continue; |
1475 | if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) | 1474 | if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) |
1476 | continue; | 1475 | continue; |
1477 | if (compare_ether_addr(tmp_sdata->dev->dev_addr, | 1476 | if (compare_ether_addr(tmp_sdata->vif.addr, |
1478 | hdr->addr2) == 0) { | 1477 | hdr->addr2) == 0) { |
1479 | sdata = tmp_sdata; | 1478 | sdata = tmp_sdata; |
1480 | break; | 1479 | break; |
@@ -1638,7 +1637,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1638 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1637 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1639 | /* RA TA DA SA */ | 1638 | /* RA TA DA SA */ |
1640 | memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); | 1639 | memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); |
1641 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1640 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); |
1642 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1641 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1643 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1642 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1644 | hdrlen = 30; | 1643 | hdrlen = 30; |
@@ -1652,7 +1651,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1652 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); | 1651 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); |
1653 | /* DA BSSID SA */ | 1652 | /* DA BSSID SA */ |
1654 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1653 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
1655 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1654 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); |
1656 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); | 1655 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); |
1657 | hdrlen = 24; | 1656 | hdrlen = 24; |
1658 | break; | 1657 | break; |
@@ -1660,7 +1659,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1660 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1659 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1661 | /* RA TA DA SA */ | 1660 | /* RA TA DA SA */ |
1662 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); | 1661 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); |
1663 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1662 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); |
1664 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1663 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1665 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1664 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1666 | hdrlen = 30; | 1665 | hdrlen = 30; |
@@ -1674,8 +1673,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1674 | goto fail; | 1673 | goto fail; |
1675 | } | 1674 | } |
1676 | 1675 | ||
1677 | if (compare_ether_addr(dev->dev_addr, | 1676 | if (compare_ether_addr(sdata->vif.addr, |
1678 | skb->data + ETH_ALEN) == 0) { | 1677 | skb->data + ETH_ALEN) == 0) { |
1679 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, | 1678 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, |
1680 | skb->data, skb->data + ETH_ALEN); | 1679 | skb->data, skb->data + ETH_ALEN); |
1681 | meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, | 1680 | meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, |
@@ -1705,7 +1704,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1705 | } | 1704 | } |
1706 | } | 1705 | } |
1707 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, | 1706 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, |
1708 | mesh_da, dev->dev_addr); | 1707 | mesh_da, sdata->vif.addr); |
1709 | rcu_read_unlock(); | 1708 | rcu_read_unlock(); |
1710 | if (is_mesh_mcast) | 1709 | if (is_mesh_mcast) |
1711 | meshhdrlen = | 1710 | meshhdrlen = |
@@ -1730,7 +1729,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1730 | if (sdata->u.mgd.use_4addr && ethertype != ETH_P_PAE) { | 1729 | if (sdata->u.mgd.use_4addr && ethertype != ETH_P_PAE) { |
1731 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1730 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1732 | /* RA TA DA SA */ | 1731 | /* RA TA DA SA */ |
1733 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1732 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); |
1734 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1733 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1735 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1734 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1736 | hdrlen = 30; | 1735 | hdrlen = 30; |
@@ -1761,9 +1760,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1761 | */ | 1760 | */ |
1762 | if (!is_multicast_ether_addr(hdr.addr1)) { | 1761 | if (!is_multicast_ether_addr(hdr.addr1)) { |
1763 | rcu_read_lock(); | 1762 | rcu_read_lock(); |
1764 | sta = sta_info_get(local, hdr.addr1); | 1763 | sta = sta_info_get(sdata, hdr.addr1); |
1765 | /* XXX: in the future, use sdata to look up the sta */ | 1764 | if (sta) |
1766 | if (sta && sta->sdata == sdata) | ||
1767 | sta_flags = get_sta_flags(sta); | 1765 | sta_flags = get_sta_flags(sta); |
1768 | rcu_read_unlock(); | 1766 | rcu_read_unlock(); |
1769 | } | 1767 | } |
@@ -1782,7 +1780,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1782 | unlikely(!is_multicast_ether_addr(hdr.addr1) && | 1780 | unlikely(!is_multicast_ether_addr(hdr.addr1) && |
1783 | !(sta_flags & WLAN_STA_AUTHORIZED) && | 1781 | !(sta_flags & WLAN_STA_AUTHORIZED) && |
1784 | !(ethertype == ETH_P_PAE && | 1782 | !(ethertype == ETH_P_PAE && |
1785 | compare_ether_addr(dev->dev_addr, | 1783 | compare_ether_addr(sdata->vif.addr, |
1786 | skb->data + ETH_ALEN) == 0))) { | 1784 | skb->data + ETH_ALEN) == 0))) { |
1787 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1785 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1788 | if (net_ratelimit()) | 1786 | if (net_ratelimit()) |
@@ -1922,7 +1920,7 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local, | |||
1922 | ieee80211_tx(sdata, skb, true); | 1920 | ieee80211_tx(sdata, skb, true); |
1923 | } else { | 1921 | } else { |
1924 | hdr = (struct ieee80211_hdr *)skb->data; | 1922 | hdr = (struct ieee80211_hdr *)skb->data; |
1925 | sta = sta_info_get(local, hdr->addr1); | 1923 | sta = sta_info_get(sdata, hdr->addr1); |
1926 | 1924 | ||
1927 | ret = __ieee80211_tx(local, &skb, sta, true); | 1925 | ret = __ieee80211_tx(local, &skb, sta, true); |
1928 | if (ret != IEEE80211_TX_OK) | 1926 | if (ret != IEEE80211_TX_OK) |
@@ -2146,8 +2144,8 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2146 | mgmt->frame_control = | 2144 | mgmt->frame_control = |
2147 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); | 2145 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
2148 | memset(mgmt->da, 0xff, ETH_ALEN); | 2146 | memset(mgmt->da, 0xff, ETH_ALEN); |
2149 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 2147 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
2150 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | 2148 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); |
2151 | mgmt->u.beacon.beacon_int = | 2149 | mgmt->u.beacon.beacon_int = |
2152 | cpu_to_le16(sdata->vif.bss_conf.beacon_int); | 2150 | cpu_to_le16(sdata->vif.bss_conf.beacon_int); |
2153 | mgmt->u.beacon.capab_info = 0x0; /* 0x0 for MPs */ | 2151 | mgmt->u.beacon.capab_info = 0x0; /* 0x0 for MPs */ |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 78a6e924c7e1..b01972579c7c 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -469,7 +469,7 @@ void ieee80211_iterate_active_interfaces( | |||
469 | break; | 469 | break; |
470 | } | 470 | } |
471 | if (netif_running(sdata->dev)) | 471 | if (netif_running(sdata->dev)) |
472 | iterator(data, sdata->dev->dev_addr, | 472 | iterator(data, sdata->vif.addr, |
473 | &sdata->vif); | 473 | &sdata->vif); |
474 | } | 474 | } |
475 | 475 | ||
@@ -503,7 +503,7 @@ void ieee80211_iterate_active_interfaces_atomic( | |||
503 | break; | 503 | break; |
504 | } | 504 | } |
505 | if (netif_running(sdata->dev)) | 505 | if (netif_running(sdata->dev)) |
506 | iterator(data, sdata->dev->dev_addr, | 506 | iterator(data, sdata->vif.addr, |
507 | &sdata->vif); | 507 | &sdata->vif); |
508 | } | 508 | } |
509 | 509 | ||
@@ -848,7 +848,7 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, | |||
848 | sizeof(*mgmt) + 6 + extra_len); | 848 | sizeof(*mgmt) + 6 + extra_len); |
849 | if (!skb) { | 849 | if (!skb) { |
850 | printk(KERN_DEBUG "%s: failed to allocate buffer for auth " | 850 | printk(KERN_DEBUG "%s: failed to allocate buffer for auth " |
851 | "frame\n", sdata->dev->name); | 851 | "frame\n", sdata->name); |
852 | return; | 852 | return; |
853 | } | 853 | } |
854 | skb_reserve(skb, local->hw.extra_tx_headroom); | 854 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -858,7 +858,7 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, | |||
858 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 858 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
859 | IEEE80211_STYPE_AUTH); | 859 | IEEE80211_STYPE_AUTH); |
860 | memcpy(mgmt->da, bssid, ETH_ALEN); | 860 | memcpy(mgmt->da, bssid, ETH_ALEN); |
861 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 861 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
862 | memcpy(mgmt->bssid, bssid, ETH_ALEN); | 862 | memcpy(mgmt->bssid, bssid, ETH_ALEN); |
863 | mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); | 863 | mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); |
864 | mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); | 864 | mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); |
@@ -908,16 +908,24 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, | |||
908 | } | 908 | } |
909 | 909 | ||
910 | if (sband->ht_cap.ht_supported) { | 910 | if (sband->ht_cap.ht_supported) { |
911 | __le16 tmp = cpu_to_le16(sband->ht_cap.cap); | 911 | u16 cap = sband->ht_cap.cap; |
912 | __le16 tmp; | ||
913 | |||
914 | if (ieee80211_disable_40mhz_24ghz && | ||
915 | sband->band == IEEE80211_BAND_2GHZ) { | ||
916 | cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; | ||
917 | cap &= ~IEEE80211_HT_CAP_SGI_40; | ||
918 | } | ||
912 | 919 | ||
913 | *pos++ = WLAN_EID_HT_CAPABILITY; | 920 | *pos++ = WLAN_EID_HT_CAPABILITY; |
914 | *pos++ = sizeof(struct ieee80211_ht_cap); | 921 | *pos++ = sizeof(struct ieee80211_ht_cap); |
915 | memset(pos, 0, sizeof(struct ieee80211_ht_cap)); | 922 | memset(pos, 0, sizeof(struct ieee80211_ht_cap)); |
923 | tmp = cpu_to_le16(cap); | ||
916 | memcpy(pos, &tmp, sizeof(u16)); | 924 | memcpy(pos, &tmp, sizeof(u16)); |
917 | pos += sizeof(u16); | 925 | pos += sizeof(u16); |
918 | /* TODO: needs a define here for << 2 */ | ||
919 | *pos++ = sband->ht_cap.ampdu_factor | | 926 | *pos++ = sband->ht_cap.ampdu_factor | |
920 | (sband->ht_cap.ampdu_density << 2); | 927 | (sband->ht_cap.ampdu_density << |
928 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); | ||
921 | memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs)); | 929 | memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs)); |
922 | pos += sizeof(sband->ht_cap.mcs); | 930 | pos += sizeof(sband->ht_cap.mcs); |
923 | pos += 2 + 4 + 1; /* ext info, BF cap, antsel */ | 931 | pos += 2 + 4 + 1; /* ext info, BF cap, antsel */ |
@@ -949,7 +957,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | |||
949 | ie_len); | 957 | ie_len); |
950 | if (!skb) { | 958 | if (!skb) { |
951 | printk(KERN_DEBUG "%s: failed to allocate buffer for probe " | 959 | printk(KERN_DEBUG "%s: failed to allocate buffer for probe " |
952 | "request\n", sdata->dev->name); | 960 | "request\n", sdata->name); |
953 | return; | 961 | return; |
954 | } | 962 | } |
955 | skb_reserve(skb, local->hw.extra_tx_headroom); | 963 | skb_reserve(skb, local->hw.extra_tx_headroom); |
@@ -958,7 +966,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | |||
958 | memset(mgmt, 0, 24); | 966 | memset(mgmt, 0, 24); |
959 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 967 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
960 | IEEE80211_STYPE_PROBE_REQ); | 968 | IEEE80211_STYPE_PROBE_REQ); |
961 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 969 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
962 | if (dst) { | 970 | if (dst) { |
963 | memcpy(mgmt->da, dst, ETH_ALEN); | 971 | memcpy(mgmt->da, dst, ETH_ALEN); |
964 | memcpy(mgmt->bssid, dst, ETH_ALEN); | 972 | memcpy(mgmt->bssid, dst, ETH_ALEN); |
@@ -1051,7 +1059,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1051 | netif_running(sdata->dev)) { | 1059 | netif_running(sdata->dev)) { |
1052 | conf.vif = &sdata->vif; | 1060 | conf.vif = &sdata->vif; |
1053 | conf.type = sdata->vif.type; | 1061 | conf.type = sdata->vif.type; |
1054 | conf.mac_addr = sdata->dev->dev_addr; | 1062 | conf.mac_addr = sdata->vif.addr; |
1055 | res = drv_add_interface(local, &conf); | 1063 | res = drv_add_interface(local, &conf); |
1056 | } | 1064 | } |
1057 | } | 1065 | } |
@@ -1066,7 +1074,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1066 | struct ieee80211_sub_if_data, | 1074 | struct ieee80211_sub_if_data, |
1067 | u.ap); | 1075 | u.ap); |
1068 | 1076 | ||
1069 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, | 1077 | drv_sta_notify(local, sdata, STA_NOTIFY_ADD, |
1070 | &sta->sta); | 1078 | &sta->sta); |
1071 | } | 1079 | } |
1072 | spin_unlock_irqrestore(&local->sta_lock, flags); | 1080 | spin_unlock_irqrestore(&local->sta_lock, flags); |
@@ -1170,3 +1178,77 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1170 | return 0; | 1178 | return 0; |
1171 | } | 1179 | } |
1172 | 1180 | ||
1181 | static int check_mgd_smps(struct ieee80211_if_managed *ifmgd, | ||
1182 | enum ieee80211_smps_mode *smps_mode) | ||
1183 | { | ||
1184 | if (ifmgd->associated) { | ||
1185 | *smps_mode = ifmgd->ap_smps; | ||
1186 | |||
1187 | if (*smps_mode == IEEE80211_SMPS_AUTOMATIC) { | ||
1188 | if (ifmgd->powersave) | ||
1189 | *smps_mode = IEEE80211_SMPS_DYNAMIC; | ||
1190 | else | ||
1191 | *smps_mode = IEEE80211_SMPS_OFF; | ||
1192 | } | ||
1193 | |||
1194 | return 1; | ||
1195 | } | ||
1196 | |||
1197 | return 0; | ||
1198 | } | ||
1199 | |||
1200 | /* must hold iflist_mtx */ | ||
1201 | void ieee80211_recalc_smps(struct ieee80211_local *local, | ||
1202 | struct ieee80211_sub_if_data *forsdata) | ||
1203 | { | ||
1204 | struct ieee80211_sub_if_data *sdata; | ||
1205 | enum ieee80211_smps_mode smps_mode = IEEE80211_SMPS_OFF; | ||
1206 | int count = 0; | ||
1207 | |||
1208 | if (forsdata) | ||
1209 | WARN_ON(!mutex_is_locked(&forsdata->u.mgd.mtx)); | ||
1210 | |||
1211 | WARN_ON(!mutex_is_locked(&local->iflist_mtx)); | ||
1212 | |||
1213 | /* | ||
1214 | * This function could be improved to handle multiple | ||
1215 | * interfaces better, but right now it makes any | ||
1216 | * non-station interfaces force SM PS to be turned | ||
1217 | * off. If there are multiple station interfaces it | ||
1218 | * could also use the best possible mode, e.g. if | ||
1219 | * one is in static and the other in dynamic then | ||
1220 | * dynamic is ok. | ||
1221 | */ | ||
1222 | |||
1223 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
1224 | if (!netif_running(sdata->dev)) | ||
1225 | continue; | ||
1226 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | ||
1227 | goto set; | ||
1228 | if (sdata != forsdata) { | ||
1229 | /* | ||
1230 | * This nested is ok -- we are holding the iflist_mtx | ||
1231 | * so can't get here twice or so. But it's required | ||
1232 | * since normally we acquire it first and then the | ||
1233 | * iflist_mtx. | ||
1234 | */ | ||
1235 | mutex_lock_nested(&sdata->u.mgd.mtx, SINGLE_DEPTH_NESTING); | ||
1236 | count += check_mgd_smps(&sdata->u.mgd, &smps_mode); | ||
1237 | mutex_unlock(&sdata->u.mgd.mtx); | ||
1238 | } else | ||
1239 | count += check_mgd_smps(&sdata->u.mgd, &smps_mode); | ||
1240 | |||
1241 | if (count > 1) { | ||
1242 | smps_mode = IEEE80211_SMPS_OFF; | ||
1243 | break; | ||
1244 | } | ||
1245 | } | ||
1246 | |||
1247 | if (smps_mode == local->smps_mode) | ||
1248 | return; | ||
1249 | |||
1250 | set: | ||
1251 | local->smps_mode = smps_mode; | ||
1252 | /* changed flag is auto-detected for this */ | ||
1253 | ieee80211_hw_config(local, 0); | ||
1254 | } | ||