xref: /linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h (revision 1119e23edf256f4b4a3655f50b31ec6406f16026)
105491d2cSKalle Valo /*
205491d2cSKalle Valo  * Copyright (c) 2010 Broadcom Corporation
305491d2cSKalle Valo  *
405491d2cSKalle Valo  * Permission to use, copy, modify, and/or distribute this software for any
505491d2cSKalle Valo  * purpose with or without fee is hereby granted, provided that the above
605491d2cSKalle Valo  * copyright notice and this permission notice appear in all copies.
705491d2cSKalle Valo  *
805491d2cSKalle Valo  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
905491d2cSKalle Valo  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1005491d2cSKalle Valo  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
1105491d2cSKalle Valo  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1205491d2cSKalle Valo  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
1305491d2cSKalle Valo  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
1405491d2cSKalle Valo  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1505491d2cSKalle Valo  */
1605491d2cSKalle Valo 
1705491d2cSKalle Valo #ifndef BRCMFMAC_CFG80211_H
1805491d2cSKalle Valo #define BRCMFMAC_CFG80211_H
1905491d2cSKalle Valo 
2005491d2cSKalle Valo /* for brcmu_d11inf */
2105491d2cSKalle Valo #include <brcmu_d11.h>
2205491d2cSKalle Valo 
2305491d2cSKalle Valo #define WL_NUM_SCAN_MAX			10
2405491d2cSKalle Valo #define WL_NUM_PMKIDS_MAX		MAXPMKID
2505491d2cSKalle Valo #define WL_TLV_INFO_MAX			1024
2605491d2cSKalle Valo #define WL_BSS_INFO_MAX			2048
2705491d2cSKalle Valo #define WL_ASSOC_INFO_MAX		512	/* assoc related fil max buf */
2805491d2cSKalle Valo #define WL_EXTRA_BUF_MAX		2048
2905491d2cSKalle Valo #define WL_ROAM_TRIGGER_LEVEL		-75
3005491d2cSKalle Valo #define WL_ROAM_DELTA			20
3105491d2cSKalle Valo 
3205491d2cSKalle Valo #define WL_SCAN_CHANNEL_TIME		40
3305491d2cSKalle Valo #define WL_SCAN_UNASSOC_TIME		40
3405491d2cSKalle Valo #define WL_SCAN_PASSIVE_TIME		120
3505491d2cSKalle Valo 
3605491d2cSKalle Valo #define WL_ESCAN_BUF_SIZE		(1024 * 64)
3705491d2cSKalle Valo #define WL_ESCAN_TIMER_INTERVAL_MS	10000 /* E-Scan timeout */
3805491d2cSKalle Valo 
3905491d2cSKalle Valo #define WL_ESCAN_ACTION_START		1
4005491d2cSKalle Valo #define WL_ESCAN_ACTION_CONTINUE	2
4105491d2cSKalle Valo #define WL_ESCAN_ACTION_ABORT		3
4205491d2cSKalle Valo 
4305491d2cSKalle Valo #define WL_AUTH_SHARED_KEY		1	/* d11 shared authentication */
4405491d2cSKalle Valo #define IE_MAX_LEN			512
4505491d2cSKalle Valo 
4605491d2cSKalle Valo /* IE TLV processing */
4705491d2cSKalle Valo #define TLV_LEN_OFF			1	/* length offset */
4805491d2cSKalle Valo #define TLV_HDR_LEN			2	/* header length */
4905491d2cSKalle Valo #define TLV_BODY_OFF			2	/* body offset */
5005491d2cSKalle Valo #define TLV_OUI_LEN			3	/* oui id length */
5105491d2cSKalle Valo 
5205491d2cSKalle Valo /* 802.11 Mgmt Packet flags */
5305491d2cSKalle Valo #define BRCMF_VNDR_IE_BEACON_FLAG	0x1
5405491d2cSKalle Valo #define BRCMF_VNDR_IE_PRBRSP_FLAG	0x2
5505491d2cSKalle Valo #define BRCMF_VNDR_IE_ASSOCRSP_FLAG	0x4
5605491d2cSKalle Valo #define BRCMF_VNDR_IE_AUTHRSP_FLAG	0x8
5705491d2cSKalle Valo #define BRCMF_VNDR_IE_PRBREQ_FLAG	0x10
5805491d2cSKalle Valo #define BRCMF_VNDR_IE_ASSOCREQ_FLAG	0x20
5905491d2cSKalle Valo /* vendor IE in IW advertisement protocol ID field */
6005491d2cSKalle Valo #define BRCMF_VNDR_IE_IWAPID_FLAG	0x40
6105491d2cSKalle Valo /* allow custom IE id */
6205491d2cSKalle Valo #define BRCMF_VNDR_IE_CUSTOM_FLAG	0x100
6305491d2cSKalle Valo 
6405491d2cSKalle Valo /* P2P Action Frames flags (spec ordered) */
6505491d2cSKalle Valo #define BRCMF_VNDR_IE_GONREQ_FLAG     0x001000
6605491d2cSKalle Valo #define BRCMF_VNDR_IE_GONRSP_FLAG     0x002000
6705491d2cSKalle Valo #define BRCMF_VNDR_IE_GONCFM_FLAG     0x004000
6805491d2cSKalle Valo #define BRCMF_VNDR_IE_INVREQ_FLAG     0x008000
6905491d2cSKalle Valo #define BRCMF_VNDR_IE_INVRSP_FLAG     0x010000
7005491d2cSKalle Valo #define BRCMF_VNDR_IE_DISREQ_FLAG     0x020000
7105491d2cSKalle Valo #define BRCMF_VNDR_IE_DISRSP_FLAG     0x040000
7205491d2cSKalle Valo #define BRCMF_VNDR_IE_PRDREQ_FLAG     0x080000
7305491d2cSKalle Valo #define BRCMF_VNDR_IE_PRDRSP_FLAG     0x100000
7405491d2cSKalle Valo 
7505491d2cSKalle Valo #define BRCMF_VNDR_IE_P2PAF_SHIFT	12
7605491d2cSKalle Valo 
7705491d2cSKalle Valo #define BRCMF_MAX_DEFAULT_KEYS		4
7805491d2cSKalle Valo 
79*1119e23eSHante Meuleman /* beacon loss timeout defaults */
80*1119e23eSHante Meuleman #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON	2
81*1119e23eSHante Meuleman #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF	4
8205491d2cSKalle Valo 
8305491d2cSKalle Valo /**
8405491d2cSKalle Valo  * enum brcmf_scan_status - scan engine status
8505491d2cSKalle Valo  *
8605491d2cSKalle Valo  * @BRCMF_SCAN_STATUS_BUSY: scanning in progress on dongle.
8705491d2cSKalle Valo  * @BRCMF_SCAN_STATUS_ABORT: scan being aborted on dongle.
8805491d2cSKalle Valo  * @BRCMF_SCAN_STATUS_SUPPRESS: scanning is suppressed in driver.
8905491d2cSKalle Valo  */
9005491d2cSKalle Valo enum brcmf_scan_status {
9105491d2cSKalle Valo 	BRCMF_SCAN_STATUS_BUSY,
9205491d2cSKalle Valo 	BRCMF_SCAN_STATUS_ABORT,
9305491d2cSKalle Valo 	BRCMF_SCAN_STATUS_SUPPRESS,
9405491d2cSKalle Valo };
9505491d2cSKalle Valo 
9605491d2cSKalle Valo /* dongle configuration */
9705491d2cSKalle Valo struct brcmf_cfg80211_conf {
9805491d2cSKalle Valo 	u32 frag_threshold;
9905491d2cSKalle Valo 	u32 rts_threshold;
10005491d2cSKalle Valo 	u32 retry_short;
10105491d2cSKalle Valo 	u32 retry_long;
10205491d2cSKalle Valo 	s32 tx_power;
10305491d2cSKalle Valo 	struct ieee80211_channel channel;
10405491d2cSKalle Valo };
10505491d2cSKalle Valo 
10605491d2cSKalle Valo /* basic structure of scan request */
10705491d2cSKalle Valo struct brcmf_cfg80211_scan_req {
10805491d2cSKalle Valo 	struct brcmf_ssid_le ssid_le;
10905491d2cSKalle Valo };
11005491d2cSKalle Valo 
11105491d2cSKalle Valo /* basic structure of information element */
11205491d2cSKalle Valo struct brcmf_cfg80211_ie {
11305491d2cSKalle Valo 	u16 offset;
11405491d2cSKalle Valo 	u8 buf[WL_TLV_INFO_MAX];
11505491d2cSKalle Valo };
11605491d2cSKalle Valo 
11705491d2cSKalle Valo /* security information with currently associated ap */
11805491d2cSKalle Valo struct brcmf_cfg80211_security {
11905491d2cSKalle Valo 	u32 wpa_versions;
12005491d2cSKalle Valo 	u32 auth_type;
12105491d2cSKalle Valo 	u32 cipher_pairwise;
12205491d2cSKalle Valo 	u32 cipher_group;
12305491d2cSKalle Valo 	u32 wpa_auth;
12405491d2cSKalle Valo };
12505491d2cSKalle Valo 
12605491d2cSKalle Valo /**
12705491d2cSKalle Valo  * struct brcmf_cfg80211_profile - profile information.
12805491d2cSKalle Valo  *
12905491d2cSKalle Valo  * @bssid: bssid of joined/joining ibss.
13005491d2cSKalle Valo  * @sec: security information.
13105491d2cSKalle Valo  * @key: key information
13205491d2cSKalle Valo  */
13305491d2cSKalle Valo struct brcmf_cfg80211_profile {
13405491d2cSKalle Valo 	u8 bssid[ETH_ALEN];
13505491d2cSKalle Valo 	struct brcmf_cfg80211_security sec;
13605491d2cSKalle Valo 	struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
13705491d2cSKalle Valo };
13805491d2cSKalle Valo 
13905491d2cSKalle Valo /**
14005491d2cSKalle Valo  * enum brcmf_vif_status - bit indices for vif status.
14105491d2cSKalle Valo  *
14205491d2cSKalle Valo  * @BRCMF_VIF_STATUS_READY: ready for operation.
14305491d2cSKalle Valo  * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress.
14405491d2cSKalle Valo  * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully.
14505491d2cSKalle Valo  * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress.
14605491d2cSKalle Valo  * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started.
14705491d2cSKalle Valo  */
14805491d2cSKalle Valo enum brcmf_vif_status {
14905491d2cSKalle Valo 	BRCMF_VIF_STATUS_READY,
15005491d2cSKalle Valo 	BRCMF_VIF_STATUS_CONNECTING,
15105491d2cSKalle Valo 	BRCMF_VIF_STATUS_CONNECTED,
15205491d2cSKalle Valo 	BRCMF_VIF_STATUS_DISCONNECTING,
15305491d2cSKalle Valo 	BRCMF_VIF_STATUS_AP_CREATED
15405491d2cSKalle Valo };
15505491d2cSKalle Valo 
15605491d2cSKalle Valo /**
15705491d2cSKalle Valo  * struct vif_saved_ie - holds saved IEs for a virtual interface.
15805491d2cSKalle Valo  *
15905491d2cSKalle Valo  * @probe_req_ie: IE info for probe request.
16005491d2cSKalle Valo  * @probe_res_ie: IE info for probe response.
16105491d2cSKalle Valo  * @beacon_ie: IE info for beacon frame.
16205491d2cSKalle Valo  * @probe_req_ie_len: IE info length for probe request.
16305491d2cSKalle Valo  * @probe_res_ie_len: IE info length for probe response.
16405491d2cSKalle Valo  * @beacon_ie_len: IE info length for beacon frame.
16505491d2cSKalle Valo  */
16605491d2cSKalle Valo struct vif_saved_ie {
16705491d2cSKalle Valo 	u8  probe_req_ie[IE_MAX_LEN];
16805491d2cSKalle Valo 	u8  probe_res_ie[IE_MAX_LEN];
16905491d2cSKalle Valo 	u8  beacon_ie[IE_MAX_LEN];
17005491d2cSKalle Valo 	u8  assoc_req_ie[IE_MAX_LEN];
17105491d2cSKalle Valo 	u32 probe_req_ie_len;
17205491d2cSKalle Valo 	u32 probe_res_ie_len;
17305491d2cSKalle Valo 	u32 beacon_ie_len;
17405491d2cSKalle Valo 	u32 assoc_req_ie_len;
17505491d2cSKalle Valo };
17605491d2cSKalle Valo 
17705491d2cSKalle Valo /**
17805491d2cSKalle Valo  * struct brcmf_cfg80211_vif - virtual interface specific information.
17905491d2cSKalle Valo  *
18005491d2cSKalle Valo  * @ifp: lower layer interface pointer
18105491d2cSKalle Valo  * @wdev: wireless device.
18205491d2cSKalle Valo  * @profile: profile information.
18305491d2cSKalle Valo  * @sme_state: SME state using enum brcmf_vif_status bits.
18405491d2cSKalle Valo  * @pm_block: power-management blocked.
18505491d2cSKalle Valo  * @list: linked list.
18605491d2cSKalle Valo  * @mgmt_rx_reg: registered rx mgmt frame types.
18705491d2cSKalle Valo  * @mbss: Multiple BSS type, set if not first AP (not relevant for P2P).
18805491d2cSKalle Valo  */
18905491d2cSKalle Valo struct brcmf_cfg80211_vif {
19005491d2cSKalle Valo 	struct brcmf_if *ifp;
19105491d2cSKalle Valo 	struct wireless_dev wdev;
19205491d2cSKalle Valo 	struct brcmf_cfg80211_profile profile;
19305491d2cSKalle Valo 	unsigned long sme_state;
19405491d2cSKalle Valo 	bool pm_block;
19505491d2cSKalle Valo 	struct vif_saved_ie saved_ie;
19605491d2cSKalle Valo 	struct list_head list;
19705491d2cSKalle Valo 	u16 mgmt_rx_reg;
19805491d2cSKalle Valo 	bool mbss;
19905491d2cSKalle Valo 	int is_11d;
20005491d2cSKalle Valo };
20105491d2cSKalle Valo 
20205491d2cSKalle Valo /* association inform */
20305491d2cSKalle Valo struct brcmf_cfg80211_connect_info {
20405491d2cSKalle Valo 	u8 *req_ie;
20505491d2cSKalle Valo 	s32 req_ie_len;
20605491d2cSKalle Valo 	u8 *resp_ie;
20705491d2cSKalle Valo 	s32 resp_ie_len;
20805491d2cSKalle Valo };
20905491d2cSKalle Valo 
21005491d2cSKalle Valo /* assoc ie length */
21105491d2cSKalle Valo struct brcmf_cfg80211_assoc_ielen_le {
21205491d2cSKalle Valo 	__le32 req_len;
21305491d2cSKalle Valo 	__le32 resp_len;
21405491d2cSKalle Valo };
21505491d2cSKalle Valo 
21605491d2cSKalle Valo /* wpa2 pmk list */
21705491d2cSKalle Valo struct brcmf_cfg80211_pmk_list {
21805491d2cSKalle Valo 	struct pmkid_list pmkids;
21905491d2cSKalle Valo 	struct pmkid foo[MAXPMKID - 1];
22005491d2cSKalle Valo };
22105491d2cSKalle Valo 
22205491d2cSKalle Valo /* dongle escan state */
22305491d2cSKalle Valo enum wl_escan_state {
22405491d2cSKalle Valo 	WL_ESCAN_STATE_IDLE,
22505491d2cSKalle Valo 	WL_ESCAN_STATE_SCANNING
22605491d2cSKalle Valo };
22705491d2cSKalle Valo 
22805491d2cSKalle Valo struct escan_info {
22905491d2cSKalle Valo 	u32 escan_state;
23005491d2cSKalle Valo 	u8 escan_buf[WL_ESCAN_BUF_SIZE];
23105491d2cSKalle Valo 	struct wiphy *wiphy;
23205491d2cSKalle Valo 	struct brcmf_if *ifp;
23305491d2cSKalle Valo 	s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
234c4958106SHante Meuleman 		   struct cfg80211_scan_request *request);
23505491d2cSKalle Valo };
23605491d2cSKalle Valo 
23705491d2cSKalle Valo /**
23805491d2cSKalle Valo  * struct brcmf_pno_param_le - PNO scan configuration parameters
23905491d2cSKalle Valo  *
24005491d2cSKalle Valo  * @version: PNO parameters version.
24105491d2cSKalle Valo  * @scan_freq: scan frequency.
24205491d2cSKalle Valo  * @lost_network_timeout: #sec. to declare discovered network as lost.
24305491d2cSKalle Valo  * @flags: Bit field to control features of PFN such as sort criteria auto
24405491d2cSKalle Valo  *	enable switch and background scan.
24505491d2cSKalle Valo  * @rssi_margin: Margin to avoid jitter for choosing a PFN based on RSSI sort
24605491d2cSKalle Valo  *	criteria.
24705491d2cSKalle Valo  * @bestn: number of best networks in each scan.
24805491d2cSKalle Valo  * @mscan: number of scans recorded.
24905491d2cSKalle Valo  * @repeat: minimum number of scan intervals before scan frequency changes
25005491d2cSKalle Valo  *	in adaptive scan.
25105491d2cSKalle Valo  * @exp: exponent of 2 for maximum scan interval.
25205491d2cSKalle Valo  * @slow_freq: slow scan period.
25305491d2cSKalle Valo  */
25405491d2cSKalle Valo struct brcmf_pno_param_le {
25505491d2cSKalle Valo 	__le32 version;
25605491d2cSKalle Valo 	__le32 scan_freq;
25705491d2cSKalle Valo 	__le32 lost_network_timeout;
25805491d2cSKalle Valo 	__le16 flags;
25905491d2cSKalle Valo 	__le16 rssi_margin;
26005491d2cSKalle Valo 	u8 bestn;
26105491d2cSKalle Valo 	u8 mscan;
26205491d2cSKalle Valo 	u8 repeat;
26305491d2cSKalle Valo 	u8 exp;
26405491d2cSKalle Valo 	__le32 slow_freq;
26505491d2cSKalle Valo };
26605491d2cSKalle Valo 
26705491d2cSKalle Valo /**
26805491d2cSKalle Valo  * struct brcmf_pno_net_param_le - scan parameters per preferred network.
26905491d2cSKalle Valo  *
27005491d2cSKalle Valo  * @ssid: ssid name and its length.
27105491d2cSKalle Valo  * @flags: bit2: hidden.
27205491d2cSKalle Valo  * @infra: BSS vs IBSS.
27305491d2cSKalle Valo  * @auth: Open vs Closed.
27405491d2cSKalle Valo  * @wpa_auth: WPA type.
27505491d2cSKalle Valo  * @wsec: wsec value.
27605491d2cSKalle Valo  */
27705491d2cSKalle Valo struct brcmf_pno_net_param_le {
27805491d2cSKalle Valo 	struct brcmf_ssid_le ssid;
27905491d2cSKalle Valo 	__le32 flags;
28005491d2cSKalle Valo 	__le32 infra;
28105491d2cSKalle Valo 	__le32 auth;
28205491d2cSKalle Valo 	__le32 wpa_auth;
28305491d2cSKalle Valo 	__le32 wsec;
28405491d2cSKalle Valo };
28505491d2cSKalle Valo 
28605491d2cSKalle Valo /**
28705491d2cSKalle Valo  * struct brcmf_pno_net_info_le - information per found network.
28805491d2cSKalle Valo  *
28905491d2cSKalle Valo  * @bssid: BSS network identifier.
29005491d2cSKalle Valo  * @channel: channel number only.
29105491d2cSKalle Valo  * @SSID_len: length of ssid.
29205491d2cSKalle Valo  * @SSID: ssid characters.
29305491d2cSKalle Valo  * @RSSI: receive signal strength (in dBm).
29405491d2cSKalle Valo  * @timestamp: age in seconds.
29505491d2cSKalle Valo  */
29605491d2cSKalle Valo struct brcmf_pno_net_info_le {
29705491d2cSKalle Valo 	u8 bssid[ETH_ALEN];
29805491d2cSKalle Valo 	u8 channel;
29905491d2cSKalle Valo 	u8 SSID_len;
30005491d2cSKalle Valo 	u8 SSID[32];
30105491d2cSKalle Valo 	__le16	RSSI;
30205491d2cSKalle Valo 	__le16	timestamp;
30305491d2cSKalle Valo };
30405491d2cSKalle Valo 
30505491d2cSKalle Valo /**
30605491d2cSKalle Valo  * struct brcmf_pno_scanresults_le - result returned in PNO NET FOUND event.
30705491d2cSKalle Valo  *
30805491d2cSKalle Valo  * @version: PNO version identifier.
30905491d2cSKalle Valo  * @status: indicates completion status of PNO scan.
31005491d2cSKalle Valo  * @count: amount of brcmf_pno_net_info_le entries appended.
31105491d2cSKalle Valo  */
31205491d2cSKalle Valo struct brcmf_pno_scanresults_le {
31305491d2cSKalle Valo 	__le32 version;
31405491d2cSKalle Valo 	__le32 status;
31505491d2cSKalle Valo 	__le32 count;
31605491d2cSKalle Valo };
31705491d2cSKalle Valo 
31805491d2cSKalle Valo /**
31905491d2cSKalle Valo  * struct brcmf_cfg80211_vif_event - virtual interface event information.
32005491d2cSKalle Valo  *
32105491d2cSKalle Valo  * @vif_wq: waitqueue awaiting interface event from firmware.
32205491d2cSKalle Valo  * @vif_event_lock: protects other members in this structure.
32305491d2cSKalle Valo  * @vif_complete: completion for net attach.
32405491d2cSKalle Valo  * @action: either add, change, or delete.
32505491d2cSKalle Valo  * @vif: virtual interface object related to the event.
32605491d2cSKalle Valo  */
32705491d2cSKalle Valo struct brcmf_cfg80211_vif_event {
32805491d2cSKalle Valo 	wait_queue_head_t vif_wq;
32905491d2cSKalle Valo 	struct mutex vif_event_lock;
33005491d2cSKalle Valo 	u8 action;
33105491d2cSKalle Valo 	struct brcmf_cfg80211_vif *vif;
33205491d2cSKalle Valo };
33305491d2cSKalle Valo 
33405491d2cSKalle Valo /**
33505491d2cSKalle Valo  * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface
33605491d2cSKalle Valo  *
33705491d2cSKalle Valo  * @wiphy: wiphy object for cfg80211 interface.
33805491d2cSKalle Valo  * @conf: dongle configuration.
33905491d2cSKalle Valo  * @p2p: peer-to-peer specific information.
34005491d2cSKalle Valo  * @btcoex: Bluetooth coexistence information.
34105491d2cSKalle Valo  * @scan_request: cfg80211 scan request object.
34205491d2cSKalle Valo  * @usr_sync: mainly for dongle up/down synchronization.
34305491d2cSKalle Valo  * @bss_list: bss_list holding scanned ap information.
34405491d2cSKalle Valo  * @scan_req_int: internal scan request object.
34505491d2cSKalle Valo  * @bss_info: bss information for cfg80211 layer.
34605491d2cSKalle Valo  * @ie: information element object for internal purpose.
34705491d2cSKalle Valo  * @conn_info: association info.
34805491d2cSKalle Valo  * @pmk_list: wpa2 pmk list.
34905491d2cSKalle Valo  * @scan_status: scan activity on the dongle.
35005491d2cSKalle Valo  * @pub: common driver information.
35105491d2cSKalle Valo  * @channel: current channel.
35205491d2cSKalle Valo  * @active_scan: current scan mode.
35305491d2cSKalle Valo  * @sched_escan: e-scan for scheduled scan support running.
35405491d2cSKalle Valo  * @ibss_starter: indicates this sta is ibss starter.
35505491d2cSKalle Valo  * @pwr_save: indicate whether dongle to support power save mode.
35605491d2cSKalle Valo  * @dongle_up: indicate whether dongle up or not.
35705491d2cSKalle Valo  * @roam_on: on/off switch for dongle self-roaming.
35805491d2cSKalle Valo  * @scan_tried: indicates if first scan attempted.
35905491d2cSKalle Valo  * @dcmd_buf: dcmd buffer.
36005491d2cSKalle Valo  * @extra_buf: mainly to grab assoc information.
36105491d2cSKalle Valo  * @debugfsdir: debugfs folder for this device.
36205491d2cSKalle Valo  * @escan_info: escan information.
36305491d2cSKalle Valo  * @escan_timeout: Timer for catch scan timeout.
36405491d2cSKalle Valo  * @escan_timeout_work: scan timeout worker.
36505491d2cSKalle Valo  * @escan_ioctl_buf: dongle command buffer for escan commands.
36605491d2cSKalle Valo  * @vif_list: linked list of vif instances.
36705491d2cSKalle Valo  * @vif_cnt: number of vif instances.
36805491d2cSKalle Valo  * @vif_event: vif event signalling.
36905491d2cSKalle Valo  * @wowl_enabled; set during suspend, is wowl used.
37005491d2cSKalle Valo  * @pre_wowl_pmmode: intermediate storage of pm mode during wowl.
37105491d2cSKalle Valo  */
37205491d2cSKalle Valo struct brcmf_cfg80211_info {
37305491d2cSKalle Valo 	struct wiphy *wiphy;
37405491d2cSKalle Valo 	struct brcmf_cfg80211_conf *conf;
37505491d2cSKalle Valo 	struct brcmf_p2p_info p2p;
37605491d2cSKalle Valo 	struct brcmf_btcoex_info *btcoex;
37705491d2cSKalle Valo 	struct cfg80211_scan_request *scan_request;
37805491d2cSKalle Valo 	struct mutex usr_sync;
37905491d2cSKalle Valo 	struct brcmf_cfg80211_scan_req scan_req_int;
38005491d2cSKalle Valo 	struct wl_cfg80211_bss_info *bss_info;
38105491d2cSKalle Valo 	struct brcmf_cfg80211_ie ie;
38205491d2cSKalle Valo 	struct brcmf_cfg80211_connect_info conn_info;
38305491d2cSKalle Valo 	struct brcmf_cfg80211_pmk_list *pmk_list;
38405491d2cSKalle Valo 	unsigned long scan_status;
38505491d2cSKalle Valo 	struct brcmf_pub *pub;
38605491d2cSKalle Valo 	u32 channel;
38705491d2cSKalle Valo 	bool active_scan;
38805491d2cSKalle Valo 	bool sched_escan;
38905491d2cSKalle Valo 	bool ibss_starter;
39005491d2cSKalle Valo 	bool pwr_save;
39105491d2cSKalle Valo 	bool dongle_up;
39205491d2cSKalle Valo 	bool scan_tried;
39305491d2cSKalle Valo 	u8 *dcmd_buf;
39405491d2cSKalle Valo 	u8 *extra_buf;
39505491d2cSKalle Valo 	struct dentry *debugfsdir;
39605491d2cSKalle Valo 	struct escan_info escan_info;
39705491d2cSKalle Valo 	struct timer_list escan_timeout;
39805491d2cSKalle Valo 	struct work_struct escan_timeout_work;
39905491d2cSKalle Valo 	u8 *escan_ioctl_buf;
40005491d2cSKalle Valo 	struct list_head vif_list;
40105491d2cSKalle Valo 	struct brcmf_cfg80211_vif_event vif_event;
40205491d2cSKalle Valo 	struct completion vif_disabled;
40305491d2cSKalle Valo 	struct brcmu_d11inf d11inf;
40405491d2cSKalle Valo 	bool wowl_enabled;
40505491d2cSKalle Valo 	u32 pre_wowl_pmmode;
40605491d2cSKalle Valo 	struct brcmf_assoclist_le assoclist;
40705491d2cSKalle Valo };
40805491d2cSKalle Valo 
40905491d2cSKalle Valo /**
41005491d2cSKalle Valo  * struct brcmf_tlv - tag_ID/length/value_buffer tuple.
41105491d2cSKalle Valo  *
41205491d2cSKalle Valo  * @id: tag identifier.
41305491d2cSKalle Valo  * @len: number of bytes in value buffer.
41405491d2cSKalle Valo  * @data: value buffer.
41505491d2cSKalle Valo  */
41605491d2cSKalle Valo struct brcmf_tlv {
41705491d2cSKalle Valo 	u8 id;
41805491d2cSKalle Valo 	u8 len;
41905491d2cSKalle Valo 	u8 data[1];
42005491d2cSKalle Valo };
42105491d2cSKalle Valo 
42205491d2cSKalle Valo static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg)
42305491d2cSKalle Valo {
42405491d2cSKalle Valo 	return cfg->wiphy;
42505491d2cSKalle Valo }
42605491d2cSKalle Valo 
42705491d2cSKalle Valo static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w)
42805491d2cSKalle Valo {
42905491d2cSKalle Valo 	return (struct brcmf_cfg80211_info *)(wiphy_priv(w));
43005491d2cSKalle Valo }
43105491d2cSKalle Valo 
43205491d2cSKalle Valo static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd)
43305491d2cSKalle Valo {
43405491d2cSKalle Valo 	return (struct brcmf_cfg80211_info *)(wdev_priv(wd));
43505491d2cSKalle Valo }
43605491d2cSKalle Valo 
43705491d2cSKalle Valo static inline
43805491d2cSKalle Valo struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg)
43905491d2cSKalle Valo {
44005491d2cSKalle Valo 	struct brcmf_cfg80211_vif *vif;
44105491d2cSKalle Valo 	vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list);
44205491d2cSKalle Valo 	return vif->wdev.netdev;
44305491d2cSKalle Valo }
44405491d2cSKalle Valo 
44505491d2cSKalle Valo static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev)
44605491d2cSKalle Valo {
44705491d2cSKalle Valo 	return wdev_to_cfg(ndev->ieee80211_ptr);
44805491d2cSKalle Valo }
44905491d2cSKalle Valo 
45005491d2cSKalle Valo static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd)
45105491d2cSKalle Valo {
45205491d2cSKalle Valo 	struct brcmf_if *ifp = netdev_priv(nd);
45305491d2cSKalle Valo 	return &ifp->vif->profile;
45405491d2cSKalle Valo }
45505491d2cSKalle Valo 
45605491d2cSKalle Valo static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev)
45705491d2cSKalle Valo {
45805491d2cSKalle Valo 	struct brcmf_if *ifp = netdev_priv(ndev);
45905491d2cSKalle Valo 	return ifp->vif;
46005491d2cSKalle Valo }
46105491d2cSKalle Valo 
46205491d2cSKalle Valo static inline struct
46305491d2cSKalle Valo brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg)
46405491d2cSKalle Valo {
46505491d2cSKalle Valo 	return &cfg->conn_info;
46605491d2cSKalle Valo }
46705491d2cSKalle Valo 
46805491d2cSKalle Valo struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
46905491d2cSKalle Valo 						  struct device *busdev,
47005491d2cSKalle Valo 						  bool p2pdev_forced);
47105491d2cSKalle Valo void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
47205491d2cSKalle Valo s32 brcmf_cfg80211_up(struct net_device *ndev);
47305491d2cSKalle Valo s32 brcmf_cfg80211_down(struct net_device *ndev);
47405491d2cSKalle Valo enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
47505491d2cSKalle Valo 
47605491d2cSKalle Valo struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
47705491d2cSKalle Valo 					   enum nl80211_iftype type,
47805491d2cSKalle Valo 					   bool pm_block);
47905491d2cSKalle Valo void brcmf_free_vif(struct brcmf_cfg80211_vif *vif);
48005491d2cSKalle Valo 
48105491d2cSKalle Valo s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
48205491d2cSKalle Valo 			  const u8 *vndr_ie_buf, u32 vndr_ie_len);
48305491d2cSKalle Valo s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif);
48405491d2cSKalle Valo const struct brcmf_tlv *
48505491d2cSKalle Valo brcmf_parse_tlvs(const void *buf, int buflen, uint key);
48605491d2cSKalle Valo u16 channel_to_chanspec(struct brcmu_d11inf *d11inf,
48705491d2cSKalle Valo 			struct ieee80211_channel *ch);
48805491d2cSKalle Valo bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg,
48905491d2cSKalle Valo 			     unsigned long state);
49005491d2cSKalle Valo void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
49105491d2cSKalle Valo 				  struct brcmf_cfg80211_vif *vif);
49205491d2cSKalle Valo bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
49305491d2cSKalle Valo int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg,
49405491d2cSKalle Valo 					  u8 action, ulong timeout);
49505491d2cSKalle Valo s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
49605491d2cSKalle Valo 				struct brcmf_if *ifp, bool aborted,
49705491d2cSKalle Valo 				bool fw_abort);
49805491d2cSKalle Valo void brcmf_set_mpc(struct brcmf_if *ndev, int mpc);
49905491d2cSKalle Valo void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg);
50005491d2cSKalle Valo void brcmf_cfg80211_free_netdev(struct net_device *ndev);
50105491d2cSKalle Valo 
50205491d2cSKalle Valo #endif /* BRCMFMAC_CFG80211_H */
503