/drivers/net/wireless/wl12xx/scan.h
C Header | 224 lines | 147 code | 44 blank | 33 comment | 0 complexity | 3c517b10f22c28611f93136907449b85 MD5 | raw file
Possible License(s): LGPL-2.0, AGPL-1.0, GPL-2.0
1/* 2 * This file is part of wl1271 3 * 4 * Copyright (C) 2009-2010 Nokia Corporation 5 * 6 * Contact: Luciano Coelho <luciano.coelho@nokia.com> 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * version 2 as published by the Free Software Foundation. 11 * 12 * This program is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 * 02110-1301 USA 21 * 22 */ 23 24#ifndef __SCAN_H__ 25#define __SCAN_H__ 26 27#include "wl12xx.h" 28 29int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, 30 struct cfg80211_scan_request *req); 31int wl1271_scan_stop(struct wl1271 *wl); 32int wl1271_scan_build_probe_req(struct wl1271 *wl, 33 const u8 *ssid, size_t ssid_len, 34 const u8 *ie, size_t ie_len, u8 band); 35void wl1271_scan_stm(struct wl1271 *wl); 36void wl1271_scan_complete_work(struct work_struct *work); 37int wl1271_scan_sched_scan_config(struct wl1271 *wl, 38 struct cfg80211_sched_scan_request *req, 39 struct ieee80211_sched_scan_ies *ies); 40int wl1271_scan_sched_scan_start(struct wl1271 *wl); 41void wl1271_scan_sched_scan_stop(struct wl1271 *wl); 42void wl1271_scan_sched_scan_results(struct wl1271 *wl); 43 44#define WL1271_SCAN_MAX_CHANNELS 24 45#define WL1271_SCAN_DEFAULT_TAG 1 46#define WL1271_SCAN_CURRENT_TX_PWR 0 47#define WL1271_SCAN_OPT_ACTIVE 0 48#define WL1271_SCAN_OPT_PASSIVE 1 49#define WL1271_SCAN_OPT_PRIORITY_HIGH 4 50#define WL1271_SCAN_BAND_2_4_GHZ 0 51#define WL1271_SCAN_BAND_5_GHZ 1 52 53#define WL1271_SCAN_TIMEOUT 10000 /* msec */ 54 55enum { 56 WL1271_SCAN_STATE_IDLE, 57 WL1271_SCAN_STATE_2GHZ_ACTIVE, 58 WL1271_SCAN_STATE_2GHZ_PASSIVE, 59 WL1271_SCAN_STATE_5GHZ_ACTIVE, 60 WL1271_SCAN_STATE_5GHZ_PASSIVE, 61 WL1271_SCAN_STATE_DONE 62}; 63 64struct basic_scan_params { 65 __le32 rx_config_options; 66 __le32 rx_filter_options; 67 /* Scan option flags (WL1271_SCAN_OPT_*) */ 68 __le16 scan_options; 69 /* Number of scan channels in the list (maximum 30) */ 70 u8 n_ch; 71 /* This field indicates the number of probe requests to send 72 per channel for an active scan */ 73 u8 n_probe_reqs; 74 /* Rate bit field for sending the probes */ 75 __le32 tx_rate; 76 u8 tid_trigger; 77 u8 ssid_len; 78 /* in order to align */ 79 u8 padding1[2]; 80 u8 ssid[IW_ESSID_MAX_SIZE]; 81 /* Band to scan */ 82 u8 band; 83 u8 use_ssid_list; 84 u8 scan_tag; 85 u8 padding2; 86} __packed; 87 88struct basic_scan_channel_params { 89 /* Duration in TU to wait for frames on a channel for active scan */ 90 __le32 min_duration; 91 __le32 max_duration; 92 __le32 bssid_lsb; 93 __le16 bssid_msb; 94 u8 early_termination; 95 u8 tx_power_att; 96 u8 channel; 97 /* FW internal use only! */ 98 u8 dfs_candidate; 99 u8 activity_detected; 100 u8 pad; 101} __packed; 102 103struct wl1271_cmd_scan { 104 struct wl1271_cmd_header header; 105 106 struct basic_scan_params params; 107 struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS]; 108} __packed; 109 110struct wl1271_cmd_trigger_scan_to { 111 struct wl1271_cmd_header header; 112 113 __le32 timeout; 114} __packed; 115 116#define MAX_CHANNELS_2GHZ 14 117#define MAX_CHANNELS_5GHZ 23 118#define MAX_CHANNELS_4GHZ 4 119 120#define SCAN_MAX_CYCLE_INTERVALS 16 121#define SCAN_MAX_BANDS 3 122 123enum { 124 SCAN_SSID_FILTER_ANY = 0, 125 SCAN_SSID_FILTER_SPECIFIC = 1, 126 SCAN_SSID_FILTER_LIST = 2, 127 SCAN_SSID_FILTER_DISABLED = 3 128}; 129 130enum { 131 SCAN_BSS_TYPE_INDEPENDENT, 132 SCAN_BSS_TYPE_INFRASTRUCTURE, 133 SCAN_BSS_TYPE_ANY, 134}; 135 136#define SCAN_CHANNEL_FLAGS_DFS BIT(0) 137#define SCAN_CHANNEL_FLAGS_DFS_ENABLED BIT(1) 138 139struct conn_scan_ch_params { 140 __le16 min_duration; 141 __le16 max_duration; 142 __le16 passive_duration; 143 144 u8 channel; 145 u8 tx_power_att; 146 147 /* bit 0: DFS channel; bit 1: DFS enabled */ 148 u8 flags; 149 150 u8 padding[3]; 151} __packed; 152 153struct wl1271_cmd_sched_scan_config { 154 struct wl1271_cmd_header header; 155 156 __le32 intervals[SCAN_MAX_CYCLE_INTERVALS]; 157 158 s8 rssi_threshold; /* for filtering (in dBm) */ 159 s8 snr_threshold; /* for filtering (in dB) */ 160 161 u8 cycles; /* maximum number of scan cycles */ 162 u8 report_after; /* report when this number of results are received */ 163 u8 terminate; /* stop scanning after reporting */ 164 165 u8 tag; 166 u8 bss_type; /* for filtering */ 167 u8 filter_type; 168 169 u8 ssid_len; /* For SCAN_SSID_FILTER_SPECIFIC */ 170 u8 ssid[IW_ESSID_MAX_SIZE]; 171 172 u8 n_probe_reqs; /* Number of probes requests per channel */ 173 174 u8 passive[SCAN_MAX_BANDS]; 175 u8 active[SCAN_MAX_BANDS]; 176 177 u8 dfs; 178 179 u8 padding[3]; 180 181 struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ]; 182 struct conn_scan_ch_params channels_5[MAX_CHANNELS_5GHZ]; 183 struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ]; 184} __packed; 185 186 187#define SCHED_SCAN_MAX_SSIDS 8 188 189enum { 190 SCAN_SSID_TYPE_PUBLIC = 0, 191 SCAN_SSID_TYPE_HIDDEN = 1, 192}; 193 194struct wl1271_ssid { 195 u8 type; 196 u8 len; 197 u8 ssid[IW_ESSID_MAX_SIZE]; 198 /* u8 padding[2]; */ 199} __packed; 200 201struct wl1271_cmd_sched_scan_ssid_list { 202 struct wl1271_cmd_header header; 203 204 u8 n_ssids; 205 struct wl1271_ssid ssids[SCHED_SCAN_MAX_SSIDS]; 206 u8 padding[3]; 207} __packed; 208 209struct wl1271_cmd_sched_scan_start { 210 struct wl1271_cmd_header header; 211 212 u8 tag; 213 u8 padding[3]; 214} __packed; 215 216struct wl1271_cmd_sched_scan_stop { 217 struct wl1271_cmd_header header; 218 219 u8 tag; 220 u8 padding[3]; 221} __packed; 222 223 224#endif /* __WL1271_SCAN_H__ */