Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010 Broadcom Corporation |
| 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| 13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
Hante Meuleman | bfe8197 | 2014-10-28 14:56:16 +0100 | [diff] [blame^] | 17 | #ifndef BRCMFMAC_CFG80211_H |
| 18 | #define BRCMFMAC_CFG80211_H |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 19 | |
Franky Lin | 83cf17a | 2013-04-11 13:28:50 +0200 | [diff] [blame] | 20 | /* for brcmu_d11inf */ |
| 21 | #include <brcmu_d11.h> |
| 22 | |
Hante Meuleman | f0799895 | 2012-11-05 16:22:13 -0800 | [diff] [blame] | 23 | #define WL_NUM_SCAN_MAX 10 |
| 24 | #define WL_NUM_PMKIDS_MAX MAXPMKID |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 25 | #define WL_TLV_INFO_MAX 1024 |
| 26 | #define WL_BSS_INFO_MAX 2048 |
Hante Meuleman | f0799895 | 2012-11-05 16:22:13 -0800 | [diff] [blame] | 27 | #define WL_ASSOC_INFO_MAX 512 /* assoc related fil max buf */ |
| 28 | #define WL_EXTRA_BUF_MAX 2048 |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 29 | #define WL_ROAM_TRIGGER_LEVEL -75 |
| 30 | #define WL_ROAM_DELTA 20 |
| 31 | #define WL_BEACON_TIMEOUT 3 |
| 32 | |
| 33 | #define WL_SCAN_CHANNEL_TIME 40 |
| 34 | #define WL_SCAN_UNASSOC_TIME 40 |
| 35 | #define WL_SCAN_PASSIVE_TIME 120 |
| 36 | |
Hante Meuleman | e756af5 | 2012-09-11 21:18:52 +0200 | [diff] [blame] | 37 | #define WL_ESCAN_BUF_SIZE (1024 * 64) |
Hante Meuleman | ef8596e | 2014-09-30 10:23:13 +0200 | [diff] [blame] | 38 | #define WL_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */ |
Hante Meuleman | e756af5 | 2012-09-11 21:18:52 +0200 | [diff] [blame] | 39 | |
| 40 | #define WL_ESCAN_ACTION_START 1 |
| 41 | #define WL_ESCAN_ACTION_CONTINUE 2 |
| 42 | #define WL_ESCAN_ACTION_ABORT 3 |
| 43 | |
Hante Meuleman | f09d0c0 | 2012-09-27 14:17:48 +0200 | [diff] [blame] | 44 | #define WL_AUTH_SHARED_KEY 1 /* d11 shared authentication */ |
Hante Meuleman | 1a87334 | 2012-09-27 14:17:54 +0200 | [diff] [blame] | 45 | #define IE_MAX_LEN 512 |
Hante Meuleman | f09d0c0 | 2012-09-27 14:17:48 +0200 | [diff] [blame] | 46 | |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 47 | /* IE TLV processing */ |
| 48 | #define TLV_LEN_OFF 1 /* length offset */ |
| 49 | #define TLV_HDR_LEN 2 /* header length */ |
| 50 | #define TLV_BODY_OFF 2 /* body offset */ |
| 51 | #define TLV_OUI_LEN 3 /* oui id length */ |
| 52 | |
| 53 | /* 802.11 Mgmt Packet flags */ |
| 54 | #define BRCMF_VNDR_IE_BEACON_FLAG 0x1 |
| 55 | #define BRCMF_VNDR_IE_PRBRSP_FLAG 0x2 |
| 56 | #define BRCMF_VNDR_IE_ASSOCRSP_FLAG 0x4 |
| 57 | #define BRCMF_VNDR_IE_AUTHRSP_FLAG 0x8 |
| 58 | #define BRCMF_VNDR_IE_PRBREQ_FLAG 0x10 |
| 59 | #define BRCMF_VNDR_IE_ASSOCREQ_FLAG 0x20 |
| 60 | /* vendor IE in IW advertisement protocol ID field */ |
| 61 | #define BRCMF_VNDR_IE_IWAPID_FLAG 0x40 |
| 62 | /* allow custom IE id */ |
| 63 | #define BRCMF_VNDR_IE_CUSTOM_FLAG 0x100 |
| 64 | |
| 65 | /* P2P Action Frames flags (spec ordered) */ |
| 66 | #define BRCMF_VNDR_IE_GONREQ_FLAG 0x001000 |
| 67 | #define BRCMF_VNDR_IE_GONRSP_FLAG 0x002000 |
| 68 | #define BRCMF_VNDR_IE_GONCFM_FLAG 0x004000 |
| 69 | #define BRCMF_VNDR_IE_INVREQ_FLAG 0x008000 |
| 70 | #define BRCMF_VNDR_IE_INVRSP_FLAG 0x010000 |
| 71 | #define BRCMF_VNDR_IE_DISREQ_FLAG 0x020000 |
| 72 | #define BRCMF_VNDR_IE_DISRSP_FLAG 0x040000 |
| 73 | #define BRCMF_VNDR_IE_PRDREQ_FLAG 0x080000 |
| 74 | #define BRCMF_VNDR_IE_PRDRSP_FLAG 0x100000 |
| 75 | |
| 76 | #define BRCMF_VNDR_IE_P2PAF_SHIFT 12 |
| 77 | |
| 78 | |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 79 | /** |
Arend van Spriel | 1687eee | 2013-04-23 12:53:11 +0200 | [diff] [blame] | 80 | * enum brcmf_scan_status - scan engine status |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 81 | * |
| 82 | * @BRCMF_SCAN_STATUS_BUSY: scanning in progress on dongle. |
| 83 | * @BRCMF_SCAN_STATUS_ABORT: scan being aborted on dongle. |
Arend van Spriel | 1687eee | 2013-04-23 12:53:11 +0200 | [diff] [blame] | 84 | * @BRCMF_SCAN_STATUS_SUPPRESS: scanning is suppressed in driver. |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 85 | */ |
| 86 | enum brcmf_scan_status { |
| 87 | BRCMF_SCAN_STATUS_BUSY, |
| 88 | BRCMF_SCAN_STATUS_ABORT, |
Arend van Spriel | 1687eee | 2013-04-23 12:53:11 +0200 | [diff] [blame] | 89 | BRCMF_SCAN_STATUS_SUPPRESS, |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 90 | }; |
| 91 | |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 92 | /* dongle configuration */ |
| 93 | struct brcmf_cfg80211_conf { |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 94 | u32 frag_threshold; |
| 95 | u32 rts_threshold; |
| 96 | u32 retry_short; |
| 97 | u32 retry_long; |
| 98 | s32 tx_power; |
| 99 | struct ieee80211_channel channel; |
| 100 | }; |
| 101 | |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 102 | /* basic structure of scan request */ |
| 103 | struct brcmf_cfg80211_scan_req { |
| 104 | struct brcmf_ssid_le ssid_le; |
| 105 | }; |
| 106 | |
| 107 | /* basic structure of information element */ |
| 108 | struct brcmf_cfg80211_ie { |
| 109 | u16 offset; |
| 110 | u8 buf[WL_TLV_INFO_MAX]; |
| 111 | }; |
| 112 | |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 113 | /* security information with currently associated ap */ |
| 114 | struct brcmf_cfg80211_security { |
| 115 | u32 wpa_versions; |
| 116 | u32 auth_type; |
| 117 | u32 cipher_pairwise; |
| 118 | u32 cipher_group; |
| 119 | u32 wpa_auth; |
| 120 | }; |
| 121 | |
Arend van Spriel | 3bc0a96 | 2012-10-22 13:55:35 -0700 | [diff] [blame] | 122 | /** |
| 123 | * struct brcmf_cfg80211_profile - profile information. |
| 124 | * |
| 125 | * @ssid: ssid of associated/associating ap. |
| 126 | * @bssid: bssid of joined/joining ibss. |
| 127 | * @sec: security information. |
| 128 | */ |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 129 | struct brcmf_cfg80211_profile { |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 130 | struct brcmf_ssid ssid; |
| 131 | u8 bssid[ETH_ALEN]; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 132 | struct brcmf_cfg80211_security sec; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 133 | }; |
| 134 | |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 135 | /** |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 136 | * enum brcmf_vif_status - bit indices for vif status. |
| 137 | * |
| 138 | * @BRCMF_VIF_STATUS_READY: ready for operation. |
| 139 | * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress. |
| 140 | * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully. |
Arend van Spriel | 5f4f9f1 | 2013-02-08 15:53:41 +0100 | [diff] [blame] | 141 | * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress. |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 142 | * @BRCMF_VIF_STATUS_AP_CREATING: interface configured for AP operation. |
| 143 | * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started. |
| 144 | */ |
| 145 | enum brcmf_vif_status { |
| 146 | BRCMF_VIF_STATUS_READY, |
| 147 | BRCMF_VIF_STATUS_CONNECTING, |
| 148 | BRCMF_VIF_STATUS_CONNECTED, |
Arend van Spriel | 5f4f9f1 | 2013-02-08 15:53:41 +0100 | [diff] [blame] | 149 | BRCMF_VIF_STATUS_DISCONNECTING, |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 150 | BRCMF_VIF_STATUS_AP_CREATING, |
| 151 | BRCMF_VIF_STATUS_AP_CREATED |
| 152 | }; |
| 153 | |
| 154 | /** |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 155 | * struct vif_saved_ie - holds saved IEs for a virtual interface. |
| 156 | * |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 157 | * @probe_req_ie: IE info for probe request. |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 158 | * @probe_res_ie: IE info for probe response. |
| 159 | * @beacon_ie: IE info for beacon frame. |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 160 | * @probe_req_ie_len: IE info length for probe request. |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 161 | * @probe_res_ie_len: IE info length for probe response. |
| 162 | * @beacon_ie_len: IE info length for beacon frame. |
| 163 | */ |
| 164 | struct vif_saved_ie { |
Hante Meuleman | dae3a27 | 2013-02-08 15:54:00 +0100 | [diff] [blame] | 165 | u8 probe_req_ie[IE_MAX_LEN]; |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 166 | u8 probe_res_ie[IE_MAX_LEN]; |
| 167 | u8 beacon_ie[IE_MAX_LEN]; |
Hante Meuleman | 89286dc | 2013-02-08 15:53:46 +0100 | [diff] [blame] | 168 | u8 assoc_req_ie[IE_MAX_LEN]; |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 169 | u32 probe_req_ie_len; |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 170 | u32 probe_res_ie_len; |
| 171 | u32 beacon_ie_len; |
Hante Meuleman | 89286dc | 2013-02-08 15:53:46 +0100 | [diff] [blame] | 172 | u32 assoc_req_ie_len; |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 173 | }; |
| 174 | |
| 175 | /** |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 176 | * struct brcmf_cfg80211_vif - virtual interface specific information. |
| 177 | * |
| 178 | * @ifp: lower layer interface pointer |
| 179 | * @wdev: wireless device. |
Arend van Spriel | 6ac4f4e | 2012-10-22 13:55:31 -0700 | [diff] [blame] | 180 | * @profile: profile information. |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 181 | * @roam_off: roaming state. |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 182 | * @sme_state: SME state using enum brcmf_vif_status bits. |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 183 | * @pm_block: power-management blocked. |
| 184 | * @list: linked list. |
Hante Meuleman | 0de8aac | 2013-02-08 15:53:38 +0100 | [diff] [blame] | 185 | * @mgmt_rx_reg: registered rx mgmt frame types. |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 186 | */ |
| 187 | struct brcmf_cfg80211_vif { |
| 188 | struct brcmf_if *ifp; |
| 189 | struct wireless_dev wdev; |
Arend van Spriel | 6ac4f4e | 2012-10-22 13:55:31 -0700 | [diff] [blame] | 190 | struct brcmf_cfg80211_profile profile; |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 191 | s32 roam_off; |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 192 | unsigned long sme_state; |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 193 | bool pm_block; |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 194 | struct vif_saved_ie saved_ie; |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 195 | struct list_head list; |
Hante Meuleman | 0de8aac | 2013-02-08 15:53:38 +0100 | [diff] [blame] | 196 | u16 mgmt_rx_reg; |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 197 | }; |
| 198 | |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 199 | /* association inform */ |
| 200 | struct brcmf_cfg80211_connect_info { |
| 201 | u8 *req_ie; |
| 202 | s32 req_ie_len; |
| 203 | u8 *resp_ie; |
| 204 | s32 resp_ie_len; |
| 205 | }; |
| 206 | |
| 207 | /* assoc ie length */ |
Arend van Spriel | c4e382d | 2011-10-12 20:51:21 +0200 | [diff] [blame] | 208 | struct brcmf_cfg80211_assoc_ielen_le { |
| 209 | __le32 req_len; |
| 210 | __le32 resp_len; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 211 | }; |
| 212 | |
| 213 | /* wpa2 pmk list */ |
| 214 | struct brcmf_cfg80211_pmk_list { |
| 215 | struct pmkid_list pmkids; |
| 216 | struct pmkid foo[MAXPMKID - 1]; |
| 217 | }; |
| 218 | |
Hante Meuleman | e756af5 | 2012-09-11 21:18:52 +0200 | [diff] [blame] | 219 | /* dongle escan state */ |
| 220 | enum wl_escan_state { |
| 221 | WL_ESCAN_STATE_IDLE, |
| 222 | WL_ESCAN_STATE_SCANNING |
| 223 | }; |
| 224 | |
| 225 | struct escan_info { |
| 226 | u32 escan_state; |
| 227 | u8 escan_buf[WL_ESCAN_BUF_SIZE]; |
| 228 | struct wiphy *wiphy; |
Arend van Spriel | a0f472a | 2013-04-05 10:57:49 +0200 | [diff] [blame] | 229 | struct brcmf_if *ifp; |
| 230 | s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 231 | struct cfg80211_scan_request *request, u16 action); |
Hante Meuleman | e756af5 | 2012-09-11 21:18:52 +0200 | [diff] [blame] | 232 | }; |
| 233 | |
Arend van Spriel | e580607 | 2012-09-19 22:21:08 +0200 | [diff] [blame] | 234 | /** |
| 235 | * struct brcmf_pno_param_le - PNO scan configuration parameters |
| 236 | * |
| 237 | * @version: PNO parameters version. |
| 238 | * @scan_freq: scan frequency. |
| 239 | * @lost_network_timeout: #sec. to declare discovered network as lost. |
| 240 | * @flags: Bit field to control features of PFN such as sort criteria auto |
| 241 | * enable switch and background scan. |
| 242 | * @rssi_margin: Margin to avoid jitter for choosing a PFN based on RSSI sort |
| 243 | * criteria. |
| 244 | * @bestn: number of best networks in each scan. |
| 245 | * @mscan: number of scans recorded. |
| 246 | * @repeat: minimum number of scan intervals before scan frequency changes |
| 247 | * in adaptive scan. |
| 248 | * @exp: exponent of 2 for maximum scan interval. |
| 249 | * @slow_freq: slow scan period. |
| 250 | */ |
| 251 | struct brcmf_pno_param_le { |
| 252 | __le32 version; |
| 253 | __le32 scan_freq; |
| 254 | __le32 lost_network_timeout; |
| 255 | __le16 flags; |
| 256 | __le16 rssi_margin; |
| 257 | u8 bestn; |
| 258 | u8 mscan; |
| 259 | u8 repeat; |
| 260 | u8 exp; |
| 261 | __le32 slow_freq; |
| 262 | }; |
| 263 | |
| 264 | /** |
| 265 | * struct brcmf_pno_net_param_le - scan parameters per preferred network. |
| 266 | * |
| 267 | * @ssid: ssid name and its length. |
| 268 | * @flags: bit2: hidden. |
| 269 | * @infra: BSS vs IBSS. |
| 270 | * @auth: Open vs Closed. |
| 271 | * @wpa_auth: WPA type. |
| 272 | * @wsec: wsec value. |
| 273 | */ |
| 274 | struct brcmf_pno_net_param_le { |
| 275 | struct brcmf_ssid_le ssid; |
| 276 | __le32 flags; |
| 277 | __le32 infra; |
| 278 | __le32 auth; |
| 279 | __le32 wpa_auth; |
| 280 | __le32 wsec; |
| 281 | }; |
| 282 | |
| 283 | /** |
| 284 | * struct brcmf_pno_net_info_le - information per found network. |
| 285 | * |
| 286 | * @bssid: BSS network identifier. |
| 287 | * @channel: channel number only. |
| 288 | * @SSID_len: length of ssid. |
| 289 | * @SSID: ssid characters. |
| 290 | * @RSSI: receive signal strength (in dBm). |
| 291 | * @timestamp: age in seconds. |
| 292 | */ |
| 293 | struct brcmf_pno_net_info_le { |
| 294 | u8 bssid[ETH_ALEN]; |
| 295 | u8 channel; |
| 296 | u8 SSID_len; |
| 297 | u8 SSID[32]; |
| 298 | __le16 RSSI; |
| 299 | __le16 timestamp; |
| 300 | }; |
| 301 | |
| 302 | /** |
| 303 | * struct brcmf_pno_scanresults_le - result returned in PNO NET FOUND event. |
| 304 | * |
| 305 | * @version: PNO version identifier. |
| 306 | * @status: indicates completion status of PNO scan. |
| 307 | * @count: amount of brcmf_pno_net_info_le entries appended. |
| 308 | */ |
| 309 | struct brcmf_pno_scanresults_le { |
| 310 | __le32 version; |
| 311 | __le32 status; |
| 312 | __le32 count; |
| 313 | }; |
| 314 | |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 315 | /** |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 316 | * struct brcmf_cfg80211_vif_event - virtual interface event information. |
| 317 | * |
| 318 | * @vif_wq: waitqueue awaiting interface event from firmware. |
| 319 | * @vif_event_lock: protects other members in this structure. |
| 320 | * @vif_complete: completion for net attach. |
| 321 | * @action: either add, change, or delete. |
| 322 | * @vif: virtual interface object related to the event. |
| 323 | */ |
| 324 | struct brcmf_cfg80211_vif_event { |
| 325 | wait_queue_head_t vif_wq; |
| 326 | struct mutex vif_event_lock; |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 327 | u8 action; |
| 328 | struct brcmf_cfg80211_vif *vif; |
| 329 | }; |
| 330 | |
| 331 | /** |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 332 | * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 333 | * |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 334 | * @wiphy: wiphy object for cfg80211 interface. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 335 | * @conf: dongle configuration. |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 336 | * @p2p: peer-to-peer specific information. |
Piotr Haber | 61730d4 | 2013-04-23 12:53:12 +0200 | [diff] [blame] | 337 | * @btcoex: Bluetooth coexistence information. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 338 | * @scan_request: cfg80211 scan request object. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 339 | * @usr_sync: mainly for dongle up/down synchronization. |
| 340 | * @bss_list: bss_list holding scanned ap information. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 341 | * @scan_req_int: internal scan request object. |
| 342 | * @bss_info: bss information for cfg80211 layer. |
| 343 | * @ie: information element object for internal purpose. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 344 | * @conn_info: association info. |
| 345 | * @pmk_list: wpa2 pmk list. |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 346 | * @scan_status: scan activity on the dongle. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 347 | * @pub: common driver information. |
| 348 | * @channel: current channel. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 349 | * @active_scan: current scan mode. |
| 350 | * @sched_escan: e-scan for scheduled scan support running. |
| 351 | * @ibss_starter: indicates this sta is ibss starter. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 352 | * @pwr_save: indicate whether dongle to support power save mode. |
| 353 | * @dongle_up: indicate whether dongle up or not. |
| 354 | * @roam_on: on/off switch for dongle self-roaming. |
| 355 | * @scan_tried: indicates if first scan attempted. |
| 356 | * @dcmd_buf: dcmd buffer. |
| 357 | * @extra_buf: mainly to grab assoc information. |
| 358 | * @debugfsdir: debugfs folder for this device. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 359 | * @escan_info: escan information. |
| 360 | * @escan_timeout: Timer for catch scan timeout. |
| 361 | * @escan_timeout_work: scan timeout worker. |
| 362 | * @escan_ioctl_buf: dongle command buffer for escan commands. |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 363 | * @vif_list: linked list of vif instances. |
| 364 | * @vif_cnt: number of vif instances. |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 365 | * @vif_event: vif event signalling. |
Hante Meuleman | 4eb3af7 | 2014-09-30 10:23:18 +0200 | [diff] [blame] | 366 | * @wowl_enabled; set during suspend, is wowl used. |
| 367 | * @pre_wowl_pmmode: intermediate storage of pm mode during wowl. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 368 | */ |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 369 | struct brcmf_cfg80211_info { |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 370 | struct wiphy *wiphy; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 371 | struct brcmf_cfg80211_conf *conf; |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 372 | struct brcmf_p2p_info p2p; |
Piotr Haber | 61730d4 | 2013-04-23 12:53:12 +0200 | [diff] [blame] | 373 | struct brcmf_btcoex_info *btcoex; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 374 | struct cfg80211_scan_request *scan_request; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 375 | struct mutex usr_sync; |
Hante Meuleman | f0799895 | 2012-11-05 16:22:13 -0800 | [diff] [blame] | 376 | struct brcmf_cfg80211_scan_req scan_req_int; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 377 | struct wl_cfg80211_bss_info *bss_info; |
| 378 | struct brcmf_cfg80211_ie ie; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 379 | struct brcmf_cfg80211_connect_info conn_info; |
| 380 | struct brcmf_cfg80211_pmk_list *pmk_list; |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 381 | unsigned long scan_status; |
Arend van Spriel | ee92838 | 2012-09-19 22:21:18 +0200 | [diff] [blame] | 382 | struct brcmf_pub *pub; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 383 | u32 channel; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 384 | bool active_scan; |
| 385 | bool sched_escan; |
| 386 | bool ibss_starter; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 387 | bool pwr_save; |
| 388 | bool dongle_up; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 389 | bool scan_tried; |
| 390 | u8 *dcmd_buf; |
| 391 | u8 *extra_buf; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 392 | struct dentry *debugfsdir; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 393 | struct escan_info escan_info; |
| 394 | struct timer_list escan_timeout; |
| 395 | struct work_struct escan_timeout_work; |
Hante Meuleman | e756af5 | 2012-09-11 21:18:52 +0200 | [diff] [blame] | 396 | u8 *escan_ioctl_buf; |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 397 | struct list_head vif_list; |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 398 | struct brcmf_cfg80211_vif_event vif_event; |
Arend van Spriel | 5f4f9f1 | 2013-02-08 15:53:41 +0100 | [diff] [blame] | 399 | struct completion vif_disabled; |
Franky Lin | 83cf17a | 2013-04-11 13:28:50 +0200 | [diff] [blame] | 400 | struct brcmu_d11inf d11inf; |
Hante Meuleman | 4eb3af7 | 2014-09-30 10:23:18 +0200 | [diff] [blame] | 401 | bool wowl_enabled; |
| 402 | u32 pre_wowl_pmmode; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 403 | }; |
| 404 | |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 405 | /** |
| 406 | * struct brcmf_tlv - tag_ID/length/value_buffer tuple. |
| 407 | * |
| 408 | * @id: tag identifier. |
| 409 | * @len: number of bytes in value buffer. |
| 410 | * @data: value buffer. |
| 411 | */ |
| 412 | struct brcmf_tlv { |
| 413 | u8 id; |
| 414 | u8 len; |
| 415 | u8 data[1]; |
| 416 | }; |
| 417 | |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 418 | static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg) |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 419 | { |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 420 | return cfg->wiphy; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 421 | } |
| 422 | |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 423 | static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w) |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 424 | { |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 425 | return (struct brcmf_cfg80211_info *)(wiphy_priv(w)); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 426 | } |
| 427 | |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 428 | static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd) |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 429 | { |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 430 | return (struct brcmf_cfg80211_info *)(wdev_priv(wd)); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 431 | } |
| 432 | |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 433 | static inline |
| 434 | struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg) |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 435 | { |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 436 | struct brcmf_cfg80211_vif *vif; |
| 437 | vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list); |
| 438 | return vif->wdev.netdev; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 439 | } |
| 440 | |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 441 | static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev) |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 442 | { |
| 443 | return wdev_to_cfg(ndev->ieee80211_ptr); |
| 444 | } |
| 445 | |
Arend van Spriel | 6ac4f4e | 2012-10-22 13:55:31 -0700 | [diff] [blame] | 446 | static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd) |
| 447 | { |
| 448 | struct brcmf_if *ifp = netdev_priv(nd); |
| 449 | return &ifp->vif->profile; |
| 450 | } |
| 451 | |
Arend van Spriel | 1332e26 | 2012-11-05 16:22:18 -0800 | [diff] [blame] | 452 | static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev) |
| 453 | { |
| 454 | struct brcmf_if *ifp = netdev_priv(ndev); |
| 455 | return ifp->vif; |
| 456 | } |
| 457 | |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 458 | static inline struct |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 459 | brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg) |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 460 | { |
| 461 | return &cfg->conn_info; |
| 462 | } |
| 463 | |
Arend van Spriel | d9cb259 | 2012-12-05 15:25:54 +0100 | [diff] [blame] | 464 | struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, |
| 465 | struct device *busdev); |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 466 | void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); |
Arend van Spriel | bdf5ff5 | 2012-11-14 18:46:09 -0800 | [diff] [blame] | 467 | s32 brcmf_cfg80211_up(struct net_device *ndev); |
| 468 | s32 brcmf_cfg80211_down(struct net_device *ndev); |
Arend van Spriel | a7965fb | 2013-04-11 17:08:37 +0200 | [diff] [blame] | 469 | enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 470 | |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 471 | struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 472 | enum nl80211_iftype type, |
| 473 | bool pm_block); |
Arend van Spriel | 427dec5 | 2014-01-06 12:40:47 +0100 | [diff] [blame] | 474 | void brcmf_free_vif(struct brcmf_cfg80211_vif *vif); |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 475 | |
| 476 | s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, |
| 477 | const u8 *vndr_ie_buf, u32 vndr_ie_len); |
Arend van Spriel | 5f4f9f1 | 2013-02-08 15:53:41 +0100 | [diff] [blame] | 478 | s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif); |
Johannes Berg | 4b5800f | 2014-01-15 14:55:59 +0100 | [diff] [blame] | 479 | const struct brcmf_tlv * |
| 480 | brcmf_parse_tlvs(const void *buf, int buflen, uint key); |
Franky Lin | 83cf17a | 2013-04-11 13:28:50 +0200 | [diff] [blame] | 481 | u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, |
| 482 | struct ieee80211_channel *ch); |
Hante Meuleman | bfe8197 | 2014-10-28 14:56:16 +0100 | [diff] [blame^] | 483 | bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg, |
| 484 | unsigned long state); |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 485 | void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, |
| 486 | struct brcmf_cfg80211_vif *vif); |
| 487 | bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg); |
| 488 | int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg, |
| 489 | u8 action, ulong timeout); |
Hante Meuleman | 7a5c1f6 | 2013-02-08 15:53:44 +0100 | [diff] [blame] | 490 | s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, |
Arend van Spriel | a0f472a | 2013-04-05 10:57:49 +0200 | [diff] [blame] | 491 | struct brcmf_if *ifp, bool aborted, |
| 492 | bool fw_abort); |
Arend van Spriel | f96aa07 | 2013-04-05 10:57:48 +0200 | [diff] [blame] | 493 | void brcmf_set_mpc(struct brcmf_if *ndev, int mpc); |
Hante Meuleman | 18e2f61 | 2013-02-08 15:53:49 +0100 | [diff] [blame] | 494 | void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg); |
Arend van Spriel | 9df4d54 | 2014-01-06 12:40:49 +0100 | [diff] [blame] | 495 | void brcmf_cfg80211_free_netdev(struct net_device *ndev); |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 496 | |
Hante Meuleman | bfe8197 | 2014-10-28 14:56:16 +0100 | [diff] [blame^] | 497 | #endif /* BRCMFMAC_CFG80211_H */ |