// SPDX-License-Identifier: ISC /* * Copyright (c) 2010 Broadcom Corporation */ #ifndef BRCMFMAC_CFG80211_H #define BRCMFMAC_CFG80211_H /* for brcmu_d11inf */ #include <brcmu_d11.h> #include "core.h" #include "fwil_types.h" #include "p2p.h" #define BRCMF_SCAN_IE_LEN_MAX … #define WL_NUM_SCAN_MAX … #define WL_TLV_INFO_MAX … #define WL_BSS_INFO_MAX … #define WL_ASSOC_INFO_MAX … #define WL_EXTRA_BUF_MAX … #define WL_ROAM_TRIGGER_LEVEL … #define WL_ROAM_DELTA … /* WME Access Category Indices (ACIs) */ #define AC_BE … #define AC_BK … #define AC_VI … #define AC_VO … #define EDCF_AC_COUNT … #define MAX_8021D_PRIO … #define EDCF_ACI_MASK … #define EDCF_ACI_SHIFT … #define EDCF_ACM_MASK … #define EDCF_ECWMIN_MASK … #define EDCF_ECWMAX_SHIFT … #define EDCF_AIFSN_MASK … #define EDCF_AIFSN_MAX … #define EDCF_ECWMAX_MASK … /* Keep BRCMF_ESCAN_BUF_SIZE below 64K (65536). Allocing over 64K can be * problematic on some systems and should be avoided. */ #define BRCMF_ESCAN_BUF_SIZE … #define BRCMF_ESCAN_TIMER_INTERVAL_MS … #define WL_ESCAN_ACTION_START … #define WL_ESCAN_ACTION_CONTINUE … #define WL_ESCAN_ACTION_ABORT … #define WL_AUTH_SHARED_KEY … #define IE_MAX_LEN … /* IE TLV processing */ #define TLV_LEN_OFF … #define TLV_HDR_LEN … #define TLV_BODY_OFF … #define TLV_OUI_LEN … /* 802.11 Mgmt Packet flags */ #define BRCMF_VNDR_IE_BEACON_FLAG … #define BRCMF_VNDR_IE_PRBRSP_FLAG … #define BRCMF_VNDR_IE_ASSOCRSP_FLAG … #define BRCMF_VNDR_IE_AUTHRSP_FLAG … #define BRCMF_VNDR_IE_PRBREQ_FLAG … #define BRCMF_VNDR_IE_ASSOCREQ_FLAG … /* vendor IE in IW advertisement protocol ID field */ #define BRCMF_VNDR_IE_IWAPID_FLAG … /* allow custom IE id */ #define BRCMF_VNDR_IE_CUSTOM_FLAG … /* P2P Action Frames flags (spec ordered) */ #define BRCMF_VNDR_IE_GONREQ_FLAG … #define BRCMF_VNDR_IE_GONRSP_FLAG … #define BRCMF_VNDR_IE_GONCFM_FLAG … #define BRCMF_VNDR_IE_INVREQ_FLAG … #define BRCMF_VNDR_IE_INVRSP_FLAG … #define BRCMF_VNDR_IE_DISREQ_FLAG … #define BRCMF_VNDR_IE_DISRSP_FLAG … #define BRCMF_VNDR_IE_PRDREQ_FLAG … #define BRCMF_VNDR_IE_PRDRSP_FLAG … #define BRCMF_VNDR_IE_P2PAF_SHIFT … #define BRCMF_MAX_DEFAULT_KEYS … /* beacon loss timeout defaults */ #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON … #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF … #define BRCMF_VIF_EVENT_TIMEOUT … /** * enum brcmf_scan_status - scan engine status * * @BRCMF_SCAN_STATUS_BUSY: scanning in progress on dongle. * @BRCMF_SCAN_STATUS_ABORT: scan being aborted on dongle. * @BRCMF_SCAN_STATUS_SUPPRESS: scanning is suppressed in driver. */ enum brcmf_scan_status { … }; /* dongle configuration */ struct brcmf_cfg80211_conf { … }; /* security information with currently associated ap */ struct brcmf_cfg80211_security { … }; enum brcmf_profile_fwsup { … }; /** * enum brcmf_profile_fwauth - firmware authenticator profile * * @BRCMF_PROFILE_FWAUTH_NONE: no firmware authenticator * @BRCMF_PROFILE_FWAUTH_PSK: authenticator for WPA/WPA2-PSK * @BRCMF_PROFILE_FWAUTH_SAE: authenticator for SAE */ enum brcmf_profile_fwauth { … }; /** * struct brcmf_cfg80211_profile - profile information. * * @bssid: bssid of joined/joining ibss. * @sec: security information. * @key: key information */ struct brcmf_cfg80211_profile { … }; /** * enum brcmf_vif_status - bit indices for vif status. * * @BRCMF_VIF_STATUS_READY: ready for operation. * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress. * @BRCMF_VIF_STATUS_CONNECTED: connected/joined successfully. * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress. * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started. * @BRCMF_VIF_STATUS_EAP_SUCCUSS: EAPOL handshake successful. * @BRCMF_VIF_STATUS_ASSOC_SUCCESS: successful SET_SSID received. */ enum brcmf_vif_status { … }; /** * struct vif_saved_ie - holds saved IEs for a virtual interface. * * @probe_req_ie: IE info for probe request. * @probe_res_ie: IE info for probe response. * @beacon_ie: IE info for beacon frame. * @assoc_res_ie: IE info for association response frame. * @probe_req_ie_len: IE info length for probe request. * @probe_res_ie_len: IE info length for probe response. * @beacon_ie_len: IE info length for beacon frame. * @assoc_res_ie_len: IE info length for association response frame. */ struct vif_saved_ie { … }; /** * struct brcmf_cfg80211_vif - virtual interface specific information. * * @ifp: lower layer interface pointer * @wdev: wireless device. * @profile: profile information. * @sme_state: SME state using enum brcmf_vif_status bits. * @list: linked list. * @mgmt_rx_reg: registered rx mgmt frame types. * @mbss: Multiple BSS type, set if not first AP (not relevant for P2P). * @cqm_rssi_low: Lower RSSI limit for CQM monitoring * @cqm_rssi_high: Upper RSSI limit for CQM monitoring * @cqm_rssi_last: Last RSSI reading for CQM monitoring */ struct brcmf_cfg80211_vif { … }; /* association inform */ struct brcmf_cfg80211_connect_info { … }; /* assoc ie length */ struct brcmf_cfg80211_assoc_ielen_le { … }; struct brcmf_cfg80211_edcf_acparam { … }; /* dongle escan state */ enum wl_escan_state { … }; struct escan_info { … }; /** * struct brcmf_cfg80211_vif_event - virtual interface event information. * * @vif_wq: waitqueue awaiting interface event from firmware. * @vif_event_lock: protects other members in this structure. * @vif_complete: completion for net attach. * @action: either add, change, or delete. * @vif: virtual interface object related to the event. */ struct brcmf_cfg80211_vif_event { … }; /** * struct brcmf_cfg80211_wowl - wowl related information. * * @active: set on suspend, cleared on resume. * @pre_pmmode: firmware PM mode at entering suspend. * @nd: net dectect data. * @nd_info: helper struct to pass to cfg80211. * @nd_data_wait: wait queue to sync net detect data. * @nd_data_completed: completion for net detect data. * @nd_enabled: net detect enabled. */ struct brcmf_cfg80211_wowl { … }; /** * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface * * @wiphy: wiphy object for cfg80211 interface. * @ops: pointer to copy of ops as registered with wiphy object. * @conf: dongle configuration. * @p2p: peer-to-peer specific information. * @btcoex: Bluetooth coexistence information. * @scan_request: cfg80211 scan request object. * @usr_sync: mainly for dongle up/down synchronization. * @bss_list: bss_list holding scanned ap information. * @bss_info: bss information for cfg80211 layer. * @conn_info: association info. * @pmk_list: wpa2 pmk list. * @scan_status: scan activity on the dongle. * @pub: common driver information. * @channel: current channel. * @int_escan_map: bucket map for which internal e-scan is done. * @ibss_starter: indicates this sta is ibss starter. * @pwr_save: indicate whether dongle to support power save mode. * @dongle_up: indicate whether dongle up or not. * @roam_on: on/off switch for dongle self-roaming. * @scan_tried: indicates if first scan attempted. * @dcmd_buf: dcmd buffer. * @extra_buf: mainly to grab assoc information. * @debugfsdir: debugfs folder for this device. * @escan_info: escan information. * @escan_timeout: Timer for catch scan timeout. * @escan_timeout_work: scan timeout worker. * @vif_list: linked list of vif instances. * @vif_cnt: number of vif instances. * @vif_event: vif event signalling. * @wowl: wowl related information. * @pno: information of pno module. */ struct brcmf_cfg80211_info { … }; /** * struct brcmf_tlv - tag_ID/length/value_buffer tuple. * * @id: tag identifier. * @len: number of bytes in value buffer. * @data: value buffer. */ struct brcmf_tlv { … }; static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg) { … } static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w) { … } static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd) { … } static inline struct brcmf_cfg80211_vif *wdev_to_vif(struct wireless_dev *wdev) { … } static inline struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg) { … } static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev) { … } static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd) { … } static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev) { … } static inline struct brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg) { … } struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, struct cfg80211_ops *ops, bool p2pdev_forced); void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); s32 brcmf_cfg80211_up(struct net_device *ndev); s32 brcmf_cfg80211_down(struct net_device *ndev); struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings); enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, enum nl80211_iftype type); void brcmf_free_vif(struct brcmf_cfg80211_vif *vif); s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, const u8 *vndr_ie_buf, u32 vndr_ie_len); s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif); u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, struct ieee80211_channel *ch); bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg, unsigned long state); void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, struct brcmf_cfg80211_vif *vif); bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg); int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg, u8 action, ulong timeout); s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, bool aborted, bool fw_abort); void brcmf_set_mpc(struct brcmf_if *ndev, int mpc); void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg); void brcmf_cfg80211_free_netdev(struct net_device *ndev); int brcmf_set_wsec(struct brcmf_if *ifp, const u8 *key, u16 key_len, u16 flags); #endif /* BRCMFMAC_CFG80211_H */