1 /** @file moal_init.c
2 *
3 * @brief This file contains the major functions in WLAN
4 * driver.
5 *
6 *
7 * Copyright 2018-2022 NXP
8 *
9 * This software file (the File) is distributed by NXP
10 * under the terms of the GNU General Public License Version 2, June 1991
11 * (the License). You may use, redistribute and/or modify the File in
12 * accordance with the terms and conditions of the License, a copy of which
13 * is available by writing to the Free Software Foundation, Inc.,
14 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
15 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
16 *
17 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
19 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
20 * this warranty disclaimer.
21 *
22 */
23 #include "moal_main.h"
24
25 /** Global moal_handle array */
26 extern pmoal_handle m_handle[];
27
28 /** Firmware name */
29 static char *fw_name;
30 static int req_fw_nowait;
31 int fw_reload;
32 int auto_fw_reload;
33
34 static char *hw_name;
35
36 /** MAC address */
37 static char *mac_addr;
38 /** Module param cfg file */
39 static char *mod_para="nxp/wifi_mod_para.conf";
40
41 #ifdef MFG_CMD_SUPPORT
42 /** Mfg mode */
43 int mfg_mode;
44 #endif
45
46 #if defined(SDIO)
47 /** SDIO interrupt mode (0: INT_MODE_SDIO, 1: INT_MODE_GPIO) */
48 static int intmode = INT_MODE_SDIO;
49 /** GPIO interrupt pin number */
50 static int gpiopin;
51 #endif
52
53 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
54 static int disable_regd_by_driver = 1;
55 /** Region alpha2 string */
56 static char *reg_alpha2;
57 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
58 static int country_ie_ignore;
59 static int beacon_hints;
60 #endif
61 #endif
62
63 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
64 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
65 static int host_mlme = 1;
66 #endif
67 #endif
68
69 static int roamoffload_in_hs;
70
71 /** Auto deep sleep */
72 static int auto_ds;
73
74 /** net_rx mode*/
75 static int net_rx;
76 /** amsdu deaggr mode */
77 static int amsdu_deaggr;
78
79 static int ext_scan;
80
81 /** IEEE PS mode */
82 static int ps_mode;
83 /** passive to active scan */
84 static int p2a_scan;
85 /** scan chan gap */
86 static int scan_chan_gap;
87 /** sched scan */
88 static int sched_scan = 1;
89 /** Max Tx buffer size */
90 int max_tx_buf;
91
92 #ifdef STA_SUPPORT
93 /** Max STA interfaces */
94 static int max_sta_bss = DEF_STA_BSS;
95 /** STA interface name */
96 static char *sta_name;
97 #endif
98
99 #ifdef UAP_SUPPORT
100 /** Max uAP interfaces */
101 static int max_uap_bss = DEF_UAP_BSS;
102 /** uAP interface name */
103 static char *uap_name;
104 /** Max uAP station number */
105 static int uap_max_sta;
106 /** WACP mode */
107 static int wacp_mode = WACP_MODE_DEFAULT;
108 #endif
109
110 #ifdef WIFI_DIRECT_SUPPORT
111 /** Max WIFIDIRECT interfaces */
112 static int max_wfd_bss = DEF_WIFIDIRECT_BSS;
113 /** WIFIDIRECT interface name */
114 static char *wfd_name;
115 #if defined(STA_CFG80211) && defined(UAP_CFG80211)
116 /** max VIRTUAL bss */
117 static int max_vir_bss = DEF_VIRTUAL_BSS;
118 #endif
119 #endif
120
121 /** PM keep power */
122 static int pm_keep_power = 1;
123 #ifdef SDIO_SUSPEND_RESUME
124 /** HS when shutdown */
125 static int shutdown_hs;
126 #endif
127
128 #if defined(SDIO)
129 /** SDIO slew rate */
130 static int slew_rate = 3;
131 #endif
132 int tx_work = 0;
133
134 static int tx_skb_clone = 0;
135 #ifdef IMX_SUPPORT
136 static int pmqos = 1;
137 #else
138 static int pmqos = 0;
139 #endif
140
141 static int chan_track = 0;
142 static int mcs32 = 1;
143
144 #if defined(STA_SUPPORT)
145 /** 802.11d configuration */
146 static int cfg_11d;
147 #endif
148
149 /** fw serial download check */
150 static int fw_serial = 1;
151
152 /** napi support*/
153 static int napi;
154
155 /** DPD data config file */
156 static char *dpd_data_cfg;
157
158 /** CAL data config file */
159 static char *cal_data_cfg;
160 /** Init config file (MAC address, register etc.) */
161 static char *init_cfg;
162
163 /** Set configuration data of Tx power limitation */
164 static char *txpwrlimit_cfg;
165 /** Allow setting tx power table of country */
166 static int cntry_txpwr;
167
168 /** Init hostcmd file */
169 static char *init_hostcmd_cfg;
170 static char *band_steer_cfg;
171
172 #if defined(STA_WEXT) || defined(UAP_WEXT)
173 /** CFG80211 and WEXT mode */
174 static int cfg80211_wext =
175 STA_WEXT_MASK | UAP_WEXT_MASK | STA_CFG80211_MASK | UAP_CFG80211_MASK;
176 #else
177 /** CFG80211 mode */
178 static int cfg80211_wext = STA_CFG80211_MASK | UAP_CFG80211_MASK;
179 #endif
180
181 /** Work queue priority */
182 static int wq_sched_prio;
183 /** Work queue scheduling policy */
184 static int wq_sched_policy = SCHED_NORMAL;
185 /** rx_work flag */
186 static int rx_work;
187
188 #if defined(USB)
189 int skip_fwdnld;
190 #endif
191
192 /* Enable/disable aggrctrl */
193 static int aggrctrl;
194
195 #ifdef USB
196 /* Enable/disable USB aggregation feature */
197 static int usb_aggr;
198 #endif
199
200 #ifdef PCIE
201 /* Enable/disable Message Signaled Interrupt (MSI) */
202 int pcie_int_mode = PCIE_INT_MODE_MSI;
203 static int ring_size;
204 #endif /* PCIE */
205
206 static int low_power_mode_enable;
207
208 static int hw_test;
209
210 #ifdef CONFIG_OF
211 int dts_enable = 1;
212 #endif
213
214 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
215 static int dfs_offload;
216 #endif
217
218 #ifdef ANDROID_KERNEL
219 int wakelock_timeout = WAKE_LOCK_TIMEOUT;
220 #endif
221
222 #if defined(STA_SUPPORT) && defined(UAP_SUPPORT)
223 #ifdef WIFI_DIRECT_SUPPORT
224 static int drv_mode = (DRV_MODE_STA | DRV_MODE_UAP | DRV_MODE_WIFIDIRECT);
225 #else
226 static int drv_mode = (DRV_MODE_STA | DRV_MODE_UAP);
227 #endif /* WIFI_DIRECT_SUPPORT */
228 #else
229 #ifdef STA_SUPPORT
230 static int drv_mode = DRV_MODE_STA;
231 #else
232 static int drv_mode = DRV_MODE_UAP;
233 #endif /* STA_SUPPORT */
234 #endif /* STA_SUPPORT & UAP_SUPPORT */
235
236 static int gtk_rekey_offload = GTK_REKEY_OFFLOAD_DISABLE;
237
238 static int pmic;
239
240 static int antcfg;
241
242 static t_u32 uap_oper_ctrl;
243
244 static int hs_wake_interval = 400;
245 static int indication_gpio = 0xff;
246 static int disconnect_on_suspend;
247 static int hs_mimo_switch;
248
249 static int indrstcfg = 0xffffffff;
250
251 /** all the feature are enabled */
252 #define DEFAULT_DEV_CAP_MASK 0xffffffff
253 static t_u32 dev_cap_mask = DEFAULT_DEV_CAP_MASK;
254 #ifdef SDIO
255 static int sdio_rx_aggr = MTRUE;
256 #endif
257
258 /** The global variable of scan beacon buffer **/
259 static int fixed_beacon_buffer;
260
261 #ifdef WIFI_DIRECT_SUPPORT
262 static int GoAgeoutTime;
263 #endif
264
265 static t_u16 multi_dtim;
266
267 static t_u16 inact_tmo;
268
269 #ifdef DEBUG_LEVEL1
270 #ifdef DEBUG_LEVEL2
271 #define DEFAULT_DEBUG_MASK (0xffffffff)
272 #else
273 #define DEFAULT_DEBUG_MASK (MMSG | MFATAL | MERROR | MREG_D)
274 #endif /* DEBUG_LEVEL2 */
275 t_u32 drvdbg = DEFAULT_DEBUG_MASK;
276
277 #endif /* DEBUG_LEVEL1 */
278
279 static card_type_entry card_type_map_tbl[] = {
280 #ifdef SD8801
281 {CARD_TYPE_SD8801, 0, CARD_SD8801},
282 #endif
283 #ifdef SD8887
284 {CARD_TYPE_SD8887, 0, CARD_SD8887},
285 #endif
286 #ifdef SD8897
287 {CARD_TYPE_SD8897, 0, CARD_SD8897},
288 #endif
289 #ifdef SD8977
290 {CARD_TYPE_SD8977, 0, CARD_SD8977},
291 #endif
292 #ifdef SD8978
293 {CARD_TYPE_SD8978, 0, CARD_SD8978},
294 #endif
295 #ifdef SD8997
296 {CARD_TYPE_SD8997, 0, CARD_SD8997},
297 #endif
298 #ifdef SD8987
299 {CARD_TYPE_SD8987, 0, CARD_SD8987},
300 #endif
301 #ifdef SD9097
302 {CARD_TYPE_SD9097, 0, CARD_SD9097},
303 #endif
304 #ifdef SD9098
305 {CARD_TYPE_SD9098, 0, CARD_SD9098},
306 #endif
307 #ifdef SD9177
308 {CARD_TYPE_SD9177, 0, CARD_SD9177},
309 #endif
310 #ifdef SDNW62X
311 {CARD_TYPE_SDNW62X, 0, CARD_SDNW62X},
312 #endif
313 #ifdef PCIE8897
314 {CARD_TYPE_PCIE8897, 0, CARD_PCIE8897},
315 #endif
316 #ifdef PCIE8997
317 {CARD_TYPE_PCIE8997, 0, CARD_PCIE8997},
318 #endif
319 #ifdef PCIE9097
320 {CARD_TYPE_PCIE9097, 0, CARD_PCIE9097},
321 #endif
322 #ifdef PCIE9098
323 {CARD_TYPE_PCIE9098, 0, CARD_PCIE9098},
324 #endif
325 #ifdef PCIENW62X
326 {CARD_TYPE_PCIENW62X, 0, CARD_PCIENW62X},
327 #endif
328 #ifdef USB8801
329 {CARD_TYPE_USB8801, 0, CARD_USB8801},
330 #endif
331
332 #ifdef USB8897
333 {CARD_TYPE_USB8897, 0, CARD_USB8897},
334 #endif
335 #ifdef USB8997
336 {CARD_TYPE_USB8997, 0, CARD_USB8997},
337 #endif
338 #ifdef USB8978
339 {CARD_TYPE_USB8978, 0, CARD_USB8978},
340 #endif
341 #ifdef USB9098
342 {CARD_TYPE_USB9098, 0, CARD_USB9098},
343 #endif
344 #ifdef USB9097
345 {CARD_TYPE_USB9097, 0, CARD_USB9097},
346 #endif
347 #ifdef USBNW62X
348 {CARD_TYPE_USBNW62X, 0, CARD_USBNW62X},
349 #endif
350
351 };
352
353 static int dfs53cfg = DFS_W53_DEFAULT_FW;
354
355 static int keep_previous_scan = 1;
356
357 /**
358 * @brief This function read a line in module parameter file
359 *
360 * @param data A pointer to module parameter data buffer
361 * @param size module parameter file size
362 * @param line_pos A pointer to offset of current line
363 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
364 */
parse_cfg_get_line(t_u8 * data,t_size size,t_u8 * line_pos)365 static t_size parse_cfg_get_line(t_u8 *data, t_size size, t_u8 *line_pos)
366 {
367 t_u8 *src, *dest;
368 static t_s32 pos;
369
370 ENTER();
371
372 if (pos >= (t_s32)size) { /* reach the end */
373 pos = 0; /* Reset position for rfkill */
374 LEAVE();
375 return -1;
376 }
377 memset(line_pos, 0, MAX_LINE_LEN);
378 src = data + pos;
379 dest = line_pos;
380
381 while (pos < (t_s32)size && *src != '\x0A' && *src != '\0') {
382 if (*src != ' ' && *src != '\t') /* parse space */
383 *dest++ = *src++;
384 else
385 src++;
386 pos++;
387 }
388 /* parse new line */
389 pos++;
390 *dest = '\0';
391 LEAVE();
392 return strlen(line_pos);
393 }
394
395 /**
396 * @brief This function duplicate a string
397 *
398 * @param dst A pointer to destination string
399 * @param src A pointer to source string
400 *
401 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
402 */
woal_dup_string(char ** dst,char * src)403 static void woal_dup_string(char **dst, char *src)
404 {
405 size_t len = 0;
406 if (src) {
407 len = strlen(src);
408 if (len != 0) {
409 if (*dst != NULL)
410 kfree(*dst);
411 *dst = kzalloc(len + 1, GFP_KERNEL);
412 if (*dst == NULL) {
413 PRINTM(MERROR,
414 "Failed to alloc mem for param: %s\n",
415 src);
416 return;
417 }
418 moal_memcpy_ext(NULL, *dst, src, len, len);
419 }
420 }
421 }
422
423 /**
424 * @brief This function read an integer value in module parameter file
425 *
426 * @param line A pointer to a line
427 * @param out_data A pointer to parsed integer value
428 *
429 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
430 */
parse_line_read_int(t_u8 * line,int * out_data)431 static mlan_status parse_line_read_int(t_u8 *line, int *out_data)
432 {
433 t_u8 *p = NULL;
434 mlan_status ret = MLAN_STATUS_SUCCESS;
435
436 if (line == NULL) {
437 ret = MLAN_STATUS_FAILURE;
438 goto out;
439 }
440 p = strstr(line, "=");
441 if (p == NULL) {
442 ret = MLAN_STATUS_FAILURE;
443 goto out;
444 }
445 p++;
446 ret = woal_atoi(out_data, p);
447 out:
448 if (ret != MLAN_STATUS_SUCCESS)
449 *out_data = 0;
450 return ret;
451 }
452
453 /**
454 * @brief This function read a string in module parameter file
455 *
456 * @param line A pointer to a line
457 * @param out_str A pointer to parsed string
458 *
459 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
460 */
parse_line_read_string(t_u8 * line,char ** out_str)461 static mlan_status parse_line_read_string(t_u8 *line, char **out_str)
462 {
463 t_u8 *p = NULL, *pstr = NULL;
464 mlan_status ret = MLAN_STATUS_SUCCESS;
465
466 if (line == NULL) {
467 ret = MLAN_STATUS_FAILURE;
468 goto out;
469 }
470 p = strstr(line, "=");
471 if (p == NULL) {
472 ret = MLAN_STATUS_FAILURE;
473 goto out;
474 }
475 p++;
476 pstr = p;
477 while (*pstr) {
478 if (*pstr == '\"')
479 *pstr = '\0';
480 pstr++;
481 }
482 if (*p == '\0')
483 p++;
484 *out_str = p;
485 out:
486 return ret;
487 }
488
489 /**
490 * @brief This function read card info in module parameter file
491 *
492 * @param line A pointer to a line
493 * @param type A pointer to card type
494 * @param if_id A pointer to interface id
495 *
496 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
497 */
parse_line_read_card_info(t_u8 * line,char ** type,char ** if_id)498 static mlan_status parse_line_read_card_info(t_u8 *line, char **type,
499 char **if_id)
500 {
501 t_u8 *p = NULL;
502 mlan_status ret = MLAN_STATUS_SUCCESS;
503
504 if (line == NULL) {
505 ret = MLAN_STATUS_FAILURE;
506 goto out;
507 }
508
509 p = strstr(line, "=");
510 if (p == NULL) {
511 ret = MLAN_STATUS_FAILURE;
512 goto out;
513 }
514 *p = '\0';
515
516 p = strstr(line, "_");
517 if (p != NULL) {
518 *p++ = '\0';
519 *if_id = p;
520 } else {
521 *if_id = NULL;
522 }
523 *type = line;
524 out:
525 return ret;
526 }
527
528 /**
529 * @brief This function read blocks in module parameter file
530 *
531 * @param data A pointer to a line
532 * @param size line size
533 * @param handle A pointer to moal_handle structure
534 *
535 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
536 */
parse_cfg_read_block(t_u8 * data,t_u32 size,moal_handle * handle)537 static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size,
538 moal_handle *handle)
539 {
540 int out_data = 0, end = 0;
541 char *out_str = NULL;
542 t_u8 line[MAX_LINE_LEN];
543 moal_mod_para *params = &handle->params;
544 mlan_status ret = MLAN_STATUS_SUCCESS;
545
546 while ((int)parse_cfg_get_line(data, size, line) != -1) {
547 if (strncmp(line, "}", strlen("}")) == 0) {
548 end = 1;
549 break;
550 }
551 if (end == 0 && strstr(line, "{") != NULL)
552 break;
553 if (strncmp(line, "hw_test", strlen("hw_test")) == 0) {
554 if (parse_line_read_int(line, &out_data) !=
555 MLAN_STATUS_SUCCESS)
556 goto err;
557 if (out_data)
558 moal_extflg_set(handle, EXT_HW_TEST);
559 else
560 moal_extflg_clear(handle, EXT_HW_TEST);
561 PRINTM(MMSG, "hw_test %s\n",
562 moal_extflg_isset(handle, EXT_HW_TEST) ? "on" :
563 "off");
564 }
565 #ifdef CONFIG_OF
566 else if (strncmp(line, "dts_enable", strlen("dts_enable")) ==
567 0) {
568 if (parse_line_read_int(line, &out_data) !=
569 MLAN_STATUS_SUCCESS)
570 goto err;
571 if (out_data)
572 moal_extflg_set(handle, EXT_DTS_ENABLE);
573 else
574 moal_extflg_clear(handle, EXT_DTS_ENABLE);
575 PRINTM(MMSG, "dts_enable %s\n",
576 moal_extflg_isset(handle, EXT_DTS_ENABLE) ?
577 "on" :
578 "off");
579 }
580 #endif
581 else if (strncmp(line, "fw_name", strlen("fw_name")) == 0) {
582 if (parse_line_read_string(line, &out_str) !=
583 MLAN_STATUS_SUCCESS)
584 goto err;
585 woal_dup_string(¶ms->fw_name, out_str);
586 PRINTM(MMSG, "fw_name=%s\n", params->fw_name);
587 } else if (strncmp(line, "req_fw_nowait",
588 strlen("req_fw_nowait")) == 0) {
589 if (parse_line_read_int(line, &out_data) !=
590 MLAN_STATUS_SUCCESS)
591 goto err;
592 if (out_data)
593 moal_extflg_set(handle, EXT_REQ_FW_NOWAIT);
594 else
595 moal_extflg_clear(handle, EXT_REQ_FW_NOWAIT);
596 PRINTM(MMSG, "req fw nowait %s\n",
597 moal_extflg_isset(handle, EXT_REQ_FW_NOWAIT) ?
598 "on" :
599 "off");
600 } else if (strncmp(line, "fw_reload", strlen("fw_reload")) ==
601 0) {
602 if (parse_line_read_int(line, &out_data) !=
603 MLAN_STATUS_SUCCESS)
604 goto err;
605 params->fw_reload = out_data;
606 PRINTM(MMSG, "fw_reload %d\n", params->fw_reload);
607 } else if (strncmp(line, "auto_fw_reload",
608 strlen("auto_fw_reload")) == 0) {
609 if (parse_line_read_int(line, &out_data) !=
610 MLAN_STATUS_SUCCESS)
611 goto err;
612 params->auto_fw_reload = out_data;
613 PRINTM(MMSG, "auto_fw_reload %d\n",
614 params->auto_fw_reload);
615 } else if (strncmp(line, "fw_serial", strlen("fw_serial")) ==
616 0) {
617 if (parse_line_read_int(line, &out_data) !=
618 MLAN_STATUS_SUCCESS)
619 goto err;
620 if (out_data)
621 moal_extflg_set(handle, EXT_FW_SERIAL);
622 else
623 moal_extflg_clear(handle, EXT_FW_SERIAL);
624 PRINTM(MMSG, "fw_serial %s\n",
625 moal_extflg_isset(handle, EXT_FW_SERIAL) ?
626 "on" :
627 "off");
628 } else if (strncmp(line, "hw_name", strlen("hw_name")) == 0) {
629 if (parse_line_read_string(line, &out_str) !=
630 MLAN_STATUS_SUCCESS)
631 goto err;
632 woal_dup_string(¶ms->hw_name, out_str);
633 PRINTM(MMSG, "hw_name=%s\n", params->hw_name);
634 } else if (strncmp(line, "mac_addr", strlen("mac_addr")) == 0) {
635 if (parse_line_read_string(line, &out_str) !=
636 MLAN_STATUS_SUCCESS)
637 goto err;
638 woal_dup_string(¶ms->mac_addr, out_str);
639 PRINTM(MMSG, "mac_addr=%s\n", params->mac_addr);
640 }
641 #ifdef MFG_CMD_SUPPORT
642 else if (strncmp(line, "mfg_mode", strlen("mfg_mode")) == 0) {
643 if (parse_line_read_int(line, &out_data) !=
644 MLAN_STATUS_SUCCESS)
645 goto err;
646 params->mfg_mode = out_data;
647 PRINTM(MMSG, "mfg_mode = %d\n", params->mfg_mode);
648 }
649 #endif
650 else if (strncmp(line, "drv_mode", strlen("drv_mode")) == 0) {
651 if (parse_line_read_int(line, &out_data) !=
652 MLAN_STATUS_SUCCESS)
653 goto err;
654 params->drv_mode = out_data;
655 PRINTM(MMSG, "drv_mode = %d\n", params->drv_mode);
656 }
657 #ifdef DEBUG_LEVEL1
658 else if (strncmp(line, "drvdbg", strlen("drvdbg")) == 0) {
659 if (parse_line_read_int(line, &out_data) !=
660 MLAN_STATUS_SUCCESS)
661 goto err;
662 params->drvdbg = out_data;
663 PRINTM(MMSG, "drvdbg = %d\n", params->drvdbg);
664 }
665 #endif
666 #ifdef STA_SUPPORT
667 else if (strncmp(line, "max_sta_bss", strlen("max_sta_bss")) ==
668 0) {
669 if (parse_line_read_int(line, &out_data) !=
670 MLAN_STATUS_SUCCESS)
671 goto err;
672 params->max_sta_bss = out_data;
673 PRINTM(MMSG, "max_sta_bss = %d\n", params->max_sta_bss);
674 } else if (strncmp(line, "sta_name", strlen("sta_name")) == 0) {
675 if (parse_line_read_string(line, &out_str) !=
676 MLAN_STATUS_SUCCESS)
677 goto err;
678 woal_dup_string(¶ms->sta_name, out_str);
679 PRINTM(MMSG, "sta_name=%s\n", params->sta_name);
680 }
681 #endif /* STA_SUPPORT */
682 #ifdef UAP_SUPPORT
683 else if (strncmp(line, "max_uap_bss", strlen("max_uap_bss")) ==
684 0) {
685 if (parse_line_read_int(line, &out_data) !=
686 MLAN_STATUS_SUCCESS)
687 goto err;
688 params->max_uap_bss = out_data;
689 PRINTM(MMSG, "max_uap_bss = %d\n", params->max_uap_bss);
690 } else if (strncmp(line, "uap_name", strlen("uap_name")) == 0) {
691 if (parse_line_read_string(line, &out_str) !=
692 MLAN_STATUS_SUCCESS)
693 goto err;
694 woal_dup_string(¶ms->uap_name, out_str);
695 PRINTM(MMSG, "uap_name=%s\n", params->uap_name);
696 }
697 #endif /* UAP_SUPPORT */
698 #ifdef WIFI_DIRECT_SUPPORT
699 else if (strncmp(line, "wfd_name", strlen("wfd_name")) == 0) {
700 if (parse_line_read_string(line, &out_str) !=
701 MLAN_STATUS_SUCCESS)
702 goto err;
703 woal_dup_string(¶ms->wfd_name, out_str);
704 PRINTM(MMSG, "wfd_name=%s\n", params->wfd_name);
705 }
706 #if defined(STA_CFG80211) && defined(UAP_CFG80211)
707 else if (strncmp(line, "max_vir_bss", strlen("max_vir_bss")) ==
708 0) {
709 if (parse_line_read_int(line, &out_data) !=
710 MLAN_STATUS_SUCCESS)
711 goto err;
712 params->max_vir_bss = out_data;
713 PRINTM(MMSG, "max_vir_bss=%d\n", params->max_vir_bss);
714 }
715 #endif
716 #endif
717 else if (strncmp(line, "auto_ds", strlen("auto_ds")) == 0) {
718 if (parse_line_read_int(line, &out_data) !=
719 MLAN_STATUS_SUCCESS)
720 goto err;
721 params->auto_ds = out_data;
722 PRINTM(MMSG, "auto_ds = %d\n", params->auto_ds);
723 } else if (strncmp(line, "net_rx", strlen("net_rx")) == 0) {
724 if (parse_line_read_int(line, &out_data) !=
725 MLAN_STATUS_SUCCESS)
726 goto err;
727 params->net_rx = out_data;
728 PRINTM(MMSG, "net_rx = %d\n", params->net_rx);
729 } else if (strncmp(line, "amsdu_deaggr",
730 strlen("amsdu_deaggr")) == 0) {
731 if (parse_line_read_int(line, &out_data) !=
732 MLAN_STATUS_SUCCESS)
733 goto err;
734 params->amsdu_deaggr = out_data;
735 PRINTM(MMSG, "amsdu_deaggr = %d\n",
736 params->amsdu_deaggr);
737 } else if (strncmp(line, "ext_scan", strlen("ext_scan")) == 0) {
738 if (parse_line_read_int(line, &out_data) !=
739 MLAN_STATUS_SUCCESS)
740 goto err;
741 params->ext_scan = out_data;
742 PRINTM(MMSG, "ext_scan = %d\n", params->ext_scan);
743 } else if (strncmp(line, "ps_mode", strlen("ps_mode")) == 0) {
744 if (parse_line_read_int(line, &out_data) !=
745 MLAN_STATUS_SUCCESS)
746 goto err;
747 params->ps_mode = out_data;
748 PRINTM(MMSG, "ps_mode = %d\n", params->ps_mode);
749 } else if (strncmp(line, "p2a_scan", strlen("p2a_scan")) == 0) {
750 if (parse_line_read_int(line, &out_data) !=
751 MLAN_STATUS_SUCCESS)
752 goto err;
753 params->p2a_scan = out_data;
754 PRINTM(MMSG, "p2a_scan = %d\n", params->p2a_scan);
755 } else if (strncmp(line, "scan_chan_gap",
756 strlen("scan_chan_gap")) == 0) {
757 if (parse_line_read_int(line, &out_data) !=
758 MLAN_STATUS_SUCCESS)
759 goto err;
760 params->scan_chan_gap = out_data;
761 PRINTM(MMSG, "scan_chan_gap = %d\n",
762 params->scan_chan_gap);
763 } else if (strncmp(line, "sched_scan", strlen("sched_scan")) ==
764 0) {
765 if (parse_line_read_int(line, &out_data) !=
766 MLAN_STATUS_SUCCESS)
767 goto err;
768 params->sched_scan = out_data;
769 PRINTM(MMSG, "sched_scan = %d\n", params->sched_scan);
770 } else if (strncmp(line, "max_tx_buf", strlen("max_tx_buf")) ==
771 0) {
772 if (parse_line_read_int(line, &out_data) !=
773 MLAN_STATUS_SUCCESS)
774 goto err;
775 params->max_tx_buf = out_data;
776 PRINTM(MMSG, "max_tx_buf = %d\n", params->max_tx_buf);
777 }
778 #if defined(SDIO)
779 else if (strncmp(line, "intmode", strlen("intmode")) == 0) {
780 if (parse_line_read_int(line, &out_data) !=
781 MLAN_STATUS_SUCCESS)
782 goto err;
783 if (out_data)
784 moal_extflg_set(handle, EXT_INTMODE);
785 else
786 moal_extflg_clear(handle, EXT_INTMODE);
787 PRINTM(MMSG, "intmode %s\n",
788 moal_extflg_isset(handle, EXT_INTMODE) ? "on" :
789 "off");
790 } else if (strncmp(line, "gpiopin", strlen("gpiopin")) == 0) {
791 if (parse_line_read_int(line, &out_data) !=
792 MLAN_STATUS_SUCCESS)
793 goto err;
794 params->gpiopin = out_data;
795 PRINTM(MMSG, "gpiopin = %d\n", params->gpiopin);
796 }
797 #endif
798 else if (strncmp(line, "pm_keep_power",
799 strlen("pm_keep_power")) == 0) {
800 if (parse_line_read_int(line, &out_data) !=
801 MLAN_STATUS_SUCCESS)
802 goto err;
803 if (out_data)
804 moal_extflg_set(handle, EXT_PM_KEEP_POWER);
805 else
806 moal_extflg_clear(handle, EXT_PM_KEEP_POWER);
807 PRINTM(MMSG, "pm_keep_power %s\n",
808 moal_extflg_isset(handle, EXT_PM_KEEP_POWER) ?
809 "on" :
810 "off");
811 }
812 #if defined(SDIO) && defined(SDIO_SUSPEND_RESUME)
813 else if (strncmp(line, "shutdown_hs", strlen("shutdown_hs")) ==
814 0) {
815 if (parse_line_read_int(line, &out_data) !=
816 MLAN_STATUS_SUCCESS)
817 goto err;
818 if (out_data)
819 moal_extflg_set(handle, EXT_SHUTDOWN_HS);
820 else
821 moal_extflg_clear(handle, EXT_SHUTDOWN_HS);
822 PRINTM(MMSG, "shutdown_hs %s\n",
823 moal_extflg_isset(handle, EXT_SHUTDOWN_HS) ?
824 "on" :
825 "off");
826 }
827 #endif
828 #if defined(STA_SUPPORT)
829 else if (strncmp(line, "cfg_11d", strlen("cfg_11d")) == 0) {
830 if (parse_line_read_int(line, &out_data) !=
831 MLAN_STATUS_SUCCESS)
832 goto err;
833 params->cfg_11d = out_data;
834 PRINTM(MMSG, "cfg_11d = %d\n", params->cfg_11d);
835 }
836 #endif
837 #if defined(SDIO)
838 else if (strncmp(line, "slew_rate", strlen("slew_rate")) == 0) {
839 if (parse_line_read_int(line, &out_data) !=
840 MLAN_STATUS_SUCCESS)
841 goto err;
842 params->slew_rate = out_data;
843 PRINTM(MMSG, "slew_rate = %d\n", params->slew_rate);
844 }
845 #endif
846 else if (strncmp(line, "dpd_data_cfg",
847 strlen("dpd_data_cfg")) == 0) {
848 if (parse_line_read_string(line, &out_str) !=
849 MLAN_STATUS_SUCCESS)
850 goto err;
851 woal_dup_string(¶ms->dpd_data_cfg, out_str);
852 PRINTM(MMSG, "dpd_data_cfg=%s\n", params->dpd_data_cfg);
853 } else if (strncmp(line, "init_cfg", strlen("init_cfg")) == 0) {
854 if (parse_line_read_string(line, &out_str) !=
855 MLAN_STATUS_SUCCESS)
856 goto err;
857 woal_dup_string(¶ms->init_cfg, out_str);
858 PRINTM(MMSG, "init_cfg=%s\n", params->init_cfg);
859 } else if (strncmp(line, "cal_data_cfg",
860 strlen("cal_data_cfg")) == 0) {
861 if (parse_line_read_string(line, &out_str) !=
862 MLAN_STATUS_SUCCESS)
863 goto err;
864 woal_dup_string(¶ms->cal_data_cfg, out_str);
865 PRINTM(MMSG, "cal_data_cfg=%s\n", params->cal_data_cfg);
866 } else if (strncmp(line, "txpwrlimit_cfg",
867 strlen("txpwrlimit_cfg")) == 0) {
868 if (parse_line_read_string(line, &out_str) !=
869 MLAN_STATUS_SUCCESS)
870 goto err;
871 woal_dup_string(¶ms->txpwrlimit_cfg, out_str);
872 PRINTM(MMSG, "txpwrlimit_cfg=%s\n",
873 params->txpwrlimit_cfg);
874 } else if (strncmp(line, "cntry_txpwr",
875 strlen("cntry_txpwr")) == 0) {
876 if (parse_line_read_int(line, &out_data) !=
877 MLAN_STATUS_SUCCESS)
878 goto err;
879 params->cntry_txpwr = out_data;
880 PRINTM(MMSG, "cntry_txpwr = %d\n", params->cntry_txpwr);
881 } else if (strncmp(line, "init_hostcmd_cfg",
882 strlen("init_hostcmd_cfg")) == 0) {
883 if (parse_line_read_string(line, &out_str) !=
884 MLAN_STATUS_SUCCESS)
885 goto err;
886 woal_dup_string(¶ms->init_hostcmd_cfg, out_str);
887 PRINTM(MMSG, "init_hostcmd_cfg=%s\n",
888 params->init_hostcmd_cfg);
889 } else if (strncmp(line, "band_steer_cfg",
890 strlen("band_steer_cfg")) == 0) {
891 if (parse_line_read_string(line, &out_str) !=
892 MLAN_STATUS_SUCCESS)
893 goto err;
894 woal_dup_string(¶ms->band_steer_cfg, out_str);
895 PRINTM(MMSG, "band_steer_cfg=%s\n",
896 params->band_steer_cfg);
897 } else if (strncmp(line, "cfg80211_wext",
898 strlen("cfg80211_wext")) == 0) {
899 if (parse_line_read_int(line, &out_data) !=
900 MLAN_STATUS_SUCCESS)
901 goto err;
902 params->cfg80211_wext = out_data;
903 PRINTM(MMSG, "cfg80211_wext=0x%x\n",
904 params->cfg80211_wext);
905 }
906 #if defined(USB)
907 else if (IS_USB(handle->card_type) &&
908 strncmp(line, "skip_fwdnld", strlen("skip_fwdnld")) ==
909 0) {
910 if (parse_line_read_int(line, &out_data) !=
911 MLAN_STATUS_SUCCESS)
912 goto err;
913 if (out_data)
914 moal_extflg_set(handle, EXT_SKIP_FWDNLD);
915 else
916 moal_extflg_clear(handle, EXT_SKIP_FWDNLD);
917 PRINTM(MMSG, "skip_fwdnld %s\n",
918 moal_extflg_isset(handle, EXT_SKIP_FWDNLD) ?
919 "on" :
920 "off");
921 }
922 #endif
923 else if (strncmp(line, "wq_sched_prio",
924 strlen("wq_sched_prio")) == 0) {
925 if (parse_line_read_int(line, &out_data) !=
926 MLAN_STATUS_SUCCESS)
927 goto err;
928 params->wq_sched_prio = out_data;
929 PRINTM(MMSG, "wq_sched_prio=0x%x\n",
930 params->wq_sched_prio);
931 } else if (strncmp(line, "wq_sched_policy",
932 strlen("wq_sched_policy")) == 0) {
933 if (parse_line_read_int(line, &out_data) !=
934 MLAN_STATUS_SUCCESS)
935 goto err;
936 params->wq_sched_policy = out_data;
937 PRINTM(MMSG, "wq_sched_policy=0x%x\n",
938 params->wq_sched_policy);
939 } else if (strncmp(line, "rx_work", strlen("rx_work")) == 0) {
940 if (parse_line_read_int(line, &out_data) !=
941 MLAN_STATUS_SUCCESS)
942 goto err;
943 params->rx_work = out_data;
944 PRINTM(MMSG, "rx_work=0x%x\n", params->rx_work);
945 } else if (strncmp(line, "aggrctrl", strlen("aggrctrl")) == 0) {
946 if (parse_line_read_int(line, &out_data) !=
947 MLAN_STATUS_SUCCESS)
948 goto err;
949 if (out_data)
950 moal_extflg_set(handle, EXT_AGGR_CTRL);
951 else
952 moal_extflg_clear(handle, EXT_AGGR_CTRL);
953 PRINTM(MMSG, "aggrctrl %s\n",
954 moal_extflg_isset(handle, EXT_AGGR_CTRL) ?
955 "on" :
956 "off");
957 }
958 #ifdef USB
959 else if (IS_USB(handle->card_type) &&
960 strncmp(line, "usb_aggr", strlen("usb_aggr")) == 0) {
961 if (parse_line_read_int(line, &out_data) !=
962 MLAN_STATUS_SUCCESS)
963 goto err;
964 params->usb_aggr = out_data;
965 PRINTM(MMSG, "usb_aggr=0x%x\n", params->usb_aggr);
966 }
967 #endif
968 #ifdef PCIE
969 else if (IS_PCIE(handle->card_type) &&
970 strncmp(line, "pcie_int_mode",
971 strlen("pcie_int_mode")) == 0) {
972 if (parse_line_read_int(line, &out_data) !=
973 MLAN_STATUS_SUCCESS)
974 goto err;
975 params->pcie_int_mode = out_data;
976 PRINTM(MMSG, "pcie_int_mode=%d\n",
977 params->pcie_int_mode);
978 } else if (IS_PCIE(handle->card_type) &&
979 strncmp(line, "ring_size", strlen("ring_size")) ==
980 0) {
981 if (parse_line_read_int(line, &out_data) !=
982 MLAN_STATUS_SUCCESS)
983 goto err;
984 params->ring_size = out_data;
985 PRINTM(MMSG, "ring_size=%d\n", params->ring_size);
986 }
987 #endif
988 else if (strncmp(line, "low_power_mode_enable",
989 strlen("low_power_mode_enable")) == 0) {
990 if (parse_line_read_int(line, &out_data) !=
991 MLAN_STATUS_SUCCESS)
992 goto err;
993 if (out_data)
994 moal_extflg_set(handle, EXT_LOW_PW_MODE);
995 else
996 moal_extflg_clear(handle, EXT_LOW_PW_MODE);
997 PRINTM(MMSG, "low_power_mode_enable %s\n",
998 moal_extflg_isset(handle, EXT_LOW_PW_MODE) ?
999 "on" :
1000 "off");
1001 }
1002 #ifdef ANDROID_KERNEL
1003 else if (strncmp(line, "wakelock_timeout",
1004 strlen("wakelock_timeout")) == 0) {
1005 if (parse_line_read_int(line, &out_data) !=
1006 MLAN_STATUS_SUCCESS)
1007 goto err;
1008 params->wakelock_timeout = out_data;
1009 PRINTM(MMSG, "wakelock_timeout=%d\n",
1010 params->wakelock_timeout);
1011 }
1012 #endif
1013 else if (strncmp(line, "dev_cap_mask",
1014 strlen("dev_cap_mask")) == 0) {
1015 if (parse_line_read_int(line, &out_data) !=
1016 MLAN_STATUS_SUCCESS)
1017 goto err;
1018 params->dev_cap_mask = out_data;
1019 PRINTM(MMSG, "dev_cap_mask=%d\n", params->dev_cap_mask);
1020 }
1021 #ifdef SDIO
1022 else if (strncmp(line, "sdio_rx_aggr",
1023 strlen("sdio_rx_aggr")) == 0) {
1024 if (parse_line_read_int(line, &out_data) !=
1025 MLAN_STATUS_SUCCESS)
1026 goto err;
1027 if (out_data)
1028 moal_extflg_set(handle, EXT_SDIO_RX_AGGR);
1029 else
1030 moal_extflg_clear(handle, EXT_SDIO_RX_AGGR);
1031 PRINTM(MMSG, "sdio_rx_aggr %s\n",
1032 moal_extflg_isset(handle, EXT_SDIO_RX_AGGR) ?
1033 "on" :
1034 "off");
1035 }
1036 #endif
1037 else if (strncmp(line, "pmic", strlen("pmic")) == 0) {
1038 if (parse_line_read_int(line, &out_data) !=
1039 MLAN_STATUS_SUCCESS)
1040 goto err;
1041 if (out_data)
1042 moal_extflg_set(handle, EXT_PMIC);
1043 else
1044 moal_extflg_clear(handle, EXT_PMIC);
1045 PRINTM(MMSG, "pmic %s\n",
1046 moal_extflg_isset(handle, EXT_PMIC) ? "on" :
1047 "off");
1048 } else if (strncmp(line, "antcfg", strlen("antcfg")) == 0) {
1049 if (parse_line_read_int(line, &out_data) !=
1050 MLAN_STATUS_SUCCESS)
1051 goto err;
1052 params->antcfg = out_data;
1053 PRINTM(MMSG, "antcfg=%d\n", params->antcfg);
1054 } else if (strncmp(line, "uap_oper_ctrl",
1055 strlen("uap_oper_ctrl")) == 0) {
1056 if (parse_line_read_int(line, &out_data) !=
1057 MLAN_STATUS_SUCCESS)
1058 goto err;
1059 params->uap_oper_ctrl = out_data;
1060 PRINTM(MMSG, "uap_oper_ctrl=%d\n",
1061 params->uap_oper_ctrl);
1062 } else if (strncmp(line, "hs_wake_interval",
1063 strlen("hs_wake_interval")) == 0) {
1064 if (parse_line_read_int(line, &out_data) !=
1065 MLAN_STATUS_SUCCESS)
1066 goto err;
1067 params->hs_wake_interval = out_data;
1068 PRINTM(MMSG, "hs_wake_interval=%d\n",
1069 params->hs_wake_interval);
1070 } else if (strncmp(line, "indication_gpio",
1071 strlen("indication_gpio")) == 0) {
1072 if (parse_line_read_int(line, &out_data) !=
1073 MLAN_STATUS_SUCCESS)
1074 goto err;
1075 params->indication_gpio = out_data;
1076 PRINTM(MMSG, "indication_gpio=%d\n",
1077 params->indication_gpio);
1078 } else if (strncmp(line, "disconnect_on_suspend",
1079 strlen("disconnect_on_suspend")) == 0) {
1080 if (parse_line_read_int(line, &out_data) !=
1081 MLAN_STATUS_SUCCESS)
1082 goto err;
1083 if (out_data)
1084 moal_extflg_set(handle,
1085 EXT_DISCONNECT_ON_SUSPEND);
1086 else
1087 moal_extflg_clear(handle,
1088 EXT_DISCONNECT_ON_SUSPEND);
1089 PRINTM(MMSG, "disconnect_on_suspend %s\n",
1090 moal_extflg_isset(handle,
1091 EXT_DISCONNECT_ON_SUSPEND) ?
1092 "on" :
1093 "off");
1094 } else if (strncmp(line, "hs_mimo_switch",
1095 strlen("hs_mimo_switch")) == 0) {
1096 if (parse_line_read_int(line, &out_data) !=
1097 MLAN_STATUS_SUCCESS)
1098 goto err;
1099 if (out_data)
1100 moal_extflg_set(handle, EXT_HS_MIMO_SWITCH);
1101 else
1102 moal_extflg_clear(handle, EXT_HS_MIMO_SWITCH);
1103 PRINTM(MMSG, "hs_mimo_switch %s\n",
1104 moal_extflg_isset(handle, EXT_HS_MIMO_SWITCH) ?
1105 "on" :
1106 "off");
1107 } else if (strncmp(line, "indrstcfg", strlen("indrstcfg")) ==
1108 0) {
1109 if (parse_line_read_int(line, &out_data) !=
1110 MLAN_STATUS_SUCCESS)
1111 goto err;
1112 params->indrstcfg = out_data;
1113 PRINTM(MMSG, "indrstcfg=%d\n", params->indrstcfg);
1114 } else if (strncmp(line, "fixed_beacon_buffer",
1115 strlen("fixed_beacon_buffer")) == 0) {
1116 if (parse_line_read_int(line, &out_data) !=
1117 MLAN_STATUS_SUCCESS)
1118 goto err;
1119 if (out_data)
1120 moal_extflg_set(handle, EXT_FIX_BCN_BUF);
1121 else
1122 moal_extflg_clear(handle, EXT_FIX_BCN_BUF);
1123 PRINTM(MMSG, "fixed_beacon_buffer %s\n",
1124 moal_extflg_isset(handle, EXT_FIX_BCN_BUF) ?
1125 "on" :
1126 "off");
1127 }
1128 #ifdef WIFI_DIRECT_SUPPORT
1129 else if (strncmp(line, "GoAgeoutTime",
1130 strlen("GoAgeoutTime")) == 0) {
1131 if (parse_line_read_int(line, &out_data) !=
1132 MLAN_STATUS_SUCCESS)
1133 goto err;
1134 params->GoAgeoutTime = out_data;
1135 PRINTM(MMSG, "GoAgeoutTime=%d\n", params->GoAgeoutTime);
1136 }
1137 #endif
1138 else if (strncmp(line, "gtk_rekey_offload",
1139 strlen("gtk_rekey_offload")) == 0) {
1140 if (parse_line_read_int(line, &out_data) !=
1141 MLAN_STATUS_SUCCESS)
1142 goto err;
1143 params->gtk_rekey_offload = out_data;
1144 PRINTM(MMSG, "gtk_rekey_offload=%d\n",
1145 params->gtk_rekey_offload);
1146 } else if (strncmp(line, "multi_dtim", strlen("multi_dtim")) ==
1147 0) {
1148 if (parse_line_read_int(line, &out_data) !=
1149 MLAN_STATUS_SUCCESS)
1150 goto err;
1151 params->multi_dtim = out_data;
1152 PRINTM(MMSG, "multi_dtim=%d\n", params->multi_dtim);
1153 } else if (strncmp(line, "inact_tmo", strlen("inact_tmo")) ==
1154 0) {
1155 if (parse_line_read_int(line, &out_data) !=
1156 MLAN_STATUS_SUCCESS)
1157 goto err;
1158 params->inact_tmo = out_data;
1159 PRINTM(MMSG, "inact_tmo=%d\n", params->inact_tmo);
1160 } else if (strncmp(line, "napi", strlen("napi")) == 0) {
1161 if (parse_line_read_int(line, &out_data) !=
1162 MLAN_STATUS_SUCCESS)
1163 goto err;
1164 if (out_data)
1165 moal_extflg_set(handle, EXT_NAPI);
1166 else
1167 moal_extflg_clear(handle, EXT_NAPI);
1168 PRINTM(MMSG, "napi %s\n",
1169 moal_extflg_isset(handle, EXT_NAPI) ? "on" :
1170 "off");
1171 } else if (strncmp(line, "tx_work", strlen("tx_work")) == 0) {
1172 if (parse_line_read_int(line, &out_data) !=
1173 MLAN_STATUS_SUCCESS)
1174 goto err;
1175 if (out_data)
1176 moal_extflg_set(handle, EXT_TX_WORK);
1177 else
1178 moal_extflg_clear(handle, EXT_TX_WORK);
1179 PRINTM(MMSG, "tx_work %s\n",
1180 moal_extflg_isset(handle, EXT_TX_WORK) ? "on" :
1181 "off");
1182 } else if (strncmp(line, "tx_skb_clone",
1183 strlen("tx_skb_clone")) == 0) {
1184 if (parse_line_read_int(line, &out_data) !=
1185 MLAN_STATUS_SUCCESS)
1186 goto err;
1187 if (out_data)
1188 moal_extflg_set(handle, EXT_TX_SKB_CLONE);
1189 else
1190 moal_extflg_clear(handle, EXT_TX_SKB_CLONE);
1191 PRINTM(MMSG, "tx_skb_clone %s\n",
1192 moal_extflg_isset(handle, EXT_TX_SKB_CLONE) ?
1193 "on" :
1194 "off");
1195 } else if (strncmp(line, "pmqos", strlen("pmqos")) == 0) {
1196 if (parse_line_read_int(line, &out_data) !=
1197 MLAN_STATUS_SUCCESS)
1198 goto err;
1199 if (out_data)
1200 moal_extflg_set(handle, EXT_PMQOS);
1201 else
1202 moal_extflg_clear(handle, EXT_PMQOS);
1203 PRINTM(MMSG, "pmqos %s\n",
1204 moal_extflg_isset(handle, EXT_PMQOS) ? "on" :
1205 "off");
1206 }
1207 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
1208 else if (strncmp(line, "dfs_offload", strlen("dfs_offload")) ==
1209 0) {
1210 if (parse_line_read_int(line, &out_data) !=
1211 MLAN_STATUS_SUCCESS)
1212 goto err;
1213 if (out_data)
1214 moal_extflg_set(handle, EXT_DFS_OFFLOAD);
1215 else
1216 moal_extflg_clear(handle, EXT_DFS_OFFLOAD);
1217 PRINTM(MMSG, "dfs_offload %s\n",
1218 moal_extflg_isset(handle, EXT_DFS_OFFLOAD) ?
1219 "on" :
1220 "off");
1221 }
1222 #endif
1223 else if (strncmp(line, "roamoffload_in_hs",
1224 strlen("roamoffload_in_hs")) == 0) {
1225 if (parse_line_read_int(line, &out_data) !=
1226 MLAN_STATUS_SUCCESS)
1227 goto err;
1228 if (out_data)
1229 moal_extflg_set(handle, EXT_ROAMOFFLOAD_IN_HS);
1230 else
1231 moal_extflg_clear(handle,
1232 EXT_ROAMOFFLOAD_IN_HS);
1233 PRINTM(MMSG, "roamoffload_in_hs %s\n",
1234 moal_extflg_isset(handle,
1235 EXT_ROAMOFFLOAD_IN_HS) ?
1236 "on" :
1237 "off");
1238 }
1239 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
1240 else if (strncmp(line, "disable_regd_by_driver",
1241 strlen("disable_regd_by_driver")) == 0) {
1242 if (parse_line_read_int(line, &out_data) !=
1243 MLAN_STATUS_SUCCESS)
1244 goto err;
1245 if (out_data)
1246 moal_extflg_set(handle,
1247 EXT_DISABLE_REGD_BY_DRIVER);
1248 else
1249 moal_extflg_clear(handle,
1250 EXT_DISABLE_REGD_BY_DRIVER);
1251 PRINTM(MMSG, "reg domain set by driver=%s\n",
1252 moal_extflg_isset(handle,
1253 EXT_DISABLE_REGD_BY_DRIVER) ?
1254 "enable" :
1255 "disable");
1256 } else if (strncmp(line, "reg_alpha2", strlen("reg_alpha2")) ==
1257 0) {
1258 if (parse_line_read_string(line, &out_str) !=
1259 MLAN_STATUS_SUCCESS)
1260 goto err;
1261 woal_dup_string(¶ms->reg_alpha2, out_str);
1262 PRINTM(MMSG, "reg_alpha2=%s\n", params->reg_alpha2);
1263 }
1264 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
1265 else if (strncmp(line, "country_ie_ignore",
1266 strlen("country_ie_ignore")) == 0) {
1267 if (parse_line_read_int(line, &out_data) !=
1268 MLAN_STATUS_SUCCESS)
1269 goto err;
1270 if (out_data)
1271 moal_extflg_set(handle, EXT_COUNTRY_IE_IGNORE);
1272 else
1273 moal_extflg_clear(handle,
1274 EXT_COUNTRY_IE_IGNORE);
1275 PRINTM(MMSG, "country_ie_ignore=%s\n",
1276 moal_extflg_isset(handle,
1277 EXT_COUNTRY_IE_IGNORE) ?
1278 "on" :
1279 "off");
1280 } else if (strncmp(line, "beacon_hints",
1281 strlen("beacon_hints")) == 0) {
1282 if (parse_line_read_int(line, &out_data) !=
1283 MLAN_STATUS_SUCCESS)
1284 goto err;
1285 if (out_data)
1286 moal_extflg_set(handle, EXT_BEACON_HINTS);
1287 else
1288 moal_extflg_clear(handle, EXT_BEACON_HINTS);
1289 PRINTM(MMSG, "beacon_hints=%s\n",
1290 moal_extflg_isset(handle, EXT_BEACON_HINTS) ?
1291 "enable" :
1292 "disable");
1293 }
1294 #endif
1295 #endif
1296 #ifdef UAP_SUPPORT
1297 else if (strncmp(line, "uap_max_sta", strlen("uap_max_sta")) ==
1298 0) {
1299 if (parse_line_read_int(line, &out_data) !=
1300 MLAN_STATUS_SUCCESS)
1301 goto err;
1302 params->uap_max_sta = out_data;
1303 PRINTM(MMSG, "uap_max_sta=%d\n", params->uap_max_sta);
1304 } else if (strncmp(line, "wacp_mode", strlen("wacp_mode")) ==
1305 0) {
1306 if (parse_line_read_int(line, &out_data) !=
1307 MLAN_STATUS_SUCCESS)
1308 goto err;
1309 params->wacp_mode = out_data;
1310 PRINTM(MMSG, "wacp_moe=%d\n", params->wacp_mode);
1311 }
1312 #endif
1313 else if (strncmp(line, "mcs32", strlen("mcs32")) == 0) {
1314 if (parse_line_read_int(line, &out_data) !=
1315 MLAN_STATUS_SUCCESS)
1316 goto err;
1317 params->mcs32 = out_data;
1318 PRINTM(MMSG, "mcs32=%d\n", params->mcs32);
1319 }
1320 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
1321 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
1322 else if (strncmp(line, "host_mlme", strlen("host_mlme")) == 0) {
1323 if (parse_line_read_int(line, &out_data) !=
1324 MLAN_STATUS_SUCCESS)
1325 goto err;
1326 if (out_data)
1327 moal_extflg_set(handle, EXT_HOST_MLME);
1328 else
1329 moal_extflg_clear(handle, EXT_HOST_MLME);
1330 PRINTM(MMSG, "host_mlme=%s\n",
1331 moal_extflg_isset(handle, EXT_HOST_MLME) ?
1332 "enable" :
1333 "disable");
1334 }
1335 #endif
1336 #endif
1337 else if (strncmp(line, "dfs53cfg", strlen("dfs53cfg")) == 0) {
1338 if (parse_line_read_int(line, &out_data) !=
1339 MLAN_STATUS_SUCCESS)
1340 goto err;
1341 params->dfs53cfg = out_data;
1342 PRINTM(MMSG, "dfs53cfg= %d\n", params->dfs53cfg);
1343 } else if (strncmp(line, "chan_track", strlen("chan_track")) ==
1344 0) {
1345 if (parse_line_read_int(line, &out_data) !=
1346 MLAN_STATUS_SUCCESS)
1347 goto err;
1348 if (out_data)
1349 moal_extflg_set(handle, EXT_CHAN_TRACK);
1350
1351 PRINTM(MMSG, "chan_track= %s\n",
1352 moal_extflg_isset(handle, EXT_PMQOS) ? "on" :
1353 "off");
1354 } else if (strncmp(line, "keep_previous_scan",
1355 strlen("keep_previous_scan")) == 0) {
1356 if (parse_line_read_int(line, &out_data) !=
1357 MLAN_STATUS_SUCCESS)
1358 goto err;
1359 params->keep_previous_scan = out_data;
1360 PRINTM(MMSG, "keep_previous_scan=%d\n",
1361 params->keep_previous_scan);
1362 }
1363 }
1364 if (end)
1365 return ret;
1366 err:
1367 PRINTM(MMSG, "Invalid line: %s\n", line);
1368 ret = MLAN_STATUS_FAILURE;
1369 return ret;
1370 }
1371
1372 /**
1373 * @brief This function initialize module parameter
1374 *
1375 * @param handle A pointer to moal_handle structure
1376 * @param params A pointer to moal_mod_para structure
1377 *
1378 * @return N/A
1379 */
woal_setup_module_param(moal_handle * handle,moal_mod_para * params)1380 static void woal_setup_module_param(moal_handle *handle, moal_mod_para *params)
1381 {
1382 if (hw_test)
1383 moal_extflg_set(handle, EXT_HW_TEST);
1384 #ifdef CONFIG_OF
1385 if (dts_enable)
1386 moal_extflg_set(handle, EXT_DTS_ENABLE);
1387 #endif
1388 woal_dup_string(&handle->params.fw_name, fw_name);
1389 if (params && params->fw_name)
1390 woal_dup_string(&handle->params.fw_name, params->fw_name);
1391 if (req_fw_nowait)
1392 moal_extflg_set(handle, EXT_REQ_FW_NOWAIT);
1393 handle->params.fw_reload = fw_reload;
1394 if (fw_reload == FW_RELOAD_WITH_EMULATION) {
1395 if (!IS_USB(handle->card_type))
1396 handle->params.fw_reload = 0;
1397 else
1398 fw_reload = 0;
1399 }
1400 if (params)
1401 handle->params.fw_reload = params->fw_reload;
1402
1403 handle->params.auto_fw_reload = auto_fw_reload;
1404 if (params)
1405 handle->params.auto_fw_reload = params->auto_fw_reload;
1406 if (fw_serial)
1407 moal_extflg_set(handle, EXT_FW_SERIAL);
1408 woal_dup_string(&handle->params.hw_name, hw_name);
1409 if (params && params->hw_name)
1410 woal_dup_string(&handle->params.hw_name, params->hw_name);
1411
1412 woal_dup_string(&handle->params.mac_addr, mac_addr);
1413 if (params && params->mac_addr)
1414 woal_dup_string(&handle->params.mac_addr, params->mac_addr);
1415 #ifdef MFG_CMD_SUPPORT
1416 handle->params.mfg_mode = mfg_mode;
1417 if (params)
1418 handle->params.mfg_mode = params->mfg_mode;
1419 #endif
1420 handle->params.drv_mode = drv_mode;
1421 if (params)
1422 handle->params.drv_mode = params->drv_mode;
1423 #ifdef DEBUG_LEVEL1
1424 handle->params.drvdbg = drvdbg;
1425 if (params)
1426 handle->params.drvdbg = params->drvdbg;
1427 #endif
1428
1429 #ifdef STA_SUPPORT
1430 handle->params.max_sta_bss = max_sta_bss;
1431 woal_dup_string(&handle->params.sta_name, sta_name);
1432 if (params) {
1433 handle->params.max_sta_bss = params->max_sta_bss;
1434 woal_dup_string(&handle->params.sta_name, params->sta_name);
1435 }
1436 #endif /* STA_SUPPORT */
1437 #ifdef UAP_SUPPORT
1438 handle->params.max_uap_bss = max_uap_bss;
1439 woal_dup_string(&handle->params.uap_name, uap_name);
1440 handle->params.uap_max_sta = uap_max_sta;
1441 handle->params.wacp_mode = wacp_mode;
1442 handle->params.mcs32 = mcs32;
1443 if (params) {
1444 handle->params.max_uap_bss = params->max_uap_bss;
1445 woal_dup_string(&handle->params.uap_name, params->uap_name);
1446 handle->params.uap_max_sta = params->uap_max_sta;
1447 handle->params.wacp_mode = params->wacp_mode;
1448 handle->params.mcs32 = params->mcs32;
1449 }
1450 #endif /* UAP_SUPPORT */
1451 #ifdef WIFI_DIRECT_SUPPORT
1452 handle->params.max_wfd_bss = max_wfd_bss;
1453 woal_dup_string(&handle->params.wfd_name, wfd_name);
1454 if (params) {
1455 handle->params.max_wfd_bss = params->max_wfd_bss;
1456 woal_dup_string(&handle->params.wfd_name, params->wfd_name);
1457 }
1458 #if defined(STA_CFG80211) && defined(UAP_CFG80211)
1459 handle->params.max_vir_bss = max_vir_bss;
1460 if (params)
1461 handle->params.max_vir_bss = params->max_vir_bss;
1462 #endif
1463 #endif /* WIFI_DIRECT_SUPPORT */
1464 handle->params.auto_ds = auto_ds;
1465 if (params)
1466 handle->params.auto_ds = params->auto_ds;
1467 handle->params.net_rx = net_rx;
1468 if (params)
1469 handle->params.net_rx = params->net_rx;
1470
1471 handle->params.amsdu_deaggr = amsdu_deaggr;
1472 if (params)
1473 handle->params.amsdu_deaggr = params->amsdu_deaggr;
1474
1475 handle->params.ext_scan = ext_scan;
1476 if (params)
1477 handle->params.ext_scan = params->ext_scan;
1478
1479 handle->params.ps_mode = ps_mode;
1480 handle->params.p2a_scan = p2a_scan;
1481 handle->params.scan_chan_gap = scan_chan_gap;
1482 handle->params.sched_scan = sched_scan;
1483 handle->params.max_tx_buf = max_tx_buf;
1484 if (params) {
1485 handle->params.ps_mode = params->ps_mode;
1486 handle->params.max_tx_buf = params->max_tx_buf;
1487 handle->params.p2a_scan = params->p2a_scan;
1488 handle->params.scan_chan_gap = params->scan_chan_gap;
1489 handle->params.sched_scan = params->sched_scan;
1490 }
1491 #if defined(SDIO)
1492 if (intmode)
1493 moal_extflg_set(handle, EXT_INTMODE);
1494 handle->params.gpiopin = gpiopin;
1495 if (params)
1496 handle->params.gpiopin = params->gpiopin;
1497 #endif
1498 if (pm_keep_power)
1499 moal_extflg_set(handle, EXT_PM_KEEP_POWER);
1500 #if defined(SDIO) && defined(SDIO_SUSPEND_RESUME)
1501 if (shutdown_hs)
1502 moal_extflg_set(handle, EXT_SHUTDOWN_HS);
1503 #endif
1504 #if defined(STA_SUPPORT)
1505 handle->params.cfg_11d = cfg_11d;
1506 if (params)
1507 handle->params.cfg_11d = params->cfg_11d;
1508 #endif
1509 #if defined(SDIO)
1510 handle->params.slew_rate = slew_rate;
1511 if (params)
1512 handle->params.slew_rate = params->slew_rate;
1513 #endif
1514 woal_dup_string(&handle->params.dpd_data_cfg, dpd_data_cfg);
1515 if (params)
1516 woal_dup_string(&handle->params.dpd_data_cfg,
1517 params->dpd_data_cfg);
1518 woal_dup_string(&handle->params.init_cfg, init_cfg);
1519 woal_dup_string(&handle->params.cal_data_cfg, cal_data_cfg);
1520 if (params) {
1521 woal_dup_string(&handle->params.init_cfg, params->init_cfg);
1522 woal_dup_string(&handle->params.cal_data_cfg,
1523 params->cal_data_cfg);
1524 }
1525 woal_dup_string(&handle->params.txpwrlimit_cfg, txpwrlimit_cfg);
1526 if (params)
1527 woal_dup_string(&handle->params.txpwrlimit_cfg,
1528 params->txpwrlimit_cfg);
1529 handle->params.cntry_txpwr = cntry_txpwr;
1530 if (params)
1531 handle->params.cntry_txpwr = params->cntry_txpwr;
1532 woal_dup_string(&handle->params.init_hostcmd_cfg, init_hostcmd_cfg);
1533 if (params)
1534 woal_dup_string(&handle->params.init_hostcmd_cfg,
1535 params->init_hostcmd_cfg);
1536
1537 woal_dup_string(&handle->params.band_steer_cfg, band_steer_cfg);
1538 if (params)
1539 woal_dup_string(&handle->params.band_steer_cfg,
1540 params->band_steer_cfg);
1541 handle->params.cfg80211_wext = cfg80211_wext;
1542 if (params)
1543 handle->params.cfg80211_wext = params->cfg80211_wext;
1544 #if defined(USB)
1545 if (skip_fwdnld)
1546 moal_extflg_set(handle, EXT_SKIP_FWDNLD);
1547 #endif
1548 handle->params.wq_sched_prio = wq_sched_prio;
1549 handle->params.wq_sched_policy = wq_sched_policy;
1550 handle->params.rx_work = rx_work;
1551 if (params) {
1552 handle->params.wq_sched_prio = params->wq_sched_prio;
1553 handle->params.wq_sched_policy = params->wq_sched_policy;
1554 handle->params.rx_work = params->rx_work;
1555 }
1556 if (aggrctrl)
1557 moal_extflg_set(handle, EXT_AGGR_CTRL);
1558 #ifdef USB
1559 handle->params.usb_aggr = usb_aggr;
1560 if (params)
1561 handle->params.usb_aggr = params->usb_aggr;
1562 #endif
1563 #ifdef PCIE
1564 handle->params.pcie_int_mode = pcie_int_mode;
1565 if (params)
1566 handle->params.pcie_int_mode = params->pcie_int_mode;
1567 handle->params.ring_size = ring_size;
1568 if (params)
1569 handle->params.ring_size = params->ring_size;
1570 #endif /* PCIE */
1571 if (low_power_mode_enable)
1572 moal_extflg_set(handle, EXT_LOW_PW_MODE);
1573
1574 #ifdef ANDROID_KERNEL
1575 handle->params.wakelock_timeout = wakelock_timeout;
1576 if (params)
1577 handle->params.wakelock_timeout = params->wakelock_timeout;
1578 #endif
1579 handle->params.dev_cap_mask = dev_cap_mask;
1580 if (params)
1581 handle->params.dev_cap_mask = params->dev_cap_mask;
1582 #ifdef SDIO
1583 if (sdio_rx_aggr)
1584 moal_extflg_set(handle, EXT_SDIO_RX_AGGR);
1585 #endif
1586 if (pmic)
1587 moal_extflg_set(handle, EXT_PMIC);
1588 handle->params.antcfg = antcfg;
1589 if (params)
1590 handle->params.antcfg = params->antcfg;
1591 handle->params.uap_oper_ctrl = uap_oper_ctrl;
1592 if (params)
1593 handle->params.uap_oper_ctrl = params->uap_oper_ctrl;
1594 handle->params.hs_wake_interval = hs_wake_interval;
1595 handle->params.indication_gpio = indication_gpio;
1596 if (params) {
1597 handle->params.hs_wake_interval = params->hs_wake_interval;
1598 handle->params.indication_gpio = params->indication_gpio;
1599 }
1600 if (disconnect_on_suspend)
1601 moal_extflg_set(handle, EXT_DISCONNECT_ON_SUSPEND);
1602 if (hs_mimo_switch)
1603 moal_extflg_set(handle, EXT_HS_MIMO_SWITCH);
1604 handle->params.indrstcfg = indrstcfg;
1605 if (params)
1606 handle->params.indrstcfg = params->indrstcfg;
1607 if (fixed_beacon_buffer)
1608 moal_extflg_set(handle, EXT_FIX_BCN_BUF);
1609 #ifdef WIFI_DIRECT_SUPPORT
1610 handle->params.GoAgeoutTime = GoAgeoutTime;
1611 if (params)
1612 handle->params.GoAgeoutTime = params->GoAgeoutTime;
1613 #endif
1614 handle->params.gtk_rekey_offload = gtk_rekey_offload;
1615 if (params)
1616 handle->params.gtk_rekey_offload = params->gtk_rekey_offload;
1617 handle->params.multi_dtim = multi_dtim;
1618 handle->params.inact_tmo = inact_tmo;
1619 if (params) {
1620 handle->params.multi_dtim = params->multi_dtim;
1621 handle->params.inact_tmo = params->inact_tmo;
1622 }
1623 if (napi)
1624 moal_extflg_set(handle, EXT_NAPI);
1625 if (tx_work)
1626 moal_extflg_set(handle, EXT_TX_WORK);
1627
1628 if (tx_skb_clone)
1629 moal_extflg_set(handle, EXT_TX_SKB_CLONE);
1630 if (pmqos)
1631 moal_extflg_set(handle, EXT_PMQOS);
1632
1633 if (chan_track)
1634 moal_extflg_set(handle, EXT_CHAN_TRACK);
1635
1636 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
1637 if (dfs_offload)
1638 moal_extflg_set(handle, EXT_DFS_OFFLOAD);
1639 #endif
1640 if (roamoffload_in_hs)
1641 moal_extflg_set(handle, EXT_ROAMOFFLOAD_IN_HS);
1642 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
1643 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
1644 if (host_mlme)
1645 moal_extflg_set(handle, EXT_HOST_MLME);
1646 #endif
1647 #endif
1648 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
1649 if (disable_regd_by_driver)
1650 moal_extflg_set(handle, EXT_DISABLE_REGD_BY_DRIVER);
1651 if (reg_alpha2)
1652 woal_dup_string(&handle->params.reg_alpha2, reg_alpha2);
1653 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
1654 if (country_ie_ignore)
1655 moal_extflg_set(handle, EXT_COUNTRY_IE_IGNORE);
1656 if (beacon_hints)
1657 moal_extflg_set(handle, EXT_BEACON_HINTS);
1658 #endif
1659 #endif
1660 if (params && params->reg_alpha2)
1661 woal_dup_string(&handle->params.reg_alpha2, params->reg_alpha2);
1662 if (params)
1663 moal_memcpy_ext(handle, handle->params.ext_flgs,
1664 params->ext_flgs, sizeof(params->ext_flgs),
1665 sizeof(handle->params.ext_flgs));
1666
1667 /* do some special handle for MFG mode */
1668 #ifdef MFG_CMD_SUPPORT
1669 if (handle->params.mfg_mode) {
1670 #if defined(STA_WEXT) || defined(UAP_WEXT)
1671 handle->params.cfg80211_wext = STA_WEXT_MASK | UAP_WEXT_MASK;
1672 #else
1673 handle->params.cfg80211_wext = 0;
1674 #endif
1675 handle->params.drv_mode = DRV_MODE_STA;
1676 }
1677 #endif
1678 if (dfs53cfg > DFS_W53_OLD) {
1679 PRINTM(MERROR, "Invalid value for dfs53cfg !\n");
1680 handle->params.dfs53cfg = DFS_W53_DEFAULT_FW;
1681 } else {
1682 handle->params.dfs53cfg = dfs53cfg;
1683 if (params)
1684 handle->params.dfs53cfg = params->dfs53cfg;
1685 }
1686 handle->params.keep_previous_scan = keep_previous_scan;
1687 }
1688
1689 /**
1690 * @brief This function free module parameter memory
1691 *
1692 * @param handle A pointer to moal_handle structure
1693 *
1694 * @return N/A
1695 */
woal_free_module_param(moal_handle * handle)1696 void woal_free_module_param(moal_handle *handle)
1697 {
1698 moal_mod_para *params = &handle->params;
1699 PRINTM(MMSG, "Free module params\n");
1700 if (params->fw_name) {
1701 kfree(params->fw_name);
1702 params->fw_name = NULL;
1703 }
1704 if (params->hw_name) {
1705 kfree(params->hw_name);
1706 params->hw_name = NULL;
1707 }
1708
1709 if (params->mac_addr) {
1710 kfree(params->mac_addr);
1711 params->mac_addr = NULL;
1712 }
1713 #ifdef STA_SUPPORT
1714 if (params->sta_name) {
1715 kfree(params->sta_name);
1716 params->sta_name = NULL;
1717 }
1718 #endif /* STA_SUPPORT */
1719 #ifdef UAP_SUPPORT
1720 if (params->uap_name) {
1721 kfree(params->uap_name);
1722 params->uap_name = NULL;
1723 }
1724 #endif /* UAP_SUPPORT */
1725 #ifdef WIFI_DIRECT_SUPPORT
1726 if (params->wfd_name) {
1727 kfree(params->wfd_name);
1728 params->wfd_name = NULL;
1729 }
1730 #endif /* WIFI_DIRECT_SUPPORT */
1731 if (params->dpd_data_cfg) {
1732 kfree(params->dpd_data_cfg);
1733 params->dpd_data_cfg = NULL;
1734 }
1735 if (params->init_cfg) {
1736 kfree(params->init_cfg);
1737 params->init_cfg = NULL;
1738 }
1739 if (params->cal_data_cfg) {
1740 kfree(params->cal_data_cfg);
1741 params->cal_data_cfg = NULL;
1742 }
1743 if (params->txpwrlimit_cfg) {
1744 kfree(params->txpwrlimit_cfg);
1745 params->txpwrlimit_cfg = NULL;
1746 }
1747 if (params->init_hostcmd_cfg) {
1748 kfree(params->init_hostcmd_cfg);
1749 params->init_hostcmd_cfg = NULL;
1750 }
1751 if (params->band_steer_cfg) {
1752 kfree(params->band_steer_cfg);
1753 params->band_steer_cfg = NULL;
1754 }
1755 if (params->reg_alpha2) {
1756 kfree(params->reg_alpha2);
1757 params->reg_alpha2 = NULL;
1758 }
1759 }
1760
1761 /**
1762 * @brief This function request module parameter data from user space
1763 *
1764 * @param handle A pointer to moal_handle structure
1765 * @param mod_file A pointer to module parameter file path
1766 *
1767 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
1768 */
woal_req_mod_param(moal_handle * handle,char * mod_file)1769 static mlan_status woal_req_mod_param(moal_handle *handle, char *mod_file)
1770 {
1771 mlan_status ret = MLAN_STATUS_SUCCESS;
1772 struct device *dev = handle->hotplug_device;
1773
1774 if (dev == NULL) {
1775 PRINTM(MERROR, "No device attached\n");
1776 ret = MLAN_STATUS_FAILURE;
1777 goto out;
1778 }
1779
1780 ret = request_firmware(&handle->param_data, mod_file, dev);
1781 if (ret < 0)
1782 PRINTM(MERROR, "Request firmware: %s failed, error: %d\n",
1783 mod_file, ret);
1784 out:
1785 return ret;
1786 }
1787
1788 #ifdef CONFIG_OF
1789 /**
1790 * @brief This function read the initial parameter from device tress
1791 *
1792 * @param handle A pointer to moal_handle structure
1793 *
1794 * @return N/A
1795 */
woal_init_from_dev_tree(void)1796 void woal_init_from_dev_tree(void)
1797 {
1798 struct device_node *dt_node = NULL;
1799 struct property *prop;
1800 t_u32 data;
1801 const char *string_data;
1802
1803 ENTER();
1804
1805 if (!dts_enable) {
1806 PRINTM(MIOCTL, "DTS is disabled!");
1807 return;
1808 }
1809
1810 dt_node = of_find_node_by_name(NULL, "sdxxx-wlan");
1811 if (!dt_node) {
1812 LEAVE();
1813 return;
1814 }
1815 for_each_property_of_node (dt_node, prop) {
1816 if (!strncmp(prop->name, "drv_mode", strlen("drv_mode"))) {
1817 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1818 PRINTM(MIOCTL, "drv_mode=0x%x\n", data);
1819 drv_mode = data;
1820 }
1821 }
1822 #ifdef DEBUG_LEVEL1
1823 else if (!strncmp(prop->name, "drvdbg", strlen("drvdbg"))) {
1824 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1825 PRINTM(MIOCTL, "drvdbg=0x%x\n", data);
1826 drvdbg = data;
1827 }
1828 }
1829 #endif
1830 else if (!strncmp(prop->name, "dev_cap_mask",
1831 strlen("dev_cap_mask"))) {
1832 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1833 PRINTM(MIOCTL, "dev_cap_mask=0x%x\n", data);
1834 dev_cap_mask = data;
1835 }
1836 } else if (!strncmp(prop->name, "hw_test", strlen("hw_test"))) {
1837 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1838 PRINTM(MIOCTL, "hw_test=0x%x\n", data);
1839 hw_test = data;
1840 }
1841 }
1842 #if defined(SDIO)
1843 else if (!strncmp(prop->name, "slew_rate",
1844 strlen("slew_rate"))) {
1845 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1846 PRINTM(MIOCTL, "slew_rate=0x%x\n", data);
1847 slew_rate = data;
1848 }
1849 }
1850 #endif
1851 else if (!strncmp(prop->name, "tx_work", strlen("tx_work"))) {
1852 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1853 PRINTM(MIOCTL, "tx_work=0x%x\n", data);
1854 tx_work = data;
1855 }
1856 } else if (!strncmp(prop->name, "tx_skb_clone",
1857 strlen("tx_skb_clone"))) {
1858 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1859 PRINTM(MIOCTL, "tx_skb_clone=0x%x\n", data);
1860 tx_skb_clone = data;
1861 }
1862 } else if (!strncmp(prop->name, "pmqos", strlen("pmqos"))) {
1863 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1864 PRINTM(MIOCTL, "pmqos=0x%x\n", data);
1865 pmqos = data;
1866 }
1867 } else if (!strncmp(prop->name, "mcs32", strlen("mcs32"))) {
1868 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1869 PRINTM(MIOCTL, "mcs32=0x%x\n", data);
1870 mcs32 = data;
1871 }
1872 }
1873 #ifdef MFG_CMD_SUPPORT
1874 else if (!strncmp(prop->name, "mfg_mode", strlen("mfg_mode"))) {
1875 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1876 PRINTM(MIOCTL, "mfg_mode=0x%x\n", data);
1877 mfg_mode = data;
1878 }
1879 }
1880 #endif
1881 else if (!strncmp(prop->name, "mac_addr", strlen("mac_addr"))) {
1882 if (!of_property_read_string(dt_node, prop->name,
1883 &string_data)) {
1884 mac_addr = (char *)string_data;
1885 PRINTM(MIOCTL, "mac_addr=%s\n", mac_addr);
1886 }
1887 } else if (!strncmp(prop->name, "fw_name", strlen("fw_name"))) {
1888 if (!of_property_read_string(dt_node, prop->name,
1889 &string_data)) {
1890 fw_name = (char *)string_data;
1891 PRINTM(MIOCTL, "fw_name=%s\n", fw_name);
1892 }
1893 } else if (!strncmp(prop->name, "hw_name", strlen("hw_name"))) {
1894 if (!of_property_read_string(dt_node, prop->name,
1895 &string_data)) {
1896 hw_name = (char *)string_data;
1897 PRINTM(MIOCTL, "hw_name=%s\n", hw_name);
1898 }
1899 }
1900 #if defined(STA_WEXT) || defined(UAP_WEXT)
1901 else if (!strncmp(prop->name, "cfg80211_wext",
1902 strlen("cfg80211_wext"))) {
1903 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1904 PRINTM(MIOCTL, "cfg80211_wext=0x%x\n", data);
1905 cfg80211_wext = data;
1906 }
1907 }
1908 #endif
1909 #ifdef STA_SUPPORT
1910 else if (!strncmp(prop->name, "sta_name", strlen("sta_name"))) {
1911 if (!of_property_read_string(dt_node, prop->name,
1912 &string_data)) {
1913 sta_name = (char *)string_data;
1914 PRINTM(MIOCTL, "sta_name=%s\n", sta_name);
1915 }
1916 }
1917 #endif
1918 #ifdef WIFI_DIRECT_SUPPORT
1919 else if (!strncmp(prop->name, "wfd_name", strlen("wfd_name"))) {
1920 if (!of_property_read_string(dt_node, prop->name,
1921 &string_data)) {
1922 wfd_name = (char *)string_data;
1923 PRINTM(MIOCTL, "wfd_name=%s\n", wfd_name);
1924 }
1925 }
1926 #endif
1927 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
1928 else if (!strncmp(prop->name, "disable_regd_by_driver",
1929 strlen("disable_regd_by_driver"))) {
1930 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1931 PRINTM(MIOCTL, "disable_regd_by_driver=0x%x\n",
1932 data);
1933 disable_regd_by_driver = data;
1934 }
1935 } else if (!strncmp(prop->name, "reg_alpha2",
1936 strlen("reg_alpha2"))) {
1937 if (!of_property_read_string(dt_node, prop->name,
1938 &string_data)) {
1939 reg_alpha2 = (char *)string_data;
1940 PRINTM(MIOCTL, "reg_alpha2=%s\n", reg_alpha2);
1941 }
1942 }
1943 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
1944 else if (!strncmp(prop->name, "country_ie_ignore",
1945 strlen("country_ie_ignore"))) {
1946 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1947 PRINTM(MIOCTL, "country_ie_ignore=0x%x\n",
1948 data);
1949 country_ie_ignore = data;
1950 }
1951 } else if (!strncmp(prop->name, "beacon_hints",
1952 strlen("beacon_hints"))) {
1953 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1954 PRINTM(MIOCTL, "beacon_hints=0x%x\n", data);
1955 beacon_hints = data;
1956 }
1957 }
1958 #endif
1959 #endif
1960 #ifdef WIFI_DIRECT_SUPPORT
1961 #if defined(STA_CFG80211) && defined(UAP_CFG80211)
1962 else if (!strncmp(prop->name, "max_vir_bss",
1963 strlen("max_vir_bss"))) {
1964 if (!of_property_read_u32(dt_node, prop->name, &data)) {
1965 PRINTM(MIOCTL, "max_vir_bss=0x%x\n", data);
1966 max_vir_bss = data;
1967 }
1968 }
1969 #endif
1970 #endif
1971 else if (!strncmp(prop->name, "dpd_data_cfg",
1972 strlen("dpd_data_cfg"))) {
1973 if (!of_property_read_string(dt_node, prop->name,
1974 &string_data)) {
1975 dpd_data_cfg = (char *)string_data;
1976 PRINTM(MIOCTL, "dpd_data_cfg=%s\n",
1977 dpd_data_cfg);
1978 }
1979 } else if (!strncmp(prop->name, "init_cfg",
1980 strlen("init_cfg"))) {
1981 if (!of_property_read_string(dt_node, prop->name,
1982 &string_data)) {
1983 init_cfg = (char *)string_data;
1984 PRINTM(MIOCTL, "init_cfg=%s\n", init_cfg);
1985 }
1986 } else if (!strncmp(prop->name, "cal_data_cfg",
1987 strlen("cal_data_cfg"))) {
1988 if (!of_property_read_string(dt_node, prop->name,
1989 &string_data)) {
1990 cal_data_cfg = (char *)string_data;
1991 PRINTM(MIOCTL, "cal_data_cfg=%s\n",
1992 cal_data_cfg);
1993 }
1994 } else if (!strncmp(prop->name, "txpwrlimit_cfg",
1995 strlen("txpwrlimit_cfg"))) {
1996 if (!of_property_read_string(dt_node, prop->name,
1997 &string_data)) {
1998 txpwrlimit_cfg = (char *)string_data;
1999 PRINTM(MIOCTL, "txpwrlimit_cfg=%s\n",
2000 txpwrlimit_cfg);
2001 }
2002 } else if (!strncmp(prop->name, "cntry_txpwr",
2003 strlen("cntry_txpwr"))) {
2004 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2005 cntry_txpwr = data;
2006 PRINTM(MIOCTL, "cntry_txpwr=%d\n", cntry_txpwr);
2007 }
2008 } else if (!strncmp(prop->name, "init_hostcmd_cfg",
2009 strlen("init_hostcmd_cfg"))) {
2010 if (!of_property_read_string(dt_node, prop->name,
2011 &string_data)) {
2012 init_hostcmd_cfg = (char *)string_data;
2013 PRINTM(MIOCTL, "init_hostcmd_cfg=%s\n",
2014 init_hostcmd_cfg);
2015 }
2016 } else if (!strncmp(prop->name, "band_steer_cfg",
2017 strlen("band_steer_cfg"))) {
2018 if (!of_property_read_string(dt_node, prop->name,
2019 &string_data)) {
2020 band_steer_cfg = (char *)string_data;
2021 PRINTM(MIOCTL, "band_steer_cfg=%s\n",
2022 band_steer_cfg);
2023 }
2024 } else if (!strncmp(prop->name, "pmic", strlen("pmic"))) {
2025 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2026 pmic = data;
2027 PRINTM(MIOCTL, "pmic=%d\n", pmic);
2028 }
2029 } else if (!strncmp(prop->name, "antcfg", strlen("antcfg"))) {
2030 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2031 antcfg = data;
2032 PRINTM(MIOCTL, "antcfg=%d\n", antcfg);
2033 }
2034 } else if (!strncmp(prop->name, "hs_wake_interval",
2035 strlen("hs_wake_interval"))) {
2036 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2037 hs_wake_interval = data;
2038 PRINTM(MIOCTL, "hs_wake_interval=%d\n",
2039 hs_wake_interval);
2040 }
2041 } else if (!strncmp(prop->name, "indication_gpio",
2042 strlen("indication_gpio"))) {
2043 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2044 indication_gpio = (t_u8)data;
2045 PRINTM(MIOCTL, "indication_gpio=%d\n",
2046 indication_gpio);
2047 }
2048 } else if (!strncmp(prop->name, "hs_mimo_switch",
2049 strlen("hs_mimo_switch"))) {
2050 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2051 hs_mimo_switch = data;
2052 PRINTM(MIOCTL, "hs_mimo_switch=%d\n",
2053 hs_mimo_switch);
2054 }
2055 }
2056 #ifdef WIFI_DIRECT_SUPPORT
2057 else if (!strncmp(prop->name, "GoAgeoutTime",
2058 strlen("GoAgeoutTime"))) {
2059 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2060 GoAgeoutTime = data;
2061 PRINTM(MIOCTL, "GoAgeoutTime=%d\n",
2062 GoAgeoutTime);
2063 }
2064 }
2065 #endif
2066 else if (!strncmp(prop->name, "indrstcfg",
2067 strlen("indrstcfg"))) {
2068 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2069 indrstcfg = data;
2070 PRINTM(MIOCTL, "indrstcfg=%d\n", indrstcfg);
2071 }
2072 } else if (!strncmp(prop->name, "fixed_beacon_buffer",
2073 strlen("fixed_beacon_buffer"))) {
2074 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2075 fixed_beacon_buffer = data;
2076 PRINTM(MIOCTL, "fixed_beacon_buffer=%d\n",
2077 fixed_beacon_buffer);
2078 }
2079 } else if (!strncmp(prop->name, "multi_dtim",
2080 strlen("multi_dtim"))) {
2081 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2082 multi_dtim = data;
2083 PRINTM(MIOCTL, "multi_dtim=%d\n", multi_dtim);
2084 }
2085 } else if (!strncmp(prop->name, "inact_tmo",
2086 strlen("inact_tmo"))) {
2087 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2088 inact_tmo = data;
2089 PRINTM(MIOCTL, "inact_tmo=%d\n", inact_tmo);
2090 }
2091 }
2092 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
2093 else if (!strncmp(prop->name, "dfs_offload",
2094 strlen("dfs_offload"))) {
2095 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2096 dfs_offload = data;
2097 PRINTM(MIOCTL, "dfs_offload=%d\n", dfs_offload);
2098 }
2099 }
2100 #endif
2101 else if (!strncmp(prop->name, "roamoffload_in_hs",
2102 strlen("roamoffload_in_hs"))) {
2103 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2104 roamoffload_in_hs = data;
2105 PRINTM(MIOCTL, "roamoffload_in_hs=%d\n",
2106 roamoffload_in_hs);
2107 }
2108 } else if (!strncmp(prop->name, "gtk_rekey_offload",
2109 strlen("gtk_rekey_offload"))) {
2110 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2111 gtk_rekey_offload = data;
2112 PRINTM(MIOCTL, "gtk_rekey_offload=%d\n",
2113 gtk_rekey_offload);
2114 }
2115 }
2116 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
2117 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
2118 else if (!strncmp(prop->name, "host_mlme",
2119 strlen("host_mlme"))) {
2120 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2121 PRINTM(MIOCTL, "host_mlme=0x%x\n", data);
2122 host_mlme = data;
2123 }
2124 }
2125 #endif
2126 #endif
2127 #ifdef UAP_SUPPORT
2128 else if (!strncmp(prop->name, "uap_max_sta",
2129 strlen("uap_max_sta"))) {
2130 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2131 PRINTM(MERROR, "uap_max_sta=0x%x\n", data);
2132 uap_max_sta = data;
2133 }
2134 } else if (!strncmp(prop->name, "wacp_mode",
2135 strlen("wacp_mode"))) {
2136 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2137 PRINTM(MERROR, "wacp_mode=0x%x\n", data);
2138 wacp_mode = data;
2139 }
2140 }
2141 #endif
2142 else if (!strncmp(prop->name, "mcs32", strlen("mcs32"))) {
2143 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2144 PRINTM(MERROR, "mcs32=0x%x\n", data);
2145 mcs32 = data;
2146 }
2147 } else if (!strncmp(prop->name, "sched_scan",
2148 strlen("sched_scan"))) {
2149 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2150 PRINTM(MIOCTL, "sched_scan=%d\n", data);
2151 sched_scan = data;
2152 }
2153 } else if (!strncmp(prop->name, "chan_track",
2154 strlen("chan_track"))) {
2155 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2156 chan_track = data;
2157 PRINTM(MIOCTL, "chan_track=%d\n", chan_track);
2158 }
2159 } else if (!strncmp(prop->name, "keep_previous_scan",
2160 strlen("keep_previous_scan"))) {
2161 if (!of_property_read_u32(dt_node, prop->name, &data)) {
2162 PRINTM(MERROR, "keep_previous_scan=0x%x\n",
2163 data);
2164 keep_previous_scan = data;
2165 }
2166 }
2167 }
2168 LEAVE();
2169 return;
2170 }
2171 #endif
2172
2173 /**
2174 * @brief This function check if configuration block id could be used
2175 *
2176 * @param handle A pointer to moal_handle structure
2177 *
2178 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
2179 */
woal_validate_cfg_id(moal_handle * handle)2180 static mlan_status woal_validate_cfg_id(moal_handle *handle)
2181 {
2182 int i;
2183 mlan_status ret = MLAN_STATUS_SUCCESS;
2184 for (i = 0; i < MAX_MLAN_ADAPTER; i++) {
2185 if (m_handle[i] == NULL || m_handle[i] == handle)
2186 continue;
2187 if (m_handle[i]->card_type == handle->card_type) {
2188 if (m_handle[i]->blk_id == handle->blk_id) {
2189 ret = MLAN_STATUS_FAILURE;
2190 }
2191 }
2192 }
2193 return ret;
2194 }
2195
2196 /**
2197 * @brief This function skip current configuration block
2198 *
2199 * @param data A pointer to buffer of module configuration file
2200 * @param size Size of module configuration file
2201 *
2202 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
2203 */
parse_skip_cfg_block(t_u8 * data,t_u32 size)2204 static mlan_status parse_skip_cfg_block(t_u8 *data, t_u32 size)
2205 {
2206 int end = 0;
2207 t_u8 line[MAX_LINE_LEN];
2208 while ((int)parse_cfg_get_line(data, size, line) != -1) {
2209 if (strncmp(line, "}", strlen("}")) == 0) {
2210 end = 1;
2211 break;
2212 }
2213 if (end == 0 && strstr(line, "{") != NULL)
2214 break;
2215 }
2216 return (end == 1) ? MLAN_STATUS_SUCCESS : MLAN_STATUS_FAILURE;
2217 }
2218
2219 /**
2220 * @brief This function handle fallback processing for invalid
2221 * block id with same card type
2222 *
2223 * @param handle A pointer to moal_handle structure
2224 *
2225 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
2226 */
woal_cfg_fallback_process(moal_handle * handle)2227 static mlan_status woal_cfg_fallback_process(moal_handle *handle)
2228 {
2229 int i, blk_id = 0x7fffffff, idx = -1;
2230 mlan_status ret = MLAN_STATUS_FAILURE;
2231 PRINTM(MMSG, "Configuration block, fallback processing\n");
2232 for (i = 0; i < MAX_MLAN_ADAPTER; i++) {
2233 if (m_handle[i] == NULL || m_handle[i] == handle ||
2234 m_handle[i]->card_type != handle->card_type)
2235 continue;
2236 /* use configuratino with lowest blk_id value */
2237 if (m_handle[i]->blk_id >= 0 && m_handle[i]->blk_id <= blk_id) {
2238 idx = i;
2239 blk_id = m_handle[i]->blk_id;
2240 }
2241 }
2242 if (idx >= 0 && idx < MAX_MLAN_ADAPTER) {
2243 ret = MLAN_STATUS_SUCCESS;
2244 handle->blk_id = m_handle[idx]->blk_id;
2245 PRINTM(MMSG,
2246 "Configuration fallback to, card_type: 0x%x, blk_id: 0x%x\n",
2247 handle->card_type, handle->blk_id);
2248 woal_setup_module_param(handle, &m_handle[idx]->params);
2249 }
2250 return ret;
2251 }
2252
2253 /**
2254 * @brief This function parse and initialize module parameters
2255 *
2256 * @param handle A pointer to moal_handle structure
2257 *
2258 * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
2259 */
woal_init_module_param(moal_handle * handle)2260 mlan_status woal_init_module_param(moal_handle *handle)
2261 {
2262 int no_match = 1;
2263 t_u32 size, i, tbl_size;
2264 t_u8 line[MAX_LINE_LEN], *data = NULL;
2265 mlan_status ret = MLAN_STATUS_SUCCESS;
2266 char *card_type = NULL, *blk_id = NULL;
2267
2268 memset(line, 0, MAX_LINE_LEN);
2269 woal_setup_module_param(handle, NULL);
2270 if (mod_para == NULL) {
2271 PRINTM(MMSG, "No module param cfg file specified\n");
2272 goto out;
2273 }
2274 if (woal_req_mod_param(handle, mod_para)) {
2275 PRINTM(MERROR, "Failed to get module param file\n");
2276 ret = MLAN_STATUS_FAILURE;
2277 goto out;
2278 }
2279 tbl_size = sizeof(card_type_map_tbl) / sizeof(card_type_map_tbl[0]);
2280 for (i = 0; i < tbl_size; i++)
2281 if (handle->card_type == card_type_map_tbl[i].card_type)
2282 break;
2283 if (i >= tbl_size) {
2284 PRINTM(MERROR, "No card type entry found for card type: 0x%x\n",
2285 handle->card_type);
2286 ret = MLAN_STATUS_FAILURE;
2287 goto out;
2288 }
2289 PRINTM(MMSG, "%s: init module param from usr cfg\n",
2290 card_type_map_tbl[i].name);
2291 size = handle->param_data->size;
2292 data = (t_u8 *)handle->param_data->data;
2293 while ((int)parse_cfg_get_line(data, size, line) != -1) {
2294 if (line[0] == '#')
2295 continue;
2296 if (strstr(line, "={")) {
2297 ret = parse_line_read_card_info(line, &card_type,
2298 &blk_id);
2299 if (ret != MLAN_STATUS_SUCCESS)
2300 goto out;
2301 PRINTM(MINFO,
2302 "Traverse, card_type: %s, config block: %s\n",
2303 card_type, blk_id);
2304 if (strcmp(card_type_map_tbl[i].name, card_type) == 0) {
2305 /* parse config block id */
2306 if (blk_id == NULL)
2307 handle->blk_id = 0;
2308 else
2309 woal_atoi(&handle->blk_id, blk_id);
2310 PRINTM(MINFO,
2311 "Validation check, %s, config block: %d\n",
2312 card_type, handle->blk_id);
2313 /* check validation of config id */
2314 if (woal_validate_cfg_id(handle) !=
2315 MLAN_STATUS_SUCCESS) {
2316 ret = parse_skip_cfg_block(data, size);
2317 if (ret != MLAN_STATUS_SUCCESS) {
2318 PRINTM(MMSG,
2319 "failed to skip block\n");
2320 goto out;
2321 }
2322 continue;
2323 }
2324 no_match = 0;
2325 PRINTM(MMSG,
2326 "card_type: %s, config block: %d\n",
2327 card_type, handle->blk_id);
2328 /* parse config block */
2329 ret = parse_cfg_read_block(data, size, handle);
2330 if (ret != MLAN_STATUS_SUCCESS)
2331 goto out;
2332 break;
2333 }
2334 }
2335 }
2336 if (no_match)
2337 ret = woal_cfg_fallback_process(handle);
2338 out:
2339 if (handle->param_data) {
2340 release_firmware(handle->param_data);
2341 /* rewind pos */
2342 parse_cfg_get_line(NULL, 0, NULL);
2343 }
2344 if (ret != MLAN_STATUS_SUCCESS) {
2345 PRINTM(MERROR, "Invalid block: %s\n", line);
2346 woal_free_module_param(handle);
2347 woal_setup_module_param(handle, NULL);
2348 }
2349 return ret;
2350 }
2351
2352 module_param(mod_para, charp, 0);
2353 MODULE_PARM_DESC(mod_para, "Module parameters configuration file");
2354 module_param(hw_test, int, 0660);
2355 MODULE_PARM_DESC(hw_test, "0: Disable hardware test; 1: Enable hardware test");
2356 #ifdef CONFIG_OF
2357 module_param(dts_enable, int, 0);
2358 MODULE_PARM_DESC(dts_enable, "0: Disable DTS; 1: Enable DTS");
2359 #endif
2360 module_param(hw_name, charp, 0660);
2361 MODULE_PARM_DESC(hw_name, "hardware name");
2362
2363 module_param(fw_name, charp, 0660);
2364 MODULE_PARM_DESC(fw_name, "Firmware name");
2365 module_param(req_fw_nowait, int, 0);
2366 MODULE_PARM_DESC(
2367 req_fw_nowait,
2368 "0: Use request_firmware API; 1: Use request_firmware_nowait API");
2369 module_param(fw_reload, int, 0);
2370 MODULE_PARM_DESC(fw_reload,
2371 "0: disable fw_reload; 1: enable fw reload feature");
2372 module_param(auto_fw_reload, int, 0);
2373 MODULE_PARM_DESC(auto_fw_reload,
2374 "0: disable auto_fw_reload; 1: enable auto fw reload feature");
2375 module_param(fw_serial, int, 0);
2376 MODULE_PARM_DESC(
2377 fw_serial,
2378 "0: support parallel download FW; 1: support serial download FW");
2379 module_param(mac_addr, charp, 0660);
2380 MODULE_PARM_DESC(mac_addr, "MAC address");
2381 #ifdef MFG_CMD_SUPPORT
2382 module_param(mfg_mode, int, 0660);
2383 MODULE_PARM_DESC(mfg_mode,
2384 "0: Download normal firmware; 1: Download MFG firmware");
2385 #endif /* MFG_CMD_SUPPORT */
2386 module_param(drv_mode, int, 0660);
2387 MODULE_PARM_DESC(drv_mode,
2388 "Bit 0: STA; Bit 1: uAP; Bit 2: WIFIDIRECT; Bit 7: ZERO_DFS");
2389
2390 #ifdef STA_SUPPORT
2391 module_param(max_sta_bss, int, 0);
2392 MODULE_PARM_DESC(max_sta_bss, "Number of STA interfaces (1)");
2393 module_param(sta_name, charp, 0);
2394 MODULE_PARM_DESC(sta_name, "STA interface name");
2395 #endif /* STA_SUPPORT */
2396 #ifdef UAP_SUPPORT
2397 module_param(max_uap_bss, int, 0);
2398 MODULE_PARM_DESC(max_uap_bss, "Number of uAP interfaces (1)");
2399 module_param(uap_name, charp, 0);
2400 MODULE_PARM_DESC(uap_name, "uAP interface name");
2401 #endif /* UAP_SUPPORT */
2402 #ifdef WIFI_DIRECT_SUPPORT
2403 module_param(max_wfd_bss, int, 0);
2404 MODULE_PARM_DESC(max_wfd_bss, "Number of WIFIDIRECT interfaces (1)");
2405 module_param(wfd_name, charp, 0);
2406 MODULE_PARM_DESC(wfd_name, "WIFIDIRECT interface name");
2407 #if defined(STA_CFG80211) && defined(UAP_CFG80211)
2408 module_param(max_vir_bss, int, 0);
2409 MODULE_PARM_DESC(max_vir_bss, "Number of Virtual interfaces (0)");
2410 #endif
2411 #endif /* WIFI_DIRECT_SUPPORT */
2412 #ifdef DEBUG_LEVEL1
2413 module_param(drvdbg, uint, 0660);
2414 MODULE_PARM_DESC(drvdbg, "Driver debug");
2415 #endif /* DEBUG_LEVEL1 */
2416 module_param(auto_ds, int, 0660);
2417 MODULE_PARM_DESC(
2418 auto_ds,
2419 "0: MLAN default; 1: Enable auto deep sleep; 2: Disable auto deep sleep");
2420 module_param(ext_scan, int, 0660);
2421 MODULE_PARM_DESC(
2422 ext_scan,
2423 "0: MLAN default; 1: Enable Extended Scan; 2: Enable Enhanced Extended Scan");
2424 module_param(ps_mode, int, 0660);
2425 MODULE_PARM_DESC(
2426 ps_mode,
2427 "0: MLAN default; 1: Enable IEEE PS mode; 2: Disable IEEE PS mode");
2428 module_param(p2a_scan, int, 0660);
2429 MODULE_PARM_DESC(
2430 p2a_scan,
2431 "0: MLAN default; 1: Enable passive to active scan for DFS channel; 2: Disable passive to active scan for DFS channel");
2432 module_param(scan_chan_gap, int, 0660);
2433 MODULE_PARM_DESC(
2434 scan_chan_gap,
2435 "Time gap between two scans in milliseconds when connected to AP(max value 500ms)");
2436 module_param(sched_scan, int, 0);
2437 MODULE_PARM_DESC(sched_scan,
2438 "0: disable sched_scan; 1: enable sched_scan default");
2439 module_param(max_tx_buf, int, 0);
2440 MODULE_PARM_DESC(max_tx_buf, "Maximum Tx buffer size (2048/4096/8192)");
2441
2442 #if defined(SDIO)
2443 module_param(intmode, int, 0);
2444 MODULE_PARM_DESC(intmode, "0: INT_MODE_SDIO, 1: INT_MODE_GPIO");
2445 module_param(gpiopin, int, 0);
2446 MODULE_PARM_DESC(gpiopin, "255:new GPIO int mode, other vlue: gpio pin number");
2447 #endif
2448
2449 module_param(pm_keep_power, int, 0);
2450 MODULE_PARM_DESC(pm_keep_power, "1: PM keep power; 0: PM no power");
2451 #ifdef SDIO_SUSPEND_RESUME
2452 module_param(shutdown_hs, int, 0);
2453 MODULE_PARM_DESC(shutdown_hs,
2454 "1: Enable HS when shutdown; 0: No HS when shutdown");
2455 #endif
2456 #if defined(STA_SUPPORT)
2457 module_param(cfg_11d, int, 0);
2458 MODULE_PARM_DESC(cfg_11d,
2459 "0: MLAN default; 1: Enable 802.11d; 2: Disable 802.11d");
2460 #endif
2461 #if defined(SDIO)
2462 module_param(slew_rate, int, 0);
2463 MODULE_PARM_DESC(
2464 slew_rate,
2465 "0:has the slowest slew rate, then 01, then 02, and 03 has the highest slew rate");
2466 #endif
2467 module_param(tx_work, uint, 0660);
2468 MODULE_PARM_DESC(tx_work, "1: Enable tx_work; 0: Disable tx_work");
2469 module_param(tx_skb_clone, uint, 0660);
2470 MODULE_PARM_DESC(tx_skb_clone,
2471 "1: Enable tx_skb_clone; 0: Disable tx_skb_clone");
2472 module_param(pmqos, uint, 0660);
2473 MODULE_PARM_DESC(pmqos, "1: Enable pmqos; 0: Disable pmqos");
2474 module_param(mcs32, uint, 0660);
2475 MODULE_PARM_DESC(mcs32, "1: Enable mcs32; 0: Disable mcs32");
2476
2477 module_param(dpd_data_cfg, charp, 0);
2478 MODULE_PARM_DESC(dpd_data_cfg, "DPD data file name");
2479 module_param(init_cfg, charp, 0);
2480 MODULE_PARM_DESC(init_cfg, "Init config file name");
2481 module_param(cal_data_cfg, charp, 0);
2482 MODULE_PARM_DESC(cal_data_cfg, "Calibration data file name");
2483 module_param(txpwrlimit_cfg, charp, 0);
2484 MODULE_PARM_DESC(txpwrlimit_cfg,
2485 "Set configuration data of Tx power limitation");
2486 module_param(cntry_txpwr, int, 0);
2487 MODULE_PARM_DESC(
2488 cntry_txpwr,
2489 "0: disable (default), 1: enable set country txpower table 2: enable set country rgpower table");
2490 module_param(init_hostcmd_cfg, charp, 0);
2491 MODULE_PARM_DESC(init_hostcmd_cfg, "Init hostcmd file name");
2492 module_param(band_steer_cfg, charp, 0);
2493 MODULE_PARM_DESC(band_steer_cfg, "band steer cfg file name");
2494 module_param(cfg80211_wext, int, 0660);
2495 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
2496 MODULE_PARM_DESC(
2497 cfg80211_wext,
2498 "Bit 0: STA WEXT Bit 1: UAP WEXT Bit 2: STA CFG80211 Bit 3: UAP CFG80211");
2499 #else
2500 MODULE_PARM_DESC(cfg80211_wext, "Bit 0: STA WEXT Bit 1: UAP WEXT Bit 2");
2501 #endif
2502 #if defined(USB)
2503 module_param(skip_fwdnld, int, 0);
2504 MODULE_PARM_DESC(skip_fwdnld, "0: Enable FW download; 1: Disable FW download");
2505 #endif
2506 module_param(wq_sched_prio, int, 0);
2507 module_param(wq_sched_policy, int, 0);
2508 MODULE_PARM_DESC(wq_sched_prio, "Priority of work queue");
2509 MODULE_PARM_DESC(
2510 wq_sched_policy,
2511 "0: SCHED_NORMAL; 1: SCHED_FIFO; 2: SCHED_RR; 3: SCHED_BATCH; 5: SCHED_IDLE");
2512 module_param(rx_work, int, 0);
2513 MODULE_PARM_DESC(
2514 rx_work,
2515 "0: default; 1: Enable rx_work_queue; 2: Disable rx_work_queue");
2516 module_param(aggrctrl, int, 0);
2517 MODULE_PARM_DESC(aggrctrl,
2518 "1: Enable Tx aggregation; 0: Disable Tx aggregation");
2519 #ifdef USB
2520 module_param(usb_aggr, int, 0);
2521 MODULE_PARM_DESC(usb_aggr,
2522 "0: MLAN default; 1: Enable USB aggr; 2: Disable USB aggr");
2523 #endif
2524 #ifdef PCIE
2525 module_param(ring_size, int, 0);
2526 MODULE_PARM_DESC(ring_size,
2527 "adma dma ring size: 32/64/128/256/512, default 128");
2528 module_param(pcie_int_mode, int, 0);
2529 MODULE_PARM_DESC(pcie_int_mode, "0: Legacy mode; 1: MSI mode; 2: MSI-X mode");
2530 #endif /* PCIE */
2531 module_param(low_power_mode_enable, int, 0);
2532 MODULE_PARM_DESC(low_power_mode_enable, "0/1: Disable/Enable Low Power Mode");
2533
2534 #ifdef ANDROID_KERNEL
2535 module_param(wakelock_timeout, int, 0);
2536 MODULE_PARM_DESC(wakelock_timeout, "set wakelock_timeout value (ms)");
2537 #endif
2538
2539 module_param(dev_cap_mask, uint, 0);
2540 MODULE_PARM_DESC(dev_cap_mask, "Device capability mask");
2541 module_param(net_rx, int, 0);
2542 MODULE_PARM_DESC(net_rx,
2543 "0: use netif_rx_ni in rx; 1: use netif_receive_skb in rx");
2544 module_param(amsdu_deaggr, int, 0);
2545 MODULE_PARM_DESC(amsdu_deaggr,
2546 "0: default; 1: Try to avoid buf copy in amsud deaggregation");
2547
2548 #ifdef SDIO
2549 module_param(sdio_rx_aggr, int, 0);
2550 MODULE_PARM_DESC(sdio_rx_aggr,
2551 "1: Enable SDIO rx aggr; 0: Disable SDIO rx aggr");
2552 #endif
2553
2554 module_param(pmic, int, 0);
2555 MODULE_PARM_DESC(
2556 pmic,
2557 "1: Send pmic configure cmd to firmware; 0: No pmic configure cmd sent to firmware");
2558
2559 module_param(antcfg, int, 0660);
2560 MODULE_PARM_DESC(
2561 antcfg,
2562 "0:default; SD8887/SD8987-[1:Tx/Rx antenna 1, 2:Tx/Rx antenna 2, 0xffff:enable antenna diversity];SD8897/SD8997-[Bit0:Rx Path A, Bit1:Rx Path B, Bit 4:Tx Path A, Bit 5:Tx Path B];9098/9097-[Bit 0: 2G Tx/Rx path A, Bit 1: 2G Tx/Rx path B,Bit 8: 5G Tx/Rx path A, Bit 9: 5G Tx/Rx path B]");
2563
2564 module_param(uap_oper_ctrl, uint, 0);
2565 MODULE_PARM_DESC(uap_oper_ctrl, "0:default; 0x20001:uap restarts on channel 6");
2566
2567 module_param(hs_wake_interval, int, 0660);
2568 MODULE_PARM_DESC(
2569 hs_wake_interval,
2570 "Host sleep wakeup interval,it will round to nearest multiple dtim*beacon_period in fw");
2571 module_param(indication_gpio, int, 0);
2572 MODULE_PARM_DESC(
2573 indication_gpio,
2574 "GPIO to indicate wakeup source; high four bits: level for normal wakeup; low four bits: GPIO pin number.");
2575 module_param(disconnect_on_suspend, int, 0);
2576 MODULE_PARM_DESC(
2577 disconnect_on_suspend,
2578 "1: Enable disconnect wifi on suspend; 0: Disable disconnect wifi on suspend");
2579 module_param(hs_mimo_switch, int, 0660);
2580 MODULE_PARM_DESC(
2581 hs_mimo_switch,
2582 "Dynamic MIMO-SISO switch during host sleep; 0: disable (default), 1: enable");
2583
2584 module_param(indrstcfg, int, 0);
2585 MODULE_PARM_DESC(
2586 indrstcfg,
2587 "Independent reset configuration; high byte: GPIO pin number; low byte: IR mode");
2588
2589 module_param(fixed_beacon_buffer, int, 0);
2590 MODULE_PARM_DESC(
2591 fixed_beacon_buffer,
2592 "0: allocate default buffer size; 1: allocate max buffer size.");
2593
2594 #ifdef WIFI_DIRECT_SUPPORT
2595 module_param(GoAgeoutTime, int, 0);
2596 MODULE_PARM_DESC(GoAgeoutTime,
2597 "0: use default ageout time; set Go age out time (TU 100ms)");
2598 #endif
2599
2600 module_param(gtk_rekey_offload, int, 0);
2601 MODULE_PARM_DESC(
2602 gtk_rekey_offload,
2603 "0: disable gtk_rekey_offload; 1: enable gtk_rekey_offload (default); 2: enable gtk_rekey_offload in suspend mode only;");
2604
2605 module_param(multi_dtim, ushort, 0);
2606 MODULE_PARM_DESC(multi_dtim, "DTIM interval");
2607
2608 module_param(inact_tmo, ushort, 0);
2609 MODULE_PARM_DESC(inact_tmo, "IEEE ps inactivity timout value");
2610
2611 module_param(napi, int, 0);
2612 MODULE_PARM_DESC(napi, "1: enable napi api; 0: disable napi");
2613
2614 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
2615 module_param(dfs_offload, int, 0);
2616 MODULE_PARM_DESC(dfs_offload, "1: enable dfs offload; 0: disable dfs offload.");
2617 #endif
2618
2619 module_param(roamoffload_in_hs, int, 0);
2620 MODULE_PARM_DESC(
2621 roamoffload_in_hs,
2622 "1: enable fw roaming only when host suspend; 0: always enable fw roaming.");
2623
2624 #ifdef UAP_SUPPORT
2625 module_param(uap_max_sta, int, 0);
2626 MODULE_PARM_DESC(uap_max_sta, "Maximum station number for UAP/GO.");
2627 module_param(wacp_mode, int, 0);
2628 MODULE_PARM_DESC(
2629 wacp_mode,
2630 "WACP mode for UAP/GO 0: WACP_MODE_DEFAULT; 1: WACP_MODE_1; 2: WACP_MODE_2");
2631 #endif
2632 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
2633 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)
2634 module_param(host_mlme, int, 0);
2635 MODULE_PARM_DESC(
2636 host_mlme,
2637 "1: Enable Host MLME Support (Default); 0: Disable Host MLME support");
2638 #endif
2639 #endif
2640
2641 #if defined(STA_CFG80211) || defined(UAP_CFG80211)
2642 module_param(disable_regd_by_driver, int, 0);
2643 MODULE_PARM_DESC(
2644 disable_regd_by_driver,
2645 "0: reg domain set by driver enable(default); 1: reg domain set by driver disable");
2646 module_param(reg_alpha2, charp, 0660);
2647 MODULE_PARM_DESC(reg_alpha2, "Regulatory alpha2");
2648 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
2649 module_param(country_ie_ignore, int, 0);
2650 MODULE_PARM_DESC(
2651 country_ie_ignore,
2652 "0: Follow countryIE from AP and beacon hint enable; 1: Ignore countryIE from AP and beacon hint disable");
2653 module_param(beacon_hints, int, 0);
2654 MODULE_PARM_DESC(beacon_hints,
2655 "0: enable beacon hints(default); 1: disable beacon hints");
2656 #endif
2657 #endif
2658
2659 module_param(dfs53cfg, int, 0);
2660 MODULE_PARM_DESC(dfs53cfg, "0: fw default; 1: new w53 dfs; 2: old w53 dfs");
2661
2662 module_param(chan_track, int, 0);
2663 MODULE_PARM_DESC(
2664 chan_track,
2665 "1: Set channel tracking; 0: Restore channel tracking for 9098 only");
2666
2667 module_param(keep_previous_scan, int, 0);
2668 MODULE_PARM_DESC(
2669 keep_previous_scan,
2670 "1: keep previous scan result; 0: flush previous scan result before start scan ");
2671