old mode 100644new mode 100755| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | | - |
|---|
| 3 | 2 | #include <typedefs.h> |
|---|
| 4 | 3 | #include <osl.h> |
|---|
| 5 | 4 | |
|---|
| .. | .. |
|---|
| 68 | 67 | #define MAXSZ_BUF 4096 |
|---|
| 69 | 68 | #define MAXSZ_CONFIG 8192 |
|---|
| 70 | 69 | |
|---|
| 71 | | -extern uint wl_reassoc_support; |
|---|
| 72 | | -#ifdef BTC_WAR |
|---|
| 73 | | -extern int btc_war; |
|---|
| 74 | | -#endif /* BTC_WAR */ |
|---|
| 75 | 70 | #if defined(BCMSDIO) && defined(DYNAMIC_MAX_HDR_READ) |
|---|
| 76 | 71 | extern uint firstread; |
|---|
| 77 | 72 | #endif |
|---|
| .. | .. |
|---|
| 145 | 140 | {BCM4375_CHIP_ID, 5, DONT_CARE, "bcm4375b4_pcie_ag", ""}, |
|---|
| 146 | 141 | #endif |
|---|
| 147 | 142 | #ifdef BCMDBUS |
|---|
| 148 | | - {BCM43143_CHIP_ID, 2, DONT_CARE, "bcm43143b0", ""}, |
|---|
| 149 | | - {BCM43242_CHIP_ID, 1, DONT_CARE, "bcm43242a1_ag", ""}, |
|---|
| 150 | | - {BCM43569_CHIP_ID, 2, DONT_CARE, "bcm4358u_ag", ""}, |
|---|
| 143 | + {BCM43143_CHIP_ID, 2, DONT_CARE, "bcm43143b0", ""}, |
|---|
| 144 | + {BCM43242_CHIP_ID, 1, DONT_CARE, "bcm43242a1_ag", ""}, |
|---|
| 145 | + {BCM43569_CHIP_ID, 2, DONT_CARE, "bcm4358u_ag", ""}, |
|---|
| 151 | 146 | #endif |
|---|
| 152 | 147 | }; |
|---|
| 153 | 148 | |
|---|
| .. | .. |
|---|
| 216 | 211 | |
|---|
| 217 | 212 | #ifdef DHD_TPUT_PATCH |
|---|
| 218 | 213 | extern int dhd_change_mtu(dhd_pub_t *dhd, int new_mtu, int ifidx); |
|---|
| 219 | | -#endif |
|---|
| 220 | | - |
|---|
| 221 | | -#ifdef WL_CFG80211 |
|---|
| 222 | | -bool |
|---|
| 223 | | -dhd_conf_legacy_chip_check(dhd_pub_t *dhd) |
|---|
| 224 | | -{ |
|---|
| 225 | | - uint chip = dhd->conf->chip; |
|---|
| 226 | | - |
|---|
| 227 | | - if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || |
|---|
| 228 | | - chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || |
|---|
| 229 | | - chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || |
|---|
| 230 | | - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || |
|---|
| 231 | | - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || |
|---|
| 232 | | - chip == BCM4371_CHIP_ID || |
|---|
| 233 | | - chip == BCM43430_CHIP_ID || |
|---|
| 234 | | - chip == BCM4345_CHIP_ID || chip == BCM43454_CHIP_ID || |
|---|
| 235 | | - chip == BCM4359_CHIP_ID || |
|---|
| 236 | | - chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID || |
|---|
| 237 | | - chip == BCM43569_CHIP_ID) { |
|---|
| 238 | | - return true; |
|---|
| 239 | | - } |
|---|
| 240 | | - |
|---|
| 241 | | - return false; |
|---|
| 242 | | -} |
|---|
| 243 | | - |
|---|
| 244 | | -bool |
|---|
| 245 | | -dhd_conf_new_chip_check(dhd_pub_t *dhd) |
|---|
| 246 | | -{ |
|---|
| 247 | | - uint chip = dhd->conf->chip; |
|---|
| 248 | | - |
|---|
| 249 | | - if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || |
|---|
| 250 | | - chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || |
|---|
| 251 | | - chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || |
|---|
| 252 | | - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || |
|---|
| 253 | | - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || |
|---|
| 254 | | - chip == BCM4371_CHIP_ID || |
|---|
| 255 | | - chip == BCM43430_CHIP_ID || |
|---|
| 256 | | - chip == BCM4345_CHIP_ID || chip == BCM43454_CHIP_ID || |
|---|
| 257 | | - chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID || |
|---|
| 258 | | - chip == BCM43569_CHIP_ID) { |
|---|
| 259 | | - return false; |
|---|
| 260 | | - } |
|---|
| 261 | | - |
|---|
| 262 | | - return true; |
|---|
| 263 | | -} |
|---|
| 264 | | - |
|---|
| 265 | | -bool |
|---|
| 266 | | -dhd_conf_extsae_chip(dhd_pub_t *dhd) |
|---|
| 267 | | -{ |
|---|
| 268 | | - uint chip = dhd->conf->chip; |
|---|
| 269 | | - |
|---|
| 270 | | - if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || |
|---|
| 271 | | - chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || |
|---|
| 272 | | - chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || |
|---|
| 273 | | - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || |
|---|
| 274 | | - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || |
|---|
| 275 | | - chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID || |
|---|
| 276 | | - chip == BCM43569_CHIP_ID) { |
|---|
| 277 | | - return false; |
|---|
| 278 | | - } |
|---|
| 279 | | - |
|---|
| 280 | | - return true; |
|---|
| 281 | | -} |
|---|
| 282 | | -#endif |
|---|
| 283 | | - |
|---|
| 284 | | -#ifdef BCMSDIO |
|---|
| 285 | | -bool |
|---|
| 286 | | -dhd_conf_disable_slpauto(dhd_pub_t *dhd) |
|---|
| 287 | | -{ |
|---|
| 288 | | - uint chip = dhd->conf->chip; |
|---|
| 289 | | - |
|---|
| 290 | | - if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID || |
|---|
| 291 | | - chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID || |
|---|
| 292 | | - chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID || |
|---|
| 293 | | - chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID || |
|---|
| 294 | | - chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID || |
|---|
| 295 | | - chip == BCM4371_CHIP_ID || |
|---|
| 296 | | - chip == BCM43430_CHIP_ID || |
|---|
| 297 | | - chip == BCM4345_CHIP_ID || chip == BCM43454_CHIP_ID || |
|---|
| 298 | | - chip == BCM4359_CHIP_ID) { |
|---|
| 299 | | - return false; |
|---|
| 300 | | - } |
|---|
| 301 | | - |
|---|
| 302 | | - return true; |
|---|
| 303 | | -} |
|---|
| 304 | 214 | #endif |
|---|
| 305 | 215 | |
|---|
| 306 | 216 | void |
|---|
| .. | .. |
|---|
| 780 | 690 | chiprev = dhd->conf->chiprev; |
|---|
| 781 | 691 | |
|---|
| 782 | 692 | for (i=0; i<sizeof(chip_name_map)/sizeof(chip_name_map[0]); i++) { |
|---|
| 783 | | - const chip_name_map_t *row = &chip_name_map[i]; |
|---|
| 693 | + const chip_name_map_t* row = &chip_name_map[i]; |
|---|
| 784 | 694 | if (row->chip == chip && row->chiprev == chiprev && |
|---|
| 785 | 695 | (row->ag_type == ag_type || |
|---|
| 786 | 696 | ag_type == DONT_CARE || row->ag_type == DONT_CARE)) { |
|---|
| .. | .. |
|---|
| 813 | 723 | |
|---|
| 814 | 724 | #ifdef BCMSDIO |
|---|
| 815 | 725 | for (i=0; i<sizeof(module_name_map)/sizeof(module_name_map[0]); i++) { |
|---|
| 816 | | - const module_name_map_t *row = &module_name_map[i]; |
|---|
| 726 | + const module_name_map_t* row = &module_name_map[i]; |
|---|
| 817 | 727 | if (row->devid == devid && row->chip == chip && row->chiprev == chiprev && |
|---|
| 818 | 728 | !strcmp(row->module_name, dhd->conf->module_name)) { |
|---|
| 819 | 729 | return row; |
|---|
| .. | .. |
|---|
| 823 | 733 | |
|---|
| 824 | 734 | #ifdef BCMPCIE |
|---|
| 825 | 735 | for (i=0; i<sizeof(module_name_map)/sizeof(module_name_map[0]); i++) { |
|---|
| 826 | | - const module_name_map_t *row = &module_name_map[i]; |
|---|
| 736 | + const module_name_map_t* row = &module_name_map[i]; |
|---|
| 827 | 737 | if (row->devid == devid && row->chip == chip && row->chiprev == chiprev && |
|---|
| 828 | 738 | row->svid == svid && row->ssid == ssid) { |
|---|
| 829 | 739 | return row; |
|---|
| .. | .. |
|---|
| 835 | 745 | } |
|---|
| 836 | 746 | #endif |
|---|
| 837 | 747 | |
|---|
| 838 | | -char * |
|---|
| 839 | | -dhd_conf_get_chip_name(dhd_pub_t *dhd, int ag_type, bool *chip_map_v2) |
|---|
| 840 | | -{ |
|---|
| 841 | | -#ifdef UPDATE_MODULE_NAME |
|---|
| 842 | | - const module_name_map_t *row_module = NULL; |
|---|
| 843 | | -#endif |
|---|
| 844 | | - const chip_name_map_t *row_chip = NULL; |
|---|
| 845 | | - char *name = NULL; |
|---|
| 846 | | - |
|---|
| 847 | | - *chip_map_v2 = FALSE; |
|---|
| 848 | | -#ifdef UPDATE_MODULE_NAME |
|---|
| 849 | | - row_module = dhd_conf_match_module(dhd); |
|---|
| 850 | | - if (row_module && strlen(row_module->chip_name)) { |
|---|
| 851 | | - name = row_module->chip_name; |
|---|
| 852 | | - } else |
|---|
| 853 | | -#endif |
|---|
| 854 | | - { |
|---|
| 855 | | - row_chip = dhd_conf_match_chip(dhd, ag_type); |
|---|
| 856 | | - if (row_chip && strlen(row_chip->chip_name)) { |
|---|
| 857 | | - name = row_chip->chip_name; |
|---|
| 858 | | - } |
|---|
| 859 | | - } |
|---|
| 860 | | - |
|---|
| 861 | | - return name; |
|---|
| 862 | | -} |
|---|
| 863 | | - |
|---|
| 864 | | -char * |
|---|
| 865 | | -dhd_conf_get_module_name(dhd_pub_t *dhd, int ag_type) |
|---|
| 866 | | -{ |
|---|
| 867 | | -#if defined(BCMPCIE) && defined(UPDATE_MODULE_NAME) |
|---|
| 868 | | - const module_name_map_t *row_module = NULL; |
|---|
| 869 | | -#endif |
|---|
| 870 | | - const chip_name_map_t *row_chip = NULL; |
|---|
| 871 | | - char *name = NULL; |
|---|
| 872 | | - |
|---|
| 873 | | -#if defined(BCMPCIE) && defined(UPDATE_MODULE_NAME) |
|---|
| 874 | | - row_module = dhd_conf_match_module(dhd); |
|---|
| 875 | | - if (row_module && strlen(row_module->module_name)) { |
|---|
| 876 | | - name = row_module->module_name; |
|---|
| 877 | | - } else |
|---|
| 878 | | -#endif |
|---|
| 879 | | - { |
|---|
| 880 | | - row_chip = dhd_conf_match_chip(dhd, ag_type); |
|---|
| 881 | | - if (row_chip && strlen(row_chip->module_name)) { |
|---|
| 882 | | - name = row_chip->module_name; |
|---|
| 883 | | - } |
|---|
| 884 | | - } |
|---|
| 885 | | - |
|---|
| 886 | | - return name; |
|---|
| 887 | | -} |
|---|
| 888 | | - |
|---|
| 889 | 748 | int |
|---|
| 890 | 749 | dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path) |
|---|
| 891 | 750 | { |
|---|
| 751 | +#ifdef UPDATE_MODULE_NAME |
|---|
| 752 | + const module_name_map_t* row_module = NULL; |
|---|
| 753 | +#endif |
|---|
| 754 | + const chip_name_map_t* row_chip = NULL; |
|---|
| 892 | 755 | int fw_type, ag_type; |
|---|
| 893 | | - char *name_ptr, *chip_name = NULL; |
|---|
| 894 | | - bool chip_map_v2; |
|---|
| 756 | + uint chip, chiprev; |
|---|
| 757 | + char *name_ptr; |
|---|
| 895 | 758 | int i; |
|---|
| 759 | + |
|---|
| 760 | + chip = dhd->conf->chip; |
|---|
| 761 | + chiprev = dhd->conf->chiprev; |
|---|
| 896 | 762 | |
|---|
| 897 | 763 | if (fw_path[0] == '\0') { |
|---|
| 898 | 764 | #ifdef CONFIG_BCMDHD_FW_PATH |
|---|
| .. | .. |
|---|
| 944 | 810 | fw_type = FW_TYPE_EZMESH; |
|---|
| 945 | 811 | #endif /* WLEASYMESH */ |
|---|
| 946 | 812 | |
|---|
| 947 | | - chip_name = dhd_conf_get_chip_name(dhd, ag_type, &chip_map_v2); |
|---|
| 948 | | - if (chip_name) { |
|---|
| 813 | + row_chip = dhd_conf_match_chip(dhd, ag_type); |
|---|
| 814 | + if (row_chip && strlen(row_chip->chip_name)) { |
|---|
| 949 | 815 | strcpy(name_ptr, "fw_"); |
|---|
| 950 | | - strcat(name_ptr, chip_name); |
|---|
| 816 | + strcat(name_ptr, row_chip->chip_name); |
|---|
| 951 | 817 | #ifdef BCMUSBDEV_COMPOSITE |
|---|
| 952 | 818 | strcat(name_ptr, "_cusb"); |
|---|
| 953 | 819 | #endif |
|---|
| .. | .. |
|---|
| 969 | 835 | strcat(name_ptr, ".bin"); |
|---|
| 970 | 836 | } |
|---|
| 971 | 837 | |
|---|
| 838 | +#ifdef UPDATE_MODULE_NAME |
|---|
| 839 | + row_module = dhd_conf_match_module(dhd); |
|---|
| 840 | + if (row_module && strlen(row_module->chip_name)) { |
|---|
| 841 | + strcpy(name_ptr, "fw_"); |
|---|
| 842 | + strcat(name_ptr, row_module->chip_name); |
|---|
| 843 | +#ifdef BCMUSBDEV_COMPOSITE |
|---|
| 844 | + strcat(name_ptr, "_cusb"); |
|---|
| 845 | +#endif |
|---|
| 846 | + if (fw_type == FW_TYPE_APSTA) |
|---|
| 847 | + strcat(name_ptr, "_apsta.bin"); |
|---|
| 848 | + else if (fw_type == FW_TYPE_P2P) |
|---|
| 849 | + strcat(name_ptr, "_p2p.bin"); |
|---|
| 850 | + else if (fw_type == FW_TYPE_MESH) |
|---|
| 851 | + strcat(name_ptr, "_mesh.bin"); |
|---|
| 852 | + else if (fw_type == FW_TYPE_EZMESH) |
|---|
| 853 | + strcat(name_ptr, "_ezmesh.bin"); |
|---|
| 854 | + else if (fw_type == FW_TYPE_ES) |
|---|
| 855 | + strcat(name_ptr, "_es.bin"); |
|---|
| 856 | + else if (fw_type == FW_TYPE_MFG) |
|---|
| 857 | + strcat(name_ptr, "_mfg.bin"); |
|---|
| 858 | + else if (fw_type == FW_TYPE_MINIME) |
|---|
| 859 | + strcat(name_ptr, "_minime.bin"); |
|---|
| 860 | + else |
|---|
| 861 | + strcat(name_ptr, ".bin"); |
|---|
| 862 | + } |
|---|
| 863 | +#endif |
|---|
| 864 | + |
|---|
| 972 | 865 | dhd->conf->fw_type = fw_type; |
|---|
| 973 | 866 | |
|---|
| 974 | 867 | #ifndef MINIME |
|---|
| .. | .. |
|---|
| 983 | 876 | void |
|---|
| 984 | 877 | dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path, int ag_type) |
|---|
| 985 | 878 | { |
|---|
| 986 | | - char *name_ptr, *chip_name = NULL; |
|---|
| 987 | | - bool chip_map_v2; |
|---|
| 879 | +#ifdef UPDATE_MODULE_NAME |
|---|
| 880 | + const module_name_map_t* row_module = NULL; |
|---|
| 881 | +#endif |
|---|
| 882 | + const chip_name_map_t* row_chip = NULL; |
|---|
| 883 | + uint chip, chiprev; |
|---|
| 884 | + char *name_ptr; |
|---|
| 988 | 885 | int i; |
|---|
| 886 | + |
|---|
| 887 | + chip = dhd->conf->chip; |
|---|
| 888 | + chiprev = dhd->conf->chiprev; |
|---|
| 989 | 889 | |
|---|
| 990 | 890 | if (clm_path[0] == '\0') { |
|---|
| 991 | 891 | CONFIG_MSG("clm path is null\n"); |
|---|
| .. | .. |
|---|
| 1003 | 903 | } |
|---|
| 1004 | 904 | name_ptr = &clm_path[i]; |
|---|
| 1005 | 905 | |
|---|
| 1006 | | - chip_name = dhd_conf_get_chip_name(dhd, ag_type, &chip_map_v2); |
|---|
| 1007 | | - if (chip_name) { |
|---|
| 906 | + row_chip = dhd_conf_match_chip(dhd, ag_type); |
|---|
| 907 | + if (row_chip && strlen(row_chip->chip_name)) { |
|---|
| 1008 | 908 | strcpy(name_ptr, "clm_"); |
|---|
| 1009 | | - strcat(name_ptr, chip_name); |
|---|
| 909 | + strcat(name_ptr, row_chip->chip_name); |
|---|
| 1010 | 910 | strcat(name_ptr, ".blob"); |
|---|
| 1011 | 911 | } |
|---|
| 912 | + |
|---|
| 913 | +#ifdef UPDATE_MODULE_NAME |
|---|
| 914 | + row_module = dhd_conf_match_module(dhd); |
|---|
| 915 | + if (row_module && strlen(row_module->chip_name)) { |
|---|
| 916 | + strcpy(name_ptr, "clm_"); |
|---|
| 917 | + strcat(name_ptr, row_module->chip_name); |
|---|
| 918 | + strcat(name_ptr, ".blob"); |
|---|
| 919 | + } |
|---|
| 920 | +#endif |
|---|
| 1012 | 921 | |
|---|
| 1013 | 922 | CONFIG_TRACE("clm_path=%s\n", clm_path); |
|---|
| 1014 | 923 | } |
|---|
| .. | .. |
|---|
| 1016 | 925 | void |
|---|
| 1017 | 926 | dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path, int ag_type) |
|---|
| 1018 | 927 | { |
|---|
| 928 | +#if defined(BCMPCIE) && defined(UPDATE_MODULE_NAME) |
|---|
| 929 | + const module_name_map_t* row_module = NULL; |
|---|
| 930 | +#endif |
|---|
| 931 | + const chip_name_map_t* row_chip = NULL; |
|---|
| 1019 | 932 | uint chip, chiprev; |
|---|
| 1020 | | - char *name_ptr, *module_name = NULL, nv_name[32]; |
|---|
| 933 | + char *name_ptr, nv_name[32]; |
|---|
| 1021 | 934 | int i; |
|---|
| 1022 | 935 | |
|---|
| 1023 | 936 | chip = dhd->conf->chip; |
|---|
| .. | .. |
|---|
| 1045 | 958 | } |
|---|
| 1046 | 959 | name_ptr = &nv_path[i]; |
|---|
| 1047 | 960 | |
|---|
| 1048 | | - module_name = dhd_conf_get_module_name(dhd, ag_type); |
|---|
| 1049 | | - if (module_name) { |
|---|
| 961 | + row_chip = dhd_conf_match_chip(dhd, ag_type); |
|---|
| 962 | + if (row_chip && strlen(row_chip->module_name)) { |
|---|
| 1050 | 963 | strcpy(name_ptr, "nvram_"); |
|---|
| 1051 | | - strcat(name_ptr, module_name); |
|---|
| 964 | + strcat(name_ptr, row_chip->module_name); |
|---|
| 1052 | 965 | #ifdef BCMUSBDEV_COMPOSITE |
|---|
| 1053 | 966 | strcat(name_ptr, "_cusb"); |
|---|
| 1054 | 967 | #endif |
|---|
| .. | .. |
|---|
| 1065 | 978 | if (dhd->conf->chip == BCM4359_CHIP_ID) { |
|---|
| 1066 | 979 | struct file *fp; |
|---|
| 1067 | 980 | // compatible for AP6398S and AP6398SA |
|---|
| 1068 | | - fp = dhd_filp_open(nv_path, O_RDONLY, 0); |
|---|
| 1069 | | - if (IS_ERR(fp) || (fp == NULL)) { |
|---|
| 981 | + fp = filp_open(nv_path, O_RDONLY, 0); |
|---|
| 982 | + if (IS_ERR(fp)) { |
|---|
| 1070 | 983 | strcpy(name_ptr, nv_name); |
|---|
| 1071 | 984 | } else { |
|---|
| 1072 | | - dhd_filp_close((struct file *)fp, NULL); |
|---|
| 985 | + filp_close((struct file *)fp, NULL); |
|---|
| 1073 | 986 | } |
|---|
| 1074 | 987 | } |
|---|
| 1075 | 988 | #endif |
|---|
| 989 | + } |
|---|
| 990 | +#endif |
|---|
| 991 | + |
|---|
| 992 | +#if defined(BCMPCIE) && defined(UPDATE_MODULE_NAME) |
|---|
| 993 | + row_module = dhd_conf_match_module(dhd); |
|---|
| 994 | + if (row_module && strlen(row_module->module_name)) { |
|---|
| 995 | + strcpy(name_ptr, "nvram_"); |
|---|
| 996 | + strcat(name_ptr, row_module->module_name); |
|---|
| 997 | + strcat(name_ptr, ".txt"); |
|---|
| 1076 | 998 | } |
|---|
| 1077 | 999 | #endif |
|---|
| 1078 | 1000 | |
|---|
| .. | .. |
|---|
| 1116 | 1038 | void |
|---|
| 1117 | 1039 | dhd_conf_set_conf_name_by_chip(dhd_pub_t *dhd, char *conf_path) |
|---|
| 1118 | 1040 | { |
|---|
| 1119 | | - char *name_ptr, *chip_name = NULL; |
|---|
| 1120 | | - bool chip_map_v2; |
|---|
| 1041 | +#ifdef UPDATE_MODULE_NAME |
|---|
| 1042 | + const module_name_map_t* row_module = NULL; |
|---|
| 1043 | +#endif |
|---|
| 1044 | + const chip_name_map_t* row_chip = NULL; |
|---|
| 1045 | + uint chip, chiprev; |
|---|
| 1046 | + char *name_ptr; |
|---|
| 1121 | 1047 | int i; |
|---|
| 1048 | + |
|---|
| 1049 | + chip = dhd->conf->chip; |
|---|
| 1050 | + chiprev = dhd->conf->chiprev; |
|---|
| 1122 | 1051 | |
|---|
| 1123 | 1052 | if (conf_path[0] == '\0') { |
|---|
| 1124 | 1053 | CONFIG_MSG("config path is null\n"); |
|---|
| .. | .. |
|---|
| 1136 | 1065 | } |
|---|
| 1137 | 1066 | name_ptr = &conf_path[i]; |
|---|
| 1138 | 1067 | |
|---|
| 1139 | | - chip_name = dhd_conf_get_chip_name(dhd, DONT_CARE, &chip_map_v2); |
|---|
| 1140 | | - if (chip_name) { |
|---|
| 1068 | + row_chip = dhd_conf_match_chip(dhd, DONT_CARE); |
|---|
| 1069 | + if (row_chip && strlen(row_chip->chip_name)) { |
|---|
| 1141 | 1070 | strcpy(name_ptr, "config_"); |
|---|
| 1142 | | - strcat(name_ptr, chip_name); |
|---|
| 1071 | + strcat(name_ptr, row_chip->chip_name); |
|---|
| 1143 | 1072 | strcat(name_ptr, ".txt"); |
|---|
| 1144 | 1073 | } |
|---|
| 1074 | + |
|---|
| 1075 | +#ifdef UPDATE_MODULE_NAME |
|---|
| 1076 | + row_module = dhd_conf_match_module(dhd); |
|---|
| 1077 | + if (row_module && strlen(row_module->chip_name)) { |
|---|
| 1078 | + strcpy(name_ptr, "config_"); |
|---|
| 1079 | + strcat(name_ptr, row_module->chip_name); |
|---|
| 1080 | + strcat(name_ptr, ".txt"); |
|---|
| 1081 | + } |
|---|
| 1082 | +#endif |
|---|
| 1145 | 1083 | |
|---|
| 1146 | 1084 | CONFIG_TRACE("config_path=%s\n", conf_path); |
|---|
| 1147 | 1085 | } |
|---|
| .. | .. |
|---|
| 1318 | 1256 | |
|---|
| 1319 | 1257 | #ifdef DHD_LINUX_STD_FW_API |
|---|
| 1320 | 1258 | #define FIRMWARE_CLASS_PATH "/sys/module/firmware_class/parameters/path" |
|---|
| 1259 | +static int |
|---|
| 1260 | +dhd_conf_get_fw_path(char *path, int len) |
|---|
| 1261 | +{ |
|---|
| 1262 | + char *pch; |
|---|
| 1263 | + int err, path_len = 0; |
|---|
| 1264 | + |
|---|
| 1265 | + err = dhd_read_file(FIRMWARE_CLASS_PATH, path, len); |
|---|
| 1266 | + if(err < 0){ |
|---|
| 1267 | + CONFIG_ERROR("firmware path can not read %d\n", err); |
|---|
| 1268 | + } else { |
|---|
| 1269 | + pch = strchr(path, '\n'); |
|---|
| 1270 | + if (pch) |
|---|
| 1271 | + *pch = '\0'; |
|---|
| 1272 | + CONFIG_TRACE("path = %s\n", path); |
|---|
| 1273 | + path_len = strlen(path); |
|---|
| 1274 | + } |
|---|
| 1275 | + |
|---|
| 1276 | + return path_len; |
|---|
| 1277 | +} |
|---|
| 1278 | + |
|---|
| 1321 | 1279 | static void |
|---|
| 1322 | 1280 | dhd_conf_get_filename(char *pFilename) |
|---|
| 1323 | 1281 | { |
|---|
| .. | .. |
|---|
| 1339 | 1297 | |
|---|
| 1340 | 1298 | if (pName) |
|---|
| 1341 | 1299 | strcpy(pFilename, pName); |
|---|
| 1342 | | - |
|---|
| 1343 | 1300 | return; |
|---|
| 1344 | 1301 | } |
|---|
| 1345 | | - |
|---|
| 1346 | | -static void |
|---|
| 1347 | | -dhd_conf_add_filepath(dhd_pub_t *dhd, char *pFilename) |
|---|
| 1348 | | -{ |
|---|
| 1349 | | - char path[WLC_IOCTL_SMLEN]; |
|---|
| 1350 | | - char *name_ptr, *module_name = NULL; |
|---|
| 1351 | | - |
|---|
| 1352 | | - if (strlen(pFilename)) { |
|---|
| 1353 | | - name_ptr = path; |
|---|
| 1354 | | - strcpy(name_ptr, ""); |
|---|
| 1355 | | -#ifdef FW_AMPAK_PATH |
|---|
| 1356 | | - strcat(name_ptr, "/"); |
|---|
| 1357 | | - strcat(name_ptr, FW_AMPAK_PATH); |
|---|
| 1358 | | -#endif |
|---|
| 1359 | | -#ifdef MODULE_PATH |
|---|
| 1360 | | -#if defined(BCMSDIO) && defined(GET_OTP_MODULE_NAME) |
|---|
| 1361 | | - if (strlen(dhd->conf->module_name)) |
|---|
| 1362 | | - module_name = dhd->conf->module_name; |
|---|
| 1363 | | - else |
|---|
| 1364 | | -#endif |
|---|
| 1365 | | - { |
|---|
| 1366 | | - module_name = dhd_conf_get_module_name(dhd, DONT_CARE); |
|---|
| 1367 | | - } |
|---|
| 1368 | | -#endif |
|---|
| 1369 | | - if (module_name) { |
|---|
| 1370 | | - strcat(name_ptr, "/"); |
|---|
| 1371 | | - strcat(name_ptr, module_name); |
|---|
| 1372 | | - } |
|---|
| 1373 | | - strcat(name_ptr, "/"); |
|---|
| 1374 | | - strcat(name_ptr, pFilename); |
|---|
| 1375 | | - strcpy(pFilename, path); |
|---|
| 1376 | | - } |
|---|
| 1377 | | - |
|---|
| 1378 | | - return; |
|---|
| 1379 | | -} |
|---|
| 1380 | | - |
|---|
| 1381 | 1302 | #endif /* DHD_LINUX_STD_FW_API */ |
|---|
| 1382 | 1303 | |
|---|
| 1383 | 1304 | void |
|---|
| 1384 | 1305 | dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path) |
|---|
| 1385 | 1306 | { |
|---|
| 1386 | 1307 | int ag_type; |
|---|
| 1308 | +#ifdef DHD_LINUX_STD_FW_API |
|---|
| 1309 | + char path[WLC_IOCTL_SMLEN]; |
|---|
| 1310 | + int path_len; |
|---|
| 1311 | +#endif |
|---|
| 1387 | 1312 | |
|---|
| 1388 | 1313 | /* External conf takes precedence if specified */ |
|---|
| 1389 | 1314 | dhd_conf_preinit(dhd); |
|---|
| .. | .. |
|---|
| 1415 | 1340 | #endif |
|---|
| 1416 | 1341 | |
|---|
| 1417 | 1342 | #ifdef DHD_LINUX_STD_FW_API |
|---|
| 1418 | | - // preprocess the filename to only left 'name' |
|---|
| 1419 | | - dhd_conf_add_filepath(dhd, fw_path); |
|---|
| 1420 | | - dhd_conf_add_filepath(dhd, nv_path); |
|---|
| 1421 | | - dhd_conf_add_filepath(dhd, dhd->clm_path); |
|---|
| 1422 | | - dhd_conf_add_filepath(dhd, dhd->conf_path); |
|---|
| 1423 | | -#endif |
|---|
| 1424 | | - |
|---|
| 1343 | + memset(path, 0, sizeof(path)); |
|---|
| 1344 | + path_len = dhd_conf_get_fw_path(path, sizeof(path)); |
|---|
| 1345 | + snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", fw_path); |
|---|
| 1346 | + CONFIG_MSG("Final fw_path=%s\n", path); |
|---|
| 1347 | + snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", nv_path); |
|---|
| 1348 | + CONFIG_MSG("Final nv_path=%s\n", path); |
|---|
| 1349 | + snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", dhd->clm_path); |
|---|
| 1350 | + CONFIG_MSG("Final clm_path=%s\n", path); |
|---|
| 1351 | + snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", dhd->conf_path); |
|---|
| 1352 | + CONFIG_MSG("Final conf_path=%s\n", path); |
|---|
| 1353 | +#else |
|---|
| 1425 | 1354 | CONFIG_MSG("Final fw_path=%s\n", fw_path); |
|---|
| 1426 | 1355 | CONFIG_MSG("Final nv_path=%s\n", nv_path); |
|---|
| 1427 | 1356 | CONFIG_MSG("Final clm_path=%s\n", dhd->clm_path); |
|---|
| 1428 | 1357 | CONFIG_MSG("Final conf_path=%s\n", dhd->conf_path); |
|---|
| 1358 | +#endif |
|---|
| 1429 | 1359 | |
|---|
| 1430 | 1360 | dhd_conf_read_config(dhd, dhd->conf_path); |
|---|
| 1431 | 1361 | #ifdef DHD_TPUT_PATCH |
|---|
| .. | .. |
|---|
| 1442 | 1372 | |
|---|
| 1443 | 1373 | if (val >= def) { |
|---|
| 1444 | 1374 | if (down) { |
|---|
| 1445 | | - if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, ifidx)) < 0) |
|---|
| 1375 | + if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_DOWN, NULL, 0, TRUE, 0)) < 0) |
|---|
| 1446 | 1376 | CONFIG_ERROR("WLC_DOWN setting failed %d\n", ret); |
|---|
| 1447 | 1377 | } |
|---|
| 1448 | 1378 | if (cmd == WLC_SET_VAR) { |
|---|
| 1449 | 1379 | CONFIG_TRACE("set %s %d\n", name, val); |
|---|
| 1450 | 1380 | bcm_mkiovar(name, (char *)&val, sizeof(val), iovbuf, sizeof(iovbuf)); |
|---|
| 1451 | | - if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, ifidx)) < 0) |
|---|
| 1381 | + if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0) |
|---|
| 1452 | 1382 | CONFIG_ERROR("%s setting failed %d\n", name, ret); |
|---|
| 1453 | 1383 | } else { |
|---|
| 1454 | 1384 | CONFIG_TRACE("set %s %d %d\n", name, cmd, val); |
|---|
| 1455 | | - if ((ret = dhd_wl_ioctl_cmd(dhd, cmd, &val, sizeof(val), TRUE, ifidx)) < 0) |
|---|
| 1385 | + if ((ret = dhd_wl_ioctl_cmd(dhd, cmd, &val, sizeof(val), TRUE, 0)) < 0) |
|---|
| 1456 | 1386 | CONFIG_ERROR("%s setting failed %d\n", name, ret); |
|---|
| 1457 | 1387 | } |
|---|
| 1458 | 1388 | } |
|---|
| .. | .. |
|---|
| 1555 | 1485 | } |
|---|
| 1556 | 1486 | |
|---|
| 1557 | 1487 | return ret; |
|---|
| 1558 | | -} |
|---|
| 1559 | | - |
|---|
| 1560 | | -static int |
|---|
| 1561 | | -dhd_conf_get_ioctl_ver(dhd_pub_t *dhd) |
|---|
| 1562 | | -{ |
|---|
| 1563 | | - int ret = 0; |
|---|
| 1564 | | - s32 val = 0; |
|---|
| 1565 | | - |
|---|
| 1566 | | - dhd->conf->ioctl_ver = WLC_IOCTL_VERSION; |
|---|
| 1567 | | - ret = dhd_conf_get_iovar(dhd, 0, WLC_GET_VERSION, "WLC_GET_VERSION", |
|---|
| 1568 | | - (char *)&val, sizeof(val)); |
|---|
| 1569 | | - if (ret) { |
|---|
| 1570 | | - return ret; |
|---|
| 1571 | | - } |
|---|
| 1572 | | - val = dtoh32(val); |
|---|
| 1573 | | - if (val != WLC_IOCTL_VERSION && val != 1) { |
|---|
| 1574 | | - CONFIG_ERROR("Version mismatch, please upgrade. Got %d, expected %d or 1\n", |
|---|
| 1575 | | - val, WLC_IOCTL_VERSION); |
|---|
| 1576 | | - return BCME_VERSION; |
|---|
| 1577 | | - } |
|---|
| 1578 | | - dhd->conf->ioctl_ver = val; |
|---|
| 1579 | | - CONFIG_TRACE("ioctl_ver=%d\n", dhd->conf->ioctl_ver); |
|---|
| 1580 | | - |
|---|
| 1581 | | - return ret; |
|---|
| 1582 | | -} |
|---|
| 1583 | | - |
|---|
| 1584 | | -int |
|---|
| 1585 | | -dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec) |
|---|
| 1586 | | -{ |
|---|
| 1587 | | - int bcmerror = -1; |
|---|
| 1588 | | - |
|---|
| 1589 | | - memset(cspec, 0, sizeof(wl_country_t)); |
|---|
| 1590 | | - bcm_mkiovar("country", NULL, 0, (char*)cspec, sizeof(wl_country_t)); |
|---|
| 1591 | | - if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, cspec, sizeof(wl_country_t), |
|---|
| 1592 | | - FALSE, 0)) < 0) |
|---|
| 1593 | | - CONFIG_ERROR("country code getting failed %d\n", bcmerror); |
|---|
| 1594 | | - |
|---|
| 1595 | | - return bcmerror; |
|---|
| 1596 | | -} |
|---|
| 1597 | | - |
|---|
| 1598 | | -int |
|---|
| 1599 | | -dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec) |
|---|
| 1600 | | -{ |
|---|
| 1601 | | - int bcmerror = -1; |
|---|
| 1602 | | - struct dhd_conf *conf = dhd->conf; |
|---|
| 1603 | | - country_list_t *country = conf->country_head; |
|---|
| 1604 | | - |
|---|
| 1605 | | -#ifdef CCODE_LIST |
|---|
| 1606 | | - bcmerror = dhd_ccode_map_country_list(dhd, cspec); |
|---|
| 1607 | | -#endif |
|---|
| 1608 | | - // **:XZ/11 => return XZ/11 if not found |
|---|
| 1609 | | - // **:**/0 => return user specified ccode if not found, but set regrev 0 |
|---|
| 1610 | | - while (country != NULL) { |
|---|
| 1611 | | - if (!strncmp("**", country->cspec.country_abbrev, 2)) { |
|---|
| 1612 | | - if (!strncmp("**", country->cspec.ccode, 2)) { |
|---|
| 1613 | | - cspec->rev = 0; |
|---|
| 1614 | | - bcmerror = 0; |
|---|
| 1615 | | - break; |
|---|
| 1616 | | - } |
|---|
| 1617 | | - memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); |
|---|
| 1618 | | - cspec->rev = country->cspec.rev; |
|---|
| 1619 | | - bcmerror = 0; |
|---|
| 1620 | | - break; |
|---|
| 1621 | | - } else if (!strncmp(cspec->country_abbrev, |
|---|
| 1622 | | - country->cspec.country_abbrev, 2)) { |
|---|
| 1623 | | - memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); |
|---|
| 1624 | | - cspec->rev = country->cspec.rev; |
|---|
| 1625 | | - bcmerror = 0; |
|---|
| 1626 | | - break; |
|---|
| 1627 | | - } |
|---|
| 1628 | | - country = country->next; |
|---|
| 1629 | | - } |
|---|
| 1630 | | - |
|---|
| 1631 | | - if (!bcmerror) |
|---|
| 1632 | | - CONFIG_MSG("%s/%d\n", cspec->ccode, cspec->rev); |
|---|
| 1633 | | - |
|---|
| 1634 | | - return bcmerror; |
|---|
| 1635 | | -} |
|---|
| 1636 | | - |
|---|
| 1637 | | -int |
|---|
| 1638 | | -dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec) |
|---|
| 1639 | | -{ |
|---|
| 1640 | | - int bcmerror = -1; |
|---|
| 1641 | | - |
|---|
| 1642 | | - memset(&dhd->dhd_cspec, 0, sizeof(wl_country_t)); |
|---|
| 1643 | | - |
|---|
| 1644 | | - CONFIG_MSG("set country %s, revision %d\n", cspec->ccode, cspec->rev); |
|---|
| 1645 | | - bcmerror = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "country", (char *)cspec, |
|---|
| 1646 | | - sizeof(wl_country_t), FALSE); |
|---|
| 1647 | | - dhd_conf_get_country(dhd, cspec); |
|---|
| 1648 | | - CONFIG_MSG("Country code: %s (%s/%d)\n", |
|---|
| 1649 | | - cspec->country_abbrev, cspec->ccode, cspec->rev); |
|---|
| 1650 | | - |
|---|
| 1651 | | - return bcmerror; |
|---|
| 1652 | | -} |
|---|
| 1653 | | - |
|---|
| 1654 | | -int |
|---|
| 1655 | | -dhd_conf_fix_country(dhd_pub_t *dhd) |
|---|
| 1656 | | -{ |
|---|
| 1657 | | - int bcmerror = -1; |
|---|
| 1658 | | - int band; |
|---|
| 1659 | | - wl_uint32_list_t *list; |
|---|
| 1660 | | - u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; |
|---|
| 1661 | | - wl_country_t cspec; |
|---|
| 1662 | | - |
|---|
| 1663 | | - if (!(dhd && dhd->conf)) { |
|---|
| 1664 | | - return bcmerror; |
|---|
| 1665 | | - } |
|---|
| 1666 | | - |
|---|
| 1667 | | - memset(valid_chan_list, 0, sizeof(valid_chan_list)); |
|---|
| 1668 | | - list = (wl_uint32_list_t *)(void *) valid_chan_list; |
|---|
| 1669 | | - list->count = htod32(WL_NUMCHANNELS); |
|---|
| 1670 | | - if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VALID_CHANNELS, valid_chan_list, |
|---|
| 1671 | | - sizeof(valid_chan_list), FALSE, 0)) < 0) { |
|---|
| 1672 | | - CONFIG_ERROR("get channels failed with %d\n", bcmerror); |
|---|
| 1673 | | - } |
|---|
| 1674 | | - |
|---|
| 1675 | | - band = dhd_conf_get_band(dhd); |
|---|
| 1676 | | - |
|---|
| 1677 | | - if (bcmerror || ((band==WLC_BAND_AUTO || band==WLC_BAND_2G || band==-1) && |
|---|
| 1678 | | - dtoh32(list->count)<11)) { |
|---|
| 1679 | | - CONFIG_ERROR("bcmerror=%d, # of channels %d\n", |
|---|
| 1680 | | - bcmerror, dtoh32(list->count)); |
|---|
| 1681 | | - dhd_conf_map_country_list(dhd, &dhd->conf->cspec); |
|---|
| 1682 | | - if ((bcmerror = dhd_conf_set_country(dhd, &dhd->conf->cspec)) < 0) { |
|---|
| 1683 | | - strcpy(cspec.country_abbrev, "US"); |
|---|
| 1684 | | - cspec.rev = 0; |
|---|
| 1685 | | - strcpy(cspec.ccode, "US"); |
|---|
| 1686 | | - dhd_conf_map_country_list(dhd, &cspec); |
|---|
| 1687 | | - dhd_conf_set_country(dhd, &cspec); |
|---|
| 1688 | | - } |
|---|
| 1689 | | - } |
|---|
| 1690 | | - |
|---|
| 1691 | | - return bcmerror; |
|---|
| 1692 | 1488 | } |
|---|
| 1693 | 1489 | |
|---|
| 1694 | 1490 | static int |
|---|
| .. | .. |
|---|
| 1898 | 1694 | } |
|---|
| 1899 | 1695 | #endif |
|---|
| 1900 | 1696 | |
|---|
| 1901 | | -int |
|---|
| 1902 | | -dhd_conf_country(dhd_pub_t *dhd, char *cmd, char *buf) |
|---|
| 1903 | | -{ |
|---|
| 1904 | | - wl_country_t cspec = {{0}, 0, {0}}; |
|---|
| 1905 | | - wl_country_t cur_cspec = {{0}, 0, {0}}; |
|---|
| 1906 | | - int err = 0; |
|---|
| 1907 | | - |
|---|
| 1908 | | - if (buf) { |
|---|
| 1909 | | - dhd_conf_get_country(dhd, &cur_cspec); |
|---|
| 1910 | | - strlcpy(cspec.country_abbrev, buf, WL_CCODE_LEN + 1); |
|---|
| 1911 | | - strlcpy(cspec.ccode, buf, WL_CCODE_LEN + 1); |
|---|
| 1912 | | - dhd_conf_map_country_list(dhd, &cspec); |
|---|
| 1913 | | - if (!memcmp(&cspec.ccode, &cur_cspec.ccode, WL_CCODE_LEN + 1) && |
|---|
| 1914 | | - (cspec.rev == cur_cspec.rev)) { |
|---|
| 1915 | | - CONFIG_MSG("country code = %s/%d is already configured\n", |
|---|
| 1916 | | - cspec.ccode, cspec.rev); |
|---|
| 1917 | | - return 0; |
|---|
| 1918 | | - } |
|---|
| 1919 | | - err = dhd_conf_set_country(dhd, &cspec); |
|---|
| 1920 | | - if (!err) { |
|---|
| 1921 | | - dhd_conf_fix_country(dhd); |
|---|
| 1922 | | - } |
|---|
| 1923 | | - dhd_conf_get_country(dhd, &dhd->dhd_cspec); |
|---|
| 1924 | | - } |
|---|
| 1925 | | - |
|---|
| 1926 | | - return err; |
|---|
| 1927 | | -} |
|---|
| 1928 | | - |
|---|
| 1929 | 1697 | typedef int (tpl_parse_t)(dhd_pub_t *dhd, char *name, char *buf); |
|---|
| 1930 | 1698 | |
|---|
| 1931 | 1699 | typedef struct iovar_tpl_t { |
|---|
| .. | .. |
|---|
| 1941 | 1709 | #ifndef SUPPORT_RANDOM_MAC_SCAN |
|---|
| 1942 | 1710 | {WLC_SET_VAR, "scanmac", dhd_conf_scan_mac}, |
|---|
| 1943 | 1711 | #endif |
|---|
| 1944 | | - {WLC_SET_VAR, "country", dhd_conf_country}, |
|---|
| 1945 | 1712 | }; |
|---|
| 1946 | 1713 | |
|---|
| 1947 | 1714 | static int iovar_tpl_parse(const iovar_tpl_t *tpl, int tpl_count, |
|---|
| .. | .. |
|---|
| 2032 | 1799 | return band; |
|---|
| 2033 | 1800 | } |
|---|
| 2034 | 1801 | |
|---|
| 1802 | +int |
|---|
| 1803 | +dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec) |
|---|
| 1804 | +{ |
|---|
| 1805 | + int bcmerror = -1; |
|---|
| 1806 | + |
|---|
| 1807 | + memset(cspec, 0, sizeof(wl_country_t)); |
|---|
| 1808 | + bcm_mkiovar("country", NULL, 0, (char*)cspec, sizeof(wl_country_t)); |
|---|
| 1809 | + if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, cspec, sizeof(wl_country_t), |
|---|
| 1810 | + FALSE, 0)) < 0) |
|---|
| 1811 | + CONFIG_ERROR("country code getting failed %d\n", bcmerror); |
|---|
| 1812 | + |
|---|
| 1813 | + return bcmerror; |
|---|
| 1814 | +} |
|---|
| 1815 | + |
|---|
| 1816 | +int |
|---|
| 1817 | +dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec) |
|---|
| 1818 | +{ |
|---|
| 1819 | + int bcmerror = -1; |
|---|
| 1820 | + struct dhd_conf *conf = dhd->conf; |
|---|
| 1821 | + country_list_t *country = conf->country_head; |
|---|
| 1822 | + |
|---|
| 1823 | +#ifdef CCODE_LIST |
|---|
| 1824 | + bcmerror = dhd_ccode_map_country_list(dhd, cspec); |
|---|
| 1825 | +#endif |
|---|
| 1826 | + // **:XZ/11 => return XZ/11 if not found |
|---|
| 1827 | + // **:**/0 => return user specified ccode if not found, but set regrev 0 |
|---|
| 1828 | + while (country != NULL) { |
|---|
| 1829 | + if (!strncmp("**", country->cspec.country_abbrev, 2)) { |
|---|
| 1830 | + if (!strncmp("**", country->cspec.ccode, 2)) { |
|---|
| 1831 | + cspec->rev = 0; |
|---|
| 1832 | + bcmerror = 0; |
|---|
| 1833 | + break; |
|---|
| 1834 | + } |
|---|
| 1835 | + memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); |
|---|
| 1836 | + cspec->rev = country->cspec.rev; |
|---|
| 1837 | + bcmerror = 0; |
|---|
| 1838 | + break; |
|---|
| 1839 | + } else if (!strncmp(cspec->country_abbrev, |
|---|
| 1840 | + country->cspec.country_abbrev, 2)) { |
|---|
| 1841 | + memcpy(cspec->ccode, country->cspec.ccode, WLC_CNTRY_BUF_SZ); |
|---|
| 1842 | + cspec->rev = country->cspec.rev; |
|---|
| 1843 | + bcmerror = 0; |
|---|
| 1844 | + break; |
|---|
| 1845 | + } |
|---|
| 1846 | + country = country->next; |
|---|
| 1847 | + } |
|---|
| 1848 | + |
|---|
| 1849 | + if (!bcmerror) |
|---|
| 1850 | + CONFIG_MSG("%s/%d\n", cspec->ccode, cspec->rev); |
|---|
| 1851 | + |
|---|
| 1852 | + return bcmerror; |
|---|
| 1853 | +} |
|---|
| 1854 | + |
|---|
| 1855 | +int |
|---|
| 1856 | +dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec) |
|---|
| 1857 | +{ |
|---|
| 1858 | + int bcmerror = -1; |
|---|
| 1859 | + |
|---|
| 1860 | + memset(&dhd->dhd_cspec, 0, sizeof(wl_country_t)); |
|---|
| 1861 | + |
|---|
| 1862 | + CONFIG_MSG("set country %s, revision %d\n", cspec->ccode, cspec->rev); |
|---|
| 1863 | + bcmerror = dhd_conf_set_bufiovar(dhd, 0, WLC_SET_VAR, "country", (char *)cspec, |
|---|
| 1864 | + sizeof(wl_country_t), FALSE); |
|---|
| 1865 | + dhd_conf_get_country(dhd, cspec); |
|---|
| 1866 | + CONFIG_MSG("Country code: %s (%s/%d)\n", |
|---|
| 1867 | + cspec->country_abbrev, cspec->ccode, cspec->rev); |
|---|
| 1868 | + |
|---|
| 1869 | + return bcmerror; |
|---|
| 1870 | +} |
|---|
| 1871 | + |
|---|
| 1872 | +int |
|---|
| 1873 | +dhd_conf_fix_country(dhd_pub_t *dhd) |
|---|
| 1874 | +{ |
|---|
| 1875 | + int bcmerror = -1; |
|---|
| 1876 | + int band; |
|---|
| 1877 | + wl_uint32_list_t *list; |
|---|
| 1878 | + u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)]; |
|---|
| 1879 | + wl_country_t cspec; |
|---|
| 1880 | + |
|---|
| 1881 | + if (!(dhd && dhd->conf)) { |
|---|
| 1882 | + return bcmerror; |
|---|
| 1883 | + } |
|---|
| 1884 | + |
|---|
| 1885 | + memset(valid_chan_list, 0, sizeof(valid_chan_list)); |
|---|
| 1886 | + list = (wl_uint32_list_t *)(void *) valid_chan_list; |
|---|
| 1887 | + list->count = htod32(WL_NUMCHANNELS); |
|---|
| 1888 | + if ((bcmerror = dhd_wl_ioctl_cmd(dhd, WLC_GET_VALID_CHANNELS, valid_chan_list, |
|---|
| 1889 | + sizeof(valid_chan_list), FALSE, 0)) < 0) { |
|---|
| 1890 | + CONFIG_ERROR("get channels failed with %d\n", bcmerror); |
|---|
| 1891 | + } |
|---|
| 1892 | + |
|---|
| 1893 | + band = dhd_conf_get_band(dhd); |
|---|
| 1894 | + |
|---|
| 1895 | + if (bcmerror || ((band==WLC_BAND_AUTO || band==WLC_BAND_2G || band==-1) && |
|---|
| 1896 | + dtoh32(list->count)<11)) { |
|---|
| 1897 | + CONFIG_ERROR("bcmerror=%d, # of channels %d\n", |
|---|
| 1898 | + bcmerror, dtoh32(list->count)); |
|---|
| 1899 | + dhd_conf_map_country_list(dhd, &dhd->conf->cspec); |
|---|
| 1900 | + if ((bcmerror = dhd_conf_set_country(dhd, &dhd->conf->cspec)) < 0) { |
|---|
| 1901 | + strcpy(cspec.country_abbrev, "US"); |
|---|
| 1902 | + cspec.rev = 0; |
|---|
| 1903 | + strcpy(cspec.ccode, "US"); |
|---|
| 1904 | + dhd_conf_map_country_list(dhd, &cspec); |
|---|
| 1905 | + dhd_conf_set_country(dhd, &cspec); |
|---|
| 1906 | + } |
|---|
| 1907 | + } |
|---|
| 1908 | + |
|---|
| 1909 | + return bcmerror; |
|---|
| 1910 | +} |
|---|
| 1911 | + |
|---|
| 2035 | 1912 | bool |
|---|
| 2036 | 1913 | dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel) |
|---|
| 2037 | 1914 | { |
|---|
| .. | .. |
|---|
| 2054 | 1931 | } |
|---|
| 2055 | 1932 | |
|---|
| 2056 | 1933 | int |
|---|
| 2057 | | -dhd_conf_set_roam(dhd_pub_t *dhd, int ifidx) |
|---|
| 1934 | +dhd_conf_set_roam(dhd_pub_t *dhd) |
|---|
| 2058 | 1935 | { |
|---|
| 2059 | 1936 | int bcmerror = -1; |
|---|
| 2060 | 1937 | struct dhd_conf *conf = dhd->conf; |
|---|
| 2061 | 1938 | uint wnm_bsstrans_resp = 0; |
|---|
| 2062 | 1939 | |
|---|
| 2063 | 1940 | if (dhd->conf->chip == BCM4359_CHIP_ID) { |
|---|
| 2064 | | - dhd_conf_get_iovar(dhd, ifidx, WLC_GET_VAR, "wnm_bsstrans_resp", |
|---|
| 1941 | + dhd_conf_get_iovar(dhd, 0, WLC_GET_VAR, "wnm_bsstrans_resp", |
|---|
| 2065 | 1942 | (char *)&wnm_bsstrans_resp, sizeof(wnm_bsstrans_resp)); |
|---|
| 2066 | 1943 | if (wnm_bsstrans_resp == WL_BSSTRANS_POLICY_PRODUCT) { |
|---|
| 2067 | 1944 | dhd->wbtext_policy = WL_BSSTRANS_POLICY_ROAM_ALWAYS; |
|---|
| 2068 | | - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "wnm_bsstrans_resp", |
|---|
| 1945 | + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "wnm_bsstrans_resp", |
|---|
| 2069 | 1946 | WL_BSSTRANS_POLICY_ROAM_ALWAYS, 0, FALSE); |
|---|
| 2070 | 1947 | } |
|---|
| 2071 | 1948 | } |
|---|
| 2072 | 1949 | |
|---|
| 2073 | 1950 | dhd_roam_disable = conf->roam_off; |
|---|
| 2074 | | - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "roam_off", dhd->conf->roam_off, 0, FALSE); |
|---|
| 1951 | + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "roam_off", dhd->conf->roam_off, 0, FALSE); |
|---|
| 2075 | 1952 | |
|---|
| 2076 | 1953 | if (!conf->roam_off || !conf->roam_off_suspend) { |
|---|
| 2077 | 1954 | CONFIG_MSG("set roam_trigger %d\n", conf->roam_trigger[0]); |
|---|
| 2078 | | - dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_ROAM_TRIGGER, "WLC_SET_ROAM_TRIGGER", |
|---|
| 1955 | + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_TRIGGER, "WLC_SET_ROAM_TRIGGER", |
|---|
| 2079 | 1956 | (char *)conf->roam_trigger, sizeof(conf->roam_trigger), FALSE); |
|---|
| 2080 | 1957 | |
|---|
| 2081 | 1958 | CONFIG_MSG("set roam_scan_period %d\n", conf->roam_scan_period[0]); |
|---|
| 2082 | | - dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_ROAM_SCAN_PERIOD, "WLC_SET_ROAM_SCAN_PERIOD", |
|---|
| 1959 | + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_SCAN_PERIOD, "WLC_SET_ROAM_SCAN_PERIOD", |
|---|
| 2083 | 1960 | (char *)conf->roam_scan_period, sizeof(conf->roam_scan_period), FALSE); |
|---|
| 2084 | 1961 | |
|---|
| 2085 | 1962 | CONFIG_MSG("set roam_delta %d\n", conf->roam_delta[0]); |
|---|
| 2086 | | - dhd_conf_set_bufiovar(dhd, ifidx, WLC_SET_ROAM_DELTA, "WLC_SET_ROAM_DELTA", |
|---|
| 1963 | + dhd_conf_set_bufiovar(dhd, 0, WLC_SET_ROAM_DELTA, "WLC_SET_ROAM_DELTA", |
|---|
| 2087 | 1964 | (char *)conf->roam_delta, sizeof(conf->roam_delta), FALSE); |
|---|
| 2088 | 1965 | |
|---|
| 2089 | | - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "fullroamperiod", |
|---|
| 1966 | + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "fullroamperiod", |
|---|
| 2090 | 1967 | dhd->conf->fullroamperiod, 1, FALSE); |
|---|
| 2091 | 1968 | } |
|---|
| 2092 | 1969 | |
|---|
| .. | .. |
|---|
| 2381 | 2258 | * Case 3: magic pkt and event wake up |
|---|
| 2382 | 2259 | * 1) dhd_master_mode=1 |
|---|
| 2383 | 2260 | * 2) pkt_filter_delete=100, 102, 103, 104, 105, 106, 107 |
|---|
| 2384 | | - * 3) magic_pkt_filter_add=141 0 1 12 |
|---|
| 2385 | | - * 4) rekey_offload=1 |
|---|
| 2261 | + * 3) pkt_filter_add=141 0 0 0 0xFFFFFFFFFFFF 0x000000000000 |
|---|
| 2262 | + * 4) magic_pkt_filter_add=141 0 1 12 |
|---|
| 2263 | + * 5) rekey_offload=1 |
|---|
| 2386 | 2264 | */ |
|---|
| 2387 | 2265 | for(i=0; i<dhd->conf->pkt_filter_add.count; i++) { |
|---|
| 2388 | 2266 | dhd->pktfilter[i+dhd->pktfilter_count] = dhd->conf->pkt_filter_add.filter[i]; |
|---|
| .. | .. |
|---|
| 2717 | 2595 | dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period, |
|---|
| 2718 | 2596 | char *packet, bool bcast) |
|---|
| 2719 | 2597 | { |
|---|
| 2720 | | - wl_mkeep_alive_pkt_v1_t *mkeep_alive_pktp; |
|---|
| 2598 | + wl_mkeep_alive_pkt_t *mkeep_alive_pktp; |
|---|
| 2721 | 2599 | int ret = 0, len_bytes=0, buf_len=0; |
|---|
| 2722 | 2600 | char *buf = NULL, *iovar_buf = NULL; |
|---|
| 2723 | 2601 | uint8 *pdata; |
|---|
| .. | .. |
|---|
| 2734 | 2612 | CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", WLC_IOCTL_SMLEN); |
|---|
| 2735 | 2613 | goto exit; |
|---|
| 2736 | 2614 | } |
|---|
| 2737 | | - mkeep_alive_pktp = (wl_mkeep_alive_pkt_v1_t *)buf; |
|---|
| 2738 | | - mkeep_alive_pktp->version = htod16(WL_MKEEP_ALIVE_VERSION_1); |
|---|
| 2615 | + mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *)buf; |
|---|
| 2616 | + mkeep_alive_pktp->version = htod16(WL_MKEEP_ALIVE_VERSION); |
|---|
| 2739 | 2617 | mkeep_alive_pktp->length = htod16(WL_MKEEP_ALIVE_FIXED_LEN); |
|---|
| 2740 | 2618 | mkeep_alive_pktp->keep_alive_id = id; |
|---|
| 2741 | 2619 | buf_len += WL_MKEEP_ALIVE_FIXED_LEN; |
|---|
| .. | .. |
|---|
| 2978 | 2856 | #endif |
|---|
| 2979 | 2857 | } |
|---|
| 2980 | 2858 | else { |
|---|
| 2981 | | - dhd_conf_get_iovar(dhd, ifidx, WLC_GET_PM, "WLC_GET_PM", (char *)&pm, sizeof(pm)); |
|---|
| 2859 | + dhd_conf_get_iovar(dhd, 0, WLC_GET_PM, "WLC_GET_PM", (char *)&pm, sizeof(pm)); |
|---|
| 2982 | 2860 | CONFIG_TRACE("PM in suspend = %d\n", pm); |
|---|
| 2983 | 2861 | if (conf->pm >= 0) |
|---|
| 2984 | 2862 | pm = conf->pm; |
|---|
| .. | .. |
|---|
| 3628 | 3506 | else if (!strncmp("fullroamperiod=", full_param, len_param)) { |
|---|
| 3629 | 3507 | conf->fullroamperiod = (int)simple_strtol(data, NULL, 10); |
|---|
| 3630 | 3508 | CONFIG_MSG("fullroamperiod = %d\n", conf->fullroamperiod); |
|---|
| 3631 | | - } |
|---|
| 3632 | | - else if (!strncmp("wl_reassoc_support=", full_param, len_param)) { |
|---|
| 3633 | | - if (!strncmp(data, "0", 1)) |
|---|
| 3634 | | - wl_reassoc_support = FALSE; |
|---|
| 3635 | | - else |
|---|
| 3636 | | - wl_reassoc_support = TRUE; |
|---|
| 3637 | | - CONFIG_MSG("wl_reassoc_support = %d\n", wl_reassoc_support); |
|---|
| 3638 | | - } |
|---|
| 3639 | | - else |
|---|
| 3509 | + } else |
|---|
| 3640 | 3510 | return false; |
|---|
| 3641 | 3511 | |
|---|
| 3642 | 3512 | return true; |
|---|
| .. | .. |
|---|
| 3975 | 3845 | dhd_doflow = TRUE; |
|---|
| 3976 | 3846 | CONFIG_MSG("dhd_doflow = %d\n", dhd_doflow); |
|---|
| 3977 | 3847 | } |
|---|
| 3978 | | - else if (!strncmp("dhd_slpauto=", full_param, len_param)) { |
|---|
| 3848 | + else if (!strncmp("dhd_slpauto=", full_param, len_param) || |
|---|
| 3849 | + !strncmp("kso_enable=", full_param, len_param)) { |
|---|
| 3979 | 3850 | if (!strncmp(data, "0", 1)) |
|---|
| 3980 | 3851 | dhd_slpauto = FALSE; |
|---|
| 3981 | | - else if (dhd_conf_disable_slpauto(dhd)) |
|---|
| 3852 | + else |
|---|
| 3982 | 3853 | dhd_slpauto = TRUE; |
|---|
| 3983 | 3854 | CONFIG_MSG("dhd_slpauto = %d\n", dhd_slpauto); |
|---|
| 3984 | 3855 | } |
|---|
| .. | .. |
|---|
| 4392 | 4263 | conf->in4way = (int)simple_strtol(data, NULL, 0); |
|---|
| 4393 | 4264 | CONFIG_MSG("in4way = 0x%x\n", conf->in4way); |
|---|
| 4394 | 4265 | } |
|---|
| 4395 | | -#ifdef BTC_WAR |
|---|
| 4396 | | - else if (!strncmp("btc_war=", full_param, len_param)) { |
|---|
| 4397 | | - btc_war = (int)simple_strtol(data, NULL, 0); |
|---|
| 4398 | | - CONFIG_MSG("btc_war = 0x%x\n", btc_war); |
|---|
| 4399 | | - } |
|---|
| 4400 | | -#endif /* BTC_WAR */ |
|---|
| 4401 | 4266 | else if (!strncmp("war=", full_param, len_param)) { |
|---|
| 4402 | 4267 | conf->war = (int)simple_strtol(data, NULL, 0); |
|---|
| 4403 | 4268 | CONFIG_MSG("war = 0x%x\n", conf->war); |
|---|
| .. | .. |
|---|
| 4837 | 4702 | int |
|---|
| 4838 | 4703 | dhd_conf_compat_func(dhd_pub_t *dhd) |
|---|
| 4839 | 4704 | { |
|---|
| 4840 | | - const module_name_map_t *row = NULL; |
|---|
| 4705 | + const module_name_map_t* row = NULL; |
|---|
| 4841 | 4706 | |
|---|
| 4842 | 4707 | row = dhd_conf_match_module(dhd); |
|---|
| 4843 | 4708 | if (row && row->compat_func) { |
|---|
| .. | .. |
|---|
| 4849 | 4714 | #endif |
|---|
| 4850 | 4715 | |
|---|
| 4851 | 4716 | void |
|---|
| 4852 | | -dhd_conf_preinit_ioctls_sta(dhd_pub_t *dhd, int ifidx) |
|---|
| 4853 | | -{ |
|---|
| 4854 | | - struct dhd_conf *conf = dhd->conf; |
|---|
| 4855 | | - int pm; |
|---|
| 4856 | | - |
|---|
| 4857 | | - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "bcn_timeout", conf->bcn_timeout, 0, FALSE); |
|---|
| 4858 | | -#ifdef NO_POWER_SAVE |
|---|
| 4859 | | - pm = PM_OFF; |
|---|
| 4860 | | -#else |
|---|
| 4861 | | - if (conf->pm >= 0) |
|---|
| 4862 | | - pm = conf->pm; |
|---|
| 4863 | | - else |
|---|
| 4864 | | - pm = PM_FAST; |
|---|
| 4865 | | -#endif |
|---|
| 4866 | | - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_PM, "WLC_SET_PM", pm, 0, FALSE); |
|---|
| 4867 | | - dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "assoc_retry_max", 10, 0, FALSE); |
|---|
| 4868 | | - dhd_conf_set_roam(dhd, ifidx); |
|---|
| 4869 | | -} |
|---|
| 4870 | | - |
|---|
| 4871 | | -void |
|---|
| 4872 | 4717 | dhd_conf_postinit_ioctls(dhd_pub_t *dhd) |
|---|
| 4873 | 4718 | { |
|---|
| 4874 | 4719 | struct dhd_conf *conf = dhd->conf; |
|---|
| 4875 | | - char wl_preinit[] = ""; |
|---|
| 4720 | + char wl_preinit[] = "assoc_retry_max=10"; |
|---|
| 4876 | 4721 | #ifdef NO_POWER_SAVE |
|---|
| 4877 | 4722 | char wl_no_power_save[] = "mpc=0, 86=0"; |
|---|
| 4878 | 4723 | dhd_conf_set_wl_cmd(dhd, wl_no_power_save, FALSE); |
|---|
| 4879 | 4724 | #endif |
|---|
| 4880 | 4725 | |
|---|
| 4881 | | - dhd_conf_get_ioctl_ver(dhd); |
|---|
| 4882 | 4726 | dhd_conf_set_intiovar(dhd, 0, WLC_UP, "WLC_UP", 0, 0, FALSE); |
|---|
| 4883 | | - dhd_conf_country(dhd, "country", conf->cspec.country_abbrev); |
|---|
| 4727 | + dhd_conf_map_country_list(dhd, &conf->cspec); |
|---|
| 4728 | + dhd_conf_set_country(dhd, &conf->cspec); |
|---|
| 4729 | + dhd_conf_fix_country(dhd); |
|---|
| 4730 | + dhd_conf_get_country(dhd, &dhd->dhd_cspec); |
|---|
| 4884 | 4731 | |
|---|
| 4885 | 4732 | dhd_conf_set_intiovar(dhd, 0, WLC_SET_BAND, "WLC_SET_BAND", conf->band, 0, FALSE); |
|---|
| 4733 | + dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "bcn_timeout", conf->bcn_timeout, 0, FALSE); |
|---|
| 4734 | + dhd_conf_set_intiovar(dhd, 0, WLC_SET_PM, "WLC_SET_PM", conf->pm, 0, FALSE); |
|---|
| 4886 | 4735 | dhd_conf_set_intiovar(dhd, 0, WLC_SET_SRL, "WLC_SET_SRL", conf->srl, 0, FALSE); |
|---|
| 4887 | 4736 | dhd_conf_set_intiovar(dhd, 0, WLC_SET_LRL, "WLC_SET_LRL", conf->lrl, 0, FALSE); |
|---|
| 4888 | 4737 | dhd_conf_set_bw_cap(dhd); |
|---|
| 4889 | | - dhd_conf_set_roam(dhd, 0); |
|---|
| 4738 | + dhd_conf_set_roam(dhd); |
|---|
| 4890 | 4739 | |
|---|
| 4891 | 4740 | #if defined(BCMPCIE) |
|---|
| 4892 | 4741 | dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "bus:deepsleep_disable", |
|---|
| .. | .. |
|---|
| 4912 | 4761 | dhd_conf_set_intiovar(dhd, 0, WLC_SET_FAKEFRAG, "WLC_SET_FAKEFRAG", |
|---|
| 4913 | 4762 | conf->frameburst, 0, FALSE); |
|---|
| 4914 | 4763 | |
|---|
| 4915 | | - dhd_conf_preinit_ioctls_sta(dhd, 0); |
|---|
| 4916 | 4764 | dhd_conf_set_wl_cmd(dhd, wl_preinit, TRUE); |
|---|
| 4917 | 4765 | #if defined(BCMSDIO) |
|---|
| 4918 | 4766 | if (conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) { |
|---|
| .. | .. |
|---|
| 4988 | 4836 | |
|---|
| 4989 | 4837 | } |
|---|
| 4990 | 4838 | |
|---|
| 4991 | | -void |
|---|
| 4992 | | -dhd_conf_free_preinit(dhd_pub_t *dhd) |
|---|
| 4839 | +int |
|---|
| 4840 | +dhd_conf_preinit(dhd_pub_t *dhd) |
|---|
| 4993 | 4841 | { |
|---|
| 4994 | 4842 | struct dhd_conf *conf = dhd->conf; |
|---|
| 4843 | + |
|---|
| 4844 | + CONFIG_TRACE("Enter\n"); |
|---|
| 4995 | 4845 | |
|---|
| 4996 | 4846 | #ifdef SET_FWNV_BY_MAC |
|---|
| 4997 | 4847 | dhd_conf_free_mac_list(&conf->fw_by_mac); |
|---|
| .. | .. |
|---|
| 5022 | 4872 | kfree(conf->vndr_ie_assocreq); |
|---|
| 5023 | 4873 | conf->vndr_ie_assocreq = NULL; |
|---|
| 5024 | 4874 | } |
|---|
| 5025 | | -} |
|---|
| 5026 | | - |
|---|
| 5027 | | -int |
|---|
| 5028 | | -dhd_conf_preinit(dhd_pub_t *dhd) |
|---|
| 5029 | | -{ |
|---|
| 5030 | | - struct dhd_conf *conf = dhd->conf; |
|---|
| 5031 | | - |
|---|
| 5032 | | - CONFIG_TRACE("Enter\n"); |
|---|
| 5033 | | - |
|---|
| 5034 | | - dhd_conf_free_preinit(dhd); |
|---|
| 5035 | 4875 | conf->band = -1; |
|---|
| 5036 | 4876 | memset(&conf->bw_cap, -1, sizeof(conf->bw_cap)); |
|---|
| 5037 | 4877 | if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID) { |
|---|
| .. | .. |
|---|
| 5054 | 4894 | conf->cspec.rev = 0; |
|---|
| 5055 | 4895 | } |
|---|
| 5056 | 4896 | memset(&conf->channels, 0, sizeof(wl_channel_list_t)); |
|---|
| 5057 | | - conf->ioctl_ver = WLC_IOCTL_VERSION; |
|---|
| 5058 | 4897 | conf->roam_off = 1; |
|---|
| 5059 | 4898 | conf->roam_off_suspend = 1; |
|---|
| 5060 | 4899 | conf->roam_trigger[0] = -65; |
|---|
| .. | .. |
|---|
| 5311 | 5150 | { |
|---|
| 5312 | 5151 | struct dhd_conf *conf = dhd->conf; |
|---|
| 5313 | 5152 | |
|---|
| 5314 | | - dhd_conf_free_preinit(dhd); |
|---|
| 5153 | +#ifdef SET_FWNV_BY_MAC |
|---|
| 5154 | + dhd_conf_free_mac_list(&conf->fw_by_mac); |
|---|
| 5155 | + dhd_conf_free_mac_list(&conf->nv_by_mac); |
|---|
| 5156 | +#endif |
|---|
| 5157 | + dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); |
|---|
| 5158 | + dhd_conf_free_country_list(conf); |
|---|
| 5159 | + dhd_conf_free_mchan_list(conf); |
|---|
| 5160 | +#ifdef PKT_FILTER_SUPPORT |
|---|
| 5161 | + if (conf->magic_pkt_filter_add) { |
|---|
| 5162 | + kfree(conf->magic_pkt_filter_add); |
|---|
| 5163 | + conf->magic_pkt_filter_add = NULL; |
|---|
| 5164 | + } |
|---|
| 5165 | +#endif |
|---|
| 5166 | + if (conf->wl_preinit) { |
|---|
| 5167 | + kfree(conf->wl_preinit); |
|---|
| 5168 | + conf->wl_preinit = NULL; |
|---|
| 5169 | + } |
|---|
| 5170 | + if (conf->wl_suspend) { |
|---|
| 5171 | + kfree(conf->wl_suspend); |
|---|
| 5172 | + conf->wl_suspend = NULL; |
|---|
| 5173 | + } |
|---|
| 5174 | + if (conf->wl_resume) { |
|---|
| 5175 | + kfree(conf->wl_resume); |
|---|
| 5176 | + conf->wl_resume = NULL; |
|---|
| 5177 | + } |
|---|
| 5178 | + if (conf->vndr_ie_assocreq) { |
|---|
| 5179 | + kfree(conf->vndr_ie_assocreq); |
|---|
| 5180 | + conf->vndr_ie_assocreq = NULL; |
|---|
| 5181 | + } |
|---|
| 5315 | 5182 | memset(conf, 0, sizeof(dhd_conf_t)); |
|---|
| 5316 | 5183 | return 0; |
|---|
| 5317 | 5184 | } |
|---|
| .. | .. |
|---|
| 5351 | 5218 | |
|---|
| 5352 | 5219 | CONFIG_TRACE("Enter\n"); |
|---|
| 5353 | 5220 | if (dhd->conf) { |
|---|
| 5354 | | - dhd_conf_free_preinit(dhd); |
|---|
| 5221 | +#ifdef SET_FWNV_BY_MAC |
|---|
| 5222 | + dhd_conf_free_mac_list(&conf->fw_by_mac); |
|---|
| 5223 | + dhd_conf_free_mac_list(&conf->nv_by_mac); |
|---|
| 5224 | +#endif |
|---|
| 5225 | + dhd_conf_free_chip_nv_path_list(&conf->nv_by_chip); |
|---|
| 5226 | + dhd_conf_free_country_list(conf); |
|---|
| 5227 | + dhd_conf_free_mchan_list(conf); |
|---|
| 5228 | +#ifdef PKT_FILTER_SUPPORT |
|---|
| 5229 | + if (conf->magic_pkt_filter_add) { |
|---|
| 5230 | + kfree(conf->magic_pkt_filter_add); |
|---|
| 5231 | + conf->magic_pkt_filter_add = NULL; |
|---|
| 5232 | + } |
|---|
| 5233 | +#endif |
|---|
| 5234 | + if (conf->wl_preinit) { |
|---|
| 5235 | + kfree(conf->wl_preinit); |
|---|
| 5236 | + conf->wl_preinit = NULL; |
|---|
| 5237 | + } |
|---|
| 5238 | + if (conf->wl_suspend) { |
|---|
| 5239 | + kfree(conf->wl_suspend); |
|---|
| 5240 | + conf->wl_suspend = NULL; |
|---|
| 5241 | + } |
|---|
| 5242 | + if (conf->wl_resume) { |
|---|
| 5243 | + kfree(conf->wl_resume); |
|---|
| 5244 | + conf->wl_resume = NULL; |
|---|
| 5245 | + } |
|---|
| 5246 | + if (conf->vndr_ie_assocreq) { |
|---|
| 5247 | + kfree(conf->vndr_ie_assocreq); |
|---|
| 5248 | + conf->vndr_ie_assocreq = NULL; |
|---|
| 5249 | + } |
|---|
| 5355 | 5250 | MFREE(dhd->osh, conf, sizeof(dhd_conf_t)); |
|---|
| 5356 | 5251 | } |
|---|
| 5357 | 5252 | dhd->conf = NULL; |
|---|