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"
7 #include "wilc_wlan_if.h"
8 #include "wilc_msgqueue.h"
9 #include <linux/etherdevice.h>
13 extern struct timer_list hDuringIpTimer;
15 extern u8 g_wilc_initialized;
17 #define HOST_IF_MSG_SCAN 0
18 #define HOST_IF_MSG_CONNECT 1
19 #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2
20 #define HOST_IF_MSG_KEY 3
21 #define HOST_IF_MSG_RCVD_NTWRK_INFO 4
22 #define HOST_IF_MSG_RCVD_SCAN_COMPLETE 5
23 #define HOST_IF_MSG_CFG_PARAMS 6
24 #define HOST_IF_MSG_SET_CHANNEL 7
25 #define HOST_IF_MSG_DISCONNECT 8
26 #define HOST_IF_MSG_GET_RSSI 9
27 #define HOST_IF_MSG_GET_CHNL 10
28 #define HOST_IF_MSG_ADD_BEACON 11
29 #define HOST_IF_MSG_DEL_BEACON 12
30 #define HOST_IF_MSG_ADD_STATION 13
31 #define HOST_IF_MSG_DEL_STATION 14
32 #define HOST_IF_MSG_EDIT_STATION 15
33 #define HOST_IF_MSG_SCAN_TIMER_FIRED 16
34 #define HOST_IF_MSG_CONNECT_TIMER_FIRED 17
35 #define HOST_IF_MSG_POWER_MGMT 18
36 #define HOST_IF_MSG_GET_INACTIVETIME 19
37 #define HOST_IF_MSG_REMAIN_ON_CHAN 20
38 #define HOST_IF_MSG_REGISTER_FRAME 21
39 #define HOST_IF_MSG_LISTEN_TIMER_FIRED 22
40 #define HOST_IF_MSG_GET_LINKSPEED 23
41 #define HOST_IF_MSG_SET_WFIDRV_HANDLER 24
42 #define HOST_IF_MSG_SET_MAC_ADDRESS 25
43 #define HOST_IF_MSG_GET_MAC_ADDRESS 26
44 #define HOST_IF_MSG_SET_OPERATION_MODE 27
45 #define HOST_IF_MSG_SET_IPADDRESS 28
46 #define HOST_IF_MSG_GET_IPADDRESS 29
47 #define HOST_IF_MSG_FLUSH_CONNECT 30
48 #define HOST_IF_MSG_GET_STATISTICS 31
49 #define HOST_IF_MSG_SET_MULTICAST_FILTER 32
50 #define HOST_IF_MSG_ADD_BA_SESSION 33
51 #define HOST_IF_MSG_DEL_BA_SESSION 34
52 #define HOST_IF_MSG_Q_IDLE 35
53 #define HOST_IF_MSG_DEL_ALL_STA 36
54 #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 34
55 #define HOST_IF_MSG_EXIT 100
57 #define HOST_IF_SCAN_TIMEOUT 4000
58 #define HOST_IF_CONNECT_TIMEOUT 9500
60 #define BA_SESSION_DEFAULT_BUFFER_SIZE 16
61 #define BA_SESSION_DEFAULT_TIMEOUT 1000
62 #define BLOCK_ACK_REQ_SIZE 0x14
64 struct cfg_param_attr {
65 struct cfg_param_val cfg_attr_info;
68 struct host_if_wpa_attr {
78 struct host_if_wep_attr {
83 enum AUTHTYPE auth_type;
86 union host_if_key_attr {
87 struct host_if_wep_attr wep;
88 struct host_if_wpa_attr wpa;
89 struct host_if_pmkid_attr pmkid;
95 union host_if_key_attr uniHostIFkeyAttr;
105 wilc_scan_result pfScanResult;
107 struct hidden_network strHiddenNetwork;
110 struct connect_attr {
117 wilc_connect_result pfConnectResult;
119 enum AUTHTYPE tenuAuth_type;
124 struct rcvd_async_info {
129 struct channel_attr {
142 struct set_multicast {
148 u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN];
153 u8 au8MacAddr[ETH_ALEN];
156 struct power_mgmt_param {
167 struct sta_inactive_t {
172 struct scan_attr scan_info;
173 struct connect_attr con_info;
174 struct rcvd_net_info net_info;
175 struct rcvd_async_info async_info;
176 struct key_attr key_info;
177 struct cfg_param_attr cfg_info;
178 struct channel_attr channel_info;
179 struct beacon_attr beacon_info;
180 struct add_sta_param add_sta_info;
181 struct del_sta del_sta_info;
182 struct add_sta_param edit_sta_info;
183 struct power_mgmt_param pwr_mgmt_info;
184 struct sta_inactive_t mac_info;
185 struct set_ip_addr ip_info;
186 struct drv_handler drv;
187 struct set_multicast multicast_info;
189 struct set_mac_addr set_mac_info;
190 struct get_mac_addr get_mac_info;
191 struct ba_session_info session_info;
192 struct remain_ch remain_on_ch;
193 struct reg_frame reg_frame;
195 struct del_all_sta del_all_sta_info;
200 union message_body body;
201 struct host_if_drv *drv;
204 struct join_bss_param {
210 char ssid[MAX_SSID_LEN];
212 u8 supp_rates[MAX_RATES_SUPPORTED + 1];
219 u8 rsn_pcip_policy[3];
220 u8 rsn_auth_policy[3];
233 enum scan_conn_timer {
236 SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF
239 static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
240 struct host_if_drv *terminated_handle;
241 struct host_if_drv *gWFiDrvHandle;
242 bool g_obtainingIP = false;
244 static struct task_struct *HostIFthreadHandler;
245 static WILC_MsgQueueHandle gMsgQHostIF;
246 static struct semaphore hSemHostIFthrdEnd;
248 struct semaphore hSemDeinitDrvHandle;
249 static struct semaphore hWaitResponse;
250 struct semaphore hSemHostIntDeinit;
251 struct timer_list g_hPeriodicRSSI;
255 u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
257 static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE];
259 bool gbScanWhileConnected = false;
264 static u8 gs8SetIP[2][4];
265 static u8 gs8GetIP[2][4];
266 static u32 gu32InactiveTime;
268 static u32 gu32WidConnRstHack;
270 u8 *gu8FlushedJoinReq;
271 u8 *gu8FlushedInfoElemAsoc;
272 u8 gu8Flushed11iMode;
273 u8 gu8FlushedAuthType;
274 u32 gu32FlushedJoinReqSize;
275 u32 gu32FlushedInfoElemAsocSize;
276 struct host_if_drv *gu8FlushedJoinReqDrvHandler;
277 #define REAL_JOIN_REQ 0
278 #define FLUSHED_JOIN_REQ 1
279 #define FLUSHED_BYTE_POS 79
281 static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
283 extern void chip_sleep_manually(u32 u32SleepTime);
284 extern int linux_wlan_get_num_conn_ifcs(void);
286 static int add_handler_in_list(struct host_if_drv *handler)
290 for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
291 if (!wfidrv_list[i]) {
292 wfidrv_list[i] = handler;
300 static int remove_handler_in_list(struct host_if_drv *handler)
304 for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
305 if (wfidrv_list[i] == handler) {
306 wfidrv_list[i] = NULL;
314 static int get_id_from_handler(struct host_if_drv *handler)
321 for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
322 if (wfidrv_list[i] == handler)
329 static struct host_if_drv *get_handler_from_id(int id)
331 if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list))
333 return wfidrv_list[id];
336 static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
337 struct channel_attr *pstrHostIFSetChan)
343 strWID.id = (u16)WID_CURRENT_CHANNEL;
344 strWID.type = WID_CHAR;
345 strWID.val = (char *)&(pstrHostIFSetChan->u8SetChan);
346 strWID.size = sizeof(char);
348 PRINT_D(HOSTINF_DBG, "Setting channel\n");
350 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
351 get_id_from_handler(hif_drv));
353 PRINT_ER("Failed to set channel\n");
360 static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv,
361 struct drv_handler *pstrHostIfSetDrvHandler)
367 strWID.id = (u16)WID_SET_DRV_HANDLER;
368 strWID.type = WID_INT;
369 strWID.val = (s8 *)&(pstrHostIfSetDrvHandler->u32Address);
370 strWID.size = sizeof(u32);
372 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
373 pstrHostIfSetDrvHandler->u32Address);
376 up(&hSemDeinitDrvHandle);
380 PRINT_ER("Failed to set driver handler\n");
387 static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv,
388 struct op_mode *pstrHostIfSetOperationMode)
394 strWID.id = (u16)WID_SET_OPERATION_MODE;
395 strWID.type = WID_INT;
396 strWID.val = (s8 *)&(pstrHostIfSetOperationMode->u32Mode);
397 strWID.size = sizeof(u32);
399 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
400 get_id_from_handler(hif_drv));
403 if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE)
404 up(&hSemDeinitDrvHandle);
408 PRINT_ER("Failed to set driver handler\n");
415 s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
420 char firmwareIPAddress[4] = {0};
422 if (pu8IPAddr[0] < 192)
425 PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr);
427 memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN);
429 strWID.id = (u16)WID_IP_ADDRESS;
430 strWID.type = WID_STR;
431 strWID.val = (u8 *)pu8IPAddr;
432 strWID.size = IP_ALEN;
434 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
435 get_id_from_handler(hif_drv));
438 host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx);
441 PRINT_ER("Failed to set IP address\n");
445 PRINT_INFO(HOSTINF_DBG, "IP address set\n");
450 s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
456 strWID.id = (u16)WID_IP_ADDRESS;
457 strWID.type = WID_STR;
458 strWID.val = kmalloc(IP_ALEN, GFP_KERNEL);
459 strWID.size = IP_ALEN;
461 s32Error = send_config_pkt(GET_CFG, &strWID, 1,
462 get_id_from_handler(hif_drv));
464 PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.val);
466 memcpy(gs8GetIP[idx], strWID.val, IP_ALEN);
470 if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0)
471 host_int_setup_ipaddress(hif_drv, gs8SetIP[idx], idx);
474 PRINT_ER("Failed to get IP address\n");
478 PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx);
479 PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]);
480 PRINT_INFO(HOSTINF_DBG, "\n");
485 static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv,
486 struct set_mac_addr *pstrHostIfSetMacAddress)
491 u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
493 if (mac_buf == NULL) {
494 PRINT_ER("No buffer to send mac address\n");
497 memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN);
499 strWID.id = (u16)WID_MAC_ADDR;
500 strWID.type = WID_STR;
501 strWID.val = mac_buf;
502 strWID.size = ETH_ALEN;
503 PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.val);
505 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
506 get_id_from_handler(hif_drv));
508 PRINT_ER("Failed to set mac address\n");
516 static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv,
517 struct get_mac_addr *pstrHostIfGetMacAddress)
523 strWID.id = (u16)WID_MAC_ADDR;
524 strWID.type = WID_STR;
525 strWID.val = pstrHostIfGetMacAddress->u8MacAddress;
526 strWID.size = ETH_ALEN;
528 s32Error = send_config_pkt(GET_CFG, &strWID, 1,
529 get_id_from_handler(hif_drv));
531 PRINT_ER("Failed to get mac address\n");
539 static s32 Handle_CfgParam(struct host_if_drv *hif_drv,
540 struct cfg_param_attr *strHostIFCfgParamAttr)
543 struct wid strWIDList[32];
546 down(&hif_drv->gtOsCfgValuesSem);
549 PRINT_D(HOSTINF_DBG, "Setting CFG params\n");
551 if (strHostIFCfgParamAttr->cfg_attr_info.flag & BSS_TYPE) {
552 if (strHostIFCfgParamAttr->cfg_attr_info.bss_type < 6) {
553 strWIDList[u8WidCnt].id = WID_BSS_TYPE;
554 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.bss_type;
555 strWIDList[u8WidCnt].type = WID_CHAR;
556 strWIDList[u8WidCnt].size = sizeof(char);
557 hif_drv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.bss_type;
559 PRINT_ER("check value 6 over\n");
565 if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTH_TYPE) {
566 if ((strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 1 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 2 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 5) {
567 strWIDList[u8WidCnt].id = WID_AUTH_TYPE;
568 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_type;
569 strWIDList[u8WidCnt].type = WID_CHAR;
570 strWIDList[u8WidCnt].size = sizeof(char);
571 hif_drv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.auth_type;
573 PRINT_ER("Impossible value \n");
579 if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTHEN_TIMEOUT) {
580 if (strHostIFCfgParamAttr->cfg_attr_info.auth_timeout > 0 && strHostIFCfgParamAttr->cfg_attr_info.auth_timeout < 65536) {
581 strWIDList[u8WidCnt].id = WID_AUTH_TIMEOUT;
582 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_timeout;
583 strWIDList[u8WidCnt].type = WID_SHORT;
584 strWIDList[u8WidCnt].size = sizeof(u16);
585 hif_drv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->cfg_attr_info.auth_timeout;
587 PRINT_ER("Range(1 ~ 65535) over\n");
593 if (strHostIFCfgParamAttr->cfg_attr_info.flag & POWER_MANAGEMENT) {
594 if (strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode < 5) {
595 strWIDList[u8WidCnt].id = WID_POWER_MANAGEMENT;
596 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode;
597 strWIDList[u8WidCnt].type = WID_CHAR;
598 strWIDList[u8WidCnt].size = sizeof(char);
599 hif_drv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode;
601 PRINT_ER("Invalide power mode\n");
607 if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_SHORT) {
608 if ((strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit < 256)) {
609 strWIDList[u8WidCnt].id = WID_SHORT_RETRY_LIMIT;
610 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit;
611 strWIDList[u8WidCnt].type = WID_SHORT;
612 strWIDList[u8WidCnt].size = sizeof(u16);
613 hif_drv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit;
615 PRINT_ER("Range(1~256) over\n");
621 if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_LONG) {
622 if ((strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit < 256)) {
623 strWIDList[u8WidCnt].id = WID_LONG_RETRY_LIMIT;
624 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit;
626 strWIDList[u8WidCnt].type = WID_SHORT;
627 strWIDList[u8WidCnt].size = sizeof(u16);
628 hif_drv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit;
630 PRINT_ER("Range(1~256) over\n");
636 if (strHostIFCfgParamAttr->cfg_attr_info.flag & FRAG_THRESHOLD) {
638 if (strHostIFCfgParamAttr->cfg_attr_info.frag_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.frag_threshold < 7937) {
639 strWIDList[u8WidCnt].id = WID_FRAG_THRESHOLD;
640 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.frag_threshold;
641 strWIDList[u8WidCnt].type = WID_SHORT;
642 strWIDList[u8WidCnt].size = sizeof(u16);
643 hif_drv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->cfg_attr_info.frag_threshold;
645 PRINT_ER("Threshold Range fail\n");
651 if (strHostIFCfgParamAttr->cfg_attr_info.flag & RTS_THRESHOLD) {
652 if (strHostIFCfgParamAttr->cfg_attr_info.rts_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.rts_threshold < 65536) {
653 strWIDList[u8WidCnt].id = WID_RTS_THRESHOLD;
654 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.rts_threshold;
655 strWIDList[u8WidCnt].type = WID_SHORT;
656 strWIDList[u8WidCnt].size = sizeof(u16);
657 hif_drv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->cfg_attr_info.rts_threshold;
659 PRINT_ER("Threshold Range fail\n");
665 if (strHostIFCfgParamAttr->cfg_attr_info.flag & PREAMBLE) {
666 if (strHostIFCfgParamAttr->cfg_attr_info.preamble_type < 3) {
667 strWIDList[u8WidCnt].id = WID_PREAMBLE;
668 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.preamble_type;
669 strWIDList[u8WidCnt].type = WID_CHAR;
670 strWIDList[u8WidCnt].size = sizeof(char);
671 hif_drv->strCfgValues.preamble_type = strHostIFCfgParamAttr->cfg_attr_info.preamble_type;
673 PRINT_ER("Preamle Range(0~2) over\n");
679 if (strHostIFCfgParamAttr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) {
680 if (strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed < 2) {
681 strWIDList[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED;
682 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed;
683 strWIDList[u8WidCnt].type = WID_CHAR;
684 strWIDList[u8WidCnt].size = sizeof(char);
685 hif_drv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed;
687 PRINT_ER("Short slot(2) over\n");
693 if (strHostIFCfgParamAttr->cfg_attr_info.flag & TXOP_PROT_DISABLE) {
694 if (strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled < 2) {
695 strWIDList[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE;
696 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled;
697 strWIDList[u8WidCnt].type = WID_CHAR;
698 strWIDList[u8WidCnt].size = sizeof(char);
699 hif_drv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled;
701 PRINT_ER("TXOP prot disable\n");
707 if (strHostIFCfgParamAttr->cfg_attr_info.flag & BEACON_INTERVAL) {
708 if (strHostIFCfgParamAttr->cfg_attr_info.beacon_interval > 0 && strHostIFCfgParamAttr->cfg_attr_info.beacon_interval < 65536) {
709 strWIDList[u8WidCnt].id = WID_BEACON_INTERVAL;
710 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.beacon_interval;
711 strWIDList[u8WidCnt].type = WID_SHORT;
712 strWIDList[u8WidCnt].size = sizeof(u16);
713 hif_drv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->cfg_attr_info.beacon_interval;
715 PRINT_ER("Beacon interval(1~65535) fail\n");
721 if (strHostIFCfgParamAttr->cfg_attr_info.flag & DTIM_PERIOD) {
722 if (strHostIFCfgParamAttr->cfg_attr_info.dtim_period > 0 && strHostIFCfgParamAttr->cfg_attr_info.dtim_period < 256) {
723 strWIDList[u8WidCnt].id = WID_DTIM_PERIOD;
724 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.dtim_period;
725 strWIDList[u8WidCnt].type = WID_CHAR;
726 strWIDList[u8WidCnt].size = sizeof(char);
727 hif_drv->strCfgValues.dtim_period = strHostIFCfgParamAttr->cfg_attr_info.dtim_period;
729 PRINT_ER("DTIM range(1~255) fail\n");
735 if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY) {
736 if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled < 3) {
737 strWIDList[u8WidCnt].id = WID_SITE_SURVEY;
738 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled;
739 strWIDList[u8WidCnt].type = WID_CHAR;
740 strWIDList[u8WidCnt].size = sizeof(char);
741 hif_drv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled;
743 PRINT_ER("Site survey disable\n");
749 if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) {
750 if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time < 65536) {
751 strWIDList[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME;
752 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time;
753 strWIDList[u8WidCnt].type = WID_SHORT;
754 strWIDList[u8WidCnt].size = sizeof(u16);
755 hif_drv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time;
757 PRINT_ER("Site survey scan time(1~65535) over\n");
763 if (strHostIFCfgParamAttr->cfg_attr_info.flag & ACTIVE_SCANTIME) {
764 if (strHostIFCfgParamAttr->cfg_attr_info.active_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.active_scan_time < 65536) {
765 strWIDList[u8WidCnt].id = WID_ACTIVE_SCAN_TIME;
766 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.active_scan_time;
767 strWIDList[u8WidCnt].type = WID_SHORT;
768 strWIDList[u8WidCnt].size = sizeof(u16);
769 hif_drv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->cfg_attr_info.active_scan_time;
771 PRINT_ER("Active scan time(1~65535) over\n");
777 if (strHostIFCfgParamAttr->cfg_attr_info.flag & PASSIVE_SCANTIME) {
778 if (strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time < 65536) {
779 strWIDList[u8WidCnt].id = WID_PASSIVE_SCAN_TIME;
780 strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time;
781 strWIDList[u8WidCnt].type = WID_SHORT;
782 strWIDList[u8WidCnt].size = sizeof(u16);
783 hif_drv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time;
785 PRINT_ER("Passive scan time(1~65535) over\n");
791 if (strHostIFCfgParamAttr->cfg_attr_info.flag & CURRENT_TX_RATE) {
792 enum CURRENT_TXRATE curr_tx_rate = strHostIFCfgParamAttr->cfg_attr_info.curr_tx_rate;
793 if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1
794 || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5
795 || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6
796 || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12
797 || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24
798 || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) {
799 strWIDList[u8WidCnt].id = WID_CURRENT_TX_RATE;
800 strWIDList[u8WidCnt].val = (s8 *)&curr_tx_rate;
801 strWIDList[u8WidCnt].type = WID_SHORT;
802 strWIDList[u8WidCnt].size = sizeof(u16);
803 hif_drv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate;
805 PRINT_ER("out of TX rate\n");
811 s32Error = send_config_pkt(SET_CFG, strWIDList, u8WidCnt,
812 get_id_from_handler(hif_drv));
815 PRINT_ER("Error in setting CFG params\n");
818 up(&hif_drv->gtOsCfgValuesSem);
822 static s32 Handle_wait_msg_q_empty(void)
824 g_wilc_initialized = 0;
829 static s32 Handle_Scan(struct host_if_drv *hif_drv,
830 struct scan_attr *pstrHostIFscanAttr)
833 struct wid strWIDList[5];
834 u32 u32WidsCount = 0;
838 u8 *pu8HdnNtwrksWidVal = NULL;
840 PRINT_D(HOSTINF_DBG, "Setting SCAN params\n");
841 PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->enuHostIFstate);
843 hif_drv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult;
844 hif_drv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg;
846 if ((hif_drv->enuHostIFstate >= HOST_IF_SCANNING) && (hif_drv->enuHostIFstate < HOST_IF_CONNECTED)) {
847 PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", hif_drv->enuHostIFstate);
848 PRINT_ER("Already scan\n");
853 if (g_obtainingIP || connecting) {
854 PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
855 PRINT_ER("Don't do obss scan\n");
860 PRINT_D(HOSTINF_DBG, "Setting SCAN params\n");
863 hif_drv->strWILC_UsrScanReq.u32RcvdChCount = 0;
865 strWIDList[u32WidsCount].id = (u16)WID_SSID_PROBE_REQ;
866 strWIDList[u32WidsCount].type = WID_STR;
868 for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++)
869 valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1);
870 pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL);
871 strWIDList[u32WidsCount].val = pu8HdnNtwrksWidVal;
872 if (strWIDList[u32WidsCount].val != NULL) {
873 pu8Buffer = strWIDList[u32WidsCount].val;
875 *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum;
877 PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum);
879 for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) {
880 *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen;
881 memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen);
882 pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen;
887 strWIDList[u32WidsCount].size = (s32)(valuesize + 1);
892 strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_PROBE;
893 strWIDList[u32WidsCount].type = WID_BIN_DATA;
894 strWIDList[u32WidsCount].val = pstrHostIFscanAttr->pu8IEs;
895 strWIDList[u32WidsCount].size = pstrHostIFscanAttr->IEsLen;
899 strWIDList[u32WidsCount].id = WID_SCAN_TYPE;
900 strWIDList[u32WidsCount].type = WID_CHAR;
901 strWIDList[u32WidsCount].size = sizeof(char);
902 strWIDList[u32WidsCount].val = (s8 *)(&(pstrHostIFscanAttr->u8ScanType));
905 strWIDList[u32WidsCount].id = WID_SCAN_CHANNEL_LIST;
906 strWIDList[u32WidsCount].type = WID_BIN_DATA;
908 if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) {
911 for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) {
912 if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0)
913 pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1;
917 strWIDList[u32WidsCount].val = pstrHostIFscanAttr->pu8ChnlFreqList;
918 strWIDList[u32WidsCount].size = pstrHostIFscanAttr->u8ChnlListLen;
921 strWIDList[u32WidsCount].id = WID_START_SCAN_REQ;
922 strWIDList[u32WidsCount].type = WID_CHAR;
923 strWIDList[u32WidsCount].size = sizeof(char);
924 strWIDList[u32WidsCount].val = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource));
927 if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)
928 gbScanWhileConnected = true;
929 else if (hif_drv->enuHostIFstate == HOST_IF_IDLE)
930 gbScanWhileConnected = false;
932 s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
933 get_id_from_handler(hif_drv));
936 PRINT_ER("Failed to send scan paramters config packet\n");
938 PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n");
942 del_timer(&hif_drv->hScanTimer);
943 Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED);
946 if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) {
947 kfree(pstrHostIFscanAttr->pu8ChnlFreqList);
948 pstrHostIFscanAttr->pu8ChnlFreqList = NULL;
951 if (pstrHostIFscanAttr->pu8IEs != NULL) {
952 kfree(pstrHostIFscanAttr->pu8IEs);
953 pstrHostIFscanAttr->pu8IEs = NULL;
955 if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) {
956 kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo);
957 pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL;
960 if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) {
961 kfree(pstrHostIFscanAttr->pu8ChnlFreqList);
962 pstrHostIFscanAttr->pu8ChnlFreqList = NULL;
965 if (pu8HdnNtwrksWidVal != NULL)
966 kfree(pu8HdnNtwrksWidVal);
971 static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
972 enum scan_event enuEvent)
975 u8 u8abort_running_scan;
979 PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n");
981 if (enuEvent == SCAN_EVENT_ABORTED) {
982 PRINT_D(GENERIC_DBG, "Abort running scan\n");
983 u8abort_running_scan = 1;
984 strWID.id = (u16)WID_ABORT_RUNNING_SCAN;
985 strWID.type = WID_CHAR;
986 strWID.val = (s8 *)&u8abort_running_scan;
987 strWID.size = sizeof(char);
989 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
990 get_id_from_handler(hif_drv));
992 PRINT_ER("Failed to set abort running scan\n");
998 PRINT_ER("Driver handler is NULL\n");
1002 if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) {
1003 hif_drv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL,
1004 hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL);
1005 hif_drv->strWILC_UsrScanReq.pfUserScanResult = NULL;
1011 u8 u8ConnectedSSID[6] = {0};
1012 static s32 Handle_Connect(struct host_if_drv *hif_drv,
1013 struct connect_attr *pstrHostIFconnectAttr)
1016 struct wid strWIDList[8];
1017 u32 u32WidsCount = 0, dummyval = 0;
1018 u8 *pu8CurrByte = NULL;
1019 struct join_bss_param *ptstrJoinBssParam;
1021 PRINT_D(GENERIC_DBG, "Handling connect request\n");
1023 if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) {
1026 PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n");
1030 PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n");
1032 ptstrJoinBssParam = (struct join_bss_param *)pstrHostIFconnectAttr->pJoinParams;
1033 if (ptstrJoinBssParam == NULL) {
1034 PRINT_ER("Required BSSID not found\n");
1039 if (pstrHostIFconnectAttr->pu8bssid != NULL) {
1040 hif_drv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL);
1041 memcpy(hif_drv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6);
1044 hif_drv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen;
1045 if (pstrHostIFconnectAttr->pu8ssid != NULL) {
1046 hif_drv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL);
1047 memcpy(hif_drv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid,
1048 pstrHostIFconnectAttr->ssidLen);
1049 hif_drv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0';
1052 hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen;
1053 if (pstrHostIFconnectAttr->pu8IEs != NULL) {
1054 hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL);
1055 memcpy(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs,
1056 pstrHostIFconnectAttr->IEsLen);
1059 hif_drv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security;
1060 hif_drv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type;
1061 hif_drv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult;
1062 hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg;
1064 strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
1065 strWIDList[u32WidsCount].type = WID_INT;
1066 strWIDList[u32WidsCount].size = sizeof(u32);
1067 strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
1070 strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
1071 strWIDList[u32WidsCount].type = WID_INT;
1072 strWIDList[u32WidsCount].size = sizeof(u32);
1073 strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
1076 strWIDList[u32WidsCount].id = WID_FAILED_COUNT;
1077 strWIDList[u32WidsCount].type = WID_INT;
1078 strWIDList[u32WidsCount].size = sizeof(u32);
1079 strWIDList[u32WidsCount].val = (s8 *)(&(dummyval));
1083 strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
1084 strWIDList[u32WidsCount].type = WID_BIN_DATA;
1085 strWIDList[u32WidsCount].val = hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs;
1086 strWIDList[u32WidsCount].size = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen;
1089 if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) {
1091 gu32FlushedInfoElemAsocSize = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen;
1092 gu8FlushedInfoElemAsoc = kmalloc(gu32FlushedInfoElemAsocSize, GFP_KERNEL);
1093 memcpy(gu8FlushedInfoElemAsoc, hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs,
1094 gu32FlushedInfoElemAsocSize);
1097 strWIDList[u32WidsCount].id = (u16)WID_11I_MODE;
1098 strWIDList[u32WidsCount].type = WID_CHAR;
1099 strWIDList[u32WidsCount].size = sizeof(char);
1100 strWIDList[u32WidsCount].val = (s8 *)(&(hif_drv->strWILC_UsrConnReq.u8security));
1103 if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7))
1104 gu8Flushed11iMode = hif_drv->strWILC_UsrConnReq.u8security;
1106 PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", hif_drv->strWILC_UsrConnReq.u8security);
1109 strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE;
1110 strWIDList[u32WidsCount].type = WID_CHAR;
1111 strWIDList[u32WidsCount].size = sizeof(char);
1112 strWIDList[u32WidsCount].val = (s8 *)(&hif_drv->strWILC_UsrConnReq.tenuAuth_type);
1115 if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7))
1116 gu8FlushedAuthType = (u8)hif_drv->strWILC_UsrConnReq.tenuAuth_type;
1118 PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", hif_drv->strWILC_UsrConnReq.tenuAuth_type);
1119 PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n",
1120 hif_drv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel);
1122 strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
1123 strWIDList[u32WidsCount].type = WID_STR;
1124 strWIDList[u32WidsCount].size = 112;
1125 strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, GFP_KERNEL);
1127 if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) {
1128 gu32FlushedJoinReqSize = strWIDList[u32WidsCount].size;
1129 gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL);
1131 if (strWIDList[u32WidsCount].val == NULL) {
1136 pu8CurrByte = strWIDList[u32WidsCount].val;
1139 if (pstrHostIFconnectAttr->pu8ssid != NULL) {
1140 memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen);
1141 pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0';
1143 pu8CurrByte += MAX_SSID_LEN;
1144 *(pu8CurrByte++) = INFRASTRUCTURE;
1146 if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) {
1147 *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel;
1149 PRINT_ER("Channel out of range\n");
1150 *(pu8CurrByte++) = 0xFF;
1152 *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF;
1153 *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF;
1154 PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8)));
1156 if (pstrHostIFconnectAttr->pu8bssid != NULL)
1157 memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6);
1160 if (pstrHostIFconnectAttr->pu8bssid != NULL)
1161 memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6);
1164 *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF;
1165 *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF;
1166 PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8)));
1167 *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period;
1168 PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1)));
1170 memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1);
1171 pu8CurrByte += (MAX_RATES_SUPPORTED + 1);
1173 *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap;
1174 PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1)));
1175 *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap;
1177 *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable;
1178 hif_drv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable;
1180 *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found;
1181 PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1));
1182 *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy;
1183 PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1)));
1184 *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i;
1185 PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1)));
1187 memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy));
1188 pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy);
1190 memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy));
1191 pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy);
1193 memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap));
1194 pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap);
1196 *(pu8CurrByte++) = REAL_JOIN_REQ;
1198 *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled;
1199 if (ptstrJoinBssParam->u8NoaEnbaled) {
1200 PRINT_D(HOSTINF_DBG, "NOA present\n");
1202 *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF;
1203 *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF;
1204 *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF;
1205 *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF;
1207 *(pu8CurrByte++) = ptstrJoinBssParam->u8Index;
1209 *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable;
1211 if (ptstrJoinBssParam->u8OppEnable)
1212 *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow;
1214 *(pu8CurrByte++) = ptstrJoinBssParam->u8Count;
1216 memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration));
1218 pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration);
1220 memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval));
1222 pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval);
1224 memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime));
1226 pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime);
1229 PRINT_D(HOSTINF_DBG, "NOA not present\n");
1231 pu8CurrByte = strWIDList[u32WidsCount].val;
1233 gu32WidConnRstHack = 0;
1235 if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) {
1236 memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize);
1237 gu8FlushedJoinReqDrvHandler = hif_drv;
1240 PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");
1242 if (pstrHostIFconnectAttr->pu8bssid != NULL) {
1243 memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN);
1245 PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->pu8bssid);
1246 PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID);
1249 s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
1250 get_id_from_handler(hif_drv));
1252 PRINT_ER("failed to send config packet\n");
1256 PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n");
1257 hif_drv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP;
1262 tstrConnectInfo strConnectInfo;
1264 del_timer(&hif_drv->hConnectTimer);
1266 PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n");
1268 memset(&strConnectInfo, 0, sizeof(tstrConnectInfo));
1270 if (pstrHostIFconnectAttr->pfConnectResult != NULL) {
1271 if (pstrHostIFconnectAttr->pu8bssid != NULL)
1272 memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6);
1274 if (pstrHostIFconnectAttr->pu8IEs != NULL) {
1275 strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen;
1276 strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL);
1277 memcpy(strConnectInfo.pu8ReqIEs,
1278 pstrHostIFconnectAttr->pu8IEs,
1279 pstrHostIFconnectAttr->IEsLen);
1282 pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP,
1286 pstrHostIFconnectAttr->pvUserArg);
1287 hif_drv->enuHostIFstate = HOST_IF_IDLE;
1288 if (strConnectInfo.pu8ReqIEs != NULL) {
1289 kfree(strConnectInfo.pu8ReqIEs);
1290 strConnectInfo.pu8ReqIEs = NULL;
1294 PRINT_ER("Connect callback function pointer is NULL\n");
1298 PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n");
1299 if (pstrHostIFconnectAttr->pu8bssid != NULL) {
1300 kfree(pstrHostIFconnectAttr->pu8bssid);
1301 pstrHostIFconnectAttr->pu8bssid = NULL;
1304 if (pstrHostIFconnectAttr->pu8ssid != NULL) {
1305 kfree(pstrHostIFconnectAttr->pu8ssid);
1306 pstrHostIFconnectAttr->pu8ssid = NULL;
1309 if (pstrHostIFconnectAttr->pu8IEs != NULL) {
1310 kfree(pstrHostIFconnectAttr->pu8IEs);
1311 pstrHostIFconnectAttr->pu8IEs = NULL;
1314 if (pu8CurrByte != NULL)
1319 static s32 Handle_FlushConnect(struct host_if_drv *hif_drv)
1322 struct wid strWIDList[5];
1323 u32 u32WidsCount = 0;
1324 u8 *pu8CurrByte = NULL;
1326 strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE;
1327 strWIDList[u32WidsCount].type = WID_BIN_DATA;
1328 strWIDList[u32WidsCount].val = gu8FlushedInfoElemAsoc;
1329 strWIDList[u32WidsCount].size = gu32FlushedInfoElemAsocSize;
1332 strWIDList[u32WidsCount].id = (u16)WID_11I_MODE;
1333 strWIDList[u32WidsCount].type = WID_CHAR;
1334 strWIDList[u32WidsCount].size = sizeof(char);
1335 strWIDList[u32WidsCount].val = (s8 *)(&(gu8Flushed11iMode));
1340 strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE;
1341 strWIDList[u32WidsCount].type = WID_CHAR;
1342 strWIDList[u32WidsCount].size = sizeof(char);
1343 strWIDList[u32WidsCount].val = (s8 *)(&gu8FlushedAuthType);
1346 strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED;
1347 strWIDList[u32WidsCount].type = WID_STR;
1348 strWIDList[u32WidsCount].size = gu32FlushedJoinReqSize;
1349 strWIDList[u32WidsCount].val = (s8 *)gu8FlushedJoinReq;
1350 pu8CurrByte = strWIDList[u32WidsCount].val;
1352 pu8CurrByte += FLUSHED_BYTE_POS;
1353 *(pu8CurrByte) = FLUSHED_JOIN_REQ;
1357 s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount,
1358 get_id_from_handler(gu8FlushedJoinReqDrvHandler));
1360 PRINT_ER("failed to send config packet\n");
1367 static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv)
1370 tstrConnectInfo strConnectInfo;
1372 u16 u16DummyReasonCode = 0;
1375 PRINT_ER("Driver handler is NULL\n");
1379 hif_drv->enuHostIFstate = HOST_IF_IDLE;
1381 gbScanWhileConnected = false;
1384 memset(&strConnectInfo, 0, sizeof(tstrConnectInfo));
1386 if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult != NULL) {
1387 if (hif_drv->strWILC_UsrConnReq.pu8bssid != NULL) {
1388 memcpy(strConnectInfo.au8bssid,
1389 hif_drv->strWILC_UsrConnReq.pu8bssid, 6);
1392 if (hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) {
1393 strConnectInfo.ReqIEsLen = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen;
1394 strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL);
1395 memcpy(strConnectInfo.pu8ReqIEs,
1396 hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs,
1397 hif_drv->strWILC_UsrConnReq.ConnReqIEsLen);
1400 hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP,
1404 hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid);
1406 if (strConnectInfo.pu8ReqIEs != NULL) {
1407 kfree(strConnectInfo.pu8ReqIEs);
1408 strConnectInfo.pu8ReqIEs = NULL;
1411 PRINT_ER("Connect callback function pointer is NULL\n");
1414 strWID.id = (u16)WID_DISCONNECT;
1415 strWID.type = WID_CHAR;
1416 strWID.val = (s8 *)&u16DummyReasonCode;
1417 strWID.size = sizeof(char);
1419 PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");
1421 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
1422 get_id_from_handler(hif_drv));
1424 PRINT_ER("Failed to send dissconect config packet\n");
1426 hif_drv->strWILC_UsrConnReq.ssidLen = 0;
1427 kfree(hif_drv->strWILC_UsrConnReq.pu8ssid);
1428 kfree(hif_drv->strWILC_UsrConnReq.pu8bssid);
1429 hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
1430 kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs);
1432 eth_zero_addr(u8ConnectedSSID);
1434 if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
1435 kfree(gu8FlushedJoinReq);
1436 gu8FlushedJoinReq = NULL;
1438 if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
1439 kfree(gu8FlushedInfoElemAsoc);
1440 gu8FlushedInfoElemAsoc = NULL;
1446 static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv,
1447 struct rcvd_net_info *pstrRcvdNetworkInfo)
1450 bool bNewNtwrkFound;
1455 tstrNetworkInfo *pstrNetworkInfo = NULL;
1456 void *pJoinParams = NULL;
1458 bNewNtwrkFound = true;
1459 PRINT_INFO(HOSTINF_DBG, "Handling received network info\n");
1461 if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) {
1462 PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n");
1463 parse_network_info(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo);
1464 if ((pstrNetworkInfo == NULL)
1465 || (hif_drv->strWILC_UsrScanReq.pfUserScanResult == NULL)) {
1466 PRINT_ER("driver is null\n");
1471 for (i = 0; i < hif_drv->strWILC_UsrScanReq.u32RcvdChCount; i++) {
1473 if ((hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) &&
1474 (pstrNetworkInfo->au8bssid != NULL)) {
1475 if (memcmp(hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid,
1476 pstrNetworkInfo->au8bssid, 6) == 0) {
1477 if (pstrNetworkInfo->s8rssi <= hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) {
1478 PRINT_D(HOSTINF_DBG, "Network previously discovered\n");
1481 hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi;
1482 bNewNtwrkFound = false;
1489 if (bNewNtwrkFound == true) {
1490 PRINT_D(HOSTINF_DBG, "New network found\n");
1492 if (hif_drv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) {
1493 hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[hif_drv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi;
1495 if ((hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[hif_drv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL)
1496 && (pstrNetworkInfo->au8bssid != NULL)) {
1497 memcpy(hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[hif_drv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid,
1498 pstrNetworkInfo->au8bssid, 6);
1500 hif_drv->strWILC_UsrScanReq.u32RcvdChCount++;
1502 pstrNetworkInfo->bNewNetwork = true;
1503 pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo);
1505 hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
1506 hif_drv->strWILC_UsrScanReq.u32UserScanPvoid,
1512 PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n");
1515 pstrNetworkInfo->bNewNetwork = false;
1516 hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo,
1517 hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL);
1522 if (pstrRcvdNetworkInfo->pu8Buffer != NULL) {
1523 kfree(pstrRcvdNetworkInfo->pu8Buffer);
1524 pstrRcvdNetworkInfo->pu8Buffer = NULL;
1527 if (pstrNetworkInfo != NULL) {
1528 DeallocateNetworkInfo(pstrNetworkInfo);
1529 pstrNetworkInfo = NULL;
1535 static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
1536 struct rcvd_async_info *pstrRcvdGnrlAsyncInfo)
1542 u16 u16WidID = (u16)WID_NIL;
1545 u8 u8MacStatusReasonCode;
1546 u8 u8MacStatusAdditionalInfo;
1547 tstrConnectInfo strConnectInfo;
1548 tstrDisconnectNotifInfo strDisconnectNotifInfo;
1552 PRINT_ER("Driver handler is NULL\n");
1555 PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", hif_drv->enuHostIFstate,
1556 pstrRcvdGnrlAsyncInfo->pu8Buffer[7]);
1558 if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) ||
1559 (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) ||
1560 hif_drv->strWILC_UsrScanReq.pfUserScanResult) {
1561 if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) ||
1562 (hif_drv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) {
1563 PRINT_ER("driver is null\n");
1567 u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0];
1569 if ('I' != u8MsgType) {
1570 PRINT_ER("Received Message format incorrect.\n");
1574 u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1];
1575 u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]);
1576 u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]);
1577 u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6];
1578 u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7];
1579 u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8];
1580 u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9];
1581 PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo);
1582 if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
1583 u32 u32RcvdAssocRespInfoLen;
1584 tstrConnectRespInfo *pstrConnectRespInfo = NULL;
1586 PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo);
1588 memset(&strConnectInfo, 0, sizeof(tstrConnectInfo));
1590 if (u8MacStatus == MAC_CONNECTED) {
1591 memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE);
1593 host_int_get_assoc_res_info(hif_drv,
1595 MAX_ASSOC_RESP_FRAME_SIZE,
1596 &u32RcvdAssocRespInfoLen);
1598 PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen);
1600 if (u32RcvdAssocRespInfoLen != 0) {
1602 PRINT_D(HOSTINF_DBG, "Parsing association response\n");
1603 s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen,
1604 &pstrConnectRespInfo);
1606 PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err);
1608 strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus;
1610 if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) {
1611 PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n");
1612 if (pstrConnectRespInfo->pu8RespIEs != NULL) {
1613 strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen;
1616 strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL);
1617 memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs,
1618 pstrConnectRespInfo->u16RespIEsLen);
1622 if (pstrConnectRespInfo != NULL) {
1623 DeallocateAssocRespInfo(pstrConnectRespInfo);
1624 pstrConnectRespInfo = NULL;
1630 if ((u8MacStatus == MAC_CONNECTED) &&
1631 (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) {
1632 PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
1633 eth_zero_addr(u8ConnectedSSID);
1635 } else if (u8MacStatus == MAC_DISCONNECTED) {
1636 PRINT_ER("Received MAC status is MAC_DISCONNECTED\n");
1637 eth_zero_addr(u8ConnectedSSID);
1640 if (hif_drv->strWILC_UsrConnReq.pu8bssid != NULL) {
1641 PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n");
1642 memcpy(strConnectInfo.au8bssid, hif_drv->strWILC_UsrConnReq.pu8bssid, 6);
1644 if ((u8MacStatus == MAC_CONNECTED) &&
1645 (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
1646 memcpy(hif_drv->au8AssociatedBSSID,
1647 hif_drv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN);
1652 if (hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) {
1653 strConnectInfo.ReqIEsLen = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen;
1654 strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL);
1655 memcpy(strConnectInfo.pu8ReqIEs,
1656 hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs,
1657 hif_drv->strWILC_UsrConnReq.ConnReqIEsLen);
1661 del_timer(&hif_drv->hConnectTimer);
1662 hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP,
1666 hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid);
1668 if ((u8MacStatus == MAC_CONNECTED) &&
1669 (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) {
1670 host_int_set_power_mgmt(hif_drv, 0, 0);
1672 PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n");
1673 hif_drv->enuHostIFstate = HOST_IF_CONNECTED;
1675 PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n");
1676 g_obtainingIP = true;
1677 mod_timer(&hDuringIpTimer,
1678 jiffies + msecs_to_jiffies(10000));
1680 PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus);
1681 hif_drv->enuHostIFstate = HOST_IF_IDLE;
1682 gbScanWhileConnected = false;
1685 if (strConnectInfo.pu8RespIEs != NULL) {
1686 kfree(strConnectInfo.pu8RespIEs);
1687 strConnectInfo.pu8RespIEs = NULL;
1690 if (strConnectInfo.pu8ReqIEs != NULL) {
1691 kfree(strConnectInfo.pu8ReqIEs);
1692 strConnectInfo.pu8ReqIEs = NULL;
1694 hif_drv->strWILC_UsrConnReq.ssidLen = 0;
1695 kfree(hif_drv->strWILC_UsrConnReq.pu8ssid);
1696 kfree(hif_drv->strWILC_UsrConnReq.pu8bssid);
1697 hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
1698 kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs);
1699 } else if ((u8MacStatus == MAC_DISCONNECTED) &&
1700 (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)) {
1701 PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n");
1703 memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo));
1705 if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) {
1706 PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n");
1707 del_timer(&hif_drv->hScanTimer);
1708 Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED);
1711 strDisconnectNotifInfo.u16reason = 0;
1712 strDisconnectNotifInfo.ie = NULL;
1713 strDisconnectNotifInfo.ie_len = 0;
1715 if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult != NULL) {
1716 g_obtainingIP = false;
1717 host_int_set_power_mgmt(hif_drv, 0, 0);
1719 hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF,
1722 &strDisconnectNotifInfo,
1723 hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid);
1726 PRINT_ER("Connect result callback function is NULL\n");
1729 eth_zero_addr(hif_drv->au8AssociatedBSSID);
1731 hif_drv->strWILC_UsrConnReq.ssidLen = 0;
1732 kfree(hif_drv->strWILC_UsrConnReq.pu8ssid);
1733 kfree(hif_drv->strWILC_UsrConnReq.pu8bssid);
1734 hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
1735 kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs);
1737 if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
1738 kfree(gu8FlushedJoinReq);
1739 gu8FlushedJoinReq = NULL;
1741 if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
1742 kfree(gu8FlushedInfoElemAsoc);
1743 gu8FlushedInfoElemAsoc = NULL;
1746 hif_drv->enuHostIFstate = HOST_IF_IDLE;
1747 gbScanWhileConnected = false;
1749 } else if ((u8MacStatus == MAC_DISCONNECTED) &&
1750 (hif_drv->strWILC_UsrScanReq.pfUserScanResult != NULL)) {
1751 PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n");
1752 PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n");
1754 del_timer(&hif_drv->hScanTimer);
1755 if (hif_drv->strWILC_UsrScanReq.pfUserScanResult)
1756 Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED);
1762 if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) {
1763 kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer);
1764 pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL;
1770 static int Handle_Key(struct host_if_drv *hif_drv,
1771 struct key_attr *pstrHostIFkeyAttr)
1775 struct wid strWIDList[5];
1781 switch (pstrHostIFkeyAttr->type) {
1786 if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) {
1788 PRINT_D(HOSTINF_DBG, "Handling WEP key\n");
1789 PRINT_D(GENERIC_DBG, "ID Hostint is %d\n", (pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.index));
1790 strWIDList[0].id = (u16)WID_11I_MODE;
1791 strWIDList[0].type = WID_CHAR;
1792 strWIDList[0].size = sizeof(char);
1793 strWIDList[0].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.mode));
1795 strWIDList[1].id = WID_AUTH_TYPE;
1796 strWIDList[1].type = WID_CHAR;
1797 strWIDList[1].size = sizeof(char);
1798 strWIDList[1].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.auth_type));
1800 strWIDList[2].id = (u16)WID_KEY_ID;
1801 strWIDList[2].type = WID_CHAR;
1803 strWIDList[2].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.index));
1804 strWIDList[2].size = sizeof(char);
1807 pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len, GFP_KERNEL);
1810 if (pu8keybuf == NULL) {
1811 PRINT_ER("No buffer to send Key\n");
1815 memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key,
1816 pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len);
1819 kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key);
1821 strWIDList[3].id = (u16)WID_WEP_KEY_VALUE;
1822 strWIDList[3].type = WID_STR;
1823 strWIDList[3].size = pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len;
1824 strWIDList[3].val = (s8 *)pu8keybuf;
1827 s32Error = send_config_pkt(SET_CFG, strWIDList, 4,
1828 get_id_from_handler(hif_drv));
1834 if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) {
1835 PRINT_D(HOSTINF_DBG, "Handling WEP key\n");
1836 pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len + 2, GFP_KERNEL);
1837 if (pu8keybuf == NULL) {
1838 PRINT_ER("No buffer to send Key\n");
1841 pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.index;
1843 memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len, 1);
1845 memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key,
1846 pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len);
1848 kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key);
1850 strWID.id = (u16)WID_ADD_WEP_KEY;
1851 strWID.type = WID_STR;
1852 strWID.val = (s8 *)pu8keybuf;
1853 strWID.size = pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len + 2;
1855 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
1856 get_id_from_handler(hif_drv));
1858 } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) {
1860 PRINT_D(HOSTINF_DBG, "Removing key\n");
1861 strWID.id = (u16)WID_REMOVE_WEP_KEY;
1862 strWID.type = WID_STR;
1864 s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.index;
1865 strWID.val = s8idxarray;
1868 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
1869 get_id_from_handler(hif_drv));
1871 strWID.id = (u16)WID_KEY_ID;
1872 strWID.type = WID_CHAR;
1873 strWID.val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.index));
1874 strWID.size = sizeof(char);
1876 PRINT_D(HOSTINF_DBG, "Setting default key index\n");
1878 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
1879 get_id_from_handler(hif_drv));
1881 up(&hif_drv->hSemTestKeyBlock);
1885 if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) {
1886 pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
1887 if (pu8keybuf == NULL) {
1888 PRINT_ER("No buffer to send RxGTK Key\n");
1890 goto _WPARxGtk_end_case_;
1893 memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN);
1895 if (pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8seq != NULL)
1896 memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8seq, 8);
1899 memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8keyidx, 1);
1901 memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen, 1);
1903 memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key,
1904 pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen);
1905 strWIDList[0].id = (u16)WID_11I_MODE;
1906 strWIDList[0].type = WID_CHAR;
1907 strWIDList[0].size = sizeof(char);
1908 strWIDList[0].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Ciphermode));
1910 strWIDList[1].id = (u16)WID_ADD_RX_GTK;
1911 strWIDList[1].type = WID_STR;
1912 strWIDList[1].val = (s8 *)pu8keybuf;
1913 strWIDList[1].size = RX_MIC_KEY_MSG_LEN;
1915 s32Error = send_config_pkt(SET_CFG, strWIDList, 2,
1916 get_id_from_handler(hif_drv));
1919 up(&hif_drv->hSemTestKeyBlock);
1922 if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) {
1923 PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n");
1925 pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
1926 if (pu8keybuf == NULL) {
1927 PRINT_ER("No buffer to send RxGTK Key\n");
1929 goto _WPARxGtk_end_case_;
1932 memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN);
1934 if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)
1935 memcpy(pu8keybuf, hif_drv->au8AssociatedBSSID, ETH_ALEN);
1937 PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n");
1939 memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8seq, 8);
1941 memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8keyidx, 1);
1943 memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen, 1);
1944 memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key,
1945 pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen);
1947 strWID.id = (u16)WID_ADD_RX_GTK;
1948 strWID.type = WID_STR;
1949 strWID.val = (s8 *)pu8keybuf;
1950 strWID.size = RX_MIC_KEY_MSG_LEN;
1952 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
1953 get_id_from_handler(hif_drv));
1956 up(&hif_drv->hSemTestKeyBlock);
1958 _WPARxGtk_end_case_:
1959 kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key);
1960 kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8seq);
1967 if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) {
1970 pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL);
1974 if (pu8keybuf == NULL) {
1975 PRINT_ER("No buffer to send PTK Key\n");
1977 goto _WPAPtk_end_case_;
1981 memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8macaddr, 6);
1982 memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8keyidx, 1);
1983 memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen, 1);
1984 memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key,
1985 pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen);
1988 strWIDList[0].id = (u16)WID_11I_MODE;
1989 strWIDList[0].type = WID_CHAR;
1990 strWIDList[0].size = sizeof(char);
1991 strWIDList[0].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Ciphermode));
1993 strWIDList[1].id = (u16)WID_ADD_PTK;
1994 strWIDList[1].type = WID_STR;
1995 strWIDList[1].val = (s8 *)pu8keybuf;
1996 strWIDList[1].size = PTK_KEY_MSG_LEN + 1;
1998 s32Error = send_config_pkt(SET_CFG, strWIDList, 2,
1999 get_id_from_handler(hif_drv));
2001 up(&hif_drv->hSemTestKeyBlock);
2003 if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) {
2006 pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
2010 if (pu8keybuf == NULL) {
2011 PRINT_ER("No buffer to send PTK Key\n");
2013 goto _WPAPtk_end_case_;
2017 memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8macaddr, 6);
2018 memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen, 1);
2019 memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key,
2020 pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen);
2023 strWID.id = (u16)WID_ADD_PTK;
2024 strWID.type = WID_STR;
2025 strWID.val = (s8 *)pu8keybuf;
2026 strWID.size = PTK_KEY_MSG_LEN;
2028 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2029 get_id_from_handler(hif_drv));
2031 up(&hif_drv->hSemTestKeyBlock);
2035 kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key);
2044 PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n");
2046 pu8keybuf = kmalloc((pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL);
2047 if (pu8keybuf == NULL) {
2048 PRINT_ER("No buffer to send PMKSA Key\n");
2052 pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.numpmkid;
2054 for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.numpmkid; i++) {
2056 memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.pmkidlist[i].bssid, ETH_ALEN);
2057 memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
2060 strWID.id = (u16)WID_PMKID_INFO;
2061 strWID.type = WID_STR;
2062 strWID.val = (s8 *)pu8keybuf;
2063 strWID.size = (pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
2065 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2066 get_id_from_handler(hif_drv));
2073 PRINT_ER("Failed to send key config packet\n");
2079 static void Handle_Disconnect(struct host_if_drv *hif_drv)
2084 u16 u16DummyReasonCode = 0;
2086 strWID.id = (u16)WID_DISCONNECT;
2087 strWID.type = WID_CHAR;
2088 strWID.val = (s8 *)&u16DummyReasonCode;
2089 strWID.size = sizeof(char);
2093 PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");
2095 g_obtainingIP = false;
2096 host_int_set_power_mgmt(hif_drv, 0, 0);
2098 eth_zero_addr(u8ConnectedSSID);
2100 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2101 get_id_from_handler(hif_drv));
2104 PRINT_ER("Failed to send dissconect config packet\n");
2106 tstrDisconnectNotifInfo strDisconnectNotifInfo;
2108 memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo));
2110 strDisconnectNotifInfo.u16reason = 0;
2111 strDisconnectNotifInfo.ie = NULL;
2112 strDisconnectNotifInfo.ie_len = 0;
2114 if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) {
2115 del_timer(&hif_drv->hScanTimer);
2116 hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL,
2117 hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL);
2119 hif_drv->strWILC_UsrScanReq.pfUserScanResult = NULL;
2122 if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult != NULL) {
2123 if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
2124 PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n");
2125 del_timer(&hif_drv->hConnectTimer);
2128 hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL,
2129 0, &strDisconnectNotifInfo, hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid);
2131 PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n");
2134 gbScanWhileConnected = false;
2136 hif_drv->enuHostIFstate = HOST_IF_IDLE;
2138 eth_zero_addr(hif_drv->au8AssociatedBSSID);
2140 hif_drv->strWILC_UsrConnReq.ssidLen = 0;
2141 kfree(hif_drv->strWILC_UsrConnReq.pu8ssid);
2142 kfree(hif_drv->strWILC_UsrConnReq.pu8bssid);
2143 hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0;
2144 kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs);
2146 if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
2147 kfree(gu8FlushedJoinReq);
2148 gu8FlushedJoinReq = NULL;
2150 if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) {
2151 kfree(gu8FlushedInfoElemAsoc);
2152 gu8FlushedInfoElemAsoc = NULL;
2157 up(&hif_drv->hSemTestDisconnectBlock);
2161 void resolve_disconnect_aberration(struct host_if_drv *hif_drv)
2165 if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (hif_drv->enuHostIFstate == HOST_IF_CONNECTING)) {
2166 PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n");
2167 host_int_disconnect(hif_drv, 1);
2171 static s32 Handle_GetChnl(struct host_if_drv *hif_drv)
2177 strWID.id = (u16)WID_CURRENT_CHANNEL;
2178 strWID.type = WID_CHAR;
2179 strWID.val = (s8 *)&gu8Chnl;
2180 strWID.size = sizeof(char);
2182 PRINT_D(HOSTINF_DBG, "Getting channel value\n");
2184 s32Error = send_config_pkt(GET_CFG, &strWID, 1,
2185 get_id_from_handler(hif_drv));
2188 PRINT_ER("Failed to get channel number\n");
2192 up(&hif_drv->hSemGetCHNL);
2200 static void Handle_GetRssi(struct host_if_drv *hif_drv)
2205 strWID.id = (u16)WID_RSSI;
2206 strWID.type = WID_CHAR;
2207 strWID.val = &gs8Rssi;
2208 strWID.size = sizeof(char);
2210 PRINT_D(HOSTINF_DBG, "Getting RSSI value\n");
2212 s32Error = send_config_pkt(GET_CFG, &strWID, 1,
2213 get_id_from_handler(hif_drv));
2215 PRINT_ER("Failed to get RSSI value\n");
2219 up(&hif_drv->hSemGetRSSI);
2225 static void Handle_GetLinkspeed(struct host_if_drv *hif_drv)
2232 strWID.id = (u16)WID_LINKSPEED;
2233 strWID.type = WID_CHAR;
2234 strWID.val = &gs8lnkspd;
2235 strWID.size = sizeof(char);
2237 PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n");
2239 s32Error = send_config_pkt(GET_CFG, &strWID, 1,
2240 get_id_from_handler(hif_drv));
2242 PRINT_ER("Failed to get LINKSPEED value\n");
2246 up(&(hif_drv->hSemGetLINKSPEED));
2251 s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
2253 struct wid strWIDList[5];
2254 u32 u32WidsCount = 0, s32Error = 0;
2256 strWIDList[u32WidsCount].id = WID_LINKSPEED;
2257 strWIDList[u32WidsCount].type = WID_CHAR;
2258 strWIDList[u32WidsCount].size = sizeof(char);
2259 strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->u8LinkSpeed));
2262 strWIDList[u32WidsCount].id = WID_RSSI;
2263 strWIDList[u32WidsCount].type = WID_CHAR;
2264 strWIDList[u32WidsCount].size = sizeof(char);
2265 strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->s8RSSI));
2268 strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT;
2269 strWIDList[u32WidsCount].type = WID_INT;
2270 strWIDList[u32WidsCount].size = sizeof(u32);
2271 strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->u32TxCount));
2274 strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT;
2275 strWIDList[u32WidsCount].type = WID_INT;
2276 strWIDList[u32WidsCount].size = sizeof(u32);
2277 strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->u32RxCount));
2280 strWIDList[u32WidsCount].id = WID_FAILED_COUNT;
2281 strWIDList[u32WidsCount].type = WID_INT;
2282 strWIDList[u32WidsCount].size = sizeof(u32);
2283 strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->u32TxFailureCount));
2286 s32Error = send_config_pkt(GET_CFG, strWIDList, u32WidsCount,
2287 get_id_from_handler(hif_drv));
2290 PRINT_ER("Failed to send scan paramters config packet\n");
2297 static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv,
2298 struct sta_inactive_t *strHostIfStaInactiveT)
2305 strWID.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME;
2306 strWID.type = WID_STR;
2307 strWID.size = ETH_ALEN;
2308 strWID.val = kmalloc(strWID.size, GFP_KERNEL);
2311 stamac = strWID.val;
2312 memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN);
2315 PRINT_D(CFG80211_DBG, "SETING STA inactive time\n");
2318 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2319 get_id_from_handler(hif_drv));
2322 PRINT_ER("Failed to SET incative time\n");
2327 strWID.id = (u16)WID_GET_INACTIVE_TIME;
2328 strWID.type = WID_INT;
2329 strWID.val = (s8 *)&gu32InactiveTime;
2330 strWID.size = sizeof(u32);
2333 s32Error = send_config_pkt(GET_CFG, &strWID, 1,
2334 get_id_from_handler(hif_drv));
2337 PRINT_ER("Failed to get incative time\n");
2342 PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime);
2344 up(&hif_drv->hSemInactiveTime);
2352 static void Handle_AddBeacon(struct host_if_drv *hif_drv,
2353 struct beacon_attr *pstrSetBeaconParam)
2359 PRINT_D(HOSTINF_DBG, "Adding BEACON\n");
2361 strWID.id = (u16)WID_ADD_BEACON;
2362 strWID.type = WID_BIN;
2363 strWID.size = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16;
2364 strWID.val = kmalloc(strWID.size, GFP_KERNEL);
2365 if (strWID.val == NULL)
2368 pu8CurrByte = strWID.val;
2369 *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF);
2370 *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF);
2371 *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF);
2372 *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF);
2374 *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF);
2375 *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF);
2376 *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF);
2377 *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF);
2379 *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF);
2380 *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF);
2381 *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF);
2382 *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF);
2384 memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen);
2385 pu8CurrByte += pstrSetBeaconParam->u32HeadLen;
2387 *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF);
2388 *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF);
2389 *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF);
2390 *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF);
2392 if (pstrSetBeaconParam->pu8Tail > 0)
2393 memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen);
2394 pu8CurrByte += pstrSetBeaconParam->u32TailLen;
2396 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2397 get_id_from_handler(hif_drv));
2399 PRINT_ER("Failed to send add beacon config packet\n");
2403 kfree(pstrSetBeaconParam->pu8Head);
2404 kfree(pstrSetBeaconParam->pu8Tail);
2407 static void Handle_DelBeacon(struct host_if_drv *hif_drv)
2413 strWID.id = (u16)WID_DEL_BEACON;
2414 strWID.type = WID_CHAR;
2415 strWID.size = sizeof(char);
2416 strWID.val = &gu8DelBcn;
2418 if (strWID.val == NULL)
2421 pu8CurrByte = strWID.val;
2423 PRINT_D(HOSTINF_DBG, "Deleting BEACON\n");
2425 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2426 get_id_from_handler(hif_drv));
2428 PRINT_ER("Failed to send delete beacon config packet\n");
2431 static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer,
2432 struct add_sta_param *pstrStationParam)
2436 pu8CurrByte = pu8Buffer;
2438 PRINT_D(HOSTINF_DBG, "Packing STA params\n");
2439 memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN);
2440 pu8CurrByte += ETH_ALEN;
2442 *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF;
2443 *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF;
2445 *pu8CurrByte++ = pstrStationParam->u8NumRates;
2446 if (pstrStationParam->u8NumRates > 0)
2447 memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates);
2448 pu8CurrByte += pstrStationParam->u8NumRates;
2450 *pu8CurrByte++ = pstrStationParam->bIsHTSupported;
2451 *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF;
2452 *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF;
2454 *pu8CurrByte++ = pstrStationParam->u8AmpduParams;
2455 memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE);
2456 pu8CurrByte += WILC_SUPP_MCS_SET_SIZE;
2458 *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF;
2459 *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF;
2461 *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF;
2462 *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF;
2463 *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF;
2464 *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF;
2466 *pu8CurrByte++ = pstrStationParam->u8ASELCap;
2468 *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF;
2469 *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF;
2471 *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF;
2472 *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF;
2474 return pu8CurrByte - pu8Buffer;
2477 static void Handle_AddStation(struct host_if_drv *hif_drv,
2478 struct add_sta_param *pstrStationParam)
2484 PRINT_D(HOSTINF_DBG, "Handling add station\n");
2485 strWID.id = (u16)WID_ADD_STA;
2486 strWID.type = WID_BIN;
2487 strWID.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates;
2489 strWID.val = kmalloc(strWID.size, GFP_KERNEL);
2490 if (strWID.val == NULL)
2493 pu8CurrByte = strWID.val;
2494 pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
2496 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2497 get_id_from_handler(hif_drv));
2499 PRINT_ER("Failed to send add station config packet\n");
2502 kfree(pstrStationParam->pu8Rates);
2506 static void Handle_DelAllSta(struct host_if_drv *hif_drv,
2507 struct del_all_sta *pstrDelAllStaParam)
2514 u8 au8Zero_Buff[6] = {0};
2516 strWID.id = (u16)WID_DEL_ALL_STA;
2517 strWID.type = WID_STR;
2518 strWID.size = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1;
2520 PRINT_D(HOSTINF_DBG, "Handling delete station\n");
2522 strWID.val = kmalloc((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1, GFP_KERNEL);
2523 if (strWID.val == NULL)
2526 pu8CurrByte = strWID.val;
2528 *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta;
2530 for (i = 0; i < MAX_NUM_STA; i++) {
2531 if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN))
2532 memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN);
2536 pu8CurrByte += ETH_ALEN;
2539 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2540 get_id_from_handler(hif_drv));
2542 PRINT_ER("Failed to send add station config packet\n");
2550 static void Handle_DelStation(struct host_if_drv *hif_drv,
2551 struct del_sta *pstrDelStaParam)
2557 strWID.id = (u16)WID_REMOVE_STA;
2558 strWID.type = WID_BIN;
2559 strWID.size = ETH_ALEN;
2561 PRINT_D(HOSTINF_DBG, "Handling delete station\n");
2563 strWID.val = kmalloc(strWID.size, GFP_KERNEL);
2564 if (strWID.val == NULL)
2567 pu8CurrByte = strWID.val;
2569 memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN);
2571 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2572 get_id_from_handler(hif_drv));
2574 PRINT_ER("Failed to send add station config packet\n");
2580 static void Handle_EditStation(struct host_if_drv *hif_drv,
2581 struct add_sta_param *pstrStationParam)
2587 strWID.id = (u16)WID_EDIT_STA;
2588 strWID.type = WID_BIN;
2589 strWID.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates;
2591 PRINT_D(HOSTINF_DBG, "Handling edit station\n");
2592 strWID.val = kmalloc(strWID.size, GFP_KERNEL);
2593 if (strWID.val == NULL)
2596 pu8CurrByte = strWID.val;
2597 pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
2599 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2600 get_id_from_handler(hif_drv));
2602 PRINT_ER("Failed to send edit station config packet\n");
2605 kfree(pstrStationParam->pu8Rates);
2609 static int Handle_RemainOnChan(struct host_if_drv *hif_drv,
2610 struct remain_ch *pstrHostIfRemainOnChan)
2613 u8 u8remain_on_chan_flag;
2616 if (!hif_drv->u8RemainOnChan_pendingreq) {
2617 hif_drv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid;
2618 hif_drv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired;
2619 hif_drv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady;
2620 hif_drv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel;
2621 hif_drv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID;
2623 pstrHostIfRemainOnChan->u16Channel = hif_drv->strHostIfRemainOnChan.u16Channel;
2626 if (hif_drv->strWILC_UsrScanReq.pfUserScanResult != NULL) {
2627 PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n");
2628 hif_drv->u8RemainOnChan_pendingreq = 1;
2632 if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) {
2633 PRINT_INFO(GENERIC_DBG, "Required to remain on chan while connecting return\n");
2638 if (g_obtainingIP || connecting) {
2639 PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
2644 PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel);
2646 u8remain_on_chan_flag = true;
2647 strWID.id = (u16)WID_REMAIN_ON_CHAN;
2648 strWID.type = WID_STR;
2650 strWID.val = kmalloc(strWID.size, GFP_KERNEL);
2652 if (strWID.val == NULL) {
2657 strWID.val[0] = u8remain_on_chan_flag;
2658 strWID.val[1] = (s8)pstrHostIfRemainOnChan->u16Channel;
2660 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2661 get_id_from_handler(hif_drv));
2663 PRINT_ER("Failed to set remain on channel\n");
2667 P2P_LISTEN_STATE = 1;
2668 hif_drv->hRemainOnChannel.data = (unsigned long)hif_drv;
2669 mod_timer(&hif_drv->hRemainOnChannel,
2671 msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration));
2673 if (hif_drv->strHostIfRemainOnChan.pRemainOnChanReady)
2674 hif_drv->strHostIfRemainOnChan.pRemainOnChanReady(hif_drv->strHostIfRemainOnChan.pVoid);
2676 if (hif_drv->u8RemainOnChan_pendingreq)
2677 hif_drv->u8RemainOnChan_pendingreq = 0;
2682 static int Handle_RegisterFrame(struct host_if_drv *hif_drv,
2683 struct reg_frame *pstrHostIfRegisterFrame)
2689 PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType);
2691 strWID.id = (u16)WID_REGISTER_FRAME;
2692 strWID.type = WID_STR;
2693 strWID.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL);
2694 if (strWID.val == NULL)
2697 pu8CurrByte = strWID.val;
2699 *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg;
2700 *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid;
2701 memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16));
2704 strWID.size = sizeof(u16) + 2;
2706 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2707 get_id_from_handler(hif_drv));
2709 PRINT_ER("Failed to frame register config packet\n");
2717 #define FALSE_FRMWR_CHANNEL 100
2718 static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv,
2719 struct remain_ch *pstrHostIfRemainOnChan)
2721 u8 u8remain_on_chan_flag;
2725 PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n");
2727 if (P2P_LISTEN_STATE) {
2728 u8remain_on_chan_flag = false;
2729 strWID.id = (u16)WID_REMAIN_ON_CHAN;
2730 strWID.type = WID_STR;
2732 strWID.val = kmalloc(strWID.size, GFP_KERNEL);
2734 if (strWID.val == NULL)
2735 PRINT_ER("Failed to allocate memory\n");
2737 strWID.val[0] = u8remain_on_chan_flag;
2738 strWID.val[1] = FALSE_FRMWR_CHANNEL;
2740 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2741 get_id_from_handler(hif_drv));
2742 if (s32Error != 0) {
2743 PRINT_ER("Failed to set remain on channel\n");
2747 if (hif_drv->strHostIfRemainOnChan.pRemainOnChanExpired) {
2748 hif_drv->strHostIfRemainOnChan.pRemainOnChanExpired(hif_drv->strHostIfRemainOnChan.pVoid
2749 , pstrHostIfRemainOnChan->u32ListenSessionID);
2751 P2P_LISTEN_STATE = 0;
2753 PRINT_D(GENERIC_DBG, "Not in listen state\n");
2761 static void ListenTimerCB(unsigned long arg)
2764 struct host_if_msg msg;
2765 struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
2767 del_timer(&hif_drv->hRemainOnChannel);
2769 memset(&msg, 0, sizeof(struct host_if_msg));
2770 msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED;
2772 msg.body.remain_on_ch.u32ListenSessionID = hif_drv->strHostIfRemainOnChan.u32ListenSessionID;
2774 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
2776 PRINT_ER("wilc_mq_send fail\n");
2779 static void Handle_PowerManagement(struct host_if_drv *hif_drv,
2780 struct power_mgmt_param *strPowerMgmtParam)
2786 strWID.id = (u16)WID_POWER_MANAGEMENT;
2788 if (strPowerMgmtParam->bIsEnabled == true)
2789 s8PowerMode = MIN_FAST_PS;
2791 s8PowerMode = NO_POWERSAVE;
2792 PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode);
2793 strWID.val = &s8PowerMode;
2794 strWID.size = sizeof(char);
2796 PRINT_D(HOSTINF_DBG, "Handling Power Management\n");
2798 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2799 get_id_from_handler(hif_drv));
2801 PRINT_ER("Failed to send power management config packet\n");
2804 static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv,
2805 struct set_multicast *strHostIfSetMulti)
2811 PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n");
2813 strWID.id = (u16)WID_SETUP_MULTICAST_FILTER;
2814 strWID.type = WID_BIN;
2815 strWID.size = sizeof(struct set_multicast) + ((strHostIfSetMulti->u32count) * ETH_ALEN);
2816 strWID.val = kmalloc(strWID.size, GFP_KERNEL);
2817 if (strWID.val == NULL)
2820 pu8CurrByte = strWID.val;
2821 *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF);
2822 *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF);
2823 *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF);
2824 *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF);
2826 *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF);
2827 *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF);
2828 *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF);
2829 *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF);
2831 if ((strHostIfSetMulti->u32count) > 0)
2832 memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN));
2834 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2835 get_id_from_handler(hif_drv));
2837 PRINT_ER("Failed to send setup multicast config packet\n");
2844 static s32 Handle_AddBASession(struct host_if_drv *hif_drv,
2845 struct ba_session_info *strHostIfBASessionInfo)
2849 int AddbaTimeout = 100;
2852 PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n",
2853 strHostIfBASessionInfo->au8Bssid[0],
2854 strHostIfBASessionInfo->au8Bssid[1],
2855 strHostIfBASessionInfo->au8Bssid[2],
2856 strHostIfBASessionInfo->u16BufferSize,
2857 strHostIfBASessionInfo->u16SessionTimeout,
2858 strHostIfBASessionInfo->u8Ted);
2860 strWID.id = (u16)WID_11E_P_ACTION_REQ;
2861 strWID.type = WID_STR;
2862 strWID.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL);
2863 strWID.size = BLOCK_ACK_REQ_SIZE;
2868 memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN);
2870 *ptr++ = strHostIfBASessionInfo->u8Ted;
2872 *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF);
2873 *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF);
2874 *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF);
2875 *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF);
2876 *ptr++ = (AddbaTimeout & 0xFF);
2877 *ptr++ = ((AddbaTimeout >> 16) & 0xFF);
2881 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2882 get_id_from_handler(hif_drv));
2884 PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n");
2887 strWID.id = (u16)WID_11E_P_ACTION_REQ;
2888 strWID.type = WID_STR;
2894 memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN);
2896 *ptr++ = strHostIfBASessionInfo->u8Ted;
2898 *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF);
2899 *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF);
2901 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2902 get_id_from_handler(hif_drv));
2904 if (strWID.val != NULL)
2911 static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv,
2912 struct ba_session_info *strHostIfBASessionInfo)
2918 PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n",
2919 strHostIfBASessionInfo->au8Bssid[0],
2920 strHostIfBASessionInfo->au8Bssid[1],
2921 strHostIfBASessionInfo->au8Bssid[2],
2922 strHostIfBASessionInfo->u8Ted);
2924 strWID.id = (u16)WID_DEL_ALL_RX_BA;
2925 strWID.type = WID_STR;
2926 strWID.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL);
2927 strWID.size = BLOCK_ACK_REQ_SIZE;
2932 memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN);
2934 *ptr++ = strHostIfBASessionInfo->u8Ted;
2938 s32Error = send_config_pkt(SET_CFG, &strWID, 1,
2939 get_id_from_handler(hif_drv));
2941 PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");
2944 if (strWID.val != NULL)
2953 static int hostIFthread(void *pvArg)
2956 struct host_if_msg msg;
2957 struct host_if_drv *hif_drv;
2959 memset(&msg, 0, sizeof(struct host_if_msg));
2962 wilc_mq_recv(&gMsgQHostIF, &msg, sizeof(struct host_if_msg), &u32Ret);
2963 hif_drv = (struct host_if_drv *)msg.drv;
2964 if (msg.id == HOST_IF_MSG_EXIT) {
2965 PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n");
2969 if ((!g_wilc_initialized)) {
2970 PRINT_D(GENERIC_DBG, "--WAIT--");
2971 usleep_range(200 * 1000, 200 * 1000);
2972 wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
2976 if (msg.id == HOST_IF_MSG_CONNECT && hif_drv->strWILC_UsrScanReq.pfUserScanResult != NULL) {
2977 PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n");
2978 wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
2979 usleep_range(2 * 1000, 2 * 1000);
2984 case HOST_IF_MSG_Q_IDLE:
2985 Handle_wait_msg_q_empty();
2988 case HOST_IF_MSG_SCAN:
2989 Handle_Scan(msg.drv, &msg.body.scan_info);
2992 case HOST_IF_MSG_CONNECT:
2993 Handle_Connect(msg.drv, &msg.body.con_info);
2996 case HOST_IF_MSG_FLUSH_CONNECT:
2997 Handle_FlushConnect(msg.drv);
3000 case HOST_IF_MSG_RCVD_NTWRK_INFO:
3001 Handle_RcvdNtwrkInfo(msg.drv, &msg.body.net_info);
3004 case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO:
3005 Handle_RcvdGnrlAsyncInfo(msg.drv, &msg.body.async_info);
3008 case HOST_IF_MSG_KEY:
3009 Handle_Key(msg.drv, &msg.body.key_info);
3012 case HOST_IF_MSG_CFG_PARAMS:
3014 Handle_CfgParam(msg.drv, &msg.body.cfg_info);
3017 case HOST_IF_MSG_SET_CHANNEL:
3018 Handle_SetChannel(msg.drv, &msg.body.channel_info);
3021 case HOST_IF_MSG_DISCONNECT:
3022 Handle_Disconnect(msg.drv);
3025 case HOST_IF_MSG_RCVD_SCAN_COMPLETE:
3026 del_timer(&hif_drv->hScanTimer);
3027 PRINT_D(HOSTINF_DBG, "scan completed successfully\n");
3029 if (!linux_wlan_get_num_conn_ifcs())
3030 chip_sleep_manually(INFINITE_SLEEP_TIME);
3032 Handle_ScanDone(msg.drv, SCAN_EVENT_DONE);
3034 if (hif_drv->u8RemainOnChan_pendingreq)
3035 Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch);
3039 case HOST_IF_MSG_GET_RSSI:
3040 Handle_GetRssi(msg.drv);
3043 case HOST_IF_MSG_GET_LINKSPEED:
3044 Handle_GetLinkspeed(msg.drv);
3047 case HOST_IF_MSG_GET_STATISTICS:
3048 Handle_GetStatistics(msg.drv, (struct rf_info *)msg.body.data);
3051 case HOST_IF_MSG_GET_CHNL:
3052 Handle_GetChnl(msg.drv);
3055 case HOST_IF_MSG_ADD_BEACON:
3056 Handle_AddBeacon(msg.drv, &msg.body.beacon_info);
3059 case HOST_IF_MSG_DEL_BEACON:
3060 Handle_DelBeacon(msg.drv);
3063 case HOST_IF_MSG_ADD_STATION:
3064 Handle_AddStation(msg.drv, &msg.body.add_sta_info);
3067 case HOST_IF_MSG_DEL_STATION:
3068 Handle_DelStation(msg.drv, &msg.body.del_sta_info);
3071 case HOST_IF_MSG_EDIT_STATION:
3072 Handle_EditStation(msg.drv, &msg.body.edit_sta_info);
3075 case HOST_IF_MSG_GET_INACTIVETIME:
3076 Handle_Get_InActiveTime(msg.drv, &msg.body.mac_info);
3079 case HOST_IF_MSG_SCAN_TIMER_FIRED:
3080 PRINT_D(HOSTINF_DBG, "Scan Timeout\n");
3082 Handle_ScanDone(msg.drv, SCAN_EVENT_ABORTED);
3085 case HOST_IF_MSG_CONNECT_TIMER_FIRED:
3086 PRINT_D(HOSTINF_DBG, "Connect Timeout\n");
3087 Handle_ConnectTimeout(msg.drv);
3090 case HOST_IF_MSG_POWER_MGMT:
3091 Handle_PowerManagement(msg.drv, &msg.body.pwr_mgmt_info);
3094 case HOST_IF_MSG_SET_WFIDRV_HANDLER:
3095 Handle_SetWfiDrvHandler(msg.drv,
3099 case HOST_IF_MSG_SET_OPERATION_MODE:
3100 Handle_SetOperationMode(msg.drv, &msg.body.mode);
3103 case HOST_IF_MSG_SET_IPADDRESS:
3104 PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n");
3105 Handle_set_IPAddress(msg.drv, msg.body.ip_info.au8IPAddr, msg.body.ip_info.idx);
3108 case HOST_IF_MSG_GET_IPADDRESS:
3109 PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n");
3110 Handle_get_IPAddress(msg.drv, msg.body.ip_info.au8IPAddr, msg.body.ip_info.idx);
3113 case HOST_IF_MSG_SET_MAC_ADDRESS:
3114 Handle_SetMacAddress(msg.drv, &msg.body.set_mac_info);
3117 case HOST_IF_MSG_GET_MAC_ADDRESS:
3118 Handle_GetMacAddress(msg.drv, &msg.body.get_mac_info);
3121 case HOST_IF_MSG_REMAIN_ON_CHAN:
3122 PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n");
3123 Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch);
3126 case HOST_IF_MSG_REGISTER_FRAME:
3127 PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n");
3128 Handle_RegisterFrame(msg.drv, &msg.body.reg_frame);
3131 case HOST_IF_MSG_LISTEN_TIMER_FIRED:
3132 Handle_ListenStateExpired(msg.drv, &msg.body.remain_on_ch);
3135 case HOST_IF_MSG_SET_MULTICAST_FILTER:
3136 PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n");
3137 Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info);
3140 case HOST_IF_MSG_ADD_BA_SESSION:
3141 Handle_AddBASession(msg.drv, &msg.body.session_info);
3144 case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS:
3145 Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info);
3148 case HOST_IF_MSG_DEL_ALL_STA:
3149 Handle_DelAllSta(msg.drv, &msg.body.del_all_sta_info);
3153 PRINT_ER("[Host Interface] undefined Received Msg ID\n");
3158 PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n");
3159 up(&hSemHostIFthrdEnd);
3163 static void TimerCB_Scan(unsigned long arg)
3165 void *pvArg = (void *)arg;
3166 struct host_if_msg msg;
3168 memset(&msg, 0, sizeof(struct host_if_msg));
3170 msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED;
3172 wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3175 static void TimerCB_Connect(unsigned long arg)
3177 void *pvArg = (void *)arg;
3178 struct host_if_msg msg;
3180 memset(&msg, 0, sizeof(struct host_if_msg));
3182 msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED;
3184 wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3187 s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress)
3191 strWID.id = (u16)WID_REMOVE_KEY;
3192 strWID.type = WID_STR;
3193 strWID.val = (s8 *)pu8StaAddress;
3199 int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index)
3202 struct host_if_msg msg;
3206 PRINT_ER("Failed to send setup multicast config packet\n");
3210 memset(&msg, 0, sizeof(struct host_if_msg));
3212 msg.id = HOST_IF_MSG_KEY;
3213 msg.body.key_info.type = WEP;
3214 msg.body.key_info.u8KeyAction = REMOVEKEY;
3216 msg.body.key_info.uniHostIFkeyAttr.wep.index = index;
3218 result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3220 PRINT_ER("Error in sending message queue : Request to remove WEP key\n");
3221 down(&hif_drv->hSemTestKeyBlock);
3226 s32 host_int_set_WEPDefaultKeyID(struct host_if_drv *hif_drv, u8 u8Index)
3229 struct host_if_msg msg;
3234 PRINT_ER("driver is null\n");
3238 memset(&msg, 0, sizeof(struct host_if_msg));
3241 msg.id = HOST_IF_MSG_KEY;
3242 msg.body.key_info.type = WEP;
3243 msg.body.key_info.u8KeyAction = DEFAULTKEY;
3247 msg.body.key_info.uniHostIFkeyAttr.wep.index = u8Index;
3249 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3251 PRINT_ER("Error in sending message queue : Default key index\n");
3252 down(&hif_drv->hSemTestKeyBlock);
3257 s32 host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv,
3258 const u8 *pu8WepKey,
3264 struct host_if_msg msg;
3268 PRINT_ER("driver is null\n");
3272 memset(&msg, 0, sizeof(struct host_if_msg));
3275 msg.id = HOST_IF_MSG_KEY;
3276 msg.body.key_info.type = WEP;
3277 msg.body.key_info.u8KeyAction = ADDKEY;
3282 uniHostIFkeyAttr.wep.key = kmalloc(u8WepKeylen, GFP_KERNEL);
3284 memcpy(msg.body.key_info.uniHostIFkeyAttr.wep.key,
3285 pu8WepKey, u8WepKeylen);
3288 msg.body.key_info.uniHostIFkeyAttr.wep.key_len = (u8WepKeylen);
3290 msg.body.key_info.uniHostIFkeyAttr.wep.index = u8Keyidx;
3292 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3294 PRINT_ER("Error in sending message queue :WEP Key\n");
3295 down(&hif_drv->hSemTestKeyBlock);
3301 s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv,
3302 const u8 *pu8WepKey,
3306 enum AUTHTYPE tenuAuth_type)
3310 struct host_if_msg msg;
3315 PRINT_ER("driver is null\n");
3319 memset(&msg, 0, sizeof(struct host_if_msg));
3322 for (i = 0; i < u8WepKeylen; i++)
3323 PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]);
3325 msg.id = HOST_IF_MSG_KEY;
3326 msg.body.key_info.type = WEP;
3327 msg.body.key_info.u8KeyAction = ADDKEY_AP;
3332 uniHostIFkeyAttr.wep.key = kmalloc(u8WepKeylen, GFP_KERNEL);
3335 memcpy(msg.body.key_info.uniHostIFkeyAttr.wep.key,
3336 pu8WepKey, (u8WepKeylen));
3339 msg.body.key_info.uniHostIFkeyAttr.wep.key_len = (u8WepKeylen);
3341 msg.body.key_info.uniHostIFkeyAttr.wep.index = u8Keyidx;
3343 msg.body.key_info.uniHostIFkeyAttr.wep.mode = u8mode;
3345 msg.body.key_info.uniHostIFkeyAttr.wep.auth_type = tenuAuth_type;
3347 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3350 PRINT_ER("Error in sending message queue :WEP Key\n");
3351 down(&hif_drv->hSemTestKeyBlock);
3357 s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk,
3358 u8 u8PtkKeylen, const u8 *mac_addr,
3359 const u8 *pu8RxMic, const u8 *pu8TxMic,
3360 u8 mode, u8 u8Ciphermode, u8 u8Idx)
3363 struct host_if_msg msg;
3364 u8 u8KeyLen = u8PtkKeylen;
3369 PRINT_ER("driver is null\n");
3372 if (pu8RxMic != NULL)
3373 u8KeyLen += RX_MIC_KEY_LEN;
3374 if (pu8TxMic != NULL)
3375 u8KeyLen += TX_MIC_KEY_LEN;
3377 memset(&msg, 0, sizeof(struct host_if_msg));
3380 msg.id = HOST_IF_MSG_KEY;
3381 msg.body.key_info.type = WPAPtk;
3382 if (mode == AP_MODE) {
3383 msg.body.key_info.u8KeyAction = ADDKEY_AP;
3384 msg.body.key_info.uniHostIFkeyAttr.wpa.u8keyidx = u8Idx;
3386 if (mode == STATION_MODE)
3387 msg.body.key_info.u8KeyAction = ADDKEY;
3391 uniHostIFkeyAttr.wpa.pu8key = kmalloc(u8PtkKeylen, GFP_KERNEL);
3394 memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key,
3395 pu8Ptk, u8PtkKeylen);
3397 if (pu8RxMic != NULL) {
3399 memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key + 16,
3400 pu8RxMic, RX_MIC_KEY_LEN);
3402 for (i = 0; i < RX_MIC_KEY_LEN; i++)
3403 PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]);
3406 if (pu8TxMic != NULL) {
3408 memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key + 24,
3409 pu8TxMic, TX_MIC_KEY_LEN);
3411 for (i = 0; i < TX_MIC_KEY_LEN; i++)
3412 PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]);
3416 msg.body.key_info.uniHostIFkeyAttr.wpa.u8Keylen = u8KeyLen;
3418 msg.body.key_info.uniHostIFkeyAttr.wpa.u8Ciphermode = u8Ciphermode;
3419 msg.body.key_info.uniHostIFkeyAttr.wpa.pu8macaddr = mac_addr;
3422 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3425 PRINT_ER("Error in sending message queue: PTK Key\n");
3427 down(&hif_drv->hSemTestKeyBlock);
3432 s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk,
3433 u8 u8GtkKeylen, u8 u8KeyIdx,
3434 u32 u32KeyRSClen, const u8 *KeyRSC,
3435 const u8 *pu8RxMic, const u8 *pu8TxMic,
3436 u8 mode, u8 u8Ciphermode)
3439 struct host_if_msg msg;
3440 u8 u8KeyLen = u8GtkKeylen;
3444 PRINT_ER("driver is null\n");
3447 memset(&msg, 0, sizeof(struct host_if_msg));
3450 if (pu8RxMic != NULL)
3451 u8KeyLen += RX_MIC_KEY_LEN;
3452 if (pu8TxMic != NULL)
3453 u8KeyLen += TX_MIC_KEY_LEN;
3454 if (KeyRSC != NULL) {
3456 uniHostIFkeyAttr.wpa.pu8seq = kmalloc(u32KeyRSClen, GFP_KERNEL);
3458 memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8seq,
3459 KeyRSC, u32KeyRSClen);
3463 msg.id = HOST_IF_MSG_KEY;
3464 msg.body.key_info.type = WPARxGtk;
3467 if (mode == AP_MODE) {
3468 msg.body.key_info.u8KeyAction = ADDKEY_AP;
3469 msg.body.key_info.uniHostIFkeyAttr.wpa.u8Ciphermode = u8Ciphermode;
3471 if (mode == STATION_MODE)
3472 msg.body.key_info.u8KeyAction = ADDKEY;
3476 uniHostIFkeyAttr.wpa.pu8key = kmalloc(u8KeyLen, GFP_KERNEL);
3478 memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key,
3479 pu8RxGtk, u8GtkKeylen);
3481 if (pu8RxMic != NULL) {
3483 memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key + 16,
3484 pu8RxMic, RX_MIC_KEY_LEN);
3487 if (pu8TxMic != NULL) {
3489 memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key + 24,
3490 pu8TxMic, TX_MIC_KEY_LEN);
3494 msg.body.key_info.uniHostIFkeyAttr.wpa.u8keyidx = u8KeyIdx;
3495 msg.body.key_info.uniHostIFkeyAttr.wpa.u8Keylen = u8KeyLen;
3497 msg.body.key_info.uniHostIFkeyAttr.wpa.u8seqlen = u32KeyRSClen;
3499 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3501 PRINT_ER("Error in sending message queue: RX GTK\n");
3503 down(&hif_drv->hSemTestKeyBlock);
3508 s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray)
3511 struct host_if_msg msg;
3517 PRINT_ER("driver is null\n");
3521 memset(&msg, 0, sizeof(struct host_if_msg));
3523 msg.id = HOST_IF_MSG_KEY;
3524 msg.body.key_info.type = PMKSA;
3525 msg.body.key_info.u8KeyAction = ADDKEY;
3528 for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) {
3530 memcpy(msg.body.key_info.uniHostIFkeyAttr.pmkid.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid,
3533 memcpy(msg.body.key_info.uniHostIFkeyAttr.pmkid.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid,
3537 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3539 PRINT_ER(" Error in sending messagequeue: PMKID Info\n");
3544 s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv,
3545 u8 *pu8PmkidInfoArray,
3546 u32 u32PmkidInfoLen)
3550 strWID.id = (u16)WID_PMKID_INFO;
3551 strWID.type = WID_STR;
3552 strWID.size = u32PmkidInfoLen;
3553 strWID.val = pu8PmkidInfoArray;
3558 s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
3564 if ((u8Psklength > 7) && (u8Psklength < 65)) {
3565 strWID.id = (u16)WID_11I_PSK;
3566 strWID.type = WID_STR;
3567 strWID.val = pu8PassPhrase;
3568 strWID.size = u8Psklength;
3574 s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
3577 struct host_if_msg msg;
3579 memset(&msg, 0, sizeof(struct host_if_msg));
3581 msg.id = HOST_IF_MSG_GET_MAC_ADDRESS;
3582 msg.body.get_mac_info.u8MacAddress = pu8MacAddress;
3585 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3587 PRINT_ER("Failed to send get mac address\n");
3591 down(&hWaitResponse);
3595 s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
3598 struct host_if_msg msg;
3600 PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]);
3602 memset(&msg, 0, sizeof(struct host_if_msg));
3603 msg.id = HOST_IF_MSG_SET_MAC_ADDRESS;
3604 memcpy(msg.body.set_mac_info.u8MacAddress, pu8MacAddress, ETH_ALEN);
3607 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3609 PRINT_ER("Failed to send message queue: Set mac address\n");
3615 s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
3616 u8 *pu8PassPhrase, u8 u8Psklength)
3620 strWID.id = (u16)WID_11I_PSK;
3621 strWID.type = WID_STR;
3622 strWID.size = u8Psklength;
3623 strWID.val = pu8PassPhrase;
3628 s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
3632 strWID.id = (u16)WID_START_SCAN_REQ;
3633 strWID.type = WID_CHAR;
3634 strWID.val = (s8 *)&scanSource;
3635 strWID.size = sizeof(char);
3640 s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource)
3644 strWID.id = (u16)WID_START_SCAN_REQ;
3645 strWID.type = WID_CHAR;
3646 strWID.val = (s8 *)pu8ScanSource;
3647 strWID.size = sizeof(char);
3652 s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
3653 const u8 *pu8ssid, size_t ssidLen,
3654 const u8 *pu8IEs, size_t IEsLen,
3655 wilc_connect_result pfConnectResult, void *pvUserArg,
3656 u8 u8security, enum AUTHTYPE tenuAuth_type,
3657 u8 u8channel, void *pJoinParams)
3660 struct host_if_msg msg;
3661 enum scan_conn_timer enuScanConnTimer;
3663 if (!hif_drv || pfConnectResult == NULL) {
3665 PRINT_ER("Driver is null\n");
3670 PRINT_ER("Driver is null\n");
3674 if (pJoinParams == NULL) {
3675 PRINT_ER("Unable to Join - JoinParams is NULL\n");
3679 memset(&msg, 0, sizeof(struct host_if_msg));
3681 msg.id = HOST_IF_MSG_CONNECT;
3683 msg.body.con_info.u8security = u8security;
3684 msg.body.con_info.tenuAuth_type = tenuAuth_type;
3685 msg.body.con_info.u8channel = u8channel;
3686 msg.body.con_info.pfConnectResult = pfConnectResult;
3687 msg.body.con_info.pvUserArg = pvUserArg;
3688 msg.body.con_info.pJoinParams = pJoinParams;
3691 if (pu8bssid != NULL) {
3692 msg.body.con_info.pu8bssid = kmalloc(6, GFP_KERNEL);
3693 memcpy(msg.body.con_info.pu8bssid,
3697 if (pu8ssid != NULL) {
3698 msg.body.con_info.ssidLen = ssidLen;
3699 msg.body.con_info.pu8ssid = kmalloc(ssidLen, GFP_KERNEL);
3700 memcpy(msg.body.con_info.pu8ssid,
3705 if (pu8IEs != NULL) {
3706 msg.body.con_info.IEsLen = IEsLen;
3707 msg.body.con_info.pu8IEs = kmalloc(IEsLen, GFP_KERNEL);
3708 memcpy(msg.body.con_info.pu8IEs,
3711 if (hif_drv->enuHostIFstate < HOST_IF_CONNECTING)
3712 hif_drv->enuHostIFstate = HOST_IF_CONNECTING;
3714 PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", hif_drv->enuHostIFstate);
3716 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3718 PRINT_ER("Failed to send message queue: Set join request\n");
3722 enuScanConnTimer = CONNECT_TIMER;
3723 hif_drv->hConnectTimer.data = (unsigned long)hif_drv;
3724 mod_timer(&hif_drv->hConnectTimer,
3725 jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT));
3730 s32 host_int_flush_join_req(struct host_if_drv *hif_drv)
3733 struct host_if_msg msg;
3735 if (!gu8FlushedJoinReq) {
3743 PRINT_ER("Driver is null\n");
3747 msg.id = HOST_IF_MSG_FLUSH_CONNECT;
3750 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3752 PRINT_ER("Failed to send message queue: Flush join request\n");
3759 s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode)
3762 struct host_if_msg msg;
3765 PRINT_ER("Driver is null\n");
3769 memset(&msg, 0, sizeof(struct host_if_msg));
3771 msg.id = HOST_IF_MSG_DISCONNECT;
3774 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3776 PRINT_ER("Failed to send message queue: disconnect\n");
3778 down(&hif_drv->hSemTestDisconnectBlock);
3783 s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id)
3787 strWID.id = (u16)WID_DISCONNECT;
3788 strWID.type = WID_CHAR;
3789 strWID.val = (s8 *)&assoc_id;
3790 strWID.size = sizeof(char);
3795 s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, u8 *pu8AssocReqInfo,
3796 u32 u32AssocReqInfoLen)
3800 strWID.id = (u16)WID_ASSOC_REQ_INFO;
3801 strWID.type = WID_STR;
3802 strWID.val = pu8AssocReqInfo;
3803 strWID.size = u32AssocReqInfoLen;
3808 s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo,
3809 u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen)
3815 PRINT_ER("Driver is null\n");
3819 strWID.id = (u16)WID_ASSOC_RES_INFO;
3820 strWID.type = WID_STR;
3821 strWID.val = pu8AssocRespInfo;
3822 strWID.size = u32MaxAssocRespInfoLen;
3824 s32Error = send_config_pkt(GET_CFG, &strWID, 1,
3825 get_id_from_handler(hif_drv));
3827 *pu32RcvdAssocRespInfoLen = 0;
3828 PRINT_ER("Failed to send association response config packet\n");
3831 *pu32RcvdAssocRespInfoLen = strWID.size;
3837 s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, u8 *pu8RxPowerLevel,
3838 u32 u32RxPowerLevelLen)
3842 strWID.id = (u16)WID_RX_POWER_LEVEL;
3843 strWID.type = WID_STR;
3844 strWID.val = pu8RxPowerLevel;
3845 strWID.size = u32RxPowerLevelLen;
3850 int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
3853 struct host_if_msg msg;
3856 PRINT_ER("driver is null\n");
3860 memset(&msg, 0, sizeof(struct host_if_msg));
3861 msg.id = HOST_IF_MSG_SET_CHANNEL;
3862 msg.body.channel_info.u8SetChan = channel;
3865 result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3867 PRINT_ER("wilc mq send fail\n");
3874 int host_int_wait_msg_queue_idle(void)
3878 struct host_if_msg msg;
3879 memset(&msg, 0, sizeof(struct host_if_msg));
3880 msg.id = HOST_IF_MSG_Q_IDLE;
3881 result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3883 PRINT_ER("wilc mq send fail\n");
3887 down(&hWaitResponse);
3892 int host_int_set_wfi_drv_handler(struct host_if_drv *hif_drv)
3896 struct host_if_msg msg;
3897 memset(&msg, 0, sizeof(struct host_if_msg));
3898 msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER;
3899 msg.body.drv.u32Address = get_id_from_handler(hif_drv);
3902 result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3904 PRINT_ER("wilc mq send fail\n");
3911 int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode)
3915 struct host_if_msg msg;
3916 memset(&msg, 0, sizeof(struct host_if_msg));
3917 msg.id = HOST_IF_MSG_SET_OPERATION_MODE;
3918 msg.body.mode.u32Mode = mode;
3921 result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3923 PRINT_ER("wilc mq send fail\n");
3930 s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo)
3933 struct host_if_msg msg;
3936 PRINT_ER("driver is null\n");
3940 memset(&msg, 0, sizeof(struct host_if_msg));
3942 msg.id = HOST_IF_MSG_GET_CHNL;
3945 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3947 PRINT_ER("wilc mq send fail\n");
3948 down(&hif_drv->hSemGetCHNL);
3957 s32 host_int_get_inactive_time(struct host_if_drv *hif_drv,
3958 const u8 *mac, u32 *pu32InactiveTime)
3961 struct host_if_msg msg;
3964 PRINT_ER("driver is null\n");
3968 memset(&msg, 0, sizeof(struct host_if_msg));
3971 memcpy(msg.body.mac_info.mac,
3974 msg.id = HOST_IF_MSG_GET_INACTIVETIME;
3977 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
3979 PRINT_ER("Failed to send get host channel param's message queue ");
3981 down(&hif_drv->hSemInactiveTime);
3983 *pu32InactiveTime = gu32InactiveTime;
3988 s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr)
3995 PRINT_ER("driver is null\n");
3999 strWID.id = (u16)WID_MEMORY_ADDRESS;
4000 strWID.type = WID_INT;
4001 strWID.val = (s8 *)pu32TestMemAddr;
4002 strWID.size = sizeof(u32);
4004 s32Error = send_config_pkt(GET_CFG, &strWID, 1,
4005 get_id_from_handler(hif_drv));
4008 PRINT_ER("Failed to get wid value\n");
4011 PRINT_D(HOSTINF_DBG, "Successfully got wid value\n");
4018 s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi)
4021 struct host_if_msg msg;
4022 memset(&msg, 0, sizeof(struct host_if_msg));
4024 msg.id = HOST_IF_MSG_GET_RSSI;
4027 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4029 PRINT_ER("Failed to send get host channel param's message queue ");
4033 down(&hif_drv->hSemGetRSSI);
4036 if (ps8Rssi == NULL) {
4037 PRINT_ER("RSS pointer value is null");
4048 s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd)
4050 struct host_if_msg msg;
4052 memset(&msg, 0, sizeof(struct host_if_msg));
4054 msg.id = HOST_IF_MSG_GET_LINKSPEED;
4057 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4059 PRINT_ER("Failed to send GET_LINKSPEED to message queue ");
4063 down(&hif_drv->hSemGetLINKSPEED);
4066 if (ps8lnkspd == NULL) {
4067 PRINT_ER("LINKSPEED pointer value is null");
4072 *ps8lnkspd = gs8lnkspd;
4078 s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics)
4081 struct host_if_msg msg;
4082 memset(&msg, 0, sizeof(struct host_if_msg));
4084 msg.id = HOST_IF_MSG_GET_STATISTICS;
4085 msg.body.data = (char *)pstrStatistics;
4088 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4090 PRINT_ER("Failed to send get host channel param's message queue ");
4094 down(&hWaitResponse);
4098 s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource,
4099 u8 u8ScanType, u8 *pu8ChnlFreqList,
4100 u8 u8ChnlListLen, const u8 *pu8IEs,
4101 size_t IEsLen, wilc_scan_result ScanResult,
4102 void *pvUserArg, struct hidden_network *pstrHiddenNetwork)
4105 struct host_if_msg msg;
4106 enum scan_conn_timer enuScanConnTimer;
4108 if (!hif_drv || ScanResult == NULL) {
4109 PRINT_ER("hif_drv or ScanResult = NULL\n");
4113 memset(&msg, 0, sizeof(struct host_if_msg));
4115 msg.id = HOST_IF_MSG_SCAN;
4117 if (pstrHiddenNetwork != NULL) {
4118 msg.body.scan_info.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo;
4119 msg.body.scan_info.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum;
4122 PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n");
4125 msg.body.scan_info.u8ScanSource = u8ScanSource;
4126 msg.body.scan_info.u8ScanType = u8ScanType;
4127 msg.body.scan_info.pfScanResult = ScanResult;
4128 msg.body.scan_info.pvUserArg = pvUserArg;
4130 msg.body.scan_info.u8ChnlListLen = u8ChnlListLen;
4131 msg.body.scan_info.pu8ChnlFreqList = kmalloc(u8ChnlListLen, GFP_KERNEL);
4132 memcpy(msg.body.scan_info.pu8ChnlFreqList,
4133 pu8ChnlFreqList, u8ChnlListLen);
4135 msg.body.scan_info.IEsLen = IEsLen;
4136 msg.body.scan_info.pu8IEs = kmalloc(IEsLen, GFP_KERNEL);
4137 memcpy(msg.body.scan_info.pu8IEs,
4140 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4142 PRINT_ER("Error in sending message queue\n");
4146 enuScanConnTimer = SCAN_TIMER;
4147 PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n");
4148 hif_drv->hScanTimer.data = (unsigned long)hif_drv;
4149 mod_timer(&hif_drv->hScanTimer,
4150 jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));
4156 s32 hif_set_cfg(struct host_if_drv *hif_drv,
4157 struct cfg_param_val *pstrCfgParamVal)
4161 struct host_if_msg msg;
4165 PRINT_ER("hif_drv NULL\n");
4169 memset(&msg, 0, sizeof(struct host_if_msg));
4170 msg.id = HOST_IF_MSG_CFG_PARAMS;
4171 msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal;
4174 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4180 s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value)
4184 down(&hif_drv->gtOsCfgValuesSem);
4187 PRINT_ER("hif_drv NULL\n");
4190 PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n");
4194 *pu16WID_Value = (u16)hif_drv->strCfgValues.bss_type;
4198 *pu16WID_Value = (u16)hif_drv->strCfgValues.auth_type;
4201 case WID_AUTH_TIMEOUT:
4202 *pu16WID_Value = hif_drv->strCfgValues.auth_timeout;
4205 case WID_POWER_MANAGEMENT:
4206 *pu16WID_Value = (u16)hif_drv->strCfgValues.power_mgmt_mode;
4209 case WID_SHORT_RETRY_LIMIT:
4210 *pu16WID_Value = hif_drv->strCfgValues.short_retry_limit;
4213 case WID_LONG_RETRY_LIMIT:
4214 *pu16WID_Value = hif_drv->strCfgValues.long_retry_limit;
4217 case WID_FRAG_THRESHOLD:
4218 *pu16WID_Value = hif_drv->strCfgValues.frag_threshold;
4221 case WID_RTS_THRESHOLD:
4222 *pu16WID_Value = hif_drv->strCfgValues.rts_threshold;
4226 *pu16WID_Value = (u16)hif_drv->strCfgValues.preamble_type;
4229 case WID_SHORT_SLOT_ALLOWED:
4230 *pu16WID_Value = (u16) hif_drv->strCfgValues.short_slot_allowed;
4233 case WID_11N_TXOP_PROT_DISABLE:
4234 *pu16WID_Value = (u16)hif_drv->strCfgValues.txop_prot_disabled;
4237 case WID_BEACON_INTERVAL:
4238 *pu16WID_Value = hif_drv->strCfgValues.beacon_interval;
4241 case WID_DTIM_PERIOD:
4242 *pu16WID_Value = (u16)hif_drv->strCfgValues.dtim_period;
4245 case WID_SITE_SURVEY:
4246 *pu16WID_Value = (u16)hif_drv->strCfgValues.site_survey_enabled;
4249 case WID_SITE_SURVEY_SCAN_TIME:
4250 *pu16WID_Value = hif_drv->strCfgValues.site_survey_scan_time;
4253 case WID_ACTIVE_SCAN_TIME:
4254 *pu16WID_Value = hif_drv->strCfgValues.active_scan_time;
4257 case WID_PASSIVE_SCAN_TIME:
4258 *pu16WID_Value = hif_drv->strCfgValues.passive_scan_time;
4261 case WID_CURRENT_TX_RATE:
4262 *pu16WID_Value = hif_drv->strCfgValues.curr_tx_rate;
4269 up(&hif_drv->gtOsCfgValuesSem);
4275 void host_int_send_join_leave_info_to_host
4276 (u16 assocId, u8 *stationAddr, bool joining)
4280 static void GetPeriodicRSSI(unsigned long arg)
4282 struct host_if_drv *hif_drv = (struct host_if_drv *)arg;
4285 PRINT_ER("Driver handler is NULL\n");
4289 if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) {
4291 struct host_if_msg msg;
4293 memset(&msg, 0, sizeof(struct host_if_msg));
4295 msg.id = HOST_IF_MSG_GET_RSSI;
4298 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4300 PRINT_ER("Failed to send get host channel param's message queue ");
4304 g_hPeriodicRSSI.data = (unsigned long)hif_drv;
4305 mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000));
4309 void host_int_send_network_info_to_host
4310 (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi)
4314 static u32 clients_count;
4316 s32 host_int_init(struct host_if_drv **hif_drv_handler)
4319 struct host_if_drv *hif_drv;
4322 PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1);
4324 gbScanWhileConnected = false;
4326 sema_init(&hWaitResponse, 0);
4328 hif_drv = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL);
4333 *hif_drv_handler = hif_drv;
4334 err = add_handler_in_list(hif_drv);
4340 g_obtainingIP = false;
4342 PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv);
4343 if (clients_count == 0) {
4344 sema_init(&hSemHostIFthrdEnd, 0);
4345 sema_init(&hSemDeinitDrvHandle, 0);
4346 sema_init(&hSemHostIntDeinit, 1);
4349 sema_init(&hif_drv->hSemTestKeyBlock, 0);
4350 sema_init(&hif_drv->hSemTestDisconnectBlock, 0);
4351 sema_init(&hif_drv->hSemGetRSSI, 0);
4352 sema_init(&hif_drv->hSemGetLINKSPEED, 0);
4353 sema_init(&hif_drv->hSemGetCHNL, 0);
4354 sema_init(&hif_drv->hSemInactiveTime, 0);
4356 PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count);
4358 if (clients_count == 0) {
4359 result = wilc_mq_create(&gMsgQHostIF);
4362 PRINT_ER("Failed to creat MQ\n");
4365 HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread");
4366 if (IS_ERR(HostIFthreadHandler)) {
4367 PRINT_ER("Failed to creat Thread\n");
4371 setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI,
4372 (unsigned long)hif_drv);
4373 mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000));
4376 setup_timer(&hif_drv->hScanTimer, TimerCB_Scan, 0);
4378 setup_timer(&hif_drv->hConnectTimer, TimerCB_Connect, 0);
4380 setup_timer(&hif_drv->hRemainOnChannel, ListenTimerCB, 0);
4382 sema_init(&(hif_drv->gtOsCfgValuesSem), 1);
4383 down(&hif_drv->gtOsCfgValuesSem);
4385 hif_drv->enuHostIFstate = HOST_IF_IDLE;
4386 hif_drv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF;
4387 hif_drv->strCfgValues.scan_source = DEFAULT_SCAN;
4388 hif_drv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME;
4389 hif_drv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME;
4390 hif_drv->strCfgValues.curr_tx_rate = AUTORATE;
4392 hif_drv->u64P2p_MgmtTimeout = 0;
4394 PRINT_INFO(HOSTINF_DBG, "Initialization values, Site survey value: %d\n Scan source: %d\n Active scan time: %d\n Passive scan time: %d\nCurrent tx Rate = %d\n",
4396 hif_drv->strCfgValues.site_survey_enabled, hif_drv->strCfgValues.scan_source,
4397 hif_drv->strCfgValues.active_scan_time, hif_drv->strCfgValues.passive_scan_time,
4398 hif_drv->strCfgValues.curr_tx_rate);
4400 up(&hif_drv->gtOsCfgValuesSem);
4407 up(&hif_drv->gtOsCfgValuesSem);
4408 del_timer_sync(&hif_drv->hConnectTimer);
4409 del_timer_sync(&hif_drv->hScanTimer);
4410 kthread_stop(HostIFthreadHandler);
4412 wilc_mq_destroy(&gMsgQHostIF);
4417 s32 host_int_deinit(struct host_if_drv *hif_drv)
4420 struct host_if_msg msg;
4424 PRINT_ER("hif_drv = NULL\n");
4428 down(&hSemHostIntDeinit);
4430 terminated_handle = hif_drv;
4431 PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count);
4433 if (del_timer_sync(&hif_drv->hScanTimer)) {
4434 PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n");
4437 if (del_timer_sync(&hif_drv->hConnectTimer)) {
4438 PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");
4442 if (del_timer_sync(&g_hPeriodicRSSI)) {
4443 PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");
4446 del_timer_sync(&hif_drv->hRemainOnChannel);
4448 host_int_set_wfi_drv_handler(NULL);
4449 down(&hSemDeinitDrvHandle);
4451 if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) {
4452 hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL,
4453 hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL);
4455 hif_drv->strWILC_UsrScanReq.pfUserScanResult = NULL;
4458 hif_drv->enuHostIFstate = HOST_IF_IDLE;
4460 gbScanWhileConnected = false;
4462 memset(&msg, 0, sizeof(struct host_if_msg));
4464 if (clients_count == 1) {
4465 if (del_timer_sync(&g_hPeriodicRSSI)) {
4466 PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n");
4468 msg.id = HOST_IF_MSG_EXIT;
4472 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4474 PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error);
4476 down(&hSemHostIFthrdEnd);
4478 wilc_mq_destroy(&gMsgQHostIF);
4481 down(&(hif_drv->gtOsCfgValuesSem));
4483 ret = remove_handler_in_list(hif_drv);
4490 terminated_handle = NULL;
4491 up(&hSemHostIntDeinit);
4495 void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length)
4498 struct host_if_msg msg;
4500 struct host_if_drv *hif_drv = NULL;
4502 id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
4503 hif_drv = get_handler_from_id(id);
4508 if (!hif_drv || hif_drv == terminated_handle) {
4509 PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv);
4513 memset(&msg, 0, sizeof(struct host_if_msg));
4515 msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO;
4518 msg.body.net_info.u32Length = u32Length;
4519 msg.body.net_info.pu8Buffer = kmalloc(u32Length, GFP_KERNEL);
4520 memcpy(msg.body.net_info.pu8Buffer,
4521 pu8Buffer, u32Length);
4523 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4525 PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error);
4528 void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
4531 struct host_if_msg msg;
4533 struct host_if_drv *hif_drv = NULL;
4535 down(&hSemHostIntDeinit);
4537 id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
4538 hif_drv = get_handler_from_id(id);
4539 PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n");
4542 if (!hif_drv || hif_drv == terminated_handle) {
4543 PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n");
4544 up(&hSemHostIntDeinit);
4548 if (!hif_drv->strWILC_UsrConnReq.pfUserConnectResult) {
4549 PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n");
4550 up(&hSemHostIntDeinit);
4554 memset(&msg, 0, sizeof(struct host_if_msg));
4557 msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO;
4561 msg.body.async_info.u32Length = u32Length;
4562 msg.body.async_info.pu8Buffer = kmalloc(u32Length, GFP_KERNEL);
4563 memcpy(msg.body.async_info.pu8Buffer,
4564 pu8Buffer, u32Length);
4566 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4568 PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", s32Error);
4570 up(&hSemHostIntDeinit);
4573 void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length)
4576 struct host_if_msg msg;
4578 struct host_if_drv *hif_drv = NULL;
4580 id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
4581 hif_drv = get_handler_from_id(id);
4584 PRINT_D(GENERIC_DBG, "Scan notification received %p\n", hif_drv);
4586 if (!hif_drv || hif_drv == terminated_handle)
4589 if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) {
4590 memset(&msg, 0, sizeof(struct host_if_msg));
4592 msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE;
4595 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4597 PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", s32Error);
4605 s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID,
4606 u32 u32duration, u16 chan,
4607 wilc_remain_on_chan_expired RemainOnChanExpired,
4608 wilc_remain_on_chan_ready RemainOnChanReady,
4612 struct host_if_msg msg;
4615 PRINT_ER("driver is null\n");
4619 memset(&msg, 0, sizeof(struct host_if_msg));
4621 msg.id = HOST_IF_MSG_REMAIN_ON_CHAN;
4622 msg.body.remain_on_ch.u16Channel = chan;
4623 msg.body.remain_on_ch.pRemainOnChanExpired = RemainOnChanExpired;
4624 msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady;
4625 msg.body.remain_on_ch.pVoid = pvUserArg;
4626 msg.body.remain_on_ch.u32duration = u32duration;
4627 msg.body.remain_on_ch.u32ListenSessionID = u32SessionID;
4630 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4632 PRINT_ER("wilc mq send fail\n");
4637 s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID)
4640 struct host_if_msg msg;
4643 PRINT_ER("driver is null\n");
4647 del_timer(&hif_drv->hRemainOnChannel);
4649 memset(&msg, 0, sizeof(struct host_if_msg));
4650 msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED;
4652 msg.body.remain_on_ch.u32ListenSessionID = u32SessionID;
4654 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4656 PRINT_ER("wilc mq send fail\n");
4661 s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg)
4664 struct host_if_msg msg;
4667 PRINT_ER("driver is null\n");
4671 memset(&msg, 0, sizeof(struct host_if_msg));
4673 msg.id = HOST_IF_MSG_REGISTER_FRAME;
4674 switch (u16FrameType) {
4676 PRINT_D(HOSTINF_DBG, "ACTION\n");
4677 msg.body.reg_frame.u8Regid = ACTION_FRM_IDX;
4681 PRINT_D(HOSTINF_DBG, "PROBE REQ\n");
4682 msg.body.reg_frame.u8Regid = PROBE_REQ_IDX;
4686 PRINT_D(HOSTINF_DBG, "Not valid frame type\n");
4689 msg.body.reg_frame.u16FrameType = u16FrameType;
4690 msg.body.reg_frame.bReg = bReg;
4693 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4695 PRINT_ER("wilc mq send fail\n");
4702 s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval,
4703 u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head,
4704 u32 u32TailLen, u8 *pu8Tail)
4707 struct host_if_msg msg;
4708 struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info;
4711 PRINT_ER("driver is null\n");
4715 memset(&msg, 0, sizeof(struct host_if_msg));
4717 PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n");
4719 msg.id = HOST_IF_MSG_ADD_BEACON;
4721 pstrSetBeaconParam->u32Interval = u32Interval;
4722 pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod;
4723 pstrSetBeaconParam->u32HeadLen = u32HeadLen;
4724 pstrSetBeaconParam->pu8Head = kmalloc(u32HeadLen, GFP_KERNEL);
4725 if (pstrSetBeaconParam->pu8Head == NULL) {
4729 memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen);
4730 pstrSetBeaconParam->u32TailLen = u32TailLen;
4732 if (u32TailLen > 0) {
4733 pstrSetBeaconParam->pu8Tail = kmalloc(u32TailLen, GFP_KERNEL);
4734 if (pstrSetBeaconParam->pu8Tail == NULL) {
4738 memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen);
4740 pstrSetBeaconParam->pu8Tail = NULL;
4743 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4745 PRINT_ER("wilc mq send fail\n");
4749 if (pstrSetBeaconParam->pu8Head != NULL)
4750 kfree(pstrSetBeaconParam->pu8Head);
4752 if (pstrSetBeaconParam->pu8Tail != NULL)
4753 kfree(pstrSetBeaconParam->pu8Tail);
4760 s32 host_int_del_beacon(struct host_if_drv *hif_drv)
4763 struct host_if_msg msg;
4766 PRINT_ER("driver is null\n");
4770 msg.id = HOST_IF_MSG_DEL_BEACON;
4772 PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n");
4774 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4776 PRINT_ER("wilc_mq_send fail\n");
4781 s32 host_int_add_station(struct host_if_drv *hif_drv,
4782 struct add_sta_param *pstrStaParams)
4785 struct host_if_msg msg;
4786 struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info;
4790 PRINT_ER("driver is null\n");
4794 memset(&msg, 0, sizeof(struct host_if_msg));
4796 PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n");
4798 msg.id = HOST_IF_MSG_ADD_STATION;
4801 memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param));
4802 if (pstrAddStationMsg->u8NumRates > 0) {
4803 u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL);
4808 memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
4809 pstrAddStationMsg->pu8Rates = rates;
4813 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4815 PRINT_ER("wilc_mq_send fail\n");
4819 s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr)
4822 struct host_if_msg msg;
4823 struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info;
4826 PRINT_ER("driver is null\n");
4830 memset(&msg, 0, sizeof(struct host_if_msg));
4832 PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n");
4834 msg.id = HOST_IF_MSG_DEL_STATION;
4837 if (pu8MacAddr == NULL)
4838 memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN);
4840 memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN);
4842 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4844 PRINT_ER("wilc_mq_send fail\n");
4848 s32 host_int_del_allstation(struct host_if_drv *hif_drv,
4849 u8 pu8MacAddr[][ETH_ALEN])
4852 struct host_if_msg msg;
4853 struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info;
4854 u8 au8Zero_Buff[ETH_ALEN] = {0};
4860 PRINT_ER("driver is null\n");
4864 memset(&msg, 0, sizeof(struct host_if_msg));
4866 PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n");
4868 msg.id = HOST_IF_MSG_DEL_ALL_STA;
4871 for (i = 0; i < MAX_NUM_STA; i++) {
4872 if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) {
4873 memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN);
4874 PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", pstrDelAllStationMsg->au8Sta_DelAllSta[i][0], pstrDelAllStationMsg->au8Sta_DelAllSta[i][1], pstrDelAllStationMsg->au8Sta_DelAllSta[i][2], pstrDelAllStationMsg->au8Sta_DelAllSta[i][3], pstrDelAllStationMsg->au8Sta_DelAllSta[i][4],
4875 pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]);
4880 PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n");
4884 pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb;
4885 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4889 PRINT_ER("wilc_mq_send fail\n");
4891 down(&hWaitResponse);
4897 s32 host_int_edit_station(struct host_if_drv *hif_drv,
4898 struct add_sta_param *pstrStaParams)
4901 struct host_if_msg msg;
4902 struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info;
4905 PRINT_ER("driver is null\n");
4909 PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n");
4911 memset(&msg, 0, sizeof(struct host_if_msg));
4913 msg.id = HOST_IF_MSG_EDIT_STATION;
4916 memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param));
4917 if (pstrAddStationMsg->u8NumRates > 0) {
4918 u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL);
4923 memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
4924 pstrAddStationMsg->pu8Rates = rates;
4927 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4929 PRINT_ER("wilc_mq_send fail\n");
4934 s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv,
4939 struct host_if_msg msg;
4940 struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info;
4942 PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d <<\n\n", bIsEnabled);
4945 PRINT_ER("driver is null\n");
4949 PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n");
4951 memset(&msg, 0, sizeof(struct host_if_msg));
4953 msg.id = HOST_IF_MSG_POWER_MGMT;
4956 pstrPowerMgmtParam->bIsEnabled = bIsEnabled;
4957 pstrPowerMgmtParam->u32Timeout = u32Timeout;
4960 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4962 PRINT_ER("wilc_mq_send fail\n");
4966 s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv,
4971 struct host_if_msg msg;
4972 struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info;
4976 PRINT_ER("driver is null\n");
4980 PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n");
4982 memset(&msg, 0, sizeof(struct host_if_msg));
4984 msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER;
4987 pstrMulticastFilterParam->bIsEnabled = bIsEnabled;
4988 pstrMulticastFilterParam->u32count = u32count;
4990 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
4992 PRINT_ER("wilc_mq_send fail\n");
4996 static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo)
4998 struct join_bss_param *pNewJoinBssParam = NULL;
5007 u8 pcipherTotalCount = 0;
5008 u8 authTotalCount = 0;
5011 pu8IEs = ptstrNetworkInfo->pu8IEs;
5012 u16IEsLen = ptstrNetworkInfo->u16IEsLen;
5014 pNewJoinBssParam = kmalloc(sizeof(struct join_bss_param), GFP_KERNEL);
5015 if (pNewJoinBssParam != NULL) {
5016 memset(pNewJoinBssParam, 0, sizeof(struct join_bss_param));
5017 pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod;
5018 pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod;
5019 pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo;
5020 memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6);
5021 memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1);
5022 pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen;
5023 memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3);
5024 memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3);
5026 while (index < u16IEsLen) {
5027 if (pu8IEs[index] == SUPP_RATES_IE) {
5028 suppRatesNo = pu8IEs[index + 1];
5029 pNewJoinBssParam->supp_rates[0] = suppRatesNo;
5032 for (i = 0; i < suppRatesNo; i++) {
5033 pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i];
5035 index += suppRatesNo;
5037 } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) {
5038 extSuppRatesNo = pu8IEs[index + 1];
5039 if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo))
5040 pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED;
5042 pNewJoinBssParam->supp_rates[0] += extSuppRatesNo;
5044 for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) {
5045 pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i];
5047 index += extSuppRatesNo;
5049 } else if (pu8IEs[index] == HT_CAPABILITY_IE) {
5050 pNewJoinBssParam->ht_capable = true;
5051 index += pu8IEs[index + 1] + 2;
5053 } else if ((pu8IEs[index] == WMM_IE) &&
5054 (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) &&
5055 (pu8IEs[index + 4] == 0xF2) &&
5056 (pu8IEs[index + 5] == 0x02) &&
5057 ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) &&
5058 (pu8IEs[index + 7] == 0x01)) {
5059 pNewJoinBssParam->wmm_cap = true;
5061 if (pu8IEs[index + 8] & BIT(7))
5062 pNewJoinBssParam->uapsd_cap = true;
5063 index += pu8IEs[index + 1] + 2;
5065 } else if ((pu8IEs[index] == P2P_IE) &&
5066 (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) &&
5067 (pu8IEs[index + 4] == 0x9a) &&
5068 (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) {
5071 pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf;
5072 pNewJoinBssParam->u8NoaEnbaled = 1;
5073 pNewJoinBssParam->u8Index = pu8IEs[index + 9];
5075 if (pu8IEs[index + 10] & BIT(7)) {
5076 pNewJoinBssParam->u8OppEnable = 1;
5077 pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10];
5079 pNewJoinBssParam->u8OppEnable = 0;
5081 PRINT_D(GENERIC_DBG, "P2P Dump\n");
5082 for (i = 0; i < pu8IEs[index + 7]; i++)
5083 PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]);
5085 pNewJoinBssParam->u8Count = pu8IEs[index + 11];
5086 u16P2P_count = index + 12;
5088 memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4);
5091 memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4);
5094 memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4);
5096 index += pu8IEs[index + 1] + 2;
5099 } else if ((pu8IEs[index] == RSN_IE) ||
5100 ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) &&
5101 (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) &&
5102 (pu8IEs[index + 5] == 0x01))) {
5103 u16 rsnIndex = index;
5105 if (pu8IEs[rsnIndex] == RSN_IE) {
5106 pNewJoinBssParam->mode_802_11i = 2;
5108 if (pNewJoinBssParam->mode_802_11i == 0)
5109 pNewJoinBssParam->mode_802_11i = 1;
5114 pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex];
5116 jumpOffset = pu8IEs[rsnIndex] * 4;
5117 pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex];
5120 for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) {
5121 pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1];
5123 pcipherTotalCount += pcipherCount;
5124 rsnIndex += jumpOffset;
5126 jumpOffset = pu8IEs[rsnIndex] * 4;
5128 authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex];
5131 for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) {
5132 pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1];
5134 authTotalCount += authCount;
5135 rsnIndex += jumpOffset;
5137 if (pu8IEs[index] == RSN_IE) {
5138 pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex];
5139 pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1];
5142 pNewJoinBssParam->rsn_found = true;
5143 index += pu8IEs[index + 1] + 2;
5146 index += pu8IEs[index + 1] + 2;
5153 return (void *)pNewJoinBssParam;
5157 void host_int_freeJoinParams(void *pJoinParams)
5159 if ((struct bss_param *)pJoinParams != NULL)
5160 kfree((struct bss_param *)pJoinParams);
5162 PRINT_ER("Unable to FREE null pointer\n");
5165 s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID)
5168 struct host_if_msg msg;
5169 struct ba_session_info *pBASessionInfo = &msg.body.session_info;
5172 PRINT_ER("driver is null\n");
5176 memset(&msg, 0, sizeof(struct host_if_msg));
5178 msg.id = HOST_IF_MSG_DEL_BA_SESSION;
5180 memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN);
5181 pBASessionInfo->u8Ted = TID;
5184 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
5186 PRINT_ER("wilc_mq_send fail\n");
5188 down(&hWaitResponse);
5193 s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv,
5198 struct host_if_msg msg;
5199 struct ba_session_info *pBASessionInfo = &msg.body.session_info;
5202 PRINT_ER("driver is null\n");
5206 memset(&msg, 0, sizeof(struct host_if_msg));
5208 msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS;
5210 memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN);
5211 pBASessionInfo->u8Ted = TID;
5214 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
5216 PRINT_ER("wilc_mq_send fail\n");
5218 down(&hWaitResponse);
5223 s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
5226 struct host_if_msg msg;
5231 PRINT_ER("driver is null\n");
5235 memset(&msg, 0, sizeof(struct host_if_msg));
5237 msg.id = HOST_IF_MSG_SET_IPADDRESS;
5239 msg.body.ip_info.au8IPAddr = u16ipadd;
5241 msg.body.ip_info.idx = idx;
5243 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
5245 PRINT_ER("wilc_mq_send fail\n");
5252 s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx)
5255 struct host_if_msg msg;
5258 PRINT_ER("driver is null\n");
5262 memset(&msg, 0, sizeof(struct host_if_msg));
5264 msg.id = HOST_IF_MSG_GET_IPADDRESS;
5266 msg.body.ip_info.au8IPAddr = u16ipadd;
5268 msg.body.ip_info.idx = idx;
5270 s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg));
5272 PRINT_ER("wilc_mq_send fail\n");