diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-08-21 16:00:21 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-08-21 16:00:21 -0400 |
commit | 01e17dacd47101ad7d33152bbfbbd4394352d2e6 (patch) | |
tree | d94706b87fcad04d08a46a9b3555396d21ab41ec /net/mac80211 | |
parent | 22c5649eef0fc37532e20c14d2656b28ca708a69 (diff) | |
parent | dcf33963c48e1959c83fda84e336dbb000eefa3f (diff) |
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
Conflicts:
drivers/net/wireless/mac80211_hwsim.c
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/aes_cmac.c | 6 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 68 | ||||
-rw-r--r-- | net/mac80211/debugfs.c | 32 | ||||
-rw-r--r-- | net/mac80211/driver-ops.h | 11 | ||||
-rw-r--r-- | net/mac80211/ibss.c | 15 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 30 | ||||
-rw-r--r-- | net/mac80211/iface.c | 289 | ||||
-rw-r--r-- | net/mac80211/main.c | 21 | ||||
-rw-r--r-- | net/mac80211/mesh.c | 28 | ||||
-rw-r--r-- | net/mac80211/mesh.h | 3 | ||||
-rw-r--r-- | net/mac80211/mesh_hwmp.c | 2 | ||||
-rw-r--r-- | net/mac80211/mesh_pathtbl.c | 44 | ||||
-rw-r--r-- | net/mac80211/mesh_plink.c | 38 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 240 | ||||
-rw-r--r-- | net/mac80211/offchannel.c | 6 | ||||
-rw-r--r-- | net/mac80211/rate.h | 2 | ||||
-rw-r--r-- | net/mac80211/rx.c | 58 | ||||
-rw-r--r-- | net/mac80211/scan.c | 12 | ||||
-rw-r--r-- | net/mac80211/status.c | 22 | ||||
-rw-r--r-- | net/mac80211/trace.h | 11 | ||||
-rw-r--r-- | net/mac80211/tx.c | 71 | ||||
-rw-r--r-- | net/mac80211/util.c | 57 |
22 files changed, 657 insertions, 409 deletions
diff --git a/net/mac80211/aes_cmac.c b/net/mac80211/aes_cmac.c index 8dfd70d8fcfb..a04752e91023 100644 --- a/net/mac80211/aes_cmac.c +++ b/net/mac80211/aes_cmac.c | |||
@@ -38,14 +38,10 @@ static void gf_mulx(u8 *pad) | |||
38 | static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem, | 38 | static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem, |
39 | const u8 *addr[], const size_t *len, u8 *mac) | 39 | const u8 *addr[], const size_t *len, u8 *mac) |
40 | { | 40 | { |
41 | u8 scratch[2 * AES_BLOCK_SIZE]; | 41 | u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE]; |
42 | u8 *cbc, *pad; | ||
43 | const u8 *pos, *end; | 42 | const u8 *pos, *end; |
44 | size_t i, e, left, total_len; | 43 | size_t i, e, left, total_len; |
45 | 44 | ||
46 | cbc = scratch; | ||
47 | pad = scratch + AES_BLOCK_SIZE; | ||
48 | |||
49 | memset(cbc, 0, AES_BLOCK_SIZE); | 45 | memset(cbc, 0, AES_BLOCK_SIZE); |
50 | 46 | ||
51 | total_len = 0; | 47 | total_len = 0; |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index d41974aacf51..69b322f6ca2e 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -102,6 +102,18 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
104 | 104 | ||
105 | static int ieee80211_start_p2p_device(struct wiphy *wiphy, | ||
106 | struct wireless_dev *wdev) | ||
107 | { | ||
108 | return ieee80211_do_open(wdev, true); | ||
109 | } | ||
110 | |||
111 | static void ieee80211_stop_p2p_device(struct wiphy *wiphy, | ||
112 | struct wireless_dev *wdev) | ||
113 | { | ||
114 | ieee80211_sdata_stop(IEEE80211_WDEV_TO_SUB_IF(wdev)); | ||
115 | } | ||
116 | |||
105 | static int ieee80211_set_noack_map(struct wiphy *wiphy, | 117 | static int ieee80211_set_noack_map(struct wiphy *wiphy, |
106 | struct net_device *dev, | 118 | struct net_device *dev, |
107 | u16 noack_map) | 119 | u16 noack_map) |
@@ -330,7 +342,7 @@ static void rate_idx_to_bitrate(struct rate_info *rate, struct sta_info *sta, in | |||
330 | if (!(rate->flags & RATE_INFO_FLAGS_MCS)) { | 342 | if (!(rate->flags & RATE_INFO_FLAGS_MCS)) { |
331 | struct ieee80211_supported_band *sband; | 343 | struct ieee80211_supported_band *sband; |
332 | sband = sta->local->hw.wiphy->bands[ | 344 | sband = sta->local->hw.wiphy->bands[ |
333 | sta->local->hw.conf.channel->band]; | 345 | sta->local->oper_channel->band]; |
334 | rate->legacy = sband->bitrates[idx].bitrate; | 346 | rate->legacy = sband->bitrates[idx].bitrate; |
335 | } else | 347 | } else |
336 | rate->mcs = idx; | 348 | rate->mcs = idx; |
@@ -725,25 +737,23 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy, | |||
725 | static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, | 737 | static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, |
726 | const u8 *resp, size_t resp_len) | 738 | const u8 *resp, size_t resp_len) |
727 | { | 739 | { |
728 | struct sk_buff *new, *old; | 740 | struct probe_resp *new, *old; |
729 | 741 | ||
730 | if (!resp || !resp_len) | 742 | if (!resp || !resp_len) |
731 | return 1; | 743 | return -EINVAL; |
732 | 744 | ||
733 | old = rtnl_dereference(sdata->u.ap.probe_resp); | 745 | old = rtnl_dereference(sdata->u.ap.probe_resp); |
734 | 746 | ||
735 | new = dev_alloc_skb(resp_len); | 747 | new = kzalloc(sizeof(struct probe_resp) + resp_len, GFP_KERNEL); |
736 | if (!new) | 748 | if (!new) |
737 | return -ENOMEM; | 749 | return -ENOMEM; |
738 | 750 | ||
739 | memcpy(skb_put(new, resp_len), resp, resp_len); | 751 | new->len = resp_len; |
752 | memcpy(new->data, resp, resp_len); | ||
740 | 753 | ||
741 | rcu_assign_pointer(sdata->u.ap.probe_resp, new); | 754 | rcu_assign_pointer(sdata->u.ap.probe_resp, new); |
742 | if (old) { | 755 | if (old) |
743 | /* TODO: use call_rcu() */ | 756 | kfree_rcu(old, rcu_head); |
744 | synchronize_rcu(); | ||
745 | dev_kfree_skb(old); | ||
746 | } | ||
747 | 757 | ||
748 | return 0; | 758 | return 0; |
749 | } | 759 | } |
@@ -950,7 +960,7 @@ static void ieee80211_send_layer2_update(struct sta_info *sta) | |||
950 | /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) | 960 | /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) |
951 | * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ | 961 | * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ |
952 | 962 | ||
953 | memset(msg->da, 0xff, ETH_ALEN); | 963 | eth_broadcast_addr(msg->da); |
954 | memcpy(msg->sa, sta->sta.addr, ETH_ALEN); | 964 | memcpy(msg->sa, sta->sta.addr, ETH_ALEN); |
955 | msg->len = htons(6); | 965 | msg->len = htons(6); |
956 | msg->dsap = 0; | 966 | msg->dsap = 0; |
@@ -1285,9 +1295,10 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
1285 | mutex_unlock(&local->sta_mtx); | 1295 | mutex_unlock(&local->sta_mtx); |
1286 | 1296 | ||
1287 | if (sdata->vif.type == NL80211_IFTYPE_STATION && | 1297 | if (sdata->vif.type == NL80211_IFTYPE_STATION && |
1288 | params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) | 1298 | params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) { |
1289 | ieee80211_recalc_ps(local, -1); | 1299 | ieee80211_recalc_ps(local, -1); |
1290 | 1300 | ieee80211_recalc_ps_vif(sdata); | |
1301 | } | ||
1291 | return 0; | 1302 | return 0; |
1292 | } | 1303 | } |
1293 | 1304 | ||
@@ -1661,7 +1672,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy, | |||
1661 | } | 1672 | } |
1662 | 1673 | ||
1663 | if (!sdata->vif.bss_conf.use_short_slot && | 1674 | if (!sdata->vif.bss_conf.use_short_slot && |
1664 | sdata->local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) { | 1675 | sdata->local->oper_channel->band == IEEE80211_BAND_5GHZ) { |
1665 | sdata->vif.bss_conf.use_short_slot = true; | 1676 | sdata->vif.bss_conf.use_short_slot = true; |
1666 | changed |= BSS_CHANGED_ERP_SLOT; | 1677 | changed |= BSS_CHANGED_ERP_SLOT; |
1667 | } | 1678 | } |
@@ -1775,6 +1786,7 @@ static int ieee80211_scan(struct wiphy *wiphy, | |||
1775 | case NL80211_IFTYPE_ADHOC: | 1786 | case NL80211_IFTYPE_ADHOC: |
1776 | case NL80211_IFTYPE_MESH_POINT: | 1787 | case NL80211_IFTYPE_MESH_POINT: |
1777 | case NL80211_IFTYPE_P2P_CLIENT: | 1788 | case NL80211_IFTYPE_P2P_CLIENT: |
1789 | case NL80211_IFTYPE_P2P_DEVICE: | ||
1778 | break; | 1790 | break; |
1779 | case NL80211_IFTYPE_P2P_GO: | 1791 | case NL80211_IFTYPE_P2P_GO: |
1780 | if (sdata->local->ops->hw_scan) | 1792 | if (sdata->local->ops->hw_scan) |
@@ -1927,7 +1939,7 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, | |||
1927 | enum nl80211_tx_power_setting type, int mbm) | 1939 | enum nl80211_tx_power_setting type, int mbm) |
1928 | { | 1940 | { |
1929 | struct ieee80211_local *local = wiphy_priv(wiphy); | 1941 | struct ieee80211_local *local = wiphy_priv(wiphy); |
1930 | struct ieee80211_channel *chan = local->hw.conf.channel; | 1942 | struct ieee80211_channel *chan = local->oper_channel; |
1931 | u32 changes = 0; | 1943 | u32 changes = 0; |
1932 | 1944 | ||
1933 | switch (type) { | 1945 | switch (type) { |
@@ -2079,6 +2091,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
2079 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); | 2091 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
2080 | 2092 | ||
2081 | ieee80211_recalc_ps(local, -1); | 2093 | ieee80211_recalc_ps(local, -1); |
2094 | ieee80211_recalc_ps_vif(sdata); | ||
2082 | 2095 | ||
2083 | return 0; | 2096 | return 0; |
2084 | } | 2097 | } |
@@ -2461,6 +2474,9 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
2461 | if (!sdata->u.mgd.associated) | 2474 | if (!sdata->u.mgd.associated) |
2462 | need_offchan = true; | 2475 | need_offchan = true; |
2463 | break; | 2476 | break; |
2477 | case NL80211_IFTYPE_P2P_DEVICE: | ||
2478 | need_offchan = true; | ||
2479 | break; | ||
2464 | default: | 2480 | default: |
2465 | return -EOPNOTSUPP; | 2481 | return -EOPNOTSUPP; |
2466 | } | 2482 | } |
@@ -2653,6 +2669,7 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, | |||
2653 | u16 status_code, struct sk_buff *skb) | 2669 | u16 status_code, struct sk_buff *skb) |
2654 | { | 2670 | { |
2655 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2671 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2672 | struct ieee80211_local *local = sdata->local; | ||
2656 | struct ieee80211_tdls_data *tf; | 2673 | struct ieee80211_tdls_data *tf; |
2657 | 2674 | ||
2658 | tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); | 2675 | tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); |
@@ -2672,8 +2689,10 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, | |||
2672 | tf->u.setup_req.capability = | 2689 | tf->u.setup_req.capability = |
2673 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); | 2690 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); |
2674 | 2691 | ||
2675 | ieee80211_add_srates_ie(sdata, skb, false); | 2692 | ieee80211_add_srates_ie(sdata, skb, false, |
2676 | ieee80211_add_ext_srates_ie(sdata, skb, false); | 2693 | local->oper_channel->band); |
2694 | ieee80211_add_ext_srates_ie(sdata, skb, false, | ||
2695 | local->oper_channel->band); | ||
2677 | ieee80211_tdls_add_ext_capab(skb); | 2696 | ieee80211_tdls_add_ext_capab(skb); |
2678 | break; | 2697 | break; |
2679 | case WLAN_TDLS_SETUP_RESPONSE: | 2698 | case WLAN_TDLS_SETUP_RESPONSE: |
@@ -2686,8 +2705,10 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, | |||
2686 | tf->u.setup_resp.capability = | 2705 | tf->u.setup_resp.capability = |
2687 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); | 2706 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); |
2688 | 2707 | ||
2689 | ieee80211_add_srates_ie(sdata, skb, false); | 2708 | ieee80211_add_srates_ie(sdata, skb, false, |
2690 | ieee80211_add_ext_srates_ie(sdata, skb, false); | 2709 | local->oper_channel->band); |
2710 | ieee80211_add_ext_srates_ie(sdata, skb, false, | ||
2711 | local->oper_channel->band); | ||
2691 | ieee80211_tdls_add_ext_capab(skb); | 2712 | ieee80211_tdls_add_ext_capab(skb); |
2692 | break; | 2713 | break; |
2693 | case WLAN_TDLS_SETUP_CONFIRM: | 2714 | case WLAN_TDLS_SETUP_CONFIRM: |
@@ -2725,6 +2746,7 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, | |||
2725 | u16 status_code, struct sk_buff *skb) | 2746 | u16 status_code, struct sk_buff *skb) |
2726 | { | 2747 | { |
2727 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2748 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2749 | struct ieee80211_local *local = sdata->local; | ||
2728 | struct ieee80211_mgmt *mgmt; | 2750 | struct ieee80211_mgmt *mgmt; |
2729 | 2751 | ||
2730 | mgmt = (void *)skb_put(skb, 24); | 2752 | mgmt = (void *)skb_put(skb, 24); |
@@ -2747,8 +2769,10 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, | |||
2747 | mgmt->u.action.u.tdls_discover_resp.capability = | 2769 | mgmt->u.action.u.tdls_discover_resp.capability = |
2748 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); | 2770 | cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); |
2749 | 2771 | ||
2750 | ieee80211_add_srates_ie(sdata, skb, false); | 2772 | ieee80211_add_srates_ie(sdata, skb, false, |
2751 | ieee80211_add_ext_srates_ie(sdata, skb, false); | 2773 | local->oper_channel->band); |
2774 | ieee80211_add_ext_srates_ie(sdata, skb, false, | ||
2775 | local->oper_channel->band); | ||
2752 | ieee80211_tdls_add_ext_capab(skb); | 2776 | ieee80211_tdls_add_ext_capab(skb); |
2753 | break; | 2777 | break; |
2754 | default: | 2778 | default: |
@@ -3005,6 +3029,8 @@ struct cfg80211_ops mac80211_config_ops = { | |||
3005 | .add_virtual_intf = ieee80211_add_iface, | 3029 | .add_virtual_intf = ieee80211_add_iface, |
3006 | .del_virtual_intf = ieee80211_del_iface, | 3030 | .del_virtual_intf = ieee80211_del_iface, |
3007 | .change_virtual_intf = ieee80211_change_iface, | 3031 | .change_virtual_intf = ieee80211_change_iface, |
3032 | .start_p2p_device = ieee80211_start_p2p_device, | ||
3033 | .stop_p2p_device = ieee80211_stop_p2p_device, | ||
3008 | .add_key = ieee80211_add_key, | 3034 | .add_key = ieee80211_add_key, |
3009 | .del_key = ieee80211_del_key, | 3035 | .del_key = ieee80211_del_key, |
3010 | .get_key = ieee80211_get_key, | 3036 | .get_key = ieee80211_get_key, |
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index b8dfb440c8ef..97173f8144d4 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -63,8 +63,6 @@ DEBUGFS_READONLY_FILE(user_power, "%d", | |||
63 | local->user_power_level); | 63 | local->user_power_level); |
64 | DEBUGFS_READONLY_FILE(power, "%d", | 64 | DEBUGFS_READONLY_FILE(power, "%d", |
65 | local->hw.conf.power_level); | 65 | local->hw.conf.power_level); |
66 | DEBUGFS_READONLY_FILE(frequency, "%d", | ||
67 | local->hw.conf.channel->center_freq); | ||
68 | DEBUGFS_READONLY_FILE(total_ps_buffered, "%d", | 66 | DEBUGFS_READONLY_FILE(total_ps_buffered, "%d", |
69 | local->total_ps_buffered); | 67 | local->total_ps_buffered); |
70 | DEBUGFS_READONLY_FILE(wep_iv, "%#08x", | 68 | DEBUGFS_READONLY_FILE(wep_iv, "%#08x", |
@@ -91,33 +89,6 @@ static const struct file_operations reset_ops = { | |||
91 | .llseek = noop_llseek, | 89 | .llseek = noop_llseek, |
92 | }; | 90 | }; |
93 | 91 | ||
94 | static ssize_t channel_type_read(struct file *file, char __user *user_buf, | ||
95 | size_t count, loff_t *ppos) | ||
96 | { | ||
97 | struct ieee80211_local *local = file->private_data; | ||
98 | const char *buf; | ||
99 | |||
100 | switch (local->hw.conf.channel_type) { | ||
101 | case NL80211_CHAN_NO_HT: | ||
102 | buf = "no ht\n"; | ||
103 | break; | ||
104 | case NL80211_CHAN_HT20: | ||
105 | buf = "ht20\n"; | ||
106 | break; | ||
107 | case NL80211_CHAN_HT40MINUS: | ||
108 | buf = "ht40-\n"; | ||
109 | break; | ||
110 | case NL80211_CHAN_HT40PLUS: | ||
111 | buf = "ht40+\n"; | ||
112 | break; | ||
113 | default: | ||
114 | buf = "???"; | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); | ||
119 | } | ||
120 | |||
121 | static ssize_t hwflags_read(struct file *file, char __user *user_buf, | 92 | static ssize_t hwflags_read(struct file *file, char __user *user_buf, |
122 | size_t count, loff_t *ppos) | 93 | size_t count, loff_t *ppos) |
123 | { | 94 | { |
@@ -205,7 +176,6 @@ static ssize_t queues_read(struct file *file, char __user *user_buf, | |||
205 | } | 176 | } |
206 | 177 | ||
207 | DEBUGFS_READONLY_FILE_OPS(hwflags); | 178 | DEBUGFS_READONLY_FILE_OPS(hwflags); |
208 | DEBUGFS_READONLY_FILE_OPS(channel_type); | ||
209 | DEBUGFS_READONLY_FILE_OPS(queues); | 179 | DEBUGFS_READONLY_FILE_OPS(queues); |
210 | 180 | ||
211 | /* statistics stuff */ | 181 | /* statistics stuff */ |
@@ -272,12 +242,10 @@ void debugfs_hw_add(struct ieee80211_local *local) | |||
272 | 242 | ||
273 | local->debugfs.keys = debugfs_create_dir("keys", phyd); | 243 | local->debugfs.keys = debugfs_create_dir("keys", phyd); |
274 | 244 | ||
275 | DEBUGFS_ADD(frequency); | ||
276 | DEBUGFS_ADD(total_ps_buffered); | 245 | DEBUGFS_ADD(total_ps_buffered); |
277 | DEBUGFS_ADD(wep_iv); | 246 | DEBUGFS_ADD(wep_iv); |
278 | DEBUGFS_ADD(queues); | 247 | DEBUGFS_ADD(queues); |
279 | DEBUGFS_ADD_MODE(reset, 0200); | 248 | DEBUGFS_ADD_MODE(reset, 0200); |
280 | DEBUGFS_ADD(channel_type); | ||
281 | DEBUGFS_ADD(hwflags); | 249 | DEBUGFS_ADD(hwflags); |
282 | DEBUGFS_ADD(user_power); | 250 | DEBUGFS_ADD(user_power); |
283 | DEBUGFS_ADD(power); | 251 | DEBUGFS_ADD(power); |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index df9203199102..da9003b20004 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -9,7 +9,7 @@ static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) | |||
9 | { | 9 | { |
10 | WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), | 10 | WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), |
11 | "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", | 11 | "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", |
12 | sdata->dev->name, sdata->flags); | 12 | sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); |
13 | } | 13 | } |
14 | 14 | ||
15 | static inline struct ieee80211_sub_if_data * | 15 | static inline struct ieee80211_sub_if_data * |
@@ -22,9 +22,11 @@ get_bss_sdata(struct ieee80211_sub_if_data *sdata) | |||
22 | return sdata; | 22 | return sdata; |
23 | } | 23 | } |
24 | 24 | ||
25 | static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) | 25 | static inline void drv_tx(struct ieee80211_local *local, |
26 | struct ieee80211_tx_control *control, | ||
27 | struct sk_buff *skb) | ||
26 | { | 28 | { |
27 | local->ops->tx(&local->hw, skb); | 29 | local->ops->tx(&local->hw, control, skb); |
28 | } | 30 | } |
29 | 31 | ||
30 | static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata, | 32 | static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata, |
@@ -526,6 +528,9 @@ static inline void drv_sta_rc_update(struct ieee80211_local *local, | |||
526 | sdata = get_bss_sdata(sdata); | 528 | sdata = get_bss_sdata(sdata); |
527 | check_sdata_in_driver(sdata); | 529 | check_sdata_in_driver(sdata); |
528 | 530 | ||
531 | WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED && | ||
532 | sdata->vif.type != NL80211_IFTYPE_ADHOC); | ||
533 | |||
529 | trace_drv_sta_rc_update(local, sdata, sta, changed); | 534 | trace_drv_sta_rc_update(local, sdata, sta, changed); |
530 | if (local->ops->sta_rc_update) | 535 | if (local->ops->sta_rc_update) |
531 | local->ops->sta_rc_update(&local->hw, &sdata->vif, | 536 | local->ops->sta_rc_update(&local->hw, &sdata->vif, |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 5746d62faba1..a9d93285dba7 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -109,7 +109,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
109 | memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); | 109 | memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); |
110 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 110 | mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
111 | IEEE80211_STYPE_PROBE_RESP); | 111 | IEEE80211_STYPE_PROBE_RESP); |
112 | memset(mgmt->da, 0xff, ETH_ALEN); | 112 | eth_broadcast_addr(mgmt->da); |
113 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); | 113 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
114 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); | 114 | memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); |
115 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); | 115 | mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); |
@@ -205,7 +205,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
205 | mod_timer(&ifibss->timer, | 205 | mod_timer(&ifibss->timer, |
206 | round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); | 206 | round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); |
207 | 207 | ||
208 | bss = cfg80211_inform_bss_frame(local->hw.wiphy, local->hw.conf.channel, | 208 | bss = cfg80211_inform_bss_frame(local->hw.wiphy, chan, |
209 | mgmt, skb->len, 0, GFP_KERNEL); | 209 | mgmt, skb->len, 0, GFP_KERNEL); |
210 | cfg80211_put_bss(bss); | 210 | cfg80211_put_bss(bss); |
211 | netif_carrier_on(sdata->dev); | 211 | netif_carrier_on(sdata->dev); |
@@ -294,7 +294,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
294 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | 294 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; |
295 | struct ieee80211_local *local = sdata->local; | 295 | struct ieee80211_local *local = sdata->local; |
296 | struct sta_info *sta; | 296 | struct sta_info *sta; |
297 | int band = local->hw.conf.channel->band; | 297 | int band = local->oper_channel->band; |
298 | 298 | ||
299 | /* | 299 | /* |
300 | * XXX: Consider removing the least recently used entry and | 300 | * XXX: Consider removing the least recently used entry and |
@@ -459,8 +459,11 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||
462 | if (sta && rates_updated) | 462 | if (sta && rates_updated) { |
463 | drv_sta_rc_update(local, sdata, &sta->sta, | ||
464 | IEEE80211_RC_SUPP_RATES_CHANGED); | ||
463 | rate_control_rate_init(sta); | 465 | rate_control_rate_init(sta); |
466 | } | ||
464 | 467 | ||
465 | rcu_read_unlock(); | 468 | rcu_read_unlock(); |
466 | } | 469 | } |
@@ -561,7 +564,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, | |||
561 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; | 564 | struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; |
562 | struct ieee80211_local *local = sdata->local; | 565 | struct ieee80211_local *local = sdata->local; |
563 | struct sta_info *sta; | 566 | struct sta_info *sta; |
564 | int band = local->hw.conf.channel->band; | 567 | int band = local->oper_channel->band; |
565 | 568 | ||
566 | /* | 569 | /* |
567 | * XXX: Consider removing the least recently used entry and | 570 | * XXX: Consider removing the least recently used entry and |
@@ -759,7 +762,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
759 | return; | 762 | return; |
760 | } | 763 | } |
761 | sdata_info(sdata, "IBSS not allowed on %d MHz\n", | 764 | sdata_info(sdata, "IBSS not allowed on %d MHz\n", |
762 | local->hw.conf.channel->center_freq); | 765 | local->oper_channel->center_freq); |
763 | 766 | ||
764 | /* No IBSS found - decrease scan interval and continue | 767 | /* No IBSS found - decrease scan interval and continue |
765 | * scanning. */ | 768 | * scanning. */ |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index bb61f7718c4c..204bfedba306 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -193,8 +193,6 @@ struct ieee80211_tx_data { | |||
193 | struct sta_info *sta; | 193 | struct sta_info *sta; |
194 | struct ieee80211_key *key; | 194 | struct ieee80211_key *key; |
195 | 195 | ||
196 | struct ieee80211_channel *channel; | ||
197 | |||
198 | unsigned int flags; | 196 | unsigned int flags; |
199 | }; | 197 | }; |
200 | 198 | ||
@@ -274,9 +272,15 @@ struct beacon_data { | |||
274 | struct rcu_head rcu_head; | 272 | struct rcu_head rcu_head; |
275 | }; | 273 | }; |
276 | 274 | ||
275 | struct probe_resp { | ||
276 | struct rcu_head rcu_head; | ||
277 | int len; | ||
278 | u8 data[0]; | ||
279 | }; | ||
280 | |||
277 | struct ieee80211_if_ap { | 281 | struct ieee80211_if_ap { |
278 | struct beacon_data __rcu *beacon; | 282 | struct beacon_data __rcu *beacon; |
279 | struct sk_buff __rcu *probe_resp; | 283 | struct probe_resp __rcu *probe_resp; |
280 | 284 | ||
281 | struct list_head vlans; | 285 | struct list_head vlans; |
282 | 286 | ||
@@ -359,6 +363,7 @@ enum ieee80211_sta_flags { | |||
359 | IEEE80211_STA_NULLFUNC_ACKED = BIT(8), | 363 | IEEE80211_STA_NULLFUNC_ACKED = BIT(8), |
360 | IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), | 364 | IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), |
361 | IEEE80211_STA_DISABLE_40MHZ = BIT(10), | 365 | IEEE80211_STA_DISABLE_40MHZ = BIT(10), |
366 | IEEE80211_STA_DISABLE_VHT = BIT(11), | ||
362 | }; | 367 | }; |
363 | 368 | ||
364 | struct ieee80211_mgd_auth_data { | 369 | struct ieee80211_mgd_auth_data { |
@@ -1075,6 +1080,8 @@ struct ieee80211_local { | |||
1075 | struct idr ack_status_frames; | 1080 | struct idr ack_status_frames; |
1076 | spinlock_t ack_status_lock; | 1081 | spinlock_t ack_status_lock; |
1077 | 1082 | ||
1083 | struct ieee80211_sub_if_data __rcu *p2p_sdata; | ||
1084 | |||
1078 | /* dummy netdev for use w/ NAPI */ | 1085 | /* dummy netdev for use w/ NAPI */ |
1079 | struct net_device napi_dev; | 1086 | struct net_device napi_dev; |
1080 | 1087 | ||
@@ -1131,7 +1138,7 @@ struct ieee802_11_elems { | |||
1131 | u8 *prep; | 1138 | u8 *prep; |
1132 | u8 *perr; | 1139 | u8 *perr; |
1133 | struct ieee80211_rann_ie *rann; | 1140 | struct ieee80211_rann_ie *rann; |
1134 | u8 *ch_switch_elem; | 1141 | struct ieee80211_channel_sw_ie *ch_switch_ie; |
1135 | u8 *country_elem; | 1142 | u8 *country_elem; |
1136 | u8 *pwr_constr_elem; | 1143 | u8 *pwr_constr_elem; |
1137 | u8 *quiet_elem; /* first quite element */ | 1144 | u8 *quiet_elem; /* first quite element */ |
@@ -1157,7 +1164,6 @@ struct ieee802_11_elems { | |||
1157 | u8 preq_len; | 1164 | u8 preq_len; |
1158 | u8 prep_len; | 1165 | u8 prep_len; |
1159 | u8 perr_len; | 1166 | u8 perr_len; |
1160 | u8 ch_switch_elem_len; | ||
1161 | u8 country_elem_len; | 1167 | u8 country_elem_len; |
1162 | u8 pwr_constr_elem_len; | 1168 | u8 pwr_constr_elem_len; |
1163 | u8 quiet_elem_len; | 1169 | u8 quiet_elem_len; |
@@ -1202,6 +1208,7 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1202 | void ieee80211_send_pspoll(struct ieee80211_local *local, | 1208 | void ieee80211_send_pspoll(struct ieee80211_local *local, |
1203 | struct ieee80211_sub_if_data *sdata); | 1209 | struct ieee80211_sub_if_data *sdata); |
1204 | void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); | 1210 | void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); |
1211 | void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata); | ||
1205 | int ieee80211_max_network_latency(struct notifier_block *nb, | 1212 | int ieee80211_max_network_latency(struct notifier_block *nb, |
1206 | unsigned long data, void *dummy); | 1213 | unsigned long data, void *dummy); |
1207 | int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); | 1214 | int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); |
@@ -1291,6 +1298,8 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local); | |||
1291 | void ieee80211_recalc_idle(struct ieee80211_local *local); | 1298 | void ieee80211_recalc_idle(struct ieee80211_local *local); |
1292 | void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, | 1299 | void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, |
1293 | const int offset); | 1300 | const int offset); |
1301 | int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up); | ||
1302 | void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata); | ||
1294 | 1303 | ||
1295 | static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) | 1304 | static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) |
1296 | { | 1305 | { |
@@ -1425,7 +1434,6 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | |||
1425 | struct ieee80211_hdr *hdr); | 1434 | struct ieee80211_hdr *hdr); |
1426 | void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, | 1435 | void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, |
1427 | struct ieee80211_hdr *hdr, bool ack); | 1436 | struct ieee80211_hdr *hdr, bool ack); |
1428 | void ieee80211_beacon_connection_loss_work(struct work_struct *work); | ||
1429 | 1437 | ||
1430 | void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, | 1438 | void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, |
1431 | enum queue_stop_reason reason); | 1439 | enum queue_stop_reason reason); |
@@ -1457,13 +1465,15 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, | |||
1457 | u8 channel); | 1465 | u8 channel); |
1458 | struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | 1466 | struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, |
1459 | u8 *dst, u32 ratemask, | 1467 | u8 *dst, u32 ratemask, |
1468 | struct ieee80211_channel *chan, | ||
1460 | const u8 *ssid, size_t ssid_len, | 1469 | const u8 *ssid, size_t ssid_len, |
1461 | const u8 *ie, size_t ie_len, | 1470 | const u8 *ie, size_t ie_len, |
1462 | bool directed); | 1471 | bool directed); |
1463 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | 1472 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
1464 | const u8 *ssid, size_t ssid_len, | 1473 | const u8 *ssid, size_t ssid_len, |
1465 | const u8 *ie, size_t ie_len, | 1474 | const u8 *ie, size_t ie_len, |
1466 | u32 ratemask, bool directed, bool no_cck); | 1475 | u32 ratemask, bool directed, bool no_cck, |
1476 | struct ieee80211_channel *channel); | ||
1467 | 1477 | ||
1468 | void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | 1478 | void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, |
1469 | const size_t supp_rates_len, | 1479 | const size_t supp_rates_len, |
@@ -1487,9 +1497,11 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, | |||
1487 | u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, | 1497 | u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, |
1488 | u32 cap); | 1498 | u32 cap); |
1489 | int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, | 1499 | int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, |
1490 | struct sk_buff *skb, bool need_basic); | 1500 | struct sk_buff *skb, bool need_basic, |
1501 | enum ieee80211_band band); | ||
1491 | int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, | 1502 | int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, |
1492 | struct sk_buff *skb, bool need_basic); | 1503 | struct sk_buff *skb, bool need_basic, |
1504 | enum ieee80211_band band); | ||
1493 | 1505 | ||
1494 | /* channel management */ | 1506 | /* channel management */ |
1495 | enum ieee80211_chan_mode { | 1507 | enum ieee80211_chan_mode { |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index bfb57dcc1538..59f8adc2aa5f 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -100,6 +100,10 @@ static u32 __ieee80211_recalc_idle(struct ieee80211_local *local) | |||
100 | sdata->vif.bss_conf.idle = true; | 100 | sdata->vif.bss_conf.idle = true; |
101 | continue; | 101 | continue; |
102 | } | 102 | } |
103 | |||
104 | if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
105 | continue; | ||
106 | |||
103 | /* count everything else */ | 107 | /* count everything else */ |
104 | sdata->vif.bss_conf.idle = false; | 108 | sdata->vif.bss_conf.idle = false; |
105 | count++; | 109 | count++; |
@@ -121,7 +125,8 @@ static u32 __ieee80211_recalc_idle(struct ieee80211_local *local) | |||
121 | 125 | ||
122 | list_for_each_entry(sdata, &local->interfaces, list) { | 126 | list_for_each_entry(sdata, &local->interfaces, list) { |
123 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || | 127 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || |
124 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 128 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN || |
129 | sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
125 | continue; | 130 | continue; |
126 | if (sdata->old_idle == sdata->vif.bss_conf.idle) | 131 | if (sdata->old_idle == sdata->vif.bss_conf.idle) |
127 | continue; | 132 | continue; |
@@ -204,6 +209,8 @@ static inline int identical_mac_addr_allowed(int type1, int type2) | |||
204 | { | 209 | { |
205 | return type1 == NL80211_IFTYPE_MONITOR || | 210 | return type1 == NL80211_IFTYPE_MONITOR || |
206 | type2 == NL80211_IFTYPE_MONITOR || | 211 | type2 == NL80211_IFTYPE_MONITOR || |
212 | type1 == NL80211_IFTYPE_P2P_DEVICE || | ||
213 | type2 == NL80211_IFTYPE_P2P_DEVICE || | ||
207 | (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_WDS) || | 214 | (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_WDS) || |
208 | (type1 == NL80211_IFTYPE_WDS && | 215 | (type1 == NL80211_IFTYPE_WDS && |
209 | (type2 == NL80211_IFTYPE_WDS || | 216 | (type2 == NL80211_IFTYPE_WDS || |
@@ -406,9 +413,10 @@ static void ieee80211_del_virtual_monitor(struct ieee80211_local *local) | |||
406 | * an error on interface type changes that have been pre-checked, so most | 413 | * an error on interface type changes that have been pre-checked, so most |
407 | * checks should be in ieee80211_check_concurrent_iface. | 414 | * checks should be in ieee80211_check_concurrent_iface. |
408 | */ | 415 | */ |
409 | static int ieee80211_do_open(struct net_device *dev, bool coming_up) | 416 | int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) |
410 | { | 417 | { |
411 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 418 | struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); |
419 | struct net_device *dev = wdev->netdev; | ||
412 | struct ieee80211_local *local = sdata->local; | 420 | struct ieee80211_local *local = sdata->local; |
413 | struct sta_info *sta; | 421 | struct sta_info *sta; |
414 | u32 changed = 0; | 422 | u32 changed = 0; |
@@ -443,6 +451,7 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
443 | case NL80211_IFTYPE_STATION: | 451 | case NL80211_IFTYPE_STATION: |
444 | case NL80211_IFTYPE_MONITOR: | 452 | case NL80211_IFTYPE_MONITOR: |
445 | case NL80211_IFTYPE_ADHOC: | 453 | case NL80211_IFTYPE_ADHOC: |
454 | case NL80211_IFTYPE_P2P_DEVICE: | ||
446 | /* no special treatment */ | 455 | /* no special treatment */ |
447 | break; | 456 | break; |
448 | case NL80211_IFTYPE_UNSPECIFIED: | 457 | case NL80211_IFTYPE_UNSPECIFIED: |
@@ -471,7 +480,7 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
471 | * Copy the hopefully now-present MAC address to | 480 | * Copy the hopefully now-present MAC address to |
472 | * this interface, if it has the special null one. | 481 | * this interface, if it has the special null one. |
473 | */ | 482 | */ |
474 | if (is_zero_ether_addr(dev->dev_addr)) { | 483 | if (dev && is_zero_ether_addr(dev->dev_addr)) { |
475 | memcpy(dev->dev_addr, | 484 | memcpy(dev->dev_addr, |
476 | local->hw.wiphy->perm_addr, | 485 | local->hw.wiphy->perm_addr, |
477 | ETH_ALEN); | 486 | ETH_ALEN); |
@@ -536,15 +545,23 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
536 | local->fif_probe_req++; | 545 | local->fif_probe_req++; |
537 | } | 546 | } |
538 | 547 | ||
539 | changed |= ieee80211_reset_erp_info(sdata); | 548 | if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE) |
549 | changed |= ieee80211_reset_erp_info(sdata); | ||
540 | ieee80211_bss_info_change_notify(sdata, changed); | 550 | ieee80211_bss_info_change_notify(sdata, changed); |
541 | 551 | ||
542 | if (sdata->vif.type == NL80211_IFTYPE_STATION || | 552 | switch (sdata->vif.type) { |
543 | sdata->vif.type == NL80211_IFTYPE_ADHOC || | 553 | case NL80211_IFTYPE_STATION: |
544 | sdata->vif.type == NL80211_IFTYPE_AP) | 554 | case NL80211_IFTYPE_ADHOC: |
555 | case NL80211_IFTYPE_AP: | ||
556 | case NL80211_IFTYPE_MESH_POINT: | ||
545 | netif_carrier_off(dev); | 557 | netif_carrier_off(dev); |
546 | else | 558 | break; |
559 | case NL80211_IFTYPE_WDS: | ||
560 | case NL80211_IFTYPE_P2P_DEVICE: | ||
561 | break; | ||
562 | default: | ||
547 | netif_carrier_on(dev); | 563 | netif_carrier_on(dev); |
564 | } | ||
548 | 565 | ||
549 | /* | 566 | /* |
550 | * set default queue parameters so drivers don't | 567 | * set default queue parameters so drivers don't |
@@ -576,6 +593,9 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
576 | } | 593 | } |
577 | 594 | ||
578 | rate_control_rate_init(sta); | 595 | rate_control_rate_init(sta); |
596 | netif_carrier_on(dev); | ||
597 | } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) { | ||
598 | rcu_assign_pointer(local->p2p_sdata, sdata); | ||
579 | } | 599 | } |
580 | 600 | ||
581 | /* | 601 | /* |
@@ -601,7 +621,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) | |||
601 | 621 | ||
602 | ieee80211_recalc_ps(local, -1); | 622 | ieee80211_recalc_ps(local, -1); |
603 | 623 | ||
604 | netif_tx_start_all_queues(dev); | 624 | if (dev) |
625 | netif_tx_start_all_queues(dev); | ||
605 | 626 | ||
606 | return 0; | 627 | return 0; |
607 | err_del_interface: | 628 | err_del_interface: |
@@ -631,7 +652,7 @@ static int ieee80211_open(struct net_device *dev) | |||
631 | if (err) | 652 | if (err) |
632 | return err; | 653 | return err; |
633 | 654 | ||
634 | return ieee80211_do_open(dev, true); | 655 | return ieee80211_do_open(&sdata->wdev, true); |
635 | } | 656 | } |
636 | 657 | ||
637 | static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | 658 | static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, |
@@ -652,7 +673,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
652 | /* | 673 | /* |
653 | * Stop TX on this interface first. | 674 | * Stop TX on this interface first. |
654 | */ | 675 | */ |
655 | netif_tx_stop_all_queues(sdata->dev); | 676 | if (sdata->dev) |
677 | netif_tx_stop_all_queues(sdata->dev); | ||
656 | 678 | ||
657 | ieee80211_roc_purge(sdata); | 679 | ieee80211_roc_purge(sdata); |
658 | 680 | ||
@@ -691,14 +713,16 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
691 | local->fif_probe_req--; | 713 | local->fif_probe_req--; |
692 | } | 714 | } |
693 | 715 | ||
694 | netif_addr_lock_bh(sdata->dev); | 716 | if (sdata->dev) { |
695 | spin_lock_bh(&local->filter_lock); | 717 | netif_addr_lock_bh(sdata->dev); |
696 | __hw_addr_unsync(&local->mc_list, &sdata->dev->mc, | 718 | spin_lock_bh(&local->filter_lock); |
697 | sdata->dev->addr_len); | 719 | __hw_addr_unsync(&local->mc_list, &sdata->dev->mc, |
698 | spin_unlock_bh(&local->filter_lock); | 720 | sdata->dev->addr_len); |
699 | netif_addr_unlock_bh(sdata->dev); | 721 | spin_unlock_bh(&local->filter_lock); |
722 | netif_addr_unlock_bh(sdata->dev); | ||
700 | 723 | ||
701 | ieee80211_configure_filter(local); | 724 | ieee80211_configure_filter(local); |
725 | } | ||
702 | 726 | ||
703 | del_timer_sync(&local->dynamic_ps_timer); | 727 | del_timer_sync(&local->dynamic_ps_timer); |
704 | cancel_work_sync(&local->dynamic_ps_enable_work); | 728 | cancel_work_sync(&local->dynamic_ps_enable_work); |
@@ -708,7 +732,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
708 | struct ieee80211_sub_if_data *vlan, *tmpsdata; | 732 | struct ieee80211_sub_if_data *vlan, *tmpsdata; |
709 | struct beacon_data *old_beacon = | 733 | struct beacon_data *old_beacon = |
710 | rtnl_dereference(sdata->u.ap.beacon); | 734 | rtnl_dereference(sdata->u.ap.beacon); |
711 | struct sk_buff *old_probe_resp = | 735 | struct probe_resp *old_probe_resp = |
712 | rtnl_dereference(sdata->u.ap.probe_resp); | 736 | rtnl_dereference(sdata->u.ap.probe_resp); |
713 | 737 | ||
714 | /* sdata_running will return false, so this will disable */ | 738 | /* sdata_running will return false, so this will disable */ |
@@ -720,7 +744,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
720 | RCU_INIT_POINTER(sdata->u.ap.probe_resp, NULL); | 744 | RCU_INIT_POINTER(sdata->u.ap.probe_resp, NULL); |
721 | synchronize_rcu(); | 745 | synchronize_rcu(); |
722 | kfree(old_beacon); | 746 | kfree(old_beacon); |
723 | kfree_skb(old_probe_resp); | 747 | kfree(old_probe_resp); |
724 | 748 | ||
725 | /* down all dependent devices, that is VLANs */ | 749 | /* down all dependent devices, that is VLANs */ |
726 | list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans, | 750 | list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans, |
@@ -759,6 +783,10 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
759 | ieee80211_adjust_monitor_flags(sdata, -1); | 783 | ieee80211_adjust_monitor_flags(sdata, -1); |
760 | ieee80211_configure_filter(local); | 784 | ieee80211_configure_filter(local); |
761 | break; | 785 | break; |
786 | case NL80211_IFTYPE_P2P_DEVICE: | ||
787 | /* relies on synchronize_rcu() below */ | ||
788 | rcu_assign_pointer(local->p2p_sdata, NULL); | ||
789 | /* fall through */ | ||
762 | default: | 790 | default: |
763 | flush_work(&sdata->work); | 791 | flush_work(&sdata->work); |
764 | /* | 792 | /* |
@@ -771,14 +799,6 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
771 | skb_queue_purge(&sdata->skb_queue); | 799 | skb_queue_purge(&sdata->skb_queue); |
772 | 800 | ||
773 | /* | 801 | /* |
774 | * Disable beaconing here for mesh only, AP and IBSS | ||
775 | * are already taken care of. | ||
776 | */ | ||
777 | if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) | ||
778 | ieee80211_bss_info_change_notify(sdata, | ||
779 | BSS_CHANGED_BEACON_ENABLED); | ||
780 | |||
781 | /* | ||
782 | * Free all remaining keys, there shouldn't be any, | 802 | * Free all remaining keys, there shouldn't be any, |
783 | * except maybe group keys in AP more or WDS? | 803 | * except maybe group keys in AP more or WDS? |
784 | */ | 804 | */ |
@@ -877,9 +897,8 @@ static void ieee80211_set_multicast_list(struct net_device *dev) | |||
877 | * Called when the netdev is removed or, by the code below, before | 897 | * Called when the netdev is removed or, by the code below, before |
878 | * the interface type changes. | 898 | * the interface type changes. |
879 | */ | 899 | */ |
880 | static void ieee80211_teardown_sdata(struct net_device *dev) | 900 | static void ieee80211_teardown_sdata(struct ieee80211_sub_if_data *sdata) |
881 | { | 901 | { |
882 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
883 | struct ieee80211_local *local = sdata->local; | 902 | struct ieee80211_local *local = sdata->local; |
884 | int flushed; | 903 | int flushed; |
885 | int i; | 904 | int i; |
@@ -900,6 +919,11 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
900 | WARN_ON(flushed); | 919 | WARN_ON(flushed); |
901 | } | 920 | } |
902 | 921 | ||
922 | static void ieee80211_uninit(struct net_device *dev) | ||
923 | { | ||
924 | ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev)); | ||
925 | } | ||
926 | |||
903 | static u16 ieee80211_netdev_select_queue(struct net_device *dev, | 927 | static u16 ieee80211_netdev_select_queue(struct net_device *dev, |
904 | struct sk_buff *skb) | 928 | struct sk_buff *skb) |
905 | { | 929 | { |
@@ -909,7 +933,7 @@ static u16 ieee80211_netdev_select_queue(struct net_device *dev, | |||
909 | static const struct net_device_ops ieee80211_dataif_ops = { | 933 | static const struct net_device_ops ieee80211_dataif_ops = { |
910 | .ndo_open = ieee80211_open, | 934 | .ndo_open = ieee80211_open, |
911 | .ndo_stop = ieee80211_stop, | 935 | .ndo_stop = ieee80211_stop, |
912 | .ndo_uninit = ieee80211_teardown_sdata, | 936 | .ndo_uninit = ieee80211_uninit, |
913 | .ndo_start_xmit = ieee80211_subif_start_xmit, | 937 | .ndo_start_xmit = ieee80211_subif_start_xmit, |
914 | .ndo_set_rx_mode = ieee80211_set_multicast_list, | 938 | .ndo_set_rx_mode = ieee80211_set_multicast_list, |
915 | .ndo_change_mtu = ieee80211_change_mtu, | 939 | .ndo_change_mtu = ieee80211_change_mtu, |
@@ -940,7 +964,7 @@ static u16 ieee80211_monitor_select_queue(struct net_device *dev, | |||
940 | static const struct net_device_ops ieee80211_monitorif_ops = { | 964 | static const struct net_device_ops ieee80211_monitorif_ops = { |
941 | .ndo_open = ieee80211_open, | 965 | .ndo_open = ieee80211_open, |
942 | .ndo_stop = ieee80211_stop, | 966 | .ndo_stop = ieee80211_stop, |
943 | .ndo_uninit = ieee80211_teardown_sdata, | 967 | .ndo_uninit = ieee80211_uninit, |
944 | .ndo_start_xmit = ieee80211_monitor_start_xmit, | 968 | .ndo_start_xmit = ieee80211_monitor_start_xmit, |
945 | .ndo_set_rx_mode = ieee80211_set_multicast_list, | 969 | .ndo_set_rx_mode = ieee80211_set_multicast_list, |
946 | .ndo_change_mtu = ieee80211_change_mtu, | 970 | .ndo_change_mtu = ieee80211_change_mtu, |
@@ -1099,7 +1123,6 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1099 | /* and set some type-dependent values */ | 1123 | /* and set some type-dependent values */ |
1100 | sdata->vif.type = type; | 1124 | sdata->vif.type = type; |
1101 | sdata->vif.p2p = false; | 1125 | sdata->vif.p2p = false; |
1102 | sdata->dev->netdev_ops = &ieee80211_dataif_ops; | ||
1103 | sdata->wdev.iftype = type; | 1126 | sdata->wdev.iftype = type; |
1104 | 1127 | ||
1105 | sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); | 1128 | sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); |
@@ -1107,8 +1130,11 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1107 | 1130 | ||
1108 | sdata->noack_map = 0; | 1131 | sdata->noack_map = 0; |
1109 | 1132 | ||
1110 | /* only monitor differs */ | 1133 | /* only monitor/p2p-device differ */ |
1111 | sdata->dev->type = ARPHRD_ETHER; | 1134 | if (sdata->dev) { |
1135 | sdata->dev->netdev_ops = &ieee80211_dataif_ops; | ||
1136 | sdata->dev->type = ARPHRD_ETHER; | ||
1137 | } | ||
1112 | 1138 | ||
1113 | skb_queue_head_init(&sdata->skb_queue); | 1139 | skb_queue_head_init(&sdata->skb_queue); |
1114 | INIT_WORK(&sdata->work, ieee80211_iface_work); | 1140 | INIT_WORK(&sdata->work, ieee80211_iface_work); |
@@ -1146,6 +1172,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1146 | break; | 1172 | break; |
1147 | case NL80211_IFTYPE_WDS: | 1173 | case NL80211_IFTYPE_WDS: |
1148 | case NL80211_IFTYPE_AP_VLAN: | 1174 | case NL80211_IFTYPE_AP_VLAN: |
1175 | case NL80211_IFTYPE_P2P_DEVICE: | ||
1149 | break; | 1176 | break; |
1150 | case NL80211_IFTYPE_UNSPECIFIED: | 1177 | case NL80211_IFTYPE_UNSPECIFIED: |
1151 | case NUM_NL80211_IFTYPES: | 1178 | case NUM_NL80211_IFTYPES: |
@@ -1156,18 +1183,6 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1156 | ieee80211_debugfs_add_netdev(sdata); | 1183 | ieee80211_debugfs_add_netdev(sdata); |
1157 | } | 1184 | } |
1158 | 1185 | ||
1159 | static void ieee80211_clean_sdata(struct ieee80211_sub_if_data *sdata) | ||
1160 | { | ||
1161 | switch (sdata->vif.type) { | ||
1162 | case NL80211_IFTYPE_MESH_POINT: | ||
1163 | mesh_path_flush_by_iface(sdata); | ||
1164 | break; | ||
1165 | |||
1166 | default: | ||
1167 | break; | ||
1168 | } | ||
1169 | } | ||
1170 | |||
1171 | static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | 1186 | static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, |
1172 | enum nl80211_iftype type) | 1187 | enum nl80211_iftype type) |
1173 | { | 1188 | { |
@@ -1225,7 +1240,7 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | |||
1225 | 1240 | ||
1226 | ieee80211_do_stop(sdata, false); | 1241 | ieee80211_do_stop(sdata, false); |
1227 | 1242 | ||
1228 | ieee80211_teardown_sdata(sdata->dev); | 1243 | ieee80211_teardown_sdata(sdata); |
1229 | 1244 | ||
1230 | ret = drv_change_interface(local, sdata, internal_type, p2p); | 1245 | ret = drv_change_interface(local, sdata, internal_type, p2p); |
1231 | if (ret) | 1246 | if (ret) |
@@ -1240,7 +1255,7 @@ static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, | |||
1240 | 1255 | ||
1241 | ieee80211_setup_sdata(sdata, type); | 1256 | ieee80211_setup_sdata(sdata, type); |
1242 | 1257 | ||
1243 | err = ieee80211_do_open(sdata->dev, false); | 1258 | err = ieee80211_do_open(&sdata->wdev, false); |
1244 | WARN(err, "type change: do_open returned %d", err); | 1259 | WARN(err, "type change: do_open returned %d", err); |
1245 | 1260 | ||
1246 | return ret; | 1261 | return ret; |
@@ -1267,14 +1282,14 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
1267 | return ret; | 1282 | return ret; |
1268 | } else { | 1283 | } else { |
1269 | /* Purge and reset type-dependent state. */ | 1284 | /* Purge and reset type-dependent state. */ |
1270 | ieee80211_teardown_sdata(sdata->dev); | 1285 | ieee80211_teardown_sdata(sdata); |
1271 | ieee80211_setup_sdata(sdata, type); | 1286 | ieee80211_setup_sdata(sdata, type); |
1272 | } | 1287 | } |
1273 | 1288 | ||
1274 | /* reset some values that shouldn't be kept across type changes */ | 1289 | /* reset some values that shouldn't be kept across type changes */ |
1275 | sdata->vif.bss_conf.basic_rates = | 1290 | sdata->vif.bss_conf.basic_rates = |
1276 | ieee80211_mandatory_rates(sdata->local, | 1291 | ieee80211_mandatory_rates(sdata->local, |
1277 | sdata->local->hw.conf.channel->band); | 1292 | sdata->local->oper_channel->band); |
1278 | sdata->drop_unencrypted = 0; | 1293 | sdata->drop_unencrypted = 0; |
1279 | if (type == NL80211_IFTYPE_STATION) | 1294 | if (type == NL80211_IFTYPE_STATION) |
1280 | sdata->u.mgd.use_4addr = false; | 1295 | sdata->u.mgd.use_4addr = false; |
@@ -1283,8 +1298,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
1283 | } | 1298 | } |
1284 | 1299 | ||
1285 | static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | 1300 | static void ieee80211_assign_perm_addr(struct ieee80211_local *local, |
1286 | struct net_device *dev, | 1301 | u8 *perm_addr, enum nl80211_iftype type) |
1287 | enum nl80211_iftype type) | ||
1288 | { | 1302 | { |
1289 | struct ieee80211_sub_if_data *sdata; | 1303 | struct ieee80211_sub_if_data *sdata; |
1290 | u64 mask, start, addr, val, inc; | 1304 | u64 mask, start, addr, val, inc; |
@@ -1293,13 +1307,12 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1293 | int i; | 1307 | int i; |
1294 | 1308 | ||
1295 | /* default ... something at least */ | 1309 | /* default ... something at least */ |
1296 | memcpy(dev->perm_addr, local->hw.wiphy->perm_addr, ETH_ALEN); | 1310 | memcpy(perm_addr, local->hw.wiphy->perm_addr, ETH_ALEN); |
1297 | 1311 | ||
1298 | if (is_zero_ether_addr(local->hw.wiphy->addr_mask) && | 1312 | if (is_zero_ether_addr(local->hw.wiphy->addr_mask) && |
1299 | local->hw.wiphy->n_addresses <= 1) | 1313 | local->hw.wiphy->n_addresses <= 1) |
1300 | return; | 1314 | return; |
1301 | 1315 | ||
1302 | |||
1303 | mutex_lock(&local->iflist_mtx); | 1316 | mutex_lock(&local->iflist_mtx); |
1304 | 1317 | ||
1305 | switch (type) { | 1318 | switch (type) { |
@@ -1312,11 +1325,24 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1312 | list_for_each_entry(sdata, &local->interfaces, list) { | 1325 | list_for_each_entry(sdata, &local->interfaces, list) { |
1313 | if (sdata->vif.type != NL80211_IFTYPE_AP) | 1326 | if (sdata->vif.type != NL80211_IFTYPE_AP) |
1314 | continue; | 1327 | continue; |
1315 | memcpy(dev->perm_addr, sdata->vif.addr, ETH_ALEN); | 1328 | memcpy(perm_addr, sdata->vif.addr, ETH_ALEN); |
1316 | break; | 1329 | break; |
1317 | } | 1330 | } |
1318 | /* keep default if no AP interface present */ | 1331 | /* keep default if no AP interface present */ |
1319 | break; | 1332 | break; |
1333 | case NL80211_IFTYPE_P2P_CLIENT: | ||
1334 | case NL80211_IFTYPE_P2P_GO: | ||
1335 | if (local->hw.flags & IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF) { | ||
1336 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
1337 | if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE) | ||
1338 | continue; | ||
1339 | if (!ieee80211_sdata_running(sdata)) | ||
1340 | continue; | ||
1341 | memcpy(perm_addr, sdata->vif.addr, ETH_ALEN); | ||
1342 | goto out_unlock; | ||
1343 | } | ||
1344 | } | ||
1345 | /* otherwise fall through */ | ||
1320 | default: | 1346 | default: |
1321 | /* assign a new address if possible -- try n_addresses first */ | 1347 | /* assign a new address if possible -- try n_addresses first */ |
1322 | for (i = 0; i < local->hw.wiphy->n_addresses; i++) { | 1348 | for (i = 0; i < local->hw.wiphy->n_addresses; i++) { |
@@ -1331,7 +1357,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1331 | } | 1357 | } |
1332 | 1358 | ||
1333 | if (!used) { | 1359 | if (!used) { |
1334 | memcpy(dev->perm_addr, | 1360 | memcpy(perm_addr, |
1335 | local->hw.wiphy->addresses[i].addr, | 1361 | local->hw.wiphy->addresses[i].addr, |
1336 | ETH_ALEN); | 1362 | ETH_ALEN); |
1337 | break; | 1363 | break; |
@@ -1382,7 +1408,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1382 | } | 1408 | } |
1383 | 1409 | ||
1384 | if (!used) { | 1410 | if (!used) { |
1385 | memcpy(dev->perm_addr, tmp_addr, ETH_ALEN); | 1411 | memcpy(perm_addr, tmp_addr, ETH_ALEN); |
1386 | break; | 1412 | break; |
1387 | } | 1413 | } |
1388 | addr = (start & ~mask) | (val & mask); | 1414 | addr = (start & ~mask) | (val & mask); |
@@ -1391,6 +1417,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, | |||
1391 | break; | 1417 | break; |
1392 | } | 1418 | } |
1393 | 1419 | ||
1420 | out_unlock: | ||
1394 | mutex_unlock(&local->iflist_mtx); | 1421 | mutex_unlock(&local->iflist_mtx); |
1395 | } | 1422 | } |
1396 | 1423 | ||
@@ -1398,49 +1425,68 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
1398 | struct wireless_dev **new_wdev, enum nl80211_iftype type, | 1425 | struct wireless_dev **new_wdev, enum nl80211_iftype type, |
1399 | struct vif_params *params) | 1426 | struct vif_params *params) |
1400 | { | 1427 | { |
1401 | struct net_device *ndev; | 1428 | struct net_device *ndev = NULL; |
1402 | struct ieee80211_sub_if_data *sdata = NULL; | 1429 | struct ieee80211_sub_if_data *sdata = NULL; |
1403 | int ret, i; | 1430 | int ret, i; |
1404 | int txqs = 1; | 1431 | int txqs = 1; |
1405 | 1432 | ||
1406 | ASSERT_RTNL(); | 1433 | ASSERT_RTNL(); |
1407 | 1434 | ||
1408 | if (local->hw.queues >= IEEE80211_NUM_ACS) | 1435 | if (type == NL80211_IFTYPE_P2P_DEVICE) { |
1409 | txqs = IEEE80211_NUM_ACS; | 1436 | struct wireless_dev *wdev; |
1410 | 1437 | ||
1411 | ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size, | 1438 | sdata = kzalloc(sizeof(*sdata) + local->hw.vif_data_size, |
1412 | name, ieee80211_if_setup, txqs, 1); | 1439 | GFP_KERNEL); |
1413 | if (!ndev) | 1440 | if (!sdata) |
1414 | return -ENOMEM; | 1441 | return -ENOMEM; |
1415 | dev_net_set(ndev, wiphy_net(local->hw.wiphy)); | 1442 | wdev = &sdata->wdev; |
1416 | 1443 | ||
1417 | ndev->needed_headroom = local->tx_headroom + | 1444 | sdata->dev = NULL; |
1418 | 4*6 /* four MAC addresses */ | 1445 | strlcpy(sdata->name, name, IFNAMSIZ); |
1419 | + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */ | 1446 | ieee80211_assign_perm_addr(local, wdev->address, type); |
1420 | + 6 /* mesh */ | 1447 | memcpy(sdata->vif.addr, wdev->address, ETH_ALEN); |
1421 | + 8 /* rfc1042/bridge tunnel */ | 1448 | } else { |
1422 | - ETH_HLEN /* ethernet hard_header_len */ | 1449 | if (local->hw.queues >= IEEE80211_NUM_ACS) |
1423 | + IEEE80211_ENCRYPT_HEADROOM; | 1450 | txqs = IEEE80211_NUM_ACS; |
1424 | ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; | 1451 | |
1425 | 1452 | ndev = alloc_netdev_mqs(sizeof(*sdata) + | |
1426 | ret = dev_alloc_name(ndev, ndev->name); | 1453 | local->hw.vif_data_size, |
1427 | if (ret < 0) | 1454 | name, ieee80211_if_setup, txqs, 1); |
1428 | goto fail; | 1455 | if (!ndev) |
1429 | 1456 | return -ENOMEM; | |
1430 | ieee80211_assign_perm_addr(local, ndev, type); | 1457 | dev_net_set(ndev, wiphy_net(local->hw.wiphy)); |
1431 | memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); | 1458 | |
1432 | SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); | 1459 | ndev->needed_headroom = local->tx_headroom + |
1433 | 1460 | 4*6 /* four MAC addresses */ | |
1434 | /* don't use IEEE80211_DEV_TO_SUB_IF because it checks too much */ | 1461 | + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */ |
1435 | sdata = netdev_priv(ndev); | 1462 | + 6 /* mesh */ |
1436 | ndev->ieee80211_ptr = &sdata->wdev; | 1463 | + 8 /* rfc1042/bridge tunnel */ |
1437 | memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN); | 1464 | - ETH_HLEN /* ethernet hard_header_len */ |
1438 | memcpy(sdata->name, ndev->name, IFNAMSIZ); | 1465 | + IEEE80211_ENCRYPT_HEADROOM; |
1466 | ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; | ||
1467 | |||
1468 | ret = dev_alloc_name(ndev, ndev->name); | ||
1469 | if (ret < 0) { | ||
1470 | free_netdev(ndev); | ||
1471 | return ret; | ||
1472 | } | ||
1473 | |||
1474 | ieee80211_assign_perm_addr(local, ndev->perm_addr, type); | ||
1475 | memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); | ||
1476 | SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); | ||
1477 | |||
1478 | /* don't use IEEE80211_DEV_TO_SUB_IF -- it checks too much */ | ||
1479 | sdata = netdev_priv(ndev); | ||
1480 | ndev->ieee80211_ptr = &sdata->wdev; | ||
1481 | memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN); | ||
1482 | memcpy(sdata->name, ndev->name, IFNAMSIZ); | ||
1483 | |||
1484 | sdata->dev = ndev; | ||
1485 | } | ||
1439 | 1486 | ||
1440 | /* initialise type-independent data */ | 1487 | /* initialise type-independent data */ |
1441 | sdata->wdev.wiphy = local->hw.wiphy; | 1488 | sdata->wdev.wiphy = local->hw.wiphy; |
1442 | sdata->local = local; | 1489 | sdata->local = local; |
1443 | sdata->dev = ndev; | ||
1444 | #ifdef CONFIG_INET | 1490 | #ifdef CONFIG_INET |
1445 | sdata->arp_filter_state = true; | 1491 | sdata->arp_filter_state = true; |
1446 | #endif | 1492 | #endif |
@@ -1469,17 +1515,21 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
1469 | /* setup type-dependent data */ | 1515 | /* setup type-dependent data */ |
1470 | ieee80211_setup_sdata(sdata, type); | 1516 | ieee80211_setup_sdata(sdata, type); |
1471 | 1517 | ||
1472 | if (params) { | 1518 | if (ndev) { |
1473 | ndev->ieee80211_ptr->use_4addr = params->use_4addr; | 1519 | if (params) { |
1474 | if (type == NL80211_IFTYPE_STATION) | 1520 | ndev->ieee80211_ptr->use_4addr = params->use_4addr; |
1475 | sdata->u.mgd.use_4addr = params->use_4addr; | 1521 | if (type == NL80211_IFTYPE_STATION) |
1476 | } | 1522 | sdata->u.mgd.use_4addr = params->use_4addr; |
1523 | } | ||
1477 | 1524 | ||
1478 | ndev->features |= local->hw.netdev_features; | 1525 | ndev->features |= local->hw.netdev_features; |
1479 | 1526 | ||
1480 | ret = register_netdevice(ndev); | 1527 | ret = register_netdevice(ndev); |
1481 | if (ret) | 1528 | if (ret) { |
1482 | goto fail; | 1529 | free_netdev(ndev); |
1530 | return ret; | ||
1531 | } | ||
1532 | } | ||
1483 | 1533 | ||
1484 | mutex_lock(&local->iflist_mtx); | 1534 | mutex_lock(&local->iflist_mtx); |
1485 | list_add_tail_rcu(&sdata->list, &local->interfaces); | 1535 | list_add_tail_rcu(&sdata->list, &local->interfaces); |
@@ -1489,10 +1539,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
1489 | *new_wdev = &sdata->wdev; | 1539 | *new_wdev = &sdata->wdev; |
1490 | 1540 | ||
1491 | return 0; | 1541 | return 0; |
1492 | |||
1493 | fail: | ||
1494 | free_netdev(ndev); | ||
1495 | return ret; | ||
1496 | } | 1542 | } |
1497 | 1543 | ||
1498 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) | 1544 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) |
@@ -1503,11 +1549,22 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) | |||
1503 | list_del_rcu(&sdata->list); | 1549 | list_del_rcu(&sdata->list); |
1504 | mutex_unlock(&sdata->local->iflist_mtx); | 1550 | mutex_unlock(&sdata->local->iflist_mtx); |
1505 | 1551 | ||
1506 | /* clean up type-dependent data */ | ||
1507 | ieee80211_clean_sdata(sdata); | ||
1508 | |||
1509 | synchronize_rcu(); | 1552 | synchronize_rcu(); |
1510 | unregister_netdevice(sdata->dev); | 1553 | |
1554 | if (sdata->dev) { | ||
1555 | unregister_netdevice(sdata->dev); | ||
1556 | } else { | ||
1557 | cfg80211_unregister_wdev(&sdata->wdev); | ||
1558 | kfree(sdata); | ||
1559 | } | ||
1560 | } | ||
1561 | |||
1562 | void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata) | ||
1563 | { | ||
1564 | if (WARN_ON_ONCE(!test_bit(SDATA_STATE_RUNNING, &sdata->state))) | ||
1565 | return; | ||
1566 | ieee80211_do_stop(sdata, true); | ||
1567 | ieee80211_teardown_sdata(sdata); | ||
1511 | } | 1568 | } |
1512 | 1569 | ||
1513 | /* | 1570 | /* |
@@ -1518,6 +1575,7 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) | |||
1518 | { | 1575 | { |
1519 | struct ieee80211_sub_if_data *sdata, *tmp; | 1576 | struct ieee80211_sub_if_data *sdata, *tmp; |
1520 | LIST_HEAD(unreg_list); | 1577 | LIST_HEAD(unreg_list); |
1578 | LIST_HEAD(wdev_list); | ||
1521 | 1579 | ||
1522 | ASSERT_RTNL(); | 1580 | ASSERT_RTNL(); |
1523 | 1581 | ||
@@ -1525,13 +1583,20 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) | |||
1525 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { | 1583 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { |
1526 | list_del(&sdata->list); | 1584 | list_del(&sdata->list); |
1527 | 1585 | ||
1528 | ieee80211_clean_sdata(sdata); | 1586 | if (sdata->dev) |
1529 | 1587 | unregister_netdevice_queue(sdata->dev, &unreg_list); | |
1530 | unregister_netdevice_queue(sdata->dev, &unreg_list); | 1588 | else |
1589 | list_add(&sdata->list, &wdev_list); | ||
1531 | } | 1590 | } |
1532 | mutex_unlock(&local->iflist_mtx); | 1591 | mutex_unlock(&local->iflist_mtx); |
1533 | unregister_netdevice_many(&unreg_list); | 1592 | unregister_netdevice_many(&unreg_list); |
1534 | list_del(&unreg_list); | 1593 | list_del(&unreg_list); |
1594 | |||
1595 | list_for_each_entry_safe(sdata, tmp, &wdev_list, list) { | ||
1596 | list_del(&sdata->list); | ||
1597 | cfg80211_unregister_wdev(&sdata->wdev); | ||
1598 | kfree(sdata); | ||
1599 | } | ||
1535 | } | 1600 | } |
1536 | 1601 | ||
1537 | static int netdev_notify(struct notifier_block *nb, | 1602 | static int netdev_notify(struct notifier_block *nb, |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index c26e231c733a..bd7529363193 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -207,6 +207,10 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, | |||
207 | sdata->vif.bss_conf.bssid = NULL; | 207 | sdata->vif.bss_conf.bssid = NULL; |
208 | else if (ieee80211_vif_is_mesh(&sdata->vif)) { | 208 | else if (ieee80211_vif_is_mesh(&sdata->vif)) { |
209 | sdata->vif.bss_conf.bssid = zero; | 209 | sdata->vif.bss_conf.bssid = zero; |
210 | } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) { | ||
211 | sdata->vif.bss_conf.bssid = sdata->vif.addr; | ||
212 | WARN_ONCE(changed & ~(BSS_CHANGED_IDLE), | ||
213 | "P2P Device BSS changed %#x", changed); | ||
210 | } else { | 214 | } else { |
211 | WARN_ON(1); | 215 | WARN_ON(1); |
212 | return; | 216 | return; |
@@ -514,6 +518,11 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { | |||
514 | BIT(IEEE80211_STYPE_AUTH >> 4) | | 518 | BIT(IEEE80211_STYPE_AUTH >> 4) | |
515 | BIT(IEEE80211_STYPE_DEAUTH >> 4), | 519 | BIT(IEEE80211_STYPE_DEAUTH >> 4), |
516 | }, | 520 | }, |
521 | [NL80211_IFTYPE_P2P_DEVICE] = { | ||
522 | .tx = 0xffff, | ||
523 | .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | | ||
524 | BIT(IEEE80211_STYPE_PROBE_REQ >> 4), | ||
525 | }, | ||
517 | }; | 526 | }; |
518 | 527 | ||
519 | static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = { | 528 | static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = { |
@@ -536,6 +545,11 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
536 | int priv_size, i; | 545 | int priv_size, i; |
537 | struct wiphy *wiphy; | 546 | struct wiphy *wiphy; |
538 | 547 | ||
548 | if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config || | ||
549 | !ops->add_interface || !ops->remove_interface || | ||
550 | !ops->configure_filter)) | ||
551 | return NULL; | ||
552 | |||
539 | if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) | 553 | if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) |
540 | return NULL; | 554 | return NULL; |
541 | 555 | ||
@@ -588,13 +602,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
588 | 602 | ||
589 | local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN); | 603 | local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN); |
590 | 604 | ||
591 | BUG_ON(!ops->tx); | ||
592 | BUG_ON(!ops->start); | ||
593 | BUG_ON(!ops->stop); | ||
594 | BUG_ON(!ops->config); | ||
595 | BUG_ON(!ops->add_interface); | ||
596 | BUG_ON(!ops->remove_interface); | ||
597 | BUG_ON(!ops->configure_filter); | ||
598 | local->ops = ops; | 605 | local->ops = ops; |
599 | 606 | ||
600 | /* set up some defaults */ | 607 | /* set up some defaults */ |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 856dcf49ce75..f4a636ffe023 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -109,11 +109,11 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata, | |||
109 | 109 | ||
110 | /* Disallow HT40+/- mismatch */ | 110 | /* Disallow HT40+/- mismatch */ |
111 | if (ie->ht_operation && | 111 | if (ie->ht_operation && |
112 | (local->_oper_channel_type == NL80211_CHAN_HT40MINUS || | 112 | (sdata->vif.bss_conf.channel_type == NL80211_CHAN_HT40MINUS || |
113 | local->_oper_channel_type == NL80211_CHAN_HT40PLUS) && | 113 | sdata->vif.bss_conf.channel_type == NL80211_CHAN_HT40PLUS) && |
114 | (sta_channel_type == NL80211_CHAN_HT40MINUS || | 114 | (sta_channel_type == NL80211_CHAN_HT40MINUS || |
115 | sta_channel_type == NL80211_CHAN_HT40PLUS) && | 115 | sta_channel_type == NL80211_CHAN_HT40PLUS) && |
116 | local->_oper_channel_type != sta_channel_type) | 116 | sdata->vif.bss_conf.channel_type != sta_channel_type) |
117 | goto mismatch; | 117 | goto mismatch; |
118 | 118 | ||
119 | return true; | 119 | return true; |
@@ -355,17 +355,18 @@ int mesh_add_ds_params_ie(struct sk_buff *skb, | |||
355 | { | 355 | { |
356 | struct ieee80211_local *local = sdata->local; | 356 | struct ieee80211_local *local = sdata->local; |
357 | struct ieee80211_supported_band *sband; | 357 | struct ieee80211_supported_band *sband; |
358 | struct ieee80211_channel *chan = local->oper_channel; | ||
358 | u8 *pos; | 359 | u8 *pos; |
359 | 360 | ||
360 | if (skb_tailroom(skb) < 3) | 361 | if (skb_tailroom(skb) < 3) |
361 | return -ENOMEM; | 362 | return -ENOMEM; |
362 | 363 | ||
363 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 364 | sband = local->hw.wiphy->bands[chan->band]; |
364 | if (sband->band == IEEE80211_BAND_2GHZ) { | 365 | if (sband->band == IEEE80211_BAND_2GHZ) { |
365 | pos = skb_put(skb, 2 + 1); | 366 | pos = skb_put(skb, 2 + 1); |
366 | *pos++ = WLAN_EID_DS_PARAMS; | 367 | *pos++ = WLAN_EID_DS_PARAMS; |
367 | *pos++ = 1; | 368 | *pos++ = 1; |
368 | *pos++ = ieee80211_frequency_to_channel(local->hw.conf.channel->center_freq); | 369 | *pos++ = ieee80211_frequency_to_channel(chan->center_freq); |
369 | } | 370 | } |
370 | 371 | ||
371 | return 0; | 372 | return 0; |
@@ -380,7 +381,7 @@ int mesh_add_ht_cap_ie(struct sk_buff *skb, | |||
380 | 381 | ||
381 | sband = local->hw.wiphy->bands[local->oper_channel->band]; | 382 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
382 | if (!sband->ht_cap.ht_supported || | 383 | if (!sband->ht_cap.ht_supported || |
383 | local->_oper_channel_type == NL80211_CHAN_NO_HT) | 384 | sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) |
384 | return 0; | 385 | return 0; |
385 | 386 | ||
386 | if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap)) | 387 | if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap)) |
@@ -397,7 +398,8 @@ int mesh_add_ht_oper_ie(struct sk_buff *skb, | |||
397 | { | 398 | { |
398 | struct ieee80211_local *local = sdata->local; | 399 | struct ieee80211_local *local = sdata->local; |
399 | struct ieee80211_channel *channel = local->oper_channel; | 400 | struct ieee80211_channel *channel = local->oper_channel; |
400 | enum nl80211_channel_type channel_type = local->_oper_channel_type; | 401 | enum nl80211_channel_type channel_type = |
402 | sdata->vif.bss_conf.channel_type; | ||
401 | struct ieee80211_supported_band *sband = | 403 | struct ieee80211_supported_band *sband = |
402 | local->hw.wiphy->bands[channel->band]; | 404 | local->hw.wiphy->bands[channel->band]; |
403 | struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap; | 405 | struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap; |
@@ -608,12 +610,14 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) | |||
608 | sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL; | 610 | sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL; |
609 | sdata->vif.bss_conf.basic_rates = | 611 | sdata->vif.bss_conf.basic_rates = |
610 | ieee80211_mandatory_rates(sdata->local, | 612 | ieee80211_mandatory_rates(sdata->local, |
611 | sdata->local->hw.conf.channel->band); | 613 | sdata->local->oper_channel->band); |
612 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON | | 614 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON | |
613 | BSS_CHANGED_BEACON_ENABLED | | 615 | BSS_CHANGED_BEACON_ENABLED | |
614 | BSS_CHANGED_HT | | 616 | BSS_CHANGED_HT | |
615 | BSS_CHANGED_BASIC_RATES | | 617 | BSS_CHANGED_BASIC_RATES | |
616 | BSS_CHANGED_BEACON_INT); | 618 | BSS_CHANGED_BEACON_INT); |
619 | |||
620 | netif_carrier_on(sdata->dev); | ||
617 | } | 621 | } |
618 | 622 | ||
619 | void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) | 623 | void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) |
@@ -621,9 +625,15 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) | |||
621 | struct ieee80211_local *local = sdata->local; | 625 | struct ieee80211_local *local = sdata->local; |
622 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | 626 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
623 | 627 | ||
628 | netif_carrier_off(sdata->dev); | ||
629 | |||
630 | /* stop the beacon */ | ||
624 | ifmsh->mesh_id_len = 0; | 631 | ifmsh->mesh_id_len = 0; |
625 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); | 632 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); |
626 | sta_info_flush(local, NULL); | 633 | |
634 | /* flush STAs and mpaths on this iface */ | ||
635 | sta_info_flush(sdata->local, sdata); | ||
636 | mesh_path_flush_by_iface(sdata); | ||
627 | 637 | ||
628 | del_timer_sync(&sdata->u.mesh.housekeeping_timer); | 638 | del_timer_sync(&sdata->u.mesh.housekeeping_timer); |
629 | del_timer_sync(&sdata->u.mesh.mesh_path_root_timer); | 639 | del_timer_sync(&sdata->u.mesh.mesh_path_root_timer); |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 13fd5b5fdb0a..25d0f17dec71 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -215,6 +215,9 @@ struct mesh_rmc { | |||
215 | /* Maximum number of paths per interface */ | 215 | /* Maximum number of paths per interface */ |
216 | #define MESH_MAX_MPATHS 1024 | 216 | #define MESH_MAX_MPATHS 1024 |
217 | 217 | ||
218 | /* Number of frames buffered per destination for unresolved destinations */ | ||
219 | #define MESH_FRAME_QUEUE_LEN 10 | ||
220 | |||
218 | /* Public interfaces */ | 221 | /* Public interfaces */ |
219 | /* Various */ | 222 | /* Various */ |
220 | int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, | 223 | int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 494bc39f61a4..47aeee2d8db1 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -17,8 +17,6 @@ | |||
17 | #define MAX_METRIC 0xffffffff | 17 | #define MAX_METRIC 0xffffffff |
18 | #define ARITH_SHIFT 8 | 18 | #define ARITH_SHIFT 8 |
19 | 19 | ||
20 | /* Number of frames buffered per destination for unresolved destinations */ | ||
21 | #define MESH_FRAME_QUEUE_LEN 10 | ||
22 | #define MAX_PREQ_QUEUE_LEN 64 | 20 | #define MAX_PREQ_QUEUE_LEN 64 |
23 | 21 | ||
24 | /* Destination only */ | 22 | /* Destination only */ |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 075bc535c601..aa749818860e 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -203,23 +203,17 @@ void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta) | |||
203 | { | 203 | { |
204 | struct sk_buff *skb; | 204 | struct sk_buff *skb; |
205 | struct ieee80211_hdr *hdr; | 205 | struct ieee80211_hdr *hdr; |
206 | struct sk_buff_head tmpq; | ||
207 | unsigned long flags; | 206 | unsigned long flags; |
208 | 207 | ||
209 | rcu_assign_pointer(mpath->next_hop, sta); | 208 | rcu_assign_pointer(mpath->next_hop, sta); |
210 | 209 | ||
211 | __skb_queue_head_init(&tmpq); | ||
212 | |||
213 | spin_lock_irqsave(&mpath->frame_queue.lock, flags); | 210 | spin_lock_irqsave(&mpath->frame_queue.lock, flags); |
214 | 211 | skb_queue_walk(&mpath->frame_queue, skb) { | |
215 | while ((skb = __skb_dequeue(&mpath->frame_queue)) != NULL) { | ||
216 | hdr = (struct ieee80211_hdr *) skb->data; | 212 | hdr = (struct ieee80211_hdr *) skb->data; |
217 | memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN); | 213 | memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN); |
218 | memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN); | 214 | memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN); |
219 | __skb_queue_tail(&tmpq, skb); | ||
220 | } | 215 | } |
221 | 216 | ||
222 | skb_queue_splice(&tmpq, &mpath->frame_queue); | ||
223 | spin_unlock_irqrestore(&mpath->frame_queue.lock, flags); | 217 | spin_unlock_irqrestore(&mpath->frame_queue.lock, flags); |
224 | } | 218 | } |
225 | 219 | ||
@@ -285,40 +279,42 @@ static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, | |||
285 | struct mesh_path *from_mpath, | 279 | struct mesh_path *from_mpath, |
286 | bool copy) | 280 | bool copy) |
287 | { | 281 | { |
288 | struct sk_buff *skb, *cp_skb = NULL; | 282 | struct sk_buff *skb, *fskb, *tmp; |
289 | struct sk_buff_head gateq, failq; | 283 | struct sk_buff_head failq; |
290 | unsigned long flags; | 284 | unsigned long flags; |
291 | int num_skbs; | ||
292 | 285 | ||
293 | BUG_ON(gate_mpath == from_mpath); | 286 | BUG_ON(gate_mpath == from_mpath); |
294 | BUG_ON(!gate_mpath->next_hop); | 287 | BUG_ON(!gate_mpath->next_hop); |
295 | 288 | ||
296 | __skb_queue_head_init(&gateq); | ||
297 | __skb_queue_head_init(&failq); | 289 | __skb_queue_head_init(&failq); |
298 | 290 | ||
299 | spin_lock_irqsave(&from_mpath->frame_queue.lock, flags); | 291 | spin_lock_irqsave(&from_mpath->frame_queue.lock, flags); |
300 | skb_queue_splice_init(&from_mpath->frame_queue, &failq); | 292 | skb_queue_splice_init(&from_mpath->frame_queue, &failq); |
301 | spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags); | 293 | spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags); |
302 | 294 | ||
303 | num_skbs = skb_queue_len(&failq); | 295 | skb_queue_walk_safe(&failq, fskb, tmp) { |
304 | 296 | if (skb_queue_len(&gate_mpath->frame_queue) >= | |
305 | while (num_skbs--) { | 297 | MESH_FRAME_QUEUE_LEN) { |
306 | skb = __skb_dequeue(&failq); | 298 | mpath_dbg(gate_mpath->sdata, "mpath queue full!\n"); |
307 | if (copy) { | 299 | break; |
308 | cp_skb = skb_copy(skb, GFP_ATOMIC); | ||
309 | if (cp_skb) | ||
310 | __skb_queue_tail(&failq, cp_skb); | ||
311 | } | 300 | } |
312 | 301 | ||
302 | skb = skb_copy(fskb, GFP_ATOMIC); | ||
303 | if (WARN_ON(!skb)) | ||
304 | break; | ||
305 | |||
313 | prepare_for_gate(skb, gate_mpath->dst, gate_mpath); | 306 | prepare_for_gate(skb, gate_mpath->dst, gate_mpath); |
314 | __skb_queue_tail(&gateq, skb); | 307 | skb_queue_tail(&gate_mpath->frame_queue, skb); |
308 | |||
309 | if (copy) | ||
310 | continue; | ||
311 | |||
312 | __skb_unlink(fskb, &failq); | ||
313 | kfree_skb(fskb); | ||
315 | } | 314 | } |
316 | 315 | ||
317 | spin_lock_irqsave(&gate_mpath->frame_queue.lock, flags); | ||
318 | skb_queue_splice(&gateq, &gate_mpath->frame_queue); | ||
319 | mpath_dbg(gate_mpath->sdata, "Mpath queue for gate %pM has %d frames\n", | 316 | mpath_dbg(gate_mpath->sdata, "Mpath queue for gate %pM has %d frames\n", |
320 | gate_mpath->dst, skb_queue_len(&gate_mpath->frame_queue)); | 317 | gate_mpath->dst, skb_queue_len(&gate_mpath->frame_queue)); |
321 | spin_unlock_irqrestore(&gate_mpath->frame_queue.lock, flags); | ||
322 | 318 | ||
323 | if (!copy) | 319 | if (!copy) |
324 | return; | 320 | return; |
@@ -531,7 +527,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata) | |||
531 | 527 | ||
532 | read_lock_bh(&pathtbl_resize_lock); | 528 | read_lock_bh(&pathtbl_resize_lock); |
533 | memcpy(new_mpath->dst, dst, ETH_ALEN); | 529 | memcpy(new_mpath->dst, dst, ETH_ALEN); |
534 | memset(new_mpath->rann_snd_addr, 0xff, ETH_ALEN); | 530 | eth_broadcast_addr(new_mpath->rann_snd_addr); |
535 | new_mpath->is_root = false; | 531 | new_mpath->is_root = false; |
536 | new_mpath->sdata = sdata; | 532 | new_mpath->sdata = sdata; |
537 | new_mpath->flags = 0; | 533 | new_mpath->flags = 0; |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index f20e9f26d137..9d7ad366ef09 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -117,7 +117,7 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata) | |||
117 | u16 ht_opmode; | 117 | u16 ht_opmode; |
118 | bool non_ht_sta = false, ht20_sta = false; | 118 | bool non_ht_sta = false, ht20_sta = false; |
119 | 119 | ||
120 | if (local->_oper_channel_type == NL80211_CHAN_NO_HT) | 120 | if (sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) |
121 | return 0; | 121 | return 0; |
122 | 122 | ||
123 | rcu_read_lock(); | 123 | rcu_read_lock(); |
@@ -147,7 +147,8 @@ out: | |||
147 | 147 | ||
148 | if (non_ht_sta) | 148 | if (non_ht_sta) |
149 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; | 149 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
150 | else if (ht20_sta && local->_oper_channel_type > NL80211_CHAN_HT20) | 150 | else if (ht20_sta && |
151 | sdata->vif.bss_conf.channel_type > NL80211_CHAN_HT20) | ||
151 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; | 152 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
152 | else | 153 | else |
153 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONE; | 154 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
@@ -215,12 +216,14 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
215 | u8 *da, __le16 llid, __le16 plid, __le16 reason) { | 216 | u8 *da, __le16 llid, __le16 plid, __le16 reason) { |
216 | struct ieee80211_local *local = sdata->local; | 217 | struct ieee80211_local *local = sdata->local; |
217 | struct sk_buff *skb; | 218 | struct sk_buff *skb; |
219 | struct ieee80211_tx_info *info; | ||
218 | struct ieee80211_mgmt *mgmt; | 220 | struct ieee80211_mgmt *mgmt; |
219 | bool include_plid = false; | 221 | bool include_plid = false; |
220 | u16 peering_proto = 0; | 222 | u16 peering_proto = 0; |
221 | u8 *pos, ie_len = 4; | 223 | u8 *pos, ie_len = 4; |
222 | int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) + | 224 | int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) + |
223 | sizeof(mgmt->u.action.u.self_prot); | 225 | sizeof(mgmt->u.action.u.self_prot); |
226 | int err = -ENOMEM; | ||
224 | 227 | ||
225 | skb = dev_alloc_skb(local->tx_headroom + | 228 | skb = dev_alloc_skb(local->tx_headroom + |
226 | hdr_len + | 229 | hdr_len + |
@@ -236,6 +239,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
236 | sdata->u.mesh.ie_len); | 239 | sdata->u.mesh.ie_len); |
237 | if (!skb) | 240 | if (!skb) |
238 | return -1; | 241 | return -1; |
242 | info = IEEE80211_SKB_CB(skb); | ||
239 | skb_reserve(skb, local->tx_headroom); | 243 | skb_reserve(skb, local->tx_headroom); |
240 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); | 244 | mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); |
241 | memset(mgmt, 0, hdr_len); | 245 | memset(mgmt, 0, hdr_len); |
@@ -256,15 +260,18 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
256 | pos = skb_put(skb, 2); | 260 | pos = skb_put(skb, 2); |
257 | memcpy(pos + 2, &plid, 2); | 261 | memcpy(pos + 2, &plid, 2); |
258 | } | 262 | } |
259 | if (ieee80211_add_srates_ie(sdata, skb, true) || | 263 | if (ieee80211_add_srates_ie(sdata, skb, true, |
260 | ieee80211_add_ext_srates_ie(sdata, skb, true) || | 264 | local->oper_channel->band) || |
265 | ieee80211_add_ext_srates_ie(sdata, skb, true, | ||
266 | local->oper_channel->band) || | ||
261 | mesh_add_rsn_ie(skb, sdata) || | 267 | mesh_add_rsn_ie(skb, sdata) || |
262 | mesh_add_meshid_ie(skb, sdata) || | 268 | mesh_add_meshid_ie(skb, sdata) || |
263 | mesh_add_meshconf_ie(skb, sdata)) | 269 | mesh_add_meshconf_ie(skb, sdata)) |
264 | return -1; | 270 | goto free; |
265 | } else { /* WLAN_SP_MESH_PEERING_CLOSE */ | 271 | } else { /* WLAN_SP_MESH_PEERING_CLOSE */ |
272 | info->flags |= IEEE80211_TX_CTL_NO_ACK; | ||
266 | if (mesh_add_meshid_ie(skb, sdata)) | 273 | if (mesh_add_meshid_ie(skb, sdata)) |
267 | return -1; | 274 | goto free; |
268 | } | 275 | } |
269 | 276 | ||
270 | /* Add Mesh Peering Management element */ | 277 | /* Add Mesh Peering Management element */ |
@@ -283,11 +290,12 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
283 | ie_len += 2; /* reason code */ | 290 | ie_len += 2; /* reason code */ |
284 | break; | 291 | break; |
285 | default: | 292 | default: |
286 | return -EINVAL; | 293 | err = -EINVAL; |
294 | goto free; | ||
287 | } | 295 | } |
288 | 296 | ||
289 | if (WARN_ON(skb_tailroom(skb) < 2 + ie_len)) | 297 | if (WARN_ON(skb_tailroom(skb) < 2 + ie_len)) |
290 | return -ENOMEM; | 298 | goto free; |
291 | 299 | ||
292 | pos = skb_put(skb, 2 + ie_len); | 300 | pos = skb_put(skb, 2 + ie_len); |
293 | *pos++ = WLAN_EID_PEER_MGMT; | 301 | *pos++ = WLAN_EID_PEER_MGMT; |
@@ -308,14 +316,17 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
308 | if (action != WLAN_SP_MESH_PEERING_CLOSE) { | 316 | if (action != WLAN_SP_MESH_PEERING_CLOSE) { |
309 | if (mesh_add_ht_cap_ie(skb, sdata) || | 317 | if (mesh_add_ht_cap_ie(skb, sdata) || |
310 | mesh_add_ht_oper_ie(skb, sdata)) | 318 | mesh_add_ht_oper_ie(skb, sdata)) |
311 | return -1; | 319 | goto free; |
312 | } | 320 | } |
313 | 321 | ||
314 | if (mesh_add_vendor_ies(skb, sdata)) | 322 | if (mesh_add_vendor_ies(skb, sdata)) |
315 | return -1; | 323 | goto free; |
316 | 324 | ||
317 | ieee80211_tx_skb(sdata, skb); | 325 | ieee80211_tx_skb(sdata, skb); |
318 | return 0; | 326 | return 0; |
327 | free: | ||
328 | kfree_skb(skb); | ||
329 | return err; | ||
319 | } | 330 | } |
320 | 331 | ||
321 | /** | 332 | /** |
@@ -360,9 +371,14 @@ static struct sta_info *mesh_peer_init(struct ieee80211_sub_if_data *sdata, | |||
360 | 371 | ||
361 | spin_lock_bh(&sta->lock); | 372 | spin_lock_bh(&sta->lock); |
362 | sta->last_rx = jiffies; | 373 | sta->last_rx = jiffies; |
374 | if (sta->plink_state == NL80211_PLINK_ESTAB) { | ||
375 | spin_unlock_bh(&sta->lock); | ||
376 | return sta; | ||
377 | } | ||
378 | |||
363 | sta->sta.supp_rates[band] = rates; | 379 | sta->sta.supp_rates[band] = rates; |
364 | if (elems->ht_cap_elem && | 380 | if (elems->ht_cap_elem && |
365 | sdata->local->_oper_channel_type != NL80211_CHAN_NO_HT) | 381 | sdata->vif.bss_conf.channel_type != NL80211_CHAN_NO_HT) |
366 | ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, | 382 | ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, |
367 | elems->ht_cap_elem, | 383 | elems->ht_cap_elem, |
368 | &sta->sta.ht_cap); | 384 | &sta->sta.ht_cap); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index cef0c9e79aba..b65b2149b23b 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -146,6 +146,9 @@ void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata) | |||
146 | if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) | 146 | if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) |
147 | return; | 147 | return; |
148 | 148 | ||
149 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) | ||
150 | return; | ||
151 | |||
149 | mod_timer(&sdata->u.mgd.bcn_mon_timer, | 152 | mod_timer(&sdata->u.mgd.bcn_mon_timer, |
150 | round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout)); | 153 | round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout)); |
151 | } | 154 | } |
@@ -182,15 +185,15 @@ static u32 ieee80211_config_ht_tx(struct ieee80211_sub_if_data *sdata, | |||
182 | u16 ht_opmode; | 185 | u16 ht_opmode; |
183 | bool disable_40 = false; | 186 | bool disable_40 = false; |
184 | 187 | ||
185 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 188 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
186 | 189 | ||
187 | switch (sdata->vif.bss_conf.channel_type) { | 190 | switch (sdata->vif.bss_conf.channel_type) { |
188 | case NL80211_CHAN_HT40PLUS: | 191 | case NL80211_CHAN_HT40PLUS: |
189 | if (local->hw.conf.channel->flags & IEEE80211_CHAN_NO_HT40PLUS) | 192 | if (local->oper_channel->flags & IEEE80211_CHAN_NO_HT40PLUS) |
190 | disable_40 = true; | 193 | disable_40 = true; |
191 | break; | 194 | break; |
192 | case NL80211_CHAN_HT40MINUS: | 195 | case NL80211_CHAN_HT40MINUS: |
193 | if (local->hw.conf.channel->flags & IEEE80211_CHAN_NO_HT40MINUS) | 196 | if (local->oper_channel->flags & IEEE80211_CHAN_NO_HT40MINUS) |
194 | disable_40 = true; | 197 | disable_40 = true; |
195 | break; | 198 | break; |
196 | default: | 199 | default: |
@@ -326,6 +329,26 @@ static void ieee80211_add_ht_ie(struct ieee80211_sub_if_data *sdata, | |||
326 | ieee80211_ie_build_ht_cap(pos, &ht_cap, cap); | 329 | ieee80211_ie_build_ht_cap(pos, &ht_cap, cap); |
327 | } | 330 | } |
328 | 331 | ||
332 | static void ieee80211_add_vht_ie(struct ieee80211_sub_if_data *sdata, | ||
333 | struct sk_buff *skb, | ||
334 | struct ieee80211_supported_band *sband) | ||
335 | { | ||
336 | u8 *pos; | ||
337 | u32 cap; | ||
338 | struct ieee80211_sta_vht_cap vht_cap; | ||
339 | |||
340 | BUILD_BUG_ON(sizeof(vht_cap) != sizeof(sband->vht_cap)); | ||
341 | |||
342 | memcpy(&vht_cap, &sband->vht_cap, sizeof(vht_cap)); | ||
343 | |||
344 | /* determine capability flags */ | ||
345 | cap = vht_cap.cap; | ||
346 | |||
347 | /* reserve and fill IE */ | ||
348 | pos = skb_put(skb, sizeof(struct ieee80211_vht_capabilities) + 2); | ||
349 | ieee80211_ie_build_vht_cap(pos, &vht_cap, cap); | ||
350 | } | ||
351 | |||
329 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | 352 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) |
330 | { | 353 | { |
331 | struct ieee80211_local *local = sdata->local; | 354 | struct ieee80211_local *local = sdata->local; |
@@ -371,6 +394,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | |||
371 | 4 + /* power capability */ | 394 | 4 + /* power capability */ |
372 | 2 + 2 * sband->n_channels + /* supported channels */ | 395 | 2 + 2 * sband->n_channels + /* supported channels */ |
373 | 2 + sizeof(struct ieee80211_ht_cap) + /* HT */ | 396 | 2 + sizeof(struct ieee80211_ht_cap) + /* HT */ |
397 | 2 + sizeof(struct ieee80211_vht_capabilities) + /* VHT */ | ||
374 | assoc_data->ie_len + /* extra IEs */ | 398 | assoc_data->ie_len + /* extra IEs */ |
375 | 9, /* WMM */ | 399 | 9, /* WMM */ |
376 | GFP_KERNEL); | 400 | GFP_KERNEL); |
@@ -503,6 +527,9 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | |||
503 | ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param, | 527 | ieee80211_add_ht_ie(sdata, skb, assoc_data->ap_ht_param, |
504 | sband, local->oper_channel, ifmgd->ap_smps); | 528 | sband, local->oper_channel, ifmgd->ap_smps); |
505 | 529 | ||
530 | if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) | ||
531 | ieee80211_add_vht_ie(sdata, skb, sband); | ||
532 | |||
506 | /* if present, add any custom non-vendor IEs that go after HT */ | 533 | /* if present, add any custom non-vendor IEs that go after HT */ |
507 | if (assoc_data->ie_len && assoc_data->ie) { | 534 | if (assoc_data->ie_len && assoc_data->ie) { |
508 | noffset = ieee80211_ie_split_vendor(assoc_data->ie, | 535 | noffset = ieee80211_ie_split_vendor(assoc_data->ie, |
@@ -583,8 +610,6 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, | |||
583 | IEEE80211_SKB_CB(skb)->flags |= | 610 | IEEE80211_SKB_CB(skb)->flags |= |
584 | IEEE80211_TX_INTFL_DONT_ENCRYPT; | 611 | IEEE80211_TX_INTFL_DONT_ENCRYPT; |
585 | 612 | ||
586 | drv_mgd_prepare_tx(local, sdata); | ||
587 | |||
588 | ieee80211_tx_skb(sdata, skb); | 613 | ieee80211_tx_skb(sdata, skb); |
589 | } | 614 | } |
590 | } | 615 | } |
@@ -687,6 +712,7 @@ static void ieee80211_chswitch_work(struct work_struct *work) | |||
687 | /* XXX: shouldn't really modify cfg80211-owned data! */ | 712 | /* XXX: shouldn't really modify cfg80211-owned data! */ |
688 | ifmgd->associated->channel = sdata->local->oper_channel; | 713 | ifmgd->associated->channel = sdata->local->oper_channel; |
689 | 714 | ||
715 | /* XXX: wait for a beacon first? */ | ||
690 | ieee80211_wake_queues_by_reason(&sdata->local->hw, | 716 | ieee80211_wake_queues_by_reason(&sdata->local->hw, |
691 | IEEE80211_QUEUE_STOP_REASON_CSA); | 717 | IEEE80211_QUEUE_STOP_REASON_CSA); |
692 | out: | 718 | out: |
@@ -763,36 +789,32 @@ void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
763 | 789 | ||
764 | sdata->local->csa_channel = new_ch; | 790 | sdata->local->csa_channel = new_ch; |
765 | 791 | ||
792 | ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; | ||
793 | |||
794 | if (sw_elem->mode) | ||
795 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | ||
796 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
797 | |||
766 | if (sdata->local->ops->channel_switch) { | 798 | if (sdata->local->ops->channel_switch) { |
767 | /* use driver's channel switch callback */ | 799 | /* use driver's channel switch callback */ |
768 | struct ieee80211_channel_switch ch_switch; | 800 | struct ieee80211_channel_switch ch_switch = { |
769 | memset(&ch_switch, 0, sizeof(ch_switch)); | 801 | .timestamp = timestamp, |
770 | ch_switch.timestamp = timestamp; | 802 | .block_tx = sw_elem->mode, |
771 | if (sw_elem->mode) { | 803 | .channel = new_ch, |
772 | ch_switch.block_tx = true; | 804 | .count = sw_elem->count, |
773 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | 805 | }; |
774 | IEEE80211_QUEUE_STOP_REASON_CSA); | 806 | |
775 | } | ||
776 | ch_switch.channel = new_ch; | ||
777 | ch_switch.count = sw_elem->count; | ||
778 | ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; | ||
779 | drv_channel_switch(sdata->local, &ch_switch); | 807 | drv_channel_switch(sdata->local, &ch_switch); |
780 | return; | 808 | return; |
781 | } | 809 | } |
782 | 810 | ||
783 | /* channel switch handled in software */ | 811 | /* channel switch handled in software */ |
784 | if (sw_elem->count <= 1) { | 812 | if (sw_elem->count <= 1) |
785 | ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); | 813 | ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); |
786 | } else { | 814 | else |
787 | if (sw_elem->mode) | ||
788 | ieee80211_stop_queues_by_reason(&sdata->local->hw, | ||
789 | IEEE80211_QUEUE_STOP_REASON_CSA); | ||
790 | ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; | ||
791 | mod_timer(&ifmgd->chswitch_timer, | 815 | mod_timer(&ifmgd->chswitch_timer, |
792 | jiffies + | 816 | TU_TO_EXP_TIME(sw_elem->count * |
793 | msecs_to_jiffies(sw_elem->count * | 817 | cbss->beacon_interval)); |
794 | cbss->beacon_interval)); | ||
795 | } | ||
796 | } | 818 | } |
797 | 819 | ||
798 | static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, | 820 | static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, |
@@ -1007,6 +1029,16 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) | |||
1007 | ieee80211_change_ps(local); | 1029 | ieee80211_change_ps(local); |
1008 | } | 1030 | } |
1009 | 1031 | ||
1032 | void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata) | ||
1033 | { | ||
1034 | bool ps_allowed = ieee80211_powersave_allowed(sdata); | ||
1035 | |||
1036 | if (sdata->vif.bss_conf.ps != ps_allowed) { | ||
1037 | sdata->vif.bss_conf.ps = ps_allowed; | ||
1038 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_PS); | ||
1039 | } | ||
1040 | } | ||
1041 | |||
1010 | void ieee80211_dynamic_ps_disable_work(struct work_struct *work) | 1042 | void ieee80211_dynamic_ps_disable_work(struct work_struct *work) |
1011 | { | 1043 | { |
1012 | struct ieee80211_local *local = | 1044 | struct ieee80211_local *local = |
@@ -1239,7 +1271,7 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, | |||
1239 | } | 1271 | } |
1240 | 1272 | ||
1241 | use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME); | 1273 | use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME); |
1242 | if (sdata->local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) | 1274 | if (sdata->local->oper_channel->band == IEEE80211_BAND_5GHZ) |
1243 | use_short_slot = true; | 1275 | use_short_slot = true; |
1244 | 1276 | ||
1245 | if (use_protection != bss_conf->use_cts_prot) { | 1277 | if (use_protection != bss_conf->use_cts_prot) { |
@@ -1310,6 +1342,8 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
1310 | ieee80211_recalc_smps(local); | 1342 | ieee80211_recalc_smps(local); |
1311 | mutex_unlock(&local->iflist_mtx); | 1343 | mutex_unlock(&local->iflist_mtx); |
1312 | 1344 | ||
1345 | ieee80211_recalc_ps_vif(sdata); | ||
1346 | |||
1313 | netif_tx_start_all_queues(sdata->dev); | 1347 | netif_tx_start_all_queues(sdata->dev); |
1314 | netif_carrier_on(sdata->dev); | 1348 | netif_carrier_on(sdata->dev); |
1315 | } | 1349 | } |
@@ -1371,6 +1405,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1371 | } | 1405 | } |
1372 | local->ps_sdata = NULL; | 1406 | local->ps_sdata = NULL; |
1373 | 1407 | ||
1408 | /* disable per-vif ps */ | ||
1409 | ieee80211_recalc_ps_vif(sdata); | ||
1410 | |||
1374 | /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */ | 1411 | /* flush out any pending frame (e.g. DELBA) before deauth/disassoc */ |
1375 | if (tx) | 1412 | if (tx) |
1376 | drv_flush(local, false); | 1413 | drv_flush(local, false); |
@@ -1540,7 +1577,8 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) | |||
1540 | ssid_len = ssid[1]; | 1577 | ssid_len = ssid[1]; |
1541 | 1578 | ||
1542 | ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid_len, NULL, | 1579 | ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid_len, NULL, |
1543 | 0, (u32) -1, true, false); | 1580 | 0, (u32) -1, true, false, |
1581 | ifmgd->associated->channel); | ||
1544 | } | 1582 | } |
1545 | 1583 | ||
1546 | ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); | 1584 | ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); |
@@ -1643,7 +1681,9 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, | |||
1643 | ssid_len = ssid[1]; | 1681 | ssid_len = ssid[1]; |
1644 | 1682 | ||
1645 | skb = ieee80211_build_probe_req(sdata, cbss->bssid, | 1683 | skb = ieee80211_build_probe_req(sdata, cbss->bssid, |
1646 | (u32) -1, ssid + 2, ssid_len, | 1684 | (u32) -1, |
1685 | sdata->local->oper_channel, | ||
1686 | ssid + 2, ssid_len, | ||
1647 | NULL, 0, true); | 1687 | NULL, 0, true); |
1648 | 1688 | ||
1649 | return skb; | 1689 | return skb; |
@@ -1654,7 +1694,6 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata) | |||
1654 | { | 1694 | { |
1655 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 1695 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
1656 | struct ieee80211_local *local = sdata->local; | 1696 | struct ieee80211_local *local = sdata->local; |
1657 | u8 bssid[ETH_ALEN]; | ||
1658 | u8 frame_buf[DEAUTH_DISASSOC_LEN]; | 1697 | u8 frame_buf[DEAUTH_DISASSOC_LEN]; |
1659 | 1698 | ||
1660 | mutex_lock(&ifmgd->mtx); | 1699 | mutex_lock(&ifmgd->mtx); |
@@ -1663,9 +1702,8 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata) | |||
1663 | return; | 1702 | return; |
1664 | } | 1703 | } |
1665 | 1704 | ||
1666 | memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); | 1705 | sdata_info(sdata, "Connection to AP %pM lost\n", |
1667 | 1706 | ifmgd->associated->bssid); | |
1668 | sdata_info(sdata, "Connection to AP %pM lost\n", bssid); | ||
1669 | 1707 | ||
1670 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 1708 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
1671 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, | 1709 | WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, |
@@ -1683,7 +1721,7 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata) | |||
1683 | mutex_unlock(&local->mtx); | 1721 | mutex_unlock(&local->mtx); |
1684 | } | 1722 | } |
1685 | 1723 | ||
1686 | void ieee80211_beacon_connection_loss_work(struct work_struct *work) | 1724 | static void ieee80211_beacon_connection_loss_work(struct work_struct *work) |
1687 | { | 1725 | { |
1688 | struct ieee80211_sub_if_data *sdata = | 1726 | struct ieee80211_sub_if_data *sdata = |
1689 | container_of(work, struct ieee80211_sub_if_data, | 1727 | container_of(work, struct ieee80211_sub_if_data, |
@@ -2230,14 +2268,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
2230 | mutex_unlock(&local->iflist_mtx); | 2268 | mutex_unlock(&local->iflist_mtx); |
2231 | } | 2269 | } |
2232 | 2270 | ||
2233 | if (elems->ch_switch_elem && (elems->ch_switch_elem_len == 3) && | 2271 | if (elems->ch_switch_ie && |
2234 | (memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, | 2272 | memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, ETH_ALEN) == 0) |
2235 | ETH_ALEN) == 0)) { | 2273 | ieee80211_sta_process_chanswitch(sdata, elems->ch_switch_ie, |
2236 | struct ieee80211_channel_sw_ie *sw_elem = | ||
2237 | (struct ieee80211_channel_sw_ie *)elems->ch_switch_elem; | ||
2238 | ieee80211_sta_process_chanswitch(sdata, sw_elem, | ||
2239 | bss, rx_status->mactime); | 2274 | bss, rx_status->mactime); |
2240 | } | ||
2241 | } | 2275 | } |
2242 | 2276 | ||
2243 | 2277 | ||
@@ -2324,7 +2358,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
2324 | if (baselen > len) | 2358 | if (baselen > len) |
2325 | return; | 2359 | return; |
2326 | 2360 | ||
2327 | if (rx_status->freq != local->hw.conf.channel->center_freq) | 2361 | if (rx_status->freq != local->oper_channel->center_freq) |
2328 | return; | 2362 | return; |
2329 | 2363 | ||
2330 | if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon && | 2364 | if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon && |
@@ -2488,7 +2522,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
2488 | !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) { | 2522 | !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) { |
2489 | struct ieee80211_supported_band *sband; | 2523 | struct ieee80211_supported_band *sband; |
2490 | 2524 | ||
2491 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 2525 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
2492 | 2526 | ||
2493 | changed |= ieee80211_config_ht_tx(sdata, elems.ht_operation, | 2527 | changed |= ieee80211_config_ht_tx(sdata, elems.ht_operation, |
2494 | bssid, true); | 2528 | bssid, true); |
@@ -2671,7 +2705,8 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) | |||
2671 | * will not answer to direct packet in unassociated state. | 2705 | * will not answer to direct packet in unassociated state. |
2672 | */ | 2706 | */ |
2673 | ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], | 2707 | ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], |
2674 | NULL, 0, (u32) -1, true, false); | 2708 | NULL, 0, (u32) -1, true, false, |
2709 | auth_data->bss->channel); | ||
2675 | } | 2710 | } |
2676 | 2711 | ||
2677 | auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; | 2712 | auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; |
@@ -2998,41 +3033,17 @@ int ieee80211_max_network_latency(struct notifier_block *nb, | |||
2998 | return 0; | 3033 | return 0; |
2999 | } | 3034 | } |
3000 | 3035 | ||
3001 | static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | 3036 | static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, |
3002 | struct cfg80211_bss *cbss, bool assoc) | 3037 | struct cfg80211_bss *cbss) |
3003 | { | 3038 | { |
3004 | struct ieee80211_local *local = sdata->local; | 3039 | struct ieee80211_local *local = sdata->local; |
3005 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 3040 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
3006 | struct ieee80211_bss *bss = (void *)cbss->priv; | ||
3007 | struct sta_info *sta = NULL; | ||
3008 | bool have_sta = false; | ||
3009 | int err; | ||
3010 | int ht_cfreq; | 3041 | int ht_cfreq; |
3011 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | 3042 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; |
3012 | const u8 *ht_oper_ie; | 3043 | const u8 *ht_oper_ie; |
3013 | const struct ieee80211_ht_operation *ht_oper = NULL; | 3044 | const struct ieee80211_ht_operation *ht_oper = NULL; |
3014 | struct ieee80211_supported_band *sband; | 3045 | struct ieee80211_supported_band *sband; |
3015 | 3046 | ||
3016 | if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) | ||
3017 | return -EINVAL; | ||
3018 | |||
3019 | if (assoc) { | ||
3020 | rcu_read_lock(); | ||
3021 | have_sta = sta_info_get(sdata, cbss->bssid); | ||
3022 | rcu_read_unlock(); | ||
3023 | } | ||
3024 | |||
3025 | if (!have_sta) { | ||
3026 | sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL); | ||
3027 | if (!sta) | ||
3028 | return -ENOMEM; | ||
3029 | } | ||
3030 | |||
3031 | mutex_lock(&local->mtx); | ||
3032 | ieee80211_recalc_idle(sdata->local); | ||
3033 | mutex_unlock(&local->mtx); | ||
3034 | |||
3035 | /* switch to the right channel */ | ||
3036 | sband = local->hw.wiphy->bands[cbss->channel->band]; | 3047 | sband = local->hw.wiphy->bands[cbss->channel->band]; |
3037 | 3048 | ||
3038 | ifmgd->flags &= ~IEEE80211_STA_DISABLE_40MHZ; | 3049 | ifmgd->flags &= ~IEEE80211_STA_DISABLE_40MHZ; |
@@ -3095,10 +3106,51 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3095 | local->oper_channel = cbss->channel; | 3106 | local->oper_channel = cbss->channel; |
3096 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | 3107 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
3097 | 3108 | ||
3098 | if (sta) { | 3109 | return 0; |
3110 | } | ||
3111 | |||
3112 | static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | ||
3113 | struct cfg80211_bss *cbss, bool assoc) | ||
3114 | { | ||
3115 | struct ieee80211_local *local = sdata->local; | ||
3116 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
3117 | struct ieee80211_bss *bss = (void *)cbss->priv; | ||
3118 | struct sta_info *new_sta = NULL; | ||
3119 | bool have_sta = false; | ||
3120 | int err; | ||
3121 | |||
3122 | if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) | ||
3123 | return -EINVAL; | ||
3124 | |||
3125 | if (assoc) { | ||
3126 | rcu_read_lock(); | ||
3127 | have_sta = sta_info_get(sdata, cbss->bssid); | ||
3128 | rcu_read_unlock(); | ||
3129 | } | ||
3130 | |||
3131 | if (!have_sta) { | ||
3132 | new_sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL); | ||
3133 | if (!new_sta) | ||
3134 | return -ENOMEM; | ||
3135 | } | ||
3136 | |||
3137 | mutex_lock(&local->mtx); | ||
3138 | ieee80211_recalc_idle(sdata->local); | ||
3139 | mutex_unlock(&local->mtx); | ||
3140 | |||
3141 | if (new_sta) { | ||
3099 | u32 rates = 0, basic_rates = 0; | 3142 | u32 rates = 0, basic_rates = 0; |
3100 | bool have_higher_than_11mbit; | 3143 | bool have_higher_than_11mbit; |
3101 | int min_rate = INT_MAX, min_rate_index = -1; | 3144 | int min_rate = INT_MAX, min_rate_index = -1; |
3145 | struct ieee80211_supported_band *sband; | ||
3146 | |||
3147 | sband = local->hw.wiphy->bands[cbss->channel->band]; | ||
3148 | |||
3149 | err = ieee80211_prep_channel(sdata, cbss); | ||
3150 | if (err) { | ||
3151 | sta_info_free(local, new_sta); | ||
3152 | return err; | ||
3153 | } | ||
3102 | 3154 | ||
3103 | ieee80211_get_rates(sband, bss->supp_rates, | 3155 | ieee80211_get_rates(sband, bss->supp_rates, |
3104 | bss->supp_rates_len, | 3156 | bss->supp_rates_len, |
@@ -3120,7 +3172,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3120 | basic_rates = BIT(min_rate_index); | 3172 | basic_rates = BIT(min_rate_index); |
3121 | } | 3173 | } |
3122 | 3174 | ||
3123 | sta->sta.supp_rates[cbss->channel->band] = rates; | 3175 | new_sta->sta.supp_rates[cbss->channel->band] = rates; |
3124 | sdata->vif.bss_conf.basic_rates = basic_rates; | 3176 | sdata->vif.bss_conf.basic_rates = basic_rates; |
3125 | 3177 | ||
3126 | /* cf. IEEE 802.11 9.2.12 */ | 3178 | /* cf. IEEE 802.11 9.2.12 */ |
@@ -3143,10 +3195,10 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
3143 | BSS_CHANGED_BEACON_INT); | 3195 | BSS_CHANGED_BEACON_INT); |
3144 | 3196 | ||
3145 | if (assoc) | 3197 | if (assoc) |
3146 | sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); | 3198 | sta_info_pre_move_state(new_sta, IEEE80211_STA_AUTH); |
3147 | 3199 | ||
3148 | err = sta_info_insert(sta); | 3200 | err = sta_info_insert(new_sta); |
3149 | sta = NULL; | 3201 | new_sta = NULL; |
3150 | if (err) { | 3202 | if (err) { |
3151 | sdata_info(sdata, | 3203 | sdata_info(sdata, |
3152 | "failed to insert STA entry for the AP (error %d)\n", | 3204 | "failed to insert STA entry for the AP (error %d)\n", |
@@ -3298,9 +3350,13 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
3298 | } | 3350 | } |
3299 | 3351 | ||
3300 | /* prepare assoc data */ | 3352 | /* prepare assoc data */ |
3301 | 3353 | ||
3302 | ifmgd->flags &= ~IEEE80211_STA_DISABLE_11N; | 3354 | /* |
3303 | ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; | 3355 | * keep only the 40 MHz disable bit set as it might have |
3356 | * been set during authentication already, all other bits | ||
3357 | * should be reset for a new connection | ||
3358 | */ | ||
3359 | ifmgd->flags &= IEEE80211_STA_DISABLE_40MHZ; | ||
3304 | 3360 | ||
3305 | ifmgd->beacon_crc_valid = false; | 3361 | ifmgd->beacon_crc_valid = false; |
3306 | 3362 | ||
@@ -3316,21 +3372,34 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
3316 | req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || | 3372 | req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || |
3317 | req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) { | 3373 | req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) { |
3318 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; | 3374 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; |
3375 | ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; | ||
3319 | netdev_info(sdata->dev, | 3376 | netdev_info(sdata->dev, |
3320 | "disabling HT due to WEP/TKIP use\n"); | 3377 | "disabling HT/VHT due to WEP/TKIP use\n"); |
3321 | } | 3378 | } |
3322 | } | 3379 | } |
3323 | 3380 | ||
3324 | if (req->flags & ASSOC_REQ_DISABLE_HT) | 3381 | if (req->flags & ASSOC_REQ_DISABLE_HT) { |
3325 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; | 3382 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; |
3383 | ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; | ||
3384 | } | ||
3326 | 3385 | ||
3327 | /* Also disable HT if we don't support it or the AP doesn't use WMM */ | 3386 | /* Also disable HT if we don't support it or the AP doesn't use WMM */ |
3328 | sband = local->hw.wiphy->bands[req->bss->channel->band]; | 3387 | sband = local->hw.wiphy->bands[req->bss->channel->band]; |
3329 | if (!sband->ht_cap.ht_supported || | 3388 | if (!sband->ht_cap.ht_supported || |
3330 | local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used) { | 3389 | local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used) { |
3331 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; | 3390 | ifmgd->flags |= IEEE80211_STA_DISABLE_11N; |
3332 | netdev_info(sdata->dev, | 3391 | if (!bss->wmm_used) |
3333 | "disabling HT as WMM/QoS is not supported\n"); | 3392 | netdev_info(sdata->dev, |
3393 | "disabling HT as WMM/QoS is not supported by the AP\n"); | ||
3394 | } | ||
3395 | |||
3396 | /* disable VHT if we don't support it or the AP doesn't use WMM */ | ||
3397 | if (!sband->vht_cap.vht_supported || | ||
3398 | local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used) { | ||
3399 | ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; | ||
3400 | if (!bss->wmm_used) | ||
3401 | netdev_info(sdata->dev, | ||
3402 | "disabling VHT as WMM/QoS is not supported by the AP\n"); | ||
3334 | } | 3403 | } |
3335 | 3404 | ||
3336 | memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); | 3405 | memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); |
@@ -3465,14 +3534,17 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
3465 | req->bssid, req->reason_code); | 3534 | req->bssid, req->reason_code); |
3466 | 3535 | ||
3467 | if (ifmgd->associated && | 3536 | if (ifmgd->associated && |
3468 | ether_addr_equal(ifmgd->associated->bssid, req->bssid)) | 3537 | ether_addr_equal(ifmgd->associated->bssid, req->bssid)) { |
3469 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 3538 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
3470 | req->reason_code, true, frame_buf); | 3539 | req->reason_code, true, frame_buf); |
3471 | else | 3540 | } else { |
3541 | drv_mgd_prepare_tx(sdata->local, sdata); | ||
3472 | ieee80211_send_deauth_disassoc(sdata, req->bssid, | 3542 | ieee80211_send_deauth_disassoc(sdata, req->bssid, |
3473 | IEEE80211_STYPE_DEAUTH, | 3543 | IEEE80211_STYPE_DEAUTH, |
3474 | req->reason_code, true, | 3544 | req->reason_code, true, |
3475 | frame_buf); | 3545 | frame_buf); |
3546 | } | ||
3547 | |||
3476 | mutex_unlock(&ifmgd->mtx); | 3548 | mutex_unlock(&ifmgd->mtx); |
3477 | 3549 | ||
3478 | __cfg80211_send_deauth(sdata->dev, frame_buf, DEAUTH_DISASSOC_LEN); | 3550 | __cfg80211_send_deauth(sdata->dev, frame_buf, DEAUTH_DISASSOC_LEN); |
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index 635c3250c668..507121dad082 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c | |||
@@ -116,6 +116,9 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, | |||
116 | if (!ieee80211_sdata_running(sdata)) | 116 | if (!ieee80211_sdata_running(sdata)) |
117 | continue; | 117 | continue; |
118 | 118 | ||
119 | if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
120 | continue; | ||
121 | |||
119 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) | 122 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) |
120 | set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); | 123 | set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); |
121 | 124 | ||
@@ -144,6 +147,9 @@ void ieee80211_offchannel_return(struct ieee80211_local *local, | |||
144 | 147 | ||
145 | mutex_lock(&local->iflist_mtx); | 148 | mutex_lock(&local->iflist_mtx); |
146 | list_for_each_entry(sdata, &local->interfaces, list) { | 149 | list_for_each_entry(sdata, &local->interfaces, list) { |
150 | if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
151 | continue; | ||
152 | |||
147 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) | 153 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) |
148 | clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); | 154 | clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); |
149 | 155 | ||
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h index 6e4fd32c6617..10de668eb9f6 100644 --- a/net/mac80211/rate.h +++ b/net/mac80211/rate.h | |||
@@ -56,7 +56,7 @@ static inline void rate_control_rate_init(struct sta_info *sta) | |||
56 | if (!ref) | 56 | if (!ref) |
57 | return; | 57 | return; |
58 | 58 | ||
59 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 59 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
60 | 60 | ||
61 | ref->ops->rate_init(ref->priv, sband, ista, priv_sta); | 61 | ref->ops->rate_init(ref->priv, sband, ista, priv_sta); |
62 | set_sta_flag(sta, WLAN_STA_RATE_CONTROL); | 62 | set_sta_flag(sta, WLAN_STA_RATE_CONTROL); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 0cb4edee6af5..b382605c5733 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -60,7 +60,9 @@ static inline int should_drop_frame(struct sk_buff *skb, | |||
60 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 60 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
61 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 61 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
62 | 62 | ||
63 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) | 63 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | |
64 | RX_FLAG_FAILED_PLCP_CRC | | ||
65 | RX_FLAG_AMPDU_IS_ZEROLEN)) | ||
64 | return 1; | 66 | return 1; |
65 | if (unlikely(skb->len < 16 + present_fcs_len)) | 67 | if (unlikely(skb->len < 16 + present_fcs_len)) |
66 | return 1; | 68 | return 1; |
@@ -91,6 +93,13 @@ ieee80211_rx_radiotap_len(struct ieee80211_local *local, | |||
91 | if (status->flag & RX_FLAG_HT) /* HT info */ | 93 | if (status->flag & RX_FLAG_HT) /* HT info */ |
92 | len += 3; | 94 | len += 3; |
93 | 95 | ||
96 | if (status->flag & RX_FLAG_AMPDU_DETAILS) { | ||
97 | /* padding */ | ||
98 | while (len & 3) | ||
99 | len++; | ||
100 | len += 8; | ||
101 | } | ||
102 | |||
94 | return len; | 103 | return len; |
95 | } | 104 | } |
96 | 105 | ||
@@ -215,6 +224,37 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
215 | pos++; | 224 | pos++; |
216 | *pos++ = status->rate_idx; | 225 | *pos++ = status->rate_idx; |
217 | } | 226 | } |
227 | |||
228 | if (status->flag & RX_FLAG_AMPDU_DETAILS) { | ||
229 | u16 flags = 0; | ||
230 | |||
231 | /* ensure 4 byte alignment */ | ||
232 | while ((pos - (u8 *)rthdr) & 3) | ||
233 | pos++; | ||
234 | rthdr->it_present |= | ||
235 | cpu_to_le32(1 << IEEE80211_RADIOTAP_AMPDU_STATUS); | ||
236 | put_unaligned_le32(status->ampdu_reference, pos); | ||
237 | pos += 4; | ||
238 | if (status->flag & RX_FLAG_AMPDU_REPORT_ZEROLEN) | ||
239 | flags |= IEEE80211_RADIOTAP_AMPDU_REPORT_ZEROLEN; | ||
240 | if (status->flag & RX_FLAG_AMPDU_IS_ZEROLEN) | ||
241 | flags |= IEEE80211_RADIOTAP_AMPDU_IS_ZEROLEN; | ||
242 | if (status->flag & RX_FLAG_AMPDU_LAST_KNOWN) | ||
243 | flags |= IEEE80211_RADIOTAP_AMPDU_LAST_KNOWN; | ||
244 | if (status->flag & RX_FLAG_AMPDU_IS_LAST) | ||
245 | flags |= IEEE80211_RADIOTAP_AMPDU_IS_LAST; | ||
246 | if (status->flag & RX_FLAG_AMPDU_DELIM_CRC_ERROR) | ||
247 | flags |= IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_ERR; | ||
248 | if (status->flag & RX_FLAG_AMPDU_DELIM_CRC_KNOWN) | ||
249 | flags |= IEEE80211_RADIOTAP_AMPDU_DELIM_CRC_KNOWN; | ||
250 | put_unaligned_le16(flags, pos); | ||
251 | pos += 2; | ||
252 | if (status->flag & RX_FLAG_AMPDU_DELIM_CRC_KNOWN) | ||
253 | *pos++ = status->ampdu_delimiter_crc; | ||
254 | else | ||
255 | *pos++ = 0; | ||
256 | *pos++ = 0; | ||
257 | } | ||
218 | } | 258 | } |
219 | 259 | ||
220 | /* | 260 | /* |
@@ -2268,7 +2308,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
2268 | 2308 | ||
2269 | goto queue; | 2309 | goto queue; |
2270 | case WLAN_CATEGORY_SPECTRUM_MGMT: | 2310 | case WLAN_CATEGORY_SPECTRUM_MGMT: |
2271 | if (local->hw.conf.channel->band != IEEE80211_BAND_5GHZ) | 2311 | if (status->band != IEEE80211_BAND_5GHZ) |
2272 | break; | 2312 | break; |
2273 | 2313 | ||
2274 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 2314 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
@@ -2772,8 +2812,7 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx, | |||
2772 | if (!bssid) { | 2812 | if (!bssid) { |
2773 | if (!ether_addr_equal(sdata->vif.addr, hdr->addr1)) | 2813 | if (!ether_addr_equal(sdata->vif.addr, hdr->addr1)) |
2774 | return 0; | 2814 | return 0; |
2775 | } else if (!ieee80211_bssid_match(bssid, | 2815 | } else if (!ieee80211_bssid_match(bssid, sdata->vif.addr)) { |
2776 | sdata->vif.addr)) { | ||
2777 | /* | 2816 | /* |
2778 | * Accept public action frames even when the | 2817 | * Accept public action frames even when the |
2779 | * BSSID doesn't match, this is used for P2P | 2818 | * BSSID doesn't match, this is used for P2P |
@@ -2793,9 +2832,18 @@ static int prepare_for_handlers(struct ieee80211_rx_data *rx, | |||
2793 | if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2)) | 2832 | if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2)) |
2794 | return 0; | 2833 | return 0; |
2795 | break; | 2834 | break; |
2835 | case NL80211_IFTYPE_P2P_DEVICE: | ||
2836 | if (!ieee80211_is_public_action(hdr, skb->len) && | ||
2837 | !ieee80211_is_probe_req(hdr->frame_control) && | ||
2838 | !ieee80211_is_probe_resp(hdr->frame_control) && | ||
2839 | !ieee80211_is_beacon(hdr->frame_control)) | ||
2840 | return 0; | ||
2841 | if (!ether_addr_equal(sdata->vif.addr, hdr->addr1)) | ||
2842 | status->rx_flags &= ~IEEE80211_RX_RA_MATCH; | ||
2843 | break; | ||
2796 | default: | 2844 | default: |
2797 | /* should never get here */ | 2845 | /* should never get here */ |
2798 | WARN_ON(1); | 2846 | WARN_ON_ONCE(1); |
2799 | break; | 2847 | break; |
2800 | } | 2848 | } |
2801 | 2849 | ||
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index bcaee5d12839..ef1d69306315 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -416,7 +416,8 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, | |||
416 | local->scan_req->ssids[i].ssid_len, | 416 | local->scan_req->ssids[i].ssid_len, |
417 | local->scan_req->ie, local->scan_req->ie_len, | 417 | local->scan_req->ie, local->scan_req->ie_len, |
418 | local->scan_req->rates[band], false, | 418 | local->scan_req->rates[band], false, |
419 | local->scan_req->no_cck); | 419 | local->scan_req->no_cck, |
420 | local->hw.conf.channel); | ||
420 | 421 | ||
421 | /* | 422 | /* |
422 | * After sending probe requests, wait for probe responses | 423 | * After sending probe requests, wait for probe responses |
@@ -479,11 +480,10 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, | |||
479 | if (local->ops->hw_scan) { | 480 | if (local->ops->hw_scan) { |
480 | __set_bit(SCAN_HW_SCANNING, &local->scanning); | 481 | __set_bit(SCAN_HW_SCANNING, &local->scanning); |
481 | } else if ((req->n_channels == 1) && | 482 | } else if ((req->n_channels == 1) && |
482 | (req->channels[0]->center_freq == | 483 | (req->channels[0] == local->oper_channel)) { |
483 | local->hw.conf.channel->center_freq)) { | 484 | /* |
484 | 485 | * If we are scanning only on the operating channel | |
485 | /* If we are scanning only on the current channel, then | 486 | * then we do not need to stop normal activities |
486 | * we do not need to stop normal activities | ||
487 | */ | 487 | */ |
488 | unsigned long next_delay; | 488 | unsigned long next_delay; |
489 | 489 | ||
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 8cd72914cdaf..b0801b7d572d 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -519,19 +519,27 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
519 | u64 cookie = (unsigned long)skb; | 519 | u64 cookie = (unsigned long)skb; |
520 | acked = info->flags & IEEE80211_TX_STAT_ACK; | 520 | acked = info->flags & IEEE80211_TX_STAT_ACK; |
521 | 521 | ||
522 | /* | ||
523 | * TODO: When we have non-netdev frame TX, | ||
524 | * we cannot use skb->dev->ieee80211_ptr | ||
525 | */ | ||
526 | |||
527 | if (ieee80211_is_nullfunc(hdr->frame_control) || | 522 | if (ieee80211_is_nullfunc(hdr->frame_control) || |
528 | ieee80211_is_qos_nullfunc(hdr->frame_control)) | 523 | ieee80211_is_qos_nullfunc(hdr->frame_control)) { |
529 | cfg80211_probe_status(skb->dev, hdr->addr1, | 524 | cfg80211_probe_status(skb->dev, hdr->addr1, |
530 | cookie, acked, GFP_ATOMIC); | 525 | cookie, acked, GFP_ATOMIC); |
531 | else | 526 | } else if (skb->dev) { |
532 | cfg80211_mgmt_tx_status( | 527 | cfg80211_mgmt_tx_status( |
533 | skb->dev->ieee80211_ptr, cookie, skb->data, | 528 | skb->dev->ieee80211_ptr, cookie, skb->data, |
534 | skb->len, acked, GFP_ATOMIC); | 529 | skb->len, acked, GFP_ATOMIC); |
530 | } else { | ||
531 | struct ieee80211_sub_if_data *p2p_sdata; | ||
532 | |||
533 | rcu_read_lock(); | ||
534 | |||
535 | p2p_sdata = rcu_dereference(local->p2p_sdata); | ||
536 | if (p2p_sdata) { | ||
537 | cfg80211_mgmt_tx_status( | ||
538 | &p2p_sdata->wdev, cookie, skb->data, | ||
539 | skb->len, acked, GFP_ATOMIC); | ||
540 | } | ||
541 | rcu_read_unlock(); | ||
542 | } | ||
535 | } | 543 | } |
536 | 544 | ||
537 | if (unlikely(info->ack_frame_id)) { | 545 | if (unlikely(info->ack_frame_id)) { |
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index c6d33b55b2df..18d9c8a52e9e 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h | |||
@@ -24,7 +24,7 @@ | |||
24 | __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") | 24 | __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") |
25 | #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ | 25 | #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ |
26 | __entry->p2p = sdata->vif.p2p; \ | 26 | __entry->p2p = sdata->vif.p2p; \ |
27 | __assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") | 27 | __assign_str(vif_name, sdata->dev ? sdata->dev->name : sdata->name) |
28 | #define VIF_PR_FMT " vif:%s(%d%s)" | 28 | #define VIF_PR_FMT " vif:%s(%d%s)" |
29 | #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" | 29 | #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" |
30 | 30 | ||
@@ -274,9 +274,12 @@ TRACE_EVENT(drv_config, | |||
274 | __entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout; | 274 | __entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout; |
275 | __entry->max_sleep_period = local->hw.conf.max_sleep_period; | 275 | __entry->max_sleep_period = local->hw.conf.max_sleep_period; |
276 | __entry->listen_interval = local->hw.conf.listen_interval; | 276 | __entry->listen_interval = local->hw.conf.listen_interval; |
277 | __entry->long_frame_max_tx_count = local->hw.conf.long_frame_max_tx_count; | 277 | __entry->long_frame_max_tx_count = |
278 | __entry->short_frame_max_tx_count = local->hw.conf.short_frame_max_tx_count; | 278 | local->hw.conf.long_frame_max_tx_count; |
279 | __entry->center_freq = local->hw.conf.channel->center_freq; | 279 | __entry->short_frame_max_tx_count = |
280 | local->hw.conf.short_frame_max_tx_count; | ||
281 | __entry->center_freq = local->hw.conf.channel ? | ||
282 | local->hw.conf.channel->center_freq : 0; | ||
280 | __entry->channel_type = local->hw.conf.channel_type; | 283 | __entry->channel_type = local->hw.conf.channel_type; |
281 | __entry->smps = local->hw.conf.smps_mode; | 284 | __entry->smps = local->hw.conf.smps_mode; |
282 | ), | 285 | ), |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index acf712ffb5e6..3b807bcb8fc9 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -55,7 +55,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, | |||
55 | if (WARN_ON_ONCE(info->control.rates[0].idx < 0)) | 55 | if (WARN_ON_ONCE(info->control.rates[0].idx < 0)) |
56 | return 0; | 56 | return 0; |
57 | 57 | ||
58 | sband = local->hw.wiphy->bands[tx->channel->band]; | 58 | sband = local->hw.wiphy->bands[info->band]; |
59 | txrate = &sband->bitrates[info->control.rates[0].idx]; | 59 | txrate = &sband->bitrates[info->control.rates[0].idx]; |
60 | 60 | ||
61 | erp = txrate->flags & IEEE80211_RATE_ERP_G; | 61 | erp = txrate->flags & IEEE80211_RATE_ERP_G; |
@@ -615,7 +615,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
615 | 615 | ||
616 | memset(&txrc, 0, sizeof(txrc)); | 616 | memset(&txrc, 0, sizeof(txrc)); |
617 | 617 | ||
618 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 618 | sband = tx->local->hw.wiphy->bands[info->band]; |
619 | 619 | ||
620 | len = min_t(u32, tx->skb->len + FCS_LEN, | 620 | len = min_t(u32, tx->skb->len + FCS_LEN, |
621 | tx->local->hw.wiphy->frag_threshold); | 621 | tx->local->hw.wiphy->frag_threshold); |
@@ -626,13 +626,13 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
626 | txrc.bss_conf = &tx->sdata->vif.bss_conf; | 626 | txrc.bss_conf = &tx->sdata->vif.bss_conf; |
627 | txrc.skb = tx->skb; | 627 | txrc.skb = tx->skb; |
628 | txrc.reported_rate.idx = -1; | 628 | txrc.reported_rate.idx = -1; |
629 | txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[tx->channel->band]; | 629 | txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[info->band]; |
630 | if (txrc.rate_idx_mask == (1 << sband->n_bitrates) - 1) | 630 | if (txrc.rate_idx_mask == (1 << sband->n_bitrates) - 1) |
631 | txrc.max_rate_idx = -1; | 631 | txrc.max_rate_idx = -1; |
632 | else | 632 | else |
633 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; | 633 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; |
634 | memcpy(txrc.rate_idx_mcs_mask, | 634 | memcpy(txrc.rate_idx_mcs_mask, |
635 | tx->sdata->rc_rateidx_mcs_mask[tx->channel->band], | 635 | tx->sdata->rc_rateidx_mcs_mask[info->band], |
636 | sizeof(txrc.rate_idx_mcs_mask)); | 636 | sizeof(txrc.rate_idx_mcs_mask)); |
637 | txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP || | 637 | txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP || |
638 | tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT || | 638 | tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT || |
@@ -667,7 +667,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
667 | "scanning and associated. Target station: " | 667 | "scanning and associated. Target station: " |
668 | "%pM on %d GHz band\n", | 668 | "%pM on %d GHz band\n", |
669 | tx->sdata->name, hdr->addr1, | 669 | tx->sdata->name, hdr->addr1, |
670 | tx->channel->band ? 5 : 2)) | 670 | info->band ? 5 : 2)) |
671 | return TX_DROP; | 671 | return TX_DROP; |
672 | 672 | ||
673 | /* | 673 | /* |
@@ -1131,7 +1131,6 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1131 | tx->skb = skb; | 1131 | tx->skb = skb; |
1132 | tx->local = local; | 1132 | tx->local = local; |
1133 | tx->sdata = sdata; | 1133 | tx->sdata = sdata; |
1134 | tx->channel = local->hw.conf.channel; | ||
1135 | __skb_queue_head_init(&tx->skbs); | 1134 | __skb_queue_head_init(&tx->skbs); |
1136 | 1135 | ||
1137 | /* | 1136 | /* |
@@ -1204,6 +1203,7 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local, | |||
1204 | struct sk_buff_head *skbs, | 1203 | struct sk_buff_head *skbs, |
1205 | bool txpending) | 1204 | bool txpending) |
1206 | { | 1205 | { |
1206 | struct ieee80211_tx_control control; | ||
1207 | struct sk_buff *skb, *tmp; | 1207 | struct sk_buff *skb, *tmp; |
1208 | unsigned long flags; | 1208 | unsigned long flags; |
1209 | 1209 | ||
@@ -1240,10 +1240,10 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local, | |||
1240 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); | 1240 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
1241 | 1241 | ||
1242 | info->control.vif = vif; | 1242 | info->control.vif = vif; |
1243 | info->control.sta = sta; | 1243 | control.sta = sta; |
1244 | 1244 | ||
1245 | __skb_unlink(skb, skbs); | 1245 | __skb_unlink(skb, skbs); |
1246 | drv_tx(local, skb); | 1246 | drv_tx(local, &control, skb); |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | return true; | 1249 | return true; |
@@ -1399,8 +1399,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, | |||
1399 | goto out; | 1399 | goto out; |
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | tx.channel = local->hw.conf.channel; | 1402 | info->band = local->hw.conf.channel->band; |
1403 | info->band = tx.channel->band; | ||
1404 | 1403 | ||
1405 | /* set up hw_queue value early */ | 1404 | /* set up hw_queue value early */ |
1406 | if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) || | 1405 | if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) || |
@@ -1720,7 +1719,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1720 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1719 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1721 | struct ieee80211_local *local = sdata->local; | 1720 | struct ieee80211_local *local = sdata->local; |
1722 | struct ieee80211_tx_info *info; | 1721 | struct ieee80211_tx_info *info; |
1723 | int ret = NETDEV_TX_BUSY, head_need; | 1722 | int head_need; |
1724 | u16 ethertype, hdrlen, meshhdrlen = 0; | 1723 | u16 ethertype, hdrlen, meshhdrlen = 0; |
1725 | __le16 fc; | 1724 | __le16 fc; |
1726 | struct ieee80211_hdr hdr; | 1725 | struct ieee80211_hdr hdr; |
@@ -1736,10 +1735,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1736 | u32 info_flags = 0; | 1735 | u32 info_flags = 0; |
1737 | u16 info_id = 0; | 1736 | u16 info_id = 0; |
1738 | 1737 | ||
1739 | if (unlikely(skb->len < ETH_HLEN)) { | 1738 | if (unlikely(skb->len < ETH_HLEN)) |
1740 | ret = NETDEV_TX_OK; | ||
1741 | goto fail; | 1739 | goto fail; |
1742 | } | ||
1743 | 1740 | ||
1744 | /* convert Ethernet header to proper 802.11 header (based on | 1741 | /* convert Ethernet header to proper 802.11 header (based on |
1745 | * operation mode) */ | 1742 | * operation mode) */ |
@@ -1787,7 +1784,6 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1787 | if (!sdata->u.mesh.mshcfg.dot11MeshTTL) { | 1784 | if (!sdata->u.mesh.mshcfg.dot11MeshTTL) { |
1788 | /* Do not send frames with mesh_ttl == 0 */ | 1785 | /* Do not send frames with mesh_ttl == 0 */ |
1789 | sdata->u.mesh.mshstats.dropped_frames_ttl++; | 1786 | sdata->u.mesh.mshstats.dropped_frames_ttl++; |
1790 | ret = NETDEV_TX_OK; | ||
1791 | goto fail; | 1787 | goto fail; |
1792 | } | 1788 | } |
1793 | rcu_read_lock(); | 1789 | rcu_read_lock(); |
@@ -1880,10 +1876,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1880 | 1876 | ||
1881 | if (tdls_direct) { | 1877 | if (tdls_direct) { |
1882 | /* link during setup - throw out frames to peer */ | 1878 | /* link during setup - throw out frames to peer */ |
1883 | if (!tdls_auth) { | 1879 | if (!tdls_auth) |
1884 | ret = NETDEV_TX_OK; | ||
1885 | goto fail; | 1880 | goto fail; |
1886 | } | ||
1887 | 1881 | ||
1888 | /* DA SA BSSID */ | 1882 | /* DA SA BSSID */ |
1889 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1883 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
@@ -1917,7 +1911,6 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1917 | hdrlen = 24; | 1911 | hdrlen = 24; |
1918 | break; | 1912 | break; |
1919 | default: | 1913 | default: |
1920 | ret = NETDEV_TX_OK; | ||
1921 | goto fail; | 1914 | goto fail; |
1922 | } | 1915 | } |
1923 | 1916 | ||
@@ -1962,7 +1955,6 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1962 | 1955 | ||
1963 | I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); | 1956 | I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); |
1964 | 1957 | ||
1965 | ret = NETDEV_TX_OK; | ||
1966 | goto fail; | 1958 | goto fail; |
1967 | } | 1959 | } |
1968 | 1960 | ||
@@ -2017,10 +2009,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
2017 | skb = skb_clone(skb, GFP_ATOMIC); | 2009 | skb = skb_clone(skb, GFP_ATOMIC); |
2018 | kfree_skb(tmp_skb); | 2010 | kfree_skb(tmp_skb); |
2019 | 2011 | ||
2020 | if (!skb) { | 2012 | if (!skb) |
2021 | ret = NETDEV_TX_OK; | ||
2022 | goto fail; | 2013 | goto fail; |
2023 | } | ||
2024 | } | 2014 | } |
2025 | 2015 | ||
2026 | hdr.frame_control = fc; | 2016 | hdr.frame_control = fc; |
@@ -2123,10 +2113,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
2123 | return NETDEV_TX_OK; | 2113 | return NETDEV_TX_OK; |
2124 | 2114 | ||
2125 | fail: | 2115 | fail: |
2126 | if (ret == NETDEV_TX_OK) | 2116 | dev_kfree_skb(skb); |
2127 | dev_kfree_skb(skb); | 2117 | return NETDEV_TX_OK; |
2128 | |||
2129 | return ret; | ||
2130 | } | 2118 | } |
2131 | 2119 | ||
2132 | 2120 | ||
@@ -2301,12 +2289,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2301 | struct ieee80211_sub_if_data *sdata = NULL; | 2289 | struct ieee80211_sub_if_data *sdata = NULL; |
2302 | struct ieee80211_if_ap *ap = NULL; | 2290 | struct ieee80211_if_ap *ap = NULL; |
2303 | struct beacon_data *beacon; | 2291 | struct beacon_data *beacon; |
2304 | struct ieee80211_supported_band *sband; | 2292 | enum ieee80211_band band = local->oper_channel->band; |
2305 | enum ieee80211_band band = local->hw.conf.channel->band; | ||
2306 | struct ieee80211_tx_rate_control txrc; | 2293 | struct ieee80211_tx_rate_control txrc; |
2307 | 2294 | ||
2308 | sband = local->hw.wiphy->bands[band]; | ||
2309 | |||
2310 | rcu_read_lock(); | 2295 | rcu_read_lock(); |
2311 | 2296 | ||
2312 | sdata = vif_to_sdata(vif); | 2297 | sdata = vif_to_sdata(vif); |
@@ -2416,7 +2401,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2416 | memset(mgmt, 0, hdr_len); | 2401 | memset(mgmt, 0, hdr_len); |
2417 | mgmt->frame_control = | 2402 | mgmt->frame_control = |
2418 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); | 2403 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
2419 | memset(mgmt->da, 0xff, ETH_ALEN); | 2404 | eth_broadcast_addr(mgmt->da); |
2420 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); | 2405 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
2421 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); | 2406 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); |
2422 | mgmt->u.beacon.beacon_int = | 2407 | mgmt->u.beacon.beacon_int = |
@@ -2428,9 +2413,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2428 | *pos++ = WLAN_EID_SSID; | 2413 | *pos++ = WLAN_EID_SSID; |
2429 | *pos++ = 0x0; | 2414 | *pos++ = 0x0; |
2430 | 2415 | ||
2431 | if (ieee80211_add_srates_ie(sdata, skb, true) || | 2416 | if (ieee80211_add_srates_ie(sdata, skb, true, band) || |
2432 | mesh_add_ds_params_ie(skb, sdata) || | 2417 | mesh_add_ds_params_ie(skb, sdata) || |
2433 | ieee80211_add_ext_srates_ie(sdata, skb, true) || | 2418 | ieee80211_add_ext_srates_ie(sdata, skb, true, band) || |
2434 | mesh_add_rsn_ie(skb, sdata) || | 2419 | mesh_add_rsn_ie(skb, sdata) || |
2435 | mesh_add_ht_cap_ie(skb, sdata) || | 2420 | mesh_add_ht_cap_ie(skb, sdata) || |
2436 | mesh_add_ht_oper_ie(skb, sdata) || | 2421 | mesh_add_ht_oper_ie(skb, sdata) || |
@@ -2453,12 +2438,12 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2453 | 2438 | ||
2454 | memset(&txrc, 0, sizeof(txrc)); | 2439 | memset(&txrc, 0, sizeof(txrc)); |
2455 | txrc.hw = hw; | 2440 | txrc.hw = hw; |
2456 | txrc.sband = sband; | 2441 | txrc.sband = local->hw.wiphy->bands[band]; |
2457 | txrc.bss_conf = &sdata->vif.bss_conf; | 2442 | txrc.bss_conf = &sdata->vif.bss_conf; |
2458 | txrc.skb = skb; | 2443 | txrc.skb = skb; |
2459 | txrc.reported_rate.idx = -1; | 2444 | txrc.reported_rate.idx = -1; |
2460 | txrc.rate_idx_mask = sdata->rc_rateidx_mask[band]; | 2445 | txrc.rate_idx_mask = sdata->rc_rateidx_mask[band]; |
2461 | if (txrc.rate_idx_mask == (1 << sband->n_bitrates) - 1) | 2446 | if (txrc.rate_idx_mask == (1 << txrc.sband->n_bitrates) - 1) |
2462 | txrc.max_rate_idx = -1; | 2447 | txrc.max_rate_idx = -1; |
2463 | else | 2448 | else |
2464 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; | 2449 | txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; |
@@ -2482,7 +2467,8 @@ struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, | |||
2482 | struct ieee80211_vif *vif) | 2467 | struct ieee80211_vif *vif) |
2483 | { | 2468 | { |
2484 | struct ieee80211_if_ap *ap = NULL; | 2469 | struct ieee80211_if_ap *ap = NULL; |
2485 | struct sk_buff *presp = NULL, *skb = NULL; | 2470 | struct sk_buff *skb = NULL; |
2471 | struct probe_resp *presp = NULL; | ||
2486 | struct ieee80211_hdr *hdr; | 2472 | struct ieee80211_hdr *hdr; |
2487 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | 2473 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); |
2488 | 2474 | ||
@@ -2496,10 +2482,12 @@ struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, | |||
2496 | if (!presp) | 2482 | if (!presp) |
2497 | goto out; | 2483 | goto out; |
2498 | 2484 | ||
2499 | skb = skb_copy(presp, GFP_ATOMIC); | 2485 | skb = dev_alloc_skb(presp->len); |
2500 | if (!skb) | 2486 | if (!skb) |
2501 | goto out; | 2487 | goto out; |
2502 | 2488 | ||
2489 | memcpy(skb_put(skb, presp->len), presp->data, presp->len); | ||
2490 | |||
2503 | hdr = (struct ieee80211_hdr *) skb->data; | 2491 | hdr = (struct ieee80211_hdr *) skb->data; |
2504 | memset(hdr->addr1, 0, sizeof(hdr->addr1)); | 2492 | memset(hdr->addr1, 0, sizeof(hdr->addr1)); |
2505 | 2493 | ||
@@ -2610,9 +2598,9 @@ struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, | |||
2610 | memset(hdr, 0, sizeof(*hdr)); | 2598 | memset(hdr, 0, sizeof(*hdr)); |
2611 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 2599 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
2612 | IEEE80211_STYPE_PROBE_REQ); | 2600 | IEEE80211_STYPE_PROBE_REQ); |
2613 | memset(hdr->addr1, 0xff, ETH_ALEN); | 2601 | eth_broadcast_addr(hdr->addr1); |
2614 | memcpy(hdr->addr2, vif->addr, ETH_ALEN); | 2602 | memcpy(hdr->addr2, vif->addr, ETH_ALEN); |
2615 | memset(hdr->addr3, 0xff, ETH_ALEN); | 2603 | eth_broadcast_addr(hdr->addr3); |
2616 | 2604 | ||
2617 | pos = skb_put(skb, ie_ssid_len); | 2605 | pos = skb_put(skb, ie_ssid_len); |
2618 | *pos++ = WLAN_EID_SSID; | 2606 | *pos++ = WLAN_EID_SSID; |
@@ -2709,8 +2697,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
2709 | info = IEEE80211_SKB_CB(skb); | 2697 | info = IEEE80211_SKB_CB(skb); |
2710 | 2698 | ||
2711 | tx.flags |= IEEE80211_TX_PS_BUFFERED; | 2699 | tx.flags |= IEEE80211_TX_PS_BUFFERED; |
2712 | tx.channel = local->hw.conf.channel; | 2700 | info->band = local->oper_channel->band; |
2713 | info->band = tx.channel->band; | ||
2714 | 2701 | ||
2715 | if (invoke_tx_handlers(&tx)) | 2702 | if (invoke_tx_handlers(&tx)) |
2716 | skb = NULL; | 2703 | skb = NULL; |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 39b82fee4904..471fb0516c99 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -276,6 +276,9 @@ void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue) | |||
276 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 276 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
277 | int ac; | 277 | int ac; |
278 | 278 | ||
279 | if (!sdata->dev) | ||
280 | continue; | ||
281 | |||
279 | if (test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) | 282 | if (test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) |
280 | continue; | 283 | continue; |
281 | 284 | ||
@@ -364,6 +367,9 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue, | |||
364 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 367 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
365 | int ac; | 368 | int ac; |
366 | 369 | ||
370 | if (!sdata->dev) | ||
371 | continue; | ||
372 | |||
367 | for (ac = 0; ac < n_acs; ac++) { | 373 | for (ac = 0; ac < n_acs; ac++) { |
368 | if (sdata->vif.hw_queue[ac] == queue || | 374 | if (sdata->vif.hw_queue[ac] == queue || |
369 | sdata->vif.cab_queue == queue) | 375 | sdata->vif.cab_queue == queue) |
@@ -768,8 +774,11 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, | |||
768 | elem_parse_failed = true; | 774 | elem_parse_failed = true; |
769 | break; | 775 | break; |
770 | case WLAN_EID_CHANNEL_SWITCH: | 776 | case WLAN_EID_CHANNEL_SWITCH: |
771 | elems->ch_switch_elem = pos; | 777 | if (elen != sizeof(struct ieee80211_channel_sw_ie)) { |
772 | elems->ch_switch_elem_len = elen; | 778 | elem_parse_failed = true; |
779 | break; | ||
780 | } | ||
781 | elems->ch_switch_ie = (void *)pos; | ||
773 | break; | 782 | break; |
774 | case WLAN_EID_QUIET: | 783 | case WLAN_EID_QUIET: |
775 | if (!elems->quiet_elem) { | 784 | if (!elems->quiet_elem) { |
@@ -832,7 +841,7 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, | |||
832 | 841 | ||
833 | memset(&qparam, 0, sizeof(qparam)); | 842 | memset(&qparam, 0, sizeof(qparam)); |
834 | 843 | ||
835 | use_11b = (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ) && | 844 | use_11b = (local->oper_channel->band == IEEE80211_BAND_2GHZ) && |
836 | !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); | 845 | !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); |
837 | 846 | ||
838 | /* | 847 | /* |
@@ -899,7 +908,8 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, | |||
899 | drv_conf_tx(local, sdata, ac, &qparam); | 908 | drv_conf_tx(local, sdata, ac, &qparam); |
900 | } | 909 | } |
901 | 910 | ||
902 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { | 911 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR && |
912 | sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE) { | ||
903 | sdata->vif.bss_conf.qos = enable_qos; | 913 | sdata->vif.bss_conf.qos = enable_qos; |
904 | if (bss_notify) | 914 | if (bss_notify) |
905 | ieee80211_bss_info_change_notify(sdata, | 915 | ieee80211_bss_info_change_notify(sdata, |
@@ -919,7 +929,7 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | |||
919 | if ((supp_rates[i] & 0x7f) * 5 > 110) | 929 | if ((supp_rates[i] & 0x7f) * 5 > 110) |
920 | have_higher_than_11mbit = 1; | 930 | have_higher_than_11mbit = 1; |
921 | 931 | ||
922 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && | 932 | if (local->oper_channel->band == IEEE80211_BAND_2GHZ && |
923 | have_higher_than_11mbit) | 933 | have_higher_than_11mbit) |
924 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; | 934 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; |
925 | else | 935 | else |
@@ -1100,6 +1110,7 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, | |||
1100 | 1110 | ||
1101 | struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | 1111 | struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, |
1102 | u8 *dst, u32 ratemask, | 1112 | u8 *dst, u32 ratemask, |
1113 | struct ieee80211_channel *chan, | ||
1103 | const u8 *ssid, size_t ssid_len, | 1114 | const u8 *ssid, size_t ssid_len, |
1104 | const u8 *ie, size_t ie_len, | 1115 | const u8 *ie, size_t ie_len, |
1105 | bool directed) | 1116 | bool directed) |
@@ -1109,7 +1120,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1109 | struct ieee80211_mgmt *mgmt; | 1120 | struct ieee80211_mgmt *mgmt; |
1110 | size_t buf_len; | 1121 | size_t buf_len; |
1111 | u8 *buf; | 1122 | u8 *buf; |
1112 | u8 chan; | 1123 | u8 chan_no; |
1113 | 1124 | ||
1114 | /* FIXME: come up with a proper value */ | 1125 | /* FIXME: come up with a proper value */ |
1115 | buf = kmalloc(200 + ie_len, GFP_KERNEL); | 1126 | buf = kmalloc(200 + ie_len, GFP_KERNEL); |
@@ -1122,14 +1133,12 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1122 | * badly-behaved APs don't respond when this parameter is included. | 1133 | * badly-behaved APs don't respond when this parameter is included. |
1123 | */ | 1134 | */ |
1124 | if (directed) | 1135 | if (directed) |
1125 | chan = 0; | 1136 | chan_no = 0; |
1126 | else | 1137 | else |
1127 | chan = ieee80211_frequency_to_channel( | 1138 | chan_no = ieee80211_frequency_to_channel(chan->center_freq); |
1128 | local->hw.conf.channel->center_freq); | ||
1129 | 1139 | ||
1130 | buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, | 1140 | buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, chan->band, |
1131 | local->hw.conf.channel->band, | 1141 | ratemask, chan_no); |
1132 | ratemask, chan); | ||
1133 | 1142 | ||
1134 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, | 1143 | skb = ieee80211_probereq_get(&local->hw, &sdata->vif, |
1135 | ssid, ssid_len, | 1144 | ssid, ssid_len, |
@@ -1154,11 +1163,13 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, | |||
1154 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | 1163 | void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, |
1155 | const u8 *ssid, size_t ssid_len, | 1164 | const u8 *ssid, size_t ssid_len, |
1156 | const u8 *ie, size_t ie_len, | 1165 | const u8 *ie, size_t ie_len, |
1157 | u32 ratemask, bool directed, bool no_cck) | 1166 | u32 ratemask, bool directed, bool no_cck, |
1167 | struct ieee80211_channel *channel) | ||
1158 | { | 1168 | { |
1159 | struct sk_buff *skb; | 1169 | struct sk_buff *skb; |
1160 | 1170 | ||
1161 | skb = ieee80211_build_probe_req(sdata, dst, ratemask, ssid, ssid_len, | 1171 | skb = ieee80211_build_probe_req(sdata, dst, ratemask, channel, |
1172 | ssid, ssid_len, | ||
1162 | ie, ie_len, directed); | 1173 | ie, ie_len, directed); |
1163 | if (skb) { | 1174 | if (skb) { |
1164 | if (no_cck) | 1175 | if (no_cck) |
@@ -1359,7 +1370,8 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1359 | switch (sdata->vif.type) { | 1370 | switch (sdata->vif.type) { |
1360 | case NL80211_IFTYPE_STATION: | 1371 | case NL80211_IFTYPE_STATION: |
1361 | changed |= BSS_CHANGED_ASSOC | | 1372 | changed |= BSS_CHANGED_ASSOC | |
1362 | BSS_CHANGED_ARP_FILTER; | 1373 | BSS_CHANGED_ARP_FILTER | |
1374 | BSS_CHANGED_PS; | ||
1363 | mutex_lock(&sdata->u.mgd.mtx); | 1375 | mutex_lock(&sdata->u.mgd.mtx); |
1364 | ieee80211_bss_info_change_notify(sdata, changed); | 1376 | ieee80211_bss_info_change_notify(sdata, changed); |
1365 | mutex_unlock(&sdata->u.mgd.mtx); | 1377 | mutex_unlock(&sdata->u.mgd.mtx); |
@@ -1385,6 +1397,9 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1385 | case NL80211_IFTYPE_MONITOR: | 1397 | case NL80211_IFTYPE_MONITOR: |
1386 | /* ignore virtual */ | 1398 | /* ignore virtual */ |
1387 | break; | 1399 | break; |
1400 | case NL80211_IFTYPE_P2P_DEVICE: | ||
1401 | changed = BSS_CHANGED_IDLE; | ||
1402 | break; | ||
1388 | case NL80211_IFTYPE_UNSPECIFIED: | 1403 | case NL80211_IFTYPE_UNSPECIFIED: |
1389 | case NUM_NL80211_IFTYPES: | 1404 | case NUM_NL80211_IFTYPES: |
1390 | case NL80211_IFTYPE_P2P_CLIENT: | 1405 | case NL80211_IFTYPE_P2P_CLIENT: |
@@ -1571,6 +1586,8 @@ void ieee80211_recalc_smps(struct ieee80211_local *local) | |||
1571 | list_for_each_entry(sdata, &local->interfaces, list) { | 1586 | list_for_each_entry(sdata, &local->interfaces, list) { |
1572 | if (!ieee80211_sdata_running(sdata)) | 1587 | if (!ieee80211_sdata_running(sdata)) |
1573 | continue; | 1588 | continue; |
1589 | if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) | ||
1590 | continue; | ||
1574 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 1591 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
1575 | goto set; | 1592 | goto set; |
1576 | 1593 | ||
@@ -1809,7 +1826,8 @@ ieee80211_ht_oper_to_channel_type(struct ieee80211_ht_operation *ht_oper) | |||
1809 | } | 1826 | } |
1810 | 1827 | ||
1811 | int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, | 1828 | int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, |
1812 | struct sk_buff *skb, bool need_basic) | 1829 | struct sk_buff *skb, bool need_basic, |
1830 | enum ieee80211_band band) | ||
1813 | { | 1831 | { |
1814 | struct ieee80211_local *local = sdata->local; | 1832 | struct ieee80211_local *local = sdata->local; |
1815 | struct ieee80211_supported_band *sband; | 1833 | struct ieee80211_supported_band *sband; |
@@ -1817,7 +1835,7 @@ int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, | |||
1817 | u8 i, rates, *pos; | 1835 | u8 i, rates, *pos; |
1818 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; | 1836 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; |
1819 | 1837 | ||
1820 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1838 | sband = local->hw.wiphy->bands[band]; |
1821 | rates = sband->n_bitrates; | 1839 | rates = sband->n_bitrates; |
1822 | if (rates > 8) | 1840 | if (rates > 8) |
1823 | rates = 8; | 1841 | rates = 8; |
@@ -1840,7 +1858,8 @@ int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, | |||
1840 | } | 1858 | } |
1841 | 1859 | ||
1842 | int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, | 1860 | int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, |
1843 | struct sk_buff *skb, bool need_basic) | 1861 | struct sk_buff *skb, bool need_basic, |
1862 | enum ieee80211_band band) | ||
1844 | { | 1863 | { |
1845 | struct ieee80211_local *local = sdata->local; | 1864 | struct ieee80211_local *local = sdata->local; |
1846 | struct ieee80211_supported_band *sband; | 1865 | struct ieee80211_supported_band *sband; |
@@ -1848,7 +1867,7 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, | |||
1848 | u8 i, exrates, *pos; | 1867 | u8 i, exrates, *pos; |
1849 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; | 1868 | u32 basic_rates = sdata->vif.bss_conf.basic_rates; |
1850 | 1869 | ||
1851 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1870 | sband = local->hw.wiphy->bands[band]; |
1852 | exrates = sband->n_bitrates; | 1871 | exrates = sband->n_bitrates; |
1853 | if (exrates > 8) | 1872 | if (exrates > 8) |
1854 | exrates -= 8; | 1873 | exrates -= 8; |