diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-11-26 14:46:41 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-11-26 14:46:41 -0500 |
commit | 62c8003ecb973986958e9dade4a7e598349caf48 (patch) | |
tree | 0e831639cd6449c2955234cfc37ef46481c788d1 /net/wireless | |
parent | e4cb3ff9311e0817e65cda7bc53898348aab7527 (diff) | |
parent | ec816087e8978b74c1bd5fae0e335dd97d964e9f (diff) |
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/chan.c | 280 | ||||
-rw-r--r-- | net/wireless/core.h | 23 | ||||
-rw-r--r-- | net/wireless/ibss.c | 27 | ||||
-rw-r--r-- | net/wireless/mesh.c | 49 | ||||
-rw-r--r-- | net/wireless/mlme.c | 36 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 415 | ||||
-rw-r--r-- | net/wireless/nl80211.h | 8 | ||||
-rw-r--r-- | net/wireless/rdev-ops.h | 42 | ||||
-rw-r--r-- | net/wireless/scan.c | 45 | ||||
-rw-r--r-- | net/wireless/trace.h | 295 | ||||
-rw-r--r-- | net/wireless/util.c | 79 | ||||
-rw-r--r-- | net/wireless/wext-compat.c | 28 | ||||
-rw-r--r-- | net/wireless/wext-sme.c | 11 |
13 files changed, 848 insertions, 490 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 48febd2160ba..bf2dfd54ff3b 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c | |||
@@ -11,96 +11,264 @@ | |||
11 | #include "core.h" | 11 | #include "core.h" |
12 | #include "rdev-ops.h" | 12 | #include "rdev-ops.h" |
13 | 13 | ||
14 | struct ieee80211_channel * | 14 | void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, |
15 | rdev_freq_to_chan(struct cfg80211_registered_device *rdev, | 15 | struct ieee80211_channel *chan, |
16 | int freq, enum nl80211_channel_type channel_type) | 16 | enum nl80211_channel_type chan_type) |
17 | { | 17 | { |
18 | struct ieee80211_channel *chan; | 18 | if (WARN_ON(!chan)) |
19 | struct ieee80211_sta_ht_cap *ht_cap; | 19 | return; |
20 | 20 | ||
21 | chan = ieee80211_get_channel(&rdev->wiphy, freq); | 21 | chandef->chan = chan; |
22 | chandef->center_freq2 = 0; | ||
22 | 23 | ||
23 | /* Primary channel not allowed */ | 24 | switch (chan_type) { |
24 | if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) | 25 | case NL80211_CHAN_NO_HT: |
25 | return NULL; | 26 | chandef->width = NL80211_CHAN_WIDTH_20_NOHT; |
27 | chandef->center_freq1 = chan->center_freq; | ||
28 | break; | ||
29 | case NL80211_CHAN_HT20: | ||
30 | chandef->width = NL80211_CHAN_WIDTH_20; | ||
31 | chandef->center_freq1 = chan->center_freq; | ||
32 | break; | ||
33 | case NL80211_CHAN_HT40PLUS: | ||
34 | chandef->width = NL80211_CHAN_WIDTH_40; | ||
35 | chandef->center_freq1 = chan->center_freq + 10; | ||
36 | break; | ||
37 | case NL80211_CHAN_HT40MINUS: | ||
38 | chandef->width = NL80211_CHAN_WIDTH_40; | ||
39 | chandef->center_freq1 = chan->center_freq - 10; | ||
40 | break; | ||
41 | default: | ||
42 | WARN_ON(1); | ||
43 | } | ||
44 | } | ||
45 | EXPORT_SYMBOL(cfg80211_chandef_create); | ||
26 | 46 | ||
27 | if (channel_type == NL80211_CHAN_HT40MINUS && | 47 | bool cfg80211_chan_def_valid(const struct cfg80211_chan_def *chandef) |
28 | chan->flags & IEEE80211_CHAN_NO_HT40MINUS) | 48 | { |
29 | return NULL; | 49 | u32 control_freq; |
30 | else if (channel_type == NL80211_CHAN_HT40PLUS && | ||
31 | chan->flags & IEEE80211_CHAN_NO_HT40PLUS) | ||
32 | return NULL; | ||
33 | 50 | ||
34 | ht_cap = &rdev->wiphy.bands[chan->band]->ht_cap; | 51 | if (!chandef->chan) |
52 | return false; | ||
35 | 53 | ||
36 | if (channel_type != NL80211_CHAN_NO_HT) { | 54 | control_freq = chandef->chan->center_freq; |
37 | if (!ht_cap->ht_supported) | ||
38 | return NULL; | ||
39 | 55 | ||
40 | if (channel_type != NL80211_CHAN_HT20 && | 56 | switch (chandef->width) { |
41 | (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) || | 57 | case NL80211_CHAN_WIDTH_20: |
42 | ht_cap->cap & IEEE80211_HT_CAP_40MHZ_INTOLERANT)) | 58 | case NL80211_CHAN_WIDTH_20_NOHT: |
43 | return NULL; | 59 | if (chandef->center_freq1 != control_freq) |
60 | return false; | ||
61 | if (chandef->center_freq2) | ||
62 | return false; | ||
63 | break; | ||
64 | case NL80211_CHAN_WIDTH_40: | ||
65 | if (chandef->center_freq1 != control_freq + 10 && | ||
66 | chandef->center_freq1 != control_freq - 10) | ||
67 | return false; | ||
68 | if (chandef->center_freq2) | ||
69 | return false; | ||
70 | break; | ||
71 | case NL80211_CHAN_WIDTH_80P80: | ||
72 | if (chandef->center_freq1 != control_freq + 30 && | ||
73 | chandef->center_freq1 != control_freq + 10 && | ||
74 | chandef->center_freq1 != control_freq - 10 && | ||
75 | chandef->center_freq1 != control_freq - 30) | ||
76 | return false; | ||
77 | if (!chandef->center_freq2) | ||
78 | return false; | ||
79 | break; | ||
80 | case NL80211_CHAN_WIDTH_80: | ||
81 | if (chandef->center_freq1 != control_freq + 30 && | ||
82 | chandef->center_freq1 != control_freq + 10 && | ||
83 | chandef->center_freq1 != control_freq - 10 && | ||
84 | chandef->center_freq1 != control_freq - 30) | ||
85 | return false; | ||
86 | if (chandef->center_freq2) | ||
87 | return false; | ||
88 | break; | ||
89 | case NL80211_CHAN_WIDTH_160: | ||
90 | if (chandef->center_freq1 != control_freq + 70 && | ||
91 | chandef->center_freq1 != control_freq + 50 && | ||
92 | chandef->center_freq1 != control_freq + 30 && | ||
93 | chandef->center_freq1 != control_freq + 10 && | ||
94 | chandef->center_freq1 != control_freq - 10 && | ||
95 | chandef->center_freq1 != control_freq - 30 && | ||
96 | chandef->center_freq1 != control_freq - 50 && | ||
97 | chandef->center_freq1 != control_freq - 70) | ||
98 | return false; | ||
99 | if (chandef->center_freq2) | ||
100 | return false; | ||
101 | break; | ||
102 | default: | ||
103 | return false; | ||
44 | } | 104 | } |
45 | 105 | ||
46 | return chan; | 106 | return true; |
47 | } | 107 | } |
48 | 108 | ||
49 | bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, | 109 | static void chandef_primary_freqs(const struct cfg80211_chan_def *c, |
50 | struct ieee80211_channel *chan, | 110 | int *pri40, int *pri80) |
51 | enum nl80211_channel_type channel_type) | ||
52 | { | 111 | { |
53 | struct ieee80211_channel *sec_chan; | 112 | int tmp; |
54 | int diff; | ||
55 | |||
56 | trace_cfg80211_can_beacon_sec_chan(wiphy, chan, channel_type); | ||
57 | 113 | ||
58 | switch (channel_type) { | 114 | switch (c->width) { |
59 | case NL80211_CHAN_HT40PLUS: | 115 | case NL80211_CHAN_WIDTH_40: |
60 | diff = 20; | 116 | *pri40 = c->center_freq1; |
117 | *pri80 = 0; | ||
61 | break; | 118 | break; |
62 | case NL80211_CHAN_HT40MINUS: | 119 | case NL80211_CHAN_WIDTH_80: |
63 | diff = -20; | 120 | case NL80211_CHAN_WIDTH_80P80: |
121 | *pri80 = c->center_freq1; | ||
122 | /* n_P20 */ | ||
123 | tmp = (30 + c->chan->center_freq - c->center_freq1)/20; | ||
124 | /* n_P40 */ | ||
125 | tmp /= 2; | ||
126 | /* freq_P40 */ | ||
127 | *pri40 = c->center_freq1 - 20 + 40 * tmp; | ||
128 | break; | ||
129 | case NL80211_CHAN_WIDTH_160: | ||
130 | /* n_P20 */ | ||
131 | tmp = (70 + c->chan->center_freq - c->center_freq1)/20; | ||
132 | /* n_P40 */ | ||
133 | tmp /= 2; | ||
134 | /* freq_P40 */ | ||
135 | *pri40 = c->center_freq1 - 60 + 40 * tmp; | ||
136 | /* n_P80 */ | ||
137 | tmp /= 2; | ||
138 | *pri80 = c->center_freq1 - 40 + 80 * tmp; | ||
64 | break; | 139 | break; |
65 | default: | 140 | default: |
66 | trace_cfg80211_return_bool(true); | 141 | WARN_ON_ONCE(1); |
67 | return true; | ||
68 | } | 142 | } |
143 | } | ||
144 | |||
145 | const struct cfg80211_chan_def * | ||
146 | cfg80211_chandef_compatible(const struct cfg80211_chan_def *c1, | ||
147 | const struct cfg80211_chan_def *c2) | ||
148 | { | ||
149 | u32 c1_pri40, c1_pri80, c2_pri40, c2_pri80; | ||
69 | 150 | ||
70 | sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff); | 151 | /* If they are identical, return */ |
71 | if (!sec_chan) { | 152 | if (cfg80211_chandef_identical(c1, c2)) |
153 | return c1; | ||
154 | |||
155 | /* otherwise, must have same control channel */ | ||
156 | if (c1->chan != c2->chan) | ||
157 | return NULL; | ||
158 | |||
159 | /* | ||
160 | * If they have the same width, but aren't identical, | ||
161 | * then they can't be compatible. | ||
162 | */ | ||
163 | if (c1->width == c2->width) | ||
164 | return NULL; | ||
165 | |||
166 | if (c1->width == NL80211_CHAN_WIDTH_20_NOHT || | ||
167 | c1->width == NL80211_CHAN_WIDTH_20) | ||
168 | return c2; | ||
169 | |||
170 | if (c2->width == NL80211_CHAN_WIDTH_20_NOHT || | ||
171 | c2->width == NL80211_CHAN_WIDTH_20) | ||
172 | return c1; | ||
173 | |||
174 | chandef_primary_freqs(c1, &c1_pri40, &c1_pri80); | ||
175 | chandef_primary_freqs(c2, &c2_pri40, &c2_pri80); | ||
176 | |||
177 | if (c1_pri40 != c2_pri40) | ||
178 | return NULL; | ||
179 | |||
180 | WARN_ON(!c1_pri80 && !c2_pri80); | ||
181 | if (c1_pri80 && c2_pri80 && c1_pri80 != c2_pri80) | ||
182 | return NULL; | ||
183 | |||
184 | if (c1->width > c2->width) | ||
185 | return c1; | ||
186 | return c2; | ||
187 | } | ||
188 | EXPORT_SYMBOL(cfg80211_chandef_compatible); | ||
189 | |||
190 | bool cfg80211_secondary_chans_ok(struct wiphy *wiphy, | ||
191 | u32 center_freq, u32 bandwidth, | ||
192 | u32 prohibited_flags) | ||
193 | { | ||
194 | struct ieee80211_channel *c; | ||
195 | u32 freq; | ||
196 | |||
197 | for (freq = center_freq - bandwidth/2 + 10; | ||
198 | freq <= center_freq + bandwidth/2 - 10; | ||
199 | freq += 20) { | ||
200 | c = ieee80211_get_channel(wiphy, freq); | ||
201 | if (!c || c->flags & prohibited_flags) | ||
202 | return false; | ||
203 | } | ||
204 | |||
205 | return true; | ||
206 | } | ||
207 | |||
208 | static bool cfg80211_check_beacon_chans(struct wiphy *wiphy, | ||
209 | u32 center_freq, u32 bw) | ||
210 | { | ||
211 | return cfg80211_secondary_chans_ok(wiphy, center_freq, bw, | ||
212 | IEEE80211_CHAN_DISABLED | | ||
213 | IEEE80211_CHAN_PASSIVE_SCAN | | ||
214 | IEEE80211_CHAN_NO_IBSS | | ||
215 | IEEE80211_CHAN_RADAR); | ||
216 | } | ||
217 | |||
218 | bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | ||
219 | struct cfg80211_chan_def *chandef) | ||
220 | { | ||
221 | u32 width; | ||
222 | bool res; | ||
223 | |||
224 | trace_cfg80211_reg_can_beacon(wiphy, chandef); | ||
225 | |||
226 | if (WARN_ON(!cfg80211_chan_def_valid(chandef))) { | ||
72 | trace_cfg80211_return_bool(false); | 227 | trace_cfg80211_return_bool(false); |
73 | return false; | 228 | return false; |
74 | } | 229 | } |
75 | 230 | ||
76 | /* we'll need a DFS capability later */ | 231 | switch (chandef->width) { |
77 | if (sec_chan->flags & (IEEE80211_CHAN_DISABLED | | 232 | case NL80211_CHAN_WIDTH_20_NOHT: |
78 | IEEE80211_CHAN_PASSIVE_SCAN | | 233 | case NL80211_CHAN_WIDTH_20: |
79 | IEEE80211_CHAN_NO_IBSS | | 234 | width = 20; |
80 | IEEE80211_CHAN_RADAR)) { | 235 | break; |
236 | case NL80211_CHAN_WIDTH_40: | ||
237 | width = 40; | ||
238 | break; | ||
239 | case NL80211_CHAN_WIDTH_80: | ||
240 | case NL80211_CHAN_WIDTH_80P80: | ||
241 | width = 80; | ||
242 | break; | ||
243 | case NL80211_CHAN_WIDTH_160: | ||
244 | width = 160; | ||
245 | break; | ||
246 | default: | ||
247 | WARN_ON_ONCE(1); | ||
81 | trace_cfg80211_return_bool(false); | 248 | trace_cfg80211_return_bool(false); |
82 | return false; | 249 | return false; |
83 | } | 250 | } |
84 | trace_cfg80211_return_bool(true); | 251 | |
85 | return true; | 252 | res = cfg80211_check_beacon_chans(wiphy, chandef->center_freq1, width); |
253 | |||
254 | if (res && chandef->center_freq2) | ||
255 | res = cfg80211_check_beacon_chans(wiphy, chandef->center_freq2, | ||
256 | width); | ||
257 | |||
258 | trace_cfg80211_return_bool(res); | ||
259 | return res; | ||
86 | } | 260 | } |
87 | EXPORT_SYMBOL(cfg80211_can_beacon_sec_chan); | 261 | EXPORT_SYMBOL(cfg80211_reg_can_beacon); |
88 | 262 | ||
89 | int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev, | 263 | int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev, |
90 | int freq, enum nl80211_channel_type chantype) | 264 | struct cfg80211_chan_def *chandef) |
91 | { | 265 | { |
92 | struct ieee80211_channel *chan; | ||
93 | |||
94 | if (!rdev->ops->set_monitor_channel) | 266 | if (!rdev->ops->set_monitor_channel) |
95 | return -EOPNOTSUPP; | 267 | return -EOPNOTSUPP; |
96 | if (!cfg80211_has_monitors_only(rdev)) | 268 | if (!cfg80211_has_monitors_only(rdev)) |
97 | return -EBUSY; | 269 | return -EBUSY; |
98 | 270 | ||
99 | chan = rdev_freq_to_chan(rdev, freq, chantype); | 271 | return rdev_set_monitor_channel(rdev, chandef); |
100 | if (!chan) | ||
101 | return -EINVAL; | ||
102 | |||
103 | return rdev_set_monitor_channel(rdev, chan, chantype); | ||
104 | } | 272 | } |
105 | 273 | ||
106 | void | 274 | void |
diff --git a/net/wireless/core.h b/net/wireless/core.h index e53831c876bb..a0c8decf6a47 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -309,9 +309,9 @@ int cfg80211_join_mesh(struct cfg80211_registered_device *rdev, | |||
309 | const struct mesh_config *conf); | 309 | const struct mesh_config *conf); |
310 | int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, | 310 | int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, |
311 | struct net_device *dev); | 311 | struct net_device *dev); |
312 | int cfg80211_set_mesh_freq(struct cfg80211_registered_device *rdev, | 312 | int cfg80211_set_mesh_channel(struct cfg80211_registered_device *rdev, |
313 | struct wireless_dev *wdev, int freq, | 313 | struct wireless_dev *wdev, |
314 | enum nl80211_channel_type channel_type); | 314 | struct cfg80211_chan_def *chandef); |
315 | 315 | ||
316 | /* AP */ | 316 | /* AP */ |
317 | int cfg80211_stop_ap(struct cfg80211_registered_device *rdev, | 317 | int cfg80211_stop_ap(struct cfg80211_registered_device *rdev, |
@@ -378,10 +378,8 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev); | |||
378 | int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, | 378 | int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, |
379 | struct wireless_dev *wdev, | 379 | struct wireless_dev *wdev, |
380 | struct ieee80211_channel *chan, bool offchan, | 380 | struct ieee80211_channel *chan, bool offchan, |
381 | enum nl80211_channel_type channel_type, | 381 | unsigned int wait, const u8 *buf, size_t len, |
382 | bool channel_type_valid, unsigned int wait, | 382 | bool no_cck, bool dont_wait_for_ack, u64 *cookie); |
383 | const u8 *buf, size_t len, bool no_cck, | ||
384 | bool dont_wait_for_ack, u64 *cookie); | ||
385 | void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa, | 383 | void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa, |
386 | const struct ieee80211_ht_cap *ht_capa_mask); | 384 | const struct ieee80211_ht_cap *ht_capa_mask); |
387 | 385 | ||
@@ -472,11 +470,8 @@ cfg80211_get_chan_state(struct wireless_dev *wdev, | |||
472 | struct ieee80211_channel **chan, | 470 | struct ieee80211_channel **chan, |
473 | enum cfg80211_chan_mode *chanmode); | 471 | enum cfg80211_chan_mode *chanmode); |
474 | 472 | ||
475 | struct ieee80211_channel * | ||
476 | rdev_freq_to_chan(struct cfg80211_registered_device *rdev, | ||
477 | int freq, enum nl80211_channel_type channel_type); | ||
478 | int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev, | 473 | int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev, |
479 | int freq, enum nl80211_channel_type chantype); | 474 | struct cfg80211_chan_def *chandef); |
480 | 475 | ||
481 | int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, | 476 | int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, |
482 | const u8 *rates, unsigned int n_rates, | 477 | const u8 *rates, unsigned int n_rates, |
@@ -488,6 +483,12 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev, | |||
488 | void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev, | 483 | void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev, |
489 | enum nl80211_iftype iftype, int num); | 484 | enum nl80211_iftype iftype, int num); |
490 | 485 | ||
486 | bool cfg80211_chan_def_valid(const struct cfg80211_chan_def *chandef); | ||
487 | |||
488 | bool cfg80211_secondary_chans_ok(struct wiphy *wiphy, | ||
489 | u32 center_freq, u32 bandwidth, | ||
490 | u32 prohibited_flags); | ||
491 | |||
491 | #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 | 492 | #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 |
492 | 493 | ||
493 | #ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS | 494 | #ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS |
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index 27941d5db72b..9b9551e4a6f9 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -100,9 +100,9 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, | |||
100 | * 11a for maximum compatibility. | 100 | * 11a for maximum compatibility. |
101 | */ | 101 | */ |
102 | struct ieee80211_supported_band *sband = | 102 | struct ieee80211_supported_band *sband = |
103 | rdev->wiphy.bands[params->channel->band]; | 103 | rdev->wiphy.bands[params->chandef.chan->band]; |
104 | int j; | 104 | int j; |
105 | u32 flag = params->channel->band == IEEE80211_BAND_5GHZ ? | 105 | u32 flag = params->chandef.chan->band == IEEE80211_BAND_5GHZ ? |
106 | IEEE80211_RATE_MANDATORY_A : | 106 | IEEE80211_RATE_MANDATORY_A : |
107 | IEEE80211_RATE_MANDATORY_B; | 107 | IEEE80211_RATE_MANDATORY_B; |
108 | 108 | ||
@@ -118,11 +118,11 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, | |||
118 | 118 | ||
119 | wdev->ibss_fixed = params->channel_fixed; | 119 | wdev->ibss_fixed = params->channel_fixed; |
120 | #ifdef CONFIG_CFG80211_WEXT | 120 | #ifdef CONFIG_CFG80211_WEXT |
121 | wdev->wext.ibss.channel = params->channel; | 121 | wdev->wext.ibss.chandef = params->chandef; |
122 | #endif | 122 | #endif |
123 | wdev->sme_state = CFG80211_SME_CONNECTING; | 123 | wdev->sme_state = CFG80211_SME_CONNECTING; |
124 | 124 | ||
125 | err = cfg80211_can_use_chan(rdev, wdev, params->channel, | 125 | err = cfg80211_can_use_chan(rdev, wdev, params->chandef.chan, |
126 | params->channel_fixed | 126 | params->channel_fixed |
127 | ? CHAN_MODE_SHARED | 127 | ? CHAN_MODE_SHARED |
128 | : CHAN_MODE_EXCLUSIVE); | 128 | : CHAN_MODE_EXCLUSIVE); |
@@ -251,7 +251,9 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, | |||
251 | wdev->wext.ibss.beacon_interval = 100; | 251 | wdev->wext.ibss.beacon_interval = 100; |
252 | 252 | ||
253 | /* try to find an IBSS channel if none requested ... */ | 253 | /* try to find an IBSS channel if none requested ... */ |
254 | if (!wdev->wext.ibss.channel) { | 254 | if (!wdev->wext.ibss.chandef.chan) { |
255 | wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; | ||
256 | |||
255 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | 257 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { |
256 | struct ieee80211_supported_band *sband; | 258 | struct ieee80211_supported_band *sband; |
257 | struct ieee80211_channel *chan; | 259 | struct ieee80211_channel *chan; |
@@ -266,15 +268,15 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, | |||
266 | continue; | 268 | continue; |
267 | if (chan->flags & IEEE80211_CHAN_DISABLED) | 269 | if (chan->flags & IEEE80211_CHAN_DISABLED) |
268 | continue; | 270 | continue; |
269 | wdev->wext.ibss.channel = chan; | 271 | wdev->wext.ibss.chandef.chan = chan; |
270 | break; | 272 | break; |
271 | } | 273 | } |
272 | 274 | ||
273 | if (wdev->wext.ibss.channel) | 275 | if (wdev->wext.ibss.chandef.chan) |
274 | break; | 276 | break; |
275 | } | 277 | } |
276 | 278 | ||
277 | if (!wdev->wext.ibss.channel) | 279 | if (!wdev->wext.ibss.chandef.chan) |
278 | return -EINVAL; | 280 | return -EINVAL; |
279 | } | 281 | } |
280 | 282 | ||
@@ -336,7 +338,7 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | |||
336 | return -EINVAL; | 338 | return -EINVAL; |
337 | } | 339 | } |
338 | 340 | ||
339 | if (wdev->wext.ibss.channel == chan) | 341 | if (wdev->wext.ibss.chandef.chan == chan) |
340 | return 0; | 342 | return 0; |
341 | 343 | ||
342 | wdev_lock(wdev); | 344 | wdev_lock(wdev); |
@@ -349,7 +351,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | |||
349 | return err; | 351 | return err; |
350 | 352 | ||
351 | if (chan) { | 353 | if (chan) { |
352 | wdev->wext.ibss.channel = chan; | 354 | wdev->wext.ibss.chandef.chan = chan; |
355 | wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; | ||
353 | wdev->wext.ibss.channel_fixed = true; | 356 | wdev->wext.ibss.channel_fixed = true; |
354 | } else { | 357 | } else { |
355 | /* cfg80211_ibss_wext_join will pick one if needed */ | 358 | /* cfg80211_ibss_wext_join will pick one if needed */ |
@@ -379,8 +382,8 @@ int cfg80211_ibss_wext_giwfreq(struct net_device *dev, | |||
379 | wdev_lock(wdev); | 382 | wdev_lock(wdev); |
380 | if (wdev->current_bss) | 383 | if (wdev->current_bss) |
381 | chan = wdev->current_bss->pub.channel; | 384 | chan = wdev->current_bss->pub.channel; |
382 | else if (wdev->wext.ibss.channel) | 385 | else if (wdev->wext.ibss.chandef.chan) |
383 | chan = wdev->wext.ibss.channel; | 386 | chan = wdev->wext.ibss.chandef.chan; |
384 | wdev_unlock(wdev); | 387 | wdev_unlock(wdev); |
385 | 388 | ||
386 | if (chan) { | 389 | if (chan) { |
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index 966cfc4cd79d..3ee5a7282283 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c | |||
@@ -73,8 +73,6 @@ const struct mesh_config default_mesh_config = { | |||
73 | 73 | ||
74 | const struct mesh_setup default_mesh_setup = { | 74 | const struct mesh_setup default_mesh_setup = { |
75 | /* cfg80211_join_mesh() will pick a channel if needed */ | 75 | /* cfg80211_join_mesh() will pick a channel if needed */ |
76 | .channel = NULL, | ||
77 | .channel_type = NL80211_CHAN_NO_HT, | ||
78 | .sync_method = IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET, | 76 | .sync_method = IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET, |
79 | .path_sel_proto = IEEE80211_PATH_PROTOCOL_HWMP, | 77 | .path_sel_proto = IEEE80211_PATH_PROTOCOL_HWMP, |
80 | .path_metric = IEEE80211_PATH_METRIC_AIRTIME, | 78 | .path_metric = IEEE80211_PATH_METRIC_AIRTIME, |
@@ -111,13 +109,12 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, | |||
111 | if (!rdev->ops->join_mesh) | 109 | if (!rdev->ops->join_mesh) |
112 | return -EOPNOTSUPP; | 110 | return -EOPNOTSUPP; |
113 | 111 | ||
114 | if (!setup->channel) { | 112 | if (!setup->chandef.chan) { |
115 | /* if no channel explicitly given, use preset channel */ | 113 | /* if no channel explicitly given, use preset channel */ |
116 | setup->channel = wdev->preset_chan; | 114 | setup->chandef = wdev->preset_chandef; |
117 | setup->channel_type = wdev->preset_chantype; | ||
118 | } | 115 | } |
119 | 116 | ||
120 | if (!setup->channel) { | 117 | if (!setup->chandef.chan) { |
121 | /* if we don't have that either, use the first usable channel */ | 118 | /* if we don't have that either, use the first usable channel */ |
122 | enum ieee80211_band band; | 119 | enum ieee80211_band band; |
123 | 120 | ||
@@ -137,26 +134,25 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, | |||
137 | IEEE80211_CHAN_DISABLED | | 134 | IEEE80211_CHAN_DISABLED | |
138 | IEEE80211_CHAN_RADAR)) | 135 | IEEE80211_CHAN_RADAR)) |
139 | continue; | 136 | continue; |
140 | setup->channel = chan; | 137 | setup->chandef.chan = chan; |
141 | break; | 138 | break; |
142 | } | 139 | } |
143 | 140 | ||
144 | if (setup->channel) | 141 | if (setup->chandef.chan) |
145 | break; | 142 | break; |
146 | } | 143 | } |
147 | 144 | ||
148 | /* no usable channel ... */ | 145 | /* no usable channel ... */ |
149 | if (!setup->channel) | 146 | if (!setup->chandef.chan) |
150 | return -EINVAL; | 147 | return -EINVAL; |
151 | 148 | ||
152 | setup->channel_type = NL80211_CHAN_NO_HT; | 149 | setup->chandef.width = NL80211_CHAN_WIDTH_20_NOHT;; |
153 | } | 150 | } |
154 | 151 | ||
155 | if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, setup->channel, | 152 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef)) |
156 | setup->channel_type)) | ||
157 | return -EINVAL; | 153 | return -EINVAL; |
158 | 154 | ||
159 | err = cfg80211_can_use_chan(rdev, wdev, setup->channel, | 155 | err = cfg80211_can_use_chan(rdev, wdev, setup->chandef.chan, |
160 | CHAN_MODE_SHARED); | 156 | CHAN_MODE_SHARED); |
161 | if (err) | 157 | if (err) |
162 | return err; | 158 | return err; |
@@ -165,7 +161,7 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, | |||
165 | if (!err) { | 161 | if (!err) { |
166 | memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len); | 162 | memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len); |
167 | wdev->mesh_id_len = setup->mesh_id_len; | 163 | wdev->mesh_id_len = setup->mesh_id_len; |
168 | wdev->channel = setup->channel; | 164 | wdev->channel = setup->chandef.chan; |
169 | } | 165 | } |
170 | 166 | ||
171 | return err; | 167 | return err; |
@@ -188,20 +184,12 @@ int cfg80211_join_mesh(struct cfg80211_registered_device *rdev, | |||
188 | return err; | 184 | return err; |
189 | } | 185 | } |
190 | 186 | ||
191 | int cfg80211_set_mesh_freq(struct cfg80211_registered_device *rdev, | 187 | int cfg80211_set_mesh_channel(struct cfg80211_registered_device *rdev, |
192 | struct wireless_dev *wdev, int freq, | 188 | struct wireless_dev *wdev, |
193 | enum nl80211_channel_type channel_type) | 189 | struct cfg80211_chan_def *chandef) |
194 | { | 190 | { |
195 | struct ieee80211_channel *channel; | ||
196 | int err; | 191 | int err; |
197 | 192 | ||
198 | channel = rdev_freq_to_chan(rdev, freq, channel_type); | ||
199 | if (!channel || !cfg80211_can_beacon_sec_chan(&rdev->wiphy, | ||
200 | channel, | ||
201 | channel_type)) { | ||
202 | return -EINVAL; | ||
203 | } | ||
204 | |||
205 | /* | 193 | /* |
206 | * Workaround for libertas (only!), it puts the interface | 194 | * Workaround for libertas (only!), it puts the interface |
207 | * into mesh mode but doesn't implement join_mesh. Instead, | 195 | * into mesh mode but doesn't implement join_mesh. Instead, |
@@ -210,21 +198,21 @@ int cfg80211_set_mesh_freq(struct cfg80211_registered_device *rdev, | |||
210 | * compatible with 802.11 mesh. | 198 | * compatible with 802.11 mesh. |
211 | */ | 199 | */ |
212 | if (rdev->ops->libertas_set_mesh_channel) { | 200 | if (rdev->ops->libertas_set_mesh_channel) { |
213 | if (channel_type != NL80211_CHAN_NO_HT) | 201 | if (chandef->width != NL80211_CHAN_WIDTH_20_NOHT) |
214 | return -EINVAL; | 202 | return -EINVAL; |
215 | 203 | ||
216 | if (!netif_running(wdev->netdev)) | 204 | if (!netif_running(wdev->netdev)) |
217 | return -ENETDOWN; | 205 | return -ENETDOWN; |
218 | 206 | ||
219 | err = cfg80211_can_use_chan(rdev, wdev, channel, | 207 | err = cfg80211_can_use_chan(rdev, wdev, chandef->chan, |
220 | CHAN_MODE_SHARED); | 208 | CHAN_MODE_SHARED); |
221 | if (err) | 209 | if (err) |
222 | return err; | 210 | return err; |
223 | 211 | ||
224 | err = rdev_libertas_set_mesh_channel(rdev, wdev->netdev, | 212 | err = rdev_libertas_set_mesh_channel(rdev, wdev->netdev, |
225 | channel); | 213 | chandef->chan); |
226 | if (!err) | 214 | if (!err) |
227 | wdev->channel = channel; | 215 | wdev->channel = chandef->chan; |
228 | 216 | ||
229 | return err; | 217 | return err; |
230 | } | 218 | } |
@@ -232,8 +220,7 @@ int cfg80211_set_mesh_freq(struct cfg80211_registered_device *rdev, | |||
232 | if (wdev->mesh_id_len) | 220 | if (wdev->mesh_id_len) |
233 | return -EBUSY; | 221 | return -EBUSY; |
234 | 222 | ||
235 | wdev->preset_chan = channel; | 223 | wdev->preset_chandef = *chandef; |
236 | wdev->preset_chantype = channel_type; | ||
237 | return 0; | 224 | return 0; |
238 | } | 225 | } |
239 | 226 | ||
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 4bfd14f7c592..5e8123ee63fd 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -579,31 +579,25 @@ void cfg80211_mlme_down(struct cfg80211_registered_device *rdev, | |||
579 | 579 | ||
580 | void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, | 580 | void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, |
581 | struct ieee80211_channel *chan, | 581 | struct ieee80211_channel *chan, |
582 | enum nl80211_channel_type channel_type, | ||
583 | unsigned int duration, gfp_t gfp) | 582 | unsigned int duration, gfp_t gfp) |
584 | { | 583 | { |
585 | struct wiphy *wiphy = wdev->wiphy; | 584 | struct wiphy *wiphy = wdev->wiphy; |
586 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 585 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
587 | 586 | ||
588 | trace_cfg80211_ready_on_channel(wdev, cookie, chan, channel_type, | 587 | trace_cfg80211_ready_on_channel(wdev, cookie, chan, duration); |
589 | duration); | 588 | nl80211_send_remain_on_channel(rdev, wdev, cookie, chan, duration, gfp); |
590 | nl80211_send_remain_on_channel(rdev, wdev, cookie, chan, channel_type, | ||
591 | duration, gfp); | ||
592 | } | 589 | } |
593 | EXPORT_SYMBOL(cfg80211_ready_on_channel); | 590 | EXPORT_SYMBOL(cfg80211_ready_on_channel); |
594 | 591 | ||
595 | void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, | 592 | void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, |
596 | struct ieee80211_channel *chan, | 593 | struct ieee80211_channel *chan, |
597 | enum nl80211_channel_type channel_type, | ||
598 | gfp_t gfp) | 594 | gfp_t gfp) |
599 | { | 595 | { |
600 | struct wiphy *wiphy = wdev->wiphy; | 596 | struct wiphy *wiphy = wdev->wiphy; |
601 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 597 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
602 | 598 | ||
603 | trace_cfg80211_ready_on_channel_expired(wdev, cookie, chan, | 599 | trace_cfg80211_ready_on_channel_expired(wdev, cookie, chan); |
604 | channel_type); | 600 | nl80211_send_remain_on_channel_cancel(rdev, wdev, cookie, chan, gfp); |
605 | nl80211_send_remain_on_channel_cancel(rdev, wdev, cookie, chan, | ||
606 | channel_type, gfp); | ||
607 | } | 601 | } |
608 | EXPORT_SYMBOL(cfg80211_remain_on_channel_expired); | 602 | EXPORT_SYMBOL(cfg80211_remain_on_channel_expired); |
609 | 603 | ||
@@ -758,10 +752,8 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev) | |||
758 | int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, | 752 | int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, |
759 | struct wireless_dev *wdev, | 753 | struct wireless_dev *wdev, |
760 | struct ieee80211_channel *chan, bool offchan, | 754 | struct ieee80211_channel *chan, bool offchan, |
761 | enum nl80211_channel_type channel_type, | 755 | unsigned int wait, const u8 *buf, size_t len, |
762 | bool channel_type_valid, unsigned int wait, | 756 | bool no_cck, bool dont_wait_for_ack, u64 *cookie) |
763 | const u8 *buf, size_t len, bool no_cck, | ||
764 | bool dont_wait_for_ack, u64 *cookie) | ||
765 | { | 757 | { |
766 | const struct ieee80211_mgmt *mgmt; | 758 | const struct ieee80211_mgmt *mgmt; |
767 | u16 stype; | 759 | u16 stype; |
@@ -855,7 +847,6 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, | |||
855 | 847 | ||
856 | /* Transmit the Action frame as requested by user space */ | 848 | /* Transmit the Action frame as requested by user space */ |
857 | return rdev_mgmt_tx(rdev, wdev, chan, offchan, | 849 | return rdev_mgmt_tx(rdev, wdev, chan, offchan, |
858 | channel_type, channel_type_valid, | ||
859 | wait, buf, len, no_cck, dont_wait_for_ack, | 850 | wait, buf, len, no_cck, dont_wait_for_ack, |
860 | cookie); | 851 | cookie); |
861 | } | 852 | } |
@@ -997,15 +988,14 @@ void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, | |||
997 | } | 988 | } |
998 | EXPORT_SYMBOL(cfg80211_pmksa_candidate_notify); | 989 | EXPORT_SYMBOL(cfg80211_pmksa_candidate_notify); |
999 | 990 | ||
1000 | void cfg80211_ch_switch_notify(struct net_device *dev, int freq, | 991 | void cfg80211_ch_switch_notify(struct net_device *dev, |
1001 | enum nl80211_channel_type type) | 992 | struct cfg80211_chan_def *chandef) |
1002 | { | 993 | { |
1003 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 994 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
1004 | struct wiphy *wiphy = wdev->wiphy; | 995 | struct wiphy *wiphy = wdev->wiphy; |
1005 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 996 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
1006 | struct ieee80211_channel *chan; | ||
1007 | 997 | ||
1008 | trace_cfg80211_ch_switch_notify(dev, freq, type); | 998 | trace_cfg80211_ch_switch_notify(dev, chandef); |
1009 | 999 | ||
1010 | wdev_lock(wdev); | 1000 | wdev_lock(wdev); |
1011 | 1001 | ||
@@ -1013,12 +1003,8 @@ void cfg80211_ch_switch_notify(struct net_device *dev, int freq, | |||
1013 | wdev->iftype != NL80211_IFTYPE_P2P_GO)) | 1003 | wdev->iftype != NL80211_IFTYPE_P2P_GO)) |
1014 | goto out; | 1004 | goto out; |
1015 | 1005 | ||
1016 | chan = rdev_freq_to_chan(rdev, freq, type); | 1006 | wdev->channel = chandef->chan; |
1017 | if (WARN_ON(!chan)) | 1007 | nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL); |
1018 | goto out; | ||
1019 | |||
1020 | wdev->channel = chan; | ||
1021 | nl80211_ch_switch_notify(rdev, dev, freq, type, GFP_KERNEL); | ||
1022 | out: | 1008 | out: |
1023 | wdev_unlock(wdev); | 1009 | wdev_unlock(wdev); |
1024 | return; | 1010 | return; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4c427fa5c450..d038fa45ecd1 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -223,8 +223,13 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
223 | [NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING, | 223 | [NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING, |
224 | .len = 20-1 }, | 224 | .len = 20-1 }, |
225 | [NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED }, | 225 | [NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED }, |
226 | |||
226 | [NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 }, | 227 | [NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 }, |
227 | [NL80211_ATTR_WIPHY_CHANNEL_TYPE] = { .type = NLA_U32 }, | 228 | [NL80211_ATTR_WIPHY_CHANNEL_TYPE] = { .type = NLA_U32 }, |
229 | [NL80211_ATTR_CHANNEL_WIDTH] = { .type = NLA_U32 }, | ||
230 | [NL80211_ATTR_CENTER_FREQ1] = { .type = NLA_U32 }, | ||
231 | [NL80211_ATTR_CENTER_FREQ2] = { .type = NLA_U32 }, | ||
232 | |||
228 | [NL80211_ATTR_WIPHY_RETRY_SHORT] = { .type = NLA_U8 }, | 233 | [NL80211_ATTR_WIPHY_RETRY_SHORT] = { .type = NLA_U8 }, |
229 | [NL80211_ATTR_WIPHY_RETRY_LONG] = { .type = NLA_U8 }, | 234 | [NL80211_ATTR_WIPHY_RETRY_LONG] = { .type = NLA_U8 }, |
230 | [NL80211_ATTR_WIPHY_FRAG_THRESHOLD] = { .type = NLA_U32 }, | 235 | [NL80211_ATTR_WIPHY_FRAG_THRESHOLD] = { .type = NLA_U32 }, |
@@ -1360,51 +1365,139 @@ static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev) | |||
1360 | wdev->iftype == NL80211_IFTYPE_P2P_GO; | 1365 | wdev->iftype == NL80211_IFTYPE_P2P_GO; |
1361 | } | 1366 | } |
1362 | 1367 | ||
1363 | static bool nl80211_valid_channel_type(struct genl_info *info, | 1368 | static int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, |
1364 | enum nl80211_channel_type *channel_type) | 1369 | struct genl_info *info, |
1370 | struct cfg80211_chan_def *chandef) | ||
1365 | { | 1371 | { |
1366 | enum nl80211_channel_type tmp; | 1372 | struct ieee80211_sta_ht_cap *ht_cap; |
1373 | struct ieee80211_sta_vht_cap *vht_cap; | ||
1374 | u32 control_freq, width; | ||
1367 | 1375 | ||
1368 | if (!info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) | 1376 | if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) |
1369 | return false; | 1377 | return -EINVAL; |
1370 | 1378 | ||
1371 | tmp = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); | 1379 | control_freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); |
1372 | if (tmp != NL80211_CHAN_NO_HT && | ||
1373 | tmp != NL80211_CHAN_HT20 && | ||
1374 | tmp != NL80211_CHAN_HT40PLUS && | ||
1375 | tmp != NL80211_CHAN_HT40MINUS) | ||
1376 | return false; | ||
1377 | 1380 | ||
1378 | if (channel_type) | 1381 | chandef->chan = ieee80211_get_channel(&rdev->wiphy, control_freq); |
1379 | *channel_type = tmp; | 1382 | chandef->width = NL80211_CHAN_WIDTH_20_NOHT; |
1383 | chandef->center_freq1 = control_freq; | ||
1384 | chandef->center_freq2 = 0; | ||
1380 | 1385 | ||
1381 | return true; | 1386 | /* Primary channel not allowed */ |
1387 | if (!chandef->chan || chandef->chan->flags & IEEE80211_CHAN_DISABLED) | ||
1388 | return -EINVAL; | ||
1389 | |||
1390 | if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { | ||
1391 | enum nl80211_channel_type chantype; | ||
1392 | |||
1393 | chantype = nla_get_u32( | ||
1394 | info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); | ||
1395 | |||
1396 | switch (chantype) { | ||
1397 | case NL80211_CHAN_NO_HT: | ||
1398 | case NL80211_CHAN_HT20: | ||
1399 | case NL80211_CHAN_HT40PLUS: | ||
1400 | case NL80211_CHAN_HT40MINUS: | ||
1401 | cfg80211_chandef_create(chandef, chandef->chan, | ||
1402 | chantype); | ||
1403 | break; | ||
1404 | default: | ||
1405 | return -EINVAL; | ||
1406 | } | ||
1407 | } else if (info->attrs[NL80211_ATTR_CHANNEL_WIDTH]) { | ||
1408 | chandef->width = | ||
1409 | nla_get_u32(info->attrs[NL80211_ATTR_CHANNEL_WIDTH]); | ||
1410 | if (info->attrs[NL80211_ATTR_CENTER_FREQ1]) | ||
1411 | chandef->center_freq1 = | ||
1412 | nla_get_u32( | ||
1413 | info->attrs[NL80211_ATTR_CENTER_FREQ1]); | ||
1414 | if (info->attrs[NL80211_ATTR_CENTER_FREQ2]) | ||
1415 | chandef->center_freq2 = | ||
1416 | nla_get_u32( | ||
1417 | info->attrs[NL80211_ATTR_CENTER_FREQ2]); | ||
1418 | } | ||
1419 | |||
1420 | ht_cap = &rdev->wiphy.bands[chandef->chan->band]->ht_cap; | ||
1421 | vht_cap = &rdev->wiphy.bands[chandef->chan->band]->vht_cap; | ||
1422 | |||
1423 | if (!cfg80211_chan_def_valid(chandef)) | ||
1424 | return -EINVAL; | ||
1425 | |||
1426 | switch (chandef->width) { | ||
1427 | case NL80211_CHAN_WIDTH_20: | ||
1428 | if (!ht_cap->ht_supported) | ||
1429 | return -EINVAL; | ||
1430 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
1431 | width = 20; | ||
1432 | break; | ||
1433 | case NL80211_CHAN_WIDTH_40: | ||
1434 | width = 40; | ||
1435 | /* quick early regulatory check */ | ||
1436 | if (chandef->center_freq1 < control_freq && | ||
1437 | chandef->chan->flags & IEEE80211_CHAN_NO_HT40MINUS) | ||
1438 | return -EINVAL; | ||
1439 | if (chandef->center_freq1 > control_freq && | ||
1440 | chandef->chan->flags & IEEE80211_CHAN_NO_HT40PLUS) | ||
1441 | return -EINVAL; | ||
1442 | if (!ht_cap->ht_supported) | ||
1443 | return -EINVAL; | ||
1444 | if (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) || | ||
1445 | ht_cap->cap & IEEE80211_HT_CAP_40MHZ_INTOLERANT) | ||
1446 | return -EINVAL; | ||
1447 | break; | ||
1448 | case NL80211_CHAN_WIDTH_80: | ||
1449 | width = 80; | ||
1450 | if (!vht_cap->vht_supported) | ||
1451 | return -EINVAL; | ||
1452 | break; | ||
1453 | case NL80211_CHAN_WIDTH_80P80: | ||
1454 | width = 80; | ||
1455 | if (!vht_cap->vht_supported) | ||
1456 | return -EINVAL; | ||
1457 | if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) | ||
1458 | return -EINVAL; | ||
1459 | break; | ||
1460 | case NL80211_CHAN_WIDTH_160: | ||
1461 | width = 160; | ||
1462 | if (!vht_cap->vht_supported) | ||
1463 | return -EINVAL; | ||
1464 | if (!(vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ)) | ||
1465 | return -EINVAL; | ||
1466 | break; | ||
1467 | default: | ||
1468 | return -EINVAL; | ||
1469 | } | ||
1470 | |||
1471 | if (!cfg80211_secondary_chans_ok(&rdev->wiphy, chandef->center_freq1, | ||
1472 | width, IEEE80211_CHAN_DISABLED)) | ||
1473 | return -EINVAL; | ||
1474 | if (chandef->center_freq2 && | ||
1475 | !cfg80211_secondary_chans_ok(&rdev->wiphy, chandef->center_freq2, | ||
1476 | width, IEEE80211_CHAN_DISABLED)) | ||
1477 | return -EINVAL; | ||
1478 | |||
1479 | /* TODO: missing regulatory check on bandwidth */ | ||
1480 | |||
1481 | return 0; | ||
1382 | } | 1482 | } |
1383 | 1483 | ||
1384 | static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, | 1484 | static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, |
1385 | struct wireless_dev *wdev, | 1485 | struct wireless_dev *wdev, |
1386 | struct genl_info *info) | 1486 | struct genl_info *info) |
1387 | { | 1487 | { |
1388 | struct ieee80211_channel *channel; | 1488 | struct cfg80211_chan_def chandef; |
1389 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | ||
1390 | u32 freq; | ||
1391 | int result; | 1489 | int result; |
1392 | enum nl80211_iftype iftype = NL80211_IFTYPE_MONITOR; | 1490 | enum nl80211_iftype iftype = NL80211_IFTYPE_MONITOR; |
1393 | 1491 | ||
1394 | if (wdev) | 1492 | if (wdev) |
1395 | iftype = wdev->iftype; | 1493 | iftype = wdev->iftype; |
1396 | 1494 | ||
1397 | if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) | ||
1398 | return -EINVAL; | ||
1399 | |||
1400 | if (!nl80211_can_set_dev_channel(wdev)) | 1495 | if (!nl80211_can_set_dev_channel(wdev)) |
1401 | return -EOPNOTSUPP; | 1496 | return -EOPNOTSUPP; |
1402 | 1497 | ||
1403 | if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] && | 1498 | result = nl80211_parse_chandef(rdev, info, &chandef); |
1404 | !nl80211_valid_channel_type(info, &channel_type)) | 1499 | if (result) |
1405 | return -EINVAL; | 1500 | return result; |
1406 | |||
1407 | freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); | ||
1408 | 1501 | ||
1409 | mutex_lock(&rdev->devlist_mtx); | 1502 | mutex_lock(&rdev->devlist_mtx); |
1410 | switch (iftype) { | 1503 | switch (iftype) { |
@@ -1414,22 +1507,18 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, | |||
1414 | result = -EBUSY; | 1507 | result = -EBUSY; |
1415 | break; | 1508 | break; |
1416 | } | 1509 | } |
1417 | channel = rdev_freq_to_chan(rdev, freq, channel_type); | 1510 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef)) { |
1418 | if (!channel || !cfg80211_can_beacon_sec_chan(&rdev->wiphy, | ||
1419 | channel, | ||
1420 | channel_type)) { | ||
1421 | result = -EINVAL; | 1511 | result = -EINVAL; |
1422 | break; | 1512 | break; |
1423 | } | 1513 | } |
1424 | wdev->preset_chan = channel; | 1514 | wdev->preset_chandef = chandef; |
1425 | wdev->preset_chantype = channel_type; | ||
1426 | result = 0; | 1515 | result = 0; |
1427 | break; | 1516 | break; |
1428 | case NL80211_IFTYPE_MESH_POINT: | 1517 | case NL80211_IFTYPE_MESH_POINT: |
1429 | result = cfg80211_set_mesh_freq(rdev, wdev, freq, channel_type); | 1518 | result = cfg80211_set_mesh_channel(rdev, wdev, &chandef); |
1430 | break; | 1519 | break; |
1431 | case NL80211_IFTYPE_MONITOR: | 1520 | case NL80211_IFTYPE_MONITOR: |
1432 | result = cfg80211_set_monitor_channel(rdev, freq, channel_type); | 1521 | result = cfg80211_set_monitor_channel(rdev, &chandef); |
1433 | break; | 1522 | break; |
1434 | default: | 1523 | default: |
1435 | result = -EINVAL; | 1524 | result = -EINVAL; |
@@ -1749,6 +1838,35 @@ static inline u64 wdev_id(struct wireless_dev *wdev) | |||
1749 | ((u64)wiphy_to_dev(wdev->wiphy)->wiphy_idx << 32); | 1838 | ((u64)wiphy_to_dev(wdev->wiphy)->wiphy_idx << 32); |
1750 | } | 1839 | } |
1751 | 1840 | ||
1841 | static int nl80211_send_chandef(struct sk_buff *msg, | ||
1842 | struct cfg80211_chan_def *chandef) | ||
1843 | { | ||
1844 | WARN_ON(!cfg80211_chan_def_valid(chandef)); | ||
1845 | |||
1846 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, | ||
1847 | chandef->chan->center_freq)) | ||
1848 | return -ENOBUFS; | ||
1849 | switch (chandef->width) { | ||
1850 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
1851 | case NL80211_CHAN_WIDTH_20: | ||
1852 | case NL80211_CHAN_WIDTH_40: | ||
1853 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, | ||
1854 | cfg80211_get_chandef_type(chandef))) | ||
1855 | return -ENOBUFS; | ||
1856 | break; | ||
1857 | default: | ||
1858 | break; | ||
1859 | } | ||
1860 | if (nla_put_u32(msg, NL80211_ATTR_CHANNEL_WIDTH, chandef->width)) | ||
1861 | return -ENOBUFS; | ||
1862 | if (nla_put_u32(msg, NL80211_ATTR_CENTER_FREQ1, chandef->center_freq1)) | ||
1863 | return -ENOBUFS; | ||
1864 | if (chandef->center_freq2 && | ||
1865 | nla_put_u32(msg, NL80211_ATTR_CENTER_FREQ2, chandef->center_freq2)) | ||
1866 | return -ENOBUFS; | ||
1867 | return 0; | ||
1868 | } | ||
1869 | |||
1752 | static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, | 1870 | static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, |
1753 | struct cfg80211_registered_device *rdev, | 1871 | struct cfg80211_registered_device *rdev, |
1754 | struct wireless_dev *wdev) | 1872 | struct wireless_dev *wdev) |
@@ -1775,16 +1893,14 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag | |||
1775 | goto nla_put_failure; | 1893 | goto nla_put_failure; |
1776 | 1894 | ||
1777 | if (rdev->ops->get_channel) { | 1895 | if (rdev->ops->get_channel) { |
1778 | struct ieee80211_channel *chan; | 1896 | int ret; |
1779 | enum nl80211_channel_type channel_type; | 1897 | struct cfg80211_chan_def chandef; |
1780 | 1898 | ||
1781 | chan = rdev_get_channel(rdev, wdev, &channel_type); | 1899 | ret = rdev_get_channel(rdev, wdev, &chandef); |
1782 | if (chan && | 1900 | if (ret == 0) { |
1783 | (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, | 1901 | if (nl80211_send_chandef(msg, &chandef)) |
1784 | chan->center_freq) || | 1902 | goto nla_put_failure; |
1785 | nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, | 1903 | } |
1786 | channel_type))) | ||
1787 | goto nla_put_failure; | ||
1788 | } | 1904 | } |
1789 | 1905 | ||
1790 | if (wdev->ssid_len) { | 1906 | if (wdev->ssid_len) { |
@@ -2492,11 +2608,10 @@ static bool nl80211_get_ap_channel(struct cfg80211_registered_device *rdev, | |||
2492 | wdev->iftype != NL80211_IFTYPE_P2P_GO) | 2608 | wdev->iftype != NL80211_IFTYPE_P2P_GO) |
2493 | continue; | 2609 | continue; |
2494 | 2610 | ||
2495 | if (!wdev->preset_chan) | 2611 | if (!wdev->preset_chandef.chan) |
2496 | continue; | 2612 | continue; |
2497 | 2613 | ||
2498 | params->channel = wdev->preset_chan; | 2614 | params->chandef = wdev->preset_chandef; |
2499 | params->channel_type = wdev->preset_chantype; | ||
2500 | ret = true; | 2615 | ret = true; |
2501 | break; | 2616 | break; |
2502 | } | 2617 | } |
@@ -2618,30 +2733,19 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) | |||
2618 | } | 2733 | } |
2619 | 2734 | ||
2620 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { | 2735 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { |
2621 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | 2736 | err = nl80211_parse_chandef(rdev, info, ¶ms.chandef); |
2622 | 2737 | if (err) | |
2623 | if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] && | 2738 | return err; |
2624 | !nl80211_valid_channel_type(info, &channel_type)) | 2739 | } else if (wdev->preset_chandef.chan) { |
2625 | return -EINVAL; | 2740 | params.chandef = wdev->preset_chandef; |
2626 | |||
2627 | params.channel = rdev_freq_to_chan(rdev, | ||
2628 | nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]), | ||
2629 | channel_type); | ||
2630 | if (!params.channel) | ||
2631 | return -EINVAL; | ||
2632 | params.channel_type = channel_type; | ||
2633 | } else if (wdev->preset_chan) { | ||
2634 | params.channel = wdev->preset_chan; | ||
2635 | params.channel_type = wdev->preset_chantype; | ||
2636 | } else if (!nl80211_get_ap_channel(rdev, ¶ms)) | 2741 | } else if (!nl80211_get_ap_channel(rdev, ¶ms)) |
2637 | return -EINVAL; | 2742 | return -EINVAL; |
2638 | 2743 | ||
2639 | if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, params.channel, | 2744 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef)) |
2640 | params.channel_type)) | ||
2641 | return -EINVAL; | 2745 | return -EINVAL; |
2642 | 2746 | ||
2643 | mutex_lock(&rdev->devlist_mtx); | 2747 | mutex_lock(&rdev->devlist_mtx); |
2644 | err = cfg80211_can_use_chan(rdev, wdev, params.channel, | 2748 | err = cfg80211_can_use_chan(rdev, wdev, params.chandef.chan, |
2645 | CHAN_MODE_SHARED); | 2749 | CHAN_MODE_SHARED); |
2646 | mutex_unlock(&rdev->devlist_mtx); | 2750 | mutex_unlock(&rdev->devlist_mtx); |
2647 | 2751 | ||
@@ -2650,10 +2754,9 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) | |||
2650 | 2754 | ||
2651 | err = rdev_start_ap(rdev, dev, ¶ms); | 2755 | err = rdev_start_ap(rdev, dev, ¶ms); |
2652 | if (!err) { | 2756 | if (!err) { |
2653 | wdev->preset_chan = params.channel; | 2757 | wdev->preset_chandef = params.chandef; |
2654 | wdev->preset_chantype = params.channel_type; | ||
2655 | wdev->beacon_interval = params.beacon_interval; | 2758 | wdev->beacon_interval = params.beacon_interval; |
2656 | wdev->channel = params.channel; | 2759 | wdev->channel = params.chandef.chan; |
2657 | wdev->ssid_len = params.ssid_len; | 2760 | wdev->ssid_len = params.ssid_len; |
2658 | memcpy(wdev->ssid, params.ssid, wdev->ssid_len); | 2761 | memcpy(wdev->ssid, params.ssid, wdev->ssid_len); |
2659 | } | 2762 | } |
@@ -2787,29 +2890,52 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, | |||
2787 | 2890 | ||
2788 | rate = nla_nest_start(msg, attr); | 2891 | rate = nla_nest_start(msg, attr); |
2789 | if (!rate) | 2892 | if (!rate) |
2790 | goto nla_put_failure; | 2893 | return false; |
2791 | 2894 | ||
2792 | /* cfg80211_calculate_bitrate will return 0 for mcs >= 32 */ | 2895 | /* cfg80211_calculate_bitrate will return 0 for mcs >= 32 */ |
2793 | bitrate = cfg80211_calculate_bitrate(info); | 2896 | bitrate = cfg80211_calculate_bitrate(info); |
2794 | /* report 16-bit bitrate only if we can */ | 2897 | /* report 16-bit bitrate only if we can */ |
2795 | bitrate_compat = bitrate < (1UL << 16) ? bitrate : 0; | 2898 | bitrate_compat = bitrate < (1UL << 16) ? bitrate : 0; |
2796 | if ((bitrate > 0 && | 2899 | if (bitrate > 0 && |
2797 | nla_put_u32(msg, NL80211_RATE_INFO_BITRATE32, bitrate)) || | 2900 | nla_put_u32(msg, NL80211_RATE_INFO_BITRATE32, bitrate)) |
2798 | (bitrate_compat > 0 && | 2901 | return false; |
2799 | nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate_compat)) || | 2902 | if (bitrate_compat > 0 && |
2800 | ((info->flags & RATE_INFO_FLAGS_MCS) && | 2903 | nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate_compat)) |
2801 | nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs)) || | 2904 | return false; |
2802 | ((info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) && | 2905 | |
2803 | nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH)) || | 2906 | if (info->flags & RATE_INFO_FLAGS_MCS) { |
2804 | ((info->flags & RATE_INFO_FLAGS_SHORT_GI) && | 2907 | if (nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs)) |
2805 | nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI))) | 2908 | return false; |
2806 | goto nla_put_failure; | 2909 | if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH && |
2910 | nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH)) | ||
2911 | return false; | ||
2912 | if (info->flags & RATE_INFO_FLAGS_SHORT_GI && | ||
2913 | nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) | ||
2914 | return false; | ||
2915 | } else if (info->flags & RATE_INFO_FLAGS_VHT_MCS) { | ||
2916 | if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_MCS, info->mcs)) | ||
2917 | return false; | ||
2918 | if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_NSS, info->nss)) | ||
2919 | return false; | ||
2920 | if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH && | ||
2921 | nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH)) | ||
2922 | return false; | ||
2923 | if (info->flags & RATE_INFO_FLAGS_80_MHZ_WIDTH && | ||
2924 | nla_put_flag(msg, NL80211_RATE_INFO_80_MHZ_WIDTH)) | ||
2925 | return false; | ||
2926 | if (info->flags & RATE_INFO_FLAGS_80P80_MHZ_WIDTH && | ||
2927 | nla_put_flag(msg, NL80211_RATE_INFO_80P80_MHZ_WIDTH)) | ||
2928 | return false; | ||
2929 | if (info->flags & RATE_INFO_FLAGS_160_MHZ_WIDTH && | ||
2930 | nla_put_flag(msg, NL80211_RATE_INFO_160_MHZ_WIDTH)) | ||
2931 | return false; | ||
2932 | if (info->flags & RATE_INFO_FLAGS_SHORT_GI && | ||
2933 | nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) | ||
2934 | return false; | ||
2935 | } | ||
2807 | 2936 | ||
2808 | nla_nest_end(msg, rate); | 2937 | nla_nest_end(msg, rate); |
2809 | return true; | 2938 | return true; |
2810 | |||
2811 | nla_put_failure: | ||
2812 | return false; | ||
2813 | } | 2939 | } |
2814 | 2940 | ||
2815 | static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq, | 2941 | static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq, |
@@ -5330,8 +5456,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) | |||
5330 | if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) | 5456 | if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) |
5331 | return -EINVAL; | 5457 | return -EINVAL; |
5332 | 5458 | ||
5333 | if (!info->attrs[NL80211_ATTR_WIPHY_FREQ] || | 5459 | if (!info->attrs[NL80211_ATTR_SSID] || |
5334 | !info->attrs[NL80211_ATTR_SSID] || | ||
5335 | !nla_len(info->attrs[NL80211_ATTR_SSID])) | 5460 | !nla_len(info->attrs[NL80211_ATTR_SSID])) |
5336 | return -EINVAL; | 5461 | return -EINVAL; |
5337 | 5462 | ||
@@ -5366,35 +5491,17 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) | |||
5366 | ibss.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); | 5491 | ibss.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); |
5367 | } | 5492 | } |
5368 | 5493 | ||
5369 | if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { | 5494 | err = nl80211_parse_chandef(rdev, info, &ibss.chandef); |
5370 | enum nl80211_channel_type channel_type; | 5495 | if (err) |
5371 | 5496 | return err; | |
5372 | if (!nl80211_valid_channel_type(info, &channel_type)) | ||
5373 | return -EINVAL; | ||
5374 | |||
5375 | if (channel_type != NL80211_CHAN_NO_HT && | ||
5376 | !(wiphy->features & NL80211_FEATURE_HT_IBSS)) | ||
5377 | return -EINVAL; | ||
5378 | |||
5379 | ibss.channel_type = channel_type; | ||
5380 | } else { | ||
5381 | ibss.channel_type = NL80211_CHAN_NO_HT; | ||
5382 | } | ||
5383 | 5497 | ||
5384 | ibss.channel = rdev_freq_to_chan(rdev, | 5498 | if (!cfg80211_reg_can_beacon(&rdev->wiphy, &ibss.chandef)) |
5385 | nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]), | ||
5386 | ibss.channel_type); | ||
5387 | if (!ibss.channel || | ||
5388 | ibss.channel->flags & IEEE80211_CHAN_NO_IBSS || | ||
5389 | ibss.channel->flags & IEEE80211_CHAN_DISABLED) | ||
5390 | return -EINVAL; | 5499 | return -EINVAL; |
5391 | 5500 | ||
5392 | /* Both channels should be able to initiate communication */ | 5501 | if (ibss.chandef.width > NL80211_CHAN_WIDTH_40) |
5393 | if ((ibss.channel_type == NL80211_CHAN_HT40PLUS || | ||
5394 | ibss.channel_type == NL80211_CHAN_HT40MINUS) && | ||
5395 | !cfg80211_can_beacon_sec_chan(&rdev->wiphy, ibss.channel, | ||
5396 | ibss.channel_type)) | ||
5397 | return -EINVAL; | 5502 | return -EINVAL; |
5503 | if (ibss.chandef.width != NL80211_CHAN_WIDTH_20_NOHT && | ||
5504 | !(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)) | ||
5398 | 5505 | ||
5399 | ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED]; | 5506 | ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED]; |
5400 | ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY]; | 5507 | ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY]; |
@@ -5405,7 +5512,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) | |||
5405 | int n_rates = | 5512 | int n_rates = |
5406 | nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); | 5513 | nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); |
5407 | struct ieee80211_supported_band *sband = | 5514 | struct ieee80211_supported_band *sband = |
5408 | wiphy->bands[ibss.channel->band]; | 5515 | wiphy->bands[ibss.chandef.chan->band]; |
5409 | 5516 | ||
5410 | err = ieee80211_get_ratemask(sband, rates, n_rates, | 5517 | err = ieee80211_get_ratemask(sband, rates, n_rates, |
5411 | &ibss.basic_rates); | 5518 | &ibss.basic_rates); |
@@ -5427,7 +5534,8 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) | |||
5427 | if (IS_ERR(connkeys)) | 5534 | if (IS_ERR(connkeys)) |
5428 | return PTR_ERR(connkeys); | 5535 | return PTR_ERR(connkeys); |
5429 | 5536 | ||
5430 | if ((ibss.channel_type != NL80211_CHAN_NO_HT) && no_ht) { | 5537 | if ((ibss.chandef.width != NL80211_CHAN_WIDTH_20_NOHT) && |
5538 | no_ht) { | ||
5431 | kfree(connkeys); | 5539 | kfree(connkeys); |
5432 | return -EINVAL; | 5540 | return -EINVAL; |
5433 | } | 5541 | } |
@@ -5948,12 +6056,11 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, | |||
5948 | { | 6056 | { |
5949 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 6057 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
5950 | struct wireless_dev *wdev = info->user_ptr[1]; | 6058 | struct wireless_dev *wdev = info->user_ptr[1]; |
5951 | struct ieee80211_channel *chan; | 6059 | struct cfg80211_chan_def chandef; |
5952 | struct sk_buff *msg; | 6060 | struct sk_buff *msg; |
5953 | void *hdr; | 6061 | void *hdr; |
5954 | u64 cookie; | 6062 | u64 cookie; |
5955 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | 6063 | u32 duration; |
5956 | u32 freq, duration; | ||
5957 | int err; | 6064 | int err; |
5958 | 6065 | ||
5959 | if (!info->attrs[NL80211_ATTR_WIPHY_FREQ] || | 6066 | if (!info->attrs[NL80211_ATTR_WIPHY_FREQ] || |
@@ -5974,14 +6081,9 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, | |||
5974 | duration > rdev->wiphy.max_remain_on_channel_duration) | 6081 | duration > rdev->wiphy.max_remain_on_channel_duration) |
5975 | return -EINVAL; | 6082 | return -EINVAL; |
5976 | 6083 | ||
5977 | if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] && | 6084 | err = nl80211_parse_chandef(rdev, info, &chandef); |
5978 | !nl80211_valid_channel_type(info, &channel_type)) | 6085 | if (err) |
5979 | return -EINVAL; | 6086 | return err; |
5980 | |||
5981 | freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); | ||
5982 | chan = rdev_freq_to_chan(rdev, freq, channel_type); | ||
5983 | if (chan == NULL) | ||
5984 | return -EINVAL; | ||
5985 | 6087 | ||
5986 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 6088 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
5987 | if (!msg) | 6089 | if (!msg) |
@@ -5995,8 +6097,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, | |||
5995 | goto free_msg; | 6097 | goto free_msg; |
5996 | } | 6098 | } |
5997 | 6099 | ||
5998 | err = rdev_remain_on_channel(rdev, wdev, chan, channel_type, duration, | 6100 | err = rdev_remain_on_channel(rdev, wdev, chandef.chan, |
5999 | &cookie); | 6101 | duration, &cookie); |
6000 | 6102 | ||
6001 | if (err) | 6103 | if (err) |
6002 | goto free_msg; | 6104 | goto free_msg; |
@@ -6215,10 +6317,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6215 | { | 6317 | { |
6216 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 6318 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
6217 | struct wireless_dev *wdev = info->user_ptr[1]; | 6319 | struct wireless_dev *wdev = info->user_ptr[1]; |
6218 | struct ieee80211_channel *chan; | 6320 | struct cfg80211_chan_def chandef; |
6219 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | ||
6220 | bool channel_type_valid = false; | ||
6221 | u32 freq; | ||
6222 | int err; | 6321 | int err; |
6223 | void *hdr = NULL; | 6322 | void *hdr = NULL; |
6224 | u64 cookie; | 6323 | u64 cookie; |
@@ -6228,8 +6327,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6228 | 6327 | ||
6229 | dont_wait_for_ack = info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK]; | 6328 | dont_wait_for_ack = info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK]; |
6230 | 6329 | ||
6231 | if (!info->attrs[NL80211_ATTR_FRAME] || | 6330 | if (!info->attrs[NL80211_ATTR_FRAME]) |
6232 | !info->attrs[NL80211_ATTR_WIPHY_FREQ]) | ||
6233 | return -EINVAL; | 6331 | return -EINVAL; |
6234 | 6332 | ||
6235 | if (!rdev->ops->mgmt_tx) | 6333 | if (!rdev->ops->mgmt_tx) |
@@ -6264,12 +6362,6 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6264 | 6362 | ||
6265 | } | 6363 | } |
6266 | 6364 | ||
6267 | if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { | ||
6268 | if (!nl80211_valid_channel_type(info, &channel_type)) | ||
6269 | return -EINVAL; | ||
6270 | channel_type_valid = true; | ||
6271 | } | ||
6272 | |||
6273 | offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; | 6365 | offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; |
6274 | 6366 | ||
6275 | if (offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) | 6367 | if (offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) |
@@ -6277,10 +6369,9 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6277 | 6369 | ||
6278 | no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); | 6370 | no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); |
6279 | 6371 | ||
6280 | freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); | 6372 | err = nl80211_parse_chandef(rdev, info, &chandef); |
6281 | chan = rdev_freq_to_chan(rdev, freq, channel_type); | 6373 | if (err) |
6282 | if (chan == NULL) | 6374 | return err; |
6283 | return -EINVAL; | ||
6284 | 6375 | ||
6285 | if (!dont_wait_for_ack) { | 6376 | if (!dont_wait_for_ack) { |
6286 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 6377 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
@@ -6296,8 +6387,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6296 | } | 6387 | } |
6297 | } | 6388 | } |
6298 | 6389 | ||
6299 | err = cfg80211_mlme_mgmt_tx(rdev, wdev, chan, offchan, channel_type, | 6390 | err = cfg80211_mlme_mgmt_tx(rdev, wdev, chandef.chan, offchan, wait, |
6300 | channel_type_valid, wait, | ||
6301 | nla_data(info->attrs[NL80211_ATTR_FRAME]), | 6391 | nla_data(info->attrs[NL80211_ATTR_FRAME]), |
6302 | nla_len(info->attrs[NL80211_ATTR_FRAME]), | 6392 | nla_len(info->attrs[NL80211_ATTR_FRAME]), |
6303 | no_cck, dont_wait_for_ack, &cookie); | 6393 | no_cck, dont_wait_for_ack, &cookie); |
@@ -6561,21 +6651,12 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) | |||
6561 | } | 6651 | } |
6562 | 6652 | ||
6563 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { | 6653 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { |
6564 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | 6654 | err = nl80211_parse_chandef(rdev, info, &setup.chandef); |
6565 | 6655 | if (err) | |
6566 | if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] && | 6656 | return err; |
6567 | !nl80211_valid_channel_type(info, &channel_type)) | ||
6568 | return -EINVAL; | ||
6569 | |||
6570 | setup.channel = rdev_freq_to_chan(rdev, | ||
6571 | nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]), | ||
6572 | channel_type); | ||
6573 | if (!setup.channel) | ||
6574 | return -EINVAL; | ||
6575 | setup.channel_type = channel_type; | ||
6576 | } else { | 6657 | } else { |
6577 | /* cfg80211_join_mesh() will sort it out */ | 6658 | /* cfg80211_join_mesh() will sort it out */ |
6578 | setup.channel = NULL; | 6659 | setup.chandef.chan = NULL; |
6579 | } | 6660 | } |
6580 | 6661 | ||
6581 | return cfg80211_join_mesh(rdev, dev, &setup, &cfg); | 6662 | return cfg80211_join_mesh(rdev, dev, &setup, &cfg); |
@@ -8395,7 +8476,6 @@ static void nl80211_send_remain_on_chan_event( | |||
8395 | int cmd, struct cfg80211_registered_device *rdev, | 8476 | int cmd, struct cfg80211_registered_device *rdev, |
8396 | struct wireless_dev *wdev, u64 cookie, | 8477 | struct wireless_dev *wdev, u64 cookie, |
8397 | struct ieee80211_channel *chan, | 8478 | struct ieee80211_channel *chan, |
8398 | enum nl80211_channel_type channel_type, | ||
8399 | unsigned int duration, gfp_t gfp) | 8479 | unsigned int duration, gfp_t gfp) |
8400 | { | 8480 | { |
8401 | struct sk_buff *msg; | 8481 | struct sk_buff *msg; |
@@ -8416,7 +8496,8 @@ static void nl80211_send_remain_on_chan_event( | |||
8416 | wdev->netdev->ifindex)) || | 8496 | wdev->netdev->ifindex)) || |
8417 | nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || | 8497 | nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || |
8418 | nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq) || | 8498 | nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq) || |
8419 | nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, channel_type) || | 8499 | nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, |
8500 | NL80211_CHAN_NO_HT) || | ||
8420 | nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) | 8501 | nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) |
8421 | goto nla_put_failure; | 8502 | goto nla_put_failure; |
8422 | 8503 | ||
@@ -8438,23 +8519,20 @@ static void nl80211_send_remain_on_chan_event( | |||
8438 | void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, | 8519 | void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, |
8439 | struct wireless_dev *wdev, u64 cookie, | 8520 | struct wireless_dev *wdev, u64 cookie, |
8440 | struct ieee80211_channel *chan, | 8521 | struct ieee80211_channel *chan, |
8441 | enum nl80211_channel_type channel_type, | ||
8442 | unsigned int duration, gfp_t gfp) | 8522 | unsigned int duration, gfp_t gfp) |
8443 | { | 8523 | { |
8444 | nl80211_send_remain_on_chan_event(NL80211_CMD_REMAIN_ON_CHANNEL, | 8524 | nl80211_send_remain_on_chan_event(NL80211_CMD_REMAIN_ON_CHANNEL, |
8445 | rdev, wdev, cookie, chan, | 8525 | rdev, wdev, cookie, chan, |
8446 | channel_type, duration, gfp); | 8526 | duration, gfp); |
8447 | } | 8527 | } |
8448 | 8528 | ||
8449 | void nl80211_send_remain_on_channel_cancel( | 8529 | void nl80211_send_remain_on_channel_cancel( |
8450 | struct cfg80211_registered_device *rdev, | 8530 | struct cfg80211_registered_device *rdev, |
8451 | struct wireless_dev *wdev, | 8531 | struct wireless_dev *wdev, |
8452 | u64 cookie, struct ieee80211_channel *chan, | 8532 | u64 cookie, struct ieee80211_channel *chan, gfp_t gfp) |
8453 | enum nl80211_channel_type channel_type, gfp_t gfp) | ||
8454 | { | 8533 | { |
8455 | nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, | 8534 | nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, |
8456 | rdev, wdev, cookie, chan, | 8535 | rdev, wdev, cookie, chan, 0, gfp); |
8457 | channel_type, 0, gfp); | ||
8458 | } | 8536 | } |
8459 | 8537 | ||
8460 | void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, | 8538 | void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, |
@@ -8810,8 +8888,8 @@ void nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev, | |||
8810 | } | 8888 | } |
8811 | 8889 | ||
8812 | void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, | 8890 | void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, |
8813 | struct net_device *netdev, int freq, | 8891 | struct net_device *netdev, |
8814 | enum nl80211_channel_type type, gfp_t gfp) | 8892 | struct cfg80211_chan_def *chandef, gfp_t gfp) |
8815 | { | 8893 | { |
8816 | struct sk_buff *msg; | 8894 | struct sk_buff *msg; |
8817 | void *hdr; | 8895 | void *hdr; |
@@ -8826,9 +8904,10 @@ void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, | |||
8826 | return; | 8904 | return; |
8827 | } | 8905 | } |
8828 | 8906 | ||
8829 | if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || | 8907 | if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) |
8830 | nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) || | 8908 | goto nla_put_failure; |
8831 | nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, type)) | 8909 | |
8910 | if (nl80211_send_chandef(msg, chandef)) | ||
8832 | goto nla_put_failure; | 8911 | goto nla_put_failure; |
8833 | 8912 | ||
8834 | genlmsg_end(msg, hdr); | 8913 | genlmsg_end(msg, hdr); |
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h index f6153516068c..2acba8477e9d 100644 --- a/net/wireless/nl80211.h +++ b/net/wireless/nl80211.h | |||
@@ -76,13 +76,11 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, | |||
76 | void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, | 76 | void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, |
77 | struct wireless_dev *wdev, u64 cookie, | 77 | struct wireless_dev *wdev, u64 cookie, |
78 | struct ieee80211_channel *chan, | 78 | struct ieee80211_channel *chan, |
79 | enum nl80211_channel_type channel_type, | ||
80 | unsigned int duration, gfp_t gfp); | 79 | unsigned int duration, gfp_t gfp); |
81 | void nl80211_send_remain_on_channel_cancel( | 80 | void nl80211_send_remain_on_channel_cancel( |
82 | struct cfg80211_registered_device *rdev, | 81 | struct cfg80211_registered_device *rdev, |
83 | struct wireless_dev *wdev, | 82 | struct wireless_dev *wdev, |
84 | u64 cookie, struct ieee80211_channel *chan, | 83 | u64 cookie, struct ieee80211_channel *chan, gfp_t gfp); |
85 | enum nl80211_channel_type channel_type, gfp_t gfp); | ||
86 | 84 | ||
87 | void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, | 85 | void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, |
88 | struct net_device *dev, const u8 *mac_addr, | 86 | struct net_device *dev, const u8 *mac_addr, |
@@ -129,8 +127,8 @@ void nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev, | |||
129 | const u8 *bssid, bool preauth, gfp_t gfp); | 127 | const u8 *bssid, bool preauth, gfp_t gfp); |
130 | 128 | ||
131 | void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, | 129 | void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, |
132 | struct net_device *dev, int freq, | 130 | struct net_device *dev, |
133 | enum nl80211_channel_type type, gfp_t gfp); | 131 | struct cfg80211_chan_def *chandef, gfp_t gfp); |
134 | 132 | ||
135 | bool nl80211_unexpected_frame(struct net_device *dev, | 133 | bool nl80211_unexpected_frame(struct net_device *dev, |
136 | const u8 *addr, gfp_t gfp); | 134 | const u8 *addr, gfp_t gfp); |
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index 6e5fa659068d..6c0c8191f837 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h | |||
@@ -359,12 +359,11 @@ rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev, | |||
359 | 359 | ||
360 | static inline int | 360 | static inline int |
361 | rdev_set_monitor_channel(struct cfg80211_registered_device *rdev, | 361 | rdev_set_monitor_channel(struct cfg80211_registered_device *rdev, |
362 | struct ieee80211_channel *chan, | 362 | struct cfg80211_chan_def *chandef) |
363 | enum nl80211_channel_type channel_type) | ||
364 | { | 363 | { |
365 | int ret; | 364 | int ret; |
366 | trace_rdev_set_monitor_channel(&rdev->wiphy, chan, channel_type); | 365 | trace_rdev_set_monitor_channel(&rdev->wiphy, chandef); |
367 | ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chan, channel_type); | 366 | ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chandef); |
368 | trace_rdev_return_int(&rdev->wiphy, ret); | 367 | trace_rdev_return_int(&rdev->wiphy, ret); |
369 | return ret; | 368 | return ret; |
370 | } | 369 | } |
@@ -600,14 +599,12 @@ static inline int | |||
600 | rdev_remain_on_channel(struct cfg80211_registered_device *rdev, | 599 | rdev_remain_on_channel(struct cfg80211_registered_device *rdev, |
601 | struct wireless_dev *wdev, | 600 | struct wireless_dev *wdev, |
602 | struct ieee80211_channel *chan, | 601 | struct ieee80211_channel *chan, |
603 | enum nl80211_channel_type channel_type, | ||
604 | unsigned int duration, u64 *cookie) | 602 | unsigned int duration, u64 *cookie) |
605 | { | 603 | { |
606 | int ret; | 604 | int ret; |
607 | trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, channel_type, | 605 | trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, duration); |
608 | duration); | ||
609 | ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan, | 606 | ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan, |
610 | channel_type, duration, cookie); | 607 | duration, cookie); |
611 | trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie); | 608 | trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie); |
612 | return ret; | 609 | return ret; |
613 | } | 610 | } |
@@ -626,17 +623,15 @@ rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev, | |||
626 | static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev, | 623 | static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev, |
627 | struct wireless_dev *wdev, | 624 | struct wireless_dev *wdev, |
628 | struct ieee80211_channel *chan, bool offchan, | 625 | struct ieee80211_channel *chan, bool offchan, |
629 | enum nl80211_channel_type channel_type, | 626 | unsigned int wait, const u8 *buf, size_t len, |
630 | bool channel_type_valid, unsigned int wait, | 627 | bool no_cck, bool dont_wait_for_ack, u64 *cookie) |
631 | const u8 *buf, size_t len, bool no_cck, | ||
632 | bool dont_wait_for_ack, u64 *cookie) | ||
633 | { | 628 | { |
634 | int ret; | 629 | int ret; |
635 | trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan, channel_type, | 630 | trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan, |
636 | channel_type_valid, wait, no_cck, dont_wait_for_ack); | 631 | wait, no_cck, dont_wait_for_ack); |
637 | ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan, | 632 | ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan, |
638 | channel_type, channel_type_valid, wait, buf, | 633 | wait, buf, len, no_cck, |
639 | len, no_cck, dont_wait_for_ack, cookie); | 634 | dont_wait_for_ack, cookie); |
640 | trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie); | 635 | trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie); |
641 | return ret; | 636 | return ret; |
642 | } | 637 | } |
@@ -848,14 +843,17 @@ static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev, | |||
848 | trace_rdev_return_void(&rdev->wiphy); | 843 | trace_rdev_return_void(&rdev->wiphy); |
849 | } | 844 | } |
850 | 845 | ||
851 | static inline struct ieee80211_channel | 846 | static inline int |
852 | *rdev_get_channel(struct cfg80211_registered_device *rdev, | 847 | rdev_get_channel(struct cfg80211_registered_device *rdev, |
853 | struct wireless_dev *wdev, enum nl80211_channel_type *type) | 848 | struct wireless_dev *wdev, |
849 | struct cfg80211_chan_def *chandef) | ||
854 | { | 850 | { |
855 | struct ieee80211_channel *ret; | 851 | int ret; |
852 | |||
856 | trace_rdev_get_channel(&rdev->wiphy, wdev); | 853 | trace_rdev_get_channel(&rdev->wiphy, wdev); |
857 | ret = rdev->ops->get_channel(&rdev->wiphy, wdev, type); | 854 | ret = rdev->ops->get_channel(&rdev->wiphy, wdev, chandef); |
858 | trace_rdev_return_channel(&rdev->wiphy, ret, *type); | 855 | trace_rdev_return_chandef(&rdev->wiphy, ret, chandef); |
856 | |||
859 | return ret; | 857 | return ret; |
860 | } | 858 | } |
861 | 859 | ||
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 7f97a087f452..9596015975d2 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -771,6 +771,38 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
771 | return found; | 771 | return found; |
772 | } | 772 | } |
773 | 773 | ||
774 | static struct ieee80211_channel * | ||
775 | cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, | ||
776 | struct ieee80211_channel *channel) | ||
777 | { | ||
778 | const u8 *tmp; | ||
779 | u32 freq; | ||
780 | int channel_number = -1; | ||
781 | |||
782 | tmp = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ie, ielen); | ||
783 | if (tmp && tmp[1] == 1) { | ||
784 | channel_number = tmp[2]; | ||
785 | } else { | ||
786 | tmp = cfg80211_find_ie(WLAN_EID_HT_OPERATION, ie, ielen); | ||
787 | if (tmp && tmp[1] >= sizeof(struct ieee80211_ht_operation)) { | ||
788 | struct ieee80211_ht_operation *htop = (void *)(tmp + 2); | ||
789 | |||
790 | channel_number = htop->primary_chan; | ||
791 | } | ||
792 | } | ||
793 | |||
794 | if (channel_number < 0) | ||
795 | return channel; | ||
796 | |||
797 | freq = ieee80211_channel_to_frequency(channel_number, channel->band); | ||
798 | channel = ieee80211_get_channel(wiphy, freq); | ||
799 | if (!channel) | ||
800 | return NULL; | ||
801 | if (channel->flags & IEEE80211_CHAN_DISABLED) | ||
802 | return NULL; | ||
803 | return channel; | ||
804 | } | ||
805 | |||
774 | struct cfg80211_bss* | 806 | struct cfg80211_bss* |
775 | cfg80211_inform_bss(struct wiphy *wiphy, | 807 | cfg80211_inform_bss(struct wiphy *wiphy, |
776 | struct ieee80211_channel *channel, | 808 | struct ieee80211_channel *channel, |
@@ -790,6 +822,10 @@ cfg80211_inform_bss(struct wiphy *wiphy, | |||
790 | (signal < 0 || signal > 100))) | 822 | (signal < 0 || signal > 100))) |
791 | return NULL; | 823 | return NULL; |
792 | 824 | ||
825 | channel = cfg80211_get_bss_channel(wiphy, ie, ielen, channel); | ||
826 | if (!channel) | ||
827 | return NULL; | ||
828 | |||
793 | res = kzalloc(sizeof(*res) + privsz + ielen, gfp); | 829 | res = kzalloc(sizeof(*res) + privsz + ielen, gfp); |
794 | if (!res) | 830 | if (!res) |
795 | return NULL; | 831 | return NULL; |
@@ -839,11 +875,13 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
839 | s32 signal, gfp_t gfp) | 875 | s32 signal, gfp_t gfp) |
840 | { | 876 | { |
841 | struct cfg80211_internal_bss *res; | 877 | struct cfg80211_internal_bss *res; |
842 | |||
843 | size_t ielen = len - offsetof(struct ieee80211_mgmt, | 878 | size_t ielen = len - offsetof(struct ieee80211_mgmt, |
844 | u.probe_resp.variable); | 879 | u.probe_resp.variable); |
845 | size_t privsz; | 880 | size_t privsz; |
846 | 881 | ||
882 | BUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) != | ||
883 | offsetof(struct ieee80211_mgmt, u.beacon.variable)); | ||
884 | |||
847 | trace_cfg80211_inform_bss_frame(wiphy, channel, mgmt, len, signal); | 885 | trace_cfg80211_inform_bss_frame(wiphy, channel, mgmt, len, signal); |
848 | 886 | ||
849 | if (WARN_ON(!mgmt)) | 887 | if (WARN_ON(!mgmt)) |
@@ -861,6 +899,11 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
861 | 899 | ||
862 | privsz = wiphy->bss_priv_size; | 900 | privsz = wiphy->bss_priv_size; |
863 | 901 | ||
902 | channel = cfg80211_get_bss_channel(wiphy, mgmt->u.beacon.variable, | ||
903 | ielen, channel); | ||
904 | if (!channel) | ||
905 | return NULL; | ||
906 | |||
864 | res = kzalloc(sizeof(*res) + privsz + ielen, gfp); | 907 | res = kzalloc(sizeof(*res) + privsz + ielen, gfp); |
865 | if (!res) | 908 | if (!res) |
866 | return NULL; | 909 | return NULL; |
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index f264c20a7090..2134576f426e 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -20,29 +20,26 @@ | |||
20 | #define MAC_PR_FMT "%pM" | 20 | #define MAC_PR_FMT "%pM" |
21 | #define MAC_PR_ARG(entry_mac) (__entry->entry_mac) | 21 | #define MAC_PR_ARG(entry_mac) (__entry->entry_mac) |
22 | 22 | ||
23 | #define WIPHY_ENTRY MAC_ENTRY(wiphy_mac) | 23 | #define MAXNAME 32 |
24 | #define WIPHY_ASSIGN MAC_ASSIGN(wiphy_mac, wiphy->perm_addr) | 24 | #define WIPHY_ENTRY __array(char, wiphy_name, 32) |
25 | #define WIPHY_PR_FMT "wiphy " MAC_PR_FMT | 25 | #define WIPHY_ASSIGN strlcpy(__entry->wiphy_name, wiphy_name(wiphy), MAXNAME) |
26 | #define WIPHY_PR_ARG MAC_PR_ARG(wiphy_mac) | 26 | #define WIPHY_PR_FMT "%s" |
27 | 27 | #define WIPHY_PR_ARG __entry->wiphy_name | |
28 | #define WDEV_ENTRY __field(u32, id) | 28 | |
29 | #define WDEV_ASSIGN (__entry->id) = (wdev ? wdev->identifier : 0) | 29 | #define WDEV_ENTRY __field(u32, id) |
30 | #define WDEV_PR_FMT ", wdev id: %u" | 30 | #define WDEV_ASSIGN (__entry->id) = (wdev ? wdev->identifier : 0) |
31 | #define WDEV_PR_ARG (__entry->id) | 31 | #define WDEV_PR_FMT "wdev(%u)" |
32 | 32 | #define WDEV_PR_ARG (__entry->id) | |
33 | #define NETDEV_ENTRY __array(char, name, IFNAMSIZ) \ | 33 | |
34 | MAC_ENTRY(netdev_addr) \ | 34 | #define NETDEV_ENTRY __array(char, name, IFNAMSIZ) \ |
35 | __field(int, ifindex) | 35 | __field(int, ifindex) |
36 | #define NETDEV_ASSIGN \ | 36 | #define NETDEV_ASSIGN \ |
37 | do { \ | 37 | do { \ |
38 | memcpy(__entry->name, netdev->name, IFNAMSIZ); \ | 38 | memcpy(__entry->name, netdev->name, IFNAMSIZ); \ |
39 | MAC_ASSIGN(netdev_addr, netdev->dev_addr); \ | ||
40 | (__entry->ifindex) = (netdev->ifindex); \ | 39 | (__entry->ifindex) = (netdev->ifindex); \ |
41 | } while (0) | 40 | } while (0) |
42 | #define NETDEV_PR_FMT ", netdev - name: %s, addr: " MAC_PR_FMT \ | 41 | #define NETDEV_PR_FMT "netdev:%s(%d)" |
43 | ", intf index: %d" | 42 | #define NETDEV_PR_ARG __entry->name, __entry->ifindex |
44 | #define NETDEV_PR_ARG (__entry->name), MAC_PR_ARG(netdev_addr), \ | ||
45 | (__entry->ifindex) | ||
46 | 43 | ||
47 | #define MESH_CFG_ENTRY __field(u16, dot11MeshRetryTimeout) \ | 44 | #define MESH_CFG_ENTRY __field(u16, dot11MeshRetryTimeout) \ |
48 | __field(u16, dot11MeshConfirmTimeout) \ | 45 | __field(u16, dot11MeshConfirmTimeout) \ |
@@ -123,9 +120,37 @@ | |||
123 | __entry->center_freq = 0; \ | 120 | __entry->center_freq = 0; \ |
124 | } \ | 121 | } \ |
125 | } while (0) | 122 | } while (0) |
126 | #define CHAN_PR_FMT ", band: %d, freq: %u" | 123 | #define CHAN_PR_FMT "band: %d, freq: %u" |
127 | #define CHAN_PR_ARG __entry->band, __entry->center_freq | 124 | #define CHAN_PR_ARG __entry->band, __entry->center_freq |
128 | 125 | ||
126 | #define CHAN_DEF_ENTRY __field(enum ieee80211_band, band) \ | ||
127 | __field(u32, control_freq) \ | ||
128 | __field(u32, width) \ | ||
129 | __field(u32, center_freq1) \ | ||
130 | __field(u32, center_freq2) | ||
131 | #define CHAN_DEF_ASSIGN(chandef) \ | ||
132 | do { \ | ||
133 | if ((chandef) && (chandef)->chan) { \ | ||
134 | __entry->band = (chandef)->chan->band; \ | ||
135 | __entry->control_freq = \ | ||
136 | (chandef)->chan->center_freq; \ | ||
137 | __entry->width = (chandef)->width; \ | ||
138 | __entry->center_freq1 = (chandef)->center_freq1;\ | ||
139 | __entry->center_freq2 = (chandef)->center_freq2;\ | ||
140 | } else { \ | ||
141 | __entry->band = 0; \ | ||
142 | __entry->control_freq = 0; \ | ||
143 | __entry->width = 0; \ | ||
144 | __entry->center_freq1 = 0; \ | ||
145 | __entry->center_freq2 = 0; \ | ||
146 | } \ | ||
147 | } while (0) | ||
148 | #define CHAN_DEF_PR_FMT \ | ||
149 | "band: %d, control freq: %u, width: %d, cf1: %u, cf2: %u" | ||
150 | #define CHAN_DEF_PR_ARG __entry->band, __entry->control_freq, \ | ||
151 | __entry->width, __entry->center_freq1, \ | ||
152 | __entry->center_freq2 | ||
153 | |||
129 | #define SINFO_ENTRY __field(int, generation) \ | 154 | #define SINFO_ENTRY __field(int, generation) \ |
130 | __field(u32, connected_time) \ | 155 | __field(u32, connected_time) \ |
131 | __field(u32, inactive_time) \ | 156 | __field(u32, inactive_time) \ |
@@ -313,7 +338,7 @@ DECLARE_EVENT_CLASS(wiphy_wdev_evt, | |||
313 | WIPHY_ASSIGN; | 338 | WIPHY_ASSIGN; |
314 | WDEV_ASSIGN; | 339 | WDEV_ASSIGN; |
315 | ), | 340 | ), |
316 | TP_printk(WIPHY_PR_FMT WDEV_PR_FMT, WIPHY_PR_ARG, WDEV_PR_ARG) | 341 | TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT, WIPHY_PR_ARG, WDEV_PR_ARG) |
317 | ); | 342 | ); |
318 | 343 | ||
319 | DEFINE_EVENT(wiphy_wdev_evt, rdev_return_wdev, | 344 | DEFINE_EVENT(wiphy_wdev_evt, rdev_return_wdev, |
@@ -340,7 +365,7 @@ TRACE_EVENT(rdev_change_virtual_intf, | |||
340 | NETDEV_ASSIGN; | 365 | NETDEV_ASSIGN; |
341 | __entry->type = type; | 366 | __entry->type = type; |
342 | ), | 367 | ), |
343 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", type: %d", | 368 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", type: %d", |
344 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->type) | 369 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->type) |
345 | ); | 370 | ); |
346 | 371 | ||
@@ -362,7 +387,7 @@ DECLARE_EVENT_CLASS(key_handle, | |||
362 | __entry->key_index = key_index; | 387 | __entry->key_index = key_index; |
363 | __entry->pairwise = pairwise; | 388 | __entry->pairwise = pairwise; |
364 | ), | 389 | ), |
365 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", key_index: %u, pairwise: %s, mac addr: " MAC_PR_FMT, | 390 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", key_index: %u, pairwise: %s, mac addr: " MAC_PR_FMT, |
366 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index, | 391 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index, |
367 | BOOL_TO_STR(__entry->pairwise), MAC_PR_ARG(mac_addr)) | 392 | BOOL_TO_STR(__entry->pairwise), MAC_PR_ARG(mac_addr)) |
368 | ); | 393 | ); |
@@ -403,7 +428,7 @@ TRACE_EVENT(rdev_set_default_key, | |||
403 | __entry->unicast = unicast; | 428 | __entry->unicast = unicast; |
404 | __entry->multicast = multicast; | 429 | __entry->multicast = multicast; |
405 | ), | 430 | ), |
406 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", key index: %u, unicast: %s, multicast: %s", | 431 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", key index: %u, unicast: %s, multicast: %s", |
407 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index, | 432 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index, |
408 | BOOL_TO_STR(__entry->unicast), | 433 | BOOL_TO_STR(__entry->unicast), |
409 | BOOL_TO_STR(__entry->multicast)) | 434 | BOOL_TO_STR(__entry->multicast)) |
@@ -422,7 +447,7 @@ TRACE_EVENT(rdev_set_default_mgmt_key, | |||
422 | NETDEV_ASSIGN; | 447 | NETDEV_ASSIGN; |
423 | __entry->key_index = key_index; | 448 | __entry->key_index = key_index; |
424 | ), | 449 | ), |
425 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", key index: %u", | 450 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", key index: %u", |
426 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index) | 451 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index) |
427 | ); | 452 | ); |
428 | 453 | ||
@@ -433,7 +458,7 @@ TRACE_EVENT(rdev_start_ap, | |||
433 | TP_STRUCT__entry( | 458 | TP_STRUCT__entry( |
434 | WIPHY_ENTRY | 459 | WIPHY_ENTRY |
435 | NETDEV_ENTRY | 460 | NETDEV_ENTRY |
436 | CHAN_ENTRY | 461 | CHAN_DEF_ENTRY |
437 | __field(int, beacon_interval) | 462 | __field(int, beacon_interval) |
438 | __field(int, dtim_period) | 463 | __field(int, dtim_period) |
439 | __array(char, ssid, IEEE80211_MAX_SSID_LEN + 1) | 464 | __array(char, ssid, IEEE80211_MAX_SSID_LEN + 1) |
@@ -446,7 +471,7 @@ TRACE_EVENT(rdev_start_ap, | |||
446 | TP_fast_assign( | 471 | TP_fast_assign( |
447 | WIPHY_ASSIGN; | 472 | WIPHY_ASSIGN; |
448 | NETDEV_ASSIGN; | 473 | NETDEV_ASSIGN; |
449 | CHAN_ASSIGN(settings->channel); | 474 | CHAN_DEF_ASSIGN(&settings->chandef); |
450 | __entry->beacon_interval = settings->beacon_interval; | 475 | __entry->beacon_interval = settings->beacon_interval; |
451 | __entry->dtim_period = settings->dtim_period; | 476 | __entry->dtim_period = settings->dtim_period; |
452 | __entry->hidden_ssid = settings->hidden_ssid; | 477 | __entry->hidden_ssid = settings->hidden_ssid; |
@@ -457,11 +482,11 @@ TRACE_EVENT(rdev_start_ap, | |||
457 | memset(__entry->ssid, 0, IEEE80211_MAX_SSID_LEN + 1); | 482 | memset(__entry->ssid, 0, IEEE80211_MAX_SSID_LEN + 1); |
458 | memcpy(__entry->ssid, settings->ssid, settings->ssid_len); | 483 | memcpy(__entry->ssid, settings->ssid, settings->ssid_len); |
459 | ), | 484 | ), |
460 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", AP settings - ssid: %s, " | 485 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", AP settings - ssid: %s, " |
461 | CHAN_PR_FMT ", beacon interval: %d, dtim period: %d, " | 486 | CHAN_DEF_PR_FMT ", beacon interval: %d, dtim period: %d, " |
462 | "hidden ssid: %d, wpa versions: %u, privacy: %s, " | 487 | "hidden ssid: %d, wpa versions: %u, privacy: %s, " |
463 | "auth type: %d, inactivity timeout: %d", | 488 | "auth type: %d, inactivity timeout: %d", |
464 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->ssid, CHAN_PR_ARG, | 489 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->ssid, CHAN_DEF_PR_ARG, |
465 | __entry->beacon_interval, __entry->dtim_period, | 490 | __entry->beacon_interval, __entry->dtim_period, |
466 | __entry->hidden_ssid, __entry->wpa_ver, | 491 | __entry->hidden_ssid, __entry->wpa_ver, |
467 | BOOL_TO_STR(__entry->privacy), __entry->auth_type, | 492 | BOOL_TO_STR(__entry->privacy), __entry->auth_type, |
@@ -510,7 +535,7 @@ TRACE_EVENT(rdev_change_beacon, | |||
510 | info->probe_resp, info->probe_resp_len); | 535 | info->probe_resp, info->probe_resp_len); |
511 | } | 536 | } |
512 | ), | 537 | ), |
513 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) | 538 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) |
514 | ); | 539 | ); |
515 | 540 | ||
516 | DECLARE_EVENT_CLASS(wiphy_netdev_evt, | 541 | DECLARE_EVENT_CLASS(wiphy_netdev_evt, |
@@ -524,7 +549,7 @@ DECLARE_EVENT_CLASS(wiphy_netdev_evt, | |||
524 | WIPHY_ASSIGN; | 549 | WIPHY_ASSIGN; |
525 | NETDEV_ASSIGN; | 550 | NETDEV_ASSIGN; |
526 | ), | 551 | ), |
527 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) | 552 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) |
528 | ); | 553 | ); |
529 | 554 | ||
530 | DEFINE_EVENT(wiphy_netdev_evt, rdev_stop_ap, | 555 | DEFINE_EVENT(wiphy_netdev_evt, rdev_stop_ap, |
@@ -602,7 +627,7 @@ DECLARE_EVENT_CLASS(station_add_change, | |||
602 | memcpy(__entry->ht_capa, params->ht_capa, | 627 | memcpy(__entry->ht_capa, params->ht_capa, |
603 | sizeof(struct ieee80211_ht_cap)); | 628 | sizeof(struct ieee80211_ht_cap)); |
604 | ), | 629 | ), |
605 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", station mac: " MAC_PR_FMT | 630 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT |
606 | ", station flags mask: %u, station flags set: %u, " | 631 | ", station flags mask: %u, station flags set: %u, " |
607 | "station modify mask: %u, listen interval: %d, aid: %u, " | 632 | "station modify mask: %u, listen interval: %d, aid: %u, " |
608 | "plink action: %u, plink state: %u, uapsd queues: %u", | 633 | "plink action: %u, plink state: %u, uapsd queues: %u", |
@@ -638,7 +663,7 @@ DECLARE_EVENT_CLASS(wiphy_netdev_mac_evt, | |||
638 | NETDEV_ASSIGN; | 663 | NETDEV_ASSIGN; |
639 | MAC_ASSIGN(sta_mac, mac); | 664 | MAC_ASSIGN(sta_mac, mac); |
640 | ), | 665 | ), |
641 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", mac: " MAC_PR_FMT, | 666 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", mac: " MAC_PR_FMT, |
642 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac)) | 667 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac)) |
643 | ); | 668 | ); |
644 | 669 | ||
@@ -678,7 +703,7 @@ TRACE_EVENT(rdev_dump_station, | |||
678 | MAC_ASSIGN(sta_mac, mac); | 703 | MAC_ASSIGN(sta_mac, mac); |
679 | __entry->idx = idx; | 704 | __entry->idx = idx; |
680 | ), | 705 | ), |
681 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", station mac: " MAC_PR_FMT ", idx: %d", | 706 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT ", idx: %d", |
682 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac), | 707 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac), |
683 | __entry->idx) | 708 | __entry->idx) |
684 | ); | 709 | ); |
@@ -716,7 +741,7 @@ DECLARE_EVENT_CLASS(mpath_evt, | |||
716 | MAC_ASSIGN(dst, dst); | 741 | MAC_ASSIGN(dst, dst); |
717 | MAC_ASSIGN(next_hop, next_hop); | 742 | MAC_ASSIGN(next_hop, next_hop); |
718 | ), | 743 | ), |
719 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", destination: " MAC_PR_FMT ", next hop: " MAC_PR_FMT, | 744 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", destination: " MAC_PR_FMT ", next hop: " MAC_PR_FMT, |
720 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(dst), | 745 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(dst), |
721 | MAC_PR_ARG(next_hop)) | 746 | MAC_PR_ARG(next_hop)) |
722 | ); | 747 | ); |
@@ -757,7 +782,7 @@ TRACE_EVENT(rdev_dump_mpath, | |||
757 | MAC_ASSIGN(next_hop, next_hop); | 782 | MAC_ASSIGN(next_hop, next_hop); |
758 | __entry->idx = idx; | 783 | __entry->idx = idx; |
759 | ), | 784 | ), |
760 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", index: %d, destination: " | 785 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", index: %d, destination: " |
761 | MAC_PR_FMT ", next hop: " MAC_PR_FMT, | 786 | MAC_PR_FMT ", next hop: " MAC_PR_FMT, |
762 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->idx, MAC_PR_ARG(dst), | 787 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->idx, MAC_PR_ARG(dst), |
763 | MAC_PR_ARG(next_hop)) | 788 | MAC_PR_ARG(next_hop)) |
@@ -834,7 +859,7 @@ TRACE_EVENT(rdev_update_mesh_config, | |||
834 | MESH_CFG_ASSIGN; | 859 | MESH_CFG_ASSIGN; |
835 | __entry->mask = mask; | 860 | __entry->mask = mask; |
836 | ), | 861 | ), |
837 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", mask: %u", | 862 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", mask: %u", |
838 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->mask) | 863 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->mask) |
839 | ); | 864 | ); |
840 | 865 | ||
@@ -853,7 +878,7 @@ TRACE_EVENT(rdev_join_mesh, | |||
853 | NETDEV_ASSIGN; | 878 | NETDEV_ASSIGN; |
854 | MESH_CFG_ASSIGN; | 879 | MESH_CFG_ASSIGN; |
855 | ), | 880 | ), |
856 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT, | 881 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, |
857 | WIPHY_PR_ARG, NETDEV_PR_ARG) | 882 | WIPHY_PR_ARG, NETDEV_PR_ARG) |
858 | ); | 883 | ); |
859 | 884 | ||
@@ -879,7 +904,7 @@ TRACE_EVENT(rdev_change_bss, | |||
879 | __entry->ap_isolate = params->ap_isolate; | 904 | __entry->ap_isolate = params->ap_isolate; |
880 | __entry->ht_opmode = params->ht_opmode; | 905 | __entry->ht_opmode = params->ht_opmode; |
881 | ), | 906 | ), |
882 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", use cts prot: %d, " | 907 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", use cts prot: %d, " |
883 | "use short preamble: %d, use short slot time: %d, " | 908 | "use short preamble: %d, use short slot time: %d, " |
884 | "ap isolate: %d, ht opmode: %d", | 909 | "ap isolate: %d, ht opmode: %d", |
885 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->use_cts_prot, | 910 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->use_cts_prot, |
@@ -909,7 +934,7 @@ TRACE_EVENT(rdev_set_txq_params, | |||
909 | __entry->cwmax = params->cwmax; | 934 | __entry->cwmax = params->cwmax; |
910 | __entry->aifs = params->aifs; | 935 | __entry->aifs = params->aifs; |
911 | ), | 936 | ), |
912 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", ac: %d, txop: %u, cwmin: %u, cwmax: %u, aifs: %u", | 937 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", ac: %d, txop: %u, cwmin: %u, cwmax: %u, aifs: %u", |
913 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->ac, __entry->txop, | 938 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->ac, __entry->txop, |
914 | __entry->cwmin, __entry->cwmax, __entry->aifs) | 939 | __entry->cwmin, __entry->cwmax, __entry->aifs) |
915 | ); | 940 | ); |
@@ -928,26 +953,24 @@ TRACE_EVENT(rdev_libertas_set_mesh_channel, | |||
928 | NETDEV_ASSIGN; | 953 | NETDEV_ASSIGN; |
929 | CHAN_ASSIGN(chan); | 954 | CHAN_ASSIGN(chan); |
930 | ), | 955 | ), |
931 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT CHAN_PR_FMT, WIPHY_PR_ARG, | 956 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_PR_FMT, WIPHY_PR_ARG, |
932 | NETDEV_PR_ARG, CHAN_PR_ARG) | 957 | NETDEV_PR_ARG, CHAN_PR_ARG) |
933 | ); | 958 | ); |
934 | 959 | ||
935 | TRACE_EVENT(rdev_set_monitor_channel, | 960 | TRACE_EVENT(rdev_set_monitor_channel, |
936 | TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *chan, | 961 | TP_PROTO(struct wiphy *wiphy, |
937 | enum nl80211_channel_type chan_type), | 962 | struct cfg80211_chan_def *chandef), |
938 | TP_ARGS(wiphy, chan, chan_type), | 963 | TP_ARGS(wiphy, chandef), |
939 | TP_STRUCT__entry( | 964 | TP_STRUCT__entry( |
940 | WIPHY_ENTRY | 965 | WIPHY_ENTRY |
941 | CHAN_ENTRY | 966 | CHAN_DEF_ENTRY |
942 | __field(enum nl80211_channel_type, chan_type) | ||
943 | ), | 967 | ), |
944 | TP_fast_assign( | 968 | TP_fast_assign( |
945 | WIPHY_ASSIGN; | 969 | WIPHY_ASSIGN; |
946 | CHAN_ASSIGN(chan); | 970 | CHAN_DEF_ASSIGN(chandef); |
947 | __entry->chan_type = chan_type; | ||
948 | ), | 971 | ), |
949 | TP_printk(WIPHY_PR_FMT CHAN_PR_FMT ", channel type : %d", | 972 | TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT, |
950 | WIPHY_PR_ARG, CHAN_PR_ARG, __entry->chan_type) | 973 | WIPHY_PR_ARG, CHAN_DEF_PR_ARG) |
951 | ); | 974 | ); |
952 | 975 | ||
953 | TRACE_EVENT(rdev_auth, | 976 | TRACE_EVENT(rdev_auth, |
@@ -969,7 +992,7 @@ TRACE_EVENT(rdev_auth, | |||
969 | memset(__entry->bssid, 0, ETH_ALEN); | 992 | memset(__entry->bssid, 0, ETH_ALEN); |
970 | __entry->auth_type = req->auth_type; | 993 | __entry->auth_type = req->auth_type; |
971 | ), | 994 | ), |
972 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", auth type: %d, bssid: " MAC_PR_FMT, | 995 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", auth type: %d, bssid: " MAC_PR_FMT, |
973 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->auth_type, | 996 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->auth_type, |
974 | MAC_PR_ARG(bssid)) | 997 | MAC_PR_ARG(bssid)) |
975 | ); | 998 | ); |
@@ -997,7 +1020,7 @@ TRACE_EVENT(rdev_assoc, | |||
997 | __entry->use_mfp = req->use_mfp; | 1020 | __entry->use_mfp = req->use_mfp; |
998 | __entry->flags = req->flags; | 1021 | __entry->flags = req->flags; |
999 | ), | 1022 | ), |
1000 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT | 1023 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", bssid: " MAC_PR_FMT |
1001 | ", previous bssid: " MAC_PR_FMT ", use mfp: %s, flags: %u", | 1024 | ", previous bssid: " MAC_PR_FMT ", use mfp: %s, flags: %u", |
1002 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), | 1025 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), |
1003 | MAC_PR_ARG(prev_bssid), BOOL_TO_STR(__entry->use_mfp), | 1026 | MAC_PR_ARG(prev_bssid), BOOL_TO_STR(__entry->use_mfp), |
@@ -1020,7 +1043,7 @@ TRACE_EVENT(rdev_deauth, | |||
1020 | MAC_ASSIGN(bssid, req->bssid); | 1043 | MAC_ASSIGN(bssid, req->bssid); |
1021 | __entry->reason_code = req->reason_code; | 1044 | __entry->reason_code = req->reason_code; |
1022 | ), | 1045 | ), |
1023 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT ", reason: %u", | 1046 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", bssid: " MAC_PR_FMT ", reason: %u", |
1024 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), | 1047 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), |
1025 | __entry->reason_code) | 1048 | __entry->reason_code) |
1026 | ); | 1049 | ); |
@@ -1046,7 +1069,7 @@ TRACE_EVENT(rdev_disassoc, | |||
1046 | __entry->reason_code = req->reason_code; | 1069 | __entry->reason_code = req->reason_code; |
1047 | __entry->local_state_change = req->local_state_change; | 1070 | __entry->local_state_change = req->local_state_change; |
1048 | ), | 1071 | ), |
1049 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT | 1072 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", bssid: " MAC_PR_FMT |
1050 | ", reason: %u, local state change: %s", | 1073 | ", reason: %u, local state change: %s", |
1051 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), | 1074 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), |
1052 | __entry->reason_code, | 1075 | __entry->reason_code, |
@@ -1067,7 +1090,7 @@ TRACE_EVENT(rdev_mgmt_tx_cancel_wait, | |||
1067 | WDEV_ASSIGN; | 1090 | WDEV_ASSIGN; |
1068 | __entry->cookie = cookie; | 1091 | __entry->cookie = cookie; |
1069 | ), | 1092 | ), |
1070 | TP_printk(WIPHY_PR_FMT WDEV_PR_FMT ", cookie: %llu ", | 1093 | TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", cookie: %llu ", |
1071 | WIPHY_PR_ARG, WDEV_PR_ARG, __entry->cookie) | 1094 | WIPHY_PR_ARG, WDEV_PR_ARG, __entry->cookie) |
1072 | ); | 1095 | ); |
1073 | 1096 | ||
@@ -1087,7 +1110,7 @@ TRACE_EVENT(rdev_set_power_mgmt, | |||
1087 | __entry->enabled = enabled; | 1110 | __entry->enabled = enabled; |
1088 | __entry->timeout = timeout; | 1111 | __entry->timeout = timeout; |
1089 | ), | 1112 | ), |
1090 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", %senabled, timeout: %d ", | 1113 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", %senabled, timeout: %d ", |
1091 | WIPHY_PR_ARG, NETDEV_PR_ARG, | 1114 | WIPHY_PR_ARG, NETDEV_PR_ARG, |
1092 | __entry->enabled ? "" : "not ", __entry->timeout) | 1115 | __entry->enabled ? "" : "not ", __entry->timeout) |
1093 | ); | 1116 | ); |
@@ -1117,7 +1140,7 @@ TRACE_EVENT(rdev_connect, | |||
1117 | __entry->wpa_versions = sme->crypto.wpa_versions; | 1140 | __entry->wpa_versions = sme->crypto.wpa_versions; |
1118 | __entry->flags = sme->flags; | 1141 | __entry->flags = sme->flags; |
1119 | ), | 1142 | ), |
1120 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT | 1143 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", bssid: " MAC_PR_FMT |
1121 | ", ssid: %s, auth type: %d, privacy: %s, wpa versions: %u, " | 1144 | ", ssid: %s, auth type: %d, privacy: %s, wpa versions: %u, " |
1122 | "flags: %u", | 1145 | "flags: %u", |
1123 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), __entry->ssid, | 1146 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), __entry->ssid, |
@@ -1142,7 +1165,7 @@ TRACE_EVENT(rdev_set_cqm_rssi_config, | |||
1142 | __entry->rssi_thold = rssi_thold; | 1165 | __entry->rssi_thold = rssi_thold; |
1143 | __entry->rssi_hyst = rssi_hyst; | 1166 | __entry->rssi_hyst = rssi_hyst; |
1144 | ), | 1167 | ), |
1145 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT | 1168 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT |
1146 | ", rssi_thold: %d, rssi_hyst: %u ", | 1169 | ", rssi_thold: %d, rssi_hyst: %u ", |
1147 | WIPHY_PR_ARG, NETDEV_PR_ARG, | 1170 | WIPHY_PR_ARG, NETDEV_PR_ARG, |
1148 | __entry->rssi_thold, __entry->rssi_hyst) | 1171 | __entry->rssi_thold, __entry->rssi_hyst) |
@@ -1166,7 +1189,7 @@ TRACE_EVENT(rdev_set_cqm_txe_config, | |||
1166 | __entry->pkts = pkts; | 1189 | __entry->pkts = pkts; |
1167 | __entry->intvl = intvl; | 1190 | __entry->intvl = intvl; |
1168 | ), | 1191 | ), |
1169 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", rate: %u, packets: %u, interval: %u", | 1192 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", rate: %u, packets: %u, interval: %u", |
1170 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->rate, __entry->pkts, | 1193 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->rate, __entry->pkts, |
1171 | __entry->intvl) | 1194 | __entry->intvl) |
1172 | ); | 1195 | ); |
@@ -1185,7 +1208,7 @@ TRACE_EVENT(rdev_disconnect, | |||
1185 | NETDEV_ASSIGN; | 1208 | NETDEV_ASSIGN; |
1186 | __entry->reason_code = reason_code; | 1209 | __entry->reason_code = reason_code; |
1187 | ), | 1210 | ), |
1188 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", reason code: %u", WIPHY_PR_ARG, | 1211 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", reason code: %u", WIPHY_PR_ARG, |
1189 | NETDEV_PR_ARG, __entry->reason_code) | 1212 | NETDEV_PR_ARG, __entry->reason_code) |
1190 | ); | 1213 | ); |
1191 | 1214 | ||
@@ -1206,7 +1229,7 @@ TRACE_EVENT(rdev_join_ibss, | |||
1206 | memset(__entry->ssid, 0, IEEE80211_MAX_SSID_LEN + 1); | 1229 | memset(__entry->ssid, 0, IEEE80211_MAX_SSID_LEN + 1); |
1207 | memcpy(__entry->ssid, params->ssid, params->ssid_len); | 1230 | memcpy(__entry->ssid, params->ssid, params->ssid_len); |
1208 | ), | 1231 | ), |
1209 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT ", ssid: %s", | 1232 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", bssid: " MAC_PR_FMT ", ssid: %s", |
1210 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), __entry->ssid) | 1233 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), __entry->ssid) |
1211 | ); | 1234 | ); |
1212 | 1235 | ||
@@ -1246,7 +1269,7 @@ TRACE_EVENT(rdev_set_tx_power, | |||
1246 | __entry->type = type; | 1269 | __entry->type = type; |
1247 | __entry->mbm = mbm; | 1270 | __entry->mbm = mbm; |
1248 | ), | 1271 | ), |
1249 | TP_printk(WIPHY_PR_FMT WDEV_PR_FMT ", type: %d, mbm: %d", | 1272 | TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", type: %u, mbm: %d", |
1250 | WIPHY_PR_ARG, WDEV_PR_ARG,__entry->type, __entry->mbm) | 1273 | WIPHY_PR_ARG, WDEV_PR_ARG,__entry->type, __entry->mbm) |
1251 | ); | 1274 | ); |
1252 | 1275 | ||
@@ -1307,7 +1330,7 @@ TRACE_EVENT(rdev_set_bitrate_mask, | |||
1307 | NETDEV_ASSIGN; | 1330 | NETDEV_ASSIGN; |
1308 | MAC_ASSIGN(peer, peer); | 1331 | MAC_ASSIGN(peer, peer); |
1309 | ), | 1332 | ), |
1310 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", peer: " MAC_PR_FMT, | 1333 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT, |
1311 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer)) | 1334 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer)) |
1312 | ); | 1335 | ); |
1313 | 1336 | ||
@@ -1327,7 +1350,7 @@ TRACE_EVENT(rdev_mgmt_frame_register, | |||
1327 | __entry->frame_type = frame_type; | 1350 | __entry->frame_type = frame_type; |
1328 | __entry->reg = reg; | 1351 | __entry->reg = reg; |
1329 | ), | 1352 | ), |
1330 | TP_printk(WIPHY_PR_FMT WDEV_PR_FMT ", frame_type: %u, reg: %s ", | 1353 | TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", frame_type: 0x%.2x, reg: %s ", |
1331 | WIPHY_PR_ARG, WDEV_PR_ARG, __entry->frame_type, | 1354 | WIPHY_PR_ARG, WDEV_PR_ARG, __entry->frame_type, |
1332 | __entry->reg ? "true" : "false") | 1355 | __entry->reg ? "true" : "false") |
1333 | ); | 1356 | ); |
@@ -1413,7 +1436,7 @@ TRACE_EVENT(rdev_sched_scan_start, | |||
1413 | WIPHY_ASSIGN; | 1436 | WIPHY_ASSIGN; |
1414 | NETDEV_ASSIGN; | 1437 | NETDEV_ASSIGN; |
1415 | ), | 1438 | ), |
1416 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT, | 1439 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, |
1417 | WIPHY_PR_ARG, NETDEV_PR_ARG) | 1440 | WIPHY_PR_ARG, NETDEV_PR_ARG) |
1418 | ); | 1441 | ); |
1419 | 1442 | ||
@@ -1441,7 +1464,7 @@ TRACE_EVENT(rdev_tdls_mgmt, | |||
1441 | __entry->status_code = status_code; | 1464 | __entry->status_code = status_code; |
1442 | memcpy(__get_dynamic_array(buf), buf, len); | 1465 | memcpy(__get_dynamic_array(buf), buf, len); |
1443 | ), | 1466 | ), |
1444 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT MAC_PR_FMT ", action_code: %u, " | 1467 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT ", action_code: %u, " |
1445 | "dialog_token: %u, status_code: %u, buf: %#.2x ", | 1468 | "dialog_token: %u, status_code: %u, buf: %#.2x ", |
1446 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), | 1469 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), |
1447 | __entry->action_code, __entry->dialog_token, | 1470 | __entry->action_code, __entry->dialog_token, |
@@ -1461,7 +1484,7 @@ TRACE_EVENT(rdev_dump_survey, | |||
1461 | NETDEV_ASSIGN; | 1484 | NETDEV_ASSIGN; |
1462 | __entry->idx = idx; | 1485 | __entry->idx = idx; |
1463 | ), | 1486 | ), |
1464 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", index: %d", | 1487 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", index: %d", |
1465 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->idx) | 1488 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->idx) |
1466 | ); | 1489 | ); |
1467 | 1490 | ||
@@ -1518,7 +1541,7 @@ TRACE_EVENT(rdev_tdls_oper, | |||
1518 | MAC_ASSIGN(peer, peer); | 1541 | MAC_ASSIGN(peer, peer); |
1519 | __entry->oper = oper; | 1542 | __entry->oper = oper; |
1520 | ), | 1543 | ), |
1521 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT MAC_PR_FMT ", oper: %d", | 1544 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT ", oper: %d", |
1522 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->oper) | 1545 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->oper) |
1523 | ); | 1546 | ); |
1524 | 1547 | ||
@@ -1536,7 +1559,7 @@ DECLARE_EVENT_CLASS(rdev_pmksa, | |||
1536 | NETDEV_ASSIGN; | 1559 | NETDEV_ASSIGN; |
1537 | MAC_ASSIGN(bssid, pmksa->bssid); | 1560 | MAC_ASSIGN(bssid, pmksa->bssid); |
1538 | ), | 1561 | ), |
1539 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT, | 1562 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", bssid: " MAC_PR_FMT, |
1540 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid)) | 1563 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid)) |
1541 | ); | 1564 | ); |
1542 | 1565 | ||
@@ -1554,7 +1577,7 @@ TRACE_EVENT(rdev_probe_client, | |||
1554 | NETDEV_ASSIGN; | 1577 | NETDEV_ASSIGN; |
1555 | MAC_ASSIGN(peer, peer); | 1578 | MAC_ASSIGN(peer, peer); |
1556 | ), | 1579 | ), |
1557 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT MAC_PR_FMT, | 1580 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT, |
1558 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer)) | 1581 | WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer)) |
1559 | ); | 1582 | ); |
1560 | 1583 | ||
@@ -1573,25 +1596,22 @@ DEFINE_EVENT(rdev_pmksa, rdev_del_pmksa, | |||
1573 | TRACE_EVENT(rdev_remain_on_channel, | 1596 | TRACE_EVENT(rdev_remain_on_channel, |
1574 | TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, | 1597 | TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, |
1575 | struct ieee80211_channel *chan, | 1598 | struct ieee80211_channel *chan, |
1576 | enum nl80211_channel_type channel_type, unsigned int duration), | 1599 | unsigned int duration), |
1577 | TP_ARGS(wiphy, wdev, chan, channel_type, duration), | 1600 | TP_ARGS(wiphy, wdev, chan, duration), |
1578 | TP_STRUCT__entry( | 1601 | TP_STRUCT__entry( |
1579 | WIPHY_ENTRY | 1602 | WIPHY_ENTRY |
1580 | WDEV_ENTRY | 1603 | WDEV_ENTRY |
1581 | CHAN_ENTRY | 1604 | CHAN_ENTRY |
1582 | __field(enum nl80211_channel_type, channel_type) | ||
1583 | __field(unsigned int, duration) | 1605 | __field(unsigned int, duration) |
1584 | ), | 1606 | ), |
1585 | TP_fast_assign( | 1607 | TP_fast_assign( |
1586 | WIPHY_ASSIGN; | 1608 | WIPHY_ASSIGN; |
1587 | WDEV_ASSIGN; | 1609 | WDEV_ASSIGN; |
1588 | CHAN_ASSIGN(chan); | 1610 | CHAN_ASSIGN(chan); |
1589 | __entry->channel_type = channel_type; | ||
1590 | __entry->duration = duration; | 1611 | __entry->duration = duration; |
1591 | ), | 1612 | ), |
1592 | TP_printk(WIPHY_PR_FMT WDEV_PR_FMT CHAN_PR_FMT ", channel type: %d, duration: %u", | 1613 | TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", " CHAN_PR_FMT ", duration: %u", |
1593 | WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG, __entry->channel_type, | 1614 | WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG, __entry->duration) |
1594 | __entry->duration) | ||
1595 | ); | 1615 | ); |
1596 | 1616 | ||
1597 | TRACE_EVENT(rdev_return_int_cookie, | 1617 | TRACE_EVENT(rdev_return_int_cookie, |
@@ -1624,25 +1644,20 @@ TRACE_EVENT(rdev_cancel_remain_on_channel, | |||
1624 | WDEV_ASSIGN; | 1644 | WDEV_ASSIGN; |
1625 | __entry->cookie = cookie; | 1645 | __entry->cookie = cookie; |
1626 | ), | 1646 | ), |
1627 | TP_printk(WIPHY_PR_FMT WDEV_PR_FMT ", cookie: %llu", | 1647 | TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", cookie: %llu", |
1628 | WIPHY_PR_ARG, WDEV_PR_ARG, __entry->cookie) | 1648 | WIPHY_PR_ARG, WDEV_PR_ARG, __entry->cookie) |
1629 | ); | 1649 | ); |
1630 | 1650 | ||
1631 | TRACE_EVENT(rdev_mgmt_tx, | 1651 | TRACE_EVENT(rdev_mgmt_tx, |
1632 | TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, | 1652 | TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, |
1633 | struct ieee80211_channel *chan, bool offchan, | 1653 | struct ieee80211_channel *chan, bool offchan, |
1634 | enum nl80211_channel_type channel_type, | 1654 | unsigned int wait, bool no_cck, bool dont_wait_for_ack), |
1635 | bool channel_type_valid, unsigned int wait, bool no_cck, | 1655 | TP_ARGS(wiphy, wdev, chan, offchan, wait, no_cck, dont_wait_for_ack), |
1636 | bool dont_wait_for_ack), | ||
1637 | TP_ARGS(wiphy, wdev, chan, offchan, channel_type, channel_type_valid, | ||
1638 | wait, no_cck, dont_wait_for_ack), | ||
1639 | TP_STRUCT__entry( | 1656 | TP_STRUCT__entry( |
1640 | WIPHY_ENTRY | 1657 | WIPHY_ENTRY |
1641 | WDEV_ENTRY | 1658 | WDEV_ENTRY |
1642 | CHAN_ENTRY | 1659 | CHAN_ENTRY |
1643 | __field(bool, offchan) | 1660 | __field(bool, offchan) |
1644 | __field(enum nl80211_channel_type, channel_type) | ||
1645 | __field(bool, channel_type_valid) | ||
1646 | __field(unsigned int, wait) | 1661 | __field(unsigned int, wait) |
1647 | __field(bool, no_cck) | 1662 | __field(bool, no_cck) |
1648 | __field(bool, dont_wait_for_ack) | 1663 | __field(bool, dont_wait_for_ack) |
@@ -1652,18 +1667,14 @@ TRACE_EVENT(rdev_mgmt_tx, | |||
1652 | WDEV_ASSIGN; | 1667 | WDEV_ASSIGN; |
1653 | CHAN_ASSIGN(chan); | 1668 | CHAN_ASSIGN(chan); |
1654 | __entry->offchan = offchan; | 1669 | __entry->offchan = offchan; |
1655 | __entry->channel_type = channel_type; | ||
1656 | __entry->channel_type_valid = channel_type_valid; | ||
1657 | __entry->wait = wait; | 1670 | __entry->wait = wait; |
1658 | __entry->no_cck = no_cck; | 1671 | __entry->no_cck = no_cck; |
1659 | __entry->dont_wait_for_ack = dont_wait_for_ack; | 1672 | __entry->dont_wait_for_ack = dont_wait_for_ack; |
1660 | ), | 1673 | ), |
1661 | TP_printk(WIPHY_PR_FMT WDEV_PR_FMT CHAN_PR_FMT ", offchan: %s, " | 1674 | TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", " CHAN_PR_FMT ", offchan: %s," |
1662 | "channel type: %d, channel type valid: %s, wait: %u, " | 1675 | " wait: %u, no cck: %s, dont wait for ack: %s", |
1663 | "no cck: %s, dont wait for ack: %s", | ||
1664 | WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG, | 1676 | WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG, |
1665 | BOOL_TO_STR(__entry->offchan), __entry->channel_type, | 1677 | BOOL_TO_STR(__entry->offchan), __entry->wait, |
1666 | BOOL_TO_STR(__entry->channel_type_valid), __entry->wait, | ||
1667 | BOOL_TO_STR(__entry->no_cck), | 1678 | BOOL_TO_STR(__entry->no_cck), |
1668 | BOOL_TO_STR(__entry->dont_wait_for_ack)) | 1679 | BOOL_TO_STR(__entry->dont_wait_for_ack)) |
1669 | ); | 1680 | ); |
@@ -1682,7 +1693,7 @@ TRACE_EVENT(rdev_set_noack_map, | |||
1682 | NETDEV_ASSIGN; | 1693 | NETDEV_ASSIGN; |
1683 | __entry->noack_map = noack_map; | 1694 | __entry->noack_map = noack_map; |
1684 | ), | 1695 | ), |
1685 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", noack_map: %u", | 1696 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", noack_map: %u", |
1686 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map) | 1697 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map) |
1687 | ); | 1698 | ); |
1688 | 1699 | ||
@@ -1699,7 +1710,7 @@ TRACE_EVENT(rdev_get_et_sset_count, | |||
1699 | NETDEV_ASSIGN; | 1710 | NETDEV_ASSIGN; |
1700 | __entry->sset = sset; | 1711 | __entry->sset = sset; |
1701 | ), | 1712 | ), |
1702 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", sset: %d", | 1713 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %d", |
1703 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset) | 1714 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset) |
1704 | ); | 1715 | ); |
1705 | 1716 | ||
@@ -1716,7 +1727,7 @@ TRACE_EVENT(rdev_get_et_strings, | |||
1716 | NETDEV_ASSIGN; | 1727 | NETDEV_ASSIGN; |
1717 | __entry->sset = sset; | 1728 | __entry->sset = sset; |
1718 | ), | 1729 | ), |
1719 | TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", sset: %u", | 1730 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %u", |
1720 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset) | 1731 | WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset) |
1721 | ); | 1732 | ); |
1722 | 1733 | ||
@@ -1725,22 +1736,25 @@ DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel, | |||
1725 | TP_ARGS(wiphy, wdev) | 1736 | TP_ARGS(wiphy, wdev) |
1726 | ); | 1737 | ); |
1727 | 1738 | ||
1728 | TRACE_EVENT(rdev_return_channel, | 1739 | TRACE_EVENT(rdev_return_chandef, |
1729 | TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *chan, | 1740 | TP_PROTO(struct wiphy *wiphy, int ret, |
1730 | enum nl80211_channel_type type), | 1741 | struct cfg80211_chan_def *chandef), |
1731 | TP_ARGS(wiphy, chan, type), | 1742 | TP_ARGS(wiphy, ret, chandef), |
1732 | TP_STRUCT__entry( | 1743 | TP_STRUCT__entry( |
1733 | WIPHY_ENTRY | 1744 | WIPHY_ENTRY |
1734 | CHAN_ENTRY | 1745 | __field(int, ret) |
1735 | __field(enum nl80211_channel_type, type) | 1746 | CHAN_DEF_ENTRY |
1736 | ), | 1747 | ), |
1737 | TP_fast_assign( | 1748 | TP_fast_assign( |
1738 | WIPHY_ASSIGN; | 1749 | WIPHY_ASSIGN; |
1739 | CHAN_ASSIGN(chan); | 1750 | if (ret == 0) |
1740 | __entry->type = type; | 1751 | CHAN_DEF_ASSIGN(chandef); |
1752 | else | ||
1753 | CHAN_DEF_ASSIGN((struct cfg80211_chan_def *)NULL); | ||
1754 | __entry->ret = ret; | ||
1741 | ), | 1755 | ), |
1742 | TP_printk(WIPHY_PR_FMT CHAN_PR_FMT ", channel type: %d", | 1756 | TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT ", ret: %d", |
1743 | WIPHY_PR_ARG, CHAN_PR_ARG, __entry->type) | 1757 | WIPHY_PR_ARG, CHAN_DEF_PR_ARG, __entry->ret) |
1744 | ); | 1758 | ); |
1745 | 1759 | ||
1746 | DEFINE_EVENT(wiphy_wdev_evt, rdev_start_p2p_device, | 1760 | DEFINE_EVENT(wiphy_wdev_evt, rdev_start_p2p_device, |
@@ -1819,7 +1833,7 @@ TRACE_EVENT(cfg80211_send_rx_assoc, | |||
1819 | MAC_ASSIGN(bssid, bss->bssid); | 1833 | MAC_ASSIGN(bssid, bss->bssid); |
1820 | CHAN_ASSIGN(bss->channel); | 1834 | CHAN_ASSIGN(bss->channel); |
1821 | ), | 1835 | ), |
1822 | TP_printk(NETDEV_PR_FMT MAC_PR_FMT CHAN_PR_FMT, | 1836 | TP_printk(NETDEV_PR_FMT ", " MAC_PR_FMT ", " CHAN_PR_FMT, |
1823 | NETDEV_PR_ARG, MAC_PR_ARG(bssid), CHAN_PR_ARG) | 1837 | NETDEV_PR_ARG, MAC_PR_ARG(bssid), CHAN_PR_ARG) |
1824 | ); | 1838 | ); |
1825 | 1839 | ||
@@ -1886,7 +1900,7 @@ TRACE_EVENT(cfg80211_michael_mic_failure, | |||
1886 | __entry->key_id = key_id; | 1900 | __entry->key_id = key_id; |
1887 | memcpy(__entry->tsc, tsc, 6); | 1901 | memcpy(__entry->tsc, tsc, 6); |
1888 | ), | 1902 | ), |
1889 | TP_printk(NETDEV_PR_FMT MAC_PR_FMT ", key type: %d, key id: %d, tsc: %pm", | 1903 | TP_printk(NETDEV_PR_FMT ", " MAC_PR_FMT ", key type: %d, key id: %d, tsc: %pm", |
1890 | NETDEV_PR_ARG, MAC_PR_ARG(addr), __entry->key_type, | 1904 | NETDEV_PR_ARG, MAC_PR_ARG(addr), __entry->key_type, |
1891 | __entry->key_id, __entry->tsc) | 1905 | __entry->key_id, __entry->tsc) |
1892 | ); | 1906 | ); |
@@ -1894,47 +1908,41 @@ TRACE_EVENT(cfg80211_michael_mic_failure, | |||
1894 | TRACE_EVENT(cfg80211_ready_on_channel, | 1908 | TRACE_EVENT(cfg80211_ready_on_channel, |
1895 | TP_PROTO(struct wireless_dev *wdev, u64 cookie, | 1909 | TP_PROTO(struct wireless_dev *wdev, u64 cookie, |
1896 | struct ieee80211_channel *chan, | 1910 | struct ieee80211_channel *chan, |
1897 | enum nl80211_channel_type channel_type, unsigned int duration), | 1911 | unsigned int duration), |
1898 | TP_ARGS(wdev, cookie, chan, channel_type, duration), | 1912 | TP_ARGS(wdev, cookie, chan, duration), |
1899 | TP_STRUCT__entry( | 1913 | TP_STRUCT__entry( |
1900 | WDEV_ENTRY | 1914 | WDEV_ENTRY |
1901 | __field(u64, cookie) | 1915 | __field(u64, cookie) |
1902 | CHAN_ENTRY | 1916 | CHAN_ENTRY |
1903 | __field(enum nl80211_channel_type, channel_type) | ||
1904 | __field(unsigned int, duration) | 1917 | __field(unsigned int, duration) |
1905 | ), | 1918 | ), |
1906 | TP_fast_assign( | 1919 | TP_fast_assign( |
1907 | WDEV_ASSIGN; | 1920 | WDEV_ASSIGN; |
1908 | __entry->cookie = cookie; | 1921 | __entry->cookie = cookie; |
1909 | CHAN_ASSIGN(chan); | 1922 | CHAN_ASSIGN(chan); |
1910 | __entry->channel_type = channel_type; | ||
1911 | __entry->duration = duration; | 1923 | __entry->duration = duration; |
1912 | ), | 1924 | ), |
1913 | TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT ", channel type: %d, duration: %u", | 1925 | TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT ", duration: %u", |
1914 | WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG, | 1926 | WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG, |
1915 | __entry->channel_type, __entry->duration) | 1927 | __entry->duration) |
1916 | ); | 1928 | ); |
1917 | 1929 | ||
1918 | TRACE_EVENT(cfg80211_ready_on_channel_expired, | 1930 | TRACE_EVENT(cfg80211_ready_on_channel_expired, |
1919 | TP_PROTO(struct wireless_dev *wdev, u64 cookie, | 1931 | TP_PROTO(struct wireless_dev *wdev, u64 cookie, |
1920 | struct ieee80211_channel *chan, | 1932 | struct ieee80211_channel *chan), |
1921 | enum nl80211_channel_type channel_type), | 1933 | TP_ARGS(wdev, cookie, chan), |
1922 | TP_ARGS(wdev, cookie, chan, channel_type), | ||
1923 | TP_STRUCT__entry( | 1934 | TP_STRUCT__entry( |
1924 | WDEV_ENTRY | 1935 | WDEV_ENTRY |
1925 | __field(u64, cookie) | 1936 | __field(u64, cookie) |
1926 | CHAN_ENTRY | 1937 | CHAN_ENTRY |
1927 | __field(enum nl80211_channel_type, channel_type) | ||
1928 | ), | 1938 | ), |
1929 | TP_fast_assign( | 1939 | TP_fast_assign( |
1930 | WDEV_ASSIGN; | 1940 | WDEV_ASSIGN; |
1931 | __entry->cookie = cookie; | 1941 | __entry->cookie = cookie; |
1932 | CHAN_ASSIGN(chan); | 1942 | CHAN_ASSIGN(chan); |
1933 | __entry->channel_type = channel_type; | ||
1934 | ), | 1943 | ), |
1935 | TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT ", channel type: %d", | 1944 | TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT, |
1936 | WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG, | 1945 | WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG) |
1937 | __entry->channel_type) | ||
1938 | ); | 1946 | ); |
1939 | 1947 | ||
1940 | TRACE_EVENT(cfg80211_new_sta, | 1948 | TRACE_EVENT(cfg80211_new_sta, |
@@ -1951,7 +1959,7 @@ TRACE_EVENT(cfg80211_new_sta, | |||
1951 | MAC_ASSIGN(mac_addr, mac_addr); | 1959 | MAC_ASSIGN(mac_addr, mac_addr); |
1952 | SINFO_ASSIGN; | 1960 | SINFO_ASSIGN; |
1953 | ), | 1961 | ), |
1954 | TP_printk(NETDEV_PR_FMT MAC_PR_FMT, | 1962 | TP_printk(NETDEV_PR_FMT ", " MAC_PR_FMT, |
1955 | NETDEV_PR_ARG, MAC_PR_ARG(mac_addr)) | 1963 | NETDEV_PR_ARG, MAC_PR_ARG(mac_addr)) |
1956 | ); | 1964 | ); |
1957 | 1965 | ||
@@ -2010,40 +2018,35 @@ TRACE_EVENT(cfg80211_cqm_rssi_notify, | |||
2010 | NETDEV_PR_ARG, __entry->rssi_event) | 2018 | NETDEV_PR_ARG, __entry->rssi_event) |
2011 | ); | 2019 | ); |
2012 | 2020 | ||
2013 | TRACE_EVENT(cfg80211_can_beacon_sec_chan, | 2021 | TRACE_EVENT(cfg80211_reg_can_beacon, |
2014 | TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *channel, | 2022 | TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef), |
2015 | enum nl80211_channel_type channel_type), | 2023 | TP_ARGS(wiphy, chandef), |
2016 | TP_ARGS(wiphy, channel, channel_type), | ||
2017 | TP_STRUCT__entry( | 2024 | TP_STRUCT__entry( |
2018 | WIPHY_ENTRY | 2025 | WIPHY_ENTRY |
2019 | CHAN_ENTRY | 2026 | CHAN_DEF_ENTRY |
2020 | __field(enum nl80211_channel_type, channel_type) | ||
2021 | ), | 2027 | ), |
2022 | TP_fast_assign( | 2028 | TP_fast_assign( |
2023 | WIPHY_ASSIGN; | 2029 | WIPHY_ASSIGN; |
2024 | CHAN_ASSIGN(channel); | 2030 | CHAN_DEF_ASSIGN(chandef); |
2025 | __entry->channel_type = channel_type; | ||
2026 | ), | 2031 | ), |
2027 | TP_printk(WIPHY_PR_FMT CHAN_PR_FMT ", channel_type: %d", | 2032 | TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT, |
2028 | WIPHY_PR_ARG, CHAN_PR_ARG, __entry->channel_type) | 2033 | WIPHY_PR_ARG, CHAN_DEF_PR_ARG) |
2029 | ); | 2034 | ); |
2030 | 2035 | ||
2031 | TRACE_EVENT(cfg80211_ch_switch_notify, | 2036 | TRACE_EVENT(cfg80211_ch_switch_notify, |
2032 | TP_PROTO(struct net_device *netdev, int freq, | 2037 | TP_PROTO(struct net_device *netdev, |
2033 | enum nl80211_channel_type type), | 2038 | struct cfg80211_chan_def *chandef), |
2034 | TP_ARGS(netdev, freq, type), | 2039 | TP_ARGS(netdev, chandef), |
2035 | TP_STRUCT__entry( | 2040 | TP_STRUCT__entry( |
2036 | NETDEV_ENTRY | 2041 | NETDEV_ENTRY |
2037 | __field(int, freq) | 2042 | CHAN_DEF_ENTRY |
2038 | __field(enum nl80211_channel_type, type) | ||
2039 | ), | 2043 | ), |
2040 | TP_fast_assign( | 2044 | TP_fast_assign( |
2041 | NETDEV_ASSIGN; | 2045 | NETDEV_ASSIGN; |
2042 | __entry->freq = freq; | 2046 | CHAN_DEF_ASSIGN(chandef); |
2043 | __entry->type = type; | ||
2044 | ), | 2047 | ), |
2045 | TP_printk(NETDEV_PR_FMT ", freq: %d, type: %d", NETDEV_PR_ARG, | 2048 | TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT, |
2046 | __entry->freq, __entry->type) | 2049 | NETDEV_PR_ARG, CHAN_DEF_PR_ARG) |
2047 | ); | 2050 | ); |
2048 | 2051 | ||
2049 | DECLARE_EVENT_CLASS(cfg80211_rx_evt, | 2052 | DECLARE_EVENT_CLASS(cfg80211_rx_evt, |
@@ -2057,7 +2060,7 @@ DECLARE_EVENT_CLASS(cfg80211_rx_evt, | |||
2057 | NETDEV_ASSIGN; | 2060 | NETDEV_ASSIGN; |
2058 | MAC_ASSIGN(addr, addr); | 2061 | MAC_ASSIGN(addr, addr); |
2059 | ), | 2062 | ), |
2060 | TP_printk(NETDEV_PR_FMT MAC_PR_FMT, NETDEV_PR_ARG, MAC_PR_ARG(addr)) | 2063 | TP_printk(NETDEV_PR_FMT ", " MAC_PR_FMT, NETDEV_PR_ARG, MAC_PR_ARG(addr)) |
2061 | ); | 2064 | ); |
2062 | 2065 | ||
2063 | DEFINE_EVENT(cfg80211_rx_evt, cfg80211_ibss_joined, | 2066 | DEFINE_EVENT(cfg80211_rx_evt, cfg80211_ibss_joined, |
@@ -2091,7 +2094,7 @@ TRACE_EVENT(cfg80211_probe_status, | |||
2091 | __entry->cookie = cookie; | 2094 | __entry->cookie = cookie; |
2092 | __entry->acked = acked; | 2095 | __entry->acked = acked; |
2093 | ), | 2096 | ), |
2094 | TP_printk(NETDEV_PR_FMT MAC_PR_FMT ", cookie: %llu, acked: %s", | 2097 | TP_printk(NETDEV_PR_FMT " addr:" MAC_PR_FMT ", cookie: %llu, acked: %s", |
2095 | NETDEV_PR_ARG, MAC_PR_ARG(addr), __entry->cookie, | 2098 | NETDEV_PR_ARG, MAC_PR_ARG(addr), __entry->cookie, |
2096 | BOOL_TO_STR(__entry->acked)) | 2099 | BOOL_TO_STR(__entry->acked)) |
2097 | ); | 2100 | ); |
@@ -2241,7 +2244,7 @@ TRACE_EVENT(cfg80211_get_bss, | |||
2241 | __entry->capa_mask = capa_mask; | 2244 | __entry->capa_mask = capa_mask; |
2242 | __entry->capa_val = capa_val; | 2245 | __entry->capa_val = capa_val; |
2243 | ), | 2246 | ), |
2244 | TP_printk(WIPHY_PR_FMT CHAN_PR_FMT MAC_PR_FMT ", buf: %#.2x, " | 2247 | TP_printk(WIPHY_PR_FMT ", " CHAN_PR_FMT ", " MAC_PR_FMT ", buf: %#.2x, " |
2245 | "capa_mask: %d, capa_val: %u", WIPHY_PR_ARG, CHAN_PR_ARG, | 2248 | "capa_mask: %d, capa_val: %u", WIPHY_PR_ARG, CHAN_PR_ARG, |
2246 | MAC_PR_ARG(bssid), ((u8 *)__get_dynamic_array(ssid))[0], | 2249 | MAC_PR_ARG(bssid), ((u8 *)__get_dynamic_array(ssid))[0], |
2247 | __entry->capa_mask, __entry->capa_val) | 2250 | __entry->capa_mask, __entry->capa_val) |
@@ -2265,7 +2268,7 @@ TRACE_EVENT(cfg80211_inform_bss_frame, | |||
2265 | memcpy(__get_dynamic_array(mgmt), mgmt, len); | 2268 | memcpy(__get_dynamic_array(mgmt), mgmt, len); |
2266 | __entry->signal = signal; | 2269 | __entry->signal = signal; |
2267 | ), | 2270 | ), |
2268 | TP_printk(WIPHY_PR_FMT CHAN_PR_FMT "signal: %d", | 2271 | TP_printk(WIPHY_PR_FMT ", " CHAN_PR_FMT "signal: %d", |
2269 | WIPHY_PR_ARG, CHAN_PR_ARG, __entry->signal) | 2272 | WIPHY_PR_ARG, CHAN_PR_ARG, __entry->signal) |
2270 | ); | 2273 | ); |
2271 | 2274 | ||
@@ -2280,7 +2283,7 @@ DECLARE_EVENT_CLASS(cfg80211_bss_evt, | |||
2280 | MAC_ASSIGN(bssid, pub->bssid); | 2283 | MAC_ASSIGN(bssid, pub->bssid); |
2281 | CHAN_ASSIGN(pub->channel); | 2284 | CHAN_ASSIGN(pub->channel); |
2282 | ), | 2285 | ), |
2283 | TP_printk(MAC_PR_FMT CHAN_PR_FMT, MAC_PR_ARG(bssid), CHAN_PR_ARG) | 2286 | TP_printk(MAC_PR_FMT ", " CHAN_PR_FMT, MAC_PR_ARG(bssid), CHAN_PR_ARG) |
2284 | ); | 2287 | ); |
2285 | 2288 | ||
2286 | DEFINE_EVENT(cfg80211_bss_evt, cfg80211_return_bss, | 2289 | DEFINE_EVENT(cfg80211_bss_evt, cfg80211_return_bss, |
diff --git a/net/wireless/util.c b/net/wireless/util.c index b99f01cda1f6..3cce6e486219 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -944,14 +944,86 @@ static u32 cfg80211_calculate_bitrate_60g(struct rate_info *rate) | |||
944 | return __mcs2bitrate[rate->mcs]; | 944 | return __mcs2bitrate[rate->mcs]; |
945 | } | 945 | } |
946 | 946 | ||
947 | static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate) | ||
948 | { | ||
949 | static const u32 base[4][10] = { | ||
950 | { 6500000, | ||
951 | 13000000, | ||
952 | 19500000, | ||
953 | 26000000, | ||
954 | 39000000, | ||
955 | 52000000, | ||
956 | 58500000, | ||
957 | 65000000, | ||
958 | 78000000, | ||
959 | 0, | ||
960 | }, | ||
961 | { 13500000, | ||
962 | 27000000, | ||
963 | 40500000, | ||
964 | 54000000, | ||
965 | 81000000, | ||
966 | 108000000, | ||
967 | 121500000, | ||
968 | 135000000, | ||
969 | 162000000, | ||
970 | 180000000, | ||
971 | }, | ||
972 | { 29300000, | ||
973 | 58500000, | ||
974 | 87800000, | ||
975 | 117000000, | ||
976 | 175500000, | ||
977 | 234000000, | ||
978 | 263300000, | ||
979 | 292500000, | ||
980 | 351000000, | ||
981 | 390000000, | ||
982 | }, | ||
983 | { 58500000, | ||
984 | 117000000, | ||
985 | 175500000, | ||
986 | 234000000, | ||
987 | 351000000, | ||
988 | 468000000, | ||
989 | 526500000, | ||
990 | 585000000, | ||
991 | 702000000, | ||
992 | 780000000, | ||
993 | }, | ||
994 | }; | ||
995 | u32 bitrate; | ||
996 | int idx; | ||
997 | |||
998 | if (WARN_ON_ONCE(rate->mcs > 9)) | ||
999 | return 0; | ||
1000 | |||
1001 | idx = rate->flags & (RATE_INFO_FLAGS_160_MHZ_WIDTH | | ||
1002 | RATE_INFO_FLAGS_80P80_MHZ_WIDTH) ? 3 : | ||
1003 | rate->flags & RATE_INFO_FLAGS_80_MHZ_WIDTH ? 2 : | ||
1004 | rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH ? 1 : 0; | ||
1005 | |||
1006 | bitrate = base[idx][rate->mcs]; | ||
1007 | bitrate *= rate->nss; | ||
1008 | |||
1009 | if (rate->flags & RATE_INFO_FLAGS_SHORT_GI) | ||
1010 | bitrate = (bitrate / 9) * 10; | ||
1011 | |||
1012 | /* do NOT round down here */ | ||
1013 | return (bitrate + 50000) / 100000; | ||
1014 | } | ||
1015 | |||
947 | u32 cfg80211_calculate_bitrate(struct rate_info *rate) | 1016 | u32 cfg80211_calculate_bitrate(struct rate_info *rate) |
948 | { | 1017 | { |
949 | int modulation, streams, bitrate; | 1018 | int modulation, streams, bitrate; |
950 | 1019 | ||
951 | if (!(rate->flags & RATE_INFO_FLAGS_MCS)) | 1020 | if (!(rate->flags & RATE_INFO_FLAGS_MCS) && |
1021 | !(rate->flags & RATE_INFO_FLAGS_VHT_MCS)) | ||
952 | return rate->legacy; | 1022 | return rate->legacy; |
953 | if (rate->flags & RATE_INFO_FLAGS_60G) | 1023 | if (rate->flags & RATE_INFO_FLAGS_60G) |
954 | return cfg80211_calculate_bitrate_60g(rate); | 1024 | return cfg80211_calculate_bitrate_60g(rate); |
1025 | if (rate->flags & RATE_INFO_FLAGS_VHT_MCS) | ||
1026 | return cfg80211_calculate_bitrate_vht(rate); | ||
955 | 1027 | ||
956 | /* the formula below does only work for MCS values smaller than 32 */ | 1028 | /* the formula below does only work for MCS values smaller than 32 */ |
957 | if (WARN_ON_ONCE(rate->mcs >= 32)) | 1029 | if (WARN_ON_ONCE(rate->mcs >= 32)) |
@@ -980,8 +1052,9 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate) | |||
980 | } | 1052 | } |
981 | EXPORT_SYMBOL(cfg80211_calculate_bitrate); | 1053 | EXPORT_SYMBOL(cfg80211_calculate_bitrate); |
982 | 1054 | ||
983 | unsigned int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, | 1055 | int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, |
984 | u8 attr, u8 *buf, unsigned int bufsize) | 1056 | enum ieee80211_p2p_attr_id attr, |
1057 | u8 *buf, unsigned int bufsize) | ||
985 | { | 1058 | { |
986 | u8 *out = buf; | 1059 | u8 *out = buf; |
987 | u16 attr_remaining = 0; | 1060 | u16 attr_remaining = 0; |
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 742ab6ec4c9d..f9680c9cf9b3 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -784,6 +784,9 @@ static int cfg80211_wext_siwfreq(struct net_device *dev, | |||
784 | { | 784 | { |
785 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 785 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
786 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 786 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
787 | struct cfg80211_chan_def chandef = { | ||
788 | .width = NL80211_CHAN_WIDTH_20_NOHT, | ||
789 | }; | ||
787 | int freq, err; | 790 | int freq, err; |
788 | 791 | ||
789 | switch (wdev->iftype) { | 792 | switch (wdev->iftype) { |
@@ -797,8 +800,12 @@ static int cfg80211_wext_siwfreq(struct net_device *dev, | |||
797 | return freq; | 800 | return freq; |
798 | if (freq == 0) | 801 | if (freq == 0) |
799 | return -EINVAL; | 802 | return -EINVAL; |
803 | chandef.center_freq1 = freq; | ||
804 | chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq); | ||
805 | if (!chandef.chan) | ||
806 | return -EINVAL; | ||
800 | mutex_lock(&rdev->devlist_mtx); | 807 | mutex_lock(&rdev->devlist_mtx); |
801 | err = cfg80211_set_monitor_channel(rdev, freq, NL80211_CHAN_NO_HT); | 808 | err = cfg80211_set_monitor_channel(rdev, &chandef); |
802 | mutex_unlock(&rdev->devlist_mtx); | 809 | mutex_unlock(&rdev->devlist_mtx); |
803 | return err; | 810 | return err; |
804 | case NL80211_IFTYPE_MESH_POINT: | 811 | case NL80211_IFTYPE_MESH_POINT: |
@@ -807,9 +814,12 @@ static int cfg80211_wext_siwfreq(struct net_device *dev, | |||
807 | return freq; | 814 | return freq; |
808 | if (freq == 0) | 815 | if (freq == 0) |
809 | return -EINVAL; | 816 | return -EINVAL; |
817 | chandef.center_freq1 = freq; | ||
818 | chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq); | ||
819 | if (!chandef.chan) | ||
820 | return -EINVAL; | ||
810 | mutex_lock(&rdev->devlist_mtx); | 821 | mutex_lock(&rdev->devlist_mtx); |
811 | err = cfg80211_set_mesh_freq(rdev, wdev, freq, | 822 | err = cfg80211_set_mesh_channel(rdev, wdev, &chandef); |
812 | NL80211_CHAN_NO_HT); | ||
813 | mutex_unlock(&rdev->devlist_mtx); | 823 | mutex_unlock(&rdev->devlist_mtx); |
814 | return err; | 824 | return err; |
815 | default: | 825 | default: |
@@ -823,8 +833,8 @@ static int cfg80211_wext_giwfreq(struct net_device *dev, | |||
823 | { | 833 | { |
824 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 834 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
825 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 835 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
826 | struct ieee80211_channel *chan; | 836 | struct cfg80211_chan_def chandef; |
827 | enum nl80211_channel_type channel_type; | 837 | int ret; |
828 | 838 | ||
829 | switch (wdev->iftype) { | 839 | switch (wdev->iftype) { |
830 | case NL80211_IFTYPE_STATION: | 840 | case NL80211_IFTYPE_STATION: |
@@ -835,10 +845,10 @@ static int cfg80211_wext_giwfreq(struct net_device *dev, | |||
835 | if (!rdev->ops->get_channel) | 845 | if (!rdev->ops->get_channel) |
836 | return -EINVAL; | 846 | return -EINVAL; |
837 | 847 | ||
838 | chan = rdev_get_channel(rdev, wdev, &channel_type); | 848 | ret = rdev_get_channel(rdev, wdev, &chandef); |
839 | if (!chan) | 849 | if (ret) |
840 | return -EINVAL; | 850 | return ret; |
841 | freq->m = chan->center_freq; | 851 | freq->m = chandef.chan->center_freq; |
842 | freq->e = 6; | 852 | freq->e = 6; |
843 | return 0; | 853 | return 0; |
844 | default: | 854 | default: |
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index 1f773f668d1a..873af63187c0 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c | |||
@@ -119,7 +119,16 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
119 | * channel we disconnected above and reconnect below. | 119 | * channel we disconnected above and reconnect below. |
120 | */ | 120 | */ |
121 | if (chan && !wdev->wext.connect.ssid_len) { | 121 | if (chan && !wdev->wext.connect.ssid_len) { |
122 | err = cfg80211_set_monitor_channel(rdev, freq, NL80211_CHAN_NO_HT); | 122 | struct cfg80211_chan_def chandef = { |
123 | .width = NL80211_CHAN_WIDTH_20_NOHT, | ||
124 | .center_freq1 = freq, | ||
125 | }; | ||
126 | |||
127 | chandef.chan = ieee80211_get_channel(&rdev->wiphy, freq); | ||
128 | if (chandef.chan) | ||
129 | err = cfg80211_set_monitor_channel(rdev, &chandef); | ||
130 | else | ||
131 | err = -EINVAL; | ||
123 | goto out; | 132 | goto out; |
124 | } | 133 | } |
125 | 134 | ||