0001
0002
0003
0004
0005
0006 #ifndef BRCMFMAC_CFG80211_H
0007 #define BRCMFMAC_CFG80211_H
0008
0009
0010 #include <brcmu_d11.h>
0011
0012 #include "core.h"
0013 #include "fwil_types.h"
0014 #include "p2p.h"
0015
0016 #define BRCMF_SCAN_IE_LEN_MAX 2048
0017
0018 #define WL_NUM_SCAN_MAX 10
0019 #define WL_TLV_INFO_MAX 1024
0020 #define WL_BSS_INFO_MAX 2048
0021 #define WL_ASSOC_INFO_MAX 512
0022 #define WL_EXTRA_BUF_MAX 2048
0023 #define WL_ROAM_TRIGGER_LEVEL -75
0024 #define WL_ROAM_DELTA 20
0025
0026
0027 #define AC_BE 0
0028 #define AC_BK 1
0029 #define AC_VI 2
0030 #define AC_VO 3
0031 #define EDCF_AC_COUNT 4
0032 #define MAX_8021D_PRIO 8
0033
0034 #define EDCF_ACI_MASK 0x60
0035 #define EDCF_ACI_SHIFT 5
0036 #define EDCF_ACM_MASK 0x10
0037 #define EDCF_ECWMIN_MASK 0x0f
0038 #define EDCF_ECWMAX_SHIFT 4
0039 #define EDCF_AIFSN_MASK 0x0f
0040 #define EDCF_AIFSN_MAX 15
0041 #define EDCF_ECWMAX_MASK 0xf0
0042
0043
0044
0045
0046 #define BRCMF_ESCAN_BUF_SIZE 65000
0047 #define BRCMF_ESCAN_TIMER_INTERVAL_MS 10000
0048
0049 #define WL_ESCAN_ACTION_START 1
0050 #define WL_ESCAN_ACTION_CONTINUE 2
0051 #define WL_ESCAN_ACTION_ABORT 3
0052
0053 #define WL_AUTH_SHARED_KEY 1
0054 #define IE_MAX_LEN 512
0055
0056
0057 #define TLV_LEN_OFF 1
0058 #define TLV_HDR_LEN 2
0059 #define TLV_BODY_OFF 2
0060 #define TLV_OUI_LEN 3
0061
0062
0063 #define BRCMF_VNDR_IE_BEACON_FLAG 0x1
0064 #define BRCMF_VNDR_IE_PRBRSP_FLAG 0x2
0065 #define BRCMF_VNDR_IE_ASSOCRSP_FLAG 0x4
0066 #define BRCMF_VNDR_IE_AUTHRSP_FLAG 0x8
0067 #define BRCMF_VNDR_IE_PRBREQ_FLAG 0x10
0068 #define BRCMF_VNDR_IE_ASSOCREQ_FLAG 0x20
0069
0070 #define BRCMF_VNDR_IE_IWAPID_FLAG 0x40
0071
0072 #define BRCMF_VNDR_IE_CUSTOM_FLAG 0x100
0073
0074
0075 #define BRCMF_VNDR_IE_GONREQ_FLAG 0x001000
0076 #define BRCMF_VNDR_IE_GONRSP_FLAG 0x002000
0077 #define BRCMF_VNDR_IE_GONCFM_FLAG 0x004000
0078 #define BRCMF_VNDR_IE_INVREQ_FLAG 0x008000
0079 #define BRCMF_VNDR_IE_INVRSP_FLAG 0x010000
0080 #define BRCMF_VNDR_IE_DISREQ_FLAG 0x020000
0081 #define BRCMF_VNDR_IE_DISRSP_FLAG 0x040000
0082 #define BRCMF_VNDR_IE_PRDREQ_FLAG 0x080000
0083 #define BRCMF_VNDR_IE_PRDRSP_FLAG 0x100000
0084
0085 #define BRCMF_VNDR_IE_P2PAF_SHIFT 12
0086
0087 #define BRCMF_MAX_DEFAULT_KEYS 6
0088
0089
0090 #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2
0091 #define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF 4
0092
0093 #define BRCMF_VIF_EVENT_TIMEOUT msecs_to_jiffies(1500)
0094
0095
0096
0097
0098
0099
0100
0101
0102 enum brcmf_scan_status {
0103 BRCMF_SCAN_STATUS_BUSY,
0104 BRCMF_SCAN_STATUS_ABORT,
0105 BRCMF_SCAN_STATUS_SUPPRESS,
0106 };
0107
0108
0109 struct brcmf_cfg80211_conf {
0110 u32 frag_threshold;
0111 u32 rts_threshold;
0112 u32 retry_short;
0113 u32 retry_long;
0114 };
0115
0116
0117 struct brcmf_cfg80211_security {
0118 u32 wpa_versions;
0119 u32 auth_type;
0120 u32 cipher_pairwise;
0121 u32 cipher_group;
0122 };
0123
0124 enum brcmf_profile_fwsup {
0125 BRCMF_PROFILE_FWSUP_NONE,
0126 BRCMF_PROFILE_FWSUP_PSK,
0127 BRCMF_PROFILE_FWSUP_1X,
0128 BRCMF_PROFILE_FWSUP_SAE
0129 };
0130
0131
0132
0133
0134
0135
0136
0137
0138 enum brcmf_profile_fwauth {
0139 BRCMF_PROFILE_FWAUTH_NONE,
0140 BRCMF_PROFILE_FWAUTH_PSK,
0141 BRCMF_PROFILE_FWAUTH_SAE
0142 };
0143
0144
0145
0146
0147
0148
0149
0150
0151 struct brcmf_cfg80211_profile {
0152 u8 bssid[ETH_ALEN];
0153 struct brcmf_cfg80211_security sec;
0154 struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
0155 enum brcmf_profile_fwsup use_fwsup;
0156 u16 use_fwauth;
0157 bool is_ft;
0158 };
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171 enum brcmf_vif_status {
0172 BRCMF_VIF_STATUS_READY,
0173 BRCMF_VIF_STATUS_CONNECTING,
0174 BRCMF_VIF_STATUS_CONNECTED,
0175 BRCMF_VIF_STATUS_DISCONNECTING,
0176 BRCMF_VIF_STATUS_AP_CREATED,
0177 BRCMF_VIF_STATUS_EAP_SUCCESS,
0178 BRCMF_VIF_STATUS_ASSOC_SUCCESS,
0179 };
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193 struct vif_saved_ie {
0194 u8 probe_req_ie[IE_MAX_LEN];
0195 u8 probe_res_ie[IE_MAX_LEN];
0196 u8 beacon_ie[IE_MAX_LEN];
0197 u8 assoc_req_ie[IE_MAX_LEN];
0198 u8 assoc_res_ie[IE_MAX_LEN];
0199 u32 probe_req_ie_len;
0200 u32 probe_res_ie_len;
0201 u32 beacon_ie_len;
0202 u32 assoc_req_ie_len;
0203 u32 assoc_res_ie_len;
0204 };
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220 struct brcmf_cfg80211_vif {
0221 struct brcmf_if *ifp;
0222 struct wireless_dev wdev;
0223 struct brcmf_cfg80211_profile profile;
0224 unsigned long sme_state;
0225 struct vif_saved_ie saved_ie;
0226 struct list_head list;
0227 u16 mgmt_rx_reg;
0228 bool mbss;
0229 int is_11d;
0230 s32 cqm_rssi_low;
0231 s32 cqm_rssi_high;
0232 s32 cqm_rssi_last;
0233 };
0234
0235
0236 struct brcmf_cfg80211_connect_info {
0237 u8 *req_ie;
0238 s32 req_ie_len;
0239 u8 *resp_ie;
0240 s32 resp_ie_len;
0241 };
0242
0243
0244 struct brcmf_cfg80211_assoc_ielen_le {
0245 __le32 req_len;
0246 __le32 resp_len;
0247 };
0248
0249 struct brcmf_cfg80211_edcf_acparam {
0250 u8 ACI;
0251 u8 ECW;
0252 u16 TXOP;
0253 };
0254
0255
0256 enum wl_escan_state {
0257 WL_ESCAN_STATE_IDLE,
0258 WL_ESCAN_STATE_SCANNING
0259 };
0260
0261 struct escan_info {
0262 u32 escan_state;
0263 u8 *escan_buf;
0264 struct wiphy *wiphy;
0265 struct brcmf_if *ifp;
0266 s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
0267 struct cfg80211_scan_request *request);
0268 };
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279 struct brcmf_cfg80211_vif_event {
0280 wait_queue_head_t vif_wq;
0281 spinlock_t vif_event_lock;
0282 u8 action;
0283 struct brcmf_cfg80211_vif *vif;
0284 };
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297 struct brcmf_cfg80211_wowl {
0298 bool active;
0299 u32 pre_pmmode;
0300 struct cfg80211_wowlan_nd_match *nd;
0301 struct cfg80211_wowlan_nd_info *nd_info;
0302 wait_queue_head_t nd_data_wait;
0303 bool nd_data_completed;
0304 bool nd_enabled;
0305 };
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342 struct brcmf_cfg80211_info {
0343 struct wiphy *wiphy;
0344 struct brcmf_cfg80211_conf *conf;
0345 struct brcmf_p2p_info p2p;
0346 struct brcmf_btcoex_info *btcoex;
0347 struct cfg80211_scan_request *scan_request;
0348 struct mutex usr_sync;
0349 struct wl_cfg80211_bss_info *bss_info;
0350 struct brcmf_cfg80211_connect_info conn_info;
0351 struct brcmf_pmk_list_le pmk_list;
0352 unsigned long scan_status;
0353 struct brcmf_pub *pub;
0354 u32 channel;
0355 u32 int_escan_map;
0356 bool ibss_starter;
0357 bool pwr_save;
0358 bool dongle_up;
0359 bool scan_tried;
0360 u8 *dcmd_buf;
0361 u8 *extra_buf;
0362 struct dentry *debugfsdir;
0363 struct escan_info escan_info;
0364 struct timer_list escan_timeout;
0365 struct work_struct escan_timeout_work;
0366 struct list_head vif_list;
0367 struct brcmf_cfg80211_vif_event vif_event;
0368 struct completion vif_disabled;
0369 struct brcmu_d11inf d11inf;
0370 struct brcmf_assoclist_le assoclist;
0371 struct brcmf_cfg80211_wowl wowl;
0372 struct brcmf_pno_info *pno;
0373 u8 ac_priority[MAX_8021D_PRIO];
0374 };
0375
0376
0377
0378
0379
0380
0381
0382
0383 struct brcmf_tlv {
0384 u8 id;
0385 u8 len;
0386 u8 data[1];
0387 };
0388
0389 static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg)
0390 {
0391 return cfg->wiphy;
0392 }
0393
0394 static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w)
0395 {
0396 struct brcmf_pub *drvr = wiphy_priv(w);
0397 return drvr->config;
0398 }
0399
0400 static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd)
0401 {
0402 return wiphy_to_cfg(wd->wiphy);
0403 }
0404
0405 static inline struct brcmf_cfg80211_vif *wdev_to_vif(struct wireless_dev *wdev)
0406 {
0407 return container_of(wdev, struct brcmf_cfg80211_vif, wdev);
0408 }
0409
0410 static inline
0411 struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg)
0412 {
0413 return brcmf_get_ifp(cfg->pub, 0)->ndev;
0414 }
0415
0416 static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev)
0417 {
0418 return wdev_to_cfg(ndev->ieee80211_ptr);
0419 }
0420
0421 static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd)
0422 {
0423 struct brcmf_if *ifp = netdev_priv(nd);
0424 return &ifp->vif->profile;
0425 }
0426
0427 static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev)
0428 {
0429 struct brcmf_if *ifp = netdev_priv(ndev);
0430 return ifp->vif;
0431 }
0432
0433 static inline struct
0434 brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg)
0435 {
0436 return &cfg->conn_info;
0437 }
0438
0439 struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
0440 struct cfg80211_ops *ops,
0441 bool p2pdev_forced);
0442 void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
0443 s32 brcmf_cfg80211_up(struct net_device *ndev);
0444 s32 brcmf_cfg80211_down(struct net_device *ndev);
0445 struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings);
0446 enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
0447
0448 struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
0449 enum nl80211_iftype type);
0450 void brcmf_free_vif(struct brcmf_cfg80211_vif *vif);
0451
0452 s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
0453 const u8 *vndr_ie_buf, u32 vndr_ie_len);
0454 s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif);
0455 u16 channel_to_chanspec(struct brcmu_d11inf *d11inf,
0456 struct ieee80211_channel *ch);
0457 bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg,
0458 unsigned long state);
0459 void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
0460 struct brcmf_cfg80211_vif *vif);
0461 bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
0462 int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
0463 u8 action, ulong timeout);
0464 s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
0465 struct brcmf_if *ifp, bool aborted,
0466 bool fw_abort);
0467 void brcmf_set_mpc(struct brcmf_if *ndev, int mpc);
0468 void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg);
0469 void brcmf_cfg80211_free_netdev(struct net_device *ndev);
0470
0471 #endif