forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_config.c
old mode 100644new mode 100755
....@@ -1,5 +1,4 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2
-
32 #include <typedefs.h>
43 #include <osl.h>
54
....@@ -68,10 +67,6 @@
6867 #define MAXSZ_BUF 4096
6968 #define MAXSZ_CONFIG 8192
7069
71
-extern uint wl_reassoc_support;
72
-#ifdef BTC_WAR
73
-extern int btc_war;
74
-#endif /* BTC_WAR */
7570 #if defined(BCMSDIO) && defined(DYNAMIC_MAX_HDR_READ)
7671 extern uint firstread;
7772 #endif
....@@ -145,9 +140,9 @@
145140 {BCM4375_CHIP_ID, 5, DONT_CARE, "bcm4375b4_pcie_ag", ""},
146141 #endif
147142 #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", ""},
151146 #endif
152147 };
153148
....@@ -216,91 +211,6 @@
216211
217212 #ifdef DHD_TPUT_PATCH
218213 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
-}
304214 #endif
305215
306216 void
....@@ -780,7 +690,7 @@
780690 chiprev = dhd->conf->chiprev;
781691
782692 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];
784694 if (row->chip == chip && row->chiprev == chiprev &&
785695 (row->ag_type == ag_type ||
786696 ag_type == DONT_CARE || row->ag_type == DONT_CARE)) {
....@@ -813,7 +723,7 @@
813723
814724 #ifdef BCMSDIO
815725 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];
817727 if (row->devid == devid && row->chip == chip && row->chiprev == chiprev &&
818728 !strcmp(row->module_name, dhd->conf->module_name)) {
819729 return row;
....@@ -823,7 +733,7 @@
823733
824734 #ifdef BCMPCIE
825735 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];
827737 if (row->devid == devid && row->chip == chip && row->chiprev == chiprev &&
828738 row->svid == svid && row->ssid == ssid) {
829739 return row;
....@@ -835,64 +745,20 @@
835745 }
836746 #endif
837747
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
-
889748 int
890749 dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path)
891750 {
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;
892755 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;
895758 int i;
759
+
760
+ chip = dhd->conf->chip;
761
+ chiprev = dhd->conf->chiprev;
896762
897763 if (fw_path[0] == '\0') {
898764 #ifdef CONFIG_BCMDHD_FW_PATH
....@@ -944,10 +810,10 @@
944810 fw_type = FW_TYPE_EZMESH;
945811 #endif /* WLEASYMESH */
946812
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)) {
949815 strcpy(name_ptr, "fw_");
950
- strcat(name_ptr, chip_name);
816
+ strcat(name_ptr, row_chip->chip_name);
951817 #ifdef BCMUSBDEV_COMPOSITE
952818 strcat(name_ptr, "_cusb");
953819 #endif
....@@ -969,6 +835,33 @@
969835 strcat(name_ptr, ".bin");
970836 }
971837
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
+
972865 dhd->conf->fw_type = fw_type;
973866
974867 #ifndef MINIME
....@@ -983,9 +876,16 @@
983876 void
984877 dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path, int ag_type)
985878 {
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;
988885 int i;
886
+
887
+ chip = dhd->conf->chip;
888
+ chiprev = dhd->conf->chiprev;
989889
990890 if (clm_path[0] == '\0') {
991891 CONFIG_MSG("clm path is null\n");
....@@ -1003,12 +903,21 @@
1003903 }
1004904 name_ptr = &clm_path[i];
1005905
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)) {
1008908 strcpy(name_ptr, "clm_");
1009
- strcat(name_ptr, chip_name);
909
+ strcat(name_ptr, row_chip->chip_name);
1010910 strcat(name_ptr, ".blob");
1011911 }
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
1012921
1013922 CONFIG_TRACE("clm_path=%s\n", clm_path);
1014923 }
....@@ -1016,8 +925,12 @@
1016925 void
1017926 dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path, int ag_type)
1018927 {
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;
1019932 uint chip, chiprev;
1020
- char *name_ptr, *module_name = NULL, nv_name[32];
933
+ char *name_ptr, nv_name[32];
1021934 int i;
1022935
1023936 chip = dhd->conf->chip;
....@@ -1045,10 +958,10 @@
1045958 }
1046959 name_ptr = &nv_path[i];
1047960
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)) {
1050963 strcpy(name_ptr, "nvram_");
1051
- strcat(name_ptr, module_name);
964
+ strcat(name_ptr, row_chip->module_name);
1052965 #ifdef BCMUSBDEV_COMPOSITE
1053966 strcat(name_ptr, "_cusb");
1054967 #endif
....@@ -1065,14 +978,23 @@
1065978 if (dhd->conf->chip == BCM4359_CHIP_ID) {
1066979 struct file *fp;
1067980 // 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)) {
1070983 strcpy(name_ptr, nv_name);
1071984 } else {
1072
- dhd_filp_close((struct file *)fp, NULL);
985
+ filp_close((struct file *)fp, NULL);
1073986 }
1074987 }
1075988 #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");
1076998 }
1077999 #endif
10781000
....@@ -1116,9 +1038,16 @@
11161038 void
11171039 dhd_conf_set_conf_name_by_chip(dhd_pub_t *dhd, char *conf_path)
11181040 {
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;
11211047 int i;
1048
+
1049
+ chip = dhd->conf->chip;
1050
+ chiprev = dhd->conf->chiprev;
11221051
11231052 if (conf_path[0] == '\0') {
11241053 CONFIG_MSG("config path is null\n");
....@@ -1136,12 +1065,21 @@
11361065 }
11371066 name_ptr = &conf_path[i];
11381067
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)) {
11411070 strcpy(name_ptr, "config_");
1142
- strcat(name_ptr, chip_name);
1071
+ strcat(name_ptr, row_chip->chip_name);
11431072 strcat(name_ptr, ".txt");
11441073 }
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
11451083
11461084 CONFIG_TRACE("config_path=%s\n", conf_path);
11471085 }
....@@ -1318,6 +1256,26 @@
13181256
13191257 #ifdef DHD_LINUX_STD_FW_API
13201258 #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
+
13211279 static void
13221280 dhd_conf_get_filename(char *pFilename)
13231281 {
....@@ -1339,51 +1297,18 @@
13391297
13401298 if (pName)
13411299 strcpy(pFilename, pName);
1342
-
13431300 return;
13441301 }
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
-
13811302 #endif /* DHD_LINUX_STD_FW_API */
13821303
13831304 void
13841305 dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path)
13851306 {
13861307 int ag_type;
1308
+#ifdef DHD_LINUX_STD_FW_API
1309
+ char path[WLC_IOCTL_SMLEN];
1310
+ int path_len;
1311
+#endif
13871312
13881313 /* External conf takes precedence if specified */
13891314 dhd_conf_preinit(dhd);
....@@ -1415,17 +1340,22 @@
14151340 #endif
14161341
14171342 #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
14251354 CONFIG_MSG("Final fw_path=%s\n", fw_path);
14261355 CONFIG_MSG("Final nv_path=%s\n", nv_path);
14271356 CONFIG_MSG("Final clm_path=%s\n", dhd->clm_path);
14281357 CONFIG_MSG("Final conf_path=%s\n", dhd->conf_path);
1358
+#endif
14291359
14301360 dhd_conf_read_config(dhd, dhd->conf_path);
14311361 #ifdef DHD_TPUT_PATCH
....@@ -1442,17 +1372,17 @@
14421372
14431373 if (val >= def) {
14441374 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)
14461376 CONFIG_ERROR("WLC_DOWN setting failed %d\n", ret);
14471377 }
14481378 if (cmd == WLC_SET_VAR) {
14491379 CONFIG_TRACE("set %s %d\n", name, val);
14501380 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)
14521382 CONFIG_ERROR("%s setting failed %d\n", name, ret);
14531383 } else {
14541384 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)
14561386 CONFIG_ERROR("%s setting failed %d\n", name, ret);
14571387 }
14581388 }
....@@ -1555,140 +1485,6 @@
15551485 }
15561486
15571487 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;
16921488 }
16931489
16941490 static int
....@@ -1898,34 +1694,6 @@
18981694 }
18991695 #endif
19001696
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
-
19291697 typedef int (tpl_parse_t)(dhd_pub_t *dhd, char *name, char *buf);
19301698
19311699 typedef struct iovar_tpl_t {
....@@ -1941,7 +1709,6 @@
19411709 #ifndef SUPPORT_RANDOM_MAC_SCAN
19421710 {WLC_SET_VAR, "scanmac", dhd_conf_scan_mac},
19431711 #endif
1944
- {WLC_SET_VAR, "country", dhd_conf_country},
19451712 };
19461713
19471714 static int iovar_tpl_parse(const iovar_tpl_t *tpl, int tpl_count,
....@@ -2032,6 +1799,116 @@
20321799 return band;
20331800 }
20341801
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
+
20351912 bool
20361913 dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel)
20371914 {
....@@ -2054,39 +1931,39 @@
20541931 }
20551932
20561933 int
2057
-dhd_conf_set_roam(dhd_pub_t *dhd, int ifidx)
1934
+dhd_conf_set_roam(dhd_pub_t *dhd)
20581935 {
20591936 int bcmerror = -1;
20601937 struct dhd_conf *conf = dhd->conf;
20611938 uint wnm_bsstrans_resp = 0;
20621939
20631940 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",
20651942 (char *)&wnm_bsstrans_resp, sizeof(wnm_bsstrans_resp));
20661943 if (wnm_bsstrans_resp == WL_BSSTRANS_POLICY_PRODUCT) {
20671944 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",
20691946 WL_BSSTRANS_POLICY_ROAM_ALWAYS, 0, FALSE);
20701947 }
20711948 }
20721949
20731950 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);
20751952
20761953 if (!conf->roam_off || !conf->roam_off_suspend) {
20771954 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",
20791956 (char *)conf->roam_trigger, sizeof(conf->roam_trigger), FALSE);
20801957
20811958 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",
20831960 (char *)conf->roam_scan_period, sizeof(conf->roam_scan_period), FALSE);
20841961
20851962 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",
20871964 (char *)conf->roam_delta, sizeof(conf->roam_delta), FALSE);
20881965
2089
- dhd_conf_set_intiovar(dhd, ifidx, WLC_SET_VAR, "fullroamperiod",
1966
+ dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "fullroamperiod",
20901967 dhd->conf->fullroamperiod, 1, FALSE);
20911968 }
20921969
....@@ -2381,8 +2258,9 @@
23812258 * Case 3: magic pkt and event wake up
23822259 * 1) dhd_master_mode=1
23832260 * 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
23862264 */
23872265 for(i=0; i<dhd->conf->pkt_filter_add.count; i++) {
23882266 dhd->pktfilter[i+dhd->pktfilter_count] = dhd->conf->pkt_filter_add.filter[i];
....@@ -2717,7 +2595,7 @@
27172595 dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period,
27182596 char *packet, bool bcast)
27192597 {
2720
- wl_mkeep_alive_pkt_v1_t *mkeep_alive_pktp;
2598
+ wl_mkeep_alive_pkt_t *mkeep_alive_pktp;
27212599 int ret = 0, len_bytes=0, buf_len=0;
27222600 char *buf = NULL, *iovar_buf = NULL;
27232601 uint8 *pdata;
....@@ -2734,8 +2612,8 @@
27342612 CONFIG_ERROR("Failed to allocate buffer of %d bytes\n", WLC_IOCTL_SMLEN);
27352613 goto exit;
27362614 }
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);
27392617 mkeep_alive_pktp->length = htod16(WL_MKEEP_ALIVE_FIXED_LEN);
27402618 mkeep_alive_pktp->keep_alive_id = id;
27412619 buf_len += WL_MKEEP_ALIVE_FIXED_LEN;
....@@ -2978,7 +2856,7 @@
29782856 #endif
29792857 }
29802858 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));
29822860 CONFIG_TRACE("PM in suspend = %d\n", pm);
29832861 if (conf->pm >= 0)
29842862 pm = conf->pm;
....@@ -3628,15 +3506,7 @@
36283506 else if (!strncmp("fullroamperiod=", full_param, len_param)) {
36293507 conf->fullroamperiod = (int)simple_strtol(data, NULL, 10);
36303508 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
36403510 return false;
36413511
36423512 return true;
....@@ -3975,10 +3845,11 @@
39753845 dhd_doflow = TRUE;
39763846 CONFIG_MSG("dhd_doflow = %d\n", dhd_doflow);
39773847 }
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)) {
39793850 if (!strncmp(data, "0", 1))
39803851 dhd_slpauto = FALSE;
3981
- else if (dhd_conf_disable_slpauto(dhd))
3852
+ else
39823853 dhd_slpauto = TRUE;
39833854 CONFIG_MSG("dhd_slpauto = %d\n", dhd_slpauto);
39843855 }
....@@ -4392,12 +4263,6 @@
43924263 conf->in4way = (int)simple_strtol(data, NULL, 0);
43934264 CONFIG_MSG("in4way = 0x%x\n", conf->in4way);
43944265 }
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 */
44014266 else if (!strncmp("war=", full_param, len_param)) {
44024267 conf->war = (int)simple_strtol(data, NULL, 0);
44034268 CONFIG_MSG("war = 0x%x\n", conf->war);
....@@ -4837,7 +4702,7 @@
48374702 int
48384703 dhd_conf_compat_func(dhd_pub_t *dhd)
48394704 {
4840
- const module_name_map_t *row = NULL;
4705
+ const module_name_map_t* row = NULL;
48414706
48424707 row = dhd_conf_match_module(dhd);
48434708 if (row && row->compat_func) {
....@@ -4849,44 +4714,28 @@
48494714 #endif
48504715
48514716 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
48724717 dhd_conf_postinit_ioctls(dhd_pub_t *dhd)
48734718 {
48744719 struct dhd_conf *conf = dhd->conf;
4875
- char wl_preinit[] = "";
4720
+ char wl_preinit[] = "assoc_retry_max=10";
48764721 #ifdef NO_POWER_SAVE
48774722 char wl_no_power_save[] = "mpc=0, 86=0";
48784723 dhd_conf_set_wl_cmd(dhd, wl_no_power_save, FALSE);
48794724 #endif
48804725
4881
- dhd_conf_get_ioctl_ver(dhd);
48824726 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);
48844731
48854732 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);
48864735 dhd_conf_set_intiovar(dhd, 0, WLC_SET_SRL, "WLC_SET_SRL", conf->srl, 0, FALSE);
48874736 dhd_conf_set_intiovar(dhd, 0, WLC_SET_LRL, "WLC_SET_LRL", conf->lrl, 0, FALSE);
48884737 dhd_conf_set_bw_cap(dhd);
4889
- dhd_conf_set_roam(dhd, 0);
4738
+ dhd_conf_set_roam(dhd);
48904739
48914740 #if defined(BCMPCIE)
48924741 dhd_conf_set_intiovar(dhd, 0, WLC_SET_VAR, "bus:deepsleep_disable",
....@@ -4912,7 +4761,6 @@
49124761 dhd_conf_set_intiovar(dhd, 0, WLC_SET_FAKEFRAG, "WLC_SET_FAKEFRAG",
49134762 conf->frameburst, 0, FALSE);
49144763
4915
- dhd_conf_preinit_ioctls_sta(dhd, 0);
49164764 dhd_conf_set_wl_cmd(dhd, wl_preinit, TRUE);
49174765 #if defined(BCMSDIO)
49184766 if (conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) {
....@@ -4988,10 +4836,12 @@
49884836
49894837 }
49904838
4991
-void
4992
-dhd_conf_free_preinit(dhd_pub_t *dhd)
4839
+int
4840
+dhd_conf_preinit(dhd_pub_t *dhd)
49934841 {
49944842 struct dhd_conf *conf = dhd->conf;
4843
+
4844
+ CONFIG_TRACE("Enter\n");
49954845
49964846 #ifdef SET_FWNV_BY_MAC
49974847 dhd_conf_free_mac_list(&conf->fw_by_mac);
....@@ -5022,16 +4872,6 @@
50224872 kfree(conf->vndr_ie_assocreq);
50234873 conf->vndr_ie_assocreq = NULL;
50244874 }
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);
50354875 conf->band = -1;
50364876 memset(&conf->bw_cap, -1, sizeof(conf->bw_cap));
50374877 if (conf->chip == BCM43362_CHIP_ID || conf->chip == BCM4330_CHIP_ID) {
....@@ -5054,7 +4894,6 @@
50544894 conf->cspec.rev = 0;
50554895 }
50564896 memset(&conf->channels, 0, sizeof(wl_channel_list_t));
5057
- conf->ioctl_ver = WLC_IOCTL_VERSION;
50584897 conf->roam_off = 1;
50594898 conf->roam_off_suspend = 1;
50604899 conf->roam_trigger[0] = -65;
....@@ -5311,7 +5150,35 @@
53115150 {
53125151 struct dhd_conf *conf = dhd->conf;
53135152
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
+ }
53155182 memset(conf, 0, sizeof(dhd_conf_t));
53165183 return 0;
53175184 }
....@@ -5351,7 +5218,35 @@
53515218
53525219 CONFIG_TRACE("Enter\n");
53535220 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
+ }
53555250 MFREE(dhd->osh, conf, sizeof(dhd_conf_t));
53565251 }
53575252 dhd->conf = NULL;