From 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 13 May 2024 10:30:14 +0000 Subject: [PATCH] modify sin led gpio --- kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c | 1046 +++++++++++++++++++++++----------------------------------- 1 files changed, 415 insertions(+), 631 deletions(-) diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c old mode 100644 new mode 100755 index f05a119..dac725e --- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c +++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c @@ -1,5 +1,4 @@ /* SPDX-License-Identifier: GPL-2.0 */ - #include <typedefs.h> #include <osl.h> @@ -68,10 +67,6 @@ #define MAXSZ_BUF 4096 #define MAXSZ_CONFIG 8192 -extern uint wl_reassoc_support; -#ifdef BTC_WAR -extern int btc_war; -#endif /* BTC_WAR */ #if defined(BCMSDIO) && defined(DYNAMIC_MAX_HDR_READ) extern uint firstread; #endif @@ -141,13 +136,13 @@ {BCM43751_CHIP_ID, 1, DONT_CARE, "bcm43751a1_pcie_ag", ""}, {BCM43751_CHIP_ID, 2, DONT_CARE, "bcm43751a2_pcie_ag", ""}, {BCM43752_CHIP_ID, 1, DONT_CARE, "bcm43752a1_pcie_ag", ""}, - {BCM43752_CHIP_ID, 2, DONT_CARE, "bcm43752a2_pcie_ag", "ap6275p"}, + {BCM43752_CHIP_ID, 2, DONT_CARE, "bcm43752a2_pcie_ag", "AP6275P"}, {BCM4375_CHIP_ID, 5, DONT_CARE, "bcm4375b4_pcie_ag", ""}, #endif #ifdef BCMDBUS - {BCM43143_CHIP_ID, 2, DONT_CARE, "bcm43143b0", ""}, - {BCM43242_CHIP_ID, 1, DONT_CARE, "bcm43242a1_ag", ""}, - {BCM43569_CHIP_ID, 2, DONT_CARE, "bcm4358u_ag", ""}, + {BCM43143_CHIP_ID, 2, DONT_CARE, "bcm43143b0", ""}, + {BCM43242_CHIP_ID, 1, DONT_CARE, "bcm43242a1_ag", ""}, + {BCM43569_CHIP_ID, 2, DONT_CARE, "bcm4358u_ag", ""}, #endif }; @@ -216,89 +211,6 @@ #ifdef DHD_TPUT_PATCH extern int dhd_change_mtu(dhd_pub_t *dhd, int new_mtu, int ifidx); -#endif - -#ifdef WL_CFG80211 -bool -dhd_conf_legacy_chip_check(dhd_pub_t *dhd) -{ - uint chip = dhd->conf->chip; - - if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || - chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || - chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || - chip == BCM4371_CHIP_ID || - chip == BCM43430_CHIP_ID || - chip == BCM4345_CHIP_ID || chip == BCM43454_CHIP_ID || - chip == BCM4359_CHIP_ID || - chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID || - chip == BCM43569_CHIP_ID) { - return true; - } - - return false; -} - -bool -dhd_conf_new_chip_check(dhd_pub_t *dhd) -{ - uint chip = dhd->conf->chip; - - if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || - chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || - chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || - chip == BCM4371_CHIP_ID || - chip == BCM43430_CHIP_ID || - chip == BCM4345_CHIP_ID || chip == BCM43454_CHIP_ID || - chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID || - chip == BCM43569_CHIP_ID) { - return false; - } - - return true; -} - -bool -dhd_conf_extsae_chip(dhd_pub_t *dhd) -{ - uint chip = dhd->conf->chip; - - if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || - chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || - chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || - chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID || - chip == BCM43569_CHIP_ID) { - return false; - } - - return true; -} -#endif - -#ifdef BCMSDIO -static void -dhd_conf_disable_slpauto(dhd_pub_t *dhd) -{ - uint chip = dhd->conf->chip; - - if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || - chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || - chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || - chip == BCM4371_CHIP_ID || - chip == BCM43430_CHIP_ID || - chip == BCM4345_CHIP_ID || chip == BCM43454_CHIP_ID || - chip == BCM4359_CHIP_ID) { - dhd_slpauto = FALSE; - } - CONFIG_MSG("dhd_slpauto = %d\n", dhd_slpauto); -} #endif void @@ -778,7 +690,7 @@ chiprev = dhd->conf->chiprev; for (i=0; i<sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { - const chip_name_map_t *row = &chip_name_map[i]; + const chip_name_map_t* row = &chip_name_map[i]; if (row->chip == chip && row->chiprev == chiprev && (row->ag_type == ag_type || ag_type == DONT_CARE || row->ag_type == DONT_CARE)) { @@ -811,7 +723,7 @@ #ifdef BCMSDIO for (i=0; i<sizeof(module_name_map)/sizeof(module_name_map[0]); i++) { - const module_name_map_t *row = &module_name_map[i]; + const module_name_map_t* row = &module_name_map[i]; if (row->devid == devid && row->chip == chip && row->chiprev == chiprev && !strcmp(row->module_name, dhd->conf->module_name)) { return row; @@ -821,7 +733,7 @@ #ifdef BCMPCIE for (i=0; i<sizeof(module_name_map)/sizeof(module_name_map[0]); i++) { - const module_name_map_t *row = &module_name_map[i]; + const module_name_map_t* row = &module_name_map[i]; if (row->devid == devid && row->chip == chip && row->chiprev == chiprev && row->svid == svid && row->ssid == ssid) { return row; @@ -833,64 +745,20 @@ } #endif -char * -dhd_conf_get_chip_name(dhd_pub_t *dhd, int ag_type, bool *chip_map_v2) -{ -#ifdef UPDATE_MODULE_NAME - const module_name_map_t *row_module = NULL; -#endif - const chip_name_map_t *row_chip = NULL; - char *name = NULL; - - *chip_map_v2 = FALSE; -#ifdef UPDATE_MODULE_NAME - row_module = dhd_conf_match_module(dhd); - if (row_module && strlen(row_module->chip_name)) { - name = row_module->chip_name; - } else -#endif - { - row_chip = dhd_conf_match_chip(dhd, ag_type); - if (row_chip && strlen(row_chip->chip_name)) { - name = row_chip->chip_name; - } - } - - return name; -} - -char * -dhd_conf_get_module_name(dhd_pub_t *dhd, int ag_type) -{ -#if defined(BCMPCIE) && defined(UPDATE_MODULE_NAME) - const module_name_map_t *row_module = NULL; -#endif - const chip_name_map_t *row_chip = NULL; - char *name = NULL; - -#if defined(BCMPCIE) && defined(UPDATE_MODULE_NAME) - row_module = dhd_conf_match_module(dhd); - if (row_module && strlen(row_module->module_name)) { - name = row_module->module_name; - } else -#endif - { - row_chip = dhd_conf_match_chip(dhd, ag_type); - if (row_chip && strlen(row_chip->module_name)) { - name = row_chip->module_name; - } - } - - return name; -} - int dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path) { +#ifdef UPDATE_MODULE_NAME + const module_name_map_t* row_module = NULL; +#endif + const chip_name_map_t* row_chip = NULL; int fw_type, ag_type; - char *name_ptr, *chip_name = NULL; - bool chip_map_v2; + uint chip, chiprev; + char *name_ptr; int i; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; if (fw_path[0] == '\0') { #ifdef CONFIG_BCMDHD_FW_PATH @@ -942,10 +810,10 @@ fw_type = FW_TYPE_EZMESH; #endif /* WLEASYMESH */ - chip_name = dhd_conf_get_chip_name(dhd, ag_type, &chip_map_v2); - if (chip_name) { + row_chip = dhd_conf_match_chip(dhd, ag_type); + if (row_chip && strlen(row_chip->chip_name)) { strcpy(name_ptr, "fw_"); - strcat(name_ptr, chip_name); + strcat(name_ptr, row_chip->chip_name); #ifdef BCMUSBDEV_COMPOSITE strcat(name_ptr, "_cusb"); #endif @@ -967,6 +835,33 @@ strcat(name_ptr, ".bin"); } +#ifdef UPDATE_MODULE_NAME + row_module = dhd_conf_match_module(dhd); + if (row_module && strlen(row_module->chip_name)) { + strcpy(name_ptr, "fw_"); + strcat(name_ptr, row_module->chip_name); +#ifdef BCMUSBDEV_COMPOSITE + strcat(name_ptr, "_cusb"); +#endif + if (fw_type == FW_TYPE_APSTA) + strcat(name_ptr, "_apsta.bin"); + else if (fw_type == FW_TYPE_P2P) + strcat(name_ptr, "_p2p.bin"); + else if (fw_type == FW_TYPE_MESH) + strcat(name_ptr, "_mesh.bin"); + else if (fw_type == FW_TYPE_EZMESH) + strcat(name_ptr, "_ezmesh.bin"); + else if (fw_type == FW_TYPE_ES) + strcat(name_ptr, "_es.bin"); + else if (fw_type == FW_TYPE_MFG) + strcat(name_ptr, "_mfg.bin"); + else if (fw_type == FW_TYPE_MINIME) + strcat(name_ptr, "_minime.bin"); + else + strcat(name_ptr, ".bin"); + } +#endif + dhd->conf->fw_type = fw_type; #ifndef MINIME @@ -981,9 +876,16 @@ void dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path, int ag_type) { - char *name_ptr, *chip_name = NULL; - bool chip_map_v2; +#ifdef UPDATE_MODULE_NAME + const module_name_map_t* row_module = NULL; +#endif + const chip_name_map_t* row_chip = NULL; + uint chip, chiprev; + char *name_ptr; int i; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; if (clm_path[0] == '\0') { CONFIG_MSG("clm path is null\n"); @@ -1001,12 +903,21 @@ } name_ptr = &clm_path[i]; - chip_name = dhd_conf_get_chip_name(dhd, ag_type, &chip_map_v2); - if (chip_name) { + row_chip = dhd_conf_match_chip(dhd, ag_type); + if (row_chip && strlen(row_chip->chip_name)) { strcpy(name_ptr, "clm_"); - strcat(name_ptr, chip_name); + strcat(name_ptr, row_chip->chip_name); strcat(name_ptr, ".blob"); } + +#ifdef UPDATE_MODULE_NAME + row_module = dhd_conf_match_module(dhd); + if (row_module && strlen(row_module->chip_name)) { + strcpy(name_ptr, "clm_"); + strcat(name_ptr, row_module->chip_name); + strcat(name_ptr, ".blob"); + } +#endif CONFIG_TRACE("clm_path=%s\n", clm_path); } @@ -1014,8 +925,12 @@ void dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path, int ag_type) { +#if defined(BCMPCIE) && defined(UPDATE_MODULE_NAME) + const module_name_map_t* row_module = NULL; +#endif + const chip_name_map_t* row_chip = NULL; uint chip, chiprev; - char *name_ptr, *module_name = NULL, nv_name[32]; + char *name_ptr, nv_name[32]; int i; chip = dhd->conf->chip; @@ -1043,10 +958,10 @@ } name_ptr = &nv_path[i]; - module_name = dhd_conf_get_module_name(dhd, ag_type); - if (module_name) { + row_chip = dhd_conf_match_chip(dhd, ag_type); + if (row_chip && strlen(row_chip->module_name)) { strcpy(name_ptr, "nvram_"); - strcat(name_ptr, module_name); + strcat(name_ptr, row_chip->module_name); #ifdef BCMUSBDEV_COMPOSITE strcat(name_ptr, "_cusb"); #endif @@ -1063,14 +978,23 @@ if (dhd->conf->chip == BCM4359_CHIP_ID) { struct file *fp; // compatible for AP6398S and AP6398SA - fp = dhd_filp_open(nv_path, O_RDONLY, 0); - if (IS_ERR(fp) || (fp == NULL)) { + fp = filp_open(nv_path, O_RDONLY, 0); + if (IS_ERR(fp)) { strcpy(name_ptr, nv_name); } else { - dhd_filp_close((struct file *)fp, NULL); + filp_close((struct file *)fp, NULL); } } #endif + } +#endif + +#if defined(BCMPCIE) && defined(UPDATE_MODULE_NAME) + row_module = dhd_conf_match_module(dhd); + if (row_module && strlen(row_module->module_name)) { + strcpy(name_ptr, "nvram_"); + strcat(name_ptr, row_module->module_name); + strcat(name_ptr, ".txt"); } #endif @@ -1114,9 +1038,16 @@ void dhd_conf_set_conf_name_by_chip(dhd_pub_t *dhd, char *conf_path) { - char *name_ptr, *chip_name = NULL; - bool chip_map_v2; +#ifdef UPDATE_MODULE_NAME + const module_name_map_t* row_module = NULL; +#endif + const chip_name_map_t* row_chip = NULL; + uint chip, chiprev; + char *name_ptr; int i; + + chip = dhd->conf->chip; + chiprev = dhd->conf->chiprev; if (conf_path[0] == '\0') { CONFIG_MSG("config path is null\n"); @@ -1134,12 +1065,21 @@ } name_ptr = &conf_path[i]; - chip_name = dhd_conf_get_chip_name(dhd, DONT_CARE, &chip_map_v2); - if (chip_name) { + row_chip = dhd_conf_match_chip(dhd, DONT_CARE); + if (row_chip && strlen(row_chip->chip_name)) { strcpy(name_ptr, "config_"); - strcat(name_ptr, chip_name); + strcat(name_ptr, row_chip->chip_name); strcat(name_ptr, ".txt"); } + +#ifdef UPDATE_MODULE_NAME + row_module = dhd_conf_match_module(dhd); + if (row_module && strlen(row_module->chip_name)) { + strcpy(name_ptr, "config_"); + strcat(name_ptr, row_module->chip_name); + strcat(name_ptr, ".txt"); + } +#endif CONFIG_TRACE("config_path=%s\n", conf_path); } @@ -1316,6 +1256,26 @@ #ifdef DHD_LINUX_STD_FW_API #define FIRMWARE_CLASS_PATH "/sys/module/firmware_class/parameters/path" +static int +dhd_conf_get_fw_path(char *path, int len) +{ + char *pch; + int err, path_len = 0; + + err = dhd_read_file(FIRMWARE_CLASS_PATH, path, len); + if(err < 0){ + CONFIG_ERROR("firmware path can not read %d\n", err); + } else { + pch = strchr(path, '\n'); + if (pch) + *pch = '\0'; + CONFIG_TRACE("path = %s\n", path); + path_len = strlen(path); + } + + return path_len; +} + static void dhd_conf_get_filename(char *pFilename) { @@ -1337,42 +1297,6 @@ if (pName) strcpy(pFilename, pName); - - return; -} - -static void -dhd_conf_add_filepath(dhd_pub_t *dhd, char *pFilename) -{ - char path[WLC_IOCTL_SMLEN]; - char *name_ptr, *module_name = NULL; - - if (strlen(pFilename)) { - name_ptr = path; - strcpy(name_ptr, ""); -#ifdef FW_AMPAK_PATH - strcat(name_ptr, "/"); - strcat(name_ptr, FW_AMPAK_PATH); -#endif -#ifdef MODULE_PATH -#if defined(BCMSDIO) && defined(GET_OTP_MODULE_NAME) - if (strlen(dhd->conf->module_name)) - module_name = dhd->conf->module_name; - else -#endif - { - module_name = dhd_conf_get_module_name(dhd, DONT_CARE); - } -#endif - if (module_name) { - strcat(name_ptr, "/"); - strcat(name_ptr, module_name); - } - strcat(name_ptr, "/"); - strcat(name_ptr, pFilename); - strcpy(pFilename, path); - } - return; } #endif /* DHD_LINUX_STD_FW_API */ @@ -1381,6 +1305,10 @@ dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path) { int ag_type; +#ifdef DHD_LINUX_STD_FW_API + char path[WLC_IOCTL_SMLEN]; + int path_len; +#endif /* External conf takes precedence if specified */ dhd_conf_preinit(dhd); @@ -1412,16 +1340,22 @@ #endif #ifdef DHD_LINUX_STD_FW_API - dhd_conf_add_filepath(dhd, fw_path); - dhd_conf_add_filepath(dhd, nv_path); - dhd_conf_add_filepath(dhd, dhd->clm_path); - dhd_conf_add_filepath(dhd, dhd->conf_path); -#endif - + memset(path, 0, sizeof(path)); + path_len = dhd_conf_get_fw_path(path, sizeof(path)); + snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", fw_path); + CONFIG_MSG("Final fw_path=%s\n", path); + snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", nv_path); + CONFIG_MSG("Final nv_path=%s\n", path); + snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", dhd->clm_path); + CONFIG_MSG("Final clm_path=%s\n", path); + snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", dhd->conf_path); + CONFIG_MSG("Final conf_path=%s\n", path); +#else CONFIG_MSG("Final fw_path=%s\n", fw_path); CONFIG_MSG("Final nv_path=%s\n", nv_path); CONFIG_MSG("Final clm_path=%s\n", dhd->clm_path); CONFIG_MSG("Final conf_path=%s\n", dhd->conf_path); +#endif dhd_conf_read_config(dhd, dhd->conf_path); #ifdef DHD_TPUT_PATCH @@ -1438,17 +1372,17 @@ if (val >= def) { if (down) { - if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, ifidx)) < 0) + if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, 0)) < 0) CONFIG_ERROR("WLC_DOWN setting failed %d\n", ret); } if (cmd == WLC_SET_VAR) { CONFIG_TRACE("set %s %d\n", name, val); bcm_mkiovar(name, (char *)&val, sizeof(val), iovbuf, sizeof(iovbuf)); - if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, ifidx)) < 0) + if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) CONFIG_ERROR("%s setting failed %d\n", name, ret); } else { CONFIG_TRACE("set %s %d %d\n", name, cmd, val); - if ((ret = dhd_wl_ioctl_cmd(dhd, cmd, &val, sizeof(val), TRUE, ifidx)) < 0) + if ((ret = dhd_wl_ioctl_cmd(dhd, cmd, &val, sizeof(val), TRUE, 0)) < 0) CONFIG_ERROR("%s setting failed %d\n", name, ret); } } @@ -1551,140 +1485,6 @@ } return ret; -} - -static int -dhd_conf_get_ioctl_ver(dhd_pub_t *dhd) -{ - int ret = 0; - s32 val = 0; - - dhd->conf->ioctl_ver = WLC_IOCTL_VERSION; - ret = dhd_conf_get_iovar(dhd, 0, WLC_GET_VERSION, "WLC_GET_VERSION", - (char *)&val, sizeof(val)); - if (ret) { - return ret; - } - val = dtoh32(val); - if (val != WLC_IOCTL_VERSION && val != 1) { - CONFIG_ERROR("Version mismatch, please upgrade. Got %d, expected %d or 1\n", - val, WLC_IOCTL_VERSION); - return BCME_VERSION; - } - dhd->conf->ioctl_ver = val; - CONFIG_TRACE("ioctl_ver=%d\n", dhd->conf->ioctl_ver); - - return ret; -} - -int -dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec) -{ - int bcmerror = -1; - - memset(cspec, 0, sizeof(wl_country_t)); - bcm_mkiovar("country", NULL, 0, (char*)cspec, sizeof(wl_country_t)); - if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, cspec, sizeof(wl_country_t), - FALSE, 0)) < 0) - CONFIG_ERROR("country code getting failed %d\n", bcmerror); - - return bcmerror; -} - -int -dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec) -{ - int bcmerror = -1; - struct dhd_conf *conf = dhd->conf; - country_list_t *country = conf->country_head; - -#ifdef CCODE_LIST - bcmerror = dhd_ccode_map_country_list(dhd, cspec); -#endif - // **:XZ/11 => return XZ/11 if not found - // **:**/0 => return user specified ccode if not found, but set regrev 0 - while (country != NULL) { - if (!strncmp("**", country->cspec.country_abbrev, 2)) { - if (!strncmp("**", country->cspec.ccode, 2)) { - cspec->rev = 0; - bcmerror = 0; - break; - } - memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); - cspec->rev = country->cspec.rev; - bcmerror = 0; - break; - } else if (!strncmp(cspec->country_abbrev, - country->cspec.country_abbrev, 2)) { - memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); - cspec->rev = country->cspec.rev; - bcmerror = 0; - break; - } - country = country->next; - } - - if (!bcmerror) - CONFIG_MSG("%s/%d\n", cspec->ccode, cspec->rev); - - return bcmerror; -} - -int -dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec) -{ - int bcmerror = -1; - - memset(&dhd->dhd_cspec, 0, sizeof(wl_country_t)); - - CONFIG_MSG("set country %s, revision %d\n", cspec->ccode, cspec->rev); - bcmerror = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "country", (char *)cspec, - sizeof(wl_country_t), FALSE); - dhd_conf_get_country(dhd, cspec); - CONFIG_MSG("Country code: %s (%s/%d)\n", - cspec->country_abbrev, cspec->ccode, cspec->rev); - - return bcmerror; -} - -int -dhd_conf_fix_country(dhd_pub_t *dhd) -{ - int bcmerror = -1; - int band; - wl_uint32_list_t *list; - u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; - wl_country_t cspec; - - if (!(dhd && dhd->conf)) { - return bcmerror; - } - - memset(valid_chan_list, 0, sizeof(valid_chan_list)); - list = (wl_uint32_list_t *)(void *) valid_chan_list; - list->count = htod32(WL_NUMCHANNELS); - if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VALID_CHANNELS, valid_chan_list, - sizeof(valid_chan_list), FALSE, 0)) < 0) { - CONFIG_ERROR("get channels failed with %d\n", bcmerror); - } - - band = dhd_conf_get_band(dhd); - - if (bcmerror || ((band==WLC_BAND_AUTO || band==WLC_BAND_2G || band==-1) && - dtoh32(list->count)<11)) { - CONFIG_ERROR("bcmerror=%d, # of channels %d\n", - bcmerror, dtoh32(list->count)); - dhd_conf_map_country_list(dhd, &dhd->conf->cspec); - if ((bcmerror = dhd_conf_set_country(dhd, &dhd->conf->cspec)) < 0) { - strcpy(cspec.country_abbrev, "US"); - cspec.rev = 0; - strcpy(cspec.ccode, "US"); - dhd_conf_map_country_list(dhd, &cspec); - dhd_conf_set_country(dhd, &cspec); - } - } - - return bcmerror; } static int @@ -1894,34 +1694,6 @@ } #endif -int -dhd_conf_country(dhd_pub_t *dhd, char *cmd, char *buf) -{ - wl_country_t cspec = {{0}, 0, {0}}; - wl_country_t cur_cspec = {{0}, 0, {0}}; - int err = 0; - - if (buf) { - dhd_conf_get_country(dhd, &cur_cspec); - strlcpy(cspec.country_abbrev, buf, WL_CCODE_LEN + 1); - strlcpy(cspec.ccode, buf, WL_CCODE_LEN + 1); - dhd_conf_map_country_list(dhd, &cspec); - if (!memcmp(&cspec.ccode, &cur_cspec.ccode, WL_CCODE_LEN + 1) && - (cspec.rev == cur_cspec.rev)) { - CONFIG_MSG("country code = %s/%d is already configured\n", - cspec.ccode, cspec.rev); - return 0; - } - err = dhd_conf_set_country(dhd, &cspec); - if (!err) { - dhd_conf_fix_country(dhd); - } - dhd_conf_get_country(dhd, &dhd->dhd_cspec); - } - - return err; -} - typedef int (tpl_parse_t)(dhd_pub_t *dhd, char *name, char *buf); typedef struct iovar_tpl_t { @@ -1937,7 +1709,6 @@ #ifndef SUPPORT_RANDOM_MAC_SCAN {WLC_SET_VAR, "scanmac", dhd_conf_scan_mac}, #endif - {WLC_SET_VAR, "country", dhd_conf_country}, }; static int iovar_tpl_parse(const iovar_tpl_t *tpl, int tpl_count, @@ -2028,6 +1799,116 @@ return band; } +int +dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec) +{ + int bcmerror = -1; + + memset(cspec, 0, sizeof(wl_country_t)); + bcm_mkiovar("country", NULL, 0, (char*)cspec, sizeof(wl_country_t)); + if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, cspec, sizeof(wl_country_t), + FALSE, 0)) < 0) + CONFIG_ERROR("country code getting failed %d\n", bcmerror); + + return bcmerror; +} + +int +dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec) +{ + int bcmerror = -1; + struct dhd_conf *conf = dhd->conf; + country_list_t *country = conf->country_head; + +#ifdef CCODE_LIST + bcmerror = dhd_ccode_map_country_list(dhd, cspec); +#endif + // **:XZ/11 => return XZ/11 if not found + // **:**/0 => return user specified ccode if not found, but set regrev 0 + while (country != NULL) { + if (!strncmp("**", country->cspec.country_abbrev, 2)) { + if (!strncmp("**", country->cspec.ccode, 2)) { + cspec->rev = 0; + bcmerror = 0; + break; + } + memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); + cspec->rev = country->cspec.rev; + bcmerror = 0; + break; + } else if (!strncmp(cspec->country_abbrev, + country->cspec.country_abbrev, 2)) { + memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); + cspec->rev = country->cspec.rev; + bcmerror = 0; + break; + } + country = country->next; + } + + if (!bcmerror) + CONFIG_MSG("%s/%d\n", cspec->ccode, cspec->rev); + + return bcmerror; +} + +int +dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec) +{ + int bcmerror = -1; + + memset(&dhd->dhd_cspec, 0, sizeof(wl_country_t)); + + CONFIG_MSG("set country %s, revision %d\n", cspec->ccode, cspec->rev); + bcmerror = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "country", (char *)cspec, + sizeof(wl_country_t), FALSE); + dhd_conf_get_country(dhd, cspec); + CONFIG_MSG("Country code: %s (%s/%d)\n", + cspec->country_abbrev, cspec->ccode, cspec->rev); + + return bcmerror; +} + +int +dhd_conf_fix_country(dhd_pub_t *dhd) +{ + int bcmerror = -1; + int band; + wl_uint32_list_t *list; + u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; + wl_country_t cspec; + + if (!(dhd && dhd->conf)) { + return bcmerror; + } + + memset(valid_chan_list, 0, sizeof(valid_chan_list)); + list = (wl_uint32_list_t *)(void *) valid_chan_list; + list->count = htod32(WL_NUMCHANNELS); + if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VALID_CHANNELS, valid_chan_list, + sizeof(valid_chan_list), FALSE, 0)) < 0) { + CONFIG_ERROR("get channels failed with %d\n", bcmerror); + } + + band = dhd_conf_get_band(dhd); + + if (bcmerror || ((band==WLC_BAND_AUTO || band==WLC_BAND_2G || band==-1) && + dtoh32(list->count)<11)) { + CONFIG_ERROR("bcmerror=%d, # of channels %d\n", + bcmerror, dtoh32(list->count)); + dhd_conf_map_country_list(dhd, &dhd->conf->cspec); + if ((bcmerror = dhd_conf_set_country(dhd, &dhd->conf->cspec)) < 0) { + strcpy(cspec.country_abbrev, "US"); + cspec.rev = 0; + strcpy(cspec.ccode, "US"); + dhd_conf_map_country_list(dhd, &cspec); + dhd_conf_set_country(dhd, &cspec); + } + } + + return bcmerror; +} + bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel) { @@ -2050,39 +1931,39 @@ } int -dhd_conf_set_roam(dhd_pub_t *dhd, int ifidx) +dhd_conf_set_roam(dhd_pub_t *dhd) { int bcmerror = -1; struct dhd_conf *conf = dhd->conf; uint wnm_bsstrans_resp = 0; if (dhd->conf->chip == BCM4359_CHIP_ID) { - dhd_conf_get_iovar(dhd, ifidx, WLC_GET_VAR, "wnm_bsstrans_resp", + dhd_conf_get_iovar(dhd, 0, WLC_GET_VAR, "wnm_bsstrans_resp", (char *)&wnm_bsstrans_resp, sizeof(wnm_bsstrans_resp)); if (wnm_bsstrans_resp == WL_BSSTRANS_POLICY_PRODUCT) { dhd->wbtext_policy = WL_BSSTRANS_POLICY_ROAM_ALWAYS; - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "wnm_bsstrans_resp", + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "wnm_bsstrans_resp", WL_BSSTRANS_POLICY_ROAM_ALWAYS, 0, FALSE); } } dhd_roam_disable = conf->roam_off; - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "roam_off", dhd->conf->roam_off, 0, FALSE); + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "roam_off", dhd->conf->roam_off, 0, FALSE); if (!conf->roam_off || !conf->roam_off_suspend) { CONFIG_MSG("set roam_trigger %d\n", conf->roam_trigger[0]); - dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_ROAM_TRIGGER, "WLC_SET_ROAM_TRIGGER", + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_TRIGGER, "WLC_SET_ROAM_TRIGGER", (char *)conf->roam_trigger, sizeof(conf->roam_trigger), FALSE); CONFIG_MSG("set roam_scan_period %d\n", conf->roam_scan_period[0]); - dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_ROAM_SCAN_PERIOD, "WLC_SET_ROAM_SCAN_PERIOD", + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_SCAN_PERIOD, "WLC_SET_ROAM_SCAN_PERIOD", (char *)conf->roam_scan_period, sizeof(conf->roam_scan_period), FALSE); CONFIG_MSG("set roam_delta %d\n", conf->roam_delta[0]); - dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_ROAM_DELTA, "WLC_SET_ROAM_DELTA", + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_DELTA, "WLC_SET_ROAM_DELTA", (char *)conf->roam_delta, sizeof(conf->roam_delta), FALSE); - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "fullroamperiod", + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "fullroamperiod", dhd->conf->fullroamperiod, 1, FALSE); } @@ -2377,8 +2258,9 @@ * Case 3: magic pkt and event wake up * 1) dhd_master_mode=1 * 2) pkt_filter_delete=100, 102, 103, 104, 105, 106, 107 - * 3) magic_pkt_filter_add=141 0 1 12 - * 4) rekey_offload=1 + * 3) pkt_filter_add=141 0 0 0 0xFFFFFFFFFFFF 0x000000000000 + * 4) magic_pkt_filter_add=141 0 1 12 + * 5) rekey_offload=1 */ for(i=0; i<dhd->conf->pkt_filter_add.count; i++) { dhd->pktfilter[i+dhd->pktfilter_count] = dhd->conf->pkt_filter_add.filter[i]; @@ -2460,24 +2342,12 @@ int *hostsleep_set, int *hostsleep_val, int *ret) { if (dhd->conf->insuspend & (NO_TXCTL_IN_SUSPEND | WOWL_IN_SUSPEND)) { - int wowl_dngldown = 0; -#ifdef WL_EXT_WOWL - wowl_dngldown = dhd_conf_wowl_dngldown(dhd); -#endif if (cmd == WLC_SET_VAR) { char *psleep = NULL; - if (wowl_dngldown) { - psleep = strstr(buf, "wowl_activate"); - if (psleep) { - *hostsleep_set = 1; - memcpy(hostsleep_val, psleep+strlen("wowl_activate")+1, sizeof(int)); - } - } else { - psleep = strstr(buf, "hostsleep"); - if (psleep) { - *hostsleep_set = 1; - memcpy(hostsleep_val, psleep+strlen("hostsleep")+1, sizeof(int)); - } + psleep = strstr(buf, "hostsleep"); + if (psleep) { + *hostsleep_set = 1; + memcpy(hostsleep_val, psleep+strlen("hostsleep")+1, sizeof(int)); } } if (dhd->hostsleep && (!*hostsleep_set || *hostsleep_val)) { @@ -2719,28 +2589,13 @@ return ret; } - -int -dhd_conf_wowl_dngldown(dhd_pub_t *dhd) -{ - int wowl_dngldown = 0; -#ifdef BCMDBUS - uint insuspend = 0; - insuspend = dhd_conf_get_insuspend(dhd, ALL_IN_SUSPEND); - if ((insuspend & WOWL_IN_SUSPEND) && dhd_master_mode) { - wowl_dngldown = dhd->conf->wowl_dngldown; - } -#endif - - return wowl_dngldown; -} #endif int dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period, char *packet, bool bcast) { - wl_mkeep_alive_pkt_v1_t *mkeep_alive_pktp; + wl_mkeep_alive_pkt_t *mkeep_alive_pktp; int ret = 0, len_bytes=0, buf_len=0; char *buf = NULL, *iovar_buf = NULL; uint8 *pdata; @@ -2757,8 +2612,8 @@ CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", WLC_IOCTL_SMLEN); goto exit; } - mkeep_alive_pktp = (wl_mkeep_alive_pkt_v1_t *)buf; - mkeep_alive_pktp->version = htod16(WL_MKEEP_ALIVE_VERSION_1); + mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *)buf; + mkeep_alive_pktp->version = htod16(WL_MKEEP_ALIVE_VERSION); mkeep_alive_pktp->length = htod16(WL_MKEEP_ALIVE_FIXED_LEN); mkeep_alive_pktp->keep_alive_id = id; buf_len += WL_MKEEP_ALIVE_FIXED_LEN; @@ -2994,18 +2849,14 @@ for(i=0; i<conf->pkt_filter_add.count; i++) { dhd_conf_wowl_pattern(dhd, ifidx, TRUE, conf->pkt_filter_add.filter[i]); } - CONFIG_MSG("wowl = 0x%x\n", conf->wowl); dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "wowl", conf->wowl, 0, FALSE); -#ifdef BCMDBUS - CONFIG_MSG("wowl_dngldown = %d\n", conf->wowl_dngldown); - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "wowl_dngldown", conf->wowl_dngldown, 1, FALSE); -#endif + dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "wowl_activate", 1, 0, FALSE); dhd_conf_wowl_wakeind(dhd, ifidx, TRUE); } #endif } else { - dhd_conf_get_iovar(dhd, ifidx, WLC_GET_PM, "WLC_GET_PM", (char *)&pm, sizeof(pm)); + dhd_conf_get_iovar(dhd, 0, WLC_GET_PM, "WLC_GET_PM", (char *)&pm, sizeof(pm)); CONFIG_TRACE("PM in suspend = %d\n", pm); if (conf->pm >= 0) pm = conf->pm; @@ -3015,7 +2866,7 @@ #ifdef WL_EXT_WOWL if (insuspend & WOWL_IN_SUSPEND) { dhd_conf_wowl_wakeind(dhd, ifidx, FALSE); -// dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "wowl_activate", 0, 0, FALSE); + dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "wowl_activate", 0, 0, FALSE); dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "wowl", 0, 0, FALSE); dhd_conf_wowl_pattern(dhd, ifidx, FALSE, "clr"); } @@ -3065,32 +2916,19 @@ if (suspend) { if (insuspend & (WOWL_IN_SUSPEND | NO_TXCTL_IN_SUSPEND)) { +#ifdef BCMSDIO uint32 intstatus = 0; - int ret = 0, hostsleep = 2, wowl_dngldown = 0; + int ret = 0; +#endif + int hostsleep = 2; #ifdef WL_EXT_WOWL hostsleep = 1; - if ((insuspend & WOWL_IN_SUSPEND) && dhd_master_mode) { - dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "wowl_activate", 1, 0, FALSE); -#ifdef BCMDBUS - wowl_dngldown = dhd->conf->wowl_dngldown; #endif - } -#endif - if (!wowl_dngldown) { - dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "hostsleep", hostsleep, 0, FALSE); - } + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "hostsleep", hostsleep, 0, FALSE); #ifdef BCMSDIO ret = dhd_bus_sleep(dhd, TRUE, &intstatus); + CONFIG_TRACE("ret = %d, intstatus = 0x%x\n", ret, intstatus); #endif -#ifdef BCMPCIE - ret = dhd_bus_sleep(dhd, TRUE, NULL); -#endif -#ifdef BCMDBUS - if (wowl_dngldown) { - ret = dhd_bus_sleep(dhd, TRUE, NULL); - } -#endif - CONFIG_MSG("ret = %d, intstatus = 0x%x\n", ret, intstatus); } } else { if (insuspend & (WOWL_IN_SUSPEND | NO_TXCTL_IN_SUSPEND)) { @@ -3668,15 +3506,7 @@ else if (!strncmp("fullroamperiod=", full_param, len_param)) { conf->fullroamperiod = (int)simple_strtol(data, NULL, 10); CONFIG_MSG("fullroamperiod = %d\n", conf->fullroamperiod); - } - else if (!strncmp("wl_reassoc_support=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) - wl_reassoc_support = FALSE; - else - wl_reassoc_support = TRUE; - CONFIG_MSG("wl_reassoc_support = %d\n", wl_reassoc_support); - } - else + } else return false; return true; @@ -4015,10 +3845,11 @@ dhd_doflow = TRUE; CONFIG_MSG("dhd_doflow = %d\n", dhd_doflow); } - else if (!strncmp("dhd_slpauto=", full_param, len_param)) { - if (!strncmp(data, "0", 1)) { - dhd_conf_disable_slpauto(dhd); - } else + else if (!strncmp("dhd_slpauto=", full_param, len_param) || + !strncmp("kso_enable=", full_param, len_param)) { + if (!strncmp(data, "0", 1)) + dhd_slpauto = FALSE; + else dhd_slpauto = TRUE; CONFIG_MSG("dhd_slpauto = %d\n", dhd_slpauto); } @@ -4190,14 +4021,6 @@ conf->enq_hdr_pkt = (int)simple_strtol(data, NULL, 0); CONFIG_MSG("enq_hdr_pkt = 0x%x\n", conf->enq_hdr_pkt); } - else if (!strncmp("aspm=", full_param, len_param)) { - conf->aspm = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("aspm = %d\n", conf->aspm); - } - else if (!strncmp("l1ss=", full_param, len_param)) { - conf->l1ss = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("l1ss = %d\n", conf->l1ss); - } else return false; @@ -4256,12 +4079,6 @@ conf->wowl = (int)simple_strtol(data, NULL, 0); CONFIG_MSG("wowl = 0x%x\n", conf->wowl); } -#ifdef BCMDBUS - else if (!strncmp("wowl_dngldown=", full_param, len_param)) { - conf->wowl_dngldown = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("wowl_dngldown = 0x%x\n", conf->wowl_dngldown); - } -#endif #endif else if (!strncmp("rekey_offload=", full_param, len_param)) { if (!strncmp(data, "1", 1)) @@ -4446,12 +4263,6 @@ conf->in4way = (int)simple_strtol(data, NULL, 0); CONFIG_MSG("in4way = 0x%x\n", conf->in4way); } -#ifdef BTC_WAR - else if (!strncmp("btc_war=", full_param, len_param)) { - btc_war = (int)simple_strtol(data, NULL, 0); - CONFIG_MSG("btc_war = 0x%x\n", btc_war); - } -#endif /* BTC_WAR */ else if (!strncmp("war=", full_param, len_param)) { conf->war = (int)simple_strtol(data, NULL, 0); CONFIG_MSG("war = 0x%x\n", conf->war); @@ -4873,108 +4684,7 @@ } } - -static void -dhd_conf_set_ampdu_mpdu(dhd_pub_t *dhd) -{ - uint chip = dhd->conf->chip; - char ampdu_mpdu[32] = "ampdu_mpdu="; - int val = -1; - - if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || - chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || - chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || - chip == BCM4371_CHIP_ID || - chip == BCM43430_CHIP_ID || - chip == BCM4345_CHIP_ID || chip == BCM43454_CHIP_ID || - chip == BCM4359_CHIP_ID || chip == BCM43012_CHIP_ID) { - val = 16; - } else if (chip == BCM43751_CHIP_ID || chip == BCM43752_CHIP_ID) { - val = 32; - } - - if (val > 0) { - snprintf(ampdu_mpdu+strlen(ampdu_mpdu), sizeof(ampdu_mpdu), "%d", val); - dhd_conf_set_wl_cmd(dhd, ampdu_mpdu, TRUE); - } -} - -#if defined(SDIO_ISR_THREAD) -static void -dhd_conf_set_intr_extn(dhd_pub_t *dhd) -{ - uint chip = dhd->conf->chip; - - if (chip == BCM43012_CHIP_ID || - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || - chip == BCM43454_CHIP_ID || chip == BCM4345_CHIP_ID || - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || - chip == BCM4345_CHIP_ID || chip == BCM4371_CHIP_ID || - chip == BCM4359_CHIP_ID || - chip == BCM43751_CHIP_ID || chip == BCM43752_CHIP_ID || - chip == BCM4375_CHIP_ID) { - CONFIG_TRACE("enable intr_extn\n"); - dhd->conf->intr_extn = TRUE; - } -} -#endif /* SDIO_ISR_THREAD */ #endif - -static void -dhd_conf_set_txbf(dhd_pub_t *dhd) -{ - uint chip = dhd->conf->chip; - - if (chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || - chip == BCM4371_CHIP_ID || chip == BCM4359_CHIP_ID || - chip == BCM43569_CHIP_ID || - chip == BCM43751_CHIP_ID || chip == BCM43752_CHIP_ID || - chip == BCM4375_CHIP_ID) { - CONFIG_TRACE("enable txbf\n"); - dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "txbf", 1, 0, FALSE); - } -} - -static void -dhd_conf_tput_improve(dhd_pub_t *dhd) -{ - struct dhd_conf *conf = dhd->conf; - uint chip = conf->chip; - uint chiprev = conf->chiprev; - - if ((chip == BCM43430_CHIP_ID && chiprev == 2) || - chip == BCM43012_CHIP_ID || - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || - chip == BCM43454_CHIP_ID || chip == BCM4345_CHIP_ID || - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || - chip == BCM4345_CHIP_ID || chip == BCM4371_CHIP_ID || - chip == BCM43569_CHIP_ID || chip == BCM4359_CHIP_ID || - chip == BCM43751_CHIP_ID || chip == BCM43752_CHIP_ID || - chip == BCM4375_CHIP_ID) { - CONFIG_TRACE("enable tput parameters\n"); -#ifdef DHDTCPACK_SUPPRESS -#ifdef BCMSDIO - conf->tcpack_sup_mode = TCPACK_SUP_REPLACE; -#endif -#endif -#if defined(BCMSDIO) || defined(BCMPCIE) - dhd_rxbound = 128; - dhd_txbound = 64; -#endif - conf->frameburst = 1; -#ifdef BCMSDIO - conf->dhd_txminmax = -1; - conf->txinrx_thres = 128; -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) - conf->orphan_move = 1; -#else - conf->orphan_move = 0; -#endif - } -} #ifdef UPDATE_MODULE_NAME #if defined(BCMSDIO) || defined(BCMPCIE) @@ -4992,7 +4702,7 @@ int dhd_conf_compat_func(dhd_pub_t *dhd) { - const module_name_map_t *row = NULL; + const module_name_map_t* row = NULL; row = dhd_conf_match_module(dhd); if (row && row->compat_func) { @@ -5004,44 +4714,28 @@ #endif void -dhd_conf_preinit_ioctls_sta(dhd_pub_t *dhd, int ifidx) -{ - struct dhd_conf *conf = dhd->conf; - int pm; - - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "bcn_timeout", conf->bcn_timeout, 0, FALSE); -#ifdef NO_POWER_SAVE - pm = PM_OFF; -#else - if (conf->pm >= 0) - pm = conf->pm; - else - pm = PM_FAST; -#endif - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_PM, "WLC_SET_PM", pm, 0, FALSE); - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "assoc_retry_max", 10, 0, FALSE); - dhd_conf_set_roam(dhd, ifidx); -} - -void dhd_conf_postinit_ioctls(dhd_pub_t *dhd) { struct dhd_conf *conf = dhd->conf; - char wl_preinit[] = ""; + char wl_preinit[] = "assoc_retry_max=10"; #ifdef NO_POWER_SAVE char wl_no_power_save[] = "mpc=0, 86=0"; dhd_conf_set_wl_cmd(dhd, wl_no_power_save, FALSE); #endif - dhd_conf_get_ioctl_ver(dhd); dhd_conf_set_intiovar(dhd, 0, WLC_UP, "WLC_UP", 0, 0, FALSE); - dhd_conf_country(dhd, "country", conf->cspec.country_abbrev); + dhd_conf_map_country_list(dhd, &conf->cspec); + dhd_conf_set_country(dhd, &conf->cspec); + dhd_conf_fix_country(dhd); + dhd_conf_get_country(dhd, &dhd->dhd_cspec); dhd_conf_set_intiovar(dhd, 0, WLC_SET_BAND, "WLC_SET_BAND", conf->band, 0, FALSE); + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "bcn_timeout", conf->bcn_timeout, 0, FALSE); + dhd_conf_set_intiovar(dhd, 0, WLC_SET_PM, "WLC_SET_PM", conf->pm, 0, FALSE); dhd_conf_set_intiovar(dhd, 0, WLC_SET_SRL, "WLC_SET_SRL", conf->srl, 0, FALSE); dhd_conf_set_intiovar(dhd, 0, WLC_SET_LRL, "WLC_SET_LRL", conf->lrl, 0, FALSE); dhd_conf_set_bw_cap(dhd); - dhd_conf_set_roam(dhd, 0); + dhd_conf_set_roam(dhd); #if defined(BCMPCIE) dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "bus:deepsleep_disable", @@ -5067,17 +4761,28 @@ dhd_conf_set_intiovar(dhd, 0, WLC_SET_FAKEFRAG, "WLC_SET_FAKEFRAG", conf->frameburst, 0, FALSE); - dhd_conf_preinit_ioctls_sta(dhd, 0); dhd_conf_set_wl_cmd(dhd, wl_preinit, TRUE); #if defined(BCMSDIO) - dhd_conf_set_ampdu_mpdu(dhd); + if (conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) { + char ampdu_mpdu[] = "ampdu_mpdu=32"; + dhd_conf_set_wl_cmd(dhd, ampdu_mpdu, TRUE); + } else { + char ampdu_mpdu[] = "ampdu_mpdu=16"; + dhd_conf_set_wl_cmd(dhd, ampdu_mpdu, TRUE); + } #endif #ifdef DHD_TPUT_PATCH if (dhd->conf->mtu) dhd_change_mtu(dhd, dhd->conf->mtu, 0); #endif - dhd_conf_set_txbf(dhd); + if (conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || + conf->chip == BCM4371_CHIP_ID || conf->chip == BCM4359_CHIP_ID || + conf->chip == BCM43569_CHIP_ID || + conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID || + conf->chip == BCM4375_CHIP_ID) { + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "txbf", 1, 0, FALSE); + } if (conf->chip == BCM4375_CHIP_ID) { char he_cmd[] = "110=1, nmode=1, vhtmode=1, he=enab 1"; dhd_conf_set_wl_cmd(dhd, he_cmd, TRUE); @@ -5131,10 +4836,12 @@ } -void -dhd_conf_free_preinit(dhd_pub_t *dhd) +int +dhd_conf_preinit(dhd_pub_t *dhd) { struct dhd_conf *conf = dhd->conf; + + CONFIG_TRACE("Enter\n"); #ifdef SET_FWNV_BY_MAC dhd_conf_free_mac_list(&conf->fw_by_mac); @@ -5165,16 +4872,6 @@ kfree(conf->vndr_ie_assocreq); conf->vndr_ie_assocreq = NULL; } -} - -int -dhd_conf_preinit(dhd_pub_t *dhd) -{ - struct dhd_conf *conf = dhd->conf; - - CONFIG_TRACE("Enter\n"); - - dhd_conf_free_preinit(dhd); conf->band = -1; memset(&conf->bw_cap, -1, sizeof(conf->bw_cap)); if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID) { @@ -5197,7 +4894,6 @@ conf->cspec.rev = 0; } memset(&conf->channels, 0, sizeof(wl_channel_list_t)); - conf->ioctl_ver = WLC_IOCTL_VERSION; conf->roam_off = 1; conf->roam_off_suspend = 1; conf->roam_trigger[0] = -65; @@ -5258,12 +4954,10 @@ #endif #endif #ifdef BCMPCIE - conf->bus_deepsleep_disable = -1; + conf->bus_deepsleep_disable = 1; conf->flow_ring_queue_threshold = FLOW_RING_QUEUE_THRESHOLD; conf->d2h_intr_method = -1; conf->d2h_intr_control = -1; - conf->aspm = -1; - conf->l1ss = -1; conf->enq_hdr_pkt = 0; #endif conf->dpc_cpucore = -1; @@ -5280,9 +4974,6 @@ #ifdef WL_EXT_WOWL dhd_master_mode = TRUE; conf->wowl = WL_WOWL_NET|WL_WOWL_DIS|WL_WOWL_BCN; -#ifdef BCMDBUS - conf->wowl_dngldown = 0; -#endif conf->insuspend |= (WOWL_IN_SUSPEND | NO_TXDATA_IN_SUSPEND); #endif if (conf->suspend_mode == PM_NOTIFIER || conf->suspend_mode == SUSPEND_MODE_2) @@ -5374,9 +5065,46 @@ memset(conf->isam_enable, 0, sizeof(conf->isam_enable)); #endif #if defined(SDIO_ISR_THREAD) - dhd_conf_set_intr_extn(dhd); + if (conf->chip == BCM43012_CHIP_ID || + conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID || + conf->chip == BCM43454_CHIP_ID || conf->chip == BCM4345_CHIP_ID || + conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || + conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID || + conf->chip == BCM4359_CHIP_ID || + conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID || + conf->chip == BCM4375_CHIP_ID) { + conf->intr_extn = TRUE; + } #endif - dhd_conf_tput_improve(dhd); + if ((conf->chip == BCM43430_CHIP_ID && conf->chiprev == 2) || + conf->chip == BCM43012_CHIP_ID || + conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID || + conf->chip == BCM43454_CHIP_ID || conf->chip == BCM4345_CHIP_ID || + conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID || + conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID || + conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID || + conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID || + conf->chip == BCM4375_CHIP_ID) { +#ifdef DHDTCPACK_SUPPRESS +#ifdef BCMSDIO + conf->tcpack_sup_mode = TCPACK_SUP_REPLACE; +#endif +#endif +#if defined(BCMSDIO) || defined(BCMPCIE) + dhd_rxbound = 128; + dhd_txbound = 64; +#endif + conf->frameburst = 1; +#ifdef BCMSDIO + conf->dhd_txminmax = -1; + conf->txinrx_thres = 128; +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) + conf->orphan_move = 1; +#else + conf->orphan_move = 0; +#endif + } #ifdef DHD_TPUT_PATCH if (conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID || conf->chip == BCM4375_CHIP_ID) { @@ -5422,7 +5150,35 @@ { struct dhd_conf *conf = dhd->conf; - dhd_conf_free_preinit(dhd); +#ifdef SET_FWNV_BY_MAC + dhd_conf_free_mac_list(&conf->fw_by_mac); + dhd_conf_free_mac_list(&conf->nv_by_mac); +#endif + dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); + dhd_conf_free_country_list(conf); + dhd_conf_free_mchan_list(conf); +#ifdef PKT_FILTER_SUPPORT + if (conf->magic_pkt_filter_add) { + kfree(conf->magic_pkt_filter_add); + conf->magic_pkt_filter_add = NULL; + } +#endif + if (conf->wl_preinit) { + kfree(conf->wl_preinit); + conf->wl_preinit = NULL; + } + if (conf->wl_suspend) { + kfree(conf->wl_suspend); + conf->wl_suspend = NULL; + } + if (conf->wl_resume) { + kfree(conf->wl_resume); + conf->wl_resume = NULL; + } + if (conf->vndr_ie_assocreq) { + kfree(conf->vndr_ie_assocreq); + conf->vndr_ie_assocreq = NULL; + } memset(conf, 0, sizeof(dhd_conf_t)); return 0; } @@ -5462,7 +5218,35 @@ CONFIG_TRACE("Enter\n"); if (dhd->conf) { - dhd_conf_free_preinit(dhd); +#ifdef SET_FWNV_BY_MAC + dhd_conf_free_mac_list(&conf->fw_by_mac); + dhd_conf_free_mac_list(&conf->nv_by_mac); +#endif + dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); + dhd_conf_free_country_list(conf); + dhd_conf_free_mchan_list(conf); +#ifdef PKT_FILTER_SUPPORT + if (conf->magic_pkt_filter_add) { + kfree(conf->magic_pkt_filter_add); + conf->magic_pkt_filter_add = NULL; + } +#endif + if (conf->wl_preinit) { + kfree(conf->wl_preinit); + conf->wl_preinit = NULL; + } + if (conf->wl_suspend) { + kfree(conf->wl_suspend); + conf->wl_suspend = NULL; + } + if (conf->wl_resume) { + kfree(conf->wl_resume); + conf->wl_resume = NULL; + } + if (conf->vndr_ie_assocreq) { + kfree(conf->vndr_ie_assocreq); + conf->vndr_ie_assocreq = NULL; + } MFREE(dhd->osh, conf, sizeof(dhd_conf_t)); } dhd->conf = NULL; -- Gitblit v1.6.2