1 2 #ifndef _dhd_config_ 3 #define _dhd_config_ 4 5 #include <bcmdevs.h> 6 #include <siutils.h> 7 #include <dngl_stats.h> 8 #include <dhd.h> 9 #include <wlioctl.h> 10 #include <802.11.h> 11 12 #define FW_TYPE_STA 0 13 #define FW_TYPE_APSTA 1 14 #define FW_TYPE_P2P 2 15 #define FW_TYPE_MESH 3 16 #define FW_TYPE_EZMESH 4 17 #define FW_TYPE_ES 5 18 #define FW_TYPE_MFG 6 19 #define FW_TYPE_MINIME 7 20 #define FW_TYPE_G 0 21 #define FW_TYPE_AG 1 22 23 #define FW_PATH_AUTO_SELECT 1 24 #ifdef BCMDHD_MDRIVER 25 #define CONFIG_PATH_AUTO_SELECT 26 #else 27 //#define CONFIG_PATH_AUTO_SELECT 28 #endif 29 extern char firmware_path[MOD_PARAM_PATHLEN]; 30 #if defined(BCMSDIO) || defined(BCMPCIE) 31 extern uint dhd_rxbound; 32 extern uint dhd_txbound; 33 #endif 34 #ifdef BCMSDIO 35 #define TXGLOM_RECV_OFFSET 8 36 extern uint dhd_doflow; 37 extern uint dhd_slpauto; 38 #endif 39 40 #ifdef SET_FWNV_BY_MAC 41 typedef struct wl_mac_range { 42 uint32 oui; 43 uint32 nic_start; 44 uint32 nic_end; 45 } wl_mac_range_t; 46 47 typedef struct wl_mac_list { 48 int count; 49 wl_mac_range_t *mac; 50 char name[MOD_PARAM_PATHLEN]; 51 } wl_mac_list_t; 52 53 typedef struct wl_mac_list_ctrl { 54 int count; 55 struct wl_mac_list *m_mac_list_head; 56 } wl_mac_list_ctrl_t; 57 #endif 58 59 typedef struct wl_chip_nv_path { 60 uint chip; 61 uint chiprev; 62 char name[MOD_PARAM_PATHLEN]; 63 } wl_chip_nv_path_t; 64 65 typedef struct wl_chip_nv_path_list_ctrl { 66 int count; 67 struct wl_chip_nv_path *m_chip_nv_path_head; 68 } wl_chip_nv_path_list_ctrl_t; 69 70 #define MAX_CTRL_CHANSPECS 256 71 typedef struct wl_channel_list { 72 uint32 count; 73 uint32 channel[MAX_CTRL_CHANSPECS]; 74 } wl_channel_list_t; 75 76 typedef struct wmes_param { 77 int aifsn[AC_COUNT]; 78 int ecwmin[AC_COUNT]; 79 int ecwmax[AC_COUNT]; 80 int txop[AC_COUNT]; 81 } wme_param_t; 82 83 #ifdef PKT_FILTER_SUPPORT 84 #define DHD_CONF_FILTER_MAX 8 85 #define PKT_FILTER_LEN 300 86 #define MAGIC_PKT_FILTER_LEN 450 87 typedef struct conf_pkt_filter_add { 88 uint32 count; 89 char filter[DHD_CONF_FILTER_MAX][PKT_FILTER_LEN]; 90 } conf_pkt_filter_add_t; 91 92 typedef struct conf_pkt_filter_del { 93 uint32 count; 94 uint32 id[DHD_CONF_FILTER_MAX]; 95 } conf_pkt_filter_del_t; 96 #endif 97 98 #define CONFIG_COUNTRY_LIST_SIZE 500 99 typedef struct country_list { 100 struct country_list *next; 101 wl_country_t cspec; 102 } country_list_t; 103 104 /* mchan_params */ 105 #define MCHAN_MAX_NUM 4 106 #define MIRACAST_SOURCE 1 107 #define MIRACAST_SINK 2 108 typedef struct mchan_params { 109 struct mchan_params *next; 110 int bw; 111 int p2p_mode; 112 int miracast_mode; 113 } mchan_params_t; 114 115 #ifdef SCAN_SUPPRESS 116 enum scan_intput_flags { 117 NO_SCAN_INTPUT = (1 << (0)), 118 SCAN_CURCHAN_INTPUT = (1 << (1)), 119 SCAN_LIGHT_INTPUT = (1 << (2)), 120 }; 121 #endif 122 123 enum war_flags { 124 SET_CHAN_INCONN = (1 << (0)), 125 FW_REINIT_INCSA = (1 << (1)), 126 FW_REINIT_EMPTY_SCAN = (1 << (2)), 127 P2P_AP_MAC_CONFLICT = (1 << (3)), 128 RESEND_EAPOL_PKT = (1 << (4)) 129 }; 130 131 enum in4way_flags { 132 STA_NO_SCAN_IN4WAY = (1 << (0)), 133 STA_NO_BTC_IN4WAY = (1 << (1)), 134 STA_WAIT_DISCONNECTED = (1 << (2)), 135 AP_WAIT_STA_RECONNECT = (1 << (3)), 136 STA_FAKE_SCAN_IN_CONNECT = (1 << (4)), 137 STA_REASSOC_RETRY = (1 << (5)), 138 }; 139 140 enum in_suspend_flags { 141 NO_EVENT_IN_SUSPEND = (1 << (0)), 142 NO_TXDATA_IN_SUSPEND = (1 << (1)), 143 NO_TXCTL_IN_SUSPEND = (1 << (2)), 144 AP_DOWN_IN_SUSPEND = (1 << (3)), 145 ROAM_OFFLOAD_IN_SUSPEND = (1 << (4)), 146 AP_FILTER_IN_SUSPEND = (1 << (5)), 147 WOWL_IN_SUSPEND = (1 << (6)), 148 ALL_IN_SUSPEND = 0xFFFFFFFF, 149 }; 150 151 enum in_suspend_mode { 152 EARLY_SUSPEND = 0, 153 PM_NOTIFIER = 1, 154 SUSPEND_MODE_2 = 2 155 }; 156 157 #ifdef TPUT_MONITOR 158 enum data_drop_mode { 159 NO_DATA_DROP = -1, 160 FW_DROP = 0, 161 TXPKT_DROP = 1, 162 XMIT_DROP = 2 163 }; 164 #endif 165 166 enum conn_state { 167 CONN_STATE_IDLE = 0, 168 CONN_STATE_CONNECTING = 1, 169 CONN_STATE_AUTH_SAE_M1 = 2, 170 CONN_STATE_AUTH_SAE_M2 = 3, 171 CONN_STATE_AUTH_SAE_M3 = 4, 172 CONN_STATE_AUTH_SAE_M4 = 5, 173 CONN_STATE_REQID = 6, 174 CONN_STATE_RSPID = 7, 175 CONN_STATE_WSC_START = 8, 176 CONN_STATE_WPS_M1 = 9, 177 CONN_STATE_WPS_M2 = 10, 178 CONN_STATE_WPS_M3 = 11, 179 CONN_STATE_WPS_M4 = 12, 180 CONN_STATE_WPS_M5 = 13, 181 CONN_STATE_WPS_M6 = 14, 182 CONN_STATE_WPS_M7 = 15, 183 CONN_STATE_WPS_M8 = 16, 184 CONN_STATE_WSC_DONE = 17, 185 CONN_STATE_4WAY_M1 = 18, 186 CONN_STATE_4WAY_M2 = 19, 187 CONN_STATE_4WAY_M3 = 20, 188 CONN_STATE_4WAY_M4 = 21, 189 CONN_STATE_ADD_KEY = 22, 190 CONN_STATE_CONNECTED = 23, 191 CONN_STATE_GROUPKEY_M1 = 24, 192 CONN_STATE_GROUPKEY_M2 = 25, 193 }; 194 195 enum enq_pkt_type { 196 ENQ_PKT_TYPE_EAPOL = (1 << (0)), 197 ENQ_PKT_TYPE_ARP = (1 << (1)), 198 ENQ_PKT_TYPE_DHCP = (1 << (2)), 199 ENQ_PKT_TYPE_ICMP = (1 << (3)), 200 }; 201 202 typedef struct dhd_conf { 203 uint devid; 204 uint chip; 205 uint chiprev; 206 #if defined(BCMPCIE) 207 uint svid; 208 uint ssid; 209 #endif 210 #ifdef GET_OTP_MODULE_NAME 211 char module_name[16]; 212 #endif 213 struct ether_addr otp_mac; 214 int fw_type; 215 #ifdef SET_FWNV_BY_MAC 216 wl_mac_list_ctrl_t fw_by_mac; 217 wl_mac_list_ctrl_t nv_by_mac; 218 #endif 219 wl_chip_nv_path_list_ctrl_t nv_by_chip; 220 country_list_t *country_head; 221 int ioctl_ver; 222 int band; 223 int bw_cap[2]; 224 wl_country_t cspec; 225 wl_channel_list_t channels; 226 uint roam_off; 227 uint roam_off_suspend; 228 int roam_trigger[2]; 229 int roam_scan_period[2]; 230 int roam_delta[2]; 231 int fullroamperiod; 232 uint keep_alive_period; 233 bool rekey_offload; 234 #ifdef ARP_OFFLOAD_SUPPORT 235 bool garp; 236 #endif 237 int force_wme_ac; 238 wme_param_t wme_sta; 239 wme_param_t wme_ap; 240 #ifdef PKT_FILTER_SUPPORT 241 conf_pkt_filter_add_t pkt_filter_add; 242 conf_pkt_filter_del_t pkt_filter_del; 243 char *magic_pkt_filter_add; 244 #endif 245 int srl; 246 int lrl; 247 uint bcn_timeout; 248 int disable_proptx; 249 int dhd_poll; 250 #ifdef BCMSDIO 251 int use_rxchain; 252 bool bus_rxglom; 253 bool txglom_ext; /* Only for 43362/4330/43340/43341/43241 */ 254 /* terence 20161011: 255 1) conf->tx_max_offset = 1 to fix credict issue in adaptivity testing 256 2) conf->tx_max_offset = 1 will cause to UDP Tx not work in rxglom supported, 257 but not happened in sw txglom 258 */ 259 int tx_max_offset; 260 uint txglomsize; 261 int txctl_tmo_fix; 262 bool txglom_mode; 263 uint deferred_tx_len; 264 /*txglom_bucket_size: 265 * 43362/4330: 1680 266 * 43340/43341/43241: 1684 267 */ 268 int txglom_bucket_size; 269 int txinrx_thres; 270 int dhd_txminmax; // -1=DATABUFCNT(bus) 271 #ifdef DYNAMIC_MAX_HDR_READ 272 int max_hdr_read; 273 #endif 274 bool oob_enabled_later; 275 #ifdef MINIME 276 uint32 ramsize; 277 #endif 278 #if defined(SDIO_ISR_THREAD) 279 bool intr_extn; 280 #endif 281 #ifdef BCMSDIO_RXLIM_POST 282 bool rxlim_en; 283 #endif 284 #ifdef BCMSDIO_TXSEQ_SYNC 285 bool txseq_sync; 286 #endif 287 #ifdef BCMSDIO_INTSTATUS_WAR 288 uint read_intr_mode; 289 #endif 290 int kso_try_max; 291 #ifdef KSO_DEBUG 292 uint kso_try_array[10]; 293 #endif 294 #endif 295 #ifdef BCMPCIE 296 int bus_deepsleep_disable; 297 int flow_ring_queue_threshold; 298 int d2h_intr_method; 299 int d2h_intr_control; 300 int enq_hdr_pkt; 301 int aspm; 302 int l1ss; 303 #endif 304 int dpc_cpucore; 305 int rxf_cpucore; 306 int dhd_dpc_prio; 307 int frameburst; 308 bool deepsleep; 309 int pm; 310 int pm_in_suspend; 311 int suspend_mode; 312 int suspend_bcn_li_dtim; 313 #ifdef DHDTCPACK_SUPPRESS 314 uint8 tcpack_sup_mode; 315 uint32 tcpack_sup_ratio; 316 uint32 tcpack_sup_delay; 317 #endif 318 int pktprio8021x; 319 uint insuspend; 320 bool suspended; 321 struct ether_addr bssid_insuspend; 322 #ifdef SUSPEND_EVENT 323 char resume_eventmask[WL_EVENTING_MASK_LEN]; 324 bool wlfc; 325 #endif 326 #ifdef IDHCP 327 int dhcpc_enable; 328 int dhcpd_enable; 329 struct ipv4_addr dhcpd_ip_addr; 330 struct ipv4_addr dhcpd_ip_mask; 331 struct ipv4_addr dhcpd_ip_start; 332 struct ipv4_addr dhcpd_ip_end; 333 #endif 334 #ifdef ISAM_PREINIT 335 char isam_init[50]; 336 char isam_config[300]; 337 char isam_enable[50]; 338 #endif 339 int ctrl_resched; 340 uint rxcnt_timeout; 341 mchan_params_t *mchan; 342 char *wl_preinit; 343 char *wl_suspend; 344 char *wl_resume; 345 int tsq; 346 int orphan_move; 347 uint in4way; 348 uint war; 349 #ifdef WL_EXT_WOWL 350 uint wowl; 351 #endif 352 #ifdef GET_CUSTOM_MAC_FROM_CONFIG 353 char hw_ether[62]; 354 #endif 355 wait_queue_head_t event_complete; 356 #ifdef PROPTX_MAXCOUNT 357 int proptx_maxcnt_2g; 358 int proptx_maxcnt_5g; 359 #endif /* DYNAMIC_PROPTX_MAXCOUNT */ 360 #ifdef TPUT_MONITOR 361 int data_drop_mode; 362 unsigned long net_len; 363 uint tput_monitor_ms; 364 struct osl_timespec tput_ts; 365 unsigned long last_tx; 366 unsigned long last_rx; 367 unsigned long last_net_tx; 368 #ifdef BCMSDIO 369 int32 doflow_tput_thresh; 370 #endif 371 #endif 372 #ifdef SCAN_SUPPRESS 373 uint scan_intput; 374 int scan_busy_thresh; 375 int scan_busy_tmo; 376 int32 scan_tput_thresh; 377 #endif 378 #ifdef DHD_TPUT_PATCH 379 bool tput_patch; 380 int mtu; 381 bool pktsetsum; 382 #endif 383 #ifdef SET_XPS_CPUS 384 bool xps_cpus; 385 #endif 386 #ifdef SET_RPS_CPUS 387 bool rps_cpus; 388 #endif 389 #ifdef CHECK_DOWNLOAD_FW 390 bool fwchk; 391 #endif 392 char *vndr_ie_assocreq; 393 } dhd_conf_t; 394 395 #ifdef BCMSDIO 396 void dhd_conf_get_otp(dhd_pub_t *dhd, bcmsdh_info_t *sdh, si_t *sih); 397 #if defined(HW_OOB) || defined(FORCE_WOWLAN) 398 void dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, struct si_pub *sih); 399 #endif 400 void dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable); 401 #endif 402 #ifdef BCMPCIE 403 int dhd_conf_get_otp(dhd_pub_t *dhd, si_t *sih); 404 bool dhd_conf_legacy_msi_chip(dhd_pub_t *dhd); 405 #endif 406 #ifdef WL_CFG80211 407 bool dhd_conf_legacy_chip_check(dhd_pub_t *dhd); 408 bool dhd_conf_new_chip_check(dhd_pub_t *dhd); 409 bool dhd_conf_extsae_chip(dhd_pub_t *dhd); 410 #endif 411 void dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path); 412 int dhd_conf_set_intiovar(dhd_pub_t *dhd, int ifidx, uint cmd, char *name, 413 int val, int def, bool down); 414 int dhd_conf_get_band(dhd_pub_t *dhd); 415 int dhd_conf_country(dhd_pub_t *dhd, char *cmd, char *buf); 416 int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec); 417 #ifdef CCODE_LIST 418 int dhd_ccode_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec); 419 #endif 420 bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel); 421 void dhd_conf_set_wme(dhd_pub_t *dhd, int ifidx, int mode); 422 void dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int go, int source); 423 void dhd_conf_add_pkt_filter(dhd_pub_t *dhd); 424 bool dhd_conf_del_pkt_filter(dhd_pub_t *dhd, uint32 id); 425 void dhd_conf_discard_pkt_filter(dhd_pub_t *dhd); 426 int dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path); 427 int dhd_conf_set_chiprev(dhd_pub_t *dhd, uint chip, uint chiprev); 428 uint dhd_conf_get_chip(void *context); 429 uint dhd_conf_get_chiprev(void *context); 430 int dhd_conf_get_pm(dhd_pub_t *dhd); 431 int dhd_conf_reg2args(dhd_pub_t *dhd, char *cmd, bool set, uint32 index, uint32 *val); 432 int dhd_conf_check_hostsleep(dhd_pub_t *dhd, int cmd, void *buf, int len, 433 int *hostsleep_set, int *hostsleep_val, int *ret); 434 void dhd_conf_get_hostsleep(dhd_pub_t *dhd, 435 int hostsleep_set, int hostsleep_val, int ret); 436 int dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period, 437 char *packet, bool bcast); 438 #ifdef ARP_OFFLOAD_SUPPORT 439 void dhd_conf_set_garp(dhd_pub_t *dhd, int ifidx, uint32 ipa, bool enable); 440 #endif 441 #ifdef PROP_TXSTATUS 442 int dhd_conf_get_disable_proptx(dhd_pub_t *dhd); 443 #endif 444 #ifdef TPUT_MONITOR 445 void dhd_conf_tput_monitor(dhd_pub_t *dhd); 446 #endif 447 uint dhd_conf_get_insuspend(dhd_pub_t *dhd, uint mask); 448 int dhd_conf_set_suspend_resume(dhd_pub_t *dhd, int suspend); 449 void dhd_conf_postinit_ioctls(dhd_pub_t *dhd); 450 #ifdef WL_STATIC_IF 451 void dhd_conf_preinit_ioctls_sta(dhd_pub_t *dhd, int ifidx); 452 #endif /* WL_STATIC_IF */ 453 int dhd_conf_preinit(dhd_pub_t *dhd); 454 int dhd_conf_reset(dhd_pub_t *dhd); 455 int dhd_conf_attach(dhd_pub_t *dhd); 456 void dhd_conf_detach(dhd_pub_t *dhd); 457 void *dhd_get_pub(struct net_device *dev); 458 int wl_pattern_atoh(char *src, char *dst); 459 int dhd_conf_suspend_resume_sta(dhd_pub_t *dhd, int ifidx, int suspend); 460 /* Add to adjust 802.1x priority */ 461 extern void pktset8021xprio(void *pkt, int prio); 462 #ifdef BCMSDIO 463 extern int dhd_bus_sleep(dhd_pub_t *dhdp, bool sleep, uint32 *intstatus); 464 #endif 465 #endif /* _dhd_config_ */ 466