1 /* SPDX-License-Identifier: GPL-2.0 */ 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_ES 4 17 #define FW_TYPE_MFG 5 18 #define FW_TYPE_MINIME 6 19 #define FW_TYPE_G 0 20 #define FW_TYPE_AG 1 21 22 #define FW_PATH_AUTO_SELECT 1 23 //#define CONFIG_PATH_AUTO_SELECT 24 extern char firmware_path[MOD_PARAM_PATHLEN]; 25 #if defined(BCMSDIO) || defined(BCMPCIE) 26 extern uint dhd_rxbound; 27 extern uint dhd_txbound; 28 #endif 29 #ifdef BCMSDIO 30 #define TXGLOM_RECV_OFFSET 8 31 extern uint dhd_doflow; 32 extern uint dhd_slpauto; 33 #endif 34 35 #ifdef SET_FWNV_BY_MAC 36 typedef struct wl_mac_range { 37 uint32 oui; 38 uint32 nic_start; 39 uint32 nic_end; 40 } wl_mac_range_t; 41 42 typedef struct wl_mac_list { 43 int count; 44 wl_mac_range_t *mac; 45 char name[MOD_PARAM_PATHLEN]; 46 } wl_mac_list_t; 47 48 typedef struct wl_mac_list_ctrl { 49 int count; 50 struct wl_mac_list *m_mac_list_head; 51 } wl_mac_list_ctrl_t; 52 #endif 53 54 typedef struct wl_chip_nv_path { 55 uint chip; 56 uint chiprev; 57 char name[MOD_PARAM_PATHLEN]; 58 } wl_chip_nv_path_t; 59 60 typedef struct wl_chip_nv_path_list_ctrl { 61 int count; 62 struct wl_chip_nv_path *m_chip_nv_path_head; 63 } wl_chip_nv_path_list_ctrl_t; 64 65 typedef struct wl_channel_list { 66 uint32 count; 67 uint32 channel[WL_NUMCHANNELS]; 68 } wl_channel_list_t; 69 70 typedef struct wmes_param { 71 int aifsn[AC_COUNT]; 72 int ecwmin[AC_COUNT]; 73 int ecwmax[AC_COUNT]; 74 int txop[AC_COUNT]; 75 } wme_param_t; 76 77 #ifdef PKT_FILTER_SUPPORT 78 #define DHD_CONF_FILTER_MAX 8 79 #define PKT_FILTER_LEN 300 80 #define MAGIC_PKT_FILTER_LEN 450 81 typedef struct conf_pkt_filter_add { 82 uint32 count; 83 char filter[DHD_CONF_FILTER_MAX][PKT_FILTER_LEN]; 84 } conf_pkt_filter_add_t; 85 86 typedef struct conf_pkt_filter_del { 87 uint32 count; 88 uint32 id[DHD_CONF_FILTER_MAX]; 89 } conf_pkt_filter_del_t; 90 #endif 91 92 #define CONFIG_COUNTRY_LIST_SIZE 500 93 typedef struct country_list { 94 struct country_list *next; 95 wl_country_t cspec; 96 } country_list_t; 97 98 /* mchan_params */ 99 #define MCHAN_MAX_NUM 4 100 #define MIRACAST_SOURCE 1 101 #define MIRACAST_SINK 2 102 typedef struct mchan_params { 103 struct mchan_params *next; 104 int bw; 105 int p2p_mode; 106 int miracast_mode; 107 } mchan_params_t; 108 109 enum in4way_flags { 110 STA_NO_SCAN_IN4WAY = (1 << (0)), 111 STA_NO_BTC_IN4WAY = (1 << (1)), 112 STA_WAIT_DISCONNECTED = (1 << (2)), 113 AP_WAIT_STA_RECONNECT = (1 << (3)), 114 }; 115 116 enum in_suspend_flags { 117 NO_EVENT_IN_SUSPEND = (1 << (0)), 118 NO_TXDATA_IN_SUSPEND = (1 << (1)), 119 NO_TXCTL_IN_SUSPEND = (1 << (2)), 120 AP_DOWN_IN_SUSPEND = (1 << (3)), 121 ROAM_OFFLOAD_IN_SUSPEND = (1 << (4)), 122 AP_FILTER_IN_SUSPEND = (1 << (5)), 123 WOWL_IN_SUSPEND = (1 << (6)), 124 ALL_IN_SUSPEND = 0xFFFFFFFF, 125 }; 126 127 enum in_suspend_mode { 128 EARLY_SUSPEND = 0, 129 PM_NOTIFIER = 1 130 }; 131 132 #ifdef HOST_TPUT_TEST 133 enum data_drop_mode { 134 NO_DATA_DROP = 0, 135 TXPKT_DROP = 1, 136 XMIT_DROP = 2 137 }; 138 #endif 139 140 enum eapol_status { 141 EAPOL_STATUS_NONE = 0, 142 EAPOL_STATUS_REQID = 1, 143 EAPOL_STATUS_RSPID = 2, 144 EAPOL_STATUS_WSC_START = 3, 145 EAPOL_STATUS_WPS_M1 = 4, 146 EAPOL_STATUS_WPS_M2 = 5, 147 EAPOL_STATUS_WPS_M3 = 6, 148 EAPOL_STATUS_WPS_M4 = 7, 149 EAPOL_STATUS_WPS_M5 = 8, 150 EAPOL_STATUS_WPS_M6 = 9, 151 EAPOL_STATUS_WPS_M7 = 10, 152 EAPOL_STATUS_WPS_M8 = 11, 153 EAPOL_STATUS_WSC_DONE = 12, 154 EAPOL_STATUS_4WAY_START = 13, 155 EAPOL_STATUS_4WAY_M1 = 14, 156 EAPOL_STATUS_4WAY_M2 = 15, 157 EAPOL_STATUS_4WAY_M3 = 16, 158 EAPOL_STATUS_4WAY_M4 = 17, 159 EAPOL_STATUS_GROUPKEY_M1 = 18, 160 EAPOL_STATUS_GROUPKEY_M2 = 19, 161 EAPOL_STATUS_4WAY_DONE = 20 162 }; 163 164 typedef struct dhd_conf { 165 uint devid; 166 uint chip; 167 uint chiprev; 168 #if defined(BCMPCIE) 169 uint svid; 170 uint ssid; 171 #endif 172 #ifdef GET_OTP_MODULE_NAME 173 char module_name[16]; 174 #endif 175 struct ether_addr otp_mac; 176 int fw_type; 177 #ifdef SET_FWNV_BY_MAC 178 wl_mac_list_ctrl_t fw_by_mac; 179 wl_mac_list_ctrl_t nv_by_mac; 180 #endif 181 wl_chip_nv_path_list_ctrl_t nv_by_chip; 182 country_list_t *country_head; 183 int band; 184 int bw_cap[2]; 185 wl_country_t cspec; 186 wl_channel_list_t channels; 187 uint roam_off; 188 uint roam_off_suspend; 189 int roam_trigger[2]; 190 int roam_scan_period[2]; 191 int roam_delta[2]; 192 int fullroamperiod; 193 uint keep_alive_period; 194 #ifdef ARP_OFFLOAD_SUPPORT 195 bool garp; 196 #endif 197 int force_wme_ac; 198 wme_param_t wme_sta; 199 wme_param_t wme_ap; 200 #ifdef PKT_FILTER_SUPPORT 201 conf_pkt_filter_add_t pkt_filter_add; 202 conf_pkt_filter_del_t pkt_filter_del; 203 char *magic_pkt_filter_add; 204 #endif 205 int srl; 206 int lrl; 207 uint bcn_timeout; 208 int disable_proptx; 209 int dhd_poll; 210 #ifdef BCMSDIO 211 int use_rxchain; 212 bool bus_rxglom; 213 bool txglom_ext; /* Only for 43362/4330/43340/43341/43241 */ 214 /* terence 20161011: 215 1) conf->tx_max_offset = 1 to fix credict issue in adaptivity testing 216 2) conf->tx_max_offset = 1 will cause to UDP Tx not work in rxglom supported, 217 but not happened in sw txglom 218 */ 219 int tx_max_offset; 220 uint txglomsize; 221 int txctl_tmo_fix; 222 bool txglom_mode; 223 uint deferred_tx_len; 224 /*txglom_bucket_size: 225 * 43362/4330: 1680 226 * 43340/43341/43241: 1684 227 */ 228 int txglom_bucket_size; 229 int txinrx_thres; 230 int dhd_txminmax; // -1=DATABUFCNT(bus) 231 #ifdef DYNAMIC_MAX_HDR_READ 232 int max_hdr_read; 233 #endif 234 bool oob_enabled_later; 235 #ifdef MINIME 236 uint32 ramsize; 237 #endif 238 #if defined(SDIO_ISR_THREAD) 239 bool intr_extn; 240 #endif 241 #ifdef BCMSDIO_RXLIM_POST 242 bool rxlim_en; 243 #endif 244 #ifdef BCMSDIO_TXSEQ_SYNC 245 bool txseq_sync; 246 #endif 247 #endif 248 #ifdef BCMPCIE 249 int bus_deepsleep_disable; 250 int flow_ring_queue_threshold; 251 #endif 252 int dpc_cpucore; 253 int rxf_cpucore; 254 int dhd_dpc_prio; 255 int frameburst; 256 bool deepsleep; 257 int pm; 258 int pm_in_suspend; 259 int suspend_mode; 260 int suspend_bcn_li_dtim; 261 #ifdef DHDTCPACK_SUPPRESS 262 uint8 tcpack_sup_mode; 263 uint32 tcpack_sup_ratio; 264 uint32 tcpack_sup_delay; 265 #endif 266 int pktprio8021x; 267 uint insuspend; 268 bool suspended; 269 #ifdef SUSPEND_EVENT 270 char resume_eventmask[WL_EVENTING_MASK_LEN]; 271 struct ether_addr bssid_insuspend; 272 bool wlfc; 273 #endif 274 #ifdef IDHCP 275 int dhcpc_enable; 276 int dhcpd_enable; 277 struct ipv4_addr dhcpd_ip_addr; 278 struct ipv4_addr dhcpd_ip_mask; 279 struct ipv4_addr dhcpd_ip_start; 280 struct ipv4_addr dhcpd_ip_end; 281 #endif 282 #ifdef ISAM_PREINIT 283 char isam_init[50]; 284 char isam_config[300]; 285 char isam_enable[50]; 286 #endif 287 int ctrl_resched; 288 mchan_params_t *mchan; 289 char *wl_preinit; 290 char *wl_suspend; 291 char *wl_resume; 292 int tsq; 293 int orphan_move; 294 uint in4way; 295 #ifdef WL_EXT_WOWL 296 uint wowl; 297 #endif 298 #ifdef GET_CUSTOM_MAC_FROM_CONFIG 299 char hw_ether[62]; 300 #endif 301 wait_queue_head_t event_complete; 302 #ifdef PROPTX_MAXCOUNT 303 int proptx_maxcnt_2g; 304 int proptx_maxcnt_5g; 305 #endif /* DYNAMIC_PROPTX_MAXCOUNT */ 306 #ifdef HOST_TPUT_TEST 307 int data_drop_mode; 308 uint tput_measure_ms; 309 struct osl_timespec tput_ts; 310 unsigned long net_len; 311 #endif 312 #ifdef DHD_TPUT_PATCH 313 bool tput_patch; 314 int mtu; 315 bool pktsetsum; 316 #endif 317 #if defined(SET_XPS_CPUS) 318 bool xps_cpus; 319 #endif 320 #if defined(SET_RPS_CPUS) 321 bool rps_cpus; 322 #endif 323 } dhd_conf_t; 324 325 #ifdef BCMSDIO 326 void dhd_conf_get_otp(dhd_pub_t *dhd, bcmsdh_info_t *sdh, si_t *sih); 327 #if defined(HW_OOB) || defined(FORCE_WOWLAN) 328 void dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, struct si_pub *sih); 329 #endif 330 void dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable); 331 #endif 332 #ifdef BCMPCIE 333 int dhd_conf_get_otp(dhd_pub_t *dhd, si_t *sih); 334 #endif 335 void dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path); 336 int dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val, 337 int def, bool down); 338 int dhd_conf_get_band(dhd_pub_t *dhd); 339 int dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec); 340 int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec); 341 int dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec); 342 #ifdef CCODE_LIST 343 int dhd_ccode_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec); 344 #endif 345 int dhd_conf_fix_country(dhd_pub_t *dhd); 346 bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel); 347 void dhd_conf_set_wme(dhd_pub_t *dhd, int ifidx, int mode); 348 void dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int go, int source); 349 void dhd_conf_add_pkt_filter(dhd_pub_t *dhd); 350 bool dhd_conf_del_pkt_filter(dhd_pub_t *dhd, uint32 id); 351 void dhd_conf_discard_pkt_filter(dhd_pub_t *dhd); 352 int dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path); 353 int dhd_conf_set_chiprev(dhd_pub_t *dhd, uint chip, uint chiprev); 354 uint dhd_conf_get_chip(void *context); 355 uint dhd_conf_get_chiprev(void *context); 356 int dhd_conf_get_pm(dhd_pub_t *dhd); 357 int dhd_conf_check_hostsleep(dhd_pub_t *dhd, int cmd, void *buf, int len, 358 int *hostsleep_set, int *hostsleep_val, int *ret); 359 void dhd_conf_get_hostsleep(dhd_pub_t *dhd, 360 int hostsleep_set, int hostsleep_val, int ret); 361 int dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period, 362 char *packet, bool bcast); 363 #ifdef ARP_OFFLOAD_SUPPORT 364 void dhd_conf_set_garp(dhd_pub_t *dhd, int ifidx, uint32 ipa, bool enable); 365 #endif 366 #ifdef PROP_TXSTATUS 367 int dhd_conf_get_disable_proptx(dhd_pub_t *dhd); 368 #endif 369 #ifdef HOST_TPUT_TEST 370 void dhd_conf_tput_measure(dhd_pub_t *dhd); 371 #endif 372 uint dhd_conf_get_insuspend(dhd_pub_t *dhd, uint mask); 373 int dhd_conf_set_suspend_resume(dhd_pub_t *dhd, int suspend); 374 void dhd_conf_postinit_ioctls(dhd_pub_t *dhd); 375 int dhd_conf_preinit(dhd_pub_t *dhd); 376 int dhd_conf_reset(dhd_pub_t *dhd); 377 int dhd_conf_attach(dhd_pub_t *dhd); 378 void dhd_conf_detach(dhd_pub_t *dhd); 379 void *dhd_get_pub(struct net_device *dev); 380 int wl_pattern_atoh(char *src, char *dst); 381 #ifdef BCMSDIO 382 extern int dhd_bus_sleep(dhd_pub_t *dhdp, bool sleep, uint32 *intstatus); 383 #endif 384 #endif /* _dhd_config_ */ 385