FILE
cfg80211.h
File preview with syntax highlighting.
linux-6.19.14/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
1// SPDX-License-Identifier: ISC 2/* 3 * Copyright (c) 2010 Broadcom Corporation 4 */ 5 6#ifndef BRCMFMAC_CFG80211_H 7#define BRCMFMAC_CFG80211_H 8 9/* for brcmu_d11inf */ 10#include <brcmu_d11.h> 11 12#include "core.h" 13#include "fwil_types.h" 14#include "p2p.h" 15 16#define DOT11_MGMT_HDR_LEN 24 /* d11 management header len */ 17 18#define BRCMF_SCAN_IE_LEN_MAX 2048 19 20#define WL_NUM_SCAN_MAX 10 21#define WL_TLV_INFO_MAX 1024 22#define WL_BSS_INFO_MAX 2048 23#define WL_ASSOC_INFO_MAX 512 /* assoc related fil max buf */ 24#define WL_EXTRA_BUF_MAX 2048 25#define WL_ROAM_TRIGGER_LEVEL -75 26#define WL_ROAM_DELTA 20 27 28/* WME Access Category Indices (ACIs) */ 29#define AC_BE 0 /* Best Effort */ 30#define AC_BK 1 /* Background */ 31#define AC_VI 2 /* Video */ 32#define AC_VO 3 /* Voice */ 33#define EDCF_AC_COUNT 4 34#define MAX_8021D_PRIO 8 35 36#define EDCF_ACI_MASK 0x60 37#define EDCF_ACI_SHIFT 5 38#define EDCF_ACM_MASK 0x10 39#define EDCF_ECWMIN_MASK 0x0f 40#define EDCF_ECWMAX_SHIFT 4 41#define EDCF_AIFSN_MASK 0x0f 42#define EDCF_AIFSN_MAX 15 43#define EDCF_ECWMAX_MASK 0xf0 44 45/* Keep BRCMF_ESCAN_BUF_SIZE below 64K (65536). Allocing over 64K can be 46 * problematic on some systems and should be avoided. 47 */ 48#define BRCMF_ESCAN_BUF_SIZE 65000 49#define BRCMF_ESCAN_TIMER_INTERVAL_MS 10000 /* E-Scan timeout */ 50 51#define WL_ESCAN_ACTION_START 1 52#define WL_ESCAN_ACTION_CONTINUE 2 53#define WL_ESCAN_ACTION_ABORT 3 54 55#define WL_AUTH_SHARED_KEY 1 /* d11 shared authentication */ 56#define IE_MAX_LEN 512 57 58/* IE TLV processing */ 59#define TLV_LEN_OFF 1 /* length offset */ 60#define TLV_HDR_LEN 2 /* header length */ 61#define TLV_BODY_OFF 2 /* body offset */ 62#define TLV_OUI_LEN 3 /* oui id length */ 63 64/* 802.11 Mgmt Packet flags */ 65#define BRCMF_VNDR_IE_BEACON_FLAG 0x1 66#define BRCMF_VNDR_IE_PRBRSP_FLAG 0x2 67#define BRCMF_VNDR_IE_ASSOCRSP_FLAG 0x4 68#define BRCMF_VNDR_IE_AUTHRSP_FLAG 0x8 69#define BRCMF_VNDR_IE_PRBREQ_FLAG 0x10 70#define BRCMF_VNDR_IE_ASSOCREQ_FLAG 0x20 71/* vendor IE in IW advertisement protocol ID field */ 72#define BRCMF_VNDR_IE_IWAPID_FLAG 0x40 73/* allow custom IE id */ 74#define BRCMF_VNDR_IE_CUSTOM_FLAG 0x100 75 76/* P2P Action Frames flags (spec ordered) */ 77#define BRCMF_VNDR_IE_GONREQ_FLAG 0x001000 78#define BRCMF_VNDR_IE_GONRSP_FLAG 0x002000 79#define BRCMF_VNDR_IE_GONCFM_FLAG 0x004000 80#define BRCMF_VNDR_IE_INVREQ_FLAG 0x008000 81#define BRCMF_VNDR_IE_INVRSP_FLAG 0x010000 82#define BRCMF_VNDR_IE_DISREQ_FLAG 0x020000 83#define BRCMF_VNDR_IE_DISRSP_FLAG 0x040000 84#define BRCMF_VNDR_IE_PRDREQ_FLAG 0x080000 85#define BRCMF_VNDR_IE_PRDRSP_FLAG 0x100000 86 87#define BRCMF_VNDR_IE_P2PAF_SHIFT 12 88 89#define BRCMF_MAX_DEFAULT_KEYS 6 90 91/* beacon loss timeout defaults */ 92#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2 93#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF 4 94 95#define BRCMF_VIF_EVENT_TIMEOUT msecs_to_jiffies(1500) 96 97/** 98 * enum brcmf_scan_status - scan engine status 99 * 100 * @BRCMF_SCAN_STATUS_BUSY: scanning in progress on dongle. 101 * @BRCMF_SCAN_STATUS_ABORT: scan being aborted on dongle. 102 * @BRCMF_SCAN_STATUS_SUPPRESS: scanning is suppressed in driver. 103 */ 104enum brcmf_scan_status { 105 BRCMF_SCAN_STATUS_BUSY, 106 BRCMF_SCAN_STATUS_ABORT, 107 BRCMF_SCAN_STATUS_SUPPRESS, 108}; 109 110/* dongle configuration */ 111struct brcmf_cfg80211_conf { 112 u32 frag_threshold; 113 u32 rts_threshold; 114 u32 retry_short; 115 u32 retry_long; 116}; 117 118/* security information with currently associated ap */ 119struct brcmf_cfg80211_security { 120 u32 wpa_versions; 121 u32 auth_type; 122 u32 cipher_pairwise; 123 u32 cipher_group; 124}; 125 126enum brcmf_profile_fwsup { 127 BRCMF_PROFILE_FWSUP_NONE, 128 BRCMF_PROFILE_FWSUP_PSK, 129 BRCMF_PROFILE_FWSUP_1X, 130 BRCMF_PROFILE_FWSUP_SAE 131}; 132 133/** 134 * enum brcmf_profile_fwauth - firmware authenticator profile 135 * 136 * @BRCMF_PROFILE_FWAUTH_NONE: no firmware authenticator 137 * @BRCMF_PROFILE_FWAUTH_PSK: authenticator for WPA/WPA2-PSK 138 * @BRCMF_PROFILE_FWAUTH_SAE: authenticator for SAE 139 */ 140enum brcmf_profile_fwauth { 141 BRCMF_PROFILE_FWAUTH_NONE, 142 BRCMF_PROFILE_FWAUTH_PSK, 143 BRCMF_PROFILE_FWAUTH_SAE 144}; 145 146/** 147 * enum brcmf_mgmt_tx_status - mgmt frame tx status 148 * 149 * @BRCMF_MGMT_TX_ACK: mgmt frame acked 150 * @BRCMF_MGMT_TX_NOACK: mgmt frame not acked 151 * @BRCMF_MGMT_TX_OFF_CHAN_COMPLETED: off-channel complete 152 * @BRCMF_MGMT_TX_SEND_FRAME: mgmt frame tx is in progres 153 */ 154enum brcmf_mgmt_tx_status { 155 BRCMF_MGMT_TX_ACK, 156 BRCMF_MGMT_TX_NOACK, 157 BRCMF_MGMT_TX_OFF_CHAN_COMPLETED, 158 BRCMF_MGMT_TX_SEND_FRAME 159}; 160 161/** 162 * struct brcmf_cfg80211_profile - profile information. 163 * 164 * @bssid: bssid of joined/joining ibss. 165 * @sec: security information. 166 * @key: key information 167 */ 168struct brcmf_cfg80211_profile { 169 u8 bssid[ETH_ALEN]; 170 struct brcmf_cfg80211_security sec; 171 struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS]; 172 enum brcmf_profile_fwsup use_fwsup; 173 u16 use_fwauth; 174 bool is_ft; 175}; 176 177/** 178 * enum brcmf_vif_status - bit indices for vif status. 179 * 180 * @BRCMF_VIF_STATUS_READY: ready for operation. 181 * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress. 182 * @BRCMF_VIF_STATUS_CONNECTED: connected/joined successfully. 183 * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress. 184 * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started. 185 * @BRCMF_VIF_STATUS_EAP_SUCCUSS: EAPOL handshake successful. 186 * @BRCMF_VIF_STATUS_ASSOC_SUCCESS: successful SET_SSID received. 187 */ 188enum brcmf_vif_status { 189 BRCMF_VIF_STATUS_READY, 190 BRCMF_VIF_STATUS_CONNECTING, 191 BRCMF_VIF_STATUS_CONNECTED, 192 BRCMF_VIF_STATUS_DISCONNECTING, 193 BRCMF_VIF_STATUS_AP_CREATED, 194 BRCMF_VIF_STATUS_EAP_SUCCESS, 195 BRCMF_VIF_STATUS_ASSOC_SUCCESS, 196}; 197 198/** 199 * struct vif_saved_ie - holds saved IEs for a virtual interface. 200 * 201 * @probe_req_ie: IE info for probe request. 202 * @probe_res_ie: IE info for probe response. 203 * @beacon_ie: IE info for beacon frame. 204 * @assoc_res_ie: IE info for association response frame. 205 * @probe_req_ie_len: IE info length for probe request. 206 * @probe_res_ie_len: IE info length for probe response. 207 * @beacon_ie_len: IE info length for beacon frame. 208 * @assoc_res_ie_len: IE info length for association response frame. 209 */ 210struct vif_saved_ie { 211 u8 probe_req_ie[IE_MAX_LEN]; 212 u8 probe_res_ie[IE_MAX_LEN]; 213 u8 beacon_ie[IE_MAX_LEN]; 214 u8 assoc_req_ie[IE_MAX_LEN]; 215 u8 assoc_res_ie[IE_MAX_LEN]; 216 u32 probe_req_ie_len; 217 u32 probe_res_ie_len; 218 u32 beacon_ie_len; 219 u32 assoc_req_ie_len; 220 u32 assoc_res_ie_len; 221}; 222 223/** 224 * struct brcmf_cfg80211_vif - virtual interface specific information. 225 * 226 * @ifp: lower layer interface pointer 227 * @wdev: wireless device. 228 * @profile: profile information. 229 * @sme_state: SME state using enum brcmf_vif_status bits. 230 * @list: linked list. 231 * @mgmt_tx: completion for management frame transmit. 232 * @mgmt_tx_status: status of last management frame sent to firmware. 233 * @mgmt_tx_id: 234 * @mgmt_rx_reg: registered rx mgmt frame types. 235 * @mbss: Multiple BSS type, set if not first AP (not relevant for P2P). 236 * @cqm_rssi_low: Lower RSSI limit for CQM monitoring 237 * @cqm_rssi_high: Upper RSSI limit for CQM monitoring 238 * @cqm_rssi_last: Last RSSI reading for CQM monitoring 239 */ 240struct brcmf_cfg80211_vif { 241 struct brcmf_if *ifp; 242 struct wireless_dev wdev; 243 struct brcmf_cfg80211_profile profile; 244 unsigned long sme_state; 245 struct vif_saved_ie saved_ie; 246 struct list_head list; 247 struct completion mgmt_tx; 248 unsigned long mgmt_tx_status; 249 u32 mgmt_tx_id; 250 u16 mgmt_rx_reg; 251 bool mbss; 252 int is_11d; 253 s32 cqm_rssi_low; 254 s32 cqm_rssi_high; 255 s32 cqm_rssi_last; 256}; 257 258/* association inform */ 259struct brcmf_cfg80211_connect_info { 260 u8 *req_ie; 261 s32 req_ie_len; 262 u8 *resp_ie; 263 s32 resp_ie_len; 264}; 265 266/* assoc ie length */ 267struct brcmf_cfg80211_assoc_ielen_le { 268 __le32 req_len; 269 __le32 resp_len; 270}; 271 272struct brcmf_cfg80211_edcf_acparam { 273 u8 ACI; 274 u8 ECW; 275 u16 TXOP; /* stored in network order (ls octet first) */ 276}; 277 278/* dongle escan state */ 279enum wl_escan_state { 280 WL_ESCAN_STATE_IDLE, 281 WL_ESCAN_STATE_SCANNING 282}; 283 284struct escan_info { 285 u32 escan_state; 286 u8 *escan_buf; 287 struct wiphy *wiphy; 288 struct brcmf_if *ifp; 289 s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, 290 struct cfg80211_scan_request *request); 291}; 292 293/** 294 * struct brcmf_cfg80211_vif_event - virtual interface event information. 295 * 296 * @vif_wq: waitqueue awaiting interface event from firmware. 297 * @vif_event_lock: protects other members in this structure. 298 * @vif_complete: completion for net attach. 299 * @action: either add, change, or delete. 300 * @vif: virtual interface object related to the event. 301 */ 302struct brcmf_cfg80211_vif_event { 303 wait_queue_head_t vif_wq; 304 spinlock_t vif_event_lock; 305 u8 action; 306 struct brcmf_cfg80211_vif *vif; 307}; 308 309/** 310 * struct brcmf_cfg80211_wowl - wowl related information. 311 * 312 * @active: set on suspend, cleared on resume. 313 * @pre_pmmode: firmware PM mode at entering suspend. 314 * @nd: net dectect data. 315 * @nd_info: helper struct to pass to cfg80211. 316 * @nd_data_wait: wait queue to sync net detect data. 317 * @nd_data_completed: completion for net detect data. 318 * @nd_enabled: net detect enabled. 319 */ 320struct brcmf_cfg80211_wowl { 321 bool active; 322 u32 pre_pmmode; 323 struct cfg80211_wowlan_nd_match *nd; 324 struct cfg80211_wowlan_nd_info *nd_info; 325 wait_queue_head_t nd_data_wait; 326 bool nd_data_completed; 327 bool nd_enabled; 328}; 329 330/** 331 * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface 332 * 333 * @wiphy: wiphy object for cfg80211 interface. 334 * @ops: pointer to copy of ops as registered with wiphy object. 335 * @conf: dongle configuration. 336 * @p2p: peer-to-peer specific information. 337 * @btcoex: Bluetooth coexistence information. 338 * @scan_request: cfg80211 scan request object. 339 * @usr_sync: mainly for dongle up/down synchronization. 340 * @bss_list: bss_list holding scanned ap information. 341 * @bss_info: bss information for cfg80211 layer. 342 * @conn_info: association info. 343 * @pmk_list: wpa2 pmk list. 344 * @scan_status: scan activity on the dongle. 345 * @pub: common driver information. 346 * @channel: current channel. 347 * @int_escan_map: bucket map for which internal e-scan is done. 348 * @ibss_starter: indicates this sta is ibss starter. 349 * @pwr_save: indicate whether dongle to support power save mode. 350 * @dongle_up: indicate whether dongle up or not. 351 * @roam_on: on/off switch for dongle self-roaming. 352 * @scan_tried: indicates if first scan attempted. 353 * @dcmd_buf: dcmd buffer. 354 * @extra_buf: mainly to grab assoc information. 355 * @debugfsdir: debugfs folder for this device. 356 * @escan_info: escan information. 357 * @escan_timeout: Timer for catch scan timeout. 358 * @escan_timeout_work: scan timeout worker. 359 * @vif_list: linked list of vif instances. 360 * @vif_cnt: number of vif instances. 361 * @vif_event: vif event signalling. 362 * @wowl: wowl related information. 363 * @pno: information of pno module. 364 */ 365struct brcmf_cfg80211_info { 366 struct wiphy *wiphy; 367 struct brcmf_cfg80211_conf *conf; 368 struct brcmf_p2p_info p2p; 369 struct brcmf_btcoex_info *btcoex; 370 struct cfg80211_scan_request *scan_request; 371 struct mutex usr_sync; 372 struct wl_cfg80211_bss_info *bss_info; 373 struct brcmf_cfg80211_connect_info conn_info; 374 struct brcmf_pmk_list_le pmk_list; 375 unsigned long scan_status; 376 struct brcmf_pub *pub; 377 u32 channel; 378 u32 int_escan_map; 379 bool ibss_starter; 380 bool pwr_save; 381 bool dongle_up; 382 bool scan_tried; 383 u8 *dcmd_buf; 384 u8 *extra_buf; 385 struct dentry *debugfsdir; 386 struct escan_info escan_info; 387 struct timer_list escan_timeout; 388 struct work_struct escan_timeout_work; 389 struct list_head vif_list; 390 struct brcmf_cfg80211_vif_event vif_event; 391 struct completion vif_disabled; 392 struct brcmu_d11inf d11inf; 393 struct brcmf_assoclist_le assoclist; 394 struct brcmf_cfg80211_wowl wowl; 395 struct brcmf_pno_info *pno; 396 u8 ac_priority[MAX_8021D_PRIO]; 397}; 398 399/** 400 * struct brcmf_tlv - tag_ID/length/value_buffer tuple. 401 * 402 * @id: tag identifier. 403 * @len: number of bytes in value buffer. 404 * @data: value buffer. 405 */ 406struct brcmf_tlv { 407 u8 id; 408 u8 len; 409 u8 data[]; 410}; 411 412static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg) 413{ 414 return cfg->wiphy; 415} 416 417static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w) 418{ 419 struct brcmf_pub *drvr = wiphy_priv(w); 420 return drvr->config; 421} 422 423static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd) 424{ 425 return wiphy_to_cfg(wd->wiphy); 426} 427 428static inline struct brcmf_cfg80211_vif *wdev_to_vif(struct wireless_dev *wdev) 429{ 430 return container_of(wdev, struct brcmf_cfg80211_vif, wdev); 431} 432 433static inline 434struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg) 435{ 436 return brcmf_get_ifp(cfg->pub, 0)->ndev; 437} 438 439static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev) 440{ 441 return wdev_to_cfg(ndev->ieee80211_ptr); 442} 443 444static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd) 445{ 446 struct brcmf_if *ifp = netdev_priv(nd); 447 return &ifp->vif->profile; 448} 449 450static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev) 451{ 452 struct brcmf_if *ifp = netdev_priv(ndev); 453 return ifp->vif; 454} 455 456static inline struct 457brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg) 458{ 459 return &cfg->conn_info; 460} 461 462struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, 463 struct cfg80211_ops *ops, 464 bool p2pdev_forced); 465void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); 466s32 brcmf_cfg80211_up(struct net_device *ndev); 467s32 brcmf_cfg80211_down(struct net_device *ndev); 468struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings); 469 470struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, 471 enum nl80211_iftype type); 472void brcmf_free_vif(struct brcmf_cfg80211_vif *vif); 473 474s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, 475 const u8 *vndr_ie_buf, u32 vndr_ie_len); 476s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif); 477u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, 478 struct ieee80211_channel *ch); 479bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg, 480 unsigned long state); 481void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, 482 struct brcmf_cfg80211_vif *vif); 483bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg); 484int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg, 485 u8 action, ulong timeout); 486s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, 487 struct brcmf_if *ifp, bool aborted, 488 bool fw_abort); 489void brcmf_set_mpc(struct brcmf_if *ndev, int mpc); 490bool brcmf_is_apmode_operating(struct wiphy *wiphy); 491void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg); 492void brcmf_cfg80211_free_netdev(struct net_device *ndev); 493 494int brcmf_set_wsec(struct brcmf_if *ifp, const u8 *key, u16 key_len, u16 flags); 495int brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, 496 struct cfg80211_mgmt_tx_params *params, u64 *cookie); 497 498#endif /* BRCMFMAC_CFG80211_H */
~/
Read-only file preview.