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 |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 24 | #define WL_TLV_INFO_MAX 1024 |
| 25 | #define WL_BSS_INFO_MAX 2048 |
Hante Meuleman | f0799895 | 2012-11-05 16:22:13 -0800 | [diff] [blame] | 26 | #define WL_ASSOC_INFO_MAX 512 /* assoc related fil max buf */ |
| 27 | #define WL_EXTRA_BUF_MAX 2048 |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 28 | #define WL_ROAM_TRIGGER_LEVEL -75 |
| 29 | #define WL_ROAM_DELTA 20 |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 30 | |
Hante Meuleman | d536733 | 2016-02-17 11:26:51 +0100 | [diff] [blame^] | 31 | /* Keep BRCMF_ESCAN_BUF_SIZE below 64K (65536). Allocing over 64K can be |
| 32 | * problematic on some systems and should be avoided. |
| 33 | */ |
| 34 | #define BRCMF_ESCAN_BUF_SIZE 65000 |
| 35 | #define BRCMF_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */ |
Hante Meuleman | e756af5 | 2012-09-11 21:18:52 +0200 | [diff] [blame] | 36 | |
| 37 | #define WL_ESCAN_ACTION_START 1 |
| 38 | #define WL_ESCAN_ACTION_CONTINUE 2 |
| 39 | #define WL_ESCAN_ACTION_ABORT 3 |
| 40 | |
Hante Meuleman | f09d0c0 | 2012-09-27 14:17:48 +0200 | [diff] [blame] | 41 | #define WL_AUTH_SHARED_KEY 1 /* d11 shared authentication */ |
Hante Meuleman | 1a87334 | 2012-09-27 14:17:54 +0200 | [diff] [blame] | 42 | #define IE_MAX_LEN 512 |
Hante Meuleman | f09d0c0 | 2012-09-27 14:17:48 +0200 | [diff] [blame] | 43 | |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 44 | /* IE TLV processing */ |
| 45 | #define TLV_LEN_OFF 1 /* length offset */ |
| 46 | #define TLV_HDR_LEN 2 /* header length */ |
| 47 | #define TLV_BODY_OFF 2 /* body offset */ |
| 48 | #define TLV_OUI_LEN 3 /* oui id length */ |
| 49 | |
| 50 | /* 802.11 Mgmt Packet flags */ |
| 51 | #define BRCMF_VNDR_IE_BEACON_FLAG 0x1 |
| 52 | #define BRCMF_VNDR_IE_PRBRSP_FLAG 0x2 |
| 53 | #define BRCMF_VNDR_IE_ASSOCRSP_FLAG 0x4 |
| 54 | #define BRCMF_VNDR_IE_AUTHRSP_FLAG 0x8 |
| 55 | #define BRCMF_VNDR_IE_PRBREQ_FLAG 0x10 |
| 56 | #define BRCMF_VNDR_IE_ASSOCREQ_FLAG 0x20 |
| 57 | /* vendor IE in IW advertisement protocol ID field */ |
| 58 | #define BRCMF_VNDR_IE_IWAPID_FLAG 0x40 |
| 59 | /* allow custom IE id */ |
| 60 | #define BRCMF_VNDR_IE_CUSTOM_FLAG 0x100 |
| 61 | |
| 62 | /* P2P Action Frames flags (spec ordered) */ |
| 63 | #define BRCMF_VNDR_IE_GONREQ_FLAG 0x001000 |
| 64 | #define BRCMF_VNDR_IE_GONRSP_FLAG 0x002000 |
| 65 | #define BRCMF_VNDR_IE_GONCFM_FLAG 0x004000 |
| 66 | #define BRCMF_VNDR_IE_INVREQ_FLAG 0x008000 |
| 67 | #define BRCMF_VNDR_IE_INVRSP_FLAG 0x010000 |
| 68 | #define BRCMF_VNDR_IE_DISREQ_FLAG 0x020000 |
| 69 | #define BRCMF_VNDR_IE_DISRSP_FLAG 0x040000 |
| 70 | #define BRCMF_VNDR_IE_PRDREQ_FLAG 0x080000 |
| 71 | #define BRCMF_VNDR_IE_PRDRSP_FLAG 0x100000 |
| 72 | |
| 73 | #define BRCMF_VNDR_IE_P2PAF_SHIFT 12 |
| 74 | |
Hante Meuleman | 118eb30 | 2014-12-21 12:43:49 +0100 | [diff] [blame] | 75 | #define BRCMF_MAX_DEFAULT_KEYS 4 |
| 76 | |
Hante Meuleman | 1119e23 | 2015-11-25 11:32:42 +0100 | [diff] [blame] | 77 | /* beacon loss timeout defaults */ |
| 78 | #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2 |
| 79 | #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF 4 |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 80 | |
Arend van Spriel | 63ce3d5 | 2016-01-05 11:05:48 +0100 | [diff] [blame] | 81 | #define BRCMF_VIF_EVENT_TIMEOUT msecs_to_jiffies(1500) |
| 82 | |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 83 | /** |
Arend van Spriel | 1687eee | 2013-04-23 12:53:11 +0200 | [diff] [blame] | 84 | * enum brcmf_scan_status - scan engine status |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 85 | * |
| 86 | * @BRCMF_SCAN_STATUS_BUSY: scanning in progress on dongle. |
| 87 | * @BRCMF_SCAN_STATUS_ABORT: scan being aborted on dongle. |
Arend van Spriel | 1687eee | 2013-04-23 12:53:11 +0200 | [diff] [blame] | 88 | * @BRCMF_SCAN_STATUS_SUPPRESS: scanning is suppressed in driver. |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 89 | */ |
| 90 | enum brcmf_scan_status { |
| 91 | BRCMF_SCAN_STATUS_BUSY, |
| 92 | BRCMF_SCAN_STATUS_ABORT, |
Arend van Spriel | 1687eee | 2013-04-23 12:53:11 +0200 | [diff] [blame] | 93 | BRCMF_SCAN_STATUS_SUPPRESS, |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 94 | }; |
| 95 | |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 96 | /* dongle configuration */ |
| 97 | struct brcmf_cfg80211_conf { |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 98 | u32 frag_threshold; |
| 99 | u32 rts_threshold; |
| 100 | u32 retry_short; |
| 101 | u32 retry_long; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 102 | }; |
| 103 | |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 104 | /* security information with currently associated ap */ |
| 105 | struct brcmf_cfg80211_security { |
| 106 | u32 wpa_versions; |
| 107 | u32 auth_type; |
| 108 | u32 cipher_pairwise; |
| 109 | u32 cipher_group; |
| 110 | u32 wpa_auth; |
| 111 | }; |
| 112 | |
Arend van Spriel | 3bc0a96 | 2012-10-22 13:55:35 -0700 | [diff] [blame] | 113 | /** |
| 114 | * struct brcmf_cfg80211_profile - profile information. |
| 115 | * |
Arend van Spriel | 3bc0a96 | 2012-10-22 13:55:35 -0700 | [diff] [blame] | 116 | * @bssid: bssid of joined/joining ibss. |
| 117 | * @sec: security information. |
Hante Meuleman | 118eb30 | 2014-12-21 12:43:49 +0100 | [diff] [blame] | 118 | * @key: key information |
Arend van Spriel | 3bc0a96 | 2012-10-22 13:55:35 -0700 | [diff] [blame] | 119 | */ |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 120 | struct brcmf_cfg80211_profile { |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 121 | u8 bssid[ETH_ALEN]; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 122 | struct brcmf_cfg80211_security sec; |
Hante Meuleman | 118eb30 | 2014-12-21 12:43:49 +0100 | [diff] [blame] | 123 | struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS]; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 124 | }; |
| 125 | |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 126 | /** |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 127 | * enum brcmf_vif_status - bit indices for vif status. |
| 128 | * |
| 129 | * @BRCMF_VIF_STATUS_READY: ready for operation. |
| 130 | * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress. |
| 131 | * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully. |
Arend van Spriel | 5f4f9f1 | 2013-02-08 15:53:41 +0100 | [diff] [blame] | 132 | * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress. |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 133 | * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started. |
| 134 | */ |
| 135 | enum brcmf_vif_status { |
| 136 | BRCMF_VIF_STATUS_READY, |
| 137 | BRCMF_VIF_STATUS_CONNECTING, |
| 138 | BRCMF_VIF_STATUS_CONNECTED, |
Arend van Spriel | 5f4f9f1 | 2013-02-08 15:53:41 +0100 | [diff] [blame] | 139 | BRCMF_VIF_STATUS_DISCONNECTING, |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 140 | BRCMF_VIF_STATUS_AP_CREATED |
| 141 | }; |
| 142 | |
| 143 | /** |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 144 | * struct vif_saved_ie - holds saved IEs for a virtual interface. |
| 145 | * |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 146 | * @probe_req_ie: IE info for probe request. |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 147 | * @probe_res_ie: IE info for probe response. |
| 148 | * @beacon_ie: IE info for beacon frame. |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 149 | * @probe_req_ie_len: IE info length for probe request. |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 150 | * @probe_res_ie_len: IE info length for probe response. |
| 151 | * @beacon_ie_len: IE info length for beacon frame. |
| 152 | */ |
| 153 | struct vif_saved_ie { |
Hante Meuleman | dae3a27 | 2013-02-08 15:54:00 +0100 | [diff] [blame] | 154 | u8 probe_req_ie[IE_MAX_LEN]; |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 155 | u8 probe_res_ie[IE_MAX_LEN]; |
| 156 | u8 beacon_ie[IE_MAX_LEN]; |
Hante Meuleman | 89286dc | 2013-02-08 15:53:46 +0100 | [diff] [blame] | 157 | u8 assoc_req_ie[IE_MAX_LEN]; |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 158 | u32 probe_req_ie_len; |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 159 | u32 probe_res_ie_len; |
| 160 | u32 beacon_ie_len; |
Hante Meuleman | 89286dc | 2013-02-08 15:53:46 +0100 | [diff] [blame] | 161 | u32 assoc_req_ie_len; |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 162 | }; |
| 163 | |
| 164 | /** |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 165 | * struct brcmf_cfg80211_vif - virtual interface specific information. |
| 166 | * |
| 167 | * @ifp: lower layer interface pointer |
| 168 | * @wdev: wireless device. |
Arend van Spriel | 6ac4f4e | 2012-10-22 13:55:31 -0700 | [diff] [blame] | 169 | * @profile: profile information. |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 170 | * @sme_state: SME state using enum brcmf_vif_status bits. |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 171 | * @pm_block: power-management blocked. |
| 172 | * @list: linked list. |
Hante Meuleman | 0de8aac | 2013-02-08 15:53:38 +0100 | [diff] [blame] | 173 | * @mgmt_rx_reg: registered rx mgmt frame types. |
Hante Meuleman | a44aa40 | 2014-12-03 21:05:33 +0100 | [diff] [blame] | 174 | * @mbss: Multiple BSS type, set if not first AP (not relevant for P2P). |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 175 | */ |
| 176 | struct brcmf_cfg80211_vif { |
| 177 | struct brcmf_if *ifp; |
| 178 | struct wireless_dev wdev; |
Arend van Spriel | 6ac4f4e | 2012-10-22 13:55:31 -0700 | [diff] [blame] | 179 | struct brcmf_cfg80211_profile profile; |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 180 | unsigned long sme_state; |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 181 | bool pm_block; |
Arend van Spriel | 8ff5dc9 | 2012-10-22 13:55:41 -0700 | [diff] [blame] | 182 | struct vif_saved_ie saved_ie; |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 183 | struct list_head list; |
Hante Meuleman | 0de8aac | 2013-02-08 15:53:38 +0100 | [diff] [blame] | 184 | u16 mgmt_rx_reg; |
Hante Meuleman | a44aa40 | 2014-12-03 21:05:33 +0100 | [diff] [blame] | 185 | bool mbss; |
Arend van Spriel | 9802776 | 2014-12-21 12:43:53 +0100 | [diff] [blame] | 186 | int is_11d; |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 187 | }; |
| 188 | |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 189 | /* association inform */ |
| 190 | struct brcmf_cfg80211_connect_info { |
| 191 | u8 *req_ie; |
| 192 | s32 req_ie_len; |
| 193 | u8 *resp_ie; |
| 194 | s32 resp_ie_len; |
| 195 | }; |
| 196 | |
| 197 | /* assoc ie length */ |
Arend van Spriel | c4e382d | 2011-10-12 20:51:21 +0200 | [diff] [blame] | 198 | struct brcmf_cfg80211_assoc_ielen_le { |
| 199 | __le32 req_len; |
| 200 | __le32 resp_len; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 201 | }; |
| 202 | |
Hante Meuleman | e756af5 | 2012-09-11 21:18:52 +0200 | [diff] [blame] | 203 | /* dongle escan state */ |
| 204 | enum wl_escan_state { |
| 205 | WL_ESCAN_STATE_IDLE, |
| 206 | WL_ESCAN_STATE_SCANNING |
| 207 | }; |
| 208 | |
| 209 | struct escan_info { |
| 210 | u32 escan_state; |
Hante Meuleman | d536733 | 2016-02-17 11:26:51 +0100 | [diff] [blame^] | 211 | u8 *escan_buf; |
Hante Meuleman | e756af5 | 2012-09-11 21:18:52 +0200 | [diff] [blame] | 212 | struct wiphy *wiphy; |
Arend van Spriel | a0f472a | 2013-04-05 10:57:49 +0200 | [diff] [blame] | 213 | struct brcmf_if *ifp; |
| 214 | s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, |
Hante Meuleman | c495810 | 2015-11-25 11:32:41 +0100 | [diff] [blame] | 215 | struct cfg80211_scan_request *request); |
Hante Meuleman | e756af5 | 2012-09-11 21:18:52 +0200 | [diff] [blame] | 216 | }; |
| 217 | |
Arend van Spriel | e580607 | 2012-09-19 22:21:08 +0200 | [diff] [blame] | 218 | /** |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 219 | * struct brcmf_cfg80211_vif_event - virtual interface event information. |
| 220 | * |
| 221 | * @vif_wq: waitqueue awaiting interface event from firmware. |
| 222 | * @vif_event_lock: protects other members in this structure. |
| 223 | * @vif_complete: completion for net attach. |
| 224 | * @action: either add, change, or delete. |
| 225 | * @vif: virtual interface object related to the event. |
| 226 | */ |
| 227 | struct brcmf_cfg80211_vif_event { |
| 228 | wait_queue_head_t vif_wq; |
| 229 | struct mutex vif_event_lock; |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 230 | u8 action; |
| 231 | struct brcmf_cfg80211_vif *vif; |
| 232 | }; |
| 233 | |
| 234 | /** |
Hante Meuleman | 3021ad9 | 2016-01-05 11:05:45 +0100 | [diff] [blame] | 235 | * struct brcmf_cfg80211_wowl - wowl related information. |
| 236 | * |
| 237 | * @active: set on suspend, cleared on resume. |
| 238 | * @pre_pmmode: firmware PM mode at entering suspend. |
| 239 | * @nd: net dectect data. |
| 240 | * @nd_info: helper struct to pass to cfg80211. |
| 241 | * @nd_data_wait: wait queue to sync net detect data. |
| 242 | * @nd_data_completed: completion for net detect data. |
| 243 | * @nd_enabled: net detect enabled. |
| 244 | */ |
| 245 | struct brcmf_cfg80211_wowl { |
| 246 | bool active; |
| 247 | u32 pre_pmmode; |
| 248 | struct cfg80211_wowlan_nd_match *nd; |
| 249 | struct cfg80211_wowlan_nd_info *nd_info; |
| 250 | wait_queue_head_t nd_data_wait; |
| 251 | bool nd_data_completed; |
| 252 | bool nd_enabled; |
| 253 | }; |
| 254 | |
| 255 | /** |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 256 | * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 257 | * |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 258 | * @wiphy: wiphy object for cfg80211 interface. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 259 | * @conf: dongle configuration. |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 260 | * @p2p: peer-to-peer specific information. |
Piotr Haber | 61730d4 | 2013-04-23 12:53:12 +0200 | [diff] [blame] | 261 | * @btcoex: Bluetooth coexistence information. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 262 | * @scan_request: cfg80211 scan request object. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 263 | * @usr_sync: mainly for dongle up/down synchronization. |
| 264 | * @bss_list: bss_list holding scanned ap information. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 265 | * @bss_info: bss information for cfg80211 layer. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 266 | * @conn_info: association info. |
| 267 | * @pmk_list: wpa2 pmk list. |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 268 | * @scan_status: scan activity on the dongle. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 269 | * @pub: common driver information. |
| 270 | * @channel: current channel. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 271 | * @active_scan: current scan mode. |
| 272 | * @sched_escan: e-scan for scheduled scan support running. |
| 273 | * @ibss_starter: indicates this sta is ibss starter. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 274 | * @pwr_save: indicate whether dongle to support power save mode. |
| 275 | * @dongle_up: indicate whether dongle up or not. |
| 276 | * @roam_on: on/off switch for dongle self-roaming. |
| 277 | * @scan_tried: indicates if first scan attempted. |
| 278 | * @dcmd_buf: dcmd buffer. |
| 279 | * @extra_buf: mainly to grab assoc information. |
| 280 | * @debugfsdir: debugfs folder for this device. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 281 | * @escan_info: escan information. |
| 282 | * @escan_timeout: Timer for catch scan timeout. |
| 283 | * @escan_timeout_work: scan timeout worker. |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 284 | * @vif_list: linked list of vif instances. |
| 285 | * @vif_cnt: number of vif instances. |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 286 | * @vif_event: vif event signalling. |
Hante Meuleman | 3021ad9 | 2016-01-05 11:05:45 +0100 | [diff] [blame] | 287 | * @wowl: wowl related information. |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 288 | */ |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 289 | struct brcmf_cfg80211_info { |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 290 | struct wiphy *wiphy; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 291 | struct brcmf_cfg80211_conf *conf; |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 292 | struct brcmf_p2p_info p2p; |
Piotr Haber | 61730d4 | 2013-04-23 12:53:12 +0200 | [diff] [blame] | 293 | struct brcmf_btcoex_info *btcoex; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 294 | struct cfg80211_scan_request *scan_request; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 295 | struct mutex usr_sync; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 296 | struct wl_cfg80211_bss_info *bss_info; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 297 | struct brcmf_cfg80211_connect_info conn_info; |
Hante Meuleman | 6c404f3 | 2015-12-10 13:43:03 +0100 | [diff] [blame] | 298 | struct brcmf_pmk_list_le pmk_list; |
Arend van Spriel | c117903 | 2012-10-22 13:55:33 -0700 | [diff] [blame] | 299 | unsigned long scan_status; |
Arend van Spriel | ee92838 | 2012-09-19 22:21:18 +0200 | [diff] [blame] | 300 | struct brcmf_pub *pub; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 301 | u32 channel; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 302 | bool active_scan; |
| 303 | bool sched_escan; |
| 304 | bool ibss_starter; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 305 | bool pwr_save; |
| 306 | bool dongle_up; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 307 | bool scan_tried; |
| 308 | u8 *dcmd_buf; |
| 309 | u8 *extra_buf; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 310 | struct dentry *debugfsdir; |
Arend van Spriel | 02030eb | 2012-09-19 22:21:17 +0200 | [diff] [blame] | 311 | struct escan_info escan_info; |
| 312 | struct timer_list escan_timeout; |
| 313 | struct work_struct escan_timeout_work; |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 314 | struct list_head vif_list; |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 315 | struct brcmf_cfg80211_vif_event vif_event; |
Arend van Spriel | 5f4f9f1 | 2013-02-08 15:53:41 +0100 | [diff] [blame] | 316 | struct completion vif_disabled; |
Franky Lin | 83cf17a | 2013-04-11 13:28:50 +0200 | [diff] [blame] | 317 | struct brcmu_d11inf d11inf; |
Hante Meuleman | bf2a7e0 | 2015-10-08 20:33:18 +0200 | [diff] [blame] | 318 | struct brcmf_assoclist_le assoclist; |
Hante Meuleman | 3021ad9 | 2016-01-05 11:05:45 +0100 | [diff] [blame] | 319 | struct brcmf_cfg80211_wowl wowl; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 320 | }; |
| 321 | |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 322 | /** |
| 323 | * struct brcmf_tlv - tag_ID/length/value_buffer tuple. |
| 324 | * |
| 325 | * @id: tag identifier. |
| 326 | * @len: number of bytes in value buffer. |
| 327 | * @data: value buffer. |
| 328 | */ |
| 329 | struct brcmf_tlv { |
| 330 | u8 id; |
| 331 | u8 len; |
| 332 | u8 data[1]; |
| 333 | }; |
| 334 | |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 335 | 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] | 336 | { |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 337 | return cfg->wiphy; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 338 | } |
| 339 | |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 340 | 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] | 341 | { |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 342 | return (struct brcmf_cfg80211_info *)(wiphy_priv(w)); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 343 | } |
| 344 | |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 345 | 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] | 346 | { |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 347 | return (struct brcmf_cfg80211_info *)(wdev_priv(wd)); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 348 | } |
| 349 | |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 350 | static inline |
| 351 | struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg) |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 352 | { |
Arend van Spriel | 3eacf86 | 2012-10-22 13:55:30 -0700 | [diff] [blame] | 353 | struct brcmf_cfg80211_vif *vif; |
| 354 | vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list); |
| 355 | return vif->wdev.netdev; |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 356 | } |
| 357 | |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 358 | 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] | 359 | { |
| 360 | return wdev_to_cfg(ndev->ieee80211_ptr); |
| 361 | } |
| 362 | |
Arend van Spriel | 6ac4f4e | 2012-10-22 13:55:31 -0700 | [diff] [blame] | 363 | static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd) |
| 364 | { |
| 365 | struct brcmf_if *ifp = netdev_priv(nd); |
| 366 | return &ifp->vif->profile; |
| 367 | } |
| 368 | |
Arend van Spriel | 1332e26 | 2012-11-05 16:22:18 -0800 | [diff] [blame] | 369 | static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev) |
| 370 | { |
| 371 | struct brcmf_if *ifp = netdev_priv(ndev); |
| 372 | return ifp->vif; |
| 373 | } |
| 374 | |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 375 | static inline struct |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 376 | 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] | 377 | { |
| 378 | return &cfg->conn_info; |
| 379 | } |
| 380 | |
Arend van Spriel | d9cb259 | 2012-12-05 15:25:54 +0100 | [diff] [blame] | 381 | struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, |
Hante Meuleman | ae7c03f | 2015-09-18 22:08:08 +0200 | [diff] [blame] | 382 | struct device *busdev, |
| 383 | bool p2pdev_forced); |
Arend van Spriel | 27a68fe | 2012-09-27 14:17:55 +0200 | [diff] [blame] | 384 | void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); |
Arend van Spriel | bdf5ff5 | 2012-11-14 18:46:09 -0800 | [diff] [blame] | 385 | s32 brcmf_cfg80211_up(struct net_device *ndev); |
| 386 | s32 brcmf_cfg80211_down(struct net_device *ndev); |
Arend van Spriel | a7965fb | 2013-04-11 17:08:37 +0200 | [diff] [blame] | 387 | enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); |
Arend van Spriel | 5b435de | 2011-10-05 13:19:03 +0200 | [diff] [blame] | 388 | |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 389 | 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] | 390 | enum nl80211_iftype type, |
| 391 | bool pm_block); |
Arend van Spriel | 427dec5 | 2014-01-06 12:40:47 +0100 | [diff] [blame] | 392 | void brcmf_free_vif(struct brcmf_cfg80211_vif *vif); |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 393 | |
| 394 | s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, |
| 395 | const u8 *vndr_ie_buf, u32 vndr_ie_len); |
Arend van Spriel | 5f4f9f1 | 2013-02-08 15:53:41 +0100 | [diff] [blame] | 396 | s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif); |
Johannes Berg | 4b5800f | 2014-01-15 14:55:59 +0100 | [diff] [blame] | 397 | const struct brcmf_tlv * |
| 398 | brcmf_parse_tlvs(const void *buf, int buflen, uint key); |
Franky Lin | 83cf17a | 2013-04-11 13:28:50 +0200 | [diff] [blame] | 399 | u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, |
| 400 | struct ieee80211_channel *ch); |
Hante Meuleman | bfe8197 | 2014-10-28 14:56:16 +0100 | [diff] [blame] | 401 | bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg, |
| 402 | unsigned long state); |
Arend van Spriel | d3c0b63 | 2013-02-08 15:53:37 +0100 | [diff] [blame] | 403 | void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, |
| 404 | struct brcmf_cfg80211_vif *vif); |
| 405 | bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg); |
Arend van Spriel | a9eb0c4 | 2016-02-17 11:26:50 +0100 | [diff] [blame] | 406 | int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg, |
| 407 | u8 action, ulong timeout); |
Hante Meuleman | 7a5c1f6 | 2013-02-08 15:53:44 +0100 | [diff] [blame] | 408 | s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, |
Arend van Spriel | a0f472a | 2013-04-05 10:57:49 +0200 | [diff] [blame] | 409 | struct brcmf_if *ifp, bool aborted, |
| 410 | bool fw_abort); |
Arend van Spriel | f96aa07 | 2013-04-05 10:57:48 +0200 | [diff] [blame] | 411 | void brcmf_set_mpc(struct brcmf_if *ndev, int mpc); |
Hante Meuleman | 18e2f61 | 2013-02-08 15:53:49 +0100 | [diff] [blame] | 412 | void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg); |
Arend van Spriel | 9df4d54 | 2014-01-06 12:40:49 +0100 | [diff] [blame] | 413 | void brcmf_cfg80211_free_netdev(struct net_device *ndev); |
Arend van Spriel | 9f440b7 | 2013-02-08 15:53:36 +0100 | [diff] [blame] | 414 | |
Hante Meuleman | bfe8197 | 2014-10-28 14:56:16 +0100 | [diff] [blame] | 415 | #endif /* BRCMFMAC_CFG80211_H */ |