aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-02-10 15:25:55 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:45:49 -0500
commit2a5193119269062608582418deba7af82844159a (patch)
tree1f2fe8cffbeb7530dce7fa708310f6fb29ab0dd8 /include
parent849b7967818995a32c3017542e33eb3155944368 (diff)
cfg80211/nl80211: scanning (and mac80211 update to use it)
This patch adds basic scan capability to cfg80211/nl80211 and changes mac80211 to use it. The BSS list that cfg80211 maintains is made driver-accessible with a private area in each BSS struct, but mac80211 doesn't yet use it. That's another large project. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nl80211.h65
-rw-r--r--include/net/cfg80211.h131
-rw-r--r--include/net/mac80211.h6
-rw-r--r--include/net/wireless.h3
4 files changed, 203 insertions, 2 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 4bc27049f4e5..8802d1bda382 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -143,6 +143,13 @@
143 * added to all specified management frames generated by 143 * added to all specified management frames generated by
144 * kernel/firmware/driver. 144 * kernel/firmware/driver.
145 * 145 *
146 * @NL80211_CMD_GET_SCAN: get scan results
147 * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
148 * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
149 * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
150 * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
151 * partial scan results may be available
152 *
146 * @NL80211_CMD_MAX: highest used command number 153 * @NL80211_CMD_MAX: highest used command number
147 * @__NL80211_CMD_AFTER_LAST: internal use 154 * @__NL80211_CMD_AFTER_LAST: internal use
148 */ 155 */
@@ -192,6 +199,11 @@ enum nl80211_commands {
192 199
193 NL80211_CMD_GET_REG, 200 NL80211_CMD_GET_REG,
194 201
202 NL80211_CMD_GET_SCAN,
203 NL80211_CMD_TRIGGER_SCAN,
204 NL80211_CMD_NEW_SCAN_RESULTS,
205 NL80211_CMD_SCAN_ABORTED,
206
195 /* add new commands above here */ 207 /* add new commands above here */
196 208
197 /* used to define NL80211_CMD_MAX below */ 209 /* used to define NL80211_CMD_MAX below */
@@ -305,6 +317,18 @@ enum nl80211_commands {
305 * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with 317 * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with
306 * %NL80211_CMD_SET_MGMT_EXTRA_IE). 318 * %NL80211_CMD_SET_MGMT_EXTRA_IE).
307 * 319 *
320 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
321 * a single scan request, a wiphy attribute.
322 *
323 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
324 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
325 * scanning and include a zero-length SSID (wildcard) for wildcard scan
326 * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
327 * scan result list changes (BSS expired or added) so that applications
328 * can verify that they got a single, consistent snapshot (when all dump
329 * messages carried the same generation number)
330 * @NL80211_ATTR_BSS: scan result BSS
331 *
308 * @NL80211_ATTR_MAX: highest attribute number currently defined 332 * @NL80211_ATTR_MAX: highest attribute number currently defined
309 * @__NL80211_ATTR_AFTER_LAST: internal use 333 * @__NL80211_ATTR_AFTER_LAST: internal use
310 */ 334 */
@@ -372,6 +396,13 @@ enum nl80211_attrs {
372 NL80211_ATTR_MGMT_SUBTYPE, 396 NL80211_ATTR_MGMT_SUBTYPE,
373 NL80211_ATTR_IE, 397 NL80211_ATTR_IE,
374 398
399 NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
400
401 NL80211_ATTR_SCAN_FREQUENCIES,
402 NL80211_ATTR_SCAN_SSIDS,
403 NL80211_ATTR_SCAN_GENERATION,
404 NL80211_ATTR_BSS,
405
375 /* add attributes here, update the policy in nl80211.c */ 406 /* add attributes here, update the policy in nl80211.c */
376 407
377 __NL80211_ATTR_AFTER_LAST, 408 __NL80211_ATTR_AFTER_LAST,
@@ -841,4 +872,38 @@ enum nl80211_channel_type {
841 NL80211_CHAN_HT40MINUS, 872 NL80211_CHAN_HT40MINUS,
842 NL80211_CHAN_HT40PLUS 873 NL80211_CHAN_HT40PLUS
843}; 874};
875
876/**
877 * enum nl80211_bss - netlink attributes for a BSS
878 *
879 * @__NL80211_BSS_INVALID: invalid
880 * @NL80211_BSS_FREQUENCY: frequency in MHz (u32)
881 * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64)
882 * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16)
883 * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16)
884 * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the
885 * raw information elements from the probe response/beacon (bin)
886 * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon
887 * in mBm (100 * dBm) (s32)
888 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
889 * in unspecified units, scaled to 0..100 (u8)
890 * @__NL80211_BSS_AFTER_LAST: internal
891 * @NL80211_BSS_MAX: highest BSS attribute
892 */
893enum nl80211_bss {
894 __NL80211_BSS_INVALID,
895 NL80211_BSS_BSSID,
896 NL80211_BSS_FREQUENCY,
897 NL80211_BSS_TSF,
898 NL80211_BSS_BEACON_INTERVAL,
899 NL80211_BSS_CAPABILITY,
900 NL80211_BSS_INFORMATION_ELEMENTS,
901 NL80211_BSS_SIGNAL_MBM,
902 NL80211_BSS_SIGNAL_UNSPEC,
903
904 /* keep last */
905 __NL80211_BSS_AFTER_LAST,
906 NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1
907};
908
844#endif /* __LINUX_NL80211_H */ 909#endif /* __LINUX_NL80211_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index dd1fd51638fc..09a0b268e5cf 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4,6 +4,10 @@
4#include <linux/netlink.h> 4#include <linux/netlink.h>
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6#include <linux/nl80211.h> 6#include <linux/nl80211.h>
7#include <linux/if_ether.h>
8#include <linux/ieee80211.h>
9#include <linux/wireless.h>
10#include <net/iw_handler.h>
7#include <net/genetlink.h> 11#include <net/genetlink.h>
8/* remove once we remove the wext stuff */ 12/* remove once we remove the wext stuff */
9#include <net/iw_handler.h> 13#include <net/iw_handler.h>
@@ -505,6 +509,83 @@ struct wiphy;
505struct ieee80211_channel; 509struct ieee80211_channel;
506 510
507/** 511/**
512 * struct cfg80211_ssid - SSID description
513 * @ssid: the SSID
514 * @ssid_len: length of the ssid
515 */
516struct cfg80211_ssid {
517 u8 ssid[IEEE80211_MAX_SSID_LEN];
518 u8 ssid_len;
519};
520
521/**
522 * struct cfg80211_scan_request - scan request description
523 *
524 * @ssids: SSIDs to scan for (active scan only)
525 * @n_ssids: number of SSIDs
526 * @channels: channels to scan on.
527 * @n_channels: number of channels for each band
528 * @wiphy: the wiphy this was for
529 * @ifidx: the interface index
530 */
531struct cfg80211_scan_request {
532 struct cfg80211_ssid *ssids;
533 int n_ssids;
534 struct ieee80211_channel **channels;
535 u32 n_channels;
536
537 /* internal */
538 struct wiphy *wiphy;
539 int ifidx;
540};
541
542/**
543 * enum cfg80211_signal_type - signal type
544 *
545 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
546 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
547 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
548 */
549enum cfg80211_signal_type {
550 CFG80211_SIGNAL_TYPE_NONE,
551 CFG80211_SIGNAL_TYPE_MBM,
552 CFG80211_SIGNAL_TYPE_UNSPEC,
553};
554
555/**
556 * struct cfg80211_bss - BSS description
557 *
558 * This structure describes a BSS (which may also be a mesh network)
559 * for use in scan results and similar.
560 *
561 * @bssid: BSSID of the BSS
562 * @tsf: timestamp of last received update
563 * @beacon_interval: the beacon interval as from the frame
564 * @capability: the capability field in host byte order
565 * @information_elements: the information elements (Note that there
566 * is no guarantee that these are well-formed!)
567 * @len_information_elements: total length of the information elements
568 * @signal: signal strength value
569 * @signal_type: signal type
570 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
571 */
572struct cfg80211_bss {
573 struct ieee80211_channel *channel;
574
575 u8 bssid[ETH_ALEN];
576 u64 tsf;
577 u16 beacon_interval;
578 u16 capability;
579 u8 *information_elements;
580 size_t len_information_elements;
581
582 s32 signal;
583 enum cfg80211_signal_type signal_type;
584
585 u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
586};
587
588/**
508 * struct cfg80211_ops - backend description for wireless configuration 589 * struct cfg80211_ops - backend description for wireless configuration
509 * 590 *
510 * This struct is registered by fullmac card drivers and/or wireless stacks 591 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -571,6 +652,11 @@ struct ieee80211_channel;
571 * @set_channel: Set channel 652 * @set_channel: Set channel
572 * 653 *
573 * @set_mgmt_extra_ie: Set extra IE data for management frames 654 * @set_mgmt_extra_ie: Set extra IE data for management frames
655 *
656 * @scan: Request to do a scan. If returning zero, the scan request is given
657 * the driver, and will be valid until passed to cfg80211_scan_done().
658 * For scan results, call cfg80211_inform_bss(); you can call this outside
659 * the scan/scan_done bracket too.
574 */ 660 */
575struct cfg80211_ops { 661struct cfg80211_ops {
576 int (*suspend)(struct wiphy *wiphy); 662 int (*suspend)(struct wiphy *wiphy);
@@ -648,6 +734,9 @@ struct cfg80211_ops {
648 int (*set_mgmt_extra_ie)(struct wiphy *wiphy, 734 int (*set_mgmt_extra_ie)(struct wiphy *wiphy,
649 struct net_device *dev, 735 struct net_device *dev,
650 struct mgmt_extra_ie_params *params); 736 struct mgmt_extra_ie_params *params);
737
738 int (*scan)(struct wiphy *wiphy, struct net_device *dev,
739 struct cfg80211_scan_request *request);
651}; 740};
652 741
653/* temporary wext handlers */ 742/* temporary wext handlers */
@@ -658,5 +747,47 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
658 u32 *mode, char *extra); 747 u32 *mode, char *extra);
659int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 748int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
660 u32 *mode, char *extra); 749 u32 *mode, char *extra);
750int cfg80211_wext_siwscan(struct net_device *dev,
751 struct iw_request_info *info,
752 union iwreq_data *wrqu, char *extra);
753int cfg80211_wext_giwscan(struct net_device *dev,
754 struct iw_request_info *info,
755 struct iw_point *data, char *extra);
756
757/**
758 * cfg80211_scan_done - notify that scan finished
759 *
760 * @request: the corresponding scan request
761 * @aborted: set to true if the scan was aborted for any reason,
762 * userspace will be notified of that
763 */
764void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
765
766/**
767 * cfg80211_inform_bss - inform cfg80211 of a new BSS
768 *
769 * @wiphy: the wiphy reporting the BSS
770 * @bss: the found BSS
771 * @gfp: context flags
772 *
773 * This informs cfg80211 that BSS information was found and
774 * the BSS should be updated/added.
775 */
776struct cfg80211_bss*
777cfg80211_inform_bss_frame(struct wiphy *wiphy,
778 struct ieee80211_channel *channel,
779 struct ieee80211_mgmt *mgmt, size_t len,
780 s32 signal, enum cfg80211_signal_type sigtype,
781 gfp_t gfp);
782
783struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
784 struct ieee80211_channel *channel,
785 const u8 *bssid,
786 const u8 *ssid, size_t ssid_len);
787struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
788 struct ieee80211_channel *channel,
789 const u8 *meshid, size_t meshidlen,
790 const u8 *meshcfg);
791void cfg80211_put_bss(struct cfg80211_bss *bss);
661 792
662#endif /* __NET_CFG80211_H */ 793#endif /* __NET_CFG80211_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 341f3e595ebd..88fa3e03e3e9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1406,7 +1406,8 @@ struct ieee80211_ops {
1406 void (*update_tkip_key)(struct ieee80211_hw *hw, 1406 void (*update_tkip_key)(struct ieee80211_hw *hw,
1407 struct ieee80211_key_conf *conf, const u8 *address, 1407 struct ieee80211_key_conf *conf, const u8 *address,
1408 u32 iv32, u16 *phase1key); 1408 u32 iv32, u16 *phase1key);
1409 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); 1409 int (*hw_scan)(struct ieee80211_hw *hw,
1410 struct cfg80211_scan_request *req);
1410 int (*get_stats)(struct ieee80211_hw *hw, 1411 int (*get_stats)(struct ieee80211_hw *hw,
1411 struct ieee80211_low_level_stats *stats); 1412 struct ieee80211_low_level_stats *stats);
1412 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1413 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
@@ -1844,8 +1845,9 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
1844 * mac80211 that the scan finished. 1845 * mac80211 that the scan finished.
1845 * 1846 *
1846 * @hw: the hardware that finished the scan 1847 * @hw: the hardware that finished the scan
1848 * @aborted: set to true if scan was aborted
1847 */ 1849 */
1848void ieee80211_scan_completed(struct ieee80211_hw *hw); 1850void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
1849 1851
1850/** 1852/**
1851 * ieee80211_iterate_active_interfaces - iterate active interfaces 1853 * ieee80211_iterate_active_interfaces - iterate active interfaces
diff --git a/include/net/wireless.h b/include/net/wireless.h
index a42c1562d52b..1c6285eb1666 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -213,6 +213,9 @@ struct wiphy {
213 bool custom_regulatory; 213 bool custom_regulatory;
214 bool strict_regulatory; 214 bool strict_regulatory;
215 215
216 int bss_priv_size;
217 u8 max_scan_ssids;
218
216 /* If multiple wiphys are registered and you're handed e.g. 219 /* If multiple wiphys are registered and you're handed e.g.
217 * a regular netdev with assigned ieee80211_ptr, you won't 220 * a regular netdev with assigned ieee80211_ptr, you won't
218 * know whether it points to a wiphy your driver has registered 221 * know whether it points to a wiphy your driver has registered