diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/scan.h')
| -rw-r--r-- | drivers/net/wireless/wl12xx/scan.h | 226 |
1 files changed, 226 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/scan.h b/drivers/net/wireless/wl12xx/scan.h new file mode 100644 index 000000000000..a0b6c5d67b07 --- /dev/null +++ b/drivers/net/wireless/wl12xx/scan.h | |||
| @@ -0,0 +1,226 @@ | |||
| 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 | |||
| 29 | int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, | ||
| 30 | struct cfg80211_scan_request *req); | ||
| 31 | int wl1271_scan_build_probe_req(struct wl1271 *wl, | ||
| 32 | const u8 *ssid, size_t ssid_len, | ||
| 33 | const u8 *ie, size_t ie_len, u8 band); | ||
| 34 | void wl1271_scan_stm(struct wl1271 *wl); | ||
| 35 | void wl1271_scan_complete_work(struct work_struct *work); | ||
| 36 | int wl1271_scan_sched_scan_config(struct wl1271 *wl, | ||
| 37 | struct cfg80211_sched_scan_request *req, | ||
| 38 | struct ieee80211_sched_scan_ies *ies); | ||
| 39 | int wl1271_scan_sched_scan_start(struct wl1271 *wl); | ||
| 40 | void wl1271_scan_sched_scan_stop(struct wl1271 *wl); | ||
| 41 | void wl1271_scan_sched_scan_results(struct wl1271 *wl); | ||
| 42 | |||
| 43 | #define WL1271_SCAN_MAX_CHANNELS 24 | ||
| 44 | #define WL1271_SCAN_DEFAULT_TAG 1 | ||
| 45 | #define WL1271_SCAN_CURRENT_TX_PWR 0 | ||
| 46 | #define WL1271_SCAN_OPT_ACTIVE 0 | ||
| 47 | #define WL1271_SCAN_OPT_PASSIVE 1 | ||
| 48 | #define WL1271_SCAN_OPT_PRIORITY_HIGH 4 | ||
| 49 | #define WL1271_SCAN_BAND_2_4_GHZ 0 | ||
| 50 | #define WL1271_SCAN_BAND_5_GHZ 1 | ||
| 51 | |||
| 52 | #define WL1271_SCAN_TIMEOUT 10000 /* msec */ | ||
| 53 | |||
| 54 | enum { | ||
| 55 | WL1271_SCAN_STATE_IDLE, | ||
| 56 | WL1271_SCAN_STATE_2GHZ_ACTIVE, | ||
| 57 | WL1271_SCAN_STATE_2GHZ_PASSIVE, | ||
| 58 | WL1271_SCAN_STATE_5GHZ_ACTIVE, | ||
| 59 | WL1271_SCAN_STATE_5GHZ_PASSIVE, | ||
| 60 | WL1271_SCAN_STATE_DONE | ||
| 61 | }; | ||
| 62 | |||
| 63 | struct basic_scan_params { | ||
| 64 | __le32 rx_config_options; | ||
| 65 | __le32 rx_filter_options; | ||
| 66 | /* Scan option flags (WL1271_SCAN_OPT_*) */ | ||
| 67 | __le16 scan_options; | ||
| 68 | /* Number of scan channels in the list (maximum 30) */ | ||
| 69 | u8 n_ch; | ||
| 70 | /* This field indicates the number of probe requests to send | ||
| 71 | per channel for an active scan */ | ||
| 72 | u8 n_probe_reqs; | ||
| 73 | /* Rate bit field for sending the probes */ | ||
| 74 | __le32 tx_rate; | ||
| 75 | u8 tid_trigger; | ||
| 76 | u8 ssid_len; | ||
| 77 | /* in order to align */ | ||
| 78 | u8 padding1[2]; | ||
| 79 | u8 ssid[IW_ESSID_MAX_SIZE]; | ||
| 80 | /* Band to scan */ | ||
| 81 | u8 band; | ||
| 82 | u8 use_ssid_list; | ||
| 83 | u8 scan_tag; | ||
| 84 | u8 padding2; | ||
| 85 | } __packed; | ||
| 86 | |||
| 87 | struct basic_scan_channel_params { | ||
| 88 | /* Duration in TU to wait for frames on a channel for active scan */ | ||
| 89 | __le32 min_duration; | ||
| 90 | __le32 max_duration; | ||
| 91 | __le32 bssid_lsb; | ||
| 92 | __le16 bssid_msb; | ||
| 93 | u8 early_termination; | ||
| 94 | u8 tx_power_att; | ||
| 95 | u8 channel; | ||
| 96 | /* FW internal use only! */ | ||
| 97 | u8 dfs_candidate; | ||
| 98 | u8 activity_detected; | ||
| 99 | u8 pad; | ||
| 100 | } __packed; | ||
| 101 | |||
| 102 | struct wl1271_cmd_scan { | ||
| 103 | struct wl1271_cmd_header header; | ||
| 104 | |||
| 105 | struct basic_scan_params params; | ||
| 106 | struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS]; | ||
| 107 | } __packed; | ||
| 108 | |||
| 109 | struct wl1271_cmd_trigger_scan_to { | ||
| 110 | struct wl1271_cmd_header header; | ||
| 111 | |||
| 112 | __le32 timeout; | ||
| 113 | } __packed; | ||
| 114 | |||
| 115 | #define MAX_CHANNELS_ALL_BANDS 41 | ||
| 116 | #define SCAN_MAX_CYCLE_INTERVALS 16 | ||
| 117 | #define SCAN_MAX_BANDS 3 | ||
| 118 | |||
| 119 | enum { | ||
| 120 | SCAN_CHANNEL_TYPE_2GHZ_PASSIVE, | ||
| 121 | SCAN_CHANNEL_TYPE_2GHZ_ACTIVE, | ||
| 122 | SCAN_CHANNEL_TYPE_5GHZ_PASSIVE, | ||
| 123 | SCAN_CHANNEL_TYPE_5GHZ_ACTIVE, | ||
| 124 | SCAN_CHANNEL_TYPE_5GHZ_DFS, | ||
| 125 | }; | ||
| 126 | |||
| 127 | enum { | ||
| 128 | SCAN_SSID_FILTER_ANY = 0, | ||
| 129 | SCAN_SSID_FILTER_SPECIFIC = 1, | ||
| 130 | SCAN_SSID_FILTER_LIST = 2, | ||
| 131 | SCAN_SSID_FILTER_DISABLED = 3 | ||
| 132 | }; | ||
| 133 | |||
| 134 | enum { | ||
| 135 | SCAN_BSS_TYPE_INDEPENDENT, | ||
| 136 | SCAN_BSS_TYPE_INFRASTRUCTURE, | ||
| 137 | SCAN_BSS_TYPE_ANY, | ||
| 138 | }; | ||
| 139 | |||
| 140 | #define SCAN_CHANNEL_FLAGS_DFS BIT(0) | ||
| 141 | #define SCAN_CHANNEL_FLAGS_DFS_ENABLED BIT(1) | ||
| 142 | |||
| 143 | struct conn_scan_ch_params { | ||
| 144 | __le16 min_duration; | ||
| 145 | __le16 max_duration; | ||
| 146 | __le16 passive_duration; | ||
| 147 | |||
| 148 | u8 channel; | ||
| 149 | u8 tx_power_att; | ||
| 150 | |||
| 151 | /* bit 0: DFS channel; bit 1: DFS enabled */ | ||
| 152 | u8 flags; | ||
| 153 | |||
| 154 | u8 padding[3]; | ||
| 155 | } __packed; | ||
| 156 | |||
| 157 | struct wl1271_cmd_sched_scan_config { | ||
| 158 | struct wl1271_cmd_header header; | ||
| 159 | |||
| 160 | __le32 intervals[SCAN_MAX_CYCLE_INTERVALS]; | ||
| 161 | |||
| 162 | s8 rssi_threshold; /* for filtering (in dBm) */ | ||
| 163 | s8 snr_threshold; /* for filtering (in dB) */ | ||
| 164 | |||
| 165 | u8 cycles; /* maximum number of scan cycles */ | ||
| 166 | u8 report_after; /* report when this number of results are received */ | ||
| 167 | u8 terminate; /* stop scanning after reporting */ | ||
| 168 | |||
| 169 | u8 tag; | ||
| 170 | u8 bss_type; /* for filtering */ | ||
| 171 | u8 filter_type; | ||
| 172 | |||
| 173 | u8 ssid_len; /* For SCAN_SSID_FILTER_SPECIFIC */ | ||
| 174 | u8 ssid[IW_ESSID_MAX_SIZE]; | ||
| 175 | |||
| 176 | u8 n_probe_reqs; /* Number of probes requests per channel */ | ||
| 177 | |||
| 178 | u8 passive[SCAN_MAX_BANDS]; | ||
| 179 | u8 active[SCAN_MAX_BANDS]; | ||
| 180 | |||
| 181 | u8 dfs; | ||
| 182 | |||
| 183 | u8 padding[3]; | ||
| 184 | |||
| 185 | struct conn_scan_ch_params channels[MAX_CHANNELS_ALL_BANDS]; | ||
| 186 | } __packed; | ||
| 187 | |||
| 188 | |||
| 189 | #define SCHED_SCAN_MAX_SSIDS 8 | ||
| 190 | |||
| 191 | enum { | ||
| 192 | SCAN_SSID_TYPE_PUBLIC = 0, | ||
| 193 | SCAN_SSID_TYPE_HIDDEN = 1, | ||
| 194 | }; | ||
| 195 | |||
| 196 | struct wl1271_ssid { | ||
| 197 | u8 type; | ||
| 198 | u8 len; | ||
| 199 | u8 ssid[IW_ESSID_MAX_SIZE]; | ||
| 200 | /* u8 padding[2]; */ | ||
| 201 | } __packed; | ||
| 202 | |||
| 203 | struct wl1271_cmd_sched_scan_ssid_list { | ||
| 204 | struct wl1271_cmd_header header; | ||
| 205 | |||
| 206 | u8 n_ssids; | ||
| 207 | struct wl1271_ssid ssids[SCHED_SCAN_MAX_SSIDS]; | ||
| 208 | u8 padding[3]; | ||
| 209 | } __packed; | ||
| 210 | |||
| 211 | struct wl1271_cmd_sched_scan_start { | ||
| 212 | struct wl1271_cmd_header header; | ||
| 213 | |||
| 214 | u8 tag; | ||
| 215 | u8 padding[3]; | ||
| 216 | } __packed; | ||
| 217 | |||
| 218 | struct wl1271_cmd_sched_scan_stop { | ||
| 219 | struct wl1271_cmd_header header; | ||
| 220 | |||
| 221 | u8 tag; | ||
| 222 | u8 padding[3]; | ||
| 223 | } __packed; | ||
| 224 | |||
| 225 | |||
| 226 | #endif /* __WL1271_SCAN_H__ */ | ||
