Pull bugzilla-9429 into release branch
[pv_ops_mirror.git] / drivers / net / wireless / libertas / scan.h
blobc29c031bef8cf8a9798ee9bf31e9314e0acc0676
1 /**
2 * Interface for the wlan network scan routines
4 * Driver interface functions and type declarations for the scan module
5 * implemented in wlan_scan.c.
6 */
7 #ifndef _WLAN_SCAN_H
8 #define _WLAN_SCAN_H
10 #include <net/ieee80211.h>
11 #include "hostcmd.h"
13 /**
14 * @brief Maximum number of channels that can be sent in a setuserscan ioctl
16 * @sa wlan_ioctl_user_scan_cfg
18 #define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50
20 //! Infrastructure BSS scan type in wlan_scan_cmd_config
21 #define WLAN_SCAN_BSS_TYPE_BSS 1
23 //! Adhoc BSS scan type in wlan_scan_cmd_config
24 #define WLAN_SCAN_BSS_TYPE_IBSS 2
26 //! Adhoc or Infrastructure BSS scan type in wlan_scan_cmd_config, no filter
27 #define WLAN_SCAN_BSS_TYPE_ANY 3
29 /**
30 * @brief Structure used internally in the wlan driver to configure a scan.
32 * Sent to the command processing module to configure the firmware
33 * scan command prepared by libertas_cmd_80211_scan.
35 * @sa wlan_scan_networks
38 struct wlan_scan_cmd_config {
39 /**
40 * @brief BSS type to be sent in the firmware command
42 * Field can be used to restrict the types of networks returned in the
43 * scan. valid settings are:
45 * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure)
46 * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc)
47 * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
49 u8 bsstype;
51 /**
52 * @brief Specific BSSID used to filter scan results in the firmware
54 u8 bssid[ETH_ALEN];
56 /**
57 * @brief length of TLVs sent in command starting at tlvBuffer
59 int tlvbufferlen;
61 /**
62 * @brief SSID TLV(s) and ChanList TLVs to be sent in the firmware command
64 * @sa TLV_TYPE_CHANLIST, mrvlietypes_chanlistparamset_t
65 * @sa TLV_TYPE_SSID, mrvlietypes_ssidparamset_t
67 u8 tlvbuffer[1]; //!< SSID TLV(s) and ChanList TLVs are stored here
70 /**
71 * @brief IOCTL channel sub-structure sent in wlan_ioctl_user_scan_cfg
73 * Multiple instances of this structure are included in the IOCTL command
74 * to configure a instance of a scan on the specific channel.
76 struct wlan_ioctl_user_scan_chan {
77 u8 channumber; //!< channel Number to scan
78 u8 radiotype; //!< Radio type: 'B/G' band = 0, 'A' band = 1
79 u8 scantype; //!< Scan type: Active = 0, Passive = 1
80 u16 scantime; //!< Scan duration in milliseconds; if 0 default used
83 /**
84 * @brief IOCTL input structure to configure an immediate scan cmd to firmware
86 * Used in the setuserscan (WLAN_SET_USER_SCAN) private ioctl. Specifies
87 * a number of parameters to be used in general for the scan as well
88 * as a channel list (wlan_ioctl_user_scan_chan) for each scan period
89 * desired.
91 * @sa libertas_set_user_scan_ioctl
93 struct wlan_ioctl_user_scan_cfg {
94 /**
95 * @brief BSS type to be sent in the firmware command
97 * Field can be used to restrict the types of networks returned in the
98 * scan. valid settings are:
100 * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure)
101 * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc)
102 * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
104 u8 bsstype;
107 * @brief Configure the number of probe requests for active chan scans
109 u8 numprobes;
112 * @brief BSSID filter sent in the firmware command to limit the results
114 u8 bssid[ETH_ALEN];
116 /* Clear existing scan results matching this BSSID */
117 u8 clear_bssid;
120 * @brief SSID filter sent in the firmware command to limit the results
122 char ssid[IW_ESSID_MAX_SIZE];
123 u8 ssid_len;
125 /* Clear existing scan results matching this SSID */
126 u8 clear_ssid;
129 * @brief Variable number (fixed maximum) of channels to scan up
131 struct wlan_ioctl_user_scan_chan chanlist[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
135 * @brief Structure used to store information for each beacon/probe response
137 struct bss_descriptor {
138 u8 bssid[ETH_ALEN];
140 u8 ssid[IW_ESSID_MAX_SIZE + 1];
141 u8 ssid_len;
143 u16 capability;
145 /* receive signal strength in dBm */
146 long rssi;
148 u32 channel;
150 u16 beaconperiod;
152 u32 atimwindow;
154 /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
155 u8 mode;
157 /* zero-terminated array of supported data rates */
158 u8 rates[MAX_RATES + 1];
160 unsigned long last_scanned;
162 union ieeetypes_phyparamset phyparamset;
163 union IEEEtypes_ssparamset ssparamset;
165 struct ieeetypes_countryinfofullset countryinfo;
167 u8 wpa_ie[MAX_WPA_IE_LEN];
168 size_t wpa_ie_len;
169 u8 rsn_ie[MAX_WPA_IE_LEN];
170 size_t rsn_ie_len;
172 u8 mesh;
174 struct list_head list;
177 int libertas_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
179 struct bss_descriptor * libertas_find_ssid_in_list(wlan_adapter * adapter,
180 u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
181 int channel);
183 struct bss_descriptor * libertas_find_bssid_in_list(wlan_adapter * adapter,
184 u8 * bssid, u8 mode);
186 int libertas_find_best_network_ssid(wlan_private * priv, u8 *out_ssid,
187 u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
189 int libertas_send_specific_ssid_scan(wlan_private * priv, u8 *ssid,
190 u8 ssid_len, u8 clear_ssid);
192 int libertas_cmd_80211_scan(wlan_private * priv,
193 struct cmd_ds_command *cmd,
194 void *pdata_buf);
196 int libertas_ret_80211_scan(wlan_private * priv,
197 struct cmd_ds_command *resp);
199 int wlan_scan_networks(wlan_private * priv,
200 const struct wlan_ioctl_user_scan_cfg * puserscanin,
201 int full_scan);
203 struct ifreq;
205 struct iw_point;
206 struct iw_param;
207 struct iw_request_info;
208 int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
209 struct iw_point *dwrq, char *extra);
210 int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
211 struct iw_param *vwrq, char *extra);
213 void libertas_scan_worker(struct work_struct *work);
215 #endif /* _WLAN_SCAN_H */