1 #include <linux/slab.h>
2 #include <linux/time.h>
3 #include <linux/kthread.h>
4 #include <linux/delay.h>
5 #include "host_interface.h"
6 #include "coreconfigurator.h"
8 #include "wilc_wlan_if.h"
9 #include "wilc_msgqueue.h"
10 #include <linux/etherdevice.h>
11 #include "wilc_wfi_netdevice.h"
13 #define HOST_IF_MSG_SCAN 0
14 #define HOST_IF_MSG_CONNECT 1
15 #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2
16 #define HOST_IF_MSG_KEY 3
17 #define HOST_IF_MSG_RCVD_NTWRK_INFO 4
18 #define HOST_IF_MSG_RCVD_SCAN_COMPLETE 5
19 #define HOST_IF_MSG_CFG_PARAMS 6
20 #define HOST_IF_MSG_SET_CHANNEL 7
21 #define HOST_IF_MSG_DISCONNECT 8
22 #define HOST_IF_MSG_GET_RSSI 9
23 #define HOST_IF_MSG_GET_CHNL 10
24 #define HOST_IF_MSG_ADD_BEACON 11
25 #define HOST_IF_MSG_DEL_BEACON 12
26 #define HOST_IF_MSG_ADD_STATION 13
27 #define HOST_IF_MSG_DEL_STATION 14
28 #define HOST_IF_MSG_EDIT_STATION 15
29 #define HOST_IF_MSG_SCAN_TIMER_FIRED 16
30 #define HOST_IF_MSG_CONNECT_TIMER_FIRED 17
31 #define HOST_IF_MSG_POWER_MGMT 18
32 #define HOST_IF_MSG_GET_INACTIVETIME 19
33 #define HOST_IF_MSG_REMAIN_ON_CHAN 20
34 #define HOST_IF_MSG_REGISTER_FRAME 21
35 #define HOST_IF_MSG_LISTEN_TIMER_FIRED 22
36 #define HOST_IF_MSG_GET_LINKSPEED 23
37 #define HOST_IF_MSG_SET_WFIDRV_HANDLER 24
38 #define HOST_IF_MSG_SET_MAC_ADDRESS 25
39 #define HOST_IF_MSG_GET_MAC_ADDRESS 26
40 #define HOST_IF_MSG_SET_OPERATION_MODE 27
41 #define HOST_IF_MSG_SET_IPADDRESS 28
42 #define HOST_IF_MSG_GET_IPADDRESS 29
43 #define HOST_IF_MSG_FLUSH_CONNECT 30
44 #define HOST_IF_MSG_GET_STATISTICS 31
45 #define HOST_IF_MSG_SET_MULTICAST_FILTER 32
46 #define HOST_IF_MSG_DEL_BA_SESSION 34
47 #define HOST_IF_MSG_Q_IDLE 35
48 #define HOST_IF_MSG_DEL_ALL_STA 36
49 #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 37
50 #define HOST_IF_MSG_SET_TX_POWER 38
51 #define HOST_IF_MSG_GET_TX_POWER 39
52 #define HOST_IF_MSG_EXIT 100
54 #define HOST_IF_SCAN_TIMEOUT 4000
55 #define HOST_IF_CONNECT_TIMEOUT 9500
57 #define BA_SESSION_DEFAULT_BUFFER_SIZE 16
58 #define BA_SESSION_DEFAULT_TIMEOUT 1000
59 #define BLOCK_ACK_REQ_SIZE 0x14
60 #define FALSE_FRMWR_CHANNEL 100
62 #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
63 #define DEFAULT_LINK_SPEED 72
65 struct cfg_param_attr
{
66 struct cfg_param_val cfg_attr_info
;
69 struct host_if_wpa_attr
{
79 struct host_if_wep_attr
{
84 enum AUTHTYPE auth_type
;
87 union host_if_key_attr
{
88 struct host_if_wep_attr wep
;
89 struct host_if_wpa_attr wpa
;
90 struct host_if_pmkid_attr pmkid
;
96 union host_if_key_attr attr
;
106 wilc_scan_result result
;
108 struct hidden_network hidden_network
;
111 struct connect_attr
{
118 wilc_connect_result result
;
120 enum AUTHTYPE auth_type
;
125 struct rcvd_async_info
{
130 struct channel_attr
{
143 struct set_multicast
{
149 u8 del_all_sta
[MAX_NUM_STA
][ETH_ALEN
];
154 u8 mac_addr
[ETH_ALEN
];
157 struct power_mgmt_param
{
167 struct sta_inactive_t
{
176 struct scan_attr scan_info
;
177 struct connect_attr con_info
;
178 struct rcvd_net_info net_info
;
179 struct rcvd_async_info async_info
;
180 struct key_attr key_info
;
181 struct cfg_param_attr cfg_info
;
182 struct channel_attr channel_info
;
183 struct beacon_attr beacon_info
;
184 struct add_sta_param add_sta_info
;
185 struct del_sta del_sta_info
;
186 struct add_sta_param edit_sta_info
;
187 struct power_mgmt_param pwr_mgmt_info
;
188 struct sta_inactive_t mac_info
;
189 struct set_ip_addr ip_info
;
190 struct drv_handler drv
;
191 struct set_multicast multicast_info
;
193 struct set_mac_addr set_mac_info
;
194 struct get_mac_addr get_mac_info
;
195 struct ba_session_info session_info
;
196 struct remain_ch remain_on_ch
;
197 struct reg_frame reg_frame
;
199 struct del_all_sta del_all_sta_info
;
200 struct tx_power tx_power
;
205 union message_body body
;
206 struct wilc_vif
*vif
;
209 struct join_bss_param
{
215 char ssid
[MAX_SSID_LEN
];
217 u8 supp_rates
[MAX_RATES_SUPPORTED
+ 1];
224 u8 rsn_pcip_policy
[3];
225 u8 rsn_auth_policy
[3];
238 static struct host_if_drv
*terminated_handle
;
239 bool wilc_optaining_ip
;
240 static u8 P2P_LISTEN_STATE
;
241 static struct task_struct
*hif_thread_handler
;
242 static struct message_queue hif_msg_q
;
243 static struct semaphore hif_sema_thread
;
244 static struct semaphore hif_sema_driver
;
245 static struct semaphore hif_sema_wait_response
;
246 static struct semaphore hif_sema_deinit
;
247 static struct timer_list periodic_rssi
;
249 u8 wilc_multicast_mac_addr_list
[WILC_MULTICAST_TABLE_SIZE
][ETH_ALEN
];
251 static u8 rcv_assoc_resp
[MAX_ASSOC_RESP_FRAME_SIZE
];
253 static bool scan_while_connected
;
256 static s8 link_speed
;
258 static u8 set_ip
[2][4];
259 static u8 get_ip
[2][4];
260 static u32 inactive_time
;
261 static u8 del_beacon
;
262 static u32 clients_count
;
265 static u8
*info_element
;
268 static u32 join_req_size
;
269 static u32 info_element_size
;
270 static struct wilc_vif
*join_req_vif
;
271 #define REAL_JOIN_REQ 0
272 #define FLUSHED_JOIN_REQ 1
273 #define FLUSHED_BYTE_POS 79
275 static void *host_int_ParseJoinBssParam(struct network_info
*ptstrNetworkInfo
);
276 static int host_int_get_ipaddress(struct wilc_vif
*vif
, u8
*ip_addr
, u8 idx
);
278 /* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as
279 * special purpose in wilc device, so we add 1 to the index to starts from 1.
280 * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
282 int wilc_get_vif_idx(struct wilc_vif
*vif
)
287 /* We need to minus 1 from idx which is from wilc device to get real index
288 * of wilc->vif[], because we add 1 when pass to wilc device in the function
290 * As a result, the index should be between 0 and NUM_CONCURRENT_IFC -1.
292 static struct wilc_vif
*wilc_get_vif_from_idx(struct wilc
*wilc
, int idx
)
296 if (index
< 0 || index
>= NUM_CONCURRENT_IFC
)
299 return wilc
->vif
[index
];
302 static s32
handle_set_channel(struct wilc_vif
*vif
,
303 struct channel_attr
*hif_set_ch
)
308 wid
.id
= (u16
)WID_CURRENT_CHANNEL
;
310 wid
.val
= (char *)&hif_set_ch
->set_ch
;
311 wid
.size
= sizeof(char);
313 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
314 wilc_get_vif_idx(vif
));
317 PRINT_ER("Failed to set channel\n");
324 static s32
handle_set_wfi_drv_handler(struct wilc_vif
*vif
,
325 struct drv_handler
*hif_drv_handler
)
330 wid
.id
= (u16
)WID_SET_DRV_HANDLER
;
332 wid
.val
= (s8
*)hif_drv_handler
;
333 wid
.size
= sizeof(*hif_drv_handler
);
335 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
336 hif_drv_handler
->handler
);
338 if (!hif_drv_handler
->handler
)
339 up(&hif_sema_driver
);
342 PRINT_ER("Failed to set driver handler\n");
349 static s32
handle_set_operation_mode(struct wilc_vif
*vif
,
350 struct op_mode
*hif_op_mode
)
355 wid
.id
= (u16
)WID_SET_OPERATION_MODE
;
357 wid
.val
= (s8
*)&hif_op_mode
->mode
;
358 wid
.size
= sizeof(u32
);
360 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
361 wilc_get_vif_idx(vif
));
363 if ((hif_op_mode
->mode
) == IDLE_MODE
)
364 up(&hif_sema_driver
);
367 PRINT_ER("Failed to set driver handler\n");
374 static s32
handle_set_ip_address(struct wilc_vif
*vif
, u8
*ip_addr
, u8 idx
)
378 char firmware_ip_addr
[4] = {0};
380 if (ip_addr
[0] < 192)
383 memcpy(set_ip
[idx
], ip_addr
, IP_ALEN
);
385 wid
.id
= (u16
)WID_IP_ADDRESS
;
387 wid
.val
= (u8
*)ip_addr
;
390 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
391 wilc_get_vif_idx(vif
));
393 host_int_get_ipaddress(vif
, firmware_ip_addr
, idx
);
396 PRINT_ER("Failed to set IP address\n");
403 static s32
handle_get_ip_address(struct wilc_vif
*vif
, u8 idx
)
408 wid
.id
= (u16
)WID_IP_ADDRESS
;
410 wid
.val
= kmalloc(IP_ALEN
, GFP_KERNEL
);
413 result
= wilc_send_config_pkt(vif
, GET_CFG
, &wid
, 1,
414 wilc_get_vif_idx(vif
));
416 memcpy(get_ip
[idx
], wid
.val
, IP_ALEN
);
420 if (memcmp(get_ip
[idx
], set_ip
[idx
], IP_ALEN
) != 0)
421 wilc_setup_ipaddress(vif
, set_ip
[idx
], idx
);
424 PRINT_ER("Failed to get IP address\n");
431 static s32
handle_set_mac_address(struct wilc_vif
*vif
,
432 struct set_mac_addr
*set_mac_addr
)
436 u8
*mac_buf
= kmalloc(ETH_ALEN
, GFP_KERNEL
);
439 PRINT_ER("No buffer to send mac address\n");
442 memcpy(mac_buf
, set_mac_addr
->mac_addr
, ETH_ALEN
);
444 wid
.id
= (u16
)WID_MAC_ADDR
;
448 PRINT_D(GENERIC_DBG
, "mac addr = :%pM\n", wid
.val
);
450 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
451 wilc_get_vif_idx(vif
));
453 PRINT_ER("Failed to set mac address\n");
461 static s32
handle_get_mac_address(struct wilc_vif
*vif
,
462 struct get_mac_addr
*get_mac_addr
)
467 wid
.id
= (u16
)WID_MAC_ADDR
;
469 wid
.val
= get_mac_addr
->mac_addr
;
472 result
= wilc_send_config_pkt(vif
, GET_CFG
, &wid
, 1,
473 wilc_get_vif_idx(vif
));
476 PRINT_ER("Failed to get mac address\n");
479 up(&hif_sema_wait_response
);
484 static s32
handle_cfg_param(struct wilc_vif
*vif
,
485 struct cfg_param_attr
*cfg_param_attr
)
488 struct wid wid_list
[32];
489 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
492 down(&hif_drv
->sem_cfg_values
);
494 if (cfg_param_attr
->cfg_attr_info
.flag
& BSS_TYPE
) {
495 if (cfg_param_attr
->cfg_attr_info
.bss_type
< 6) {
496 wid_list
[wid_cnt
].id
= WID_BSS_TYPE
;
497 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.bss_type
;
498 wid_list
[wid_cnt
].type
= WID_CHAR
;
499 wid_list
[wid_cnt
].size
= sizeof(char);
500 hif_drv
->cfg_values
.bss_type
= (u8
)cfg_param_attr
->cfg_attr_info
.bss_type
;
502 PRINT_ER("check value 6 over\n");
508 if (cfg_param_attr
->cfg_attr_info
.flag
& AUTH_TYPE
) {
509 if (cfg_param_attr
->cfg_attr_info
.auth_type
== 1 ||
510 cfg_param_attr
->cfg_attr_info
.auth_type
== 2 ||
511 cfg_param_attr
->cfg_attr_info
.auth_type
== 5) {
512 wid_list
[wid_cnt
].id
= WID_AUTH_TYPE
;
513 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.auth_type
;
514 wid_list
[wid_cnt
].type
= WID_CHAR
;
515 wid_list
[wid_cnt
].size
= sizeof(char);
516 hif_drv
->cfg_values
.auth_type
= (u8
)cfg_param_attr
->cfg_attr_info
.auth_type
;
518 PRINT_ER("Impossible value \n");
524 if (cfg_param_attr
->cfg_attr_info
.flag
& AUTHEN_TIMEOUT
) {
525 if (cfg_param_attr
->cfg_attr_info
.auth_timeout
> 0 &&
526 cfg_param_attr
->cfg_attr_info
.auth_timeout
< 65536) {
527 wid_list
[wid_cnt
].id
= WID_AUTH_TIMEOUT
;
528 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.auth_timeout
;
529 wid_list
[wid_cnt
].type
= WID_SHORT
;
530 wid_list
[wid_cnt
].size
= sizeof(u16
);
531 hif_drv
->cfg_values
.auth_timeout
= cfg_param_attr
->cfg_attr_info
.auth_timeout
;
533 PRINT_ER("Range(1 ~ 65535) over\n");
539 if (cfg_param_attr
->cfg_attr_info
.flag
& POWER_MANAGEMENT
) {
540 if (cfg_param_attr
->cfg_attr_info
.power_mgmt_mode
< 5) {
541 wid_list
[wid_cnt
].id
= WID_POWER_MANAGEMENT
;
542 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.power_mgmt_mode
;
543 wid_list
[wid_cnt
].type
= WID_CHAR
;
544 wid_list
[wid_cnt
].size
= sizeof(char);
545 hif_drv
->cfg_values
.power_mgmt_mode
= (u8
)cfg_param_attr
->cfg_attr_info
.power_mgmt_mode
;
547 PRINT_ER("Invalide power mode\n");
553 if (cfg_param_attr
->cfg_attr_info
.flag
& RETRY_SHORT
) {
554 if (cfg_param_attr
->cfg_attr_info
.short_retry_limit
> 0 &&
555 cfg_param_attr
->cfg_attr_info
.short_retry_limit
< 256) {
556 wid_list
[wid_cnt
].id
= WID_SHORT_RETRY_LIMIT
;
557 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.short_retry_limit
;
558 wid_list
[wid_cnt
].type
= WID_SHORT
;
559 wid_list
[wid_cnt
].size
= sizeof(u16
);
560 hif_drv
->cfg_values
.short_retry_limit
= cfg_param_attr
->cfg_attr_info
.short_retry_limit
;
562 PRINT_ER("Range(1~256) over\n");
568 if (cfg_param_attr
->cfg_attr_info
.flag
& RETRY_LONG
) {
569 if (cfg_param_attr
->cfg_attr_info
.long_retry_limit
> 0 &&
570 cfg_param_attr
->cfg_attr_info
.long_retry_limit
< 256) {
571 wid_list
[wid_cnt
].id
= WID_LONG_RETRY_LIMIT
;
572 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.long_retry_limit
;
573 wid_list
[wid_cnt
].type
= WID_SHORT
;
574 wid_list
[wid_cnt
].size
= sizeof(u16
);
575 hif_drv
->cfg_values
.long_retry_limit
= cfg_param_attr
->cfg_attr_info
.long_retry_limit
;
577 PRINT_ER("Range(1~256) over\n");
583 if (cfg_param_attr
->cfg_attr_info
.flag
& FRAG_THRESHOLD
) {
584 if (cfg_param_attr
->cfg_attr_info
.frag_threshold
> 255 &&
585 cfg_param_attr
->cfg_attr_info
.frag_threshold
< 7937) {
586 wid_list
[wid_cnt
].id
= WID_FRAG_THRESHOLD
;
587 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.frag_threshold
;
588 wid_list
[wid_cnt
].type
= WID_SHORT
;
589 wid_list
[wid_cnt
].size
= sizeof(u16
);
590 hif_drv
->cfg_values
.frag_threshold
= cfg_param_attr
->cfg_attr_info
.frag_threshold
;
592 PRINT_ER("Threshold Range fail\n");
598 if (cfg_param_attr
->cfg_attr_info
.flag
& RTS_THRESHOLD
) {
599 if (cfg_param_attr
->cfg_attr_info
.rts_threshold
> 255 &&
600 cfg_param_attr
->cfg_attr_info
.rts_threshold
< 65536) {
601 wid_list
[wid_cnt
].id
= WID_RTS_THRESHOLD
;
602 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.rts_threshold
;
603 wid_list
[wid_cnt
].type
= WID_SHORT
;
604 wid_list
[wid_cnt
].size
= sizeof(u16
);
605 hif_drv
->cfg_values
.rts_threshold
= cfg_param_attr
->cfg_attr_info
.rts_threshold
;
607 PRINT_ER("Threshold Range fail\n");
613 if (cfg_param_attr
->cfg_attr_info
.flag
& PREAMBLE
) {
614 if (cfg_param_attr
->cfg_attr_info
.preamble_type
< 3) {
615 wid_list
[wid_cnt
].id
= WID_PREAMBLE
;
616 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.preamble_type
;
617 wid_list
[wid_cnt
].type
= WID_CHAR
;
618 wid_list
[wid_cnt
].size
= sizeof(char);
619 hif_drv
->cfg_values
.preamble_type
= cfg_param_attr
->cfg_attr_info
.preamble_type
;
621 PRINT_ER("Preamle Range(0~2) over\n");
627 if (cfg_param_attr
->cfg_attr_info
.flag
& SHORT_SLOT_ALLOWED
) {
628 if (cfg_param_attr
->cfg_attr_info
.short_slot_allowed
< 2) {
629 wid_list
[wid_cnt
].id
= WID_SHORT_SLOT_ALLOWED
;
630 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.short_slot_allowed
;
631 wid_list
[wid_cnt
].type
= WID_CHAR
;
632 wid_list
[wid_cnt
].size
= sizeof(char);
633 hif_drv
->cfg_values
.short_slot_allowed
= (u8
)cfg_param_attr
->cfg_attr_info
.short_slot_allowed
;
635 PRINT_ER("Short slot(2) over\n");
641 if (cfg_param_attr
->cfg_attr_info
.flag
& TXOP_PROT_DISABLE
) {
642 if (cfg_param_attr
->cfg_attr_info
.txop_prot_disabled
< 2) {
643 wid_list
[wid_cnt
].id
= WID_11N_TXOP_PROT_DISABLE
;
644 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.txop_prot_disabled
;
645 wid_list
[wid_cnt
].type
= WID_CHAR
;
646 wid_list
[wid_cnt
].size
= sizeof(char);
647 hif_drv
->cfg_values
.txop_prot_disabled
= (u8
)cfg_param_attr
->cfg_attr_info
.txop_prot_disabled
;
649 PRINT_ER("TXOP prot disable\n");
655 if (cfg_param_attr
->cfg_attr_info
.flag
& BEACON_INTERVAL
) {
656 if (cfg_param_attr
->cfg_attr_info
.beacon_interval
> 0 &&
657 cfg_param_attr
->cfg_attr_info
.beacon_interval
< 65536) {
658 wid_list
[wid_cnt
].id
= WID_BEACON_INTERVAL
;
659 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.beacon_interval
;
660 wid_list
[wid_cnt
].type
= WID_SHORT
;
661 wid_list
[wid_cnt
].size
= sizeof(u16
);
662 hif_drv
->cfg_values
.beacon_interval
= cfg_param_attr
->cfg_attr_info
.beacon_interval
;
664 PRINT_ER("Beacon interval(1~65535) fail\n");
670 if (cfg_param_attr
->cfg_attr_info
.flag
& DTIM_PERIOD
) {
671 if (cfg_param_attr
->cfg_attr_info
.dtim_period
> 0 &&
672 cfg_param_attr
->cfg_attr_info
.dtim_period
< 256) {
673 wid_list
[wid_cnt
].id
= WID_DTIM_PERIOD
;
674 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.dtim_period
;
675 wid_list
[wid_cnt
].type
= WID_CHAR
;
676 wid_list
[wid_cnt
].size
= sizeof(char);
677 hif_drv
->cfg_values
.dtim_period
= cfg_param_attr
->cfg_attr_info
.dtim_period
;
679 PRINT_ER("DTIM range(1~255) fail\n");
685 if (cfg_param_attr
->cfg_attr_info
.flag
& SITE_SURVEY
) {
686 if (cfg_param_attr
->cfg_attr_info
.site_survey_enabled
< 3) {
687 wid_list
[wid_cnt
].id
= WID_SITE_SURVEY
;
688 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.site_survey_enabled
;
689 wid_list
[wid_cnt
].type
= WID_CHAR
;
690 wid_list
[wid_cnt
].size
= sizeof(char);
691 hif_drv
->cfg_values
.site_survey_enabled
= (u8
)cfg_param_attr
->cfg_attr_info
.site_survey_enabled
;
693 PRINT_ER("Site survey disable\n");
699 if (cfg_param_attr
->cfg_attr_info
.flag
& SITE_SURVEY_SCAN_TIME
) {
700 if (cfg_param_attr
->cfg_attr_info
.site_survey_scan_time
> 0 &&
701 cfg_param_attr
->cfg_attr_info
.site_survey_scan_time
< 65536) {
702 wid_list
[wid_cnt
].id
= WID_SITE_SURVEY_SCAN_TIME
;
703 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.site_survey_scan_time
;
704 wid_list
[wid_cnt
].type
= WID_SHORT
;
705 wid_list
[wid_cnt
].size
= sizeof(u16
);
706 hif_drv
->cfg_values
.site_survey_scan_time
= cfg_param_attr
->cfg_attr_info
.site_survey_scan_time
;
708 PRINT_ER("Site survey scan time(1~65535) over\n");
714 if (cfg_param_attr
->cfg_attr_info
.flag
& ACTIVE_SCANTIME
) {
715 if (cfg_param_attr
->cfg_attr_info
.active_scan_time
> 0 &&
716 cfg_param_attr
->cfg_attr_info
.active_scan_time
< 65536) {
717 wid_list
[wid_cnt
].id
= WID_ACTIVE_SCAN_TIME
;
718 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.active_scan_time
;
719 wid_list
[wid_cnt
].type
= WID_SHORT
;
720 wid_list
[wid_cnt
].size
= sizeof(u16
);
721 hif_drv
->cfg_values
.active_scan_time
= cfg_param_attr
->cfg_attr_info
.active_scan_time
;
723 PRINT_ER("Active scan time(1~65535) over\n");
729 if (cfg_param_attr
->cfg_attr_info
.flag
& PASSIVE_SCANTIME
) {
730 if (cfg_param_attr
->cfg_attr_info
.passive_scan_time
> 0 &&
731 cfg_param_attr
->cfg_attr_info
.passive_scan_time
< 65536) {
732 wid_list
[wid_cnt
].id
= WID_PASSIVE_SCAN_TIME
;
733 wid_list
[wid_cnt
].val
= (s8
*)&cfg_param_attr
->cfg_attr_info
.passive_scan_time
;
734 wid_list
[wid_cnt
].type
= WID_SHORT
;
735 wid_list
[wid_cnt
].size
= sizeof(u16
);
736 hif_drv
->cfg_values
.passive_scan_time
= cfg_param_attr
->cfg_attr_info
.passive_scan_time
;
738 PRINT_ER("Passive scan time(1~65535) over\n");
744 if (cfg_param_attr
->cfg_attr_info
.flag
& CURRENT_TX_RATE
) {
745 enum CURRENT_TXRATE curr_tx_rate
= cfg_param_attr
->cfg_attr_info
.curr_tx_rate
;
747 if (curr_tx_rate
== AUTORATE
|| curr_tx_rate
== MBPS_1
748 || curr_tx_rate
== MBPS_2
|| curr_tx_rate
== MBPS_5_5
749 || curr_tx_rate
== MBPS_11
|| curr_tx_rate
== MBPS_6
750 || curr_tx_rate
== MBPS_9
|| curr_tx_rate
== MBPS_12
751 || curr_tx_rate
== MBPS_18
|| curr_tx_rate
== MBPS_24
752 || curr_tx_rate
== MBPS_36
|| curr_tx_rate
== MBPS_48
|| curr_tx_rate
== MBPS_54
) {
753 wid_list
[wid_cnt
].id
= WID_CURRENT_TX_RATE
;
754 wid_list
[wid_cnt
].val
= (s8
*)&curr_tx_rate
;
755 wid_list
[wid_cnt
].type
= WID_SHORT
;
756 wid_list
[wid_cnt
].size
= sizeof(u16
);
757 hif_drv
->cfg_values
.curr_tx_rate
= (u8
)curr_tx_rate
;
759 PRINT_ER("out of TX rate\n");
766 result
= wilc_send_config_pkt(vif
, SET_CFG
, wid_list
,
767 wid_cnt
, wilc_get_vif_idx(vif
));
770 PRINT_ER("Error in setting CFG params\n");
773 up(&hif_drv
->sem_cfg_values
);
777 static void Handle_wait_msg_q_empty(void)
779 wilc_initialized
= 0;
780 up(&hif_sema_wait_response
);
783 static s32
Handle_ScanDone(struct wilc_vif
*vif
,
784 enum scan_event enuEvent
);
786 static s32
Handle_Scan(struct wilc_vif
*vif
,
787 struct scan_attr
*pstrHostIFscanAttr
)
790 struct wid strWIDList
[5];
791 u32 u32WidsCount
= 0;
795 u8
*pu8HdnNtwrksWidVal
= NULL
;
796 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
798 hif_drv
->usr_scan_req
.scan_result
= pstrHostIFscanAttr
->result
;
799 hif_drv
->usr_scan_req
.arg
= pstrHostIFscanAttr
->arg
;
801 if ((hif_drv
->hif_state
>= HOST_IF_SCANNING
) &&
802 (hif_drv
->hif_state
< HOST_IF_CONNECTED
)) {
803 PRINT_D(GENERIC_DBG
, "Don't scan already in [%d] state\n",
805 PRINT_ER("Already scan\n");
810 if (wilc_optaining_ip
|| wilc_connecting
) {
811 PRINT_D(GENERIC_DBG
, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
812 PRINT_ER("Don't do obss scan\n");
817 hif_drv
->usr_scan_req
.rcvd_ch_cnt
= 0;
819 strWIDList
[u32WidsCount
].id
= (u16
)WID_SSID_PROBE_REQ
;
820 strWIDList
[u32WidsCount
].type
= WID_STR
;
822 for (i
= 0; i
< pstrHostIFscanAttr
->hidden_network
.n_ssids
; i
++)
823 valuesize
+= ((pstrHostIFscanAttr
->hidden_network
.net_info
[i
].ssid_len
) + 1);
824 pu8HdnNtwrksWidVal
= kmalloc(valuesize
+ 1, GFP_KERNEL
);
825 strWIDList
[u32WidsCount
].val
= pu8HdnNtwrksWidVal
;
826 if (strWIDList
[u32WidsCount
].val
) {
827 pu8Buffer
= strWIDList
[u32WidsCount
].val
;
829 *pu8Buffer
++ = pstrHostIFscanAttr
->hidden_network
.n_ssids
;
831 for (i
= 0; i
< pstrHostIFscanAttr
->hidden_network
.n_ssids
; i
++) {
832 *pu8Buffer
++ = pstrHostIFscanAttr
->hidden_network
.net_info
[i
].ssid_len
;
833 memcpy(pu8Buffer
, pstrHostIFscanAttr
->hidden_network
.net_info
[i
].ssid
, pstrHostIFscanAttr
->hidden_network
.net_info
[i
].ssid_len
);
834 pu8Buffer
+= pstrHostIFscanAttr
->hidden_network
.net_info
[i
].ssid_len
;
837 strWIDList
[u32WidsCount
].size
= (s32
)(valuesize
+ 1);
842 strWIDList
[u32WidsCount
].id
= WID_INFO_ELEMENT_PROBE
;
843 strWIDList
[u32WidsCount
].type
= WID_BIN_DATA
;
844 strWIDList
[u32WidsCount
].val
= pstrHostIFscanAttr
->ies
;
845 strWIDList
[u32WidsCount
].size
= pstrHostIFscanAttr
->ies_len
;
849 strWIDList
[u32WidsCount
].id
= WID_SCAN_TYPE
;
850 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
851 strWIDList
[u32WidsCount
].size
= sizeof(char);
852 strWIDList
[u32WidsCount
].val
= (s8
*)&pstrHostIFscanAttr
->type
;
855 strWIDList
[u32WidsCount
].id
= WID_SCAN_CHANNEL_LIST
;
856 strWIDList
[u32WidsCount
].type
= WID_BIN_DATA
;
858 if (pstrHostIFscanAttr
->ch_freq_list
&&
859 pstrHostIFscanAttr
->ch_list_len
> 0) {
862 for (i
= 0; i
< pstrHostIFscanAttr
->ch_list_len
; i
++) {
863 if (pstrHostIFscanAttr
->ch_freq_list
[i
] > 0)
864 pstrHostIFscanAttr
->ch_freq_list
[i
] = pstrHostIFscanAttr
->ch_freq_list
[i
] - 1;
868 strWIDList
[u32WidsCount
].val
= pstrHostIFscanAttr
->ch_freq_list
;
869 strWIDList
[u32WidsCount
].size
= pstrHostIFscanAttr
->ch_list_len
;
872 strWIDList
[u32WidsCount
].id
= WID_START_SCAN_REQ
;
873 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
874 strWIDList
[u32WidsCount
].size
= sizeof(char);
875 strWIDList
[u32WidsCount
].val
= (s8
*)&pstrHostIFscanAttr
->src
;
878 if (hif_drv
->hif_state
== HOST_IF_CONNECTED
)
879 scan_while_connected
= true;
880 else if (hif_drv
->hif_state
== HOST_IF_IDLE
)
881 scan_while_connected
= false;
883 result
= wilc_send_config_pkt(vif
, SET_CFG
, strWIDList
,
885 wilc_get_vif_idx(vif
));
888 PRINT_ER("Failed to send scan paramters config packet\n");
892 del_timer(&hif_drv
->scan_timer
);
893 Handle_ScanDone(vif
, SCAN_EVENT_ABORTED
);
896 kfree(pstrHostIFscanAttr
->ch_freq_list
);
897 pstrHostIFscanAttr
->ch_freq_list
= NULL
;
899 kfree(pstrHostIFscanAttr
->ies
);
900 pstrHostIFscanAttr
->ies
= NULL
;
901 kfree(pstrHostIFscanAttr
->hidden_network
.net_info
);
902 pstrHostIFscanAttr
->hidden_network
.net_info
= NULL
;
904 kfree(pu8HdnNtwrksWidVal
);
909 static s32
Handle_ScanDone(struct wilc_vif
*vif
,
910 enum scan_event enuEvent
)
913 u8 u8abort_running_scan
;
915 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
917 if (enuEvent
== SCAN_EVENT_ABORTED
) {
918 PRINT_D(GENERIC_DBG
, "Abort running scan\n");
919 u8abort_running_scan
= 1;
920 wid
.id
= (u16
)WID_ABORT_RUNNING_SCAN
;
922 wid
.val
= (s8
*)&u8abort_running_scan
;
923 wid
.size
= sizeof(char);
925 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
926 wilc_get_vif_idx(vif
));
929 PRINT_ER("Failed to set abort running scan\n");
935 PRINT_ER("Driver handler is NULL\n");
939 if (hif_drv
->usr_scan_req
.scan_result
) {
940 hif_drv
->usr_scan_req
.scan_result(enuEvent
, NULL
,
941 hif_drv
->usr_scan_req
.arg
, NULL
);
942 hif_drv
->usr_scan_req
.scan_result
= NULL
;
948 u8 wilc_connected_ssid
[6] = {0};
949 static s32
Handle_Connect(struct wilc_vif
*vif
,
950 struct connect_attr
*pstrHostIFconnectAttr
)
953 struct wid strWIDList
[8];
954 u32 u32WidsCount
= 0, dummyval
= 0;
955 u8
*pu8CurrByte
= NULL
;
956 struct join_bss_param
*ptstrJoinBssParam
;
957 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
959 PRINT_D(GENERIC_DBG
, "Handling connect request\n");
961 if (memcmp(pstrHostIFconnectAttr
->bssid
, wilc_connected_ssid
, ETH_ALEN
) == 0) {
963 PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n");
967 ptstrJoinBssParam
= (struct join_bss_param
*)pstrHostIFconnectAttr
->params
;
968 if (!ptstrJoinBssParam
) {
969 PRINT_ER("Required BSSID not found\n");
974 if (pstrHostIFconnectAttr
->bssid
) {
975 hif_drv
->usr_conn_req
.pu8bssid
= kmalloc(6, GFP_KERNEL
);
976 memcpy(hif_drv
->usr_conn_req
.pu8bssid
, pstrHostIFconnectAttr
->bssid
, 6);
979 hif_drv
->usr_conn_req
.ssid_len
= pstrHostIFconnectAttr
->ssid_len
;
980 if (pstrHostIFconnectAttr
->ssid
) {
981 hif_drv
->usr_conn_req
.pu8ssid
= kmalloc(pstrHostIFconnectAttr
->ssid_len
+ 1, GFP_KERNEL
);
982 memcpy(hif_drv
->usr_conn_req
.pu8ssid
,
983 pstrHostIFconnectAttr
->ssid
,
984 pstrHostIFconnectAttr
->ssid_len
);
985 hif_drv
->usr_conn_req
.pu8ssid
[pstrHostIFconnectAttr
->ssid_len
] = '\0';
988 hif_drv
->usr_conn_req
.ies_len
= pstrHostIFconnectAttr
->ies_len
;
989 if (pstrHostIFconnectAttr
->ies
) {
990 hif_drv
->usr_conn_req
.ies
= kmalloc(pstrHostIFconnectAttr
->ies_len
, GFP_KERNEL
);
991 memcpy(hif_drv
->usr_conn_req
.ies
,
992 pstrHostIFconnectAttr
->ies
,
993 pstrHostIFconnectAttr
->ies_len
);
996 hif_drv
->usr_conn_req
.u8security
= pstrHostIFconnectAttr
->security
;
997 hif_drv
->usr_conn_req
.auth_type
= pstrHostIFconnectAttr
->auth_type
;
998 hif_drv
->usr_conn_req
.conn_result
= pstrHostIFconnectAttr
->result
;
999 hif_drv
->usr_conn_req
.arg
= pstrHostIFconnectAttr
->arg
;
1001 strWIDList
[u32WidsCount
].id
= WID_SUCCESS_FRAME_COUNT
;
1002 strWIDList
[u32WidsCount
].type
= WID_INT
;
1003 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
1004 strWIDList
[u32WidsCount
].val
= (s8
*)(&(dummyval
));
1007 strWIDList
[u32WidsCount
].id
= WID_RECEIVED_FRAGMENT_COUNT
;
1008 strWIDList
[u32WidsCount
].type
= WID_INT
;
1009 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
1010 strWIDList
[u32WidsCount
].val
= (s8
*)(&(dummyval
));
1013 strWIDList
[u32WidsCount
].id
= WID_FAILED_COUNT
;
1014 strWIDList
[u32WidsCount
].type
= WID_INT
;
1015 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
1016 strWIDList
[u32WidsCount
].val
= (s8
*)(&(dummyval
));
1020 strWIDList
[u32WidsCount
].id
= WID_INFO_ELEMENT_ASSOCIATE
;
1021 strWIDList
[u32WidsCount
].type
= WID_BIN_DATA
;
1022 strWIDList
[u32WidsCount
].val
= hif_drv
->usr_conn_req
.ies
;
1023 strWIDList
[u32WidsCount
].size
= hif_drv
->usr_conn_req
.ies_len
;
1026 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7)) {
1027 info_element_size
= hif_drv
->usr_conn_req
.ies_len
;
1028 info_element
= kmalloc(info_element_size
, GFP_KERNEL
);
1029 memcpy(info_element
, hif_drv
->usr_conn_req
.ies
,
1033 strWIDList
[u32WidsCount
].id
= (u16
)WID_11I_MODE
;
1034 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
1035 strWIDList
[u32WidsCount
].size
= sizeof(char);
1036 strWIDList
[u32WidsCount
].val
= (s8
*)&hif_drv
->usr_conn_req
.u8security
;
1039 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7))
1040 mode_11i
= hif_drv
->usr_conn_req
.u8security
;
1042 strWIDList
[u32WidsCount
].id
= (u16
)WID_AUTH_TYPE
;
1043 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
1044 strWIDList
[u32WidsCount
].size
= sizeof(char);
1045 strWIDList
[u32WidsCount
].val
= (s8
*)&hif_drv
->usr_conn_req
.auth_type
;
1048 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7))
1049 auth_type
= (u8
)hif_drv
->usr_conn_req
.auth_type
;
1051 strWIDList
[u32WidsCount
].id
= (u16
)WID_JOIN_REQ_EXTENDED
;
1052 strWIDList
[u32WidsCount
].type
= WID_STR
;
1053 strWIDList
[u32WidsCount
].size
= 112;
1054 strWIDList
[u32WidsCount
].val
= kmalloc(strWIDList
[u32WidsCount
].size
, GFP_KERNEL
);
1056 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7)) {
1057 join_req_size
= strWIDList
[u32WidsCount
].size
;
1058 join_req
= kmalloc(join_req_size
, GFP_KERNEL
);
1060 if (!strWIDList
[u32WidsCount
].val
) {
1065 pu8CurrByte
= strWIDList
[u32WidsCount
].val
;
1067 if (pstrHostIFconnectAttr
->ssid
) {
1068 memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->ssid
, pstrHostIFconnectAttr
->ssid_len
);
1069 pu8CurrByte
[pstrHostIFconnectAttr
->ssid_len
] = '\0';
1071 pu8CurrByte
+= MAX_SSID_LEN
;
1072 *(pu8CurrByte
++) = INFRASTRUCTURE
;
1074 if ((pstrHostIFconnectAttr
->ch
>= 1) && (pstrHostIFconnectAttr
->ch
<= 14)) {
1075 *(pu8CurrByte
++) = pstrHostIFconnectAttr
->ch
;
1077 PRINT_ER("Channel out of range\n");
1078 *(pu8CurrByte
++) = 0xFF;
1080 *(pu8CurrByte
++) = (ptstrJoinBssParam
->cap_info
) & 0xFF;
1081 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->cap_info
) >> 8) & 0xFF;
1083 if (pstrHostIFconnectAttr
->bssid
)
1084 memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->bssid
, 6);
1087 if (pstrHostIFconnectAttr
->bssid
)
1088 memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->bssid
, 6);
1091 *(pu8CurrByte
++) = (ptstrJoinBssParam
->beacon_period
) & 0xFF;
1092 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->beacon_period
) >> 8) & 0xFF;
1093 *(pu8CurrByte
++) = ptstrJoinBssParam
->dtim_period
;
1095 memcpy(pu8CurrByte
, ptstrJoinBssParam
->supp_rates
, MAX_RATES_SUPPORTED
+ 1);
1096 pu8CurrByte
+= (MAX_RATES_SUPPORTED
+ 1);
1098 *(pu8CurrByte
++) = ptstrJoinBssParam
->wmm_cap
;
1099 *(pu8CurrByte
++) = ptstrJoinBssParam
->uapsd_cap
;
1101 *(pu8CurrByte
++) = ptstrJoinBssParam
->ht_capable
;
1102 hif_drv
->usr_conn_req
.ht_capable
= ptstrJoinBssParam
->ht_capable
;
1104 *(pu8CurrByte
++) = ptstrJoinBssParam
->rsn_found
;
1105 *(pu8CurrByte
++) = ptstrJoinBssParam
->rsn_grp_policy
;
1106 *(pu8CurrByte
++) = ptstrJoinBssParam
->mode_802_11i
;
1108 memcpy(pu8CurrByte
, ptstrJoinBssParam
->rsn_pcip_policy
, sizeof(ptstrJoinBssParam
->rsn_pcip_policy
));
1109 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->rsn_pcip_policy
);
1111 memcpy(pu8CurrByte
, ptstrJoinBssParam
->rsn_auth_policy
, sizeof(ptstrJoinBssParam
->rsn_auth_policy
));
1112 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->rsn_auth_policy
);
1114 memcpy(pu8CurrByte
, ptstrJoinBssParam
->rsn_cap
, sizeof(ptstrJoinBssParam
->rsn_cap
));
1115 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->rsn_cap
);
1117 *(pu8CurrByte
++) = REAL_JOIN_REQ
;
1118 *(pu8CurrByte
++) = ptstrJoinBssParam
->noa_enabled
;
1120 if (ptstrJoinBssParam
->noa_enabled
) {
1121 *(pu8CurrByte
++) = (ptstrJoinBssParam
->tsf
) & 0xFF;
1122 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->tsf
) >> 8) & 0xFF;
1123 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->tsf
) >> 16) & 0xFF;
1124 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->tsf
) >> 24) & 0xFF;
1126 *(pu8CurrByte
++) = ptstrJoinBssParam
->opp_enabled
;
1127 *(pu8CurrByte
++) = ptstrJoinBssParam
->idx
;
1129 if (ptstrJoinBssParam
->opp_enabled
)
1130 *(pu8CurrByte
++) = ptstrJoinBssParam
->ct_window
;
1132 *(pu8CurrByte
++) = ptstrJoinBssParam
->cnt
;
1134 memcpy(pu8CurrByte
, ptstrJoinBssParam
->duration
, sizeof(ptstrJoinBssParam
->duration
));
1135 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->duration
);
1137 memcpy(pu8CurrByte
, ptstrJoinBssParam
->interval
, sizeof(ptstrJoinBssParam
->interval
));
1138 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->interval
);
1140 memcpy(pu8CurrByte
, ptstrJoinBssParam
->start_time
, sizeof(ptstrJoinBssParam
->start_time
));
1141 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->start_time
);
1144 pu8CurrByte
= strWIDList
[u32WidsCount
].val
;
1147 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7)) {
1148 memcpy(join_req
, pu8CurrByte
, join_req_size
);
1152 if (pstrHostIFconnectAttr
->bssid
) {
1153 memcpy(wilc_connected_ssid
,
1154 pstrHostIFconnectAttr
->bssid
, ETH_ALEN
);
1155 PRINT_D(GENERIC_DBG
, "save Bssid = %pM\n",
1156 pstrHostIFconnectAttr
->bssid
);
1157 PRINT_D(GENERIC_DBG
, "save bssid = %pM\n", wilc_connected_ssid
);
1160 result
= wilc_send_config_pkt(vif
, SET_CFG
, strWIDList
,
1162 wilc_get_vif_idx(vif
));
1164 PRINT_ER("failed to send config packet\n");
1168 PRINT_D(GENERIC_DBG
, "set HOST_IF_WAITING_CONN_RESP\n");
1169 hif_drv
->hif_state
= HOST_IF_WAITING_CONN_RESP
;
1174 tstrConnectInfo strConnectInfo
;
1176 del_timer(&hif_drv
->connect_timer
);
1178 memset(&strConnectInfo
, 0, sizeof(tstrConnectInfo
));
1180 if (pstrHostIFconnectAttr
->result
) {
1181 if (pstrHostIFconnectAttr
->bssid
)
1182 memcpy(strConnectInfo
.au8bssid
, pstrHostIFconnectAttr
->bssid
, 6);
1184 if (pstrHostIFconnectAttr
->ies
) {
1185 strConnectInfo
.ReqIEsLen
= pstrHostIFconnectAttr
->ies_len
;
1186 strConnectInfo
.pu8ReqIEs
= kmalloc(pstrHostIFconnectAttr
->ies_len
, GFP_KERNEL
);
1187 memcpy(strConnectInfo
.pu8ReqIEs
,
1188 pstrHostIFconnectAttr
->ies
,
1189 pstrHostIFconnectAttr
->ies_len
);
1192 pstrHostIFconnectAttr
->result(CONN_DISCONN_EVENT_CONN_RESP
,
1196 pstrHostIFconnectAttr
->arg
);
1197 hif_drv
->hif_state
= HOST_IF_IDLE
;
1198 kfree(strConnectInfo
.pu8ReqIEs
);
1199 strConnectInfo
.pu8ReqIEs
= NULL
;
1202 PRINT_ER("Connect callback function pointer is NULL\n");
1206 kfree(pstrHostIFconnectAttr
->bssid
);
1207 pstrHostIFconnectAttr
->bssid
= NULL
;
1209 kfree(pstrHostIFconnectAttr
->ssid
);
1210 pstrHostIFconnectAttr
->ssid
= NULL
;
1212 kfree(pstrHostIFconnectAttr
->ies
);
1213 pstrHostIFconnectAttr
->ies
= NULL
;
1219 static s32
Handle_FlushConnect(struct wilc_vif
*vif
)
1222 struct wid strWIDList
[5];
1223 u32 u32WidsCount
= 0;
1224 u8
*pu8CurrByte
= NULL
;
1226 strWIDList
[u32WidsCount
].id
= WID_INFO_ELEMENT_ASSOCIATE
;
1227 strWIDList
[u32WidsCount
].type
= WID_BIN_DATA
;
1228 strWIDList
[u32WidsCount
].val
= info_element
;
1229 strWIDList
[u32WidsCount
].size
= info_element_size
;
1232 strWIDList
[u32WidsCount
].id
= (u16
)WID_11I_MODE
;
1233 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
1234 strWIDList
[u32WidsCount
].size
= sizeof(char);
1235 strWIDList
[u32WidsCount
].val
= (s8
*)(&(mode_11i
));
1238 strWIDList
[u32WidsCount
].id
= (u16
)WID_AUTH_TYPE
;
1239 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
1240 strWIDList
[u32WidsCount
].size
= sizeof(char);
1241 strWIDList
[u32WidsCount
].val
= (s8
*)(&auth_type
);
1244 strWIDList
[u32WidsCount
].id
= (u16
)WID_JOIN_REQ_EXTENDED
;
1245 strWIDList
[u32WidsCount
].type
= WID_STR
;
1246 strWIDList
[u32WidsCount
].size
= join_req_size
;
1247 strWIDList
[u32WidsCount
].val
= (s8
*)join_req
;
1248 pu8CurrByte
= strWIDList
[u32WidsCount
].val
;
1250 pu8CurrByte
+= FLUSHED_BYTE_POS
;
1251 *(pu8CurrByte
) = FLUSHED_JOIN_REQ
;
1255 result
= wilc_send_config_pkt(vif
, SET_CFG
, strWIDList
,
1257 wilc_get_vif_idx(join_req_vif
));
1259 PRINT_ER("failed to send config packet\n");
1266 static s32
Handle_ConnectTimeout(struct wilc_vif
*vif
)
1269 tstrConnectInfo strConnectInfo
;
1271 u16 u16DummyReasonCode
= 0;
1272 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
1275 PRINT_ER("Driver handler is NULL\n");
1279 hif_drv
->hif_state
= HOST_IF_IDLE
;
1281 scan_while_connected
= false;
1283 memset(&strConnectInfo
, 0, sizeof(tstrConnectInfo
));
1285 if (hif_drv
->usr_conn_req
.conn_result
) {
1286 if (hif_drv
->usr_conn_req
.pu8bssid
) {
1287 memcpy(strConnectInfo
.au8bssid
,
1288 hif_drv
->usr_conn_req
.pu8bssid
, 6);
1291 if (hif_drv
->usr_conn_req
.ies
) {
1292 strConnectInfo
.ReqIEsLen
= hif_drv
->usr_conn_req
.ies_len
;
1293 strConnectInfo
.pu8ReqIEs
= kmalloc(hif_drv
->usr_conn_req
.ies_len
, GFP_KERNEL
);
1294 memcpy(strConnectInfo
.pu8ReqIEs
,
1295 hif_drv
->usr_conn_req
.ies
,
1296 hif_drv
->usr_conn_req
.ies_len
);
1299 hif_drv
->usr_conn_req
.conn_result(CONN_DISCONN_EVENT_CONN_RESP
,
1303 hif_drv
->usr_conn_req
.arg
);
1305 kfree(strConnectInfo
.pu8ReqIEs
);
1306 strConnectInfo
.pu8ReqIEs
= NULL
;
1308 PRINT_ER("Connect callback function pointer is NULL\n");
1311 wid
.id
= (u16
)WID_DISCONNECT
;
1312 wid
.type
= WID_CHAR
;
1313 wid
.val
= (s8
*)&u16DummyReasonCode
;
1314 wid
.size
= sizeof(char);
1316 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
1317 wilc_get_vif_idx(vif
));
1319 PRINT_ER("Failed to send dissconect config packet\n");
1321 hif_drv
->usr_conn_req
.ssid_len
= 0;
1322 kfree(hif_drv
->usr_conn_req
.pu8ssid
);
1323 hif_drv
->usr_conn_req
.pu8ssid
= NULL
;
1324 kfree(hif_drv
->usr_conn_req
.pu8bssid
);
1325 hif_drv
->usr_conn_req
.pu8bssid
= NULL
;
1326 hif_drv
->usr_conn_req
.ies_len
= 0;
1327 kfree(hif_drv
->usr_conn_req
.ies
);
1328 hif_drv
->usr_conn_req
.ies
= NULL
;
1330 eth_zero_addr(wilc_connected_ssid
);
1332 if (join_req
&& join_req_vif
== vif
) {
1337 if (info_element
&& join_req_vif
== vif
) {
1338 kfree(info_element
);
1339 info_element
= NULL
;
1345 static s32
Handle_RcvdNtwrkInfo(struct wilc_vif
*vif
,
1346 struct rcvd_net_info
*pstrRcvdNetworkInfo
)
1349 bool bNewNtwrkFound
;
1351 struct network_info
*pstrNetworkInfo
= NULL
;
1352 void *pJoinParams
= NULL
;
1353 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
1355 bNewNtwrkFound
= true;
1357 if (hif_drv
->usr_scan_req
.scan_result
) {
1358 wilc_parse_network_info(pstrRcvdNetworkInfo
->buffer
, &pstrNetworkInfo
);
1359 if ((!pstrNetworkInfo
) ||
1360 (!hif_drv
->usr_scan_req
.scan_result
)) {
1361 PRINT_ER("driver is null\n");
1366 for (i
= 0; i
< hif_drv
->usr_scan_req
.rcvd_ch_cnt
; i
++) {
1367 if ((hif_drv
->usr_scan_req
.net_info
[i
].au8bssid
) &&
1368 (pstrNetworkInfo
->au8bssid
)) {
1369 if (memcmp(hif_drv
->usr_scan_req
.net_info
[i
].au8bssid
,
1370 pstrNetworkInfo
->au8bssid
, 6) == 0) {
1371 if (pstrNetworkInfo
->s8rssi
<= hif_drv
->usr_scan_req
.net_info
[i
].s8rssi
) {
1374 hif_drv
->usr_scan_req
.net_info
[i
].s8rssi
= pstrNetworkInfo
->s8rssi
;
1375 bNewNtwrkFound
= false;
1382 if (bNewNtwrkFound
) {
1383 if (hif_drv
->usr_scan_req
.rcvd_ch_cnt
< MAX_NUM_SCANNED_NETWORKS
) {
1384 hif_drv
->usr_scan_req
.net_info
[hif_drv
->usr_scan_req
.rcvd_ch_cnt
].s8rssi
= pstrNetworkInfo
->s8rssi
;
1386 if (hif_drv
->usr_scan_req
.net_info
[hif_drv
->usr_scan_req
.rcvd_ch_cnt
].au8bssid
&&
1387 pstrNetworkInfo
->au8bssid
) {
1388 memcpy(hif_drv
->usr_scan_req
.net_info
[hif_drv
->usr_scan_req
.rcvd_ch_cnt
].au8bssid
,
1389 pstrNetworkInfo
->au8bssid
, 6);
1391 hif_drv
->usr_scan_req
.rcvd_ch_cnt
++;
1393 pstrNetworkInfo
->bNewNetwork
= true;
1394 pJoinParams
= host_int_ParseJoinBssParam(pstrNetworkInfo
);
1396 hif_drv
->usr_scan_req
.scan_result(SCAN_EVENT_NETWORK_FOUND
, pstrNetworkInfo
,
1397 hif_drv
->usr_scan_req
.arg
,
1402 pstrNetworkInfo
->bNewNetwork
= false;
1403 hif_drv
->usr_scan_req
.scan_result(SCAN_EVENT_NETWORK_FOUND
, pstrNetworkInfo
,
1404 hif_drv
->usr_scan_req
.arg
, NULL
);
1409 kfree(pstrRcvdNetworkInfo
->buffer
);
1410 pstrRcvdNetworkInfo
->buffer
= NULL
;
1412 if (pstrNetworkInfo
) {
1413 kfree(pstrNetworkInfo
->pu8IEs
);
1414 kfree(pstrNetworkInfo
);
1420 static s32
host_int_get_assoc_res_info(struct wilc_vif
*vif
,
1421 u8
*pu8AssocRespInfo
,
1422 u32 u32MaxAssocRespInfoLen
,
1423 u32
*pu32RcvdAssocRespInfoLen
);
1425 static s32
Handle_RcvdGnrlAsyncInfo(struct wilc_vif
*vif
,
1426 struct rcvd_async_info
*pstrRcvdGnrlAsyncInfo
)
1432 u16 u16WidID
= (u16
)WID_NIL
;
1435 u8 u8MacStatusReasonCode
;
1436 u8 u8MacStatusAdditionalInfo
;
1437 tstrConnectInfo strConnectInfo
;
1438 tstrDisconnectNotifInfo strDisconnectNotifInfo
;
1440 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
1443 PRINT_ER("Driver handler is NULL\n");
1446 PRINT_D(GENERIC_DBG
, "Current State = %d,Received state = %d\n",
1447 hif_drv
->hif_state
, pstrRcvdGnrlAsyncInfo
->buffer
[7]);
1449 if ((hif_drv
->hif_state
== HOST_IF_WAITING_CONN_RESP
) ||
1450 (hif_drv
->hif_state
== HOST_IF_CONNECTED
) ||
1451 hif_drv
->usr_scan_req
.scan_result
) {
1452 if (!pstrRcvdGnrlAsyncInfo
->buffer
||
1453 !hif_drv
->usr_conn_req
.conn_result
) {
1454 PRINT_ER("driver is null\n");
1458 u8MsgType
= pstrRcvdGnrlAsyncInfo
->buffer
[0];
1460 if ('I' != u8MsgType
) {
1461 PRINT_ER("Received Message format incorrect.\n");
1465 u8MsgID
= pstrRcvdGnrlAsyncInfo
->buffer
[1];
1466 u16MsgLen
= MAKE_WORD16(pstrRcvdGnrlAsyncInfo
->buffer
[2], pstrRcvdGnrlAsyncInfo
->buffer
[3]);
1467 u16WidID
= MAKE_WORD16(pstrRcvdGnrlAsyncInfo
->buffer
[4], pstrRcvdGnrlAsyncInfo
->buffer
[5]);
1468 u8WidLen
= pstrRcvdGnrlAsyncInfo
->buffer
[6];
1469 u8MacStatus
= pstrRcvdGnrlAsyncInfo
->buffer
[7];
1470 u8MacStatusReasonCode
= pstrRcvdGnrlAsyncInfo
->buffer
[8];
1471 u8MacStatusAdditionalInfo
= pstrRcvdGnrlAsyncInfo
->buffer
[9];
1472 if (hif_drv
->hif_state
== HOST_IF_WAITING_CONN_RESP
) {
1473 u32 u32RcvdAssocRespInfoLen
= 0;
1474 struct connect_resp_info
*pstrConnectRespInfo
= NULL
;
1476 memset(&strConnectInfo
, 0, sizeof(tstrConnectInfo
));
1478 if (u8MacStatus
== MAC_CONNECTED
) {
1479 memset(rcv_assoc_resp
, 0, MAX_ASSOC_RESP_FRAME_SIZE
);
1481 host_int_get_assoc_res_info(vif
,
1483 MAX_ASSOC_RESP_FRAME_SIZE
,
1484 &u32RcvdAssocRespInfoLen
);
1486 if (u32RcvdAssocRespInfoLen
!= 0) {
1487 s32Err
= wilc_parse_assoc_resp_info(rcv_assoc_resp
, u32RcvdAssocRespInfoLen
,
1488 &pstrConnectRespInfo
);
1490 PRINT_ER("wilc_parse_assoc_resp_info() returned error %d\n", s32Err
);
1492 strConnectInfo
.u16ConnectStatus
= pstrConnectRespInfo
->status
;
1494 if (strConnectInfo
.u16ConnectStatus
== SUCCESSFUL_STATUSCODE
) {
1495 if (pstrConnectRespInfo
->ies
) {
1496 strConnectInfo
.u16RespIEsLen
= pstrConnectRespInfo
->ies_len
;
1497 strConnectInfo
.pu8RespIEs
= kmalloc(pstrConnectRespInfo
->ies_len
, GFP_KERNEL
);
1498 memcpy(strConnectInfo
.pu8RespIEs
, pstrConnectRespInfo
->ies
,
1499 pstrConnectRespInfo
->ies_len
);
1503 if (pstrConnectRespInfo
) {
1504 kfree(pstrConnectRespInfo
->ies
);
1505 kfree(pstrConnectRespInfo
);
1511 if ((u8MacStatus
== MAC_CONNECTED
) &&
1512 (strConnectInfo
.u16ConnectStatus
!= SUCCESSFUL_STATUSCODE
)) {
1513 PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
1514 eth_zero_addr(wilc_connected_ssid
);
1515 } else if (u8MacStatus
== MAC_DISCONNECTED
) {
1516 PRINT_ER("Received MAC status is MAC_DISCONNECTED\n");
1517 eth_zero_addr(wilc_connected_ssid
);
1520 if (hif_drv
->usr_conn_req
.pu8bssid
) {
1521 memcpy(strConnectInfo
.au8bssid
, hif_drv
->usr_conn_req
.pu8bssid
, 6);
1523 if ((u8MacStatus
== MAC_CONNECTED
) &&
1524 (strConnectInfo
.u16ConnectStatus
== SUCCESSFUL_STATUSCODE
)) {
1525 memcpy(hif_drv
->assoc_bssid
,
1526 hif_drv
->usr_conn_req
.pu8bssid
, ETH_ALEN
);
1530 if (hif_drv
->usr_conn_req
.ies
) {
1531 strConnectInfo
.ReqIEsLen
= hif_drv
->usr_conn_req
.ies_len
;
1532 strConnectInfo
.pu8ReqIEs
= kmalloc(hif_drv
->usr_conn_req
.ies_len
, GFP_KERNEL
);
1533 memcpy(strConnectInfo
.pu8ReqIEs
,
1534 hif_drv
->usr_conn_req
.ies
,
1535 hif_drv
->usr_conn_req
.ies_len
);
1538 del_timer(&hif_drv
->connect_timer
);
1539 hif_drv
->usr_conn_req
.conn_result(CONN_DISCONN_EVENT_CONN_RESP
,
1543 hif_drv
->usr_conn_req
.arg
);
1545 if ((u8MacStatus
== MAC_CONNECTED
) &&
1546 (strConnectInfo
.u16ConnectStatus
== SUCCESSFUL_STATUSCODE
)) {
1547 wilc_set_power_mgmt(vif
, 0, 0);
1549 hif_drv
->hif_state
= HOST_IF_CONNECTED
;
1551 PRINT_D(GENERIC_DBG
, "Obtaining an IP, Disable Scan\n");
1552 wilc_optaining_ip
= true;
1553 mod_timer(&wilc_during_ip_timer
,
1554 jiffies
+ msecs_to_jiffies(10000));
1556 hif_drv
->hif_state
= HOST_IF_IDLE
;
1557 scan_while_connected
= false;
1560 kfree(strConnectInfo
.pu8RespIEs
);
1561 strConnectInfo
.pu8RespIEs
= NULL
;
1563 kfree(strConnectInfo
.pu8ReqIEs
);
1564 strConnectInfo
.pu8ReqIEs
= NULL
;
1565 hif_drv
->usr_conn_req
.ssid_len
= 0;
1566 kfree(hif_drv
->usr_conn_req
.pu8ssid
);
1567 hif_drv
->usr_conn_req
.pu8ssid
= NULL
;
1568 kfree(hif_drv
->usr_conn_req
.pu8bssid
);
1569 hif_drv
->usr_conn_req
.pu8bssid
= NULL
;
1570 hif_drv
->usr_conn_req
.ies_len
= 0;
1571 kfree(hif_drv
->usr_conn_req
.ies
);
1572 hif_drv
->usr_conn_req
.ies
= NULL
;
1573 } else if ((u8MacStatus
== MAC_DISCONNECTED
) &&
1574 (hif_drv
->hif_state
== HOST_IF_CONNECTED
)) {
1575 memset(&strDisconnectNotifInfo
, 0, sizeof(tstrDisconnectNotifInfo
));
1577 if (hif_drv
->usr_scan_req
.scan_result
) {
1578 del_timer(&hif_drv
->scan_timer
);
1579 Handle_ScanDone(vif
, SCAN_EVENT_ABORTED
);
1582 strDisconnectNotifInfo
.u16reason
= 0;
1583 strDisconnectNotifInfo
.ie
= NULL
;
1584 strDisconnectNotifInfo
.ie_len
= 0;
1586 if (hif_drv
->usr_conn_req
.conn_result
) {
1587 wilc_optaining_ip
= false;
1588 wilc_set_power_mgmt(vif
, 0, 0);
1590 hif_drv
->usr_conn_req
.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF
,
1593 &strDisconnectNotifInfo
,
1594 hif_drv
->usr_conn_req
.arg
);
1596 PRINT_ER("Connect result callback function is NULL\n");
1599 eth_zero_addr(hif_drv
->assoc_bssid
);
1601 hif_drv
->usr_conn_req
.ssid_len
= 0;
1602 kfree(hif_drv
->usr_conn_req
.pu8ssid
);
1603 hif_drv
->usr_conn_req
.pu8ssid
= NULL
;
1604 kfree(hif_drv
->usr_conn_req
.pu8bssid
);
1605 hif_drv
->usr_conn_req
.pu8bssid
= NULL
;
1606 hif_drv
->usr_conn_req
.ies_len
= 0;
1607 kfree(hif_drv
->usr_conn_req
.ies
);
1608 hif_drv
->usr_conn_req
.ies
= NULL
;
1610 if (join_req
&& join_req_vif
== vif
) {
1615 if (info_element
&& join_req_vif
== vif
) {
1616 kfree(info_element
);
1617 info_element
= NULL
;
1620 hif_drv
->hif_state
= HOST_IF_IDLE
;
1621 scan_while_connected
= false;
1623 } else if ((u8MacStatus
== MAC_DISCONNECTED
) &&
1624 (hif_drv
->usr_scan_req
.scan_result
)) {
1625 del_timer(&hif_drv
->scan_timer
);
1626 if (hif_drv
->usr_scan_req
.scan_result
)
1627 Handle_ScanDone(vif
, SCAN_EVENT_ABORTED
);
1631 kfree(pstrRcvdGnrlAsyncInfo
->buffer
);
1632 pstrRcvdGnrlAsyncInfo
->buffer
= NULL
;
1637 static int Handle_Key(struct wilc_vif
*vif
,
1638 struct key_attr
*pstrHostIFkeyAttr
)
1642 struct wid strWIDList
[5];
1647 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
1649 switch (pstrHostIFkeyAttr
->type
) {
1652 if (pstrHostIFkeyAttr
->action
& ADDKEY_AP
) {
1653 strWIDList
[0].id
= (u16
)WID_11I_MODE
;
1654 strWIDList
[0].type
= WID_CHAR
;
1655 strWIDList
[0].size
= sizeof(char);
1656 strWIDList
[0].val
= (s8
*)&pstrHostIFkeyAttr
->attr
.wep
.mode
;
1658 strWIDList
[1].id
= WID_AUTH_TYPE
;
1659 strWIDList
[1].type
= WID_CHAR
;
1660 strWIDList
[1].size
= sizeof(char);
1661 strWIDList
[1].val
= (s8
*)&pstrHostIFkeyAttr
->attr
.wep
.auth_type
;
1663 pu8keybuf
= kmalloc(pstrHostIFkeyAttr
->attr
.wep
.key_len
+ 2,
1666 if (pu8keybuf
== NULL
) {
1667 PRINT_ER("No buffer to send Key\n");
1671 pu8keybuf
[0] = pstrHostIFkeyAttr
->attr
.wep
.index
;
1672 pu8keybuf
[1] = pstrHostIFkeyAttr
->attr
.wep
.key_len
;
1674 memcpy(&pu8keybuf
[2], pstrHostIFkeyAttr
->attr
.wep
.key
,
1675 pstrHostIFkeyAttr
->attr
.wep
.key_len
);
1677 kfree(pstrHostIFkeyAttr
->attr
.wep
.key
);
1679 strWIDList
[2].id
= (u16
)WID_WEP_KEY_VALUE
;
1680 strWIDList
[2].type
= WID_STR
;
1681 strWIDList
[2].size
= pstrHostIFkeyAttr
->attr
.wep
.key_len
+ 2;
1682 strWIDList
[2].val
= (s8
*)pu8keybuf
;
1684 result
= wilc_send_config_pkt(vif
, SET_CFG
,
1686 wilc_get_vif_idx(vif
));
1688 } else if (pstrHostIFkeyAttr
->action
& ADDKEY
) {
1689 pu8keybuf
= kmalloc(pstrHostIFkeyAttr
->attr
.wep
.key_len
+ 2, GFP_KERNEL
);
1691 PRINT_ER("No buffer to send Key\n");
1694 pu8keybuf
[0] = pstrHostIFkeyAttr
->attr
.wep
.index
;
1695 memcpy(pu8keybuf
+ 1, &pstrHostIFkeyAttr
->attr
.wep
.key_len
, 1);
1696 memcpy(pu8keybuf
+ 2, pstrHostIFkeyAttr
->attr
.wep
.key
,
1697 pstrHostIFkeyAttr
->attr
.wep
.key_len
);
1698 kfree(pstrHostIFkeyAttr
->attr
.wep
.key
);
1700 wid
.id
= (u16
)WID_ADD_WEP_KEY
;
1702 wid
.val
= (s8
*)pu8keybuf
;
1703 wid
.size
= pstrHostIFkeyAttr
->attr
.wep
.key_len
+ 2;
1705 result
= wilc_send_config_pkt(vif
, SET_CFG
,
1707 wilc_get_vif_idx(vif
));
1709 } else if (pstrHostIFkeyAttr
->action
& REMOVEKEY
) {
1710 wid
.id
= (u16
)WID_REMOVE_WEP_KEY
;
1713 s8idxarray
[0] = (s8
)pstrHostIFkeyAttr
->attr
.wep
.index
;
1714 wid
.val
= s8idxarray
;
1717 result
= wilc_send_config_pkt(vif
, SET_CFG
,
1719 wilc_get_vif_idx(vif
));
1720 } else if (pstrHostIFkeyAttr
->action
& DEFAULTKEY
) {
1721 wid
.id
= (u16
)WID_KEY_ID
;
1722 wid
.type
= WID_CHAR
;
1723 wid
.val
= (s8
*)&pstrHostIFkeyAttr
->attr
.wep
.index
;
1724 wid
.size
= sizeof(char);
1726 result
= wilc_send_config_pkt(vif
, SET_CFG
,
1728 wilc_get_vif_idx(vif
));
1730 up(&hif_drv
->sem_test_key_block
);
1734 if (pstrHostIFkeyAttr
->action
& ADDKEY_AP
) {
1735 pu8keybuf
= kzalloc(RX_MIC_KEY_MSG_LEN
, GFP_KERNEL
);
1737 PRINT_ER("No buffer to send RxGTK Key\n");
1739 goto _WPARxGtk_end_case_
;
1742 if (pstrHostIFkeyAttr
->attr
.wpa
.seq
)
1743 memcpy(pu8keybuf
+ 6, pstrHostIFkeyAttr
->attr
.wpa
.seq
, 8);
1745 memcpy(pu8keybuf
+ 14, &pstrHostIFkeyAttr
->attr
.wpa
.index
, 1);
1746 memcpy(pu8keybuf
+ 15, &pstrHostIFkeyAttr
->attr
.wpa
.key_len
, 1);
1747 memcpy(pu8keybuf
+ 16, pstrHostIFkeyAttr
->attr
.wpa
.key
,
1748 pstrHostIFkeyAttr
->attr
.wpa
.key_len
);
1750 strWIDList
[0].id
= (u16
)WID_11I_MODE
;
1751 strWIDList
[0].type
= WID_CHAR
;
1752 strWIDList
[0].size
= sizeof(char);
1753 strWIDList
[0].val
= (s8
*)&pstrHostIFkeyAttr
->attr
.wpa
.mode
;
1755 strWIDList
[1].id
= (u16
)WID_ADD_RX_GTK
;
1756 strWIDList
[1].type
= WID_STR
;
1757 strWIDList
[1].val
= (s8
*)pu8keybuf
;
1758 strWIDList
[1].size
= RX_MIC_KEY_MSG_LEN
;
1760 result
= wilc_send_config_pkt(vif
, SET_CFG
,
1762 wilc_get_vif_idx(vif
));
1765 up(&hif_drv
->sem_test_key_block
);
1766 } else if (pstrHostIFkeyAttr
->action
& ADDKEY
) {
1767 pu8keybuf
= kzalloc(RX_MIC_KEY_MSG_LEN
, GFP_KERNEL
);
1768 if (pu8keybuf
== NULL
) {
1769 PRINT_ER("No buffer to send RxGTK Key\n");
1771 goto _WPARxGtk_end_case_
;
1774 if (hif_drv
->hif_state
== HOST_IF_CONNECTED
)
1775 memcpy(pu8keybuf
, hif_drv
->assoc_bssid
, ETH_ALEN
);
1777 PRINT_ER("Couldn't handle WPARxGtk while state is not HOST_IF_CONNECTED\n");
1779 memcpy(pu8keybuf
+ 6, pstrHostIFkeyAttr
->attr
.wpa
.seq
, 8);
1780 memcpy(pu8keybuf
+ 14, &pstrHostIFkeyAttr
->attr
.wpa
.index
, 1);
1781 memcpy(pu8keybuf
+ 15, &pstrHostIFkeyAttr
->attr
.wpa
.key_len
, 1);
1782 memcpy(pu8keybuf
+ 16, pstrHostIFkeyAttr
->attr
.wpa
.key
,
1783 pstrHostIFkeyAttr
->attr
.wpa
.key_len
);
1785 wid
.id
= (u16
)WID_ADD_RX_GTK
;
1787 wid
.val
= (s8
*)pu8keybuf
;
1788 wid
.size
= RX_MIC_KEY_MSG_LEN
;
1790 result
= wilc_send_config_pkt(vif
, SET_CFG
,
1792 wilc_get_vif_idx(vif
));
1795 up(&hif_drv
->sem_test_key_block
);
1797 _WPARxGtk_end_case_
:
1798 kfree(pstrHostIFkeyAttr
->attr
.wpa
.key
);
1799 kfree(pstrHostIFkeyAttr
->attr
.wpa
.seq
);
1806 if (pstrHostIFkeyAttr
->action
& ADDKEY_AP
) {
1807 pu8keybuf
= kmalloc(PTK_KEY_MSG_LEN
+ 1, GFP_KERNEL
);
1809 PRINT_ER("No buffer to send PTK Key\n");
1811 goto _WPAPtk_end_case_
;
1814 memcpy(pu8keybuf
, pstrHostIFkeyAttr
->attr
.wpa
.mac_addr
, 6);
1815 memcpy(pu8keybuf
+ 6, &pstrHostIFkeyAttr
->attr
.wpa
.index
, 1);
1816 memcpy(pu8keybuf
+ 7, &pstrHostIFkeyAttr
->attr
.wpa
.key_len
, 1);
1817 memcpy(pu8keybuf
+ 8, pstrHostIFkeyAttr
->attr
.wpa
.key
,
1818 pstrHostIFkeyAttr
->attr
.wpa
.key_len
);
1820 strWIDList
[0].id
= (u16
)WID_11I_MODE
;
1821 strWIDList
[0].type
= WID_CHAR
;
1822 strWIDList
[0].size
= sizeof(char);
1823 strWIDList
[0].val
= (s8
*)&pstrHostIFkeyAttr
->attr
.wpa
.mode
;
1825 strWIDList
[1].id
= (u16
)WID_ADD_PTK
;
1826 strWIDList
[1].type
= WID_STR
;
1827 strWIDList
[1].val
= (s8
*)pu8keybuf
;
1828 strWIDList
[1].size
= PTK_KEY_MSG_LEN
+ 1;
1830 result
= wilc_send_config_pkt(vif
, SET_CFG
,
1832 wilc_get_vif_idx(vif
));
1834 up(&hif_drv
->sem_test_key_block
);
1835 } else if (pstrHostIFkeyAttr
->action
& ADDKEY
) {
1836 pu8keybuf
= kmalloc(PTK_KEY_MSG_LEN
, GFP_KERNEL
);
1838 PRINT_ER("No buffer to send PTK Key\n");
1840 goto _WPAPtk_end_case_
;
1843 memcpy(pu8keybuf
, pstrHostIFkeyAttr
->attr
.wpa
.mac_addr
, 6);
1844 memcpy(pu8keybuf
+ 6, &pstrHostIFkeyAttr
->attr
.wpa
.key_len
, 1);
1845 memcpy(pu8keybuf
+ 7, pstrHostIFkeyAttr
->attr
.wpa
.key
,
1846 pstrHostIFkeyAttr
->attr
.wpa
.key_len
);
1848 wid
.id
= (u16
)WID_ADD_PTK
;
1850 wid
.val
= (s8
*)pu8keybuf
;
1851 wid
.size
= PTK_KEY_MSG_LEN
;
1853 result
= wilc_send_config_pkt(vif
, SET_CFG
,
1855 wilc_get_vif_idx(vif
));
1857 up(&hif_drv
->sem_test_key_block
);
1861 kfree(pstrHostIFkeyAttr
->attr
.wpa
.key
);
1868 pu8keybuf
= kmalloc((pstrHostIFkeyAttr
->attr
.pmkid
.numpmkid
* PMKSA_KEY_LEN
) + 1, GFP_KERNEL
);
1870 PRINT_ER("No buffer to send PMKSA Key\n");
1874 pu8keybuf
[0] = pstrHostIFkeyAttr
->attr
.pmkid
.numpmkid
;
1876 for (i
= 0; i
< pstrHostIFkeyAttr
->attr
.pmkid
.numpmkid
; i
++) {
1877 memcpy(pu8keybuf
+ ((PMKSA_KEY_LEN
* i
) + 1), pstrHostIFkeyAttr
->attr
.pmkid
.pmkidlist
[i
].bssid
, ETH_ALEN
);
1878 memcpy(pu8keybuf
+ ((PMKSA_KEY_LEN
* i
) + ETH_ALEN
+ 1), pstrHostIFkeyAttr
->attr
.pmkid
.pmkidlist
[i
].pmkid
, PMKID_LEN
);
1881 wid
.id
= (u16
)WID_PMKID_INFO
;
1883 wid
.val
= (s8
*)pu8keybuf
;
1884 wid
.size
= (pstrHostIFkeyAttr
->attr
.pmkid
.numpmkid
* PMKSA_KEY_LEN
) + 1;
1886 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
1887 wilc_get_vif_idx(vif
));
1894 PRINT_ER("Failed to send key config packet\n");
1899 static void Handle_Disconnect(struct wilc_vif
*vif
)
1902 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
1905 u16 u16DummyReasonCode
= 0;
1907 wid
.id
= (u16
)WID_DISCONNECT
;
1908 wid
.type
= WID_CHAR
;
1909 wid
.val
= (s8
*)&u16DummyReasonCode
;
1910 wid
.size
= sizeof(char);
1912 wilc_optaining_ip
= false;
1913 wilc_set_power_mgmt(vif
, 0, 0);
1915 eth_zero_addr(wilc_connected_ssid
);
1917 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
1918 wilc_get_vif_idx(vif
));
1921 PRINT_ER("Failed to send dissconect config packet\n");
1923 tstrDisconnectNotifInfo strDisconnectNotifInfo
;
1925 memset(&strDisconnectNotifInfo
, 0, sizeof(tstrDisconnectNotifInfo
));
1927 strDisconnectNotifInfo
.u16reason
= 0;
1928 strDisconnectNotifInfo
.ie
= NULL
;
1929 strDisconnectNotifInfo
.ie_len
= 0;
1931 if (hif_drv
->usr_scan_req
.scan_result
) {
1932 del_timer(&hif_drv
->scan_timer
);
1933 hif_drv
->usr_scan_req
.scan_result(SCAN_EVENT_ABORTED
,
1935 hif_drv
->usr_scan_req
.arg
,
1937 hif_drv
->usr_scan_req
.scan_result
= NULL
;
1940 if (hif_drv
->usr_conn_req
.conn_result
) {
1941 if (hif_drv
->hif_state
== HOST_IF_WAITING_CONN_RESP
)
1942 del_timer(&hif_drv
->connect_timer
);
1944 hif_drv
->usr_conn_req
.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF
,
1947 &strDisconnectNotifInfo
,
1948 hif_drv
->usr_conn_req
.arg
);
1950 PRINT_ER("usr_conn_req.conn_result = NULL\n");
1953 scan_while_connected
= false;
1955 hif_drv
->hif_state
= HOST_IF_IDLE
;
1957 eth_zero_addr(hif_drv
->assoc_bssid
);
1959 hif_drv
->usr_conn_req
.ssid_len
= 0;
1960 kfree(hif_drv
->usr_conn_req
.pu8ssid
);
1961 hif_drv
->usr_conn_req
.pu8ssid
= NULL
;
1962 kfree(hif_drv
->usr_conn_req
.pu8bssid
);
1963 hif_drv
->usr_conn_req
.pu8bssid
= NULL
;
1964 hif_drv
->usr_conn_req
.ies_len
= 0;
1965 kfree(hif_drv
->usr_conn_req
.ies
);
1966 hif_drv
->usr_conn_req
.ies
= NULL
;
1968 if (join_req
&& join_req_vif
== vif
) {
1973 if (info_element
&& join_req_vif
== vif
) {
1974 kfree(info_element
);
1975 info_element
= NULL
;
1979 up(&hif_drv
->sem_test_disconn_block
);
1982 void wilc_resolve_disconnect_aberration(struct wilc_vif
*vif
)
1986 if ((vif
->hif_drv
->hif_state
== HOST_IF_WAITING_CONN_RESP
) ||
1987 (vif
->hif_drv
->hif_state
== HOST_IF_CONNECTING
))
1988 wilc_disconnect(vif
, 1);
1991 static s32
Handle_GetChnl(struct wilc_vif
*vif
)
1995 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
1997 wid
.id
= (u16
)WID_CURRENT_CHANNEL
;
1998 wid
.type
= WID_CHAR
;
1999 wid
.val
= (s8
*)&ch_no
;
2000 wid
.size
= sizeof(char);
2002 result
= wilc_send_config_pkt(vif
, GET_CFG
, &wid
, 1,
2003 wilc_get_vif_idx(vif
));
2006 PRINT_ER("Failed to get channel number\n");
2010 up(&hif_drv
->sem_get_chnl
);
2015 static void Handle_GetRssi(struct wilc_vif
*vif
)
2020 wid
.id
= (u16
)WID_RSSI
;
2021 wid
.type
= WID_CHAR
;
2023 wid
.size
= sizeof(char);
2025 result
= wilc_send_config_pkt(vif
, GET_CFG
, &wid
, 1,
2026 wilc_get_vif_idx(vif
));
2028 PRINT_ER("Failed to get RSSI value\n");
2032 up(&vif
->hif_drv
->sem_get_rssi
);
2035 static void Handle_GetLinkspeed(struct wilc_vif
*vif
)
2039 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
2043 wid
.id
= (u16
)WID_LINKSPEED
;
2044 wid
.type
= WID_CHAR
;
2045 wid
.val
= &link_speed
;
2046 wid
.size
= sizeof(char);
2048 result
= wilc_send_config_pkt(vif
, GET_CFG
, &wid
, 1,
2049 wilc_get_vif_idx(vif
));
2051 PRINT_ER("Failed to get LINKSPEED value\n");
2055 up(&hif_drv
->sem_get_link_speed
);
2058 static s32
Handle_GetStatistics(struct wilc_vif
*vif
,
2059 struct rf_info
*pstrStatistics
)
2061 struct wid strWIDList
[5];
2062 u32 u32WidsCount
= 0, result
= 0;
2064 strWIDList
[u32WidsCount
].id
= WID_LINKSPEED
;
2065 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
2066 strWIDList
[u32WidsCount
].size
= sizeof(char);
2067 strWIDList
[u32WidsCount
].val
= (s8
*)&pstrStatistics
->link_speed
;
2070 strWIDList
[u32WidsCount
].id
= WID_RSSI
;
2071 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
2072 strWIDList
[u32WidsCount
].size
= sizeof(char);
2073 strWIDList
[u32WidsCount
].val
= (s8
*)&pstrStatistics
->rssi
;
2076 strWIDList
[u32WidsCount
].id
= WID_SUCCESS_FRAME_COUNT
;
2077 strWIDList
[u32WidsCount
].type
= WID_INT
;
2078 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
2079 strWIDList
[u32WidsCount
].val
= (s8
*)&pstrStatistics
->tx_cnt
;
2082 strWIDList
[u32WidsCount
].id
= WID_RECEIVED_FRAGMENT_COUNT
;
2083 strWIDList
[u32WidsCount
].type
= WID_INT
;
2084 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
2085 strWIDList
[u32WidsCount
].val
= (s8
*)&pstrStatistics
->rx_cnt
;
2088 strWIDList
[u32WidsCount
].id
= WID_FAILED_COUNT
;
2089 strWIDList
[u32WidsCount
].type
= WID_INT
;
2090 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
2091 strWIDList
[u32WidsCount
].val
= (s8
*)&pstrStatistics
->tx_fail_cnt
;
2094 result
= wilc_send_config_pkt(vif
, GET_CFG
, strWIDList
,
2096 wilc_get_vif_idx(vif
));
2099 PRINT_ER("Failed to send scan paramters config packet\n");
2101 if (pstrStatistics
->link_speed
> TCP_ACK_FILTER_LINK_SPEED_THRESH
&&
2102 pstrStatistics
->link_speed
!= DEFAULT_LINK_SPEED
)
2103 wilc_enable_tcp_ack_filter(true);
2104 else if (pstrStatistics
->link_speed
!= DEFAULT_LINK_SPEED
)
2105 wilc_enable_tcp_ack_filter(false);
2107 if (pstrStatistics
!= &vif
->wilc
->dummy_statistics
)
2108 up(&hif_sema_wait_response
);
2112 static s32
Handle_Get_InActiveTime(struct wilc_vif
*vif
,
2113 struct sta_inactive_t
*strHostIfStaInactiveT
)
2118 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
2120 wid
.id
= (u16
)WID_SET_STA_MAC_INACTIVE_TIME
;
2122 wid
.size
= ETH_ALEN
;
2123 wid
.val
= kmalloc(wid
.size
, GFP_KERNEL
);
2126 memcpy(stamac
, strHostIfStaInactiveT
->mac
, ETH_ALEN
);
2128 PRINT_D(CFG80211_DBG
, "SETING STA inactive time\n");
2130 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2131 wilc_get_vif_idx(vif
));
2134 PRINT_ER("Failed to SET incative time\n");
2138 wid
.id
= (u16
)WID_GET_INACTIVE_TIME
;
2140 wid
.val
= (s8
*)&inactive_time
;
2141 wid
.size
= sizeof(u32
);
2143 result
= wilc_send_config_pkt(vif
, GET_CFG
, &wid
, 1,
2144 wilc_get_vif_idx(vif
));
2147 PRINT_ER("Failed to get incative time\n");
2151 PRINT_D(CFG80211_DBG
, "Getting inactive time : %d\n", inactive_time
);
2153 up(&hif_drv
->sem_inactive_time
);
2158 static void Handle_AddBeacon(struct wilc_vif
*vif
,
2159 struct beacon_attr
*pstrSetBeaconParam
)
2165 wid
.id
= (u16
)WID_ADD_BEACON
;
2167 wid
.size
= pstrSetBeaconParam
->head_len
+ pstrSetBeaconParam
->tail_len
+ 16;
2168 wid
.val
= kmalloc(wid
.size
, GFP_KERNEL
);
2172 pu8CurrByte
= wid
.val
;
2173 *pu8CurrByte
++ = (pstrSetBeaconParam
->interval
& 0xFF);
2174 *pu8CurrByte
++ = ((pstrSetBeaconParam
->interval
>> 8) & 0xFF);
2175 *pu8CurrByte
++ = ((pstrSetBeaconParam
->interval
>> 16) & 0xFF);
2176 *pu8CurrByte
++ = ((pstrSetBeaconParam
->interval
>> 24) & 0xFF);
2178 *pu8CurrByte
++ = (pstrSetBeaconParam
->dtim_period
& 0xFF);
2179 *pu8CurrByte
++ = ((pstrSetBeaconParam
->dtim_period
>> 8) & 0xFF);
2180 *pu8CurrByte
++ = ((pstrSetBeaconParam
->dtim_period
>> 16) & 0xFF);
2181 *pu8CurrByte
++ = ((pstrSetBeaconParam
->dtim_period
>> 24) & 0xFF);
2183 *pu8CurrByte
++ = (pstrSetBeaconParam
->head_len
& 0xFF);
2184 *pu8CurrByte
++ = ((pstrSetBeaconParam
->head_len
>> 8) & 0xFF);
2185 *pu8CurrByte
++ = ((pstrSetBeaconParam
->head_len
>> 16) & 0xFF);
2186 *pu8CurrByte
++ = ((pstrSetBeaconParam
->head_len
>> 24) & 0xFF);
2188 memcpy(pu8CurrByte
, pstrSetBeaconParam
->head
, pstrSetBeaconParam
->head_len
);
2189 pu8CurrByte
+= pstrSetBeaconParam
->head_len
;
2191 *pu8CurrByte
++ = (pstrSetBeaconParam
->tail_len
& 0xFF);
2192 *pu8CurrByte
++ = ((pstrSetBeaconParam
->tail_len
>> 8) & 0xFF);
2193 *pu8CurrByte
++ = ((pstrSetBeaconParam
->tail_len
>> 16) & 0xFF);
2194 *pu8CurrByte
++ = ((pstrSetBeaconParam
->tail_len
>> 24) & 0xFF);
2196 if (pstrSetBeaconParam
->tail
)
2197 memcpy(pu8CurrByte
, pstrSetBeaconParam
->tail
, pstrSetBeaconParam
->tail_len
);
2198 pu8CurrByte
+= pstrSetBeaconParam
->tail_len
;
2200 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2201 wilc_get_vif_idx(vif
));
2203 PRINT_ER("Failed to send add beacon config packet\n");
2207 kfree(pstrSetBeaconParam
->head
);
2208 kfree(pstrSetBeaconParam
->tail
);
2211 static void Handle_DelBeacon(struct wilc_vif
*vif
)
2217 wid
.id
= (u16
)WID_DEL_BEACON
;
2218 wid
.type
= WID_CHAR
;
2219 wid
.size
= sizeof(char);
2220 wid
.val
= &del_beacon
;
2225 pu8CurrByte
= wid
.val
;
2227 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2228 wilc_get_vif_idx(vif
));
2230 PRINT_ER("Failed to send delete beacon config packet\n");
2233 static u32
WILC_HostIf_PackStaParam(u8
*pu8Buffer
,
2234 struct add_sta_param
*pstrStationParam
)
2238 pu8CurrByte
= pu8Buffer
;
2240 memcpy(pu8CurrByte
, pstrStationParam
->bssid
, ETH_ALEN
);
2241 pu8CurrByte
+= ETH_ALEN
;
2243 *pu8CurrByte
++ = pstrStationParam
->aid
& 0xFF;
2244 *pu8CurrByte
++ = (pstrStationParam
->aid
>> 8) & 0xFF;
2246 *pu8CurrByte
++ = pstrStationParam
->rates_len
;
2247 if (pstrStationParam
->rates_len
> 0)
2248 memcpy(pu8CurrByte
, pstrStationParam
->rates
,
2249 pstrStationParam
->rates_len
);
2250 pu8CurrByte
+= pstrStationParam
->rates_len
;
2252 *pu8CurrByte
++ = pstrStationParam
->ht_supported
;
2253 *pu8CurrByte
++ = pstrStationParam
->ht_capa_info
& 0xFF;
2254 *pu8CurrByte
++ = (pstrStationParam
->ht_capa_info
>> 8) & 0xFF;
2256 *pu8CurrByte
++ = pstrStationParam
->ht_ampdu_params
;
2257 memcpy(pu8CurrByte
, pstrStationParam
->ht_supp_mcs_set
,
2258 WILC_SUPP_MCS_SET_SIZE
);
2259 pu8CurrByte
+= WILC_SUPP_MCS_SET_SIZE
;
2261 *pu8CurrByte
++ = pstrStationParam
->ht_ext_params
& 0xFF;
2262 *pu8CurrByte
++ = (pstrStationParam
->ht_ext_params
>> 8) & 0xFF;
2264 *pu8CurrByte
++ = pstrStationParam
->ht_tx_bf_cap
& 0xFF;
2265 *pu8CurrByte
++ = (pstrStationParam
->ht_tx_bf_cap
>> 8) & 0xFF;
2266 *pu8CurrByte
++ = (pstrStationParam
->ht_tx_bf_cap
>> 16) & 0xFF;
2267 *pu8CurrByte
++ = (pstrStationParam
->ht_tx_bf_cap
>> 24) & 0xFF;
2269 *pu8CurrByte
++ = pstrStationParam
->ht_ante_sel
;
2271 *pu8CurrByte
++ = pstrStationParam
->flags_mask
& 0xFF;
2272 *pu8CurrByte
++ = (pstrStationParam
->flags_mask
>> 8) & 0xFF;
2274 *pu8CurrByte
++ = pstrStationParam
->flags_set
& 0xFF;
2275 *pu8CurrByte
++ = (pstrStationParam
->flags_set
>> 8) & 0xFF;
2277 return pu8CurrByte
- pu8Buffer
;
2280 static void Handle_AddStation(struct wilc_vif
*vif
,
2281 struct add_sta_param
*pstrStationParam
)
2287 wid
.id
= (u16
)WID_ADD_STA
;
2289 wid
.size
= WILC_ADD_STA_LENGTH
+ pstrStationParam
->rates_len
;
2291 wid
.val
= kmalloc(wid
.size
, GFP_KERNEL
);
2295 pu8CurrByte
= wid
.val
;
2296 pu8CurrByte
+= WILC_HostIf_PackStaParam(pu8CurrByte
, pstrStationParam
);
2298 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2299 wilc_get_vif_idx(vif
));
2301 PRINT_ER("Failed to send add station config packet\n");
2304 kfree(pstrStationParam
->rates
);
2308 static void Handle_DelAllSta(struct wilc_vif
*vif
,
2309 struct del_all_sta
*pstrDelAllStaParam
)
2315 u8 au8Zero_Buff
[6] = {0};
2317 wid
.id
= (u16
)WID_DEL_ALL_STA
;
2319 wid
.size
= (pstrDelAllStaParam
->assoc_sta
* ETH_ALEN
) + 1;
2321 wid
.val
= kmalloc((pstrDelAllStaParam
->assoc_sta
* ETH_ALEN
) + 1, GFP_KERNEL
);
2325 pu8CurrByte
= wid
.val
;
2327 *(pu8CurrByte
++) = pstrDelAllStaParam
->assoc_sta
;
2329 for (i
= 0; i
< MAX_NUM_STA
; i
++) {
2330 if (memcmp(pstrDelAllStaParam
->del_all_sta
[i
], au8Zero_Buff
, ETH_ALEN
))
2331 memcpy(pu8CurrByte
, pstrDelAllStaParam
->del_all_sta
[i
], ETH_ALEN
);
2335 pu8CurrByte
+= ETH_ALEN
;
2338 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2339 wilc_get_vif_idx(vif
));
2341 PRINT_ER("Failed to send add station config packet\n");
2346 up(&hif_sema_wait_response
);
2349 static void Handle_DelStation(struct wilc_vif
*vif
,
2350 struct del_sta
*pstrDelStaParam
)
2356 wid
.id
= (u16
)WID_REMOVE_STA
;
2358 wid
.size
= ETH_ALEN
;
2360 wid
.val
= kmalloc(wid
.size
, GFP_KERNEL
);
2364 pu8CurrByte
= wid
.val
;
2366 memcpy(pu8CurrByte
, pstrDelStaParam
->mac_addr
, ETH_ALEN
);
2368 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2369 wilc_get_vif_idx(vif
));
2371 PRINT_ER("Failed to send add station config packet\n");
2377 static void Handle_EditStation(struct wilc_vif
*vif
,
2378 struct add_sta_param
*pstrStationParam
)
2384 wid
.id
= (u16
)WID_EDIT_STA
;
2386 wid
.size
= WILC_ADD_STA_LENGTH
+ pstrStationParam
->rates_len
;
2388 wid
.val
= kmalloc(wid
.size
, GFP_KERNEL
);
2392 pu8CurrByte
= wid
.val
;
2393 pu8CurrByte
+= WILC_HostIf_PackStaParam(pu8CurrByte
, pstrStationParam
);
2395 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2396 wilc_get_vif_idx(vif
));
2398 PRINT_ER("Failed to send edit station config packet\n");
2401 kfree(pstrStationParam
->rates
);
2405 static int Handle_RemainOnChan(struct wilc_vif
*vif
,
2406 struct remain_ch
*pstrHostIfRemainOnChan
)
2409 u8 u8remain_on_chan_flag
;
2411 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
2413 if (!hif_drv
->remain_on_ch_pending
) {
2414 hif_drv
->remain_on_ch
.arg
= pstrHostIfRemainOnChan
->arg
;
2415 hif_drv
->remain_on_ch
.expired
= pstrHostIfRemainOnChan
->expired
;
2416 hif_drv
->remain_on_ch
.ready
= pstrHostIfRemainOnChan
->ready
;
2417 hif_drv
->remain_on_ch
.ch
= pstrHostIfRemainOnChan
->ch
;
2418 hif_drv
->remain_on_ch
.id
= pstrHostIfRemainOnChan
->id
;
2420 pstrHostIfRemainOnChan
->ch
= hif_drv
->remain_on_ch
.ch
;
2423 if (hif_drv
->usr_scan_req
.scan_result
) {
2424 PRINT_INFO(GENERIC_DBG
, "Required to remain on chan while scanning return\n");
2425 hif_drv
->remain_on_ch_pending
= 1;
2429 if (hif_drv
->hif_state
== HOST_IF_WAITING_CONN_RESP
) {
2430 PRINT_INFO(GENERIC_DBG
, "Required to remain on chan while connecting return\n");
2435 if (wilc_optaining_ip
|| wilc_connecting
) {
2436 PRINT_D(GENERIC_DBG
, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
2441 u8remain_on_chan_flag
= true;
2442 wid
.id
= (u16
)WID_REMAIN_ON_CHAN
;
2445 wid
.val
= kmalloc(wid
.size
, GFP_KERNEL
);
2451 wid
.val
[0] = u8remain_on_chan_flag
;
2452 wid
.val
[1] = (s8
)pstrHostIfRemainOnChan
->ch
;
2454 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2455 wilc_get_vif_idx(vif
));
2457 PRINT_ER("Failed to set remain on channel\n");
2461 P2P_LISTEN_STATE
= 1;
2462 hif_drv
->remain_on_ch_timer
.data
= (unsigned long)vif
;
2463 mod_timer(&hif_drv
->remain_on_ch_timer
,
2465 msecs_to_jiffies(pstrHostIfRemainOnChan
->duration
));
2467 if (hif_drv
->remain_on_ch
.ready
)
2468 hif_drv
->remain_on_ch
.ready(hif_drv
->remain_on_ch
.arg
);
2470 if (hif_drv
->remain_on_ch_pending
)
2471 hif_drv
->remain_on_ch_pending
= 0;
2477 static int Handle_RegisterFrame(struct wilc_vif
*vif
,
2478 struct reg_frame
*pstrHostIfRegisterFrame
)
2484 wid
.id
= (u16
)WID_REGISTER_FRAME
;
2486 wid
.val
= kmalloc(sizeof(u16
) + 2, GFP_KERNEL
);
2490 pu8CurrByte
= wid
.val
;
2492 *pu8CurrByte
++ = pstrHostIfRegisterFrame
->reg
;
2493 *pu8CurrByte
++ = pstrHostIfRegisterFrame
->reg_id
;
2494 memcpy(pu8CurrByte
, &pstrHostIfRegisterFrame
->frame_type
, sizeof(u16
));
2496 wid
.size
= sizeof(u16
) + 2;
2498 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2499 wilc_get_vif_idx(vif
));
2501 PRINT_ER("Failed to frame register config packet\n");
2508 static u32
Handle_ListenStateExpired(struct wilc_vif
*vif
,
2509 struct remain_ch
*pstrHostIfRemainOnChan
)
2511 u8 u8remain_on_chan_flag
;
2514 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
2516 if (P2P_LISTEN_STATE
) {
2517 u8remain_on_chan_flag
= false;
2518 wid
.id
= (u16
)WID_REMAIN_ON_CHAN
;
2521 wid
.val
= kmalloc(wid
.size
, GFP_KERNEL
);
2524 PRINT_ER("Failed to allocate memory\n");
2528 wid
.val
[0] = u8remain_on_chan_flag
;
2529 wid
.val
[1] = FALSE_FRMWR_CHANNEL
;
2531 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2532 wilc_get_vif_idx(vif
));
2534 PRINT_ER("Failed to set remain on channel\n");
2538 if (hif_drv
->remain_on_ch
.expired
) {
2539 hif_drv
->remain_on_ch
.expired(hif_drv
->remain_on_ch
.arg
,
2540 pstrHostIfRemainOnChan
->id
);
2542 P2P_LISTEN_STATE
= 0;
2544 PRINT_D(GENERIC_DBG
, "Not in listen state\n");
2552 static void ListenTimerCB(unsigned long arg
)
2555 struct host_if_msg msg
;
2556 struct wilc_vif
*vif
= (struct wilc_vif
*)arg
;
2558 del_timer(&vif
->hif_drv
->remain_on_ch_timer
);
2560 memset(&msg
, 0, sizeof(struct host_if_msg
));
2561 msg
.id
= HOST_IF_MSG_LISTEN_TIMER_FIRED
;
2563 msg
.body
.remain_on_ch
.id
= vif
->hif_drv
->remain_on_ch
.id
;
2565 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2567 PRINT_ER("wilc_mq_send fail\n");
2570 static void Handle_PowerManagement(struct wilc_vif
*vif
,
2571 struct power_mgmt_param
*strPowerMgmtParam
)
2577 wid
.id
= (u16
)WID_POWER_MANAGEMENT
;
2579 if (strPowerMgmtParam
->enabled
)
2580 s8PowerMode
= MIN_FAST_PS
;
2582 s8PowerMode
= NO_POWERSAVE
;
2584 wid
.val
= &s8PowerMode
;
2585 wid
.size
= sizeof(char);
2587 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2588 wilc_get_vif_idx(vif
));
2590 PRINT_ER("Failed to send power management config packet\n");
2593 static void Handle_SetMulticastFilter(struct wilc_vif
*vif
,
2594 struct set_multicast
*strHostIfSetMulti
)
2600 wid
.id
= (u16
)WID_SETUP_MULTICAST_FILTER
;
2602 wid
.size
= sizeof(struct set_multicast
) + ((strHostIfSetMulti
->cnt
) * ETH_ALEN
);
2603 wid
.val
= kmalloc(wid
.size
, GFP_KERNEL
);
2607 pu8CurrByte
= wid
.val
;
2608 *pu8CurrByte
++ = (strHostIfSetMulti
->enabled
& 0xFF);
2613 *pu8CurrByte
++ = (strHostIfSetMulti
->cnt
& 0xFF);
2614 *pu8CurrByte
++ = ((strHostIfSetMulti
->cnt
>> 8) & 0xFF);
2615 *pu8CurrByte
++ = ((strHostIfSetMulti
->cnt
>> 16) & 0xFF);
2616 *pu8CurrByte
++ = ((strHostIfSetMulti
->cnt
>> 24) & 0xFF);
2618 if ((strHostIfSetMulti
->cnt
) > 0)
2619 memcpy(pu8CurrByte
, wilc_multicast_mac_addr_list
,
2620 ((strHostIfSetMulti
->cnt
) * ETH_ALEN
));
2622 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2623 wilc_get_vif_idx(vif
));
2625 PRINT_ER("Failed to send setup multicast config packet\n");
2631 static s32
Handle_DelAllRxBASessions(struct wilc_vif
*vif
,
2632 struct ba_session_info
*strHostIfBASessionInfo
)
2638 PRINT_D(GENERIC_DBG
, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n",
2639 strHostIfBASessionInfo
->bssid
[0],
2640 strHostIfBASessionInfo
->bssid
[1],
2641 strHostIfBASessionInfo
->bssid
[2],
2642 strHostIfBASessionInfo
->tid
);
2644 wid
.id
= (u16
)WID_DEL_ALL_RX_BA
;
2646 wid
.val
= kmalloc(BLOCK_ACK_REQ_SIZE
, GFP_KERNEL
);
2647 wid
.size
= BLOCK_ACK_REQ_SIZE
;
2652 memcpy(ptr
, strHostIfBASessionInfo
->bssid
, ETH_ALEN
);
2654 *ptr
++ = strHostIfBASessionInfo
->tid
;
2658 result
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2659 wilc_get_vif_idx(vif
));
2663 up(&hif_sema_wait_response
);
2668 static void handle_set_tx_pwr(struct wilc_vif
*vif
, u8 tx_pwr
)
2673 wid
.id
= (u16
)WID_TX_POWER
;
2674 wid
.type
= WID_CHAR
;
2676 wid
.size
= sizeof(char);
2678 ret
= wilc_send_config_pkt(vif
, SET_CFG
, &wid
, 1,
2679 wilc_get_vif_idx(vif
));
2681 netdev_err(vif
->ndev
, "Failed to set TX PWR\n");
2684 static void handle_get_tx_pwr(struct wilc_vif
*vif
, u8
*tx_pwr
)
2689 wid
.id
= (u16
)WID_TX_POWER
;
2690 wid
.type
= WID_CHAR
;
2691 wid
.val
= (s8
*)tx_pwr
;
2692 wid
.size
= sizeof(char);
2694 ret
= wilc_send_config_pkt(vif
, GET_CFG
, &wid
, 1,
2695 wilc_get_vif_idx(vif
));
2697 netdev_err(vif
->ndev
, "Failed to get TX PWR\n");
2699 up(&hif_sema_wait_response
);
2702 static int hostIFthread(void *pvArg
)
2705 struct host_if_msg msg
;
2706 struct wilc
*wilc
= (struct wilc
*)pvArg
;
2707 struct wilc_vif
*vif
;
2709 memset(&msg
, 0, sizeof(struct host_if_msg
));
2712 wilc_mq_recv(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
), &u32Ret
);
2714 if (msg
.id
== HOST_IF_MSG_EXIT
) {
2715 PRINT_D(GENERIC_DBG
, "THREAD: Exiting HostIfThread\n");
2719 if ((!wilc_initialized
)) {
2720 PRINT_D(GENERIC_DBG
, "--WAIT--");
2721 usleep_range(200 * 1000, 200 * 1000);
2722 wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2726 if (msg
.id
== HOST_IF_MSG_CONNECT
&&
2727 vif
->hif_drv
->usr_scan_req
.scan_result
) {
2728 wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2729 usleep_range(2 * 1000, 2 * 1000);
2734 case HOST_IF_MSG_Q_IDLE
:
2735 Handle_wait_msg_q_empty();
2738 case HOST_IF_MSG_SCAN
:
2739 Handle_Scan(msg
.vif
, &msg
.body
.scan_info
);
2742 case HOST_IF_MSG_CONNECT
:
2743 Handle_Connect(msg
.vif
, &msg
.body
.con_info
);
2746 case HOST_IF_MSG_FLUSH_CONNECT
:
2747 Handle_FlushConnect(msg
.vif
);
2750 case HOST_IF_MSG_RCVD_NTWRK_INFO
:
2751 Handle_RcvdNtwrkInfo(msg
.vif
, &msg
.body
.net_info
);
2754 case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO
:
2755 Handle_RcvdGnrlAsyncInfo(vif
,
2756 &msg
.body
.async_info
);
2759 case HOST_IF_MSG_KEY
:
2760 Handle_Key(msg
.vif
, &msg
.body
.key_info
);
2763 case HOST_IF_MSG_CFG_PARAMS
:
2764 handle_cfg_param(msg
.vif
, &msg
.body
.cfg_info
);
2767 case HOST_IF_MSG_SET_CHANNEL
:
2768 handle_set_channel(msg
.vif
, &msg
.body
.channel_info
);
2771 case HOST_IF_MSG_DISCONNECT
:
2772 Handle_Disconnect(msg
.vif
);
2775 case HOST_IF_MSG_RCVD_SCAN_COMPLETE
:
2776 del_timer(&vif
->hif_drv
->scan_timer
);
2778 if (!wilc_wlan_get_num_conn_ifcs(wilc
))
2779 wilc_chip_sleep_manually(wilc
);
2781 Handle_ScanDone(msg
.vif
, SCAN_EVENT_DONE
);
2783 if (vif
->hif_drv
->remain_on_ch_pending
)
2784 Handle_RemainOnChan(msg
.vif
,
2785 &msg
.body
.remain_on_ch
);
2789 case HOST_IF_MSG_GET_RSSI
:
2790 Handle_GetRssi(msg
.vif
);
2793 case HOST_IF_MSG_GET_LINKSPEED
:
2794 Handle_GetLinkspeed(msg
.vif
);
2797 case HOST_IF_MSG_GET_STATISTICS
:
2798 Handle_GetStatistics(msg
.vif
,
2799 (struct rf_info
*)msg
.body
.data
);
2802 case HOST_IF_MSG_GET_CHNL
:
2803 Handle_GetChnl(msg
.vif
);
2806 case HOST_IF_MSG_ADD_BEACON
:
2807 Handle_AddBeacon(msg
.vif
, &msg
.body
.beacon_info
);
2810 case HOST_IF_MSG_DEL_BEACON
:
2811 Handle_DelBeacon(msg
.vif
);
2814 case HOST_IF_MSG_ADD_STATION
:
2815 Handle_AddStation(msg
.vif
, &msg
.body
.add_sta_info
);
2818 case HOST_IF_MSG_DEL_STATION
:
2819 Handle_DelStation(msg
.vif
, &msg
.body
.del_sta_info
);
2822 case HOST_IF_MSG_EDIT_STATION
:
2823 Handle_EditStation(msg
.vif
, &msg
.body
.edit_sta_info
);
2826 case HOST_IF_MSG_GET_INACTIVETIME
:
2827 Handle_Get_InActiveTime(msg
.vif
, &msg
.body
.mac_info
);
2830 case HOST_IF_MSG_SCAN_TIMER_FIRED
:
2832 Handle_ScanDone(msg
.vif
, SCAN_EVENT_ABORTED
);
2835 case HOST_IF_MSG_CONNECT_TIMER_FIRED
:
2836 Handle_ConnectTimeout(msg
.vif
);
2839 case HOST_IF_MSG_POWER_MGMT
:
2840 Handle_PowerManagement(msg
.vif
,
2841 &msg
.body
.pwr_mgmt_info
);
2844 case HOST_IF_MSG_SET_WFIDRV_HANDLER
:
2845 handle_set_wfi_drv_handler(msg
.vif
, &msg
.body
.drv
);
2848 case HOST_IF_MSG_SET_OPERATION_MODE
:
2849 handle_set_operation_mode(msg
.vif
, &msg
.body
.mode
);
2852 case HOST_IF_MSG_SET_IPADDRESS
:
2853 handle_set_ip_address(vif
,
2854 msg
.body
.ip_info
.ip_addr
,
2855 msg
.body
.ip_info
.idx
);
2858 case HOST_IF_MSG_GET_IPADDRESS
:
2859 handle_get_ip_address(vif
, msg
.body
.ip_info
.idx
);
2862 case HOST_IF_MSG_SET_MAC_ADDRESS
:
2863 handle_set_mac_address(msg
.vif
,
2864 &msg
.body
.set_mac_info
);
2867 case HOST_IF_MSG_GET_MAC_ADDRESS
:
2868 handle_get_mac_address(msg
.vif
,
2869 &msg
.body
.get_mac_info
);
2872 case HOST_IF_MSG_REMAIN_ON_CHAN
:
2873 Handle_RemainOnChan(msg
.vif
, &msg
.body
.remain_on_ch
);
2876 case HOST_IF_MSG_REGISTER_FRAME
:
2877 Handle_RegisterFrame(msg
.vif
, &msg
.body
.reg_frame
);
2880 case HOST_IF_MSG_LISTEN_TIMER_FIRED
:
2881 Handle_ListenStateExpired(msg
.vif
, &msg
.body
.remain_on_ch
);
2884 case HOST_IF_MSG_SET_MULTICAST_FILTER
:
2885 Handle_SetMulticastFilter(msg
.vif
, &msg
.body
.multicast_info
);
2888 case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS
:
2889 Handle_DelAllRxBASessions(msg
.vif
, &msg
.body
.session_info
);
2892 case HOST_IF_MSG_DEL_ALL_STA
:
2893 Handle_DelAllSta(msg
.vif
, &msg
.body
.del_all_sta_info
);
2896 case HOST_IF_MSG_SET_TX_POWER
:
2897 handle_set_tx_pwr(msg
.vif
, msg
.body
.tx_power
.tx_pwr
);
2900 case HOST_IF_MSG_GET_TX_POWER
:
2901 handle_get_tx_pwr(msg
.vif
, &msg
.body
.tx_power
.tx_pwr
);
2904 PRINT_ER("[Host Interface] undefined Received Msg ID\n");
2909 up(&hif_sema_thread
);
2913 static void TimerCB_Scan(unsigned long arg
)
2915 struct wilc_vif
*vif
= (struct wilc_vif
*)arg
;
2916 struct host_if_msg msg
;
2918 memset(&msg
, 0, sizeof(struct host_if_msg
));
2920 msg
.id
= HOST_IF_MSG_SCAN_TIMER_FIRED
;
2922 wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2925 static void TimerCB_Connect(unsigned long arg
)
2927 struct wilc_vif
*vif
= (struct wilc_vif
*)arg
;
2928 struct host_if_msg msg
;
2930 memset(&msg
, 0, sizeof(struct host_if_msg
));
2932 msg
.id
= HOST_IF_MSG_CONNECT_TIMER_FIRED
;
2934 wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2937 s32
wilc_remove_key(struct host_if_drv
*hif_drv
, const u8
*pu8StaAddress
)
2941 wid
.id
= (u16
)WID_REMOVE_KEY
;
2943 wid
.val
= (s8
*)pu8StaAddress
;
2949 int wilc_remove_wep_key(struct wilc_vif
*vif
, u8 index
)
2952 struct host_if_msg msg
;
2953 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
2957 PRINT_ER("Failed to send setup multicast config packet\n");
2961 memset(&msg
, 0, sizeof(struct host_if_msg
));
2963 msg
.id
= HOST_IF_MSG_KEY
;
2964 msg
.body
.key_info
.type
= WEP
;
2965 msg
.body
.key_info
.action
= REMOVEKEY
;
2967 msg
.body
.key_info
.attr
.wep
.index
= index
;
2969 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2971 PRINT_ER("Error in sending message queue : Request to remove WEP key\n");
2972 down(&hif_drv
->sem_test_key_block
);
2977 int wilc_set_wep_default_keyid(struct wilc_vif
*vif
, u8 index
)
2980 struct host_if_msg msg
;
2981 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
2985 PRINT_ER("driver is null\n");
2989 memset(&msg
, 0, sizeof(struct host_if_msg
));
2991 msg
.id
= HOST_IF_MSG_KEY
;
2992 msg
.body
.key_info
.type
= WEP
;
2993 msg
.body
.key_info
.action
= DEFAULTKEY
;
2995 msg
.body
.key_info
.attr
.wep
.index
= index
;
2997 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2999 PRINT_ER("Error in sending message queue : Default key index\n");
3000 down(&hif_drv
->sem_test_key_block
);
3005 int wilc_add_wep_key_bss_sta(struct wilc_vif
*vif
, const u8
*key
, u8 len
,
3009 struct host_if_msg msg
;
3010 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3013 PRINT_ER("driver is null\n");
3017 memset(&msg
, 0, sizeof(struct host_if_msg
));
3019 msg
.id
= HOST_IF_MSG_KEY
;
3020 msg
.body
.key_info
.type
= WEP
;
3021 msg
.body
.key_info
.action
= ADDKEY
;
3023 msg
.body
.key_info
.attr
.wep
.key
= kmemdup(key
, len
, GFP_KERNEL
);
3024 if (!msg
.body
.key_info
.attr
.wep
.key
)
3027 msg
.body
.key_info
.attr
.wep
.key_len
= len
;
3028 msg
.body
.key_info
.attr
.wep
.index
= index
;
3030 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3032 PRINT_ER("Error in sending message queue :WEP Key\n");
3033 down(&hif_drv
->sem_test_key_block
);
3038 int wilc_add_wep_key_bss_ap(struct wilc_vif
*vif
, const u8
*key
, u8 len
,
3039 u8 index
, u8 mode
, enum AUTHTYPE auth_type
)
3042 struct host_if_msg msg
;
3043 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3047 PRINT_ER("driver is null\n");
3051 memset(&msg
, 0, sizeof(struct host_if_msg
));
3054 for (i
= 0; i
< len
; i
++)
3055 PRINT_INFO(HOSTAPD_DBG
, "KEY is %x\n", key
[i
]);
3057 msg
.id
= HOST_IF_MSG_KEY
;
3058 msg
.body
.key_info
.type
= WEP
;
3059 msg
.body
.key_info
.action
= ADDKEY_AP
;
3061 msg
.body
.key_info
.attr
.wep
.key
= kmemdup(key
, len
, GFP_KERNEL
);
3062 if (!msg
.body
.key_info
.attr
.wep
.key
)
3065 msg
.body
.key_info
.attr
.wep
.key_len
= len
;
3066 msg
.body
.key_info
.attr
.wep
.index
= index
;
3067 msg
.body
.key_info
.attr
.wep
.mode
= mode
;
3068 msg
.body
.key_info
.attr
.wep
.auth_type
= auth_type
;
3070 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3073 PRINT_ER("Error in sending message queue :WEP Key\n");
3074 down(&hif_drv
->sem_test_key_block
);
3079 int wilc_add_ptk(struct wilc_vif
*vif
, const u8
*ptk
, u8 ptk_key_len
,
3080 const u8
*mac_addr
, const u8
*rx_mic
, const u8
*tx_mic
,
3081 u8 mode
, u8 cipher_mode
, u8 index
)
3084 struct host_if_msg msg
;
3085 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3086 u8 key_len
= ptk_key_len
;
3090 PRINT_ER("driver is null\n");
3095 key_len
+= RX_MIC_KEY_LEN
;
3098 key_len
+= TX_MIC_KEY_LEN
;
3100 memset(&msg
, 0, sizeof(struct host_if_msg
));
3102 msg
.id
= HOST_IF_MSG_KEY
;
3103 msg
.body
.key_info
.type
= WPA_PTK
;
3104 if (mode
== AP_MODE
) {
3105 msg
.body
.key_info
.action
= ADDKEY_AP
;
3106 msg
.body
.key_info
.attr
.wpa
.index
= index
;
3108 if (mode
== STATION_MODE
)
3109 msg
.body
.key_info
.action
= ADDKEY
;
3111 msg
.body
.key_info
.attr
.wpa
.key
= kmemdup(ptk
, ptk_key_len
, GFP_KERNEL
);
3112 if (!msg
.body
.key_info
.attr
.wpa
.key
)
3116 memcpy(msg
.body
.key_info
.attr
.wpa
.key
+ 16, rx_mic
, RX_MIC_KEY_LEN
);
3118 for (i
= 0; i
< RX_MIC_KEY_LEN
; i
++)
3119 PRINT_INFO(CFG80211_DBG
, "PairwiseRx[%d] = %x\n", i
, rx_mic
[i
]);
3123 memcpy(msg
.body
.key_info
.attr
.wpa
.key
+ 24, tx_mic
, TX_MIC_KEY_LEN
);
3125 for (i
= 0; i
< TX_MIC_KEY_LEN
; i
++)
3126 PRINT_INFO(CFG80211_DBG
, "PairwiseTx[%d] = %x\n", i
, tx_mic
[i
]);
3130 msg
.body
.key_info
.attr
.wpa
.key_len
= key_len
;
3131 msg
.body
.key_info
.attr
.wpa
.mac_addr
= mac_addr
;
3132 msg
.body
.key_info
.attr
.wpa
.mode
= cipher_mode
;
3135 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3138 PRINT_ER("Error in sending message queue: PTK Key\n");
3140 down(&hif_drv
->sem_test_key_block
);
3145 int wilc_add_rx_gtk(struct wilc_vif
*vif
, const u8
*rx_gtk
, u8 gtk_key_len
,
3146 u8 index
, u32 key_rsc_len
, const u8
*key_rsc
,
3147 const u8
*rx_mic
, const u8
*tx_mic
, u8 mode
,
3151 struct host_if_msg msg
;
3152 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3153 u8 key_len
= gtk_key_len
;
3156 PRINT_ER("driver is null\n");
3159 memset(&msg
, 0, sizeof(struct host_if_msg
));
3162 key_len
+= RX_MIC_KEY_LEN
;
3165 key_len
+= TX_MIC_KEY_LEN
;
3168 msg
.body
.key_info
.attr
.wpa
.seq
= kmemdup(key_rsc
,
3171 if (!msg
.body
.key_info
.attr
.wpa
.seq
)
3175 msg
.id
= HOST_IF_MSG_KEY
;
3176 msg
.body
.key_info
.type
= WPA_RX_GTK
;
3179 if (mode
== AP_MODE
) {
3180 msg
.body
.key_info
.action
= ADDKEY_AP
;
3181 msg
.body
.key_info
.attr
.wpa
.mode
= cipher_mode
;
3183 if (mode
== STATION_MODE
)
3184 msg
.body
.key_info
.action
= ADDKEY
;
3186 msg
.body
.key_info
.attr
.wpa
.key
= kmemdup(rx_gtk
,
3189 if (!msg
.body
.key_info
.attr
.wpa
.key
)
3193 memcpy(msg
.body
.key_info
.attr
.wpa
.key
+ 16, rx_mic
,
3197 memcpy(msg
.body
.key_info
.attr
.wpa
.key
+ 24, tx_mic
,
3200 msg
.body
.key_info
.attr
.wpa
.index
= index
;
3201 msg
.body
.key_info
.attr
.wpa
.key_len
= key_len
;
3202 msg
.body
.key_info
.attr
.wpa
.seq_len
= key_rsc_len
;
3204 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3206 PRINT_ER("Error in sending message queue: RX GTK\n");
3208 down(&hif_drv
->sem_test_key_block
);
3213 int wilc_set_pmkid_info(struct wilc_vif
*vif
,
3214 struct host_if_pmkid_attr
*pmkid
)
3217 struct host_if_msg msg
;
3218 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3222 PRINT_ER("driver is null\n");
3226 memset(&msg
, 0, sizeof(struct host_if_msg
));
3228 msg
.id
= HOST_IF_MSG_KEY
;
3229 msg
.body
.key_info
.type
= PMKSA
;
3230 msg
.body
.key_info
.action
= ADDKEY
;
3233 for (i
= 0; i
< pmkid
->numpmkid
; i
++) {
3234 memcpy(msg
.body
.key_info
.attr
.pmkid
.pmkidlist
[i
].bssid
,
3235 &pmkid
->pmkidlist
[i
].bssid
, ETH_ALEN
);
3236 memcpy(msg
.body
.key_info
.attr
.pmkid
.pmkidlist
[i
].pmkid
,
3237 &pmkid
->pmkidlist
[i
].pmkid
, PMKID_LEN
);
3240 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3242 PRINT_ER(" Error in sending messagequeue: PMKID Info\n");
3247 int wilc_get_mac_address(struct wilc_vif
*vif
, u8
*mac_addr
)
3250 struct host_if_msg msg
;
3252 memset(&msg
, 0, sizeof(struct host_if_msg
));
3254 msg
.id
= HOST_IF_MSG_GET_MAC_ADDRESS
;
3255 msg
.body
.get_mac_info
.mac_addr
= mac_addr
;
3258 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3260 PRINT_ER("Failed to send get mac address\n");
3264 down(&hif_sema_wait_response
);
3268 int wilc_set_join_req(struct wilc_vif
*vif
, u8
*bssid
, const u8
*ssid
,
3269 size_t ssid_len
, const u8
*ies
, size_t ies_len
,
3270 wilc_connect_result connect_result
, void *user_arg
,
3271 u8 security
, enum AUTHTYPE auth_type
,
3272 u8 channel
, void *join_params
)
3275 struct host_if_msg msg
;
3276 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3278 if (!hif_drv
|| !connect_result
) {
3279 PRINT_ER("Driver is null\n");
3284 PRINT_ER("Unable to Join - JoinParams is NULL\n");
3288 memset(&msg
, 0, sizeof(struct host_if_msg
));
3290 msg
.id
= HOST_IF_MSG_CONNECT
;
3292 msg
.body
.con_info
.security
= security
;
3293 msg
.body
.con_info
.auth_type
= auth_type
;
3294 msg
.body
.con_info
.ch
= channel
;
3295 msg
.body
.con_info
.result
= connect_result
;
3296 msg
.body
.con_info
.arg
= user_arg
;
3297 msg
.body
.con_info
.params
= join_params
;
3301 msg
.body
.con_info
.bssid
= kmemdup(bssid
, 6, GFP_KERNEL
);
3302 if (!msg
.body
.con_info
.bssid
)
3307 msg
.body
.con_info
.ssid_len
= ssid_len
;
3308 msg
.body
.con_info
.ssid
= kmemdup(ssid
, ssid_len
, GFP_KERNEL
);
3309 if (!msg
.body
.con_info
.ssid
)
3314 msg
.body
.con_info
.ies_len
= ies_len
;
3315 msg
.body
.con_info
.ies
= kmemdup(ies
, ies_len
, GFP_KERNEL
);
3316 if (!msg
.body
.con_info
.ies
)
3319 if (hif_drv
->hif_state
< HOST_IF_CONNECTING
)
3320 hif_drv
->hif_state
= HOST_IF_CONNECTING
;
3322 PRINT_D(GENERIC_DBG
, "Don't set state to 'connecting' : %d\n",
3323 hif_drv
->hif_state
);
3325 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3327 PRINT_ER("Failed to send message queue: Set join request\n");
3331 hif_drv
->connect_timer
.data
= (unsigned long)vif
;
3332 mod_timer(&hif_drv
->connect_timer
,
3333 jiffies
+ msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT
));
3338 int wilc_disconnect(struct wilc_vif
*vif
, u16 reason_code
)
3341 struct host_if_msg msg
;
3342 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3345 PRINT_ER("Driver is null\n");
3349 memset(&msg
, 0, sizeof(struct host_if_msg
));
3351 msg
.id
= HOST_IF_MSG_DISCONNECT
;
3354 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3356 PRINT_ER("Failed to send message queue: disconnect\n");
3358 down(&hif_drv
->sem_test_disconn_block
);
3363 static s32
host_int_get_assoc_res_info(struct wilc_vif
*vif
,
3364 u8
*pu8AssocRespInfo
,
3365 u32 u32MaxAssocRespInfoLen
,
3366 u32
*pu32RcvdAssocRespInfoLen
)
3370 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3373 PRINT_ER("Driver is null\n");
3377 wid
.id
= (u16
)WID_ASSOC_RES_INFO
;
3379 wid
.val
= pu8AssocRespInfo
;
3380 wid
.size
= u32MaxAssocRespInfoLen
;
3382 result
= wilc_send_config_pkt(vif
, GET_CFG
, &wid
, 1,
3383 wilc_get_vif_idx(vif
));
3385 *pu32RcvdAssocRespInfoLen
= 0;
3386 PRINT_ER("Failed to send association response config packet\n");
3389 *pu32RcvdAssocRespInfoLen
= wid
.size
;
3395 int wilc_set_mac_chnl_num(struct wilc_vif
*vif
, u8 channel
)
3398 struct host_if_msg msg
;
3399 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3402 PRINT_ER("driver is null\n");
3406 memset(&msg
, 0, sizeof(struct host_if_msg
));
3407 msg
.id
= HOST_IF_MSG_SET_CHANNEL
;
3408 msg
.body
.channel_info
.set_ch
= channel
;
3411 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3413 PRINT_ER("wilc mq send fail\n");
3420 int wilc_set_wfi_drv_handler(struct wilc_vif
*vif
, int index
, u8 mac_idx
)
3423 struct host_if_msg msg
;
3425 memset(&msg
, 0, sizeof(struct host_if_msg
));
3426 msg
.id
= HOST_IF_MSG_SET_WFIDRV_HANDLER
;
3427 msg
.body
.drv
.handler
= index
;
3428 msg
.body
.drv
.mac_idx
= mac_idx
;
3431 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3433 PRINT_ER("wilc mq send fail\n");
3440 int wilc_set_operation_mode(struct wilc_vif
*vif
, u32 mode
)
3443 struct host_if_msg msg
;
3445 memset(&msg
, 0, sizeof(struct host_if_msg
));
3446 msg
.id
= HOST_IF_MSG_SET_OPERATION_MODE
;
3447 msg
.body
.mode
.mode
= mode
;
3450 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3452 PRINT_ER("wilc mq send fail\n");
3459 s32
wilc_get_inactive_time(struct wilc_vif
*vif
, const u8
*mac
,
3460 u32
*pu32InactiveTime
)
3463 struct host_if_msg msg
;
3464 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3467 PRINT_ER("driver is null\n");
3471 memset(&msg
, 0, sizeof(struct host_if_msg
));
3472 memcpy(msg
.body
.mac_info
.mac
, mac
, ETH_ALEN
);
3474 msg
.id
= HOST_IF_MSG_GET_INACTIVETIME
;
3477 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3479 PRINT_ER("Failed to send get host channel param's message queue ");
3481 down(&hif_drv
->sem_inactive_time
);
3483 *pu32InactiveTime
= inactive_time
;
3488 int wilc_get_rssi(struct wilc_vif
*vif
, s8
*rssi_level
)
3491 struct host_if_msg msg
;
3492 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3494 memset(&msg
, 0, sizeof(struct host_if_msg
));
3495 msg
.id
= HOST_IF_MSG_GET_RSSI
;
3498 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3500 PRINT_ER("Failed to send get host channel param's message queue ");
3504 down(&hif_drv
->sem_get_rssi
);
3507 PRINT_ER("RSS pointer value is null");
3516 int wilc_get_statistics(struct wilc_vif
*vif
, struct rf_info
*stats
)
3519 struct host_if_msg msg
;
3521 memset(&msg
, 0, sizeof(struct host_if_msg
));
3522 msg
.id
= HOST_IF_MSG_GET_STATISTICS
;
3523 msg
.body
.data
= (char *)stats
;
3526 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3528 PRINT_ER("Failed to send get host channel param's message queue ");
3532 if (stats
!= &vif
->wilc
->dummy_statistics
)
3533 down(&hif_sema_wait_response
);
3537 int wilc_scan(struct wilc_vif
*vif
, u8 scan_source
, u8 scan_type
,
3538 u8
*ch_freq_list
, u8 ch_list_len
, const u8
*ies
,
3539 size_t ies_len
, wilc_scan_result scan_result
, void *user_arg
,
3540 struct hidden_network
*hidden_network
)
3543 struct host_if_msg msg
;
3544 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3546 if (!hif_drv
|| !scan_result
) {
3547 PRINT_ER("hif_drv or scan_result = NULL\n");
3551 memset(&msg
, 0, sizeof(struct host_if_msg
));
3553 msg
.id
= HOST_IF_MSG_SCAN
;
3555 if (hidden_network
) {
3556 msg
.body
.scan_info
.hidden_network
.net_info
= hidden_network
->net_info
;
3557 msg
.body
.scan_info
.hidden_network
.n_ssids
= hidden_network
->n_ssids
;
3561 msg
.body
.scan_info
.src
= scan_source
;
3562 msg
.body
.scan_info
.type
= scan_type
;
3563 msg
.body
.scan_info
.result
= scan_result
;
3564 msg
.body
.scan_info
.arg
= user_arg
;
3566 msg
.body
.scan_info
.ch_list_len
= ch_list_len
;
3567 msg
.body
.scan_info
.ch_freq_list
= kmemdup(ch_freq_list
,
3570 if (!msg
.body
.scan_info
.ch_freq_list
)
3573 msg
.body
.scan_info
.ies_len
= ies_len
;
3574 msg
.body
.scan_info
.ies
= kmemdup(ies
, ies_len
, GFP_KERNEL
);
3575 if (!msg
.body
.scan_info
.ies
)
3578 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3580 PRINT_ER("Error in sending message queue\n");
3584 hif_drv
->scan_timer
.data
= (unsigned long)vif
;
3585 mod_timer(&hif_drv
->scan_timer
,
3586 jiffies
+ msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT
));
3591 s32
wilc_hif_set_cfg(struct wilc_vif
*vif
,
3592 struct cfg_param_val
*pstrCfgParamVal
)
3595 struct host_if_msg msg
;
3596 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3599 PRINT_ER("hif_drv NULL\n");
3603 memset(&msg
, 0, sizeof(struct host_if_msg
));
3604 msg
.id
= HOST_IF_MSG_CFG_PARAMS
;
3605 msg
.body
.cfg_info
.cfg_attr_info
= *pstrCfgParamVal
;
3608 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3613 static void GetPeriodicRSSI(unsigned long arg
)
3615 struct wilc_vif
*vif
= (struct wilc_vif
*)arg
;
3617 if (!vif
->hif_drv
) {
3618 PRINT_ER("Driver handler is NULL\n");
3622 if (vif
->hif_drv
->hif_state
== HOST_IF_CONNECTED
)
3623 wilc_get_statistics(vif
, &vif
->wilc
->dummy_statistics
);
3625 periodic_rssi
.data
= (unsigned long)vif
;
3626 mod_timer(&periodic_rssi
, jiffies
+ msecs_to_jiffies(5000));
3629 int wilc_init(struct net_device
*dev
, struct host_if_drv
**hif_drv_handler
)
3632 struct host_if_drv
*hif_drv
;
3633 struct wilc_vif
*vif
;
3637 vif
= netdev_priv(dev
);
3640 scan_while_connected
= false;
3642 sema_init(&hif_sema_wait_response
, 0);
3644 hif_drv
= kzalloc(sizeof(struct host_if_drv
), GFP_KERNEL
);
3649 *hif_drv_handler
= hif_drv
;
3650 for (i
= 0; i
< wilc
->vif_num
; i
++)
3651 if (dev
== wilc
->vif
[i
]->ndev
) {
3652 wilc
->vif
[i
]->hif_drv
= hif_drv
;
3656 wilc_optaining_ip
= false;
3658 if (clients_count
== 0) {
3659 sema_init(&hif_sema_thread
, 0);
3660 sema_init(&hif_sema_driver
, 0);
3661 sema_init(&hif_sema_deinit
, 1);
3664 sema_init(&hif_drv
->sem_test_key_block
, 0);
3665 sema_init(&hif_drv
->sem_test_disconn_block
, 0);
3666 sema_init(&hif_drv
->sem_get_rssi
, 0);
3667 sema_init(&hif_drv
->sem_get_link_speed
, 0);
3668 sema_init(&hif_drv
->sem_get_chnl
, 0);
3669 sema_init(&hif_drv
->sem_inactive_time
, 0);
3671 if (clients_count
== 0) {
3672 result
= wilc_mq_create(&hif_msg_q
);
3675 PRINT_ER("Failed to creat MQ\n");
3679 hif_thread_handler
= kthread_run(hostIFthread
, wilc
,
3682 if (IS_ERR(hif_thread_handler
)) {
3683 PRINT_ER("Failed to creat Thread\n");
3687 setup_timer(&periodic_rssi
, GetPeriodicRSSI
,
3688 (unsigned long)vif
);
3689 mod_timer(&periodic_rssi
, jiffies
+ msecs_to_jiffies(5000));
3692 setup_timer(&hif_drv
->scan_timer
, TimerCB_Scan
, 0);
3693 setup_timer(&hif_drv
->connect_timer
, TimerCB_Connect
, 0);
3694 setup_timer(&hif_drv
->remain_on_ch_timer
, ListenTimerCB
, 0);
3696 sema_init(&hif_drv
->sem_cfg_values
, 1);
3697 down(&hif_drv
->sem_cfg_values
);
3699 hif_drv
->hif_state
= HOST_IF_IDLE
;
3700 hif_drv
->cfg_values
.site_survey_enabled
= SITE_SURVEY_OFF
;
3701 hif_drv
->cfg_values
.scan_source
= DEFAULT_SCAN
;
3702 hif_drv
->cfg_values
.active_scan_time
= ACTIVE_SCAN_TIME
;
3703 hif_drv
->cfg_values
.passive_scan_time
= PASSIVE_SCAN_TIME
;
3704 hif_drv
->cfg_values
.curr_tx_rate
= AUTORATE
;
3706 hif_drv
->p2p_timeout
= 0;
3708 up(&hif_drv
->sem_cfg_values
);
3715 wilc_mq_destroy(&hif_msg_q
);
3720 s32
wilc_deinit(struct wilc_vif
*vif
)
3723 struct host_if_msg msg
;
3724 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3727 PRINT_ER("hif_drv = NULL\n");
3731 down(&hif_sema_deinit
);
3733 terminated_handle
= hif_drv
;
3735 del_timer_sync(&hif_drv
->scan_timer
);
3736 del_timer_sync(&hif_drv
->connect_timer
);
3737 del_timer_sync(&periodic_rssi
);
3738 del_timer_sync(&hif_drv
->remain_on_ch_timer
);
3740 wilc_set_wfi_drv_handler(vif
, 0, 0);
3741 down(&hif_sema_driver
);
3743 if (hif_drv
->usr_scan_req
.scan_result
) {
3744 hif_drv
->usr_scan_req
.scan_result(SCAN_EVENT_ABORTED
, NULL
,
3745 hif_drv
->usr_scan_req
.arg
, NULL
);
3746 hif_drv
->usr_scan_req
.scan_result
= NULL
;
3749 hif_drv
->hif_state
= HOST_IF_IDLE
;
3751 scan_while_connected
= false;
3753 memset(&msg
, 0, sizeof(struct host_if_msg
));
3755 if (clients_count
== 1) {
3756 del_timer_sync(&periodic_rssi
);
3757 msg
.id
= HOST_IF_MSG_EXIT
;
3760 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3762 PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", result
);
3764 down(&hif_sema_thread
);
3766 wilc_mq_destroy(&hif_msg_q
);
3772 terminated_handle
= NULL
;
3773 up(&hif_sema_deinit
);
3777 void wilc_network_info_received(struct wilc
*wilc
, u8
*pu8Buffer
,
3781 struct host_if_msg msg
;
3783 struct host_if_drv
*hif_drv
= NULL
;
3784 struct wilc_vif
*vif
;
3786 id
= ((pu8Buffer
[u32Length
- 4]) | (pu8Buffer
[u32Length
- 3] << 8) | (pu8Buffer
[u32Length
- 2] << 16) | (pu8Buffer
[u32Length
- 1] << 24));
3787 vif
= wilc_get_vif_from_idx(wilc
, id
);
3790 hif_drv
= vif
->hif_drv
;
3792 if (!hif_drv
|| hif_drv
== terminated_handle
) {
3793 PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv
);
3797 memset(&msg
, 0, sizeof(struct host_if_msg
));
3799 msg
.id
= HOST_IF_MSG_RCVD_NTWRK_INFO
;
3802 msg
.body
.net_info
.len
= u32Length
;
3803 msg
.body
.net_info
.buffer
= kmalloc(u32Length
, GFP_KERNEL
);
3804 memcpy(msg
.body
.net_info
.buffer
, pu8Buffer
, u32Length
);
3806 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3808 PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", result
);
3811 void wilc_gnrl_async_info_received(struct wilc
*wilc
, u8
*pu8Buffer
,
3815 struct host_if_msg msg
;
3817 struct host_if_drv
*hif_drv
= NULL
;
3818 struct wilc_vif
*vif
;
3820 down(&hif_sema_deinit
);
3822 id
= ((pu8Buffer
[u32Length
- 4]) | (pu8Buffer
[u32Length
- 3] << 8) | (pu8Buffer
[u32Length
- 2] << 16) | (pu8Buffer
[u32Length
- 1] << 24));
3823 vif
= wilc_get_vif_from_idx(wilc
, id
);
3825 up(&hif_sema_deinit
);
3829 hif_drv
= vif
->hif_drv
;
3831 if (!hif_drv
|| hif_drv
== terminated_handle
) {
3832 up(&hif_sema_deinit
);
3836 if (!hif_drv
->usr_conn_req
.conn_result
) {
3837 PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n");
3838 up(&hif_sema_deinit
);
3842 memset(&msg
, 0, sizeof(struct host_if_msg
));
3844 msg
.id
= HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO
;
3847 msg
.body
.async_info
.len
= u32Length
;
3848 msg
.body
.async_info
.buffer
= kmalloc(u32Length
, GFP_KERNEL
);
3849 memcpy(msg
.body
.async_info
.buffer
, pu8Buffer
, u32Length
);
3851 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3853 PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", result
);
3855 up(&hif_sema_deinit
);
3858 void wilc_scan_complete_received(struct wilc
*wilc
, u8
*pu8Buffer
,
3862 struct host_if_msg msg
;
3864 struct host_if_drv
*hif_drv
= NULL
;
3865 struct wilc_vif
*vif
;
3867 id
= ((pu8Buffer
[u32Length
- 4]) | (pu8Buffer
[u32Length
- 3] << 8) | (pu8Buffer
[u32Length
- 2] << 16) | (pu8Buffer
[u32Length
- 1] << 24));
3868 vif
= wilc_get_vif_from_idx(wilc
, id
);
3871 hif_drv
= vif
->hif_drv
;
3873 PRINT_D(GENERIC_DBG
, "Scan notification received %p\n", hif_drv
);
3875 if (!hif_drv
|| hif_drv
== terminated_handle
)
3878 if (hif_drv
->usr_scan_req
.scan_result
) {
3879 memset(&msg
, 0, sizeof(struct host_if_msg
));
3881 msg
.id
= HOST_IF_MSG_RCVD_SCAN_COMPLETE
;
3884 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3886 PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", result
);
3892 int wilc_remain_on_channel(struct wilc_vif
*vif
, u32 session_id
,
3893 u32 duration
, u16 chan
,
3894 wilc_remain_on_chan_expired expired
,
3895 wilc_remain_on_chan_ready ready
,
3899 struct host_if_msg msg
;
3900 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3903 PRINT_ER("driver is null\n");
3907 memset(&msg
, 0, sizeof(struct host_if_msg
));
3909 msg
.id
= HOST_IF_MSG_REMAIN_ON_CHAN
;
3910 msg
.body
.remain_on_ch
.ch
= chan
;
3911 msg
.body
.remain_on_ch
.expired
= expired
;
3912 msg
.body
.remain_on_ch
.ready
= ready
;
3913 msg
.body
.remain_on_ch
.arg
= user_arg
;
3914 msg
.body
.remain_on_ch
.duration
= duration
;
3915 msg
.body
.remain_on_ch
.id
= session_id
;
3918 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3920 PRINT_ER("wilc mq send fail\n");
3925 int wilc_listen_state_expired(struct wilc_vif
*vif
, u32 session_id
)
3928 struct host_if_msg msg
;
3929 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3932 PRINT_ER("driver is null\n");
3936 del_timer(&hif_drv
->remain_on_ch_timer
);
3938 memset(&msg
, 0, sizeof(struct host_if_msg
));
3939 msg
.id
= HOST_IF_MSG_LISTEN_TIMER_FIRED
;
3941 msg
.body
.remain_on_ch
.id
= session_id
;
3943 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3945 PRINT_ER("wilc mq send fail\n");
3950 int wilc_frame_register(struct wilc_vif
*vif
, u16 frame_type
, bool reg
)
3953 struct host_if_msg msg
;
3954 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3957 PRINT_ER("driver is null\n");
3961 memset(&msg
, 0, sizeof(struct host_if_msg
));
3963 msg
.id
= HOST_IF_MSG_REGISTER_FRAME
;
3964 switch (frame_type
) {
3966 msg
.body
.reg_frame
.reg_id
= ACTION_FRM_IDX
;
3970 msg
.body
.reg_frame
.reg_id
= PROBE_REQ_IDX
;
3976 msg
.body
.reg_frame
.frame_type
= frame_type
;
3977 msg
.body
.reg_frame
.reg
= reg
;
3980 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3982 PRINT_ER("wilc mq send fail\n");
3987 int wilc_add_beacon(struct wilc_vif
*vif
, u32 interval
, u32 dtim_period
,
3988 u32 head_len
, u8
*head
, u32 tail_len
, u8
*tail
)
3991 struct host_if_msg msg
;
3992 struct beacon_attr
*beacon_info
= &msg
.body
.beacon_info
;
3993 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
3996 PRINT_ER("driver is null\n");
4000 memset(&msg
, 0, sizeof(struct host_if_msg
));
4002 msg
.id
= HOST_IF_MSG_ADD_BEACON
;
4004 beacon_info
->interval
= interval
;
4005 beacon_info
->dtim_period
= dtim_period
;
4006 beacon_info
->head_len
= head_len
;
4007 beacon_info
->head
= kmemdup(head
, head_len
, GFP_KERNEL
);
4008 if (!beacon_info
->head
) {
4012 beacon_info
->tail_len
= tail_len
;
4015 beacon_info
->tail
= kmemdup(tail
, tail_len
, GFP_KERNEL
);
4016 if (!beacon_info
->tail
) {
4021 beacon_info
->tail
= NULL
;
4024 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4026 PRINT_ER("wilc mq send fail\n");
4030 kfree(beacon_info
->head
);
4032 kfree(beacon_info
->tail
);
4038 int wilc_del_beacon(struct wilc_vif
*vif
)
4041 struct host_if_msg msg
;
4042 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
4045 PRINT_ER("driver is null\n");
4049 msg
.id
= HOST_IF_MSG_DEL_BEACON
;
4052 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4054 PRINT_ER("wilc_mq_send fail\n");
4059 int wilc_add_station(struct wilc_vif
*vif
, struct add_sta_param
*sta_param
)
4062 struct host_if_msg msg
;
4063 struct add_sta_param
*add_sta_info
= &msg
.body
.add_sta_info
;
4064 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
4067 PRINT_ER("driver is null\n");
4071 memset(&msg
, 0, sizeof(struct host_if_msg
));
4073 msg
.id
= HOST_IF_MSG_ADD_STATION
;
4076 memcpy(add_sta_info
, sta_param
, sizeof(struct add_sta_param
));
4077 if (add_sta_info
->rates_len
> 0) {
4078 add_sta_info
->rates
= kmemdup(sta_param
->rates
,
4079 add_sta_info
->rates_len
,
4081 if (!add_sta_info
->rates
)
4085 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4087 PRINT_ER("wilc_mq_send fail\n");
4091 int wilc_del_station(struct wilc_vif
*vif
, const u8
*mac_addr
)
4094 struct host_if_msg msg
;
4095 struct del_sta
*del_sta_info
= &msg
.body
.del_sta_info
;
4096 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
4099 PRINT_ER("driver is null\n");
4103 memset(&msg
, 0, sizeof(struct host_if_msg
));
4105 msg
.id
= HOST_IF_MSG_DEL_STATION
;
4109 eth_broadcast_addr(del_sta_info
->mac_addr
);
4111 memcpy(del_sta_info
->mac_addr
, mac_addr
, ETH_ALEN
);
4113 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4115 PRINT_ER("wilc_mq_send fail\n");
4119 int wilc_del_allstation(struct wilc_vif
*vif
, u8 mac_addr
[][ETH_ALEN
])
4122 struct host_if_msg msg
;
4123 struct del_all_sta
*del_all_sta_info
= &msg
.body
.del_all_sta_info
;
4124 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
4125 u8 zero_addr
[ETH_ALEN
] = {0};
4130 PRINT_ER("driver is null\n");
4134 memset(&msg
, 0, sizeof(struct host_if_msg
));
4136 msg
.id
= HOST_IF_MSG_DEL_ALL_STA
;
4139 for (i
= 0; i
< MAX_NUM_STA
; i
++) {
4140 if (memcmp(mac_addr
[i
], zero_addr
, ETH_ALEN
)) {
4141 memcpy(del_all_sta_info
->del_all_sta
[i
], mac_addr
[i
], ETH_ALEN
);
4142 PRINT_D(CFG80211_DBG
, "BSSID = %x%x%x%x%x%x\n",
4143 del_all_sta_info
->del_all_sta
[i
][0],
4144 del_all_sta_info
->del_all_sta
[i
][1],
4145 del_all_sta_info
->del_all_sta
[i
][2],
4146 del_all_sta_info
->del_all_sta
[i
][3],
4147 del_all_sta_info
->del_all_sta
[i
][4],
4148 del_all_sta_info
->del_all_sta
[i
][5]);
4153 PRINT_D(CFG80211_DBG
, "NO ASSOCIATED STAS\n");
4157 del_all_sta_info
->assoc_sta
= assoc_sta
;
4158 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4161 PRINT_ER("wilc_mq_send fail\n");
4163 down(&hif_sema_wait_response
);
4168 int wilc_edit_station(struct wilc_vif
*vif
,
4169 struct add_sta_param
*sta_param
)
4172 struct host_if_msg msg
;
4173 struct add_sta_param
*add_sta_info
= &msg
.body
.add_sta_info
;
4174 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
4177 PRINT_ER("driver is null\n");
4181 memset(&msg
, 0, sizeof(struct host_if_msg
));
4183 msg
.id
= HOST_IF_MSG_EDIT_STATION
;
4186 memcpy(add_sta_info
, sta_param
, sizeof(struct add_sta_param
));
4187 if (add_sta_info
->rates_len
> 0) {
4188 add_sta_info
->rates
= kmemdup(sta_param
->rates
,
4189 add_sta_info
->rates_len
,
4191 if (!add_sta_info
->rates
)
4195 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4197 PRINT_ER("wilc_mq_send fail\n");
4202 int wilc_set_power_mgmt(struct wilc_vif
*vif
, bool enabled
, u32 timeout
)
4205 struct host_if_msg msg
;
4206 struct power_mgmt_param
*pwr_mgmt_info
= &msg
.body
.pwr_mgmt_info
;
4207 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
4210 PRINT_ER("driver is null\n");
4214 if (wilc_wlan_get_num_conn_ifcs(vif
->wilc
) == 2 && enabled
)
4217 memset(&msg
, 0, sizeof(struct host_if_msg
));
4219 msg
.id
= HOST_IF_MSG_POWER_MGMT
;
4222 pwr_mgmt_info
->enabled
= enabled
;
4223 pwr_mgmt_info
->timeout
= timeout
;
4225 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4227 PRINT_ER("wilc_mq_send fail\n");
4231 int wilc_setup_multicast_filter(struct wilc_vif
*vif
, bool enabled
,
4235 struct host_if_msg msg
;
4236 struct set_multicast
*multicast_filter_param
= &msg
.body
.multicast_info
;
4237 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
4240 PRINT_ER("driver is null\n");
4244 memset(&msg
, 0, sizeof(struct host_if_msg
));
4246 msg
.id
= HOST_IF_MSG_SET_MULTICAST_FILTER
;
4249 multicast_filter_param
->enabled
= enabled
;
4250 multicast_filter_param
->cnt
= count
;
4252 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4254 PRINT_ER("wilc_mq_send fail\n");
4258 static void *host_int_ParseJoinBssParam(struct network_info
*ptstrNetworkInfo
)
4260 struct join_bss_param
*pNewJoinBssParam
= NULL
;
4269 u8 pcipherTotalCount
= 0;
4270 u8 authTotalCount
= 0;
4273 pu8IEs
= ptstrNetworkInfo
->pu8IEs
;
4274 u16IEsLen
= ptstrNetworkInfo
->u16IEsLen
;
4276 pNewJoinBssParam
= kzalloc(sizeof(struct join_bss_param
), GFP_KERNEL
);
4277 if (pNewJoinBssParam
) {
4278 pNewJoinBssParam
->dtim_period
= ptstrNetworkInfo
->u8DtimPeriod
;
4279 pNewJoinBssParam
->beacon_period
= ptstrNetworkInfo
->u16BeaconPeriod
;
4280 pNewJoinBssParam
->cap_info
= ptstrNetworkInfo
->u16CapInfo
;
4281 memcpy(pNewJoinBssParam
->au8bssid
, ptstrNetworkInfo
->au8bssid
, 6);
4282 memcpy((u8
*)pNewJoinBssParam
->ssid
, ptstrNetworkInfo
->au8ssid
, ptstrNetworkInfo
->u8SsidLen
+ 1);
4283 pNewJoinBssParam
->ssid_len
= ptstrNetworkInfo
->u8SsidLen
;
4284 memset(pNewJoinBssParam
->rsn_pcip_policy
, 0xFF, 3);
4285 memset(pNewJoinBssParam
->rsn_auth_policy
, 0xFF, 3);
4287 while (index
< u16IEsLen
) {
4288 if (pu8IEs
[index
] == SUPP_RATES_IE
) {
4289 suppRatesNo
= pu8IEs
[index
+ 1];
4290 pNewJoinBssParam
->supp_rates
[0] = suppRatesNo
;
4293 for (i
= 0; i
< suppRatesNo
; i
++)
4294 pNewJoinBssParam
->supp_rates
[i
+ 1] = pu8IEs
[index
+ i
];
4296 index
+= suppRatesNo
;
4298 } else if (pu8IEs
[index
] == EXT_SUPP_RATES_IE
) {
4299 extSuppRatesNo
= pu8IEs
[index
+ 1];
4300 if (extSuppRatesNo
> (MAX_RATES_SUPPORTED
- suppRatesNo
))
4301 pNewJoinBssParam
->supp_rates
[0] = MAX_RATES_SUPPORTED
;
4303 pNewJoinBssParam
->supp_rates
[0] += extSuppRatesNo
;
4305 for (i
= 0; i
< (pNewJoinBssParam
->supp_rates
[0] - suppRatesNo
); i
++)
4306 pNewJoinBssParam
->supp_rates
[suppRatesNo
+ i
+ 1] = pu8IEs
[index
+ i
];
4308 index
+= extSuppRatesNo
;
4310 } else if (pu8IEs
[index
] == HT_CAPABILITY_IE
) {
4311 pNewJoinBssParam
->ht_capable
= true;
4312 index
+= pu8IEs
[index
+ 1] + 2;
4314 } else if ((pu8IEs
[index
] == WMM_IE
) &&
4315 (pu8IEs
[index
+ 2] == 0x00) && (pu8IEs
[index
+ 3] == 0x50) &&
4316 (pu8IEs
[index
+ 4] == 0xF2) &&
4317 (pu8IEs
[index
+ 5] == 0x02) &&
4318 ((pu8IEs
[index
+ 6] == 0x00) || (pu8IEs
[index
+ 6] == 0x01)) &&
4319 (pu8IEs
[index
+ 7] == 0x01)) {
4320 pNewJoinBssParam
->wmm_cap
= true;
4322 if (pu8IEs
[index
+ 8] & BIT(7))
4323 pNewJoinBssParam
->uapsd_cap
= true;
4324 index
+= pu8IEs
[index
+ 1] + 2;
4326 } else if ((pu8IEs
[index
] == P2P_IE
) &&
4327 (pu8IEs
[index
+ 2] == 0x50) && (pu8IEs
[index
+ 3] == 0x6f) &&
4328 (pu8IEs
[index
+ 4] == 0x9a) &&
4329 (pu8IEs
[index
+ 5] == 0x09) && (pu8IEs
[index
+ 6] == 0x0c)) {
4332 pNewJoinBssParam
->tsf
= ptstrNetworkInfo
->u32Tsf
;
4333 pNewJoinBssParam
->noa_enabled
= 1;
4334 pNewJoinBssParam
->idx
= pu8IEs
[index
+ 9];
4336 if (pu8IEs
[index
+ 10] & BIT(7)) {
4337 pNewJoinBssParam
->opp_enabled
= 1;
4338 pNewJoinBssParam
->ct_window
= pu8IEs
[index
+ 10];
4340 pNewJoinBssParam
->opp_enabled
= 0;
4343 PRINT_D(GENERIC_DBG
, "P2P Dump\n");
4344 for (i
= 0; i
< pu8IEs
[index
+ 7]; i
++)
4345 PRINT_D(GENERIC_DBG
, " %x\n", pu8IEs
[index
+ 9 + i
]);
4347 pNewJoinBssParam
->cnt
= pu8IEs
[index
+ 11];
4348 u16P2P_count
= index
+ 12;
4350 memcpy(pNewJoinBssParam
->duration
, pu8IEs
+ u16P2P_count
, 4);
4353 memcpy(pNewJoinBssParam
->interval
, pu8IEs
+ u16P2P_count
, 4);
4356 memcpy(pNewJoinBssParam
->start_time
, pu8IEs
+ u16P2P_count
, 4);
4358 index
+= pu8IEs
[index
+ 1] + 2;
4361 } else if ((pu8IEs
[index
] == RSN_IE
) ||
4362 ((pu8IEs
[index
] == WPA_IE
) && (pu8IEs
[index
+ 2] == 0x00) &&
4363 (pu8IEs
[index
+ 3] == 0x50) && (pu8IEs
[index
+ 4] == 0xF2) &&
4364 (pu8IEs
[index
+ 5] == 0x01))) {
4365 u16 rsnIndex
= index
;
4367 if (pu8IEs
[rsnIndex
] == RSN_IE
) {
4368 pNewJoinBssParam
->mode_802_11i
= 2;
4370 if (pNewJoinBssParam
->mode_802_11i
== 0)
4371 pNewJoinBssParam
->mode_802_11i
= 1;
4376 pNewJoinBssParam
->rsn_grp_policy
= pu8IEs
[rsnIndex
];
4378 jumpOffset
= pu8IEs
[rsnIndex
] * 4;
4379 pcipherCount
= (pu8IEs
[rsnIndex
] > 3) ? 3 : pu8IEs
[rsnIndex
];
4382 for (i
= pcipherTotalCount
, j
= 0; i
< pcipherCount
+ pcipherTotalCount
&& i
< 3; i
++, j
++)
4383 pNewJoinBssParam
->rsn_pcip_policy
[i
] = pu8IEs
[rsnIndex
+ ((j
+ 1) * 4) - 1];
4385 pcipherTotalCount
+= pcipherCount
;
4386 rsnIndex
+= jumpOffset
;
4388 jumpOffset
= pu8IEs
[rsnIndex
] * 4;
4390 authCount
= (pu8IEs
[rsnIndex
] > 3) ? 3 : pu8IEs
[rsnIndex
];
4393 for (i
= authTotalCount
, j
= 0; i
< authTotalCount
+ authCount
; i
++, j
++)
4394 pNewJoinBssParam
->rsn_auth_policy
[i
] = pu8IEs
[rsnIndex
+ ((j
+ 1) * 4) - 1];
4396 authTotalCount
+= authCount
;
4397 rsnIndex
+= jumpOffset
;
4399 if (pu8IEs
[index
] == RSN_IE
) {
4400 pNewJoinBssParam
->rsn_cap
[0] = pu8IEs
[rsnIndex
];
4401 pNewJoinBssParam
->rsn_cap
[1] = pu8IEs
[rsnIndex
+ 1];
4404 pNewJoinBssParam
->rsn_found
= true;
4405 index
+= pu8IEs
[index
+ 1] + 2;
4408 index
+= pu8IEs
[index
+ 1] + 2;
4412 return (void *)pNewJoinBssParam
;
4415 int wilc_setup_ipaddress(struct wilc_vif
*vif
, u8
*ip_addr
, u8 idx
)
4418 struct host_if_msg msg
;
4419 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
4422 PRINT_ER("driver is null\n");
4426 memset(&msg
, 0, sizeof(struct host_if_msg
));
4428 msg
.id
= HOST_IF_MSG_SET_IPADDRESS
;
4430 msg
.body
.ip_info
.ip_addr
= ip_addr
;
4432 msg
.body
.ip_info
.idx
= idx
;
4434 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4436 PRINT_ER("wilc_mq_send fail\n");
4441 static int host_int_get_ipaddress(struct wilc_vif
*vif
, u8
*ip_addr
, u8 idx
)
4444 struct host_if_msg msg
;
4445 struct host_if_drv
*hif_drv
= vif
->hif_drv
;
4448 PRINT_ER("driver is null\n");
4452 memset(&msg
, 0, sizeof(struct host_if_msg
));
4454 msg
.id
= HOST_IF_MSG_GET_IPADDRESS
;
4456 msg
.body
.ip_info
.ip_addr
= ip_addr
;
4458 msg
.body
.ip_info
.idx
= idx
;
4460 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4462 PRINT_ER("wilc_mq_send fail\n");
4467 int wilc_set_tx_power(struct wilc_vif
*vif
, u8 tx_power
)
4470 struct host_if_msg msg
;
4472 memset(&msg
, 0, sizeof(struct host_if_msg
));
4474 msg
.id
= HOST_IF_MSG_SET_TX_POWER
;
4475 msg
.body
.tx_power
.tx_pwr
= tx_power
;
4478 ret
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4480 netdev_err(vif
->ndev
, "wilc_mq_send fail\n");
4485 int wilc_get_tx_power(struct wilc_vif
*vif
, u8
*tx_power
)
4488 struct host_if_msg msg
;
4490 memset(&msg
, 0, sizeof(struct host_if_msg
));
4492 msg
.id
= HOST_IF_MSG_GET_TX_POWER
;
4495 ret
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4497 netdev_err(vif
->ndev
, "Failed to get TX PWR\n");
4499 down(&hif_sema_wait_response
);
4500 *tx_power
= msg
.body
.tx_power
.tx_pwr
;