diff options
| author | Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> | 2013-07-08 10:55:49 -0400 |
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2013-07-16 02:58:01 -0400 |
| commit | dcd6eac1f3b5fa1df11dfa99da0cf75b76cfef97 (patch) | |
| tree | 6bd0f6452332418b8c17e9d4c0358fdb7d9678ef /include | |
| parent | be29b99a9b51b0338eea3c66a58de53bbd01de24 (diff) | |
nl80211: add scan width to bss and scan request structs
To allow scanning and working with 5 MHz and 10 MHz BSS, extend the
inform bss commands and add wrappers to take 5 and 10 MHz bss into
account.
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/cfg80211.h | 54 | ||||
| -rw-r--r-- | include/uapi/linux/nl80211.h | 18 |
2 files changed, 69 insertions, 3 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 071ed2395c9a..bae8614a450f 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -1285,6 +1285,7 @@ struct cfg80211_ssid { | |||
| 1285 | * @n_ssids: number of SSIDs | 1285 | * @n_ssids: number of SSIDs |
| 1286 | * @channels: channels to scan on. | 1286 | * @channels: channels to scan on. |
| 1287 | * @n_channels: total number of channels to scan | 1287 | * @n_channels: total number of channels to scan |
| 1288 | * @scan_width: channel width for scanning | ||
| 1288 | * @ie: optional information element(s) to add into Probe Request or %NULL | 1289 | * @ie: optional information element(s) to add into Probe Request or %NULL |
| 1289 | * @ie_len: length of ie in octets | 1290 | * @ie_len: length of ie in octets |
| 1290 | * @flags: bit field of flags controlling operation | 1291 | * @flags: bit field of flags controlling operation |
| @@ -1300,6 +1301,7 @@ struct cfg80211_scan_request { | |||
| 1300 | struct cfg80211_ssid *ssids; | 1301 | struct cfg80211_ssid *ssids; |
| 1301 | int n_ssids; | 1302 | int n_ssids; |
| 1302 | u32 n_channels; | 1303 | u32 n_channels; |
| 1304 | enum nl80211_bss_scan_width scan_width; | ||
| 1303 | const u8 *ie; | 1305 | const u8 *ie; |
| 1304 | size_t ie_len; | 1306 | size_t ie_len; |
| 1305 | u32 flags; | 1307 | u32 flags; |
| @@ -1333,6 +1335,7 @@ struct cfg80211_match_set { | |||
| 1333 | * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) | 1335 | * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) |
| 1334 | * @n_ssids: number of SSIDs | 1336 | * @n_ssids: number of SSIDs |
| 1335 | * @n_channels: total number of channels to scan | 1337 | * @n_channels: total number of channels to scan |
| 1338 | * @scan_width: channel width for scanning | ||
| 1336 | * @interval: interval between each scheduled scan cycle | 1339 | * @interval: interval between each scheduled scan cycle |
| 1337 | * @ie: optional information element(s) to add into Probe Request or %NULL | 1340 | * @ie: optional information element(s) to add into Probe Request or %NULL |
| 1338 | * @ie_len: length of ie in octets | 1341 | * @ie_len: length of ie in octets |
| @@ -1352,6 +1355,7 @@ struct cfg80211_sched_scan_request { | |||
| 1352 | struct cfg80211_ssid *ssids; | 1355 | struct cfg80211_ssid *ssids; |
| 1353 | int n_ssids; | 1356 | int n_ssids; |
| 1354 | u32 n_channels; | 1357 | u32 n_channels; |
| 1358 | enum nl80211_bss_scan_width scan_width; | ||
| 1355 | u32 interval; | 1359 | u32 interval; |
| 1356 | const u8 *ie; | 1360 | const u8 *ie; |
| 1357 | size_t ie_len; | 1361 | size_t ie_len; |
| @@ -1403,6 +1407,7 @@ struct cfg80211_bss_ies { | |||
| 1403 | * for use in scan results and similar. | 1407 | * for use in scan results and similar. |
| 1404 | * | 1408 | * |
| 1405 | * @channel: channel this BSS is on | 1409 | * @channel: channel this BSS is on |
| 1410 | * @scan_width: width of the control channel | ||
| 1406 | * @bssid: BSSID of the BSS | 1411 | * @bssid: BSSID of the BSS |
| 1407 | * @beacon_interval: the beacon interval as from the frame | 1412 | * @beacon_interval: the beacon interval as from the frame |
| 1408 | * @capability: the capability field in host byte order | 1413 | * @capability: the capability field in host byte order |
| @@ -1424,6 +1429,7 @@ struct cfg80211_bss_ies { | |||
| 1424 | */ | 1429 | */ |
| 1425 | struct cfg80211_bss { | 1430 | struct cfg80211_bss { |
| 1426 | struct ieee80211_channel *channel; | 1431 | struct ieee80211_channel *channel; |
| 1432 | enum nl80211_bss_scan_width scan_width; | ||
| 1427 | 1433 | ||
| 1428 | const struct cfg80211_bss_ies __rcu *ies; | 1434 | const struct cfg80211_bss_ies __rcu *ies; |
| 1429 | const struct cfg80211_bss_ies __rcu *beacon_ies; | 1435 | const struct cfg80211_bss_ies __rcu *beacon_ies; |
| @@ -3438,10 +3444,11 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy); | |||
| 3438 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy); | 3444 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy); |
| 3439 | 3445 | ||
| 3440 | /** | 3446 | /** |
| 3441 | * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame | 3447 | * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame |
| 3442 | * | 3448 | * |
| 3443 | * @wiphy: the wiphy reporting the BSS | 3449 | * @wiphy: the wiphy reporting the BSS |
| 3444 | * @channel: The channel the frame was received on | 3450 | * @channel: The channel the frame was received on |
| 3451 | * @scan_width: width of the control channel | ||
| 3445 | * @mgmt: the management frame (probe response or beacon) | 3452 | * @mgmt: the management frame (probe response or beacon) |
| 3446 | * @len: length of the management frame | 3453 | * @len: length of the management frame |
| 3447 | * @signal: the signal strength, type depends on the wiphy's signal_type | 3454 | * @signal: the signal strength, type depends on the wiphy's signal_type |
| @@ -3454,16 +3461,29 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy); | |||
| 3454 | * Or %NULL on error. | 3461 | * Or %NULL on error. |
| 3455 | */ | 3462 | */ |
| 3456 | struct cfg80211_bss * __must_check | 3463 | struct cfg80211_bss * __must_check |
| 3464 | cfg80211_inform_bss_width_frame(struct wiphy *wiphy, | ||
| 3465 | struct ieee80211_channel *channel, | ||
| 3466 | enum nl80211_bss_scan_width scan_width, | ||
| 3467 | struct ieee80211_mgmt *mgmt, size_t len, | ||
| 3468 | s32 signal, gfp_t gfp); | ||
| 3469 | |||
| 3470 | static inline struct cfg80211_bss * __must_check | ||
| 3457 | cfg80211_inform_bss_frame(struct wiphy *wiphy, | 3471 | cfg80211_inform_bss_frame(struct wiphy *wiphy, |
| 3458 | struct ieee80211_channel *channel, | 3472 | struct ieee80211_channel *channel, |
| 3459 | struct ieee80211_mgmt *mgmt, size_t len, | 3473 | struct ieee80211_mgmt *mgmt, size_t len, |
| 3460 | s32 signal, gfp_t gfp); | 3474 | s32 signal, gfp_t gfp) |
| 3475 | { | ||
| 3476 | return cfg80211_inform_bss_width_frame(wiphy, channel, | ||
| 3477 | NL80211_BSS_CHAN_WIDTH_20, | ||
| 3478 | mgmt, len, signal, gfp); | ||
| 3479 | } | ||
| 3461 | 3480 | ||
| 3462 | /** | 3481 | /** |
| 3463 | * cfg80211_inform_bss - inform cfg80211 of a new BSS | 3482 | * cfg80211_inform_bss - inform cfg80211 of a new BSS |
| 3464 | * | 3483 | * |
| 3465 | * @wiphy: the wiphy reporting the BSS | 3484 | * @wiphy: the wiphy reporting the BSS |
| 3466 | * @channel: The channel the frame was received on | 3485 | * @channel: The channel the frame was received on |
| 3486 | * @scan_width: width of the control channel | ||
| 3467 | * @bssid: the BSSID of the BSS | 3487 | * @bssid: the BSSID of the BSS |
| 3468 | * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) | 3488 | * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) |
| 3469 | * @capability: the capability field sent by the peer | 3489 | * @capability: the capability field sent by the peer |
| @@ -3480,11 +3500,26 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
| 3480 | * Or %NULL on error. | 3500 | * Or %NULL on error. |
| 3481 | */ | 3501 | */ |
| 3482 | struct cfg80211_bss * __must_check | 3502 | struct cfg80211_bss * __must_check |
| 3503 | cfg80211_inform_bss_width(struct wiphy *wiphy, | ||
| 3504 | struct ieee80211_channel *channel, | ||
| 3505 | enum nl80211_bss_scan_width scan_width, | ||
| 3506 | const u8 *bssid, u64 tsf, u16 capability, | ||
| 3507 | u16 beacon_interval, const u8 *ie, size_t ielen, | ||
| 3508 | s32 signal, gfp_t gfp); | ||
| 3509 | |||
| 3510 | static inline struct cfg80211_bss * __must_check | ||
| 3483 | cfg80211_inform_bss(struct wiphy *wiphy, | 3511 | cfg80211_inform_bss(struct wiphy *wiphy, |
| 3484 | struct ieee80211_channel *channel, | 3512 | struct ieee80211_channel *channel, |
| 3485 | const u8 *bssid, u64 tsf, u16 capability, | 3513 | const u8 *bssid, u64 tsf, u16 capability, |
| 3486 | u16 beacon_interval, const u8 *ie, size_t ielen, | 3514 | u16 beacon_interval, const u8 *ie, size_t ielen, |
| 3487 | s32 signal, gfp_t gfp); | 3515 | s32 signal, gfp_t gfp) |
| 3516 | { | ||
| 3517 | return cfg80211_inform_bss_width(wiphy, channel, | ||
| 3518 | NL80211_BSS_CHAN_WIDTH_20, | ||
| 3519 | bssid, tsf, capability, | ||
| 3520 | beacon_interval, ie, ielen, signal, | ||
| 3521 | gfp); | ||
| 3522 | } | ||
| 3488 | 3523 | ||
| 3489 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | 3524 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, |
| 3490 | struct ieee80211_channel *channel, | 3525 | struct ieee80211_channel *channel, |
| @@ -3530,6 +3565,19 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); | |||
| 3530 | */ | 3565 | */ |
| 3531 | void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); | 3566 | void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); |
| 3532 | 3567 | ||
| 3568 | static inline enum nl80211_bss_scan_width | ||
| 3569 | cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef) | ||
| 3570 | { | ||
| 3571 | switch (chandef->width) { | ||
| 3572 | case NL80211_CHAN_WIDTH_5: | ||
| 3573 | return NL80211_BSS_CHAN_WIDTH_5; | ||
| 3574 | case NL80211_CHAN_WIDTH_10: | ||
| 3575 | return NL80211_BSS_CHAN_WIDTH_10; | ||
| 3576 | default: | ||
| 3577 | return NL80211_BSS_CHAN_WIDTH_20; | ||
| 3578 | } | ||
| 3579 | } | ||
| 3580 | |||
| 3533 | /** | 3581 | /** |
| 3534 | * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame | 3582 | * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame |
| 3535 | * @dev: network device | 3583 | * @dev: network device |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 5abc54d14d4d..eb68735b3318 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
| @@ -2808,6 +2808,21 @@ enum nl80211_chan_width { | |||
| 2808 | }; | 2808 | }; |
| 2809 | 2809 | ||
| 2810 | /** | 2810 | /** |
| 2811 | * enum nl80211_bss_scan_width - control channel width for a BSS | ||
| 2812 | * | ||
| 2813 | * These values are used with the %NL80211_BSS_CHAN_WIDTH attribute. | ||
| 2814 | * | ||
| 2815 | * @NL80211_BSS_CHAN_WIDTH_20: control channel is 20 MHz wide or compatible | ||
| 2816 | * @NL80211_BSS_CHAN_WIDTH_10: control channel is 10 MHz wide | ||
| 2817 | * @NL80211_BSS_CHAN_WIDTH_5: control channel is 5 MHz wide | ||
| 2818 | */ | ||
| 2819 | enum nl80211_bss_scan_width { | ||
| 2820 | NL80211_BSS_CHAN_WIDTH_20, | ||
| 2821 | NL80211_BSS_CHAN_WIDTH_10, | ||
| 2822 | NL80211_BSS_CHAN_WIDTH_5, | ||
| 2823 | }; | ||
| 2824 | |||
| 2825 | /** | ||
| 2811 | * enum nl80211_bss - netlink attributes for a BSS | 2826 | * enum nl80211_bss - netlink attributes for a BSS |
| 2812 | * | 2827 | * |
| 2813 | * @__NL80211_BSS_INVALID: invalid | 2828 | * @__NL80211_BSS_INVALID: invalid |
| @@ -2831,6 +2846,8 @@ enum nl80211_chan_width { | |||
| 2831 | * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information | 2846 | * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information |
| 2832 | * elements from a Beacon frame (bin); not present if no Beacon frame has | 2847 | * elements from a Beacon frame (bin); not present if no Beacon frame has |
| 2833 | * yet been received | 2848 | * yet been received |
| 2849 | * @NL80211_BSS_CHAN_WIDTH: channel width of the control channel | ||
| 2850 | * (u32, enum nl80211_bss_scan_width) | ||
| 2834 | * @__NL80211_BSS_AFTER_LAST: internal | 2851 | * @__NL80211_BSS_AFTER_LAST: internal |
| 2835 | * @NL80211_BSS_MAX: highest BSS attribute | 2852 | * @NL80211_BSS_MAX: highest BSS attribute |
| 2836 | */ | 2853 | */ |
| @@ -2847,6 +2864,7 @@ enum nl80211_bss { | |||
| 2847 | NL80211_BSS_STATUS, | 2864 | NL80211_BSS_STATUS, |
| 2848 | NL80211_BSS_SEEN_MS_AGO, | 2865 | NL80211_BSS_SEEN_MS_AGO, |
| 2849 | NL80211_BSS_BEACON_IES, | 2866 | NL80211_BSS_BEACON_IES, |
| 2867 | NL80211_BSS_CHAN_WIDTH, | ||
| 2850 | 2868 | ||
| 2851 | /* keep last */ | 2869 | /* keep last */ |
| 2852 | __NL80211_BSS_AFTER_LAST, | 2870 | __NL80211_BSS_AFTER_LAST, |
