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 attr
;
105 wilc_scan_result result
;
107 struct hidden_network hidden_network
;
110 struct connect_attr
{
117 wilc_connect_result result
;
119 enum AUTHTYPE auth_type
;
124 struct rcvd_async_info
{
129 struct channel_attr
{
142 struct set_multicast
{
148 u8 del_all_sta
[MAX_NUM_STA
][ETH_ALEN
];
153 u8 mac_addr
[ETH_ALEN
];
156 struct power_mgmt_param
{
166 struct sta_inactive_t
{
171 struct scan_attr scan_info
;
172 struct connect_attr con_info
;
173 struct rcvd_net_info net_info
;
174 struct rcvd_async_info async_info
;
175 struct key_attr key_info
;
176 struct cfg_param_attr cfg_info
;
177 struct channel_attr channel_info
;
178 struct beacon_attr beacon_info
;
179 struct add_sta_param add_sta_info
;
180 struct del_sta del_sta_info
;
181 struct add_sta_param edit_sta_info
;
182 struct power_mgmt_param pwr_mgmt_info
;
183 struct sta_inactive_t mac_info
;
184 struct set_ip_addr ip_info
;
185 struct drv_handler drv
;
186 struct set_multicast multicast_info
;
188 struct set_mac_addr set_mac_info
;
189 struct get_mac_addr get_mac_info
;
190 struct ba_session_info session_info
;
191 struct remain_ch remain_on_ch
;
192 struct reg_frame reg_frame
;
194 struct del_all_sta del_all_sta_info
;
199 union message_body body
;
200 struct host_if_drv
*drv
;
203 struct join_bss_param
{
209 char ssid
[MAX_SSID_LEN
];
211 u8 supp_rates
[MAX_RATES_SUPPORTED
+ 1];
218 u8 rsn_pcip_policy
[3];
219 u8 rsn_auth_policy
[3];
232 static struct host_if_drv
*wfidrv_list
[NUM_CONCURRENT_IFC
+ 1];
233 struct host_if_drv
*terminated_handle
;
236 static struct task_struct
*hif_thread_handler
;
237 static WILC_MsgQueueHandle hif_msg_q
;
238 static struct semaphore hif_sema_thread
;
239 static struct semaphore hif_sema_driver
;
240 static struct semaphore hif_sema_wait_response
;
241 static struct semaphore hif_sema_deinit
;
242 static struct timer_list periodic_rssi
;
244 u8 gau8MulticastMacAddrList
[WILC_MULTICAST_TABLE_SIZE
][ETH_ALEN
];
246 static u8 gapu8RcvdAssocResp
[MAX_ASSOC_RESP_FRAME_SIZE
];
248 bool gbScanWhileConnected
;
253 static u8 gs8SetIP
[2][4];
254 static u8 gs8GetIP
[2][4];
255 static u32 gu32InactiveTime
;
257 static u32 gu32WidConnRstHack
;
259 u8
*gu8FlushedJoinReq
;
260 u8
*gu8FlushedInfoElemAsoc
;
261 u8 gu8Flushed11iMode
;
262 u8 gu8FlushedAuthType
;
263 u32 gu32FlushedJoinReqSize
;
264 u32 gu32FlushedInfoElemAsocSize
;
265 struct host_if_drv
*gu8FlushedJoinReqDrvHandler
;
266 #define REAL_JOIN_REQ 0
267 #define FLUSHED_JOIN_REQ 1
268 #define FLUSHED_BYTE_POS 79
270 static void *host_int_ParseJoinBssParam(tstrNetworkInfo
*ptstrNetworkInfo
);
272 extern void chip_sleep_manually(u32 u32SleepTime
);
273 extern int linux_wlan_get_num_conn_ifcs(void);
275 static int add_handler_in_list(struct host_if_drv
*handler
)
279 for (i
= 1; i
< ARRAY_SIZE(wfidrv_list
); i
++) {
280 if (!wfidrv_list
[i
]) {
281 wfidrv_list
[i
] = handler
;
289 static int remove_handler_in_list(struct host_if_drv
*handler
)
293 for (i
= 1; i
< ARRAY_SIZE(wfidrv_list
); i
++) {
294 if (wfidrv_list
[i
] == handler
) {
295 wfidrv_list
[i
] = NULL
;
303 static int get_id_from_handler(struct host_if_drv
*handler
)
310 for (i
= 1; i
< ARRAY_SIZE(wfidrv_list
); i
++) {
311 if (wfidrv_list
[i
] == handler
)
318 static struct host_if_drv
*get_handler_from_id(int id
)
320 if (id
<= 0 || id
>= ARRAY_SIZE(wfidrv_list
))
322 return wfidrv_list
[id
];
325 static s32
Handle_SetChannel(struct host_if_drv
*hif_drv
,
326 struct channel_attr
*pstrHostIFSetChan
)
332 strWID
.id
= (u16
)WID_CURRENT_CHANNEL
;
333 strWID
.type
= WID_CHAR
;
334 strWID
.val
= (char *)&(pstrHostIFSetChan
->set_ch
);
335 strWID
.size
= sizeof(char);
337 PRINT_D(HOSTINF_DBG
, "Setting channel\n");
339 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
340 get_id_from_handler(hif_drv
));
342 PRINT_ER("Failed to set channel\n");
349 static s32
Handle_SetWfiDrvHandler(struct host_if_drv
*hif_drv
,
350 struct drv_handler
*pstrHostIfSetDrvHandler
)
356 strWID
.id
= (u16
)WID_SET_DRV_HANDLER
;
357 strWID
.type
= WID_INT
;
358 strWID
.val
= (s8
*)&(pstrHostIfSetDrvHandler
->u32Address
);
359 strWID
.size
= sizeof(u32
);
361 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
362 pstrHostIfSetDrvHandler
->u32Address
);
365 up(&hif_sema_driver
);
368 PRINT_ER("Failed to set driver handler\n");
375 static s32
Handle_SetOperationMode(struct host_if_drv
*hif_drv
,
376 struct op_mode
*pstrHostIfSetOperationMode
)
382 strWID
.id
= (u16
)WID_SET_OPERATION_MODE
;
383 strWID
.type
= WID_INT
;
384 strWID
.val
= (s8
*)&(pstrHostIfSetOperationMode
->u32Mode
);
385 strWID
.size
= sizeof(u32
);
387 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
388 get_id_from_handler(hif_drv
));
391 if ((pstrHostIfSetOperationMode
->u32Mode
) == IDLE_MODE
)
392 up(&hif_sema_driver
);
395 PRINT_ER("Failed to set driver handler\n");
402 s32
Handle_set_IPAddress(struct host_if_drv
*hif_drv
, u8
*pu8IPAddr
, u8 idx
)
407 char firmwareIPAddress
[4] = {0};
409 if (pu8IPAddr
[0] < 192)
412 PRINT_INFO(HOSTINF_DBG
, "Indx = %d, Handling set IP = %pI4\n", idx
, pu8IPAddr
);
414 memcpy(gs8SetIP
[idx
], pu8IPAddr
, IP_ALEN
);
416 strWID
.id
= (u16
)WID_IP_ADDRESS
;
417 strWID
.type
= WID_STR
;
418 strWID
.val
= (u8
*)pu8IPAddr
;
419 strWID
.size
= IP_ALEN
;
421 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
422 get_id_from_handler(hif_drv
));
425 host_int_get_ipaddress(hif_drv
, firmwareIPAddress
, idx
);
428 PRINT_ER("Failed to set IP address\n");
432 PRINT_INFO(HOSTINF_DBG
, "IP address set\n");
437 s32
Handle_get_IPAddress(struct host_if_drv
*hif_drv
, u8
*pu8IPAddr
, u8 idx
)
443 strWID
.id
= (u16
)WID_IP_ADDRESS
;
444 strWID
.type
= WID_STR
;
445 strWID
.val
= kmalloc(IP_ALEN
, GFP_KERNEL
);
446 strWID
.size
= IP_ALEN
;
448 s32Error
= send_config_pkt(GET_CFG
, &strWID
, 1,
449 get_id_from_handler(hif_drv
));
451 PRINT_INFO(HOSTINF_DBG
, "%pI4\n", strWID
.val
);
453 memcpy(gs8GetIP
[idx
], strWID
.val
, IP_ALEN
);
457 if (memcmp(gs8GetIP
[idx
], gs8SetIP
[idx
], IP_ALEN
) != 0)
458 host_int_setup_ipaddress(hif_drv
, gs8SetIP
[idx
], idx
);
461 PRINT_ER("Failed to get IP address\n");
465 PRINT_INFO(HOSTINF_DBG
, "IP address retrieved:: u8IfIdx = %d\n", idx
);
466 PRINT_INFO(HOSTINF_DBG
, "%pI4\n", gs8GetIP
[idx
]);
467 PRINT_INFO(HOSTINF_DBG
, "\n");
472 static s32
Handle_SetMacAddress(struct host_if_drv
*hif_drv
,
473 struct set_mac_addr
*pstrHostIfSetMacAddress
)
478 u8
*mac_buf
= kmalloc(ETH_ALEN
, GFP_KERNEL
);
480 if (mac_buf
== NULL
) {
481 PRINT_ER("No buffer to send mac address\n");
484 memcpy(mac_buf
, pstrHostIfSetMacAddress
->u8MacAddress
, ETH_ALEN
);
486 strWID
.id
= (u16
)WID_MAC_ADDR
;
487 strWID
.type
= WID_STR
;
488 strWID
.val
= mac_buf
;
489 strWID
.size
= ETH_ALEN
;
490 PRINT_D(GENERIC_DBG
, "mac addr = :%pM\n", strWID
.val
);
492 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
493 get_id_from_handler(hif_drv
));
495 PRINT_ER("Failed to set mac address\n");
503 static s32
Handle_GetMacAddress(struct host_if_drv
*hif_drv
,
504 struct get_mac_addr
*pstrHostIfGetMacAddress
)
510 strWID
.id
= (u16
)WID_MAC_ADDR
;
511 strWID
.type
= WID_STR
;
512 strWID
.val
= pstrHostIfGetMacAddress
->u8MacAddress
;
513 strWID
.size
= ETH_ALEN
;
515 s32Error
= send_config_pkt(GET_CFG
, &strWID
, 1,
516 get_id_from_handler(hif_drv
));
518 PRINT_ER("Failed to get mac address\n");
521 up(&hif_sema_wait_response
);
526 static s32
Handle_CfgParam(struct host_if_drv
*hif_drv
,
527 struct cfg_param_attr
*strHostIFCfgParamAttr
)
530 struct wid strWIDList
[32];
533 down(&hif_drv
->gtOsCfgValuesSem
);
536 PRINT_D(HOSTINF_DBG
, "Setting CFG params\n");
538 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& BSS_TYPE
) {
539 if (strHostIFCfgParamAttr
->cfg_attr_info
.bss_type
< 6) {
540 strWIDList
[u8WidCnt
].id
= WID_BSS_TYPE
;
541 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.bss_type
;
542 strWIDList
[u8WidCnt
].type
= WID_CHAR
;
543 strWIDList
[u8WidCnt
].size
= sizeof(char);
544 hif_drv
->strCfgValues
.bss_type
= (u8
)strHostIFCfgParamAttr
->cfg_attr_info
.bss_type
;
546 PRINT_ER("check value 6 over\n");
552 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& AUTH_TYPE
) {
553 if ((strHostIFCfgParamAttr
->cfg_attr_info
.auth_type
) == 1 || (strHostIFCfgParamAttr
->cfg_attr_info
.auth_type
) == 2 || (strHostIFCfgParamAttr
->cfg_attr_info
.auth_type
) == 5) {
554 strWIDList
[u8WidCnt
].id
= WID_AUTH_TYPE
;
555 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.auth_type
;
556 strWIDList
[u8WidCnt
].type
= WID_CHAR
;
557 strWIDList
[u8WidCnt
].size
= sizeof(char);
558 hif_drv
->strCfgValues
.auth_type
= (u8
)strHostIFCfgParamAttr
->cfg_attr_info
.auth_type
;
560 PRINT_ER("Impossible value \n");
566 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& AUTHEN_TIMEOUT
) {
567 if (strHostIFCfgParamAttr
->cfg_attr_info
.auth_timeout
> 0 && strHostIFCfgParamAttr
->cfg_attr_info
.auth_timeout
< 65536) {
568 strWIDList
[u8WidCnt
].id
= WID_AUTH_TIMEOUT
;
569 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.auth_timeout
;
570 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
571 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
572 hif_drv
->strCfgValues
.auth_timeout
= strHostIFCfgParamAttr
->cfg_attr_info
.auth_timeout
;
574 PRINT_ER("Range(1 ~ 65535) over\n");
580 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& POWER_MANAGEMENT
) {
581 if (strHostIFCfgParamAttr
->cfg_attr_info
.power_mgmt_mode
< 5) {
582 strWIDList
[u8WidCnt
].id
= WID_POWER_MANAGEMENT
;
583 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.power_mgmt_mode
;
584 strWIDList
[u8WidCnt
].type
= WID_CHAR
;
585 strWIDList
[u8WidCnt
].size
= sizeof(char);
586 hif_drv
->strCfgValues
.power_mgmt_mode
= (u8
)strHostIFCfgParamAttr
->cfg_attr_info
.power_mgmt_mode
;
588 PRINT_ER("Invalide power mode\n");
594 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& RETRY_SHORT
) {
595 if ((strHostIFCfgParamAttr
->cfg_attr_info
.short_retry_limit
> 0) && (strHostIFCfgParamAttr
->cfg_attr_info
.short_retry_limit
< 256)) {
596 strWIDList
[u8WidCnt
].id
= WID_SHORT_RETRY_LIMIT
;
597 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.short_retry_limit
;
598 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
599 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
600 hif_drv
->strCfgValues
.short_retry_limit
= strHostIFCfgParamAttr
->cfg_attr_info
.short_retry_limit
;
602 PRINT_ER("Range(1~256) over\n");
608 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& RETRY_LONG
) {
609 if ((strHostIFCfgParamAttr
->cfg_attr_info
.long_retry_limit
> 0) && (strHostIFCfgParamAttr
->cfg_attr_info
.long_retry_limit
< 256)) {
610 strWIDList
[u8WidCnt
].id
= WID_LONG_RETRY_LIMIT
;
611 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.long_retry_limit
;
613 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
614 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
615 hif_drv
->strCfgValues
.long_retry_limit
= strHostIFCfgParamAttr
->cfg_attr_info
.long_retry_limit
;
617 PRINT_ER("Range(1~256) over\n");
623 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& FRAG_THRESHOLD
) {
625 if (strHostIFCfgParamAttr
->cfg_attr_info
.frag_threshold
> 255 && strHostIFCfgParamAttr
->cfg_attr_info
.frag_threshold
< 7937) {
626 strWIDList
[u8WidCnt
].id
= WID_FRAG_THRESHOLD
;
627 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.frag_threshold
;
628 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
629 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
630 hif_drv
->strCfgValues
.frag_threshold
= strHostIFCfgParamAttr
->cfg_attr_info
.frag_threshold
;
632 PRINT_ER("Threshold Range fail\n");
638 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& RTS_THRESHOLD
) {
639 if (strHostIFCfgParamAttr
->cfg_attr_info
.rts_threshold
> 255 && strHostIFCfgParamAttr
->cfg_attr_info
.rts_threshold
< 65536) {
640 strWIDList
[u8WidCnt
].id
= WID_RTS_THRESHOLD
;
641 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.rts_threshold
;
642 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
643 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
644 hif_drv
->strCfgValues
.rts_threshold
= strHostIFCfgParamAttr
->cfg_attr_info
.rts_threshold
;
646 PRINT_ER("Threshold Range fail\n");
652 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& PREAMBLE
) {
653 if (strHostIFCfgParamAttr
->cfg_attr_info
.preamble_type
< 3) {
654 strWIDList
[u8WidCnt
].id
= WID_PREAMBLE
;
655 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.preamble_type
;
656 strWIDList
[u8WidCnt
].type
= WID_CHAR
;
657 strWIDList
[u8WidCnt
].size
= sizeof(char);
658 hif_drv
->strCfgValues
.preamble_type
= strHostIFCfgParamAttr
->cfg_attr_info
.preamble_type
;
660 PRINT_ER("Preamle Range(0~2) over\n");
666 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& SHORT_SLOT_ALLOWED
) {
667 if (strHostIFCfgParamAttr
->cfg_attr_info
.short_slot_allowed
< 2) {
668 strWIDList
[u8WidCnt
].id
= WID_SHORT_SLOT_ALLOWED
;
669 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.short_slot_allowed
;
670 strWIDList
[u8WidCnt
].type
= WID_CHAR
;
671 strWIDList
[u8WidCnt
].size
= sizeof(char);
672 hif_drv
->strCfgValues
.short_slot_allowed
= (u8
)strHostIFCfgParamAttr
->cfg_attr_info
.short_slot_allowed
;
674 PRINT_ER("Short slot(2) over\n");
680 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& TXOP_PROT_DISABLE
) {
681 if (strHostIFCfgParamAttr
->cfg_attr_info
.txop_prot_disabled
< 2) {
682 strWIDList
[u8WidCnt
].id
= WID_11N_TXOP_PROT_DISABLE
;
683 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.txop_prot_disabled
;
684 strWIDList
[u8WidCnt
].type
= WID_CHAR
;
685 strWIDList
[u8WidCnt
].size
= sizeof(char);
686 hif_drv
->strCfgValues
.txop_prot_disabled
= (u8
)strHostIFCfgParamAttr
->cfg_attr_info
.txop_prot_disabled
;
688 PRINT_ER("TXOP prot disable\n");
694 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& BEACON_INTERVAL
) {
695 if (strHostIFCfgParamAttr
->cfg_attr_info
.beacon_interval
> 0 && strHostIFCfgParamAttr
->cfg_attr_info
.beacon_interval
< 65536) {
696 strWIDList
[u8WidCnt
].id
= WID_BEACON_INTERVAL
;
697 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.beacon_interval
;
698 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
699 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
700 hif_drv
->strCfgValues
.beacon_interval
= strHostIFCfgParamAttr
->cfg_attr_info
.beacon_interval
;
702 PRINT_ER("Beacon interval(1~65535) fail\n");
708 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& DTIM_PERIOD
) {
709 if (strHostIFCfgParamAttr
->cfg_attr_info
.dtim_period
> 0 && strHostIFCfgParamAttr
->cfg_attr_info
.dtim_period
< 256) {
710 strWIDList
[u8WidCnt
].id
= WID_DTIM_PERIOD
;
711 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.dtim_period
;
712 strWIDList
[u8WidCnt
].type
= WID_CHAR
;
713 strWIDList
[u8WidCnt
].size
= sizeof(char);
714 hif_drv
->strCfgValues
.dtim_period
= strHostIFCfgParamAttr
->cfg_attr_info
.dtim_period
;
716 PRINT_ER("DTIM range(1~255) fail\n");
722 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& SITE_SURVEY
) {
723 if (strHostIFCfgParamAttr
->cfg_attr_info
.site_survey_enabled
< 3) {
724 strWIDList
[u8WidCnt
].id
= WID_SITE_SURVEY
;
725 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.site_survey_enabled
;
726 strWIDList
[u8WidCnt
].type
= WID_CHAR
;
727 strWIDList
[u8WidCnt
].size
= sizeof(char);
728 hif_drv
->strCfgValues
.site_survey_enabled
= (u8
)strHostIFCfgParamAttr
->cfg_attr_info
.site_survey_enabled
;
730 PRINT_ER("Site survey disable\n");
736 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& SITE_SURVEY_SCAN_TIME
) {
737 if (strHostIFCfgParamAttr
->cfg_attr_info
.site_survey_scan_time
> 0 && strHostIFCfgParamAttr
->cfg_attr_info
.site_survey_scan_time
< 65536) {
738 strWIDList
[u8WidCnt
].id
= WID_SITE_SURVEY_SCAN_TIME
;
739 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.site_survey_scan_time
;
740 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
741 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
742 hif_drv
->strCfgValues
.site_survey_scan_time
= strHostIFCfgParamAttr
->cfg_attr_info
.site_survey_scan_time
;
744 PRINT_ER("Site survey scan time(1~65535) over\n");
750 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& ACTIVE_SCANTIME
) {
751 if (strHostIFCfgParamAttr
->cfg_attr_info
.active_scan_time
> 0 && strHostIFCfgParamAttr
->cfg_attr_info
.active_scan_time
< 65536) {
752 strWIDList
[u8WidCnt
].id
= WID_ACTIVE_SCAN_TIME
;
753 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.active_scan_time
;
754 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
755 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
756 hif_drv
->strCfgValues
.active_scan_time
= strHostIFCfgParamAttr
->cfg_attr_info
.active_scan_time
;
758 PRINT_ER("Active scan time(1~65535) over\n");
764 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& PASSIVE_SCANTIME
) {
765 if (strHostIFCfgParamAttr
->cfg_attr_info
.passive_scan_time
> 0 && strHostIFCfgParamAttr
->cfg_attr_info
.passive_scan_time
< 65536) {
766 strWIDList
[u8WidCnt
].id
= WID_PASSIVE_SCAN_TIME
;
767 strWIDList
[u8WidCnt
].val
= (s8
*)&strHostIFCfgParamAttr
->cfg_attr_info
.passive_scan_time
;
768 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
769 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
770 hif_drv
->strCfgValues
.passive_scan_time
= strHostIFCfgParamAttr
->cfg_attr_info
.passive_scan_time
;
772 PRINT_ER("Passive scan time(1~65535) over\n");
778 if (strHostIFCfgParamAttr
->cfg_attr_info
.flag
& CURRENT_TX_RATE
) {
779 enum CURRENT_TXRATE curr_tx_rate
= strHostIFCfgParamAttr
->cfg_attr_info
.curr_tx_rate
;
780 if (curr_tx_rate
== AUTORATE
|| curr_tx_rate
== MBPS_1
781 || curr_tx_rate
== MBPS_2
|| curr_tx_rate
== MBPS_5_5
782 || curr_tx_rate
== MBPS_11
|| curr_tx_rate
== MBPS_6
783 || curr_tx_rate
== MBPS_9
|| curr_tx_rate
== MBPS_12
784 || curr_tx_rate
== MBPS_18
|| curr_tx_rate
== MBPS_24
785 || curr_tx_rate
== MBPS_36
|| curr_tx_rate
== MBPS_48
|| curr_tx_rate
== MBPS_54
) {
786 strWIDList
[u8WidCnt
].id
= WID_CURRENT_TX_RATE
;
787 strWIDList
[u8WidCnt
].val
= (s8
*)&curr_tx_rate
;
788 strWIDList
[u8WidCnt
].type
= WID_SHORT
;
789 strWIDList
[u8WidCnt
].size
= sizeof(u16
);
790 hif_drv
->strCfgValues
.curr_tx_rate
= (u8
)curr_tx_rate
;
792 PRINT_ER("out of TX rate\n");
798 s32Error
= send_config_pkt(SET_CFG
, strWIDList
, u8WidCnt
,
799 get_id_from_handler(hif_drv
));
802 PRINT_ER("Error in setting CFG params\n");
805 up(&hif_drv
->gtOsCfgValuesSem
);
809 static s32
Handle_wait_msg_q_empty(void)
811 g_wilc_initialized
= 0;
812 up(&hif_sema_wait_response
);
816 static s32
Handle_Scan(struct host_if_drv
*hif_drv
,
817 struct scan_attr
*pstrHostIFscanAttr
)
820 struct wid strWIDList
[5];
821 u32 u32WidsCount
= 0;
825 u8
*pu8HdnNtwrksWidVal
= NULL
;
827 PRINT_D(HOSTINF_DBG
, "Setting SCAN params\n");
828 PRINT_D(HOSTINF_DBG
, "Scanning: In [%d] state\n", hif_drv
->enuHostIFstate
);
830 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
= pstrHostIFscanAttr
->result
;
831 hif_drv
->strWILC_UsrScanReq
.u32UserScanPvoid
= pstrHostIFscanAttr
->arg
;
833 if ((hif_drv
->enuHostIFstate
>= HOST_IF_SCANNING
) && (hif_drv
->enuHostIFstate
< HOST_IF_CONNECTED
)) {
834 PRINT_D(GENERIC_DBG
, "Don't scan we are already in [%d] state\n", hif_drv
->enuHostIFstate
);
835 PRINT_ER("Already scan\n");
840 if (g_obtainingIP
|| connecting
) {
841 PRINT_D(GENERIC_DBG
, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
842 PRINT_ER("Don't do obss scan\n");
847 PRINT_D(HOSTINF_DBG
, "Setting SCAN params\n");
850 hif_drv
->strWILC_UsrScanReq
.u32RcvdChCount
= 0;
852 strWIDList
[u32WidsCount
].id
= (u16
)WID_SSID_PROBE_REQ
;
853 strWIDList
[u32WidsCount
].type
= WID_STR
;
855 for (i
= 0; i
< pstrHostIFscanAttr
->hidden_network
.u8ssidnum
; i
++)
856 valuesize
+= ((pstrHostIFscanAttr
->hidden_network
.pstrHiddenNetworkInfo
[i
].u8ssidlen
) + 1);
857 pu8HdnNtwrksWidVal
= kmalloc(valuesize
+ 1, GFP_KERNEL
);
858 strWIDList
[u32WidsCount
].val
= pu8HdnNtwrksWidVal
;
859 if (strWIDList
[u32WidsCount
].val
!= NULL
) {
860 pu8Buffer
= strWIDList
[u32WidsCount
].val
;
862 *pu8Buffer
++ = pstrHostIFscanAttr
->hidden_network
.u8ssidnum
;
864 PRINT_D(HOSTINF_DBG
, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr
->hidden_network
.u8ssidnum
);
866 for (i
= 0; i
< pstrHostIFscanAttr
->hidden_network
.u8ssidnum
; i
++) {
867 *pu8Buffer
++ = pstrHostIFscanAttr
->hidden_network
.pstrHiddenNetworkInfo
[i
].u8ssidlen
;
868 memcpy(pu8Buffer
, pstrHostIFscanAttr
->hidden_network
.pstrHiddenNetworkInfo
[i
].pu8ssid
, pstrHostIFscanAttr
->hidden_network
.pstrHiddenNetworkInfo
[i
].u8ssidlen
);
869 pu8Buffer
+= pstrHostIFscanAttr
->hidden_network
.pstrHiddenNetworkInfo
[i
].u8ssidlen
;
874 strWIDList
[u32WidsCount
].size
= (s32
)(valuesize
+ 1);
879 strWIDList
[u32WidsCount
].id
= WID_INFO_ELEMENT_PROBE
;
880 strWIDList
[u32WidsCount
].type
= WID_BIN_DATA
;
881 strWIDList
[u32WidsCount
].val
= pstrHostIFscanAttr
->ies
;
882 strWIDList
[u32WidsCount
].size
= pstrHostIFscanAttr
->ies_len
;
886 strWIDList
[u32WidsCount
].id
= WID_SCAN_TYPE
;
887 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
888 strWIDList
[u32WidsCount
].size
= sizeof(char);
889 strWIDList
[u32WidsCount
].val
= (s8
*)(&(pstrHostIFscanAttr
->type
));
892 strWIDList
[u32WidsCount
].id
= WID_SCAN_CHANNEL_LIST
;
893 strWIDList
[u32WidsCount
].type
= WID_BIN_DATA
;
895 if (pstrHostIFscanAttr
->ch_freq_list
!= NULL
&& pstrHostIFscanAttr
->ch_list_len
> 0) {
898 for (i
= 0; i
< pstrHostIFscanAttr
->ch_list_len
; i
++) {
899 if (pstrHostIFscanAttr
->ch_freq_list
[i
] > 0)
900 pstrHostIFscanAttr
->ch_freq_list
[i
] = pstrHostIFscanAttr
->ch_freq_list
[i
] - 1;
904 strWIDList
[u32WidsCount
].val
= pstrHostIFscanAttr
->ch_freq_list
;
905 strWIDList
[u32WidsCount
].size
= pstrHostIFscanAttr
->ch_list_len
;
908 strWIDList
[u32WidsCount
].id
= WID_START_SCAN_REQ
;
909 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
910 strWIDList
[u32WidsCount
].size
= sizeof(char);
911 strWIDList
[u32WidsCount
].val
= (s8
*)(&(pstrHostIFscanAttr
->src
));
914 if (hif_drv
->enuHostIFstate
== HOST_IF_CONNECTED
)
915 gbScanWhileConnected
= true;
916 else if (hif_drv
->enuHostIFstate
== HOST_IF_IDLE
)
917 gbScanWhileConnected
= false;
919 s32Error
= send_config_pkt(SET_CFG
, strWIDList
, u32WidsCount
,
920 get_id_from_handler(hif_drv
));
923 PRINT_ER("Failed to send scan paramters config packet\n");
925 PRINT_D(HOSTINF_DBG
, "Successfully sent SCAN params config packet\n");
929 del_timer(&hif_drv
->hScanTimer
);
930 Handle_ScanDone(hif_drv
, SCAN_EVENT_ABORTED
);
933 kfree(pstrHostIFscanAttr
->ch_freq_list
);
934 pstrHostIFscanAttr
->ch_freq_list
= NULL
;
936 kfree(pstrHostIFscanAttr
->ies
);
937 pstrHostIFscanAttr
->ies
= NULL
;
938 kfree(pstrHostIFscanAttr
->hidden_network
.pstrHiddenNetworkInfo
);
939 pstrHostIFscanAttr
->hidden_network
.pstrHiddenNetworkInfo
= NULL
;
941 kfree(pu8HdnNtwrksWidVal
);
946 static s32
Handle_ScanDone(struct host_if_drv
*hif_drv
,
947 enum scan_event enuEvent
)
950 u8 u8abort_running_scan
;
954 PRINT_D(HOSTINF_DBG
, "in Handle_ScanDone()\n");
956 if (enuEvent
== SCAN_EVENT_ABORTED
) {
957 PRINT_D(GENERIC_DBG
, "Abort running scan\n");
958 u8abort_running_scan
= 1;
959 strWID
.id
= (u16
)WID_ABORT_RUNNING_SCAN
;
960 strWID
.type
= WID_CHAR
;
961 strWID
.val
= (s8
*)&u8abort_running_scan
;
962 strWID
.size
= sizeof(char);
964 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
965 get_id_from_handler(hif_drv
));
967 PRINT_ER("Failed to set abort running scan\n");
973 PRINT_ER("Driver handler is NULL\n");
977 if (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
) {
978 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult(enuEvent
, NULL
,
979 hif_drv
->strWILC_UsrScanReq
.u32UserScanPvoid
, NULL
);
980 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
= NULL
;
986 u8 u8ConnectedSSID
[6] = {0};
987 static s32
Handle_Connect(struct host_if_drv
*hif_drv
,
988 struct connect_attr
*pstrHostIFconnectAttr
)
991 struct wid strWIDList
[8];
992 u32 u32WidsCount
= 0, dummyval
= 0;
993 u8
*pu8CurrByte
= NULL
;
994 struct join_bss_param
*ptstrJoinBssParam
;
996 PRINT_D(GENERIC_DBG
, "Handling connect request\n");
998 if (memcmp(pstrHostIFconnectAttr
->bssid
, u8ConnectedSSID
, ETH_ALEN
) == 0) {
1001 PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n");
1005 PRINT_INFO(HOSTINF_DBG
, "Saving connection parameters in global structure\n");
1007 ptstrJoinBssParam
= (struct join_bss_param
*)pstrHostIFconnectAttr
->params
;
1008 if (ptstrJoinBssParam
== NULL
) {
1009 PRINT_ER("Required BSSID not found\n");
1014 if (pstrHostIFconnectAttr
->bssid
!= NULL
) {
1015 hif_drv
->strWILC_UsrConnReq
.pu8bssid
= kmalloc(6, GFP_KERNEL
);
1016 memcpy(hif_drv
->strWILC_UsrConnReq
.pu8bssid
, pstrHostIFconnectAttr
->bssid
, 6);
1019 hif_drv
->strWILC_UsrConnReq
.ssidLen
= pstrHostIFconnectAttr
->ssid_len
;
1020 if (pstrHostIFconnectAttr
->ssid
!= NULL
) {
1021 hif_drv
->strWILC_UsrConnReq
.pu8ssid
= kmalloc(pstrHostIFconnectAttr
->ssid_len
+ 1, GFP_KERNEL
);
1022 memcpy(hif_drv
->strWILC_UsrConnReq
.pu8ssid
, pstrHostIFconnectAttr
->ssid
,
1023 pstrHostIFconnectAttr
->ssid_len
);
1024 hif_drv
->strWILC_UsrConnReq
.pu8ssid
[pstrHostIFconnectAttr
->ssid_len
] = '\0';
1027 hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
= pstrHostIFconnectAttr
->ies_len
;
1028 if (pstrHostIFconnectAttr
->ies
!= NULL
) {
1029 hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
= kmalloc(pstrHostIFconnectAttr
->ies_len
, GFP_KERNEL
);
1030 memcpy(hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
, pstrHostIFconnectAttr
->ies
,
1031 pstrHostIFconnectAttr
->ies_len
);
1034 hif_drv
->strWILC_UsrConnReq
.u8security
= pstrHostIFconnectAttr
->security
;
1035 hif_drv
->strWILC_UsrConnReq
.tenuAuth_type
= pstrHostIFconnectAttr
->auth_type
;
1036 hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult
= pstrHostIFconnectAttr
->result
;
1037 hif_drv
->strWILC_UsrConnReq
.u32UserConnectPvoid
= pstrHostIFconnectAttr
->arg
;
1039 strWIDList
[u32WidsCount
].id
= WID_SUCCESS_FRAME_COUNT
;
1040 strWIDList
[u32WidsCount
].type
= WID_INT
;
1041 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
1042 strWIDList
[u32WidsCount
].val
= (s8
*)(&(dummyval
));
1045 strWIDList
[u32WidsCount
].id
= WID_RECEIVED_FRAGMENT_COUNT
;
1046 strWIDList
[u32WidsCount
].type
= WID_INT
;
1047 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
1048 strWIDList
[u32WidsCount
].val
= (s8
*)(&(dummyval
));
1051 strWIDList
[u32WidsCount
].id
= WID_FAILED_COUNT
;
1052 strWIDList
[u32WidsCount
].type
= WID_INT
;
1053 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
1054 strWIDList
[u32WidsCount
].val
= (s8
*)(&(dummyval
));
1058 strWIDList
[u32WidsCount
].id
= WID_INFO_ELEMENT_ASSOCIATE
;
1059 strWIDList
[u32WidsCount
].type
= WID_BIN_DATA
;
1060 strWIDList
[u32WidsCount
].val
= hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
;
1061 strWIDList
[u32WidsCount
].size
= hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
;
1064 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7)) {
1066 gu32FlushedInfoElemAsocSize
= hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
;
1067 gu8FlushedInfoElemAsoc
= kmalloc(gu32FlushedInfoElemAsocSize
, GFP_KERNEL
);
1068 memcpy(gu8FlushedInfoElemAsoc
, hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
,
1069 gu32FlushedInfoElemAsocSize
);
1072 strWIDList
[u32WidsCount
].id
= (u16
)WID_11I_MODE
;
1073 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
1074 strWIDList
[u32WidsCount
].size
= sizeof(char);
1075 strWIDList
[u32WidsCount
].val
= (s8
*)(&(hif_drv
->strWILC_UsrConnReq
.u8security
));
1078 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7))
1079 gu8Flushed11iMode
= hif_drv
->strWILC_UsrConnReq
.u8security
;
1081 PRINT_INFO(HOSTINF_DBG
, "Encrypt Mode = %x\n", hif_drv
->strWILC_UsrConnReq
.u8security
);
1084 strWIDList
[u32WidsCount
].id
= (u16
)WID_AUTH_TYPE
;
1085 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
1086 strWIDList
[u32WidsCount
].size
= sizeof(char);
1087 strWIDList
[u32WidsCount
].val
= (s8
*)(&hif_drv
->strWILC_UsrConnReq
.tenuAuth_type
);
1090 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7))
1091 gu8FlushedAuthType
= (u8
)hif_drv
->strWILC_UsrConnReq
.tenuAuth_type
;
1093 PRINT_INFO(HOSTINF_DBG
, "Authentication Type = %x\n", hif_drv
->strWILC_UsrConnReq
.tenuAuth_type
);
1094 PRINT_D(HOSTINF_DBG
, "Connecting to network of SSID %s on channel %d\n",
1095 hif_drv
->strWILC_UsrConnReq
.pu8ssid
, pstrHostIFconnectAttr
->ch
);
1097 strWIDList
[u32WidsCount
].id
= (u16
)WID_JOIN_REQ_EXTENDED
;
1098 strWIDList
[u32WidsCount
].type
= WID_STR
;
1099 strWIDList
[u32WidsCount
].size
= 112;
1100 strWIDList
[u32WidsCount
].val
= kmalloc(strWIDList
[u32WidsCount
].size
, GFP_KERNEL
);
1102 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7)) {
1103 gu32FlushedJoinReqSize
= strWIDList
[u32WidsCount
].size
;
1104 gu8FlushedJoinReq
= kmalloc(gu32FlushedJoinReqSize
, GFP_KERNEL
);
1106 if (strWIDList
[u32WidsCount
].val
== NULL
) {
1111 pu8CurrByte
= strWIDList
[u32WidsCount
].val
;
1114 if (pstrHostIFconnectAttr
->ssid
!= NULL
) {
1115 memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->ssid
, pstrHostIFconnectAttr
->ssid_len
);
1116 pu8CurrByte
[pstrHostIFconnectAttr
->ssid_len
] = '\0';
1118 pu8CurrByte
+= MAX_SSID_LEN
;
1119 *(pu8CurrByte
++) = INFRASTRUCTURE
;
1121 if ((pstrHostIFconnectAttr
->ch
>= 1) && (pstrHostIFconnectAttr
->ch
<= 14)) {
1122 *(pu8CurrByte
++) = pstrHostIFconnectAttr
->ch
;
1124 PRINT_ER("Channel out of range\n");
1125 *(pu8CurrByte
++) = 0xFF;
1127 *(pu8CurrByte
++) = (ptstrJoinBssParam
->cap_info
) & 0xFF;
1128 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->cap_info
) >> 8) & 0xFF;
1129 PRINT_D(HOSTINF_DBG
, "* Cap Info %0x*\n", (*(pu8CurrByte
- 2) | ((*(pu8CurrByte
- 1)) << 8)));
1131 if (pstrHostIFconnectAttr
->bssid
!= NULL
)
1132 memcpy(pu8CurrByte
, pstrHostIFconnectAttr
->bssid
, 6);
1135 *(pu8CurrByte
++) = (ptstrJoinBssParam
->beacon_period
) & 0xFF;
1136 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->beacon_period
) >> 8) & 0xFF;
1137 PRINT_D(HOSTINF_DBG
, "* Beacon Period %d*\n", (*(pu8CurrByte
- 2) | ((*(pu8CurrByte
- 1)) << 8)));
1138 *(pu8CurrByte
++) = ptstrJoinBssParam
->dtim_period
;
1139 PRINT_D(HOSTINF_DBG
, "* DTIM Period %d*\n", (*(pu8CurrByte
- 1)));
1141 memcpy(pu8CurrByte
, ptstrJoinBssParam
->supp_rates
, MAX_RATES_SUPPORTED
+ 1);
1142 pu8CurrByte
+= (MAX_RATES_SUPPORTED
+ 1);
1144 *(pu8CurrByte
++) = ptstrJoinBssParam
->wmm_cap
;
1145 PRINT_D(HOSTINF_DBG
, "* wmm cap%d*\n", (*(pu8CurrByte
- 1)));
1146 *(pu8CurrByte
++) = ptstrJoinBssParam
->uapsd_cap
;
1148 *(pu8CurrByte
++) = ptstrJoinBssParam
->ht_capable
;
1149 hif_drv
->strWILC_UsrConnReq
.IsHTCapable
= ptstrJoinBssParam
->ht_capable
;
1151 *(pu8CurrByte
++) = ptstrJoinBssParam
->rsn_found
;
1152 PRINT_D(HOSTINF_DBG
, "* rsn found %d*\n", *(pu8CurrByte
- 1));
1153 *(pu8CurrByte
++) = ptstrJoinBssParam
->rsn_grp_policy
;
1154 PRINT_D(HOSTINF_DBG
, "* rsn group policy %0x*\n", (*(pu8CurrByte
- 1)));
1155 *(pu8CurrByte
++) = ptstrJoinBssParam
->mode_802_11i
;
1156 PRINT_D(HOSTINF_DBG
, "* mode_802_11i %d*\n", (*(pu8CurrByte
- 1)));
1158 memcpy(pu8CurrByte
, ptstrJoinBssParam
->rsn_pcip_policy
, sizeof(ptstrJoinBssParam
->rsn_pcip_policy
));
1159 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->rsn_pcip_policy
);
1161 memcpy(pu8CurrByte
, ptstrJoinBssParam
->rsn_auth_policy
, sizeof(ptstrJoinBssParam
->rsn_auth_policy
));
1162 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->rsn_auth_policy
);
1164 memcpy(pu8CurrByte
, ptstrJoinBssParam
->rsn_cap
, sizeof(ptstrJoinBssParam
->rsn_cap
));
1165 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->rsn_cap
);
1167 *(pu8CurrByte
++) = REAL_JOIN_REQ
;
1168 *(pu8CurrByte
++) = ptstrJoinBssParam
->noa_enabled
;
1170 if (ptstrJoinBssParam
->noa_enabled
) {
1171 PRINT_D(HOSTINF_DBG
, "NOA present\n");
1173 *(pu8CurrByte
++) = (ptstrJoinBssParam
->tsf
) & 0xFF;
1174 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->tsf
) >> 8) & 0xFF;
1175 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->tsf
) >> 16) & 0xFF;
1176 *(pu8CurrByte
++) = ((ptstrJoinBssParam
->tsf
) >> 24) & 0xFF;
1178 *(pu8CurrByte
++) = ptstrJoinBssParam
->opp_enabled
;
1179 *(pu8CurrByte
++) = ptstrJoinBssParam
->idx
;
1181 if (ptstrJoinBssParam
->opp_enabled
)
1182 *(pu8CurrByte
++) = ptstrJoinBssParam
->ct_window
;
1184 *(pu8CurrByte
++) = ptstrJoinBssParam
->cnt
;
1186 memcpy(pu8CurrByte
, ptstrJoinBssParam
->duration
, sizeof(ptstrJoinBssParam
->duration
));
1187 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->duration
);
1189 memcpy(pu8CurrByte
, ptstrJoinBssParam
->interval
, sizeof(ptstrJoinBssParam
->interval
));
1190 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->interval
);
1192 memcpy(pu8CurrByte
, ptstrJoinBssParam
->au8StartTime
, sizeof(ptstrJoinBssParam
->au8StartTime
));
1194 pu8CurrByte
+= sizeof(ptstrJoinBssParam
->au8StartTime
);
1197 PRINT_D(HOSTINF_DBG
, "NOA not present\n");
1199 pu8CurrByte
= strWIDList
[u32WidsCount
].val
;
1201 gu32WidConnRstHack
= 0;
1203 if (memcmp("DIRECT-", pstrHostIFconnectAttr
->ssid
, 7)) {
1204 memcpy(gu8FlushedJoinReq
, pu8CurrByte
, gu32FlushedJoinReqSize
);
1205 gu8FlushedJoinReqDrvHandler
= hif_drv
;
1208 PRINT_D(GENERIC_DBG
, "send HOST_IF_WAITING_CONN_RESP\n");
1210 if (pstrHostIFconnectAttr
->bssid
!= NULL
) {
1211 memcpy(u8ConnectedSSID
, pstrHostIFconnectAttr
->bssid
, ETH_ALEN
);
1213 PRINT_D(GENERIC_DBG
, "save Bssid = %pM\n", pstrHostIFconnectAttr
->bssid
);
1214 PRINT_D(GENERIC_DBG
, "save bssid = %pM\n", u8ConnectedSSID
);
1217 s32Error
= send_config_pkt(SET_CFG
, strWIDList
, u32WidsCount
,
1218 get_id_from_handler(hif_drv
));
1220 PRINT_ER("failed to send config packet\n");
1224 PRINT_D(GENERIC_DBG
, "set HOST_IF_WAITING_CONN_RESP\n");
1225 hif_drv
->enuHostIFstate
= HOST_IF_WAITING_CONN_RESP
;
1230 tstrConnectInfo strConnectInfo
;
1232 del_timer(&hif_drv
->hConnectTimer
);
1234 PRINT_D(HOSTINF_DBG
, "could not start connecting to the required network\n");
1236 memset(&strConnectInfo
, 0, sizeof(tstrConnectInfo
));
1238 if (pstrHostIFconnectAttr
->result
!= NULL
) {
1239 if (pstrHostIFconnectAttr
->bssid
!= NULL
)
1240 memcpy(strConnectInfo
.au8bssid
, pstrHostIFconnectAttr
->bssid
, 6);
1242 if (pstrHostIFconnectAttr
->ies
!= NULL
) {
1243 strConnectInfo
.ReqIEsLen
= pstrHostIFconnectAttr
->ies_len
;
1244 strConnectInfo
.pu8ReqIEs
= kmalloc(pstrHostIFconnectAttr
->ies_len
, GFP_KERNEL
);
1245 memcpy(strConnectInfo
.pu8ReqIEs
,
1246 pstrHostIFconnectAttr
->ies
,
1247 pstrHostIFconnectAttr
->ies_len
);
1250 pstrHostIFconnectAttr
->result(CONN_DISCONN_EVENT_CONN_RESP
,
1254 pstrHostIFconnectAttr
->arg
);
1255 hif_drv
->enuHostIFstate
= HOST_IF_IDLE
;
1256 kfree(strConnectInfo
.pu8ReqIEs
);
1257 strConnectInfo
.pu8ReqIEs
= NULL
;
1260 PRINT_ER("Connect callback function pointer is NULL\n");
1264 PRINT_D(HOSTINF_DBG
, "Deallocating connection parameters\n");
1265 kfree(pstrHostIFconnectAttr
->bssid
);
1266 pstrHostIFconnectAttr
->bssid
= NULL
;
1268 kfree(pstrHostIFconnectAttr
->ssid
);
1269 pstrHostIFconnectAttr
->ssid
= NULL
;
1271 kfree(pstrHostIFconnectAttr
->ies
);
1272 pstrHostIFconnectAttr
->ies
= NULL
;
1278 static s32
Handle_FlushConnect(struct host_if_drv
*hif_drv
)
1281 struct wid strWIDList
[5];
1282 u32 u32WidsCount
= 0;
1283 u8
*pu8CurrByte
= NULL
;
1285 strWIDList
[u32WidsCount
].id
= WID_INFO_ELEMENT_ASSOCIATE
;
1286 strWIDList
[u32WidsCount
].type
= WID_BIN_DATA
;
1287 strWIDList
[u32WidsCount
].val
= gu8FlushedInfoElemAsoc
;
1288 strWIDList
[u32WidsCount
].size
= gu32FlushedInfoElemAsocSize
;
1291 strWIDList
[u32WidsCount
].id
= (u16
)WID_11I_MODE
;
1292 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
1293 strWIDList
[u32WidsCount
].size
= sizeof(char);
1294 strWIDList
[u32WidsCount
].val
= (s8
*)(&(gu8Flushed11iMode
));
1299 strWIDList
[u32WidsCount
].id
= (u16
)WID_AUTH_TYPE
;
1300 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
1301 strWIDList
[u32WidsCount
].size
= sizeof(char);
1302 strWIDList
[u32WidsCount
].val
= (s8
*)(&gu8FlushedAuthType
);
1305 strWIDList
[u32WidsCount
].id
= (u16
)WID_JOIN_REQ_EXTENDED
;
1306 strWIDList
[u32WidsCount
].type
= WID_STR
;
1307 strWIDList
[u32WidsCount
].size
= gu32FlushedJoinReqSize
;
1308 strWIDList
[u32WidsCount
].val
= (s8
*)gu8FlushedJoinReq
;
1309 pu8CurrByte
= strWIDList
[u32WidsCount
].val
;
1311 pu8CurrByte
+= FLUSHED_BYTE_POS
;
1312 *(pu8CurrByte
) = FLUSHED_JOIN_REQ
;
1316 s32Error
= send_config_pkt(SET_CFG
, strWIDList
, u32WidsCount
,
1317 get_id_from_handler(gu8FlushedJoinReqDrvHandler
));
1319 PRINT_ER("failed to send config packet\n");
1326 static s32
Handle_ConnectTimeout(struct host_if_drv
*hif_drv
)
1329 tstrConnectInfo strConnectInfo
;
1331 u16 u16DummyReasonCode
= 0;
1334 PRINT_ER("Driver handler is NULL\n");
1338 hif_drv
->enuHostIFstate
= HOST_IF_IDLE
;
1340 gbScanWhileConnected
= false;
1343 memset(&strConnectInfo
, 0, sizeof(tstrConnectInfo
));
1345 if (hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult
!= NULL
) {
1346 if (hif_drv
->strWILC_UsrConnReq
.pu8bssid
!= NULL
) {
1347 memcpy(strConnectInfo
.au8bssid
,
1348 hif_drv
->strWILC_UsrConnReq
.pu8bssid
, 6);
1351 if (hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
!= NULL
) {
1352 strConnectInfo
.ReqIEsLen
= hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
;
1353 strConnectInfo
.pu8ReqIEs
= kmalloc(hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
, GFP_KERNEL
);
1354 memcpy(strConnectInfo
.pu8ReqIEs
,
1355 hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
,
1356 hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
);
1359 hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP
,
1363 hif_drv
->strWILC_UsrConnReq
.u32UserConnectPvoid
);
1365 kfree(strConnectInfo
.pu8ReqIEs
);
1366 strConnectInfo
.pu8ReqIEs
= NULL
;
1368 PRINT_ER("Connect callback function pointer is NULL\n");
1371 strWID
.id
= (u16
)WID_DISCONNECT
;
1372 strWID
.type
= WID_CHAR
;
1373 strWID
.val
= (s8
*)&u16DummyReasonCode
;
1374 strWID
.size
= sizeof(char);
1376 PRINT_D(HOSTINF_DBG
, "Sending disconnect request\n");
1378 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
1379 get_id_from_handler(hif_drv
));
1381 PRINT_ER("Failed to send dissconect config packet\n");
1383 hif_drv
->strWILC_UsrConnReq
.ssidLen
= 0;
1384 kfree(hif_drv
->strWILC_UsrConnReq
.pu8ssid
);
1385 kfree(hif_drv
->strWILC_UsrConnReq
.pu8bssid
);
1386 hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
= 0;
1387 kfree(hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
);
1389 eth_zero_addr(u8ConnectedSSID
);
1391 if (gu8FlushedJoinReq
!= NULL
&& gu8FlushedJoinReqDrvHandler
== hif_drv
) {
1392 kfree(gu8FlushedJoinReq
);
1393 gu8FlushedJoinReq
= NULL
;
1395 if (gu8FlushedInfoElemAsoc
!= NULL
&& gu8FlushedJoinReqDrvHandler
== hif_drv
) {
1396 kfree(gu8FlushedInfoElemAsoc
);
1397 gu8FlushedInfoElemAsoc
= NULL
;
1403 static s32
Handle_RcvdNtwrkInfo(struct host_if_drv
*hif_drv
,
1404 struct rcvd_net_info
*pstrRcvdNetworkInfo
)
1407 bool bNewNtwrkFound
;
1412 tstrNetworkInfo
*pstrNetworkInfo
= NULL
;
1413 void *pJoinParams
= NULL
;
1415 bNewNtwrkFound
= true;
1416 PRINT_INFO(HOSTINF_DBG
, "Handling received network info\n");
1418 if (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
) {
1419 PRINT_D(HOSTINF_DBG
, "State: Scanning, parsing network information received\n");
1420 parse_network_info(pstrRcvdNetworkInfo
->buffer
, &pstrNetworkInfo
);
1421 if ((pstrNetworkInfo
== NULL
)
1422 || (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
== NULL
)) {
1423 PRINT_ER("driver is null\n");
1428 for (i
= 0; i
< hif_drv
->strWILC_UsrScanReq
.u32RcvdChCount
; i
++) {
1430 if ((hif_drv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[i
].au8bssid
!= NULL
) &&
1431 (pstrNetworkInfo
->au8bssid
!= NULL
)) {
1432 if (memcmp(hif_drv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[i
].au8bssid
,
1433 pstrNetworkInfo
->au8bssid
, 6) == 0) {
1434 if (pstrNetworkInfo
->s8rssi
<= hif_drv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[i
].s8rssi
) {
1435 PRINT_D(HOSTINF_DBG
, "Network previously discovered\n");
1438 hif_drv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[i
].s8rssi
= pstrNetworkInfo
->s8rssi
;
1439 bNewNtwrkFound
= false;
1446 if (bNewNtwrkFound
== true) {
1447 PRINT_D(HOSTINF_DBG
, "New network found\n");
1449 if (hif_drv
->strWILC_UsrScanReq
.u32RcvdChCount
< MAX_NUM_SCANNED_NETWORKS
) {
1450 hif_drv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[hif_drv
->strWILC_UsrScanReq
.u32RcvdChCount
].s8rssi
= pstrNetworkInfo
->s8rssi
;
1452 if ((hif_drv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[hif_drv
->strWILC_UsrScanReq
.u32RcvdChCount
].au8bssid
!= NULL
)
1453 && (pstrNetworkInfo
->au8bssid
!= NULL
)) {
1454 memcpy(hif_drv
->strWILC_UsrScanReq
.astrFoundNetworkInfo
[hif_drv
->strWILC_UsrScanReq
.u32RcvdChCount
].au8bssid
,
1455 pstrNetworkInfo
->au8bssid
, 6);
1457 hif_drv
->strWILC_UsrScanReq
.u32RcvdChCount
++;
1459 pstrNetworkInfo
->bNewNetwork
= true;
1460 pJoinParams
= host_int_ParseJoinBssParam(pstrNetworkInfo
);
1462 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND
, pstrNetworkInfo
,
1463 hif_drv
->strWILC_UsrScanReq
.u32UserScanPvoid
,
1469 PRINT_WRN(HOSTINF_DBG
, "Discovered networks exceeded max. limit\n");
1472 pstrNetworkInfo
->bNewNetwork
= false;
1473 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND
, pstrNetworkInfo
,
1474 hif_drv
->strWILC_UsrScanReq
.u32UserScanPvoid
, NULL
);
1479 kfree(pstrRcvdNetworkInfo
->buffer
);
1480 pstrRcvdNetworkInfo
->buffer
= NULL
;
1482 if (pstrNetworkInfo
!= NULL
) {
1483 DeallocateNetworkInfo(pstrNetworkInfo
);
1484 pstrNetworkInfo
= NULL
;
1490 static s32
Handle_RcvdGnrlAsyncInfo(struct host_if_drv
*hif_drv
,
1491 struct rcvd_async_info
*pstrRcvdGnrlAsyncInfo
)
1497 u16 u16WidID
= (u16
)WID_NIL
;
1500 u8 u8MacStatusReasonCode
;
1501 u8 u8MacStatusAdditionalInfo
;
1502 tstrConnectInfo strConnectInfo
;
1503 tstrDisconnectNotifInfo strDisconnectNotifInfo
;
1507 PRINT_ER("Driver handler is NULL\n");
1510 PRINT_D(GENERIC_DBG
, "Current State = %d,Received state = %d\n", hif_drv
->enuHostIFstate
,
1511 pstrRcvdGnrlAsyncInfo
->buffer
[7]);
1513 if ((hif_drv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) ||
1514 (hif_drv
->enuHostIFstate
== HOST_IF_CONNECTED
) ||
1515 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
) {
1516 if ((pstrRcvdGnrlAsyncInfo
->buffer
== NULL
) ||
1517 (hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult
== NULL
)) {
1518 PRINT_ER("driver is null\n");
1522 u8MsgType
= pstrRcvdGnrlAsyncInfo
->buffer
[0];
1524 if ('I' != u8MsgType
) {
1525 PRINT_ER("Received Message format incorrect.\n");
1529 u8MsgID
= pstrRcvdGnrlAsyncInfo
->buffer
[1];
1530 u16MsgLen
= MAKE_WORD16(pstrRcvdGnrlAsyncInfo
->buffer
[2], pstrRcvdGnrlAsyncInfo
->buffer
[3]);
1531 u16WidID
= MAKE_WORD16(pstrRcvdGnrlAsyncInfo
->buffer
[4], pstrRcvdGnrlAsyncInfo
->buffer
[5]);
1532 u8WidLen
= pstrRcvdGnrlAsyncInfo
->buffer
[6];
1533 u8MacStatus
= pstrRcvdGnrlAsyncInfo
->buffer
[7];
1534 u8MacStatusReasonCode
= pstrRcvdGnrlAsyncInfo
->buffer
[8];
1535 u8MacStatusAdditionalInfo
= pstrRcvdGnrlAsyncInfo
->buffer
[9];
1536 PRINT_INFO(HOSTINF_DBG
, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus
, u8MacStatusReasonCode
, u8MacStatusAdditionalInfo
);
1537 if (hif_drv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) {
1538 u32 u32RcvdAssocRespInfoLen
;
1539 tstrConnectRespInfo
*pstrConnectRespInfo
= NULL
;
1541 PRINT_D(HOSTINF_DBG
, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus
, u8MacStatusReasonCode
, u8MacStatusAdditionalInfo
);
1543 memset(&strConnectInfo
, 0, sizeof(tstrConnectInfo
));
1545 if (u8MacStatus
== MAC_CONNECTED
) {
1546 memset(gapu8RcvdAssocResp
, 0, MAX_ASSOC_RESP_FRAME_SIZE
);
1548 host_int_get_assoc_res_info(hif_drv
,
1550 MAX_ASSOC_RESP_FRAME_SIZE
,
1551 &u32RcvdAssocRespInfoLen
);
1553 PRINT_INFO(HOSTINF_DBG
, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen
);
1555 if (u32RcvdAssocRespInfoLen
!= 0) {
1557 PRINT_D(HOSTINF_DBG
, "Parsing association response\n");
1558 s32Err
= ParseAssocRespInfo(gapu8RcvdAssocResp
, u32RcvdAssocRespInfoLen
,
1559 &pstrConnectRespInfo
);
1561 PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err
);
1563 strConnectInfo
.u16ConnectStatus
= pstrConnectRespInfo
->u16ConnectStatus
;
1565 if (strConnectInfo
.u16ConnectStatus
== SUCCESSFUL_STATUSCODE
) {
1566 PRINT_INFO(HOSTINF_DBG
, "Association response received : Successful connection status\n");
1567 if (pstrConnectRespInfo
->pu8RespIEs
!= NULL
) {
1568 strConnectInfo
.u16RespIEsLen
= pstrConnectRespInfo
->u16RespIEsLen
;
1571 strConnectInfo
.pu8RespIEs
= kmalloc(pstrConnectRespInfo
->u16RespIEsLen
, GFP_KERNEL
);
1572 memcpy(strConnectInfo
.pu8RespIEs
, pstrConnectRespInfo
->pu8RespIEs
,
1573 pstrConnectRespInfo
->u16RespIEsLen
);
1577 if (pstrConnectRespInfo
!= NULL
) {
1578 DeallocateAssocRespInfo(pstrConnectRespInfo
);
1579 pstrConnectRespInfo
= NULL
;
1585 if ((u8MacStatus
== MAC_CONNECTED
) &&
1586 (strConnectInfo
.u16ConnectStatus
!= SUCCESSFUL_STATUSCODE
)) {
1587 PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n");
1588 eth_zero_addr(u8ConnectedSSID
);
1590 } else if (u8MacStatus
== MAC_DISCONNECTED
) {
1591 PRINT_ER("Received MAC status is MAC_DISCONNECTED\n");
1592 eth_zero_addr(u8ConnectedSSID
);
1595 if (hif_drv
->strWILC_UsrConnReq
.pu8bssid
!= NULL
) {
1596 PRINT_D(HOSTINF_DBG
, "Retrieving actual BSSID from AP\n");
1597 memcpy(strConnectInfo
.au8bssid
, hif_drv
->strWILC_UsrConnReq
.pu8bssid
, 6);
1599 if ((u8MacStatus
== MAC_CONNECTED
) &&
1600 (strConnectInfo
.u16ConnectStatus
== SUCCESSFUL_STATUSCODE
)) {
1601 memcpy(hif_drv
->au8AssociatedBSSID
,
1602 hif_drv
->strWILC_UsrConnReq
.pu8bssid
, ETH_ALEN
);
1607 if (hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
!= NULL
) {
1608 strConnectInfo
.ReqIEsLen
= hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
;
1609 strConnectInfo
.pu8ReqIEs
= kmalloc(hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
, GFP_KERNEL
);
1610 memcpy(strConnectInfo
.pu8ReqIEs
,
1611 hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
,
1612 hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
);
1616 del_timer(&hif_drv
->hConnectTimer
);
1617 hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP
,
1621 hif_drv
->strWILC_UsrConnReq
.u32UserConnectPvoid
);
1623 if ((u8MacStatus
== MAC_CONNECTED
) &&
1624 (strConnectInfo
.u16ConnectStatus
== SUCCESSFUL_STATUSCODE
)) {
1625 host_int_set_power_mgmt(hif_drv
, 0, 0);
1627 PRINT_D(HOSTINF_DBG
, "MAC status : CONNECTED and Connect Status : Successful\n");
1628 hif_drv
->enuHostIFstate
= HOST_IF_CONNECTED
;
1630 PRINT_D(GENERIC_DBG
, "Obtaining an IP, Disable Scan\n");
1631 g_obtainingIP
= true;
1632 mod_timer(&hDuringIpTimer
,
1633 jiffies
+ msecs_to_jiffies(10000));
1635 PRINT_D(HOSTINF_DBG
, "MAC status : %d and Connect Status : %d\n", u8MacStatus
, strConnectInfo
.u16ConnectStatus
);
1636 hif_drv
->enuHostIFstate
= HOST_IF_IDLE
;
1637 gbScanWhileConnected
= false;
1640 kfree(strConnectInfo
.pu8RespIEs
);
1641 strConnectInfo
.pu8RespIEs
= NULL
;
1643 kfree(strConnectInfo
.pu8ReqIEs
);
1644 strConnectInfo
.pu8ReqIEs
= NULL
;
1645 hif_drv
->strWILC_UsrConnReq
.ssidLen
= 0;
1646 kfree(hif_drv
->strWILC_UsrConnReq
.pu8ssid
);
1647 kfree(hif_drv
->strWILC_UsrConnReq
.pu8bssid
);
1648 hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
= 0;
1649 kfree(hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
);
1650 } else if ((u8MacStatus
== MAC_DISCONNECTED
) &&
1651 (hif_drv
->enuHostIFstate
== HOST_IF_CONNECTED
)) {
1652 PRINT_D(HOSTINF_DBG
, "Received MAC_DISCONNECTED from the FW\n");
1654 memset(&strDisconnectNotifInfo
, 0, sizeof(tstrDisconnectNotifInfo
));
1656 if (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
) {
1657 PRINT_D(HOSTINF_DBG
, "\n\n<< Abort the running OBSS Scan >>\n\n");
1658 del_timer(&hif_drv
->hScanTimer
);
1659 Handle_ScanDone((void *)hif_drv
, SCAN_EVENT_ABORTED
);
1662 strDisconnectNotifInfo
.u16reason
= 0;
1663 strDisconnectNotifInfo
.ie
= NULL
;
1664 strDisconnectNotifInfo
.ie_len
= 0;
1666 if (hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult
!= NULL
) {
1667 g_obtainingIP
= false;
1668 host_int_set_power_mgmt(hif_drv
, 0, 0);
1670 hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF
,
1673 &strDisconnectNotifInfo
,
1674 hif_drv
->strWILC_UsrConnReq
.u32UserConnectPvoid
);
1677 PRINT_ER("Connect result callback function is NULL\n");
1680 eth_zero_addr(hif_drv
->au8AssociatedBSSID
);
1682 hif_drv
->strWILC_UsrConnReq
.ssidLen
= 0;
1683 kfree(hif_drv
->strWILC_UsrConnReq
.pu8ssid
);
1684 kfree(hif_drv
->strWILC_UsrConnReq
.pu8bssid
);
1685 hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
= 0;
1686 kfree(hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
);
1688 if (gu8FlushedJoinReq
!= NULL
&& gu8FlushedJoinReqDrvHandler
== hif_drv
) {
1689 kfree(gu8FlushedJoinReq
);
1690 gu8FlushedJoinReq
= NULL
;
1692 if (gu8FlushedInfoElemAsoc
!= NULL
&& gu8FlushedJoinReqDrvHandler
== hif_drv
) {
1693 kfree(gu8FlushedInfoElemAsoc
);
1694 gu8FlushedInfoElemAsoc
= NULL
;
1697 hif_drv
->enuHostIFstate
= HOST_IF_IDLE
;
1698 gbScanWhileConnected
= false;
1700 } else if ((u8MacStatus
== MAC_DISCONNECTED
) &&
1701 (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
!= NULL
)) {
1702 PRINT_D(HOSTINF_DBG
, "Received MAC_DISCONNECTED from the FW while scanning\n");
1703 PRINT_D(HOSTINF_DBG
, "\n\n<< Abort the running Scan >>\n\n");
1705 del_timer(&hif_drv
->hScanTimer
);
1706 if (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
)
1707 Handle_ScanDone(hif_drv
, SCAN_EVENT_ABORTED
);
1713 kfree(pstrRcvdGnrlAsyncInfo
->buffer
);
1714 pstrRcvdGnrlAsyncInfo
->buffer
= NULL
;
1719 static int Handle_Key(struct host_if_drv
*hif_drv
,
1720 struct key_attr
*pstrHostIFkeyAttr
)
1724 struct wid strWIDList
[5];
1730 switch (pstrHostIFkeyAttr
->type
) {
1735 if (pstrHostIFkeyAttr
->action
& ADDKEY_AP
) {
1737 PRINT_D(HOSTINF_DBG
, "Handling WEP key\n");
1738 PRINT_D(GENERIC_DBG
, "ID Hostint is %d\n", (pstrHostIFkeyAttr
->attr
.wep
.index
));
1739 strWIDList
[0].id
= (u16
)WID_11I_MODE
;
1740 strWIDList
[0].type
= WID_CHAR
;
1741 strWIDList
[0].size
= sizeof(char);
1742 strWIDList
[0].val
= (s8
*)(&(pstrHostIFkeyAttr
->attr
.wep
.mode
));
1744 strWIDList
[1].id
= WID_AUTH_TYPE
;
1745 strWIDList
[1].type
= WID_CHAR
;
1746 strWIDList
[1].size
= sizeof(char);
1747 strWIDList
[1].val
= (s8
*)(&(pstrHostIFkeyAttr
->attr
.wep
.auth_type
));
1749 strWIDList
[2].id
= (u16
)WID_KEY_ID
;
1750 strWIDList
[2].type
= WID_CHAR
;
1752 strWIDList
[2].val
= (s8
*)(&(pstrHostIFkeyAttr
->attr
.wep
.index
));
1753 strWIDList
[2].size
= sizeof(char);
1755 pu8keybuf
= kmalloc(pstrHostIFkeyAttr
->attr
.wep
.key_len
, GFP_KERNEL
);
1757 if (pu8keybuf
== NULL
) {
1758 PRINT_ER("No buffer to send Key\n");
1762 memcpy(pu8keybuf
, pstrHostIFkeyAttr
->attr
.wep
.key
,
1763 pstrHostIFkeyAttr
->attr
.wep
.key_len
);
1765 kfree(pstrHostIFkeyAttr
->attr
.wep
.key
);
1767 strWIDList
[3].id
= (u16
)WID_WEP_KEY_VALUE
;
1768 strWIDList
[3].type
= WID_STR
;
1769 strWIDList
[3].size
= pstrHostIFkeyAttr
->attr
.wep
.key_len
;
1770 strWIDList
[3].val
= (s8
*)pu8keybuf
;
1773 s32Error
= send_config_pkt(SET_CFG
, strWIDList
, 4,
1774 get_id_from_handler(hif_drv
));
1780 if (pstrHostIFkeyAttr
->action
& ADDKEY
) {
1781 PRINT_D(HOSTINF_DBG
, "Handling WEP key\n");
1782 pu8keybuf
= kmalloc(pstrHostIFkeyAttr
->attr
.wep
.key_len
+ 2, GFP_KERNEL
);
1783 if (pu8keybuf
== NULL
) {
1784 PRINT_ER("No buffer to send Key\n");
1787 pu8keybuf
[0] = pstrHostIFkeyAttr
->attr
.wep
.index
;
1788 memcpy(pu8keybuf
+ 1, &pstrHostIFkeyAttr
->attr
.wep
.key_len
, 1);
1789 memcpy(pu8keybuf
+ 2, pstrHostIFkeyAttr
->attr
.wep
.key
,
1790 pstrHostIFkeyAttr
->attr
.wep
.key_len
);
1791 kfree(pstrHostIFkeyAttr
->attr
.wep
.key
);
1793 strWID
.id
= (u16
)WID_ADD_WEP_KEY
;
1794 strWID
.type
= WID_STR
;
1795 strWID
.val
= (s8
*)pu8keybuf
;
1796 strWID
.size
= pstrHostIFkeyAttr
->attr
.wep
.key_len
+ 2;
1798 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
1799 get_id_from_handler(hif_drv
));
1801 } else if (pstrHostIFkeyAttr
->action
& REMOVEKEY
) {
1803 PRINT_D(HOSTINF_DBG
, "Removing key\n");
1804 strWID
.id
= (u16
)WID_REMOVE_WEP_KEY
;
1805 strWID
.type
= WID_STR
;
1807 s8idxarray
[0] = (s8
)pstrHostIFkeyAttr
->attr
.wep
.index
;
1808 strWID
.val
= s8idxarray
;
1811 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
1812 get_id_from_handler(hif_drv
));
1814 strWID
.id
= (u16
)WID_KEY_ID
;
1815 strWID
.type
= WID_CHAR
;
1816 strWID
.val
= (s8
*)(&(pstrHostIFkeyAttr
->attr
.wep
.index
));
1817 strWID
.size
= sizeof(char);
1819 PRINT_D(HOSTINF_DBG
, "Setting default key index\n");
1821 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
1822 get_id_from_handler(hif_drv
));
1824 up(&hif_drv
->hSemTestKeyBlock
);
1828 if (pstrHostIFkeyAttr
->action
& ADDKEY_AP
) {
1829 pu8keybuf
= kzalloc(RX_MIC_KEY_MSG_LEN
, GFP_KERNEL
);
1830 if (pu8keybuf
== NULL
) {
1831 PRINT_ER("No buffer to send RxGTK Key\n");
1833 goto _WPARxGtk_end_case_
;
1836 if (pstrHostIFkeyAttr
->attr
.wpa
.seq
!= NULL
)
1837 memcpy(pu8keybuf
+ 6, pstrHostIFkeyAttr
->attr
.wpa
.seq
, 8);
1839 memcpy(pu8keybuf
+ 14, &pstrHostIFkeyAttr
->attr
.wpa
.index
, 1);
1840 memcpy(pu8keybuf
+ 15, &pstrHostIFkeyAttr
->attr
.wpa
.key_len
, 1);
1841 memcpy(pu8keybuf
+ 16, pstrHostIFkeyAttr
->attr
.wpa
.key
,
1842 pstrHostIFkeyAttr
->attr
.wpa
.key_len
);
1844 strWIDList
[0].id
= (u16
)WID_11I_MODE
;
1845 strWIDList
[0].type
= WID_CHAR
;
1846 strWIDList
[0].size
= sizeof(char);
1847 strWIDList
[0].val
= (s8
*)(&(pstrHostIFkeyAttr
->attr
.wpa
.mode
));
1849 strWIDList
[1].id
= (u16
)WID_ADD_RX_GTK
;
1850 strWIDList
[1].type
= WID_STR
;
1851 strWIDList
[1].val
= (s8
*)pu8keybuf
;
1852 strWIDList
[1].size
= RX_MIC_KEY_MSG_LEN
;
1854 s32Error
= send_config_pkt(SET_CFG
, strWIDList
, 2,
1855 get_id_from_handler(hif_drv
));
1858 up(&hif_drv
->hSemTestKeyBlock
);
1861 if (pstrHostIFkeyAttr
->action
& ADDKEY
) {
1862 PRINT_D(HOSTINF_DBG
, "Handling group key(Rx) function\n");
1864 pu8keybuf
= kzalloc(RX_MIC_KEY_MSG_LEN
, GFP_KERNEL
);
1865 if (pu8keybuf
== NULL
) {
1866 PRINT_ER("No buffer to send RxGTK Key\n");
1868 goto _WPARxGtk_end_case_
;
1871 if (hif_drv
->enuHostIFstate
== HOST_IF_CONNECTED
)
1872 memcpy(pu8keybuf
, hif_drv
->au8AssociatedBSSID
, ETH_ALEN
);
1874 PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n");
1876 memcpy(pu8keybuf
+ 6, pstrHostIFkeyAttr
->attr
.wpa
.seq
, 8);
1877 memcpy(pu8keybuf
+ 14, &pstrHostIFkeyAttr
->attr
.wpa
.index
, 1);
1878 memcpy(pu8keybuf
+ 15, &pstrHostIFkeyAttr
->attr
.wpa
.key_len
, 1);
1879 memcpy(pu8keybuf
+ 16, pstrHostIFkeyAttr
->attr
.wpa
.key
,
1880 pstrHostIFkeyAttr
->attr
.wpa
.key_len
);
1882 strWID
.id
= (u16
)WID_ADD_RX_GTK
;
1883 strWID
.type
= WID_STR
;
1884 strWID
.val
= (s8
*)pu8keybuf
;
1885 strWID
.size
= RX_MIC_KEY_MSG_LEN
;
1887 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
1888 get_id_from_handler(hif_drv
));
1891 up(&hif_drv
->hSemTestKeyBlock
);
1893 _WPARxGtk_end_case_
:
1894 kfree(pstrHostIFkeyAttr
->attr
.wpa
.key
);
1895 kfree(pstrHostIFkeyAttr
->attr
.wpa
.seq
);
1902 if (pstrHostIFkeyAttr
->action
& ADDKEY_AP
) {
1905 pu8keybuf
= kmalloc(PTK_KEY_MSG_LEN
+ 1, GFP_KERNEL
);
1909 if (pu8keybuf
== NULL
) {
1910 PRINT_ER("No buffer to send PTK Key\n");
1912 goto _WPAPtk_end_case_
;
1916 memcpy(pu8keybuf
, pstrHostIFkeyAttr
->attr
.wpa
.mac_addr
, 6);
1917 memcpy(pu8keybuf
+ 6, &pstrHostIFkeyAttr
->attr
.wpa
.index
, 1);
1918 memcpy(pu8keybuf
+ 7, &pstrHostIFkeyAttr
->attr
.wpa
.key_len
, 1);
1919 memcpy(pu8keybuf
+ 8, pstrHostIFkeyAttr
->attr
.wpa
.key
,
1920 pstrHostIFkeyAttr
->attr
.wpa
.key_len
);
1922 strWIDList
[0].id
= (u16
)WID_11I_MODE
;
1923 strWIDList
[0].type
= WID_CHAR
;
1924 strWIDList
[0].size
= sizeof(char);
1925 strWIDList
[0].val
= (s8
*)(&(pstrHostIFkeyAttr
->attr
.wpa
.mode
));
1927 strWIDList
[1].id
= (u16
)WID_ADD_PTK
;
1928 strWIDList
[1].type
= WID_STR
;
1929 strWIDList
[1].val
= (s8
*)pu8keybuf
;
1930 strWIDList
[1].size
= PTK_KEY_MSG_LEN
+ 1;
1932 s32Error
= send_config_pkt(SET_CFG
, strWIDList
, 2,
1933 get_id_from_handler(hif_drv
));
1935 up(&hif_drv
->hSemTestKeyBlock
);
1937 if (pstrHostIFkeyAttr
->action
& ADDKEY
) {
1940 pu8keybuf
= kmalloc(PTK_KEY_MSG_LEN
, GFP_KERNEL
);
1944 if (pu8keybuf
== NULL
) {
1945 PRINT_ER("No buffer to send PTK Key\n");
1947 goto _WPAPtk_end_case_
;
1951 memcpy(pu8keybuf
, pstrHostIFkeyAttr
->attr
.wpa
.mac_addr
, 6);
1952 memcpy(pu8keybuf
+ 6, &pstrHostIFkeyAttr
->attr
.wpa
.key_len
, 1);
1953 memcpy(pu8keybuf
+ 7, pstrHostIFkeyAttr
->attr
.wpa
.key
,
1954 pstrHostIFkeyAttr
->attr
.wpa
.key_len
);
1956 strWID
.id
= (u16
)WID_ADD_PTK
;
1957 strWID
.type
= WID_STR
;
1958 strWID
.val
= (s8
*)pu8keybuf
;
1959 strWID
.size
= PTK_KEY_MSG_LEN
;
1961 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
1962 get_id_from_handler(hif_drv
));
1964 up(&hif_drv
->hSemTestKeyBlock
);
1968 kfree(pstrHostIFkeyAttr
->attr
.wpa
.key
);
1977 PRINT_D(HOSTINF_DBG
, "Handling PMKSA key\n");
1979 pu8keybuf
= kmalloc((pstrHostIFkeyAttr
->attr
.pmkid
.numpmkid
* PMKSA_KEY_LEN
) + 1, GFP_KERNEL
);
1980 if (pu8keybuf
== NULL
) {
1981 PRINT_ER("No buffer to send PMKSA Key\n");
1985 pu8keybuf
[0] = pstrHostIFkeyAttr
->attr
.pmkid
.numpmkid
;
1987 for (i
= 0; i
< pstrHostIFkeyAttr
->attr
.pmkid
.numpmkid
; i
++) {
1988 memcpy(pu8keybuf
+ ((PMKSA_KEY_LEN
* i
) + 1), pstrHostIFkeyAttr
->attr
.pmkid
.pmkidlist
[i
].bssid
, ETH_ALEN
);
1989 memcpy(pu8keybuf
+ ((PMKSA_KEY_LEN
* i
) + ETH_ALEN
+ 1), pstrHostIFkeyAttr
->attr
.pmkid
.pmkidlist
[i
].pmkid
, PMKID_LEN
);
1992 strWID
.id
= (u16
)WID_PMKID_INFO
;
1993 strWID
.type
= WID_STR
;
1994 strWID
.val
= (s8
*)pu8keybuf
;
1995 strWID
.size
= (pstrHostIFkeyAttr
->attr
.pmkid
.numpmkid
* PMKSA_KEY_LEN
) + 1;
1997 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
1998 get_id_from_handler(hif_drv
));
2005 PRINT_ER("Failed to send key config packet\n");
2011 static void Handle_Disconnect(struct host_if_drv
*hif_drv
)
2016 u16 u16DummyReasonCode
= 0;
2018 strWID
.id
= (u16
)WID_DISCONNECT
;
2019 strWID
.type
= WID_CHAR
;
2020 strWID
.val
= (s8
*)&u16DummyReasonCode
;
2021 strWID
.size
= sizeof(char);
2025 PRINT_D(HOSTINF_DBG
, "Sending disconnect request\n");
2027 g_obtainingIP
= false;
2028 host_int_set_power_mgmt(hif_drv
, 0, 0);
2030 eth_zero_addr(u8ConnectedSSID
);
2032 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2033 get_id_from_handler(hif_drv
));
2036 PRINT_ER("Failed to send dissconect config packet\n");
2038 tstrDisconnectNotifInfo strDisconnectNotifInfo
;
2040 memset(&strDisconnectNotifInfo
, 0, sizeof(tstrDisconnectNotifInfo
));
2042 strDisconnectNotifInfo
.u16reason
= 0;
2043 strDisconnectNotifInfo
.ie
= NULL
;
2044 strDisconnectNotifInfo
.ie_len
= 0;
2046 if (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
) {
2047 del_timer(&hif_drv
->hScanTimer
);
2048 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult(SCAN_EVENT_ABORTED
, NULL
,
2049 hif_drv
->strWILC_UsrScanReq
.u32UserScanPvoid
, NULL
);
2051 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
= NULL
;
2054 if (hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult
!= NULL
) {
2055 if (hif_drv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) {
2056 PRINT_D(HOSTINF_DBG
, "Upper layer requested termination of connection\n");
2057 del_timer(&hif_drv
->hConnectTimer
);
2060 hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF
, NULL
,
2061 0, &strDisconnectNotifInfo
, hif_drv
->strWILC_UsrConnReq
.u32UserConnectPvoid
);
2063 PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n");
2066 gbScanWhileConnected
= false;
2068 hif_drv
->enuHostIFstate
= HOST_IF_IDLE
;
2070 eth_zero_addr(hif_drv
->au8AssociatedBSSID
);
2072 hif_drv
->strWILC_UsrConnReq
.ssidLen
= 0;
2073 kfree(hif_drv
->strWILC_UsrConnReq
.pu8ssid
);
2074 kfree(hif_drv
->strWILC_UsrConnReq
.pu8bssid
);
2075 hif_drv
->strWILC_UsrConnReq
.ConnReqIEsLen
= 0;
2076 kfree(hif_drv
->strWILC_UsrConnReq
.pu8ConnReqIEs
);
2078 if (gu8FlushedJoinReq
!= NULL
&& gu8FlushedJoinReqDrvHandler
== hif_drv
) {
2079 kfree(gu8FlushedJoinReq
);
2080 gu8FlushedJoinReq
= NULL
;
2082 if (gu8FlushedInfoElemAsoc
!= NULL
&& gu8FlushedJoinReqDrvHandler
== hif_drv
) {
2083 kfree(gu8FlushedInfoElemAsoc
);
2084 gu8FlushedInfoElemAsoc
= NULL
;
2089 up(&hif_drv
->hSemTestDisconnectBlock
);
2093 void resolve_disconnect_aberration(struct host_if_drv
*hif_drv
)
2097 if ((hif_drv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) || (hif_drv
->enuHostIFstate
== HOST_IF_CONNECTING
)) {
2098 PRINT_D(HOSTINF_DBG
, "\n\n<< correcting Supplicant state machine >>\n\n");
2099 host_int_disconnect(hif_drv
, 1);
2103 static s32
Handle_GetChnl(struct host_if_drv
*hif_drv
)
2109 strWID
.id
= (u16
)WID_CURRENT_CHANNEL
;
2110 strWID
.type
= WID_CHAR
;
2111 strWID
.val
= (s8
*)&gu8Chnl
;
2112 strWID
.size
= sizeof(char);
2114 PRINT_D(HOSTINF_DBG
, "Getting channel value\n");
2116 s32Error
= send_config_pkt(GET_CFG
, &strWID
, 1,
2117 get_id_from_handler(hif_drv
));
2120 PRINT_ER("Failed to get channel number\n");
2124 up(&hif_drv
->hSemGetCHNL
);
2132 static void Handle_GetRssi(struct host_if_drv
*hif_drv
)
2137 strWID
.id
= (u16
)WID_RSSI
;
2138 strWID
.type
= WID_CHAR
;
2139 strWID
.val
= &gs8Rssi
;
2140 strWID
.size
= sizeof(char);
2142 PRINT_D(HOSTINF_DBG
, "Getting RSSI value\n");
2144 s32Error
= send_config_pkt(GET_CFG
, &strWID
, 1,
2145 get_id_from_handler(hif_drv
));
2147 PRINT_ER("Failed to get RSSI value\n");
2151 up(&hif_drv
->hSemGetRSSI
);
2157 static void Handle_GetLinkspeed(struct host_if_drv
*hif_drv
)
2164 strWID
.id
= (u16
)WID_LINKSPEED
;
2165 strWID
.type
= WID_CHAR
;
2166 strWID
.val
= &gs8lnkspd
;
2167 strWID
.size
= sizeof(char);
2169 PRINT_D(HOSTINF_DBG
, "Getting LINKSPEED value\n");
2171 s32Error
= send_config_pkt(GET_CFG
, &strWID
, 1,
2172 get_id_from_handler(hif_drv
));
2174 PRINT_ER("Failed to get LINKSPEED value\n");
2178 up(&(hif_drv
->hSemGetLINKSPEED
));
2183 s32
Handle_GetStatistics(struct host_if_drv
*hif_drv
, struct rf_info
*pstrStatistics
)
2185 struct wid strWIDList
[5];
2186 u32 u32WidsCount
= 0, s32Error
= 0;
2188 strWIDList
[u32WidsCount
].id
= WID_LINKSPEED
;
2189 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
2190 strWIDList
[u32WidsCount
].size
= sizeof(char);
2191 strWIDList
[u32WidsCount
].val
= (s8
*)(&(pstrStatistics
->u8LinkSpeed
));
2194 strWIDList
[u32WidsCount
].id
= WID_RSSI
;
2195 strWIDList
[u32WidsCount
].type
= WID_CHAR
;
2196 strWIDList
[u32WidsCount
].size
= sizeof(char);
2197 strWIDList
[u32WidsCount
].val
= (s8
*)(&(pstrStatistics
->s8RSSI
));
2200 strWIDList
[u32WidsCount
].id
= WID_SUCCESS_FRAME_COUNT
;
2201 strWIDList
[u32WidsCount
].type
= WID_INT
;
2202 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
2203 strWIDList
[u32WidsCount
].val
= (s8
*)(&(pstrStatistics
->u32TxCount
));
2206 strWIDList
[u32WidsCount
].id
= WID_RECEIVED_FRAGMENT_COUNT
;
2207 strWIDList
[u32WidsCount
].type
= WID_INT
;
2208 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
2209 strWIDList
[u32WidsCount
].val
= (s8
*)(&(pstrStatistics
->u32RxCount
));
2212 strWIDList
[u32WidsCount
].id
= WID_FAILED_COUNT
;
2213 strWIDList
[u32WidsCount
].type
= WID_INT
;
2214 strWIDList
[u32WidsCount
].size
= sizeof(u32
);
2215 strWIDList
[u32WidsCount
].val
= (s8
*)(&(pstrStatistics
->u32TxFailureCount
));
2218 s32Error
= send_config_pkt(GET_CFG
, strWIDList
, u32WidsCount
,
2219 get_id_from_handler(hif_drv
));
2222 PRINT_ER("Failed to send scan paramters config packet\n");
2224 up(&hif_sema_wait_response
);
2229 static s32
Handle_Get_InActiveTime(struct host_if_drv
*hif_drv
,
2230 struct sta_inactive_t
*strHostIfStaInactiveT
)
2237 strWID
.id
= (u16
)WID_SET_STA_MAC_INACTIVE_TIME
;
2238 strWID
.type
= WID_STR
;
2239 strWID
.size
= ETH_ALEN
;
2240 strWID
.val
= kmalloc(strWID
.size
, GFP_KERNEL
);
2243 stamac
= strWID
.val
;
2244 memcpy(stamac
, strHostIfStaInactiveT
->mac
, ETH_ALEN
);
2247 PRINT_D(CFG80211_DBG
, "SETING STA inactive time\n");
2250 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2251 get_id_from_handler(hif_drv
));
2254 PRINT_ER("Failed to SET incative time\n");
2259 strWID
.id
= (u16
)WID_GET_INACTIVE_TIME
;
2260 strWID
.type
= WID_INT
;
2261 strWID
.val
= (s8
*)&gu32InactiveTime
;
2262 strWID
.size
= sizeof(u32
);
2265 s32Error
= send_config_pkt(GET_CFG
, &strWID
, 1,
2266 get_id_from_handler(hif_drv
));
2269 PRINT_ER("Failed to get incative time\n");
2274 PRINT_D(CFG80211_DBG
, "Getting inactive time : %d\n", gu32InactiveTime
);
2276 up(&hif_drv
->hSemInactiveTime
);
2284 static void Handle_AddBeacon(struct host_if_drv
*hif_drv
,
2285 struct beacon_attr
*pstrSetBeaconParam
)
2291 PRINT_D(HOSTINF_DBG
, "Adding BEACON\n");
2293 strWID
.id
= (u16
)WID_ADD_BEACON
;
2294 strWID
.type
= WID_BIN
;
2295 strWID
.size
= pstrSetBeaconParam
->head_len
+ pstrSetBeaconParam
->tail_len
+ 16;
2296 strWID
.val
= kmalloc(strWID
.size
, GFP_KERNEL
);
2297 if (strWID
.val
== NULL
)
2300 pu8CurrByte
= strWID
.val
;
2301 *pu8CurrByte
++ = (pstrSetBeaconParam
->interval
& 0xFF);
2302 *pu8CurrByte
++ = ((pstrSetBeaconParam
->interval
>> 8) & 0xFF);
2303 *pu8CurrByte
++ = ((pstrSetBeaconParam
->interval
>> 16) & 0xFF);
2304 *pu8CurrByte
++ = ((pstrSetBeaconParam
->interval
>> 24) & 0xFF);
2306 *pu8CurrByte
++ = (pstrSetBeaconParam
->dtim_period
& 0xFF);
2307 *pu8CurrByte
++ = ((pstrSetBeaconParam
->dtim_period
>> 8) & 0xFF);
2308 *pu8CurrByte
++ = ((pstrSetBeaconParam
->dtim_period
>> 16) & 0xFF);
2309 *pu8CurrByte
++ = ((pstrSetBeaconParam
->dtim_period
>> 24) & 0xFF);
2311 *pu8CurrByte
++ = (pstrSetBeaconParam
->head_len
& 0xFF);
2312 *pu8CurrByte
++ = ((pstrSetBeaconParam
->head_len
>> 8) & 0xFF);
2313 *pu8CurrByte
++ = ((pstrSetBeaconParam
->head_len
>> 16) & 0xFF);
2314 *pu8CurrByte
++ = ((pstrSetBeaconParam
->head_len
>> 24) & 0xFF);
2316 memcpy(pu8CurrByte
, pstrSetBeaconParam
->head
, pstrSetBeaconParam
->head_len
);
2317 pu8CurrByte
+= pstrSetBeaconParam
->head_len
;
2319 *pu8CurrByte
++ = (pstrSetBeaconParam
->tail_len
& 0xFF);
2320 *pu8CurrByte
++ = ((pstrSetBeaconParam
->tail_len
>> 8) & 0xFF);
2321 *pu8CurrByte
++ = ((pstrSetBeaconParam
->tail_len
>> 16) & 0xFF);
2322 *pu8CurrByte
++ = ((pstrSetBeaconParam
->tail_len
>> 24) & 0xFF);
2324 if (pstrSetBeaconParam
->tail
> 0)
2325 memcpy(pu8CurrByte
, pstrSetBeaconParam
->tail
, pstrSetBeaconParam
->tail_len
);
2326 pu8CurrByte
+= pstrSetBeaconParam
->tail_len
;
2328 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2329 get_id_from_handler(hif_drv
));
2331 PRINT_ER("Failed to send add beacon config packet\n");
2335 kfree(pstrSetBeaconParam
->head
);
2336 kfree(pstrSetBeaconParam
->tail
);
2339 static void Handle_DelBeacon(struct host_if_drv
*hif_drv
)
2345 strWID
.id
= (u16
)WID_DEL_BEACON
;
2346 strWID
.type
= WID_CHAR
;
2347 strWID
.size
= sizeof(char);
2348 strWID
.val
= &gu8DelBcn
;
2350 if (strWID
.val
== NULL
)
2353 pu8CurrByte
= strWID
.val
;
2355 PRINT_D(HOSTINF_DBG
, "Deleting BEACON\n");
2357 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2358 get_id_from_handler(hif_drv
));
2360 PRINT_ER("Failed to send delete beacon config packet\n");
2363 static u32
WILC_HostIf_PackStaParam(u8
*pu8Buffer
,
2364 struct add_sta_param
*pstrStationParam
)
2368 pu8CurrByte
= pu8Buffer
;
2370 PRINT_D(HOSTINF_DBG
, "Packing STA params\n");
2371 memcpy(pu8CurrByte
, pstrStationParam
->au8BSSID
, ETH_ALEN
);
2372 pu8CurrByte
+= ETH_ALEN
;
2374 *pu8CurrByte
++ = pstrStationParam
->u16AssocID
& 0xFF;
2375 *pu8CurrByte
++ = (pstrStationParam
->u16AssocID
>> 8) & 0xFF;
2377 *pu8CurrByte
++ = pstrStationParam
->u8NumRates
;
2378 if (pstrStationParam
->u8NumRates
> 0)
2379 memcpy(pu8CurrByte
, pstrStationParam
->pu8Rates
, pstrStationParam
->u8NumRates
);
2380 pu8CurrByte
+= pstrStationParam
->u8NumRates
;
2382 *pu8CurrByte
++ = pstrStationParam
->bIsHTSupported
;
2383 *pu8CurrByte
++ = pstrStationParam
->u16HTCapInfo
& 0xFF;
2384 *pu8CurrByte
++ = (pstrStationParam
->u16HTCapInfo
>> 8) & 0xFF;
2386 *pu8CurrByte
++ = pstrStationParam
->u8AmpduParams
;
2387 memcpy(pu8CurrByte
, pstrStationParam
->au8SuppMCsSet
, WILC_SUPP_MCS_SET_SIZE
);
2388 pu8CurrByte
+= WILC_SUPP_MCS_SET_SIZE
;
2390 *pu8CurrByte
++ = pstrStationParam
->u16HTExtParams
& 0xFF;
2391 *pu8CurrByte
++ = (pstrStationParam
->u16HTExtParams
>> 8) & 0xFF;
2393 *pu8CurrByte
++ = pstrStationParam
->u32TxBeamformingCap
& 0xFF;
2394 *pu8CurrByte
++ = (pstrStationParam
->u32TxBeamformingCap
>> 8) & 0xFF;
2395 *pu8CurrByte
++ = (pstrStationParam
->u32TxBeamformingCap
>> 16) & 0xFF;
2396 *pu8CurrByte
++ = (pstrStationParam
->u32TxBeamformingCap
>> 24) & 0xFF;
2398 *pu8CurrByte
++ = pstrStationParam
->u8ASELCap
;
2400 *pu8CurrByte
++ = pstrStationParam
->u16FlagsMask
& 0xFF;
2401 *pu8CurrByte
++ = (pstrStationParam
->u16FlagsMask
>> 8) & 0xFF;
2403 *pu8CurrByte
++ = pstrStationParam
->u16FlagsSet
& 0xFF;
2404 *pu8CurrByte
++ = (pstrStationParam
->u16FlagsSet
>> 8) & 0xFF;
2406 return pu8CurrByte
- pu8Buffer
;
2409 static void Handle_AddStation(struct host_if_drv
*hif_drv
,
2410 struct add_sta_param
*pstrStationParam
)
2416 PRINT_D(HOSTINF_DBG
, "Handling add station\n");
2417 strWID
.id
= (u16
)WID_ADD_STA
;
2418 strWID
.type
= WID_BIN
;
2419 strWID
.size
= WILC_ADD_STA_LENGTH
+ pstrStationParam
->u8NumRates
;
2421 strWID
.val
= kmalloc(strWID
.size
, GFP_KERNEL
);
2422 if (strWID
.val
== NULL
)
2425 pu8CurrByte
= strWID
.val
;
2426 pu8CurrByte
+= WILC_HostIf_PackStaParam(pu8CurrByte
, pstrStationParam
);
2428 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2429 get_id_from_handler(hif_drv
));
2431 PRINT_ER("Failed to send add station config packet\n");
2434 kfree(pstrStationParam
->pu8Rates
);
2438 static void Handle_DelAllSta(struct host_if_drv
*hif_drv
,
2439 struct del_all_sta
*pstrDelAllStaParam
)
2446 u8 au8Zero_Buff
[6] = {0};
2448 strWID
.id
= (u16
)WID_DEL_ALL_STA
;
2449 strWID
.type
= WID_STR
;
2450 strWID
.size
= (pstrDelAllStaParam
->assoc_sta
* ETH_ALEN
) + 1;
2452 PRINT_D(HOSTINF_DBG
, "Handling delete station\n");
2454 strWID
.val
= kmalloc((pstrDelAllStaParam
->assoc_sta
* ETH_ALEN
) + 1, GFP_KERNEL
);
2455 if (strWID
.val
== NULL
)
2458 pu8CurrByte
= strWID
.val
;
2460 *(pu8CurrByte
++) = pstrDelAllStaParam
->assoc_sta
;
2462 for (i
= 0; i
< MAX_NUM_STA
; i
++) {
2463 if (memcmp(pstrDelAllStaParam
->del_all_sta
[i
], au8Zero_Buff
, ETH_ALEN
))
2464 memcpy(pu8CurrByte
, pstrDelAllStaParam
->del_all_sta
[i
], ETH_ALEN
);
2468 pu8CurrByte
+= ETH_ALEN
;
2471 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2472 get_id_from_handler(hif_drv
));
2474 PRINT_ER("Failed to send add station config packet\n");
2479 up(&hif_sema_wait_response
);
2482 static void Handle_DelStation(struct host_if_drv
*hif_drv
,
2483 struct del_sta
*pstrDelStaParam
)
2489 strWID
.id
= (u16
)WID_REMOVE_STA
;
2490 strWID
.type
= WID_BIN
;
2491 strWID
.size
= ETH_ALEN
;
2493 PRINT_D(HOSTINF_DBG
, "Handling delete station\n");
2495 strWID
.val
= kmalloc(strWID
.size
, GFP_KERNEL
);
2496 if (strWID
.val
== NULL
)
2499 pu8CurrByte
= strWID
.val
;
2501 memcpy(pu8CurrByte
, pstrDelStaParam
->mac_addr
, ETH_ALEN
);
2503 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2504 get_id_from_handler(hif_drv
));
2506 PRINT_ER("Failed to send add station config packet\n");
2512 static void Handle_EditStation(struct host_if_drv
*hif_drv
,
2513 struct add_sta_param
*pstrStationParam
)
2519 strWID
.id
= (u16
)WID_EDIT_STA
;
2520 strWID
.type
= WID_BIN
;
2521 strWID
.size
= WILC_ADD_STA_LENGTH
+ pstrStationParam
->u8NumRates
;
2523 PRINT_D(HOSTINF_DBG
, "Handling edit station\n");
2524 strWID
.val
= kmalloc(strWID
.size
, GFP_KERNEL
);
2525 if (strWID
.val
== NULL
)
2528 pu8CurrByte
= strWID
.val
;
2529 pu8CurrByte
+= WILC_HostIf_PackStaParam(pu8CurrByte
, pstrStationParam
);
2531 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2532 get_id_from_handler(hif_drv
));
2534 PRINT_ER("Failed to send edit station config packet\n");
2537 kfree(pstrStationParam
->pu8Rates
);
2541 static int Handle_RemainOnChan(struct host_if_drv
*hif_drv
,
2542 struct remain_ch
*pstrHostIfRemainOnChan
)
2545 u8 u8remain_on_chan_flag
;
2548 if (!hif_drv
->u8RemainOnChan_pendingreq
) {
2549 hif_drv
->strHostIfRemainOnChan
.pVoid
= pstrHostIfRemainOnChan
->pVoid
;
2550 hif_drv
->strHostIfRemainOnChan
.pRemainOnChanExpired
= pstrHostIfRemainOnChan
->pRemainOnChanExpired
;
2551 hif_drv
->strHostIfRemainOnChan
.pRemainOnChanReady
= pstrHostIfRemainOnChan
->pRemainOnChanReady
;
2552 hif_drv
->strHostIfRemainOnChan
.u16Channel
= pstrHostIfRemainOnChan
->u16Channel
;
2553 hif_drv
->strHostIfRemainOnChan
.u32ListenSessionID
= pstrHostIfRemainOnChan
->u32ListenSessionID
;
2555 pstrHostIfRemainOnChan
->u16Channel
= hif_drv
->strHostIfRemainOnChan
.u16Channel
;
2558 if (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
!= NULL
) {
2559 PRINT_INFO(GENERIC_DBG
, "Required to remain on chan while scanning return\n");
2560 hif_drv
->u8RemainOnChan_pendingreq
= 1;
2564 if (hif_drv
->enuHostIFstate
== HOST_IF_WAITING_CONN_RESP
) {
2565 PRINT_INFO(GENERIC_DBG
, "Required to remain on chan while connecting return\n");
2570 if (g_obtainingIP
|| connecting
) {
2571 PRINT_D(GENERIC_DBG
, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n");
2576 PRINT_D(HOSTINF_DBG
, "Setting channel :%d\n", pstrHostIfRemainOnChan
->u16Channel
);
2578 u8remain_on_chan_flag
= true;
2579 strWID
.id
= (u16
)WID_REMAIN_ON_CHAN
;
2580 strWID
.type
= WID_STR
;
2582 strWID
.val
= kmalloc(strWID
.size
, GFP_KERNEL
);
2584 if (strWID
.val
== NULL
) {
2589 strWID
.val
[0] = u8remain_on_chan_flag
;
2590 strWID
.val
[1] = (s8
)pstrHostIfRemainOnChan
->u16Channel
;
2592 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2593 get_id_from_handler(hif_drv
));
2595 PRINT_ER("Failed to set remain on channel\n");
2599 P2P_LISTEN_STATE
= 1;
2600 hif_drv
->hRemainOnChannel
.data
= (unsigned long)hif_drv
;
2601 mod_timer(&hif_drv
->hRemainOnChannel
,
2603 msecs_to_jiffies(pstrHostIfRemainOnChan
->u32duration
));
2605 if (hif_drv
->strHostIfRemainOnChan
.pRemainOnChanReady
)
2606 hif_drv
->strHostIfRemainOnChan
.pRemainOnChanReady(hif_drv
->strHostIfRemainOnChan
.pVoid
);
2608 if (hif_drv
->u8RemainOnChan_pendingreq
)
2609 hif_drv
->u8RemainOnChan_pendingreq
= 0;
2614 static int Handle_RegisterFrame(struct host_if_drv
*hif_drv
,
2615 struct reg_frame
*pstrHostIfRegisterFrame
)
2621 PRINT_D(HOSTINF_DBG
, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame
->bReg
, pstrHostIfRegisterFrame
->u16FrameType
);
2623 strWID
.id
= (u16
)WID_REGISTER_FRAME
;
2624 strWID
.type
= WID_STR
;
2625 strWID
.val
= kmalloc(sizeof(u16
) + 2, GFP_KERNEL
);
2626 if (strWID
.val
== NULL
)
2629 pu8CurrByte
= strWID
.val
;
2631 *pu8CurrByte
++ = pstrHostIfRegisterFrame
->bReg
;
2632 *pu8CurrByte
++ = pstrHostIfRegisterFrame
->u8Regid
;
2633 memcpy(pu8CurrByte
, &(pstrHostIfRegisterFrame
->u16FrameType
), sizeof(u16
));
2636 strWID
.size
= sizeof(u16
) + 2;
2638 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2639 get_id_from_handler(hif_drv
));
2641 PRINT_ER("Failed to frame register config packet\n");
2649 #define FALSE_FRMWR_CHANNEL 100
2650 static u32
Handle_ListenStateExpired(struct host_if_drv
*hif_drv
,
2651 struct remain_ch
*pstrHostIfRemainOnChan
)
2653 u8 u8remain_on_chan_flag
;
2657 PRINT_D(HOSTINF_DBG
, "CANCEL REMAIN ON CHAN\n");
2659 if (P2P_LISTEN_STATE
) {
2660 u8remain_on_chan_flag
= false;
2661 strWID
.id
= (u16
)WID_REMAIN_ON_CHAN
;
2662 strWID
.type
= WID_STR
;
2664 strWID
.val
= kmalloc(strWID
.size
, GFP_KERNEL
);
2666 if (strWID
.val
== NULL
)
2667 PRINT_ER("Failed to allocate memory\n");
2669 strWID
.val
[0] = u8remain_on_chan_flag
;
2670 strWID
.val
[1] = FALSE_FRMWR_CHANNEL
;
2672 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2673 get_id_from_handler(hif_drv
));
2674 if (s32Error
!= 0) {
2675 PRINT_ER("Failed to set remain on channel\n");
2679 if (hif_drv
->strHostIfRemainOnChan
.pRemainOnChanExpired
) {
2680 hif_drv
->strHostIfRemainOnChan
.pRemainOnChanExpired(hif_drv
->strHostIfRemainOnChan
.pVoid
2681 , pstrHostIfRemainOnChan
->u32ListenSessionID
);
2683 P2P_LISTEN_STATE
= 0;
2685 PRINT_D(GENERIC_DBG
, "Not in listen state\n");
2693 static void ListenTimerCB(unsigned long arg
)
2696 struct host_if_msg msg
;
2697 struct host_if_drv
*hif_drv
= (struct host_if_drv
*)arg
;
2699 del_timer(&hif_drv
->hRemainOnChannel
);
2701 memset(&msg
, 0, sizeof(struct host_if_msg
));
2702 msg
.id
= HOST_IF_MSG_LISTEN_TIMER_FIRED
;
2704 msg
.body
.remain_on_ch
.u32ListenSessionID
= hif_drv
->strHostIfRemainOnChan
.u32ListenSessionID
;
2706 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2708 PRINT_ER("wilc_mq_send fail\n");
2711 static void Handle_PowerManagement(struct host_if_drv
*hif_drv
,
2712 struct power_mgmt_param
*strPowerMgmtParam
)
2718 strWID
.id
= (u16
)WID_POWER_MANAGEMENT
;
2720 if (strPowerMgmtParam
->enabled
== true)
2721 s8PowerMode
= MIN_FAST_PS
;
2723 s8PowerMode
= NO_POWERSAVE
;
2724 PRINT_D(HOSTINF_DBG
, "Handling power mgmt to %d\n", s8PowerMode
);
2725 strWID
.val
= &s8PowerMode
;
2726 strWID
.size
= sizeof(char);
2728 PRINT_D(HOSTINF_DBG
, "Handling Power Management\n");
2730 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2731 get_id_from_handler(hif_drv
));
2733 PRINT_ER("Failed to send power management config packet\n");
2736 static void Handle_SetMulticastFilter(struct host_if_drv
*hif_drv
,
2737 struct set_multicast
*strHostIfSetMulti
)
2743 PRINT_D(HOSTINF_DBG
, "Setup Multicast Filter\n");
2745 strWID
.id
= (u16
)WID_SETUP_MULTICAST_FILTER
;
2746 strWID
.type
= WID_BIN
;
2747 strWID
.size
= sizeof(struct set_multicast
) + ((strHostIfSetMulti
->cnt
) * ETH_ALEN
);
2748 strWID
.val
= kmalloc(strWID
.size
, GFP_KERNEL
);
2749 if (strWID
.val
== NULL
)
2752 pu8CurrByte
= strWID
.val
;
2753 *pu8CurrByte
++ = (strHostIfSetMulti
->enabled
& 0xFF);
2754 *pu8CurrByte
++ = ((strHostIfSetMulti
->enabled
>> 8) & 0xFF);
2755 *pu8CurrByte
++ = ((strHostIfSetMulti
->enabled
>> 16) & 0xFF);
2756 *pu8CurrByte
++ = ((strHostIfSetMulti
->enabled
>> 24) & 0xFF);
2758 *pu8CurrByte
++ = (strHostIfSetMulti
->cnt
& 0xFF);
2759 *pu8CurrByte
++ = ((strHostIfSetMulti
->cnt
>> 8) & 0xFF);
2760 *pu8CurrByte
++ = ((strHostIfSetMulti
->cnt
>> 16) & 0xFF);
2761 *pu8CurrByte
++ = ((strHostIfSetMulti
->cnt
>> 24) & 0xFF);
2763 if ((strHostIfSetMulti
->cnt
) > 0)
2764 memcpy(pu8CurrByte
, gau8MulticastMacAddrList
, ((strHostIfSetMulti
->cnt
) * ETH_ALEN
));
2766 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2767 get_id_from_handler(hif_drv
));
2769 PRINT_ER("Failed to send setup multicast config packet\n");
2776 static s32
Handle_AddBASession(struct host_if_drv
*hif_drv
,
2777 struct ba_session_info
*strHostIfBASessionInfo
)
2781 int AddbaTimeout
= 100;
2784 PRINT_D(HOSTINF_DBG
, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n",
2785 strHostIfBASessionInfo
->au8Bssid
[0],
2786 strHostIfBASessionInfo
->au8Bssid
[1],
2787 strHostIfBASessionInfo
->au8Bssid
[2],
2788 strHostIfBASessionInfo
->u16BufferSize
,
2789 strHostIfBASessionInfo
->u16SessionTimeout
,
2790 strHostIfBASessionInfo
->u8Ted
);
2792 strWID
.id
= (u16
)WID_11E_P_ACTION_REQ
;
2793 strWID
.type
= WID_STR
;
2794 strWID
.val
= kmalloc(BLOCK_ACK_REQ_SIZE
, GFP_KERNEL
);
2795 strWID
.size
= BLOCK_ACK_REQ_SIZE
;
2800 memcpy(ptr
, strHostIfBASessionInfo
->au8Bssid
, ETH_ALEN
);
2802 *ptr
++ = strHostIfBASessionInfo
->u8Ted
;
2804 *ptr
++ = (strHostIfBASessionInfo
->u16BufferSize
& 0xFF);
2805 *ptr
++ = ((strHostIfBASessionInfo
->u16BufferSize
>> 16) & 0xFF);
2806 *ptr
++ = (strHostIfBASessionInfo
->u16SessionTimeout
& 0xFF);
2807 *ptr
++ = ((strHostIfBASessionInfo
->u16SessionTimeout
>> 16) & 0xFF);
2808 *ptr
++ = (AddbaTimeout
& 0xFF);
2809 *ptr
++ = ((AddbaTimeout
>> 16) & 0xFF);
2813 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2814 get_id_from_handler(hif_drv
));
2816 PRINT_D(HOSTINF_DBG
, "Couldn't open BA Session\n");
2819 strWID
.id
= (u16
)WID_11E_P_ACTION_REQ
;
2820 strWID
.type
= WID_STR
;
2826 memcpy(ptr
, strHostIfBASessionInfo
->au8Bssid
, ETH_ALEN
);
2828 *ptr
++ = strHostIfBASessionInfo
->u8Ted
;
2830 *ptr
++ = (strHostIfBASessionInfo
->u16BufferSize
& 0xFF);
2831 *ptr
++ = ((strHostIfBASessionInfo
->u16SessionTimeout
>> 16) & 0xFF);
2833 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2834 get_id_from_handler(hif_drv
));
2842 static s32
Handle_DelAllRxBASessions(struct host_if_drv
*hif_drv
,
2843 struct ba_session_info
*strHostIfBASessionInfo
)
2849 PRINT_D(GENERIC_DBG
, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n",
2850 strHostIfBASessionInfo
->au8Bssid
[0],
2851 strHostIfBASessionInfo
->au8Bssid
[1],
2852 strHostIfBASessionInfo
->au8Bssid
[2],
2853 strHostIfBASessionInfo
->u8Ted
);
2855 strWID
.id
= (u16
)WID_DEL_ALL_RX_BA
;
2856 strWID
.type
= WID_STR
;
2857 strWID
.val
= kmalloc(BLOCK_ACK_REQ_SIZE
, GFP_KERNEL
);
2858 strWID
.size
= BLOCK_ACK_REQ_SIZE
;
2863 memcpy(ptr
, strHostIfBASessionInfo
->au8Bssid
, ETH_ALEN
);
2865 *ptr
++ = strHostIfBASessionInfo
->u8Ted
;
2869 s32Error
= send_config_pkt(SET_CFG
, &strWID
, 1,
2870 get_id_from_handler(hif_drv
));
2872 PRINT_D(HOSTINF_DBG
, "Couldn't delete BA Session\n");
2877 up(&hif_sema_wait_response
);
2883 static int hostIFthread(void *pvArg
)
2886 struct host_if_msg msg
;
2887 struct host_if_drv
*hif_drv
;
2889 memset(&msg
, 0, sizeof(struct host_if_msg
));
2892 wilc_mq_recv(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
), &u32Ret
);
2893 hif_drv
= (struct host_if_drv
*)msg
.drv
;
2894 if (msg
.id
== HOST_IF_MSG_EXIT
) {
2895 PRINT_D(GENERIC_DBG
, "THREAD: Exiting HostIfThread\n");
2899 if ((!g_wilc_initialized
)) {
2900 PRINT_D(GENERIC_DBG
, "--WAIT--");
2901 usleep_range(200 * 1000, 200 * 1000);
2902 wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2906 if (msg
.id
== HOST_IF_MSG_CONNECT
&& hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
!= NULL
) {
2907 PRINT_D(HOSTINF_DBG
, "Requeue connect request till scan done received\n");
2908 wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
2909 usleep_range(2 * 1000, 2 * 1000);
2914 case HOST_IF_MSG_Q_IDLE
:
2915 Handle_wait_msg_q_empty();
2918 case HOST_IF_MSG_SCAN
:
2919 Handle_Scan(msg
.drv
, &msg
.body
.scan_info
);
2922 case HOST_IF_MSG_CONNECT
:
2923 Handle_Connect(msg
.drv
, &msg
.body
.con_info
);
2926 case HOST_IF_MSG_FLUSH_CONNECT
:
2927 Handle_FlushConnect(msg
.drv
);
2930 case HOST_IF_MSG_RCVD_NTWRK_INFO
:
2931 Handle_RcvdNtwrkInfo(msg
.drv
, &msg
.body
.net_info
);
2934 case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO
:
2935 Handle_RcvdGnrlAsyncInfo(msg
.drv
, &msg
.body
.async_info
);
2938 case HOST_IF_MSG_KEY
:
2939 Handle_Key(msg
.drv
, &msg
.body
.key_info
);
2942 case HOST_IF_MSG_CFG_PARAMS
:
2944 Handle_CfgParam(msg
.drv
, &msg
.body
.cfg_info
);
2947 case HOST_IF_MSG_SET_CHANNEL
:
2948 Handle_SetChannel(msg
.drv
, &msg
.body
.channel_info
);
2951 case HOST_IF_MSG_DISCONNECT
:
2952 Handle_Disconnect(msg
.drv
);
2955 case HOST_IF_MSG_RCVD_SCAN_COMPLETE
:
2956 del_timer(&hif_drv
->hScanTimer
);
2957 PRINT_D(HOSTINF_DBG
, "scan completed successfully\n");
2959 if (!linux_wlan_get_num_conn_ifcs())
2960 chip_sleep_manually(INFINITE_SLEEP_TIME
);
2962 Handle_ScanDone(msg
.drv
, SCAN_EVENT_DONE
);
2964 if (hif_drv
->u8RemainOnChan_pendingreq
)
2965 Handle_RemainOnChan(msg
.drv
, &msg
.body
.remain_on_ch
);
2969 case HOST_IF_MSG_GET_RSSI
:
2970 Handle_GetRssi(msg
.drv
);
2973 case HOST_IF_MSG_GET_LINKSPEED
:
2974 Handle_GetLinkspeed(msg
.drv
);
2977 case HOST_IF_MSG_GET_STATISTICS
:
2978 Handle_GetStatistics(msg
.drv
, (struct rf_info
*)msg
.body
.data
);
2981 case HOST_IF_MSG_GET_CHNL
:
2982 Handle_GetChnl(msg
.drv
);
2985 case HOST_IF_MSG_ADD_BEACON
:
2986 Handle_AddBeacon(msg
.drv
, &msg
.body
.beacon_info
);
2989 case HOST_IF_MSG_DEL_BEACON
:
2990 Handle_DelBeacon(msg
.drv
);
2993 case HOST_IF_MSG_ADD_STATION
:
2994 Handle_AddStation(msg
.drv
, &msg
.body
.add_sta_info
);
2997 case HOST_IF_MSG_DEL_STATION
:
2998 Handle_DelStation(msg
.drv
, &msg
.body
.del_sta_info
);
3001 case HOST_IF_MSG_EDIT_STATION
:
3002 Handle_EditStation(msg
.drv
, &msg
.body
.edit_sta_info
);
3005 case HOST_IF_MSG_GET_INACTIVETIME
:
3006 Handle_Get_InActiveTime(msg
.drv
, &msg
.body
.mac_info
);
3009 case HOST_IF_MSG_SCAN_TIMER_FIRED
:
3010 PRINT_D(HOSTINF_DBG
, "Scan Timeout\n");
3012 Handle_ScanDone(msg
.drv
, SCAN_EVENT_ABORTED
);
3015 case HOST_IF_MSG_CONNECT_TIMER_FIRED
:
3016 PRINT_D(HOSTINF_DBG
, "Connect Timeout\n");
3017 Handle_ConnectTimeout(msg
.drv
);
3020 case HOST_IF_MSG_POWER_MGMT
:
3021 Handle_PowerManagement(msg
.drv
, &msg
.body
.pwr_mgmt_info
);
3024 case HOST_IF_MSG_SET_WFIDRV_HANDLER
:
3025 Handle_SetWfiDrvHandler(msg
.drv
,
3029 case HOST_IF_MSG_SET_OPERATION_MODE
:
3030 Handle_SetOperationMode(msg
.drv
, &msg
.body
.mode
);
3033 case HOST_IF_MSG_SET_IPADDRESS
:
3034 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_SET_IPADDRESS\n");
3035 Handle_set_IPAddress(msg
.drv
, msg
.body
.ip_info
.ip_addr
, msg
.body
.ip_info
.idx
);
3038 case HOST_IF_MSG_GET_IPADDRESS
:
3039 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_SET_IPADDRESS\n");
3040 Handle_get_IPAddress(msg
.drv
, msg
.body
.ip_info
.ip_addr
, msg
.body
.ip_info
.idx
);
3043 case HOST_IF_MSG_SET_MAC_ADDRESS
:
3044 Handle_SetMacAddress(msg
.drv
, &msg
.body
.set_mac_info
);
3047 case HOST_IF_MSG_GET_MAC_ADDRESS
:
3048 Handle_GetMacAddress(msg
.drv
, &msg
.body
.get_mac_info
);
3051 case HOST_IF_MSG_REMAIN_ON_CHAN
:
3052 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_REMAIN_ON_CHAN\n");
3053 Handle_RemainOnChan(msg
.drv
, &msg
.body
.remain_on_ch
);
3056 case HOST_IF_MSG_REGISTER_FRAME
:
3057 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_REGISTER_FRAME\n");
3058 Handle_RegisterFrame(msg
.drv
, &msg
.body
.reg_frame
);
3061 case HOST_IF_MSG_LISTEN_TIMER_FIRED
:
3062 Handle_ListenStateExpired(msg
.drv
, &msg
.body
.remain_on_ch
);
3065 case HOST_IF_MSG_SET_MULTICAST_FILTER
:
3066 PRINT_D(HOSTINF_DBG
, "HOST_IF_MSG_SET_MULTICAST_FILTER\n");
3067 Handle_SetMulticastFilter(msg
.drv
, &msg
.body
.multicast_info
);
3070 case HOST_IF_MSG_ADD_BA_SESSION
:
3071 Handle_AddBASession(msg
.drv
, &msg
.body
.session_info
);
3074 case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS
:
3075 Handle_DelAllRxBASessions(msg
.drv
, &msg
.body
.session_info
);
3078 case HOST_IF_MSG_DEL_ALL_STA
:
3079 Handle_DelAllSta(msg
.drv
, &msg
.body
.del_all_sta_info
);
3083 PRINT_ER("[Host Interface] undefined Received Msg ID\n");
3088 PRINT_D(HOSTINF_DBG
, "Releasing thread exit semaphore\n");
3089 up(&hif_sema_thread
);
3093 static void TimerCB_Scan(unsigned long arg
)
3095 void *pvArg
= (void *)arg
;
3096 struct host_if_msg msg
;
3098 memset(&msg
, 0, sizeof(struct host_if_msg
));
3100 msg
.id
= HOST_IF_MSG_SCAN_TIMER_FIRED
;
3102 wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3105 static void TimerCB_Connect(unsigned long arg
)
3107 void *pvArg
= (void *)arg
;
3108 struct host_if_msg msg
;
3110 memset(&msg
, 0, sizeof(struct host_if_msg
));
3112 msg
.id
= HOST_IF_MSG_CONNECT_TIMER_FIRED
;
3114 wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3117 s32
host_int_remove_key(struct host_if_drv
*hif_drv
, const u8
*pu8StaAddress
)
3121 strWID
.id
= (u16
)WID_REMOVE_KEY
;
3122 strWID
.type
= WID_STR
;
3123 strWID
.val
= (s8
*)pu8StaAddress
;
3129 int host_int_remove_wep_key(struct host_if_drv
*hif_drv
, u8 index
)
3132 struct host_if_msg msg
;
3136 PRINT_ER("Failed to send setup multicast config packet\n");
3140 memset(&msg
, 0, sizeof(struct host_if_msg
));
3142 msg
.id
= HOST_IF_MSG_KEY
;
3143 msg
.body
.key_info
.type
= WEP
;
3144 msg
.body
.key_info
.action
= REMOVEKEY
;
3146 msg
.body
.key_info
.attr
.wep
.index
= index
;
3148 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3150 PRINT_ER("Error in sending message queue : Request to remove WEP key\n");
3151 down(&hif_drv
->hSemTestKeyBlock
);
3156 s32
host_int_set_WEPDefaultKeyID(struct host_if_drv
*hif_drv
, u8 u8Index
)
3159 struct host_if_msg msg
;
3164 PRINT_ER("driver is null\n");
3168 memset(&msg
, 0, sizeof(struct host_if_msg
));
3171 msg
.id
= HOST_IF_MSG_KEY
;
3172 msg
.body
.key_info
.type
= WEP
;
3173 msg
.body
.key_info
.action
= DEFAULTKEY
;
3175 msg
.body
.key_info
.attr
.wep
.index
= u8Index
;
3177 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3179 PRINT_ER("Error in sending message queue : Default key index\n");
3180 down(&hif_drv
->hSemTestKeyBlock
);
3185 s32
host_int_add_wep_key_bss_sta(struct host_if_drv
*hif_drv
,
3186 const u8
*pu8WepKey
,
3192 struct host_if_msg msg
;
3196 PRINT_ER("driver is null\n");
3200 memset(&msg
, 0, sizeof(struct host_if_msg
));
3203 msg
.id
= HOST_IF_MSG_KEY
;
3204 msg
.body
.key_info
.type
= WEP
;
3205 msg
.body
.key_info
.action
= ADDKEY
;
3207 msg
.body
.key_info
.attr
.wep
.key
= kmalloc(u8WepKeylen
, GFP_KERNEL
);
3208 memcpy(msg
.body
.key_info
.attr
.wep
.key
, pu8WepKey
, u8WepKeylen
);
3209 msg
.body
.key_info
.attr
.wep
.key_len
= (u8WepKeylen
);
3210 msg
.body
.key_info
.attr
.wep
.index
= u8Keyidx
;
3212 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3214 PRINT_ER("Error in sending message queue :WEP Key\n");
3215 down(&hif_drv
->hSemTestKeyBlock
);
3221 s32
host_int_add_wep_key_bss_ap(struct host_if_drv
*hif_drv
,
3222 const u8
*pu8WepKey
,
3226 enum AUTHTYPE tenuAuth_type
)
3230 struct host_if_msg msg
;
3235 PRINT_ER("driver is null\n");
3239 memset(&msg
, 0, sizeof(struct host_if_msg
));
3242 for (i
= 0; i
< u8WepKeylen
; i
++)
3243 PRINT_INFO(HOSTAPD_DBG
, "KEY is %x\n", pu8WepKey
[i
]);
3245 msg
.id
= HOST_IF_MSG_KEY
;
3246 msg
.body
.key_info
.type
= WEP
;
3247 msg
.body
.key_info
.action
= ADDKEY_AP
;
3249 msg
.body
.key_info
.attr
.wep
.key
= kmalloc(u8WepKeylen
, GFP_KERNEL
);
3250 memcpy(msg
.body
.key_info
.attr
.wep
.key
, pu8WepKey
, (u8WepKeylen
));
3251 msg
.body
.key_info
.attr
.wep
.key_len
= (u8WepKeylen
);
3252 msg
.body
.key_info
.attr
.wep
.index
= u8Keyidx
;
3253 msg
.body
.key_info
.attr
.wep
.mode
= u8mode
;
3254 msg
.body
.key_info
.attr
.wep
.auth_type
= tenuAuth_type
;
3256 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3259 PRINT_ER("Error in sending message queue :WEP Key\n");
3260 down(&hif_drv
->hSemTestKeyBlock
);
3266 s32
host_int_add_ptk(struct host_if_drv
*hif_drv
, const u8
*pu8Ptk
,
3267 u8 u8PtkKeylen
, const u8
*mac_addr
,
3268 const u8
*pu8RxMic
, const u8
*pu8TxMic
,
3269 u8 mode
, u8 u8Ciphermode
, u8 u8Idx
)
3272 struct host_if_msg msg
;
3273 u8 u8KeyLen
= u8PtkKeylen
;
3278 PRINT_ER("driver is null\n");
3281 if (pu8RxMic
!= NULL
)
3282 u8KeyLen
+= RX_MIC_KEY_LEN
;
3283 if (pu8TxMic
!= NULL
)
3284 u8KeyLen
+= TX_MIC_KEY_LEN
;
3286 memset(&msg
, 0, sizeof(struct host_if_msg
));
3289 msg
.id
= HOST_IF_MSG_KEY
;
3290 msg
.body
.key_info
.type
= WPAPtk
;
3291 if (mode
== AP_MODE
) {
3292 msg
.body
.key_info
.action
= ADDKEY_AP
;
3293 msg
.body
.key_info
.attr
.wpa
.index
= u8Idx
;
3295 if (mode
== STATION_MODE
)
3296 msg
.body
.key_info
.action
= ADDKEY
;
3298 msg
.body
.key_info
.attr
.wpa
.key
= kmalloc(u8PtkKeylen
, GFP_KERNEL
);
3299 memcpy(msg
.body
.key_info
.attr
.wpa
.key
, pu8Ptk
, u8PtkKeylen
);
3301 if (pu8RxMic
!= NULL
) {
3302 memcpy(msg
.body
.key_info
.attr
.wpa
.key
+ 16, pu8RxMic
, RX_MIC_KEY_LEN
);
3304 for (i
= 0; i
< RX_MIC_KEY_LEN
; i
++)
3305 PRINT_INFO(CFG80211_DBG
, "PairwiseRx[%d] = %x\n", i
, pu8RxMic
[i
]);
3308 if (pu8TxMic
!= NULL
) {
3309 memcpy(msg
.body
.key_info
.attr
.wpa
.key
+ 24, pu8TxMic
, TX_MIC_KEY_LEN
);
3311 for (i
= 0; i
< TX_MIC_KEY_LEN
; i
++)
3312 PRINT_INFO(CFG80211_DBG
, "PairwiseTx[%d] = %x\n", i
, pu8TxMic
[i
]);
3316 msg
.body
.key_info
.attr
.wpa
.key_len
= u8KeyLen
;
3317 msg
.body
.key_info
.attr
.wpa
.mac_addr
= mac_addr
;
3318 msg
.body
.key_info
.attr
.wpa
.mode
= u8Ciphermode
;
3321 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3324 PRINT_ER("Error in sending message queue: PTK Key\n");
3326 down(&hif_drv
->hSemTestKeyBlock
);
3331 s32
host_int_add_rx_gtk(struct host_if_drv
*hif_drv
, const u8
*pu8RxGtk
,
3332 u8 u8GtkKeylen
, u8 u8KeyIdx
,
3333 u32 u32KeyRSClen
, const u8
*KeyRSC
,
3334 const u8
*pu8RxMic
, const u8
*pu8TxMic
,
3335 u8 mode
, u8 u8Ciphermode
)
3338 struct host_if_msg msg
;
3339 u8 u8KeyLen
= u8GtkKeylen
;
3343 PRINT_ER("driver is null\n");
3346 memset(&msg
, 0, sizeof(struct host_if_msg
));
3349 if (pu8RxMic
!= NULL
)
3350 u8KeyLen
+= RX_MIC_KEY_LEN
;
3351 if (pu8TxMic
!= NULL
)
3352 u8KeyLen
+= TX_MIC_KEY_LEN
;
3353 if (KeyRSC
!= NULL
) {
3354 msg
.body
.key_info
.attr
.wpa
.seq
= kmalloc(u32KeyRSClen
, GFP_KERNEL
);
3355 memcpy(msg
.body
.key_info
.attr
.wpa
.seq
, KeyRSC
, u32KeyRSClen
);
3359 msg
.id
= HOST_IF_MSG_KEY
;
3360 msg
.body
.key_info
.type
= WPARxGtk
;
3363 if (mode
== AP_MODE
) {
3364 msg
.body
.key_info
.action
= ADDKEY_AP
;
3365 msg
.body
.key_info
.attr
.wpa
.mode
= u8Ciphermode
;
3367 if (mode
== STATION_MODE
)
3368 msg
.body
.key_info
.action
= ADDKEY
;
3370 msg
.body
.key_info
.attr
.wpa
.key
= kmalloc(u8KeyLen
, GFP_KERNEL
);
3371 memcpy(msg
.body
.key_info
.attr
.wpa
.key
, pu8RxGtk
, u8GtkKeylen
);
3373 if (pu8RxMic
!= NULL
) {
3374 memcpy(msg
.body
.key_info
.attr
.wpa
.key
+ 16, pu8RxMic
, RX_MIC_KEY_LEN
);
3376 if (pu8TxMic
!= NULL
) {
3377 memcpy(msg
.body
.key_info
.attr
.wpa
.key
+ 24, pu8TxMic
, TX_MIC_KEY_LEN
);
3380 msg
.body
.key_info
.attr
.wpa
.index
= u8KeyIdx
;
3381 msg
.body
.key_info
.attr
.wpa
.key_len
= u8KeyLen
;
3382 msg
.body
.key_info
.attr
.wpa
.seq_len
= u32KeyRSClen
;
3384 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3386 PRINT_ER("Error in sending message queue: RX GTK\n");
3388 down(&hif_drv
->hSemTestKeyBlock
);
3393 s32
host_int_set_pmkid_info(struct host_if_drv
*hif_drv
, struct host_if_pmkid_attr
*pu8PmkidInfoArray
)
3396 struct host_if_msg msg
;
3402 PRINT_ER("driver is null\n");
3406 memset(&msg
, 0, sizeof(struct host_if_msg
));
3408 msg
.id
= HOST_IF_MSG_KEY
;
3409 msg
.body
.key_info
.type
= PMKSA
;
3410 msg
.body
.key_info
.action
= ADDKEY
;
3413 for (i
= 0; i
< pu8PmkidInfoArray
->numpmkid
; i
++) {
3414 memcpy(msg
.body
.key_info
.attr
.pmkid
.pmkidlist
[i
].bssid
, &pu8PmkidInfoArray
->pmkidlist
[i
].bssid
,
3416 memcpy(msg
.body
.key_info
.attr
.pmkid
.pmkidlist
[i
].pmkid
, &pu8PmkidInfoArray
->pmkidlist
[i
].pmkid
,
3420 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3422 PRINT_ER(" Error in sending messagequeue: PMKID Info\n");
3427 s32
host_int_get_pmkid_info(struct host_if_drv
*hif_drv
,
3428 u8
*pu8PmkidInfoArray
,
3429 u32 u32PmkidInfoLen
)
3433 strWID
.id
= (u16
)WID_PMKID_INFO
;
3434 strWID
.type
= WID_STR
;
3435 strWID
.size
= u32PmkidInfoLen
;
3436 strWID
.val
= pu8PmkidInfoArray
;
3441 s32
host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv
*hif_drv
,
3447 if ((u8Psklength
> 7) && (u8Psklength
< 65)) {
3448 strWID
.id
= (u16
)WID_11I_PSK
;
3449 strWID
.type
= WID_STR
;
3450 strWID
.val
= pu8PassPhrase
;
3451 strWID
.size
= u8Psklength
;
3457 s32
host_int_get_MacAddress(struct host_if_drv
*hif_drv
, u8
*pu8MacAddress
)
3460 struct host_if_msg msg
;
3462 memset(&msg
, 0, sizeof(struct host_if_msg
));
3464 msg
.id
= HOST_IF_MSG_GET_MAC_ADDRESS
;
3465 msg
.body
.get_mac_info
.u8MacAddress
= pu8MacAddress
;
3468 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3470 PRINT_ER("Failed to send get mac address\n");
3474 down(&hif_sema_wait_response
);
3478 s32
host_int_set_MacAddress(struct host_if_drv
*hif_drv
, u8
*pu8MacAddress
)
3481 struct host_if_msg msg
;
3483 PRINT_D(GENERIC_DBG
, "mac addr = %x:%x:%x\n", pu8MacAddress
[0], pu8MacAddress
[1], pu8MacAddress
[2]);
3485 memset(&msg
, 0, sizeof(struct host_if_msg
));
3486 msg
.id
= HOST_IF_MSG_SET_MAC_ADDRESS
;
3487 memcpy(msg
.body
.set_mac_info
.u8MacAddress
, pu8MacAddress
, ETH_ALEN
);
3490 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3492 PRINT_ER("Failed to send message queue: Set mac address\n");
3498 s32
host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv
*hif_drv
,
3499 u8
*pu8PassPhrase
, u8 u8Psklength
)
3503 strWID
.id
= (u16
)WID_11I_PSK
;
3504 strWID
.type
= WID_STR
;
3505 strWID
.size
= u8Psklength
;
3506 strWID
.val
= pu8PassPhrase
;
3511 s32
host_int_set_start_scan_req(struct host_if_drv
*hif_drv
, u8 scanSource
)
3515 strWID
.id
= (u16
)WID_START_SCAN_REQ
;
3516 strWID
.type
= WID_CHAR
;
3517 strWID
.val
= (s8
*)&scanSource
;
3518 strWID
.size
= sizeof(char);
3523 s32
host_int_get_start_scan_req(struct host_if_drv
*hif_drv
, u8
*pu8ScanSource
)
3527 strWID
.id
= (u16
)WID_START_SCAN_REQ
;
3528 strWID
.type
= WID_CHAR
;
3529 strWID
.val
= (s8
*)pu8ScanSource
;
3530 strWID
.size
= sizeof(char);
3535 s32
host_int_set_join_req(struct host_if_drv
*hif_drv
, u8
*pu8bssid
,
3536 const u8
*pu8ssid
, size_t ssidLen
,
3537 const u8
*pu8IEs
, size_t IEsLen
,
3538 wilc_connect_result pfConnectResult
, void *pvUserArg
,
3539 u8 u8security
, enum AUTHTYPE tenuAuth_type
,
3540 u8 u8channel
, void *pJoinParams
)
3543 struct host_if_msg msg
;
3545 if (!hif_drv
|| pfConnectResult
== NULL
) {
3547 PRINT_ER("Driver is null\n");
3551 if (pJoinParams
== NULL
) {
3552 PRINT_ER("Unable to Join - JoinParams is NULL\n");
3556 memset(&msg
, 0, sizeof(struct host_if_msg
));
3558 msg
.id
= HOST_IF_MSG_CONNECT
;
3560 msg
.body
.con_info
.security
= u8security
;
3561 msg
.body
.con_info
.auth_type
= tenuAuth_type
;
3562 msg
.body
.con_info
.ch
= u8channel
;
3563 msg
.body
.con_info
.result
= pfConnectResult
;
3564 msg
.body
.con_info
.arg
= pvUserArg
;
3565 msg
.body
.con_info
.params
= pJoinParams
;
3568 if (pu8bssid
!= NULL
) {
3569 msg
.body
.con_info
.bssid
= kmalloc(6, GFP_KERNEL
);
3570 memcpy(msg
.body
.con_info
.bssid
, pu8bssid
, 6);
3573 if (pu8ssid
!= NULL
) {
3574 msg
.body
.con_info
.ssid_len
= ssidLen
;
3575 msg
.body
.con_info
.ssid
= kmalloc(ssidLen
, GFP_KERNEL
);
3576 memcpy(msg
.body
.con_info
.ssid
, pu8ssid
, ssidLen
);
3579 if (pu8IEs
!= NULL
) {
3580 msg
.body
.con_info
.ies_len
= IEsLen
;
3581 msg
.body
.con_info
.ies
= kmalloc(IEsLen
, GFP_KERNEL
);
3582 memcpy(msg
.body
.con_info
.ies
, pu8IEs
, IEsLen
);
3584 if (hif_drv
->enuHostIFstate
< HOST_IF_CONNECTING
)
3585 hif_drv
->enuHostIFstate
= HOST_IF_CONNECTING
;
3587 PRINT_D(GENERIC_DBG
, "Don't set state to 'connecting' as state is %d\n", hif_drv
->enuHostIFstate
);
3589 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3591 PRINT_ER("Failed to send message queue: Set join request\n");
3595 hif_drv
->hConnectTimer
.data
= (unsigned long)hif_drv
;
3596 mod_timer(&hif_drv
->hConnectTimer
,
3597 jiffies
+ msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT
));
3602 s32
host_int_flush_join_req(struct host_if_drv
*hif_drv
)
3605 struct host_if_msg msg
;
3607 if (!gu8FlushedJoinReq
) {
3615 PRINT_ER("Driver is null\n");
3619 msg
.id
= HOST_IF_MSG_FLUSH_CONNECT
;
3622 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3624 PRINT_ER("Failed to send message queue: Flush join request\n");
3631 s32
host_int_disconnect(struct host_if_drv
*hif_drv
, u16 u16ReasonCode
)
3634 struct host_if_msg msg
;
3637 PRINT_ER("Driver is null\n");
3641 memset(&msg
, 0, sizeof(struct host_if_msg
));
3643 msg
.id
= HOST_IF_MSG_DISCONNECT
;
3646 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3648 PRINT_ER("Failed to send message queue: disconnect\n");
3650 down(&hif_drv
->hSemTestDisconnectBlock
);
3655 s32
host_int_disconnect_station(struct host_if_drv
*hif_drv
, u8 assoc_id
)
3659 strWID
.id
= (u16
)WID_DISCONNECT
;
3660 strWID
.type
= WID_CHAR
;
3661 strWID
.val
= (s8
*)&assoc_id
;
3662 strWID
.size
= sizeof(char);
3667 s32
host_int_get_assoc_req_info(struct host_if_drv
*hif_drv
, u8
*pu8AssocReqInfo
,
3668 u32 u32AssocReqInfoLen
)
3672 strWID
.id
= (u16
)WID_ASSOC_REQ_INFO
;
3673 strWID
.type
= WID_STR
;
3674 strWID
.val
= pu8AssocReqInfo
;
3675 strWID
.size
= u32AssocReqInfoLen
;
3680 s32
host_int_get_assoc_res_info(struct host_if_drv
*hif_drv
, u8
*pu8AssocRespInfo
,
3681 u32 u32MaxAssocRespInfoLen
, u32
*pu32RcvdAssocRespInfoLen
)
3687 PRINT_ER("Driver is null\n");
3691 strWID
.id
= (u16
)WID_ASSOC_RES_INFO
;
3692 strWID
.type
= WID_STR
;
3693 strWID
.val
= pu8AssocRespInfo
;
3694 strWID
.size
= u32MaxAssocRespInfoLen
;
3696 s32Error
= send_config_pkt(GET_CFG
, &strWID
, 1,
3697 get_id_from_handler(hif_drv
));
3699 *pu32RcvdAssocRespInfoLen
= 0;
3700 PRINT_ER("Failed to send association response config packet\n");
3703 *pu32RcvdAssocRespInfoLen
= strWID
.size
;
3709 s32
host_int_get_rx_power_level(struct host_if_drv
*hif_drv
, u8
*pu8RxPowerLevel
,
3710 u32 u32RxPowerLevelLen
)
3714 strWID
.id
= (u16
)WID_RX_POWER_LEVEL
;
3715 strWID
.type
= WID_STR
;
3716 strWID
.val
= pu8RxPowerLevel
;
3717 strWID
.size
= u32RxPowerLevelLen
;
3722 int host_int_set_mac_chnl_num(struct host_if_drv
*hif_drv
, u8 channel
)
3725 struct host_if_msg msg
;
3728 PRINT_ER("driver is null\n");
3732 memset(&msg
, 0, sizeof(struct host_if_msg
));
3733 msg
.id
= HOST_IF_MSG_SET_CHANNEL
;
3734 msg
.body
.channel_info
.set_ch
= channel
;
3737 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3739 PRINT_ER("wilc mq send fail\n");
3746 int host_int_wait_msg_queue_idle(void)
3750 struct host_if_msg msg
;
3751 memset(&msg
, 0, sizeof(struct host_if_msg
));
3752 msg
.id
= HOST_IF_MSG_Q_IDLE
;
3753 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3755 PRINT_ER("wilc mq send fail\n");
3759 down(&hif_sema_wait_response
);
3764 int host_int_set_wfi_drv_handler(struct host_if_drv
*hif_drv
)
3768 struct host_if_msg msg
;
3769 memset(&msg
, 0, sizeof(struct host_if_msg
));
3770 msg
.id
= HOST_IF_MSG_SET_WFIDRV_HANDLER
;
3771 msg
.body
.drv
.u32Address
= get_id_from_handler(hif_drv
);
3774 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3776 PRINT_ER("wilc mq send fail\n");
3783 int host_int_set_operation_mode(struct host_if_drv
*hif_drv
, u32 mode
)
3787 struct host_if_msg msg
;
3788 memset(&msg
, 0, sizeof(struct host_if_msg
));
3789 msg
.id
= HOST_IF_MSG_SET_OPERATION_MODE
;
3790 msg
.body
.mode
.u32Mode
= mode
;
3793 result
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3795 PRINT_ER("wilc mq send fail\n");
3802 s32
host_int_get_host_chnl_num(struct host_if_drv
*hif_drv
, u8
*pu8ChNo
)
3805 struct host_if_msg msg
;
3808 PRINT_ER("driver is null\n");
3812 memset(&msg
, 0, sizeof(struct host_if_msg
));
3814 msg
.id
= HOST_IF_MSG_GET_CHNL
;
3817 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3819 PRINT_ER("wilc mq send fail\n");
3820 down(&hif_drv
->hSemGetCHNL
);
3829 s32
host_int_get_inactive_time(struct host_if_drv
*hif_drv
,
3830 const u8
*mac
, u32
*pu32InactiveTime
)
3833 struct host_if_msg msg
;
3836 PRINT_ER("driver is null\n");
3840 memset(&msg
, 0, sizeof(struct host_if_msg
));
3843 memcpy(msg
.body
.mac_info
.mac
,
3846 msg
.id
= HOST_IF_MSG_GET_INACTIVETIME
;
3849 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3851 PRINT_ER("Failed to send get host channel param's message queue ");
3853 down(&hif_drv
->hSemInactiveTime
);
3855 *pu32InactiveTime
= gu32InactiveTime
;
3860 s32
host_int_test_get_int_wid(struct host_if_drv
*hif_drv
, u32
*pu32TestMemAddr
)
3867 PRINT_ER("driver is null\n");
3871 strWID
.id
= (u16
)WID_MEMORY_ADDRESS
;
3872 strWID
.type
= WID_INT
;
3873 strWID
.val
= (s8
*)pu32TestMemAddr
;
3874 strWID
.size
= sizeof(u32
);
3876 s32Error
= send_config_pkt(GET_CFG
, &strWID
, 1,
3877 get_id_from_handler(hif_drv
));
3880 PRINT_ER("Failed to get wid value\n");
3883 PRINT_D(HOSTINF_DBG
, "Successfully got wid value\n");
3890 s32
host_int_get_rssi(struct host_if_drv
*hif_drv
, s8
*ps8Rssi
)
3893 struct host_if_msg msg
;
3894 memset(&msg
, 0, sizeof(struct host_if_msg
));
3896 msg
.id
= HOST_IF_MSG_GET_RSSI
;
3899 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3901 PRINT_ER("Failed to send get host channel param's message queue ");
3905 down(&hif_drv
->hSemGetRSSI
);
3908 if (ps8Rssi
== NULL
) {
3909 PRINT_ER("RSS pointer value is null");
3920 s32
host_int_get_link_speed(struct host_if_drv
*hif_drv
, s8
*ps8lnkspd
)
3922 struct host_if_msg msg
;
3924 memset(&msg
, 0, sizeof(struct host_if_msg
));
3926 msg
.id
= HOST_IF_MSG_GET_LINKSPEED
;
3929 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3931 PRINT_ER("Failed to send GET_LINKSPEED to message queue ");
3935 down(&hif_drv
->hSemGetLINKSPEED
);
3938 if (ps8lnkspd
== NULL
) {
3939 PRINT_ER("LINKSPEED pointer value is null");
3944 *ps8lnkspd
= gs8lnkspd
;
3950 s32
host_int_get_statistics(struct host_if_drv
*hif_drv
, struct rf_info
*pstrStatistics
)
3953 struct host_if_msg msg
;
3954 memset(&msg
, 0, sizeof(struct host_if_msg
));
3956 msg
.id
= HOST_IF_MSG_GET_STATISTICS
;
3957 msg
.body
.data
= (char *)pstrStatistics
;
3960 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
3962 PRINT_ER("Failed to send get host channel param's message queue ");
3966 down(&hif_sema_wait_response
);
3970 s32
host_int_scan(struct host_if_drv
*hif_drv
, u8 u8ScanSource
,
3971 u8 u8ScanType
, u8
*pu8ChnlFreqList
,
3972 u8 u8ChnlListLen
, const u8
*pu8IEs
,
3973 size_t IEsLen
, wilc_scan_result ScanResult
,
3974 void *pvUserArg
, struct hidden_network
*pstrHiddenNetwork
)
3977 struct host_if_msg msg
;
3979 if (!hif_drv
|| ScanResult
== NULL
) {
3980 PRINT_ER("hif_drv or ScanResult = NULL\n");
3984 memset(&msg
, 0, sizeof(struct host_if_msg
));
3986 msg
.id
= HOST_IF_MSG_SCAN
;
3988 if (pstrHiddenNetwork
!= NULL
) {
3989 msg
.body
.scan_info
.hidden_network
.pstrHiddenNetworkInfo
= pstrHiddenNetwork
->pstrHiddenNetworkInfo
;
3990 msg
.body
.scan_info
.hidden_network
.u8ssidnum
= pstrHiddenNetwork
->u8ssidnum
;
3993 PRINT_D(HOSTINF_DBG
, "pstrHiddenNetwork IS EQUAL TO NULL\n");
3996 msg
.body
.scan_info
.src
= u8ScanSource
;
3997 msg
.body
.scan_info
.type
= u8ScanType
;
3998 msg
.body
.scan_info
.result
= ScanResult
;
3999 msg
.body
.scan_info
.arg
= pvUserArg
;
4001 msg
.body
.scan_info
.ch_list_len
= u8ChnlListLen
;
4002 msg
.body
.scan_info
.ch_freq_list
= kmalloc(u8ChnlListLen
, GFP_KERNEL
);
4003 memcpy(msg
.body
.scan_info
.ch_freq_list
, pu8ChnlFreqList
, u8ChnlListLen
);
4005 msg
.body
.scan_info
.ies_len
= IEsLen
;
4006 msg
.body
.scan_info
.ies
= kmalloc(IEsLen
, GFP_KERNEL
);
4007 memcpy(msg
.body
.scan_info
.ies
, pu8IEs
, IEsLen
);
4009 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4011 PRINT_ER("Error in sending message queue\n");
4015 PRINT_D(HOSTINF_DBG
, ">> Starting the SCAN timer\n");
4016 hif_drv
->hScanTimer
.data
= (unsigned long)hif_drv
;
4017 mod_timer(&hif_drv
->hScanTimer
,
4018 jiffies
+ msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT
));
4024 s32
hif_set_cfg(struct host_if_drv
*hif_drv
,
4025 struct cfg_param_val
*pstrCfgParamVal
)
4029 struct host_if_msg msg
;
4033 PRINT_ER("hif_drv NULL\n");
4037 memset(&msg
, 0, sizeof(struct host_if_msg
));
4038 msg
.id
= HOST_IF_MSG_CFG_PARAMS
;
4039 msg
.body
.cfg_info
.cfg_attr_info
= *pstrCfgParamVal
;
4042 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4048 s32
hif_get_cfg(struct host_if_drv
*hif_drv
, u16 u16WID
, u16
*pu16WID_Value
)
4052 down(&hif_drv
->gtOsCfgValuesSem
);
4055 PRINT_ER("hif_drv NULL\n");
4058 PRINT_D(HOSTINF_DBG
, "Getting configuration parameters\n");
4062 *pu16WID_Value
= (u16
)hif_drv
->strCfgValues
.bss_type
;
4066 *pu16WID_Value
= (u16
)hif_drv
->strCfgValues
.auth_type
;
4069 case WID_AUTH_TIMEOUT
:
4070 *pu16WID_Value
= hif_drv
->strCfgValues
.auth_timeout
;
4073 case WID_POWER_MANAGEMENT
:
4074 *pu16WID_Value
= (u16
)hif_drv
->strCfgValues
.power_mgmt_mode
;
4077 case WID_SHORT_RETRY_LIMIT
:
4078 *pu16WID_Value
= hif_drv
->strCfgValues
.short_retry_limit
;
4081 case WID_LONG_RETRY_LIMIT
:
4082 *pu16WID_Value
= hif_drv
->strCfgValues
.long_retry_limit
;
4085 case WID_FRAG_THRESHOLD
:
4086 *pu16WID_Value
= hif_drv
->strCfgValues
.frag_threshold
;
4089 case WID_RTS_THRESHOLD
:
4090 *pu16WID_Value
= hif_drv
->strCfgValues
.rts_threshold
;
4094 *pu16WID_Value
= (u16
)hif_drv
->strCfgValues
.preamble_type
;
4097 case WID_SHORT_SLOT_ALLOWED
:
4098 *pu16WID_Value
= (u16
) hif_drv
->strCfgValues
.short_slot_allowed
;
4101 case WID_11N_TXOP_PROT_DISABLE
:
4102 *pu16WID_Value
= (u16
)hif_drv
->strCfgValues
.txop_prot_disabled
;
4105 case WID_BEACON_INTERVAL
:
4106 *pu16WID_Value
= hif_drv
->strCfgValues
.beacon_interval
;
4109 case WID_DTIM_PERIOD
:
4110 *pu16WID_Value
= (u16
)hif_drv
->strCfgValues
.dtim_period
;
4113 case WID_SITE_SURVEY
:
4114 *pu16WID_Value
= (u16
)hif_drv
->strCfgValues
.site_survey_enabled
;
4117 case WID_SITE_SURVEY_SCAN_TIME
:
4118 *pu16WID_Value
= hif_drv
->strCfgValues
.site_survey_scan_time
;
4121 case WID_ACTIVE_SCAN_TIME
:
4122 *pu16WID_Value
= hif_drv
->strCfgValues
.active_scan_time
;
4125 case WID_PASSIVE_SCAN_TIME
:
4126 *pu16WID_Value
= hif_drv
->strCfgValues
.passive_scan_time
;
4129 case WID_CURRENT_TX_RATE
:
4130 *pu16WID_Value
= hif_drv
->strCfgValues
.curr_tx_rate
;
4137 up(&hif_drv
->gtOsCfgValuesSem
);
4143 void host_int_send_join_leave_info_to_host
4144 (u16 assocId
, u8
*stationAddr
, bool joining
)
4148 static void GetPeriodicRSSI(unsigned long arg
)
4150 struct host_if_drv
*hif_drv
= (struct host_if_drv
*)arg
;
4153 PRINT_ER("Driver handler is NULL\n");
4157 if (hif_drv
->enuHostIFstate
== HOST_IF_CONNECTED
) {
4159 struct host_if_msg msg
;
4161 memset(&msg
, 0, sizeof(struct host_if_msg
));
4163 msg
.id
= HOST_IF_MSG_GET_RSSI
;
4166 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4168 PRINT_ER("Failed to send get host channel param's message queue ");
4172 periodic_rssi
.data
= (unsigned long)hif_drv
;
4173 mod_timer(&periodic_rssi
, jiffies
+ msecs_to_jiffies(5000));
4177 void host_int_send_network_info_to_host
4178 (u8
*macStartAddress
, u16 u16RxFrameLen
, s8 s8Rssi
)
4182 static u32 clients_count
;
4184 s32
host_int_init(struct host_if_drv
**hif_drv_handler
)
4187 struct host_if_drv
*hif_drv
;
4190 PRINT_D(HOSTINF_DBG
, "Initializing host interface for client %d\n", clients_count
+ 1);
4192 gbScanWhileConnected
= false;
4194 sema_init(&hif_sema_wait_response
, 0);
4196 hif_drv
= kzalloc(sizeof(struct host_if_drv
), GFP_KERNEL
);
4201 *hif_drv_handler
= hif_drv
;
4202 err
= add_handler_in_list(hif_drv
);
4208 g_obtainingIP
= false;
4210 PRINT_D(HOSTINF_DBG
, "Global handle pointer value=%p\n", hif_drv
);
4211 if (clients_count
== 0) {
4212 sema_init(&hif_sema_thread
, 0);
4213 sema_init(&hif_sema_driver
, 0);
4214 sema_init(&hif_sema_deinit
, 1);
4217 sema_init(&hif_drv
->hSemTestKeyBlock
, 0);
4218 sema_init(&hif_drv
->hSemTestDisconnectBlock
, 0);
4219 sema_init(&hif_drv
->hSemGetRSSI
, 0);
4220 sema_init(&hif_drv
->hSemGetLINKSPEED
, 0);
4221 sema_init(&hif_drv
->hSemGetCHNL
, 0);
4222 sema_init(&hif_drv
->hSemInactiveTime
, 0);
4224 PRINT_D(HOSTINF_DBG
, "INIT: CLIENT COUNT %d\n", clients_count
);
4226 if (clients_count
== 0) {
4227 result
= wilc_mq_create(&hif_msg_q
);
4230 PRINT_ER("Failed to creat MQ\n");
4234 hif_thread_handler
= kthread_run(hostIFthread
, NULL
, "WILC_kthread");
4236 if (IS_ERR(hif_thread_handler
)) {
4237 PRINT_ER("Failed to creat Thread\n");
4241 setup_timer(&periodic_rssi
, GetPeriodicRSSI
,
4242 (unsigned long)hif_drv
);
4243 mod_timer(&periodic_rssi
, jiffies
+ msecs_to_jiffies(5000));
4246 setup_timer(&hif_drv
->hScanTimer
, TimerCB_Scan
, 0);
4248 setup_timer(&hif_drv
->hConnectTimer
, TimerCB_Connect
, 0);
4250 setup_timer(&hif_drv
->hRemainOnChannel
, ListenTimerCB
, 0);
4252 sema_init(&(hif_drv
->gtOsCfgValuesSem
), 1);
4253 down(&hif_drv
->gtOsCfgValuesSem
);
4255 hif_drv
->enuHostIFstate
= HOST_IF_IDLE
;
4256 hif_drv
->strCfgValues
.site_survey_enabled
= SITE_SURVEY_OFF
;
4257 hif_drv
->strCfgValues
.scan_source
= DEFAULT_SCAN
;
4258 hif_drv
->strCfgValues
.active_scan_time
= ACTIVE_SCAN_TIME
;
4259 hif_drv
->strCfgValues
.passive_scan_time
= PASSIVE_SCAN_TIME
;
4260 hif_drv
->strCfgValues
.curr_tx_rate
= AUTORATE
;
4262 hif_drv
->u64P2p_MgmtTimeout
= 0;
4264 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",
4266 hif_drv
->strCfgValues
.site_survey_enabled
, hif_drv
->strCfgValues
.scan_source
,
4267 hif_drv
->strCfgValues
.active_scan_time
, hif_drv
->strCfgValues
.passive_scan_time
,
4268 hif_drv
->strCfgValues
.curr_tx_rate
);
4270 up(&hif_drv
->gtOsCfgValuesSem
);
4277 up(&hif_drv
->gtOsCfgValuesSem
);
4278 del_timer_sync(&hif_drv
->hConnectTimer
);
4279 del_timer_sync(&hif_drv
->hScanTimer
);
4280 kthread_stop(hif_thread_handler
);
4282 wilc_mq_destroy(&hif_msg_q
);
4287 s32
host_int_deinit(struct host_if_drv
*hif_drv
)
4290 struct host_if_msg msg
;
4294 PRINT_ER("hif_drv = NULL\n");
4298 down(&hif_sema_deinit
);
4300 terminated_handle
= hif_drv
;
4301 PRINT_D(HOSTINF_DBG
, "De-initializing host interface for client %d\n", clients_count
);
4303 if (del_timer_sync(&hif_drv
->hScanTimer
)) {
4304 PRINT_D(HOSTINF_DBG
, ">> Scan timer is active\n");
4307 if (del_timer_sync(&hif_drv
->hConnectTimer
)) {
4308 PRINT_D(HOSTINF_DBG
, ">> Connect timer is active\n");
4311 if (del_timer_sync(&periodic_rssi
))
4312 PRINT_D(HOSTINF_DBG
, ">> Connect timer is active\n");
4314 del_timer_sync(&hif_drv
->hRemainOnChannel
);
4316 host_int_set_wfi_drv_handler(NULL
);
4317 down(&hif_sema_driver
);
4319 if (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
) {
4320 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult(SCAN_EVENT_ABORTED
, NULL
,
4321 hif_drv
->strWILC_UsrScanReq
.u32UserScanPvoid
, NULL
);
4323 hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
= NULL
;
4326 hif_drv
->enuHostIFstate
= HOST_IF_IDLE
;
4328 gbScanWhileConnected
= false;
4330 memset(&msg
, 0, sizeof(struct host_if_msg
));
4332 if (clients_count
== 1) {
4333 if (del_timer_sync(&periodic_rssi
))
4334 PRINT_D(HOSTINF_DBG
, ">> Connect timer is active\n");
4336 msg
.id
= HOST_IF_MSG_EXIT
;
4339 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4341 PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error
);
4343 down(&hif_sema_thread
);
4345 wilc_mq_destroy(&hif_msg_q
);
4348 down(&(hif_drv
->gtOsCfgValuesSem
));
4350 ret
= remove_handler_in_list(hif_drv
);
4357 terminated_handle
= NULL
;
4358 up(&hif_sema_deinit
);
4362 void NetworkInfoReceived(u8
*pu8Buffer
, u32 u32Length
)
4365 struct host_if_msg msg
;
4367 struct host_if_drv
*hif_drv
= NULL
;
4369 id
= ((pu8Buffer
[u32Length
- 4]) | (pu8Buffer
[u32Length
- 3] << 8) | (pu8Buffer
[u32Length
- 2] << 16) | (pu8Buffer
[u32Length
- 1] << 24));
4370 hif_drv
= get_handler_from_id(id
);
4375 if (!hif_drv
|| hif_drv
== terminated_handle
) {
4376 PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv
);
4380 memset(&msg
, 0, sizeof(struct host_if_msg
));
4382 msg
.id
= HOST_IF_MSG_RCVD_NTWRK_INFO
;
4385 msg
.body
.net_info
.len
= u32Length
;
4386 msg
.body
.net_info
.buffer
= kmalloc(u32Length
, GFP_KERNEL
);
4387 memcpy(msg
.body
.net_info
.buffer
, pu8Buffer
, u32Length
);
4389 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4391 PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error
);
4394 void GnrlAsyncInfoReceived(u8
*pu8Buffer
, u32 u32Length
)
4397 struct host_if_msg msg
;
4399 struct host_if_drv
*hif_drv
= NULL
;
4401 down(&hif_sema_deinit
);
4403 id
= ((pu8Buffer
[u32Length
- 4]) | (pu8Buffer
[u32Length
- 3] << 8) | (pu8Buffer
[u32Length
- 2] << 16) | (pu8Buffer
[u32Length
- 1] << 24));
4404 hif_drv
= get_handler_from_id(id
);
4405 PRINT_D(HOSTINF_DBG
, "General asynchronous info packet received\n");
4408 if (!hif_drv
|| hif_drv
== terminated_handle
) {
4409 PRINT_D(HOSTINF_DBG
, "Wifi driver handler is equal to NULL\n");
4410 up(&hif_sema_deinit
);
4414 if (!hif_drv
->strWILC_UsrConnReq
.pfUserConnectResult
) {
4415 PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n");
4416 up(&hif_sema_deinit
);
4420 memset(&msg
, 0, sizeof(struct host_if_msg
));
4423 msg
.id
= HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO
;
4426 msg
.body
.async_info
.len
= u32Length
;
4427 msg
.body
.async_info
.buffer
= kmalloc(u32Length
, GFP_KERNEL
);
4428 memcpy(msg
.body
.async_info
.buffer
, pu8Buffer
, u32Length
);
4430 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4432 PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", s32Error
);
4434 up(&hif_sema_deinit
);
4437 void host_int_ScanCompleteReceived(u8
*pu8Buffer
, u32 u32Length
)
4440 struct host_if_msg msg
;
4442 struct host_if_drv
*hif_drv
= NULL
;
4444 id
= ((pu8Buffer
[u32Length
- 4]) | (pu8Buffer
[u32Length
- 3] << 8) | (pu8Buffer
[u32Length
- 2] << 16) | (pu8Buffer
[u32Length
- 1] << 24));
4445 hif_drv
= get_handler_from_id(id
);
4448 PRINT_D(GENERIC_DBG
, "Scan notification received %p\n", hif_drv
);
4450 if (!hif_drv
|| hif_drv
== terminated_handle
)
4453 if (hif_drv
->strWILC_UsrScanReq
.pfUserScanResult
) {
4454 memset(&msg
, 0, sizeof(struct host_if_msg
));
4456 msg
.id
= HOST_IF_MSG_RCVD_SCAN_COMPLETE
;
4459 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4461 PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", s32Error
);
4469 s32
host_int_remain_on_channel(struct host_if_drv
*hif_drv
, u32 u32SessionID
,
4470 u32 u32duration
, u16 chan
,
4471 wilc_remain_on_chan_expired RemainOnChanExpired
,
4472 wilc_remain_on_chan_ready RemainOnChanReady
,
4476 struct host_if_msg msg
;
4479 PRINT_ER("driver is null\n");
4483 memset(&msg
, 0, sizeof(struct host_if_msg
));
4485 msg
.id
= HOST_IF_MSG_REMAIN_ON_CHAN
;
4486 msg
.body
.remain_on_ch
.u16Channel
= chan
;
4487 msg
.body
.remain_on_ch
.pRemainOnChanExpired
= RemainOnChanExpired
;
4488 msg
.body
.remain_on_ch
.pRemainOnChanReady
= RemainOnChanReady
;
4489 msg
.body
.remain_on_ch
.pVoid
= pvUserArg
;
4490 msg
.body
.remain_on_ch
.u32duration
= u32duration
;
4491 msg
.body
.remain_on_ch
.u32ListenSessionID
= u32SessionID
;
4494 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4496 PRINT_ER("wilc mq send fail\n");
4501 s32
host_int_ListenStateExpired(struct host_if_drv
*hif_drv
, u32 u32SessionID
)
4504 struct host_if_msg msg
;
4507 PRINT_ER("driver is null\n");
4511 del_timer(&hif_drv
->hRemainOnChannel
);
4513 memset(&msg
, 0, sizeof(struct host_if_msg
));
4514 msg
.id
= HOST_IF_MSG_LISTEN_TIMER_FIRED
;
4516 msg
.body
.remain_on_ch
.u32ListenSessionID
= u32SessionID
;
4518 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4520 PRINT_ER("wilc mq send fail\n");
4525 s32
host_int_frame_register(struct host_if_drv
*hif_drv
, u16 u16FrameType
, bool bReg
)
4528 struct host_if_msg msg
;
4531 PRINT_ER("driver is null\n");
4535 memset(&msg
, 0, sizeof(struct host_if_msg
));
4537 msg
.id
= HOST_IF_MSG_REGISTER_FRAME
;
4538 switch (u16FrameType
) {
4540 PRINT_D(HOSTINF_DBG
, "ACTION\n");
4541 msg
.body
.reg_frame
.u8Regid
= ACTION_FRM_IDX
;
4545 PRINT_D(HOSTINF_DBG
, "PROBE REQ\n");
4546 msg
.body
.reg_frame
.u8Regid
= PROBE_REQ_IDX
;
4550 PRINT_D(HOSTINF_DBG
, "Not valid frame type\n");
4553 msg
.body
.reg_frame
.u16FrameType
= u16FrameType
;
4554 msg
.body
.reg_frame
.bReg
= bReg
;
4557 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4559 PRINT_ER("wilc mq send fail\n");
4566 s32
host_int_add_beacon(struct host_if_drv
*hif_drv
, u32 u32Interval
,
4567 u32 u32DTIMPeriod
, u32 u32HeadLen
, u8
*pu8Head
,
4568 u32 u32TailLen
, u8
*pu8Tail
)
4571 struct host_if_msg msg
;
4572 struct beacon_attr
*pstrSetBeaconParam
= &msg
.body
.beacon_info
;
4575 PRINT_ER("driver is null\n");
4579 memset(&msg
, 0, sizeof(struct host_if_msg
));
4581 PRINT_D(HOSTINF_DBG
, "Setting adding beacon message queue params\n");
4583 msg
.id
= HOST_IF_MSG_ADD_BEACON
;
4585 pstrSetBeaconParam
->interval
= u32Interval
;
4586 pstrSetBeaconParam
->dtim_period
= u32DTIMPeriod
;
4587 pstrSetBeaconParam
->head_len
= u32HeadLen
;
4588 pstrSetBeaconParam
->head
= kmalloc(u32HeadLen
, GFP_KERNEL
);
4589 if (pstrSetBeaconParam
->head
== NULL
) {
4593 memcpy(pstrSetBeaconParam
->head
, pu8Head
, u32HeadLen
);
4594 pstrSetBeaconParam
->tail_len
= u32TailLen
;
4596 if (u32TailLen
> 0) {
4597 pstrSetBeaconParam
->tail
= kmalloc(u32TailLen
, GFP_KERNEL
);
4598 if (pstrSetBeaconParam
->tail
== NULL
) {
4602 memcpy(pstrSetBeaconParam
->tail
, pu8Tail
, u32TailLen
);
4604 pstrSetBeaconParam
->tail
= NULL
;
4607 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4609 PRINT_ER("wilc mq send fail\n");
4613 kfree(pstrSetBeaconParam
->head
);
4615 kfree(pstrSetBeaconParam
->tail
);
4622 s32
host_int_del_beacon(struct host_if_drv
*hif_drv
)
4625 struct host_if_msg msg
;
4628 PRINT_ER("driver is null\n");
4632 msg
.id
= HOST_IF_MSG_DEL_BEACON
;
4634 PRINT_D(HOSTINF_DBG
, "Setting deleting beacon message queue params\n");
4636 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4638 PRINT_ER("wilc_mq_send fail\n");
4643 s32
host_int_add_station(struct host_if_drv
*hif_drv
,
4644 struct add_sta_param
*pstrStaParams
)
4647 struct host_if_msg msg
;
4648 struct add_sta_param
*pstrAddStationMsg
= &msg
.body
.add_sta_info
;
4652 PRINT_ER("driver is null\n");
4656 memset(&msg
, 0, sizeof(struct host_if_msg
));
4658 PRINT_D(HOSTINF_DBG
, "Setting adding station message queue params\n");
4660 msg
.id
= HOST_IF_MSG_ADD_STATION
;
4663 memcpy(pstrAddStationMsg
, pstrStaParams
, sizeof(struct add_sta_param
));
4664 if (pstrAddStationMsg
->u8NumRates
> 0) {
4665 u8
*rates
= kmalloc(pstrAddStationMsg
->u8NumRates
, GFP_KERNEL
);
4670 memcpy(rates
, pstrStaParams
->pu8Rates
, pstrAddStationMsg
->u8NumRates
);
4671 pstrAddStationMsg
->pu8Rates
= rates
;
4674 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4676 PRINT_ER("wilc_mq_send fail\n");
4680 s32
host_int_del_station(struct host_if_drv
*hif_drv
, const u8
*pu8MacAddr
)
4683 struct host_if_msg msg
;
4684 struct del_sta
*pstrDelStationMsg
= &msg
.body
.del_sta_info
;
4687 PRINT_ER("driver is null\n");
4691 memset(&msg
, 0, sizeof(struct host_if_msg
));
4693 PRINT_D(HOSTINF_DBG
, "Setting deleting station message queue params\n");
4695 msg
.id
= HOST_IF_MSG_DEL_STATION
;
4698 if (pu8MacAddr
== NULL
)
4699 memset(pstrDelStationMsg
->mac_addr
, 255, ETH_ALEN
);
4701 memcpy(pstrDelStationMsg
->mac_addr
, pu8MacAddr
, ETH_ALEN
);
4703 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4705 PRINT_ER("wilc_mq_send fail\n");
4709 s32
host_int_del_allstation(struct host_if_drv
*hif_drv
,
4710 u8 pu8MacAddr
[][ETH_ALEN
])
4713 struct host_if_msg msg
;
4714 struct del_all_sta
*pstrDelAllStationMsg
= &msg
.body
.del_all_sta_info
;
4715 u8 au8Zero_Buff
[ETH_ALEN
] = {0};
4721 PRINT_ER("driver is null\n");
4725 memset(&msg
, 0, sizeof(struct host_if_msg
));
4727 PRINT_D(HOSTINF_DBG
, "Setting deauthenticating station message queue params\n");
4729 msg
.id
= HOST_IF_MSG_DEL_ALL_STA
;
4732 for (i
= 0; i
< MAX_NUM_STA
; i
++) {
4733 if (memcmp(pu8MacAddr
[i
], au8Zero_Buff
, ETH_ALEN
)) {
4734 memcpy(pstrDelAllStationMsg
->del_all_sta
[i
], pu8MacAddr
[i
], ETH_ALEN
);
4735 PRINT_D(CFG80211_DBG
, "BSSID = %x%x%x%x%x%x\n",
4736 pstrDelAllStationMsg
->del_all_sta
[i
][0],
4737 pstrDelAllStationMsg
->del_all_sta
[i
][1],
4738 pstrDelAllStationMsg
->del_all_sta
[i
][2],
4739 pstrDelAllStationMsg
->del_all_sta
[i
][3],
4740 pstrDelAllStationMsg
->del_all_sta
[i
][4],
4741 pstrDelAllStationMsg
->del_all_sta
[i
][5]);
4746 PRINT_D(CFG80211_DBG
, "NO ASSOCIATED STAS\n");
4750 pstrDelAllStationMsg
->assoc_sta
= u8AssocNumb
;
4751 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4754 PRINT_ER("wilc_mq_send fail\n");
4756 down(&hif_sema_wait_response
);
4762 s32
host_int_edit_station(struct host_if_drv
*hif_drv
,
4763 struct add_sta_param
*pstrStaParams
)
4766 struct host_if_msg msg
;
4767 struct add_sta_param
*pstrAddStationMsg
= &msg
.body
.add_sta_info
;
4770 PRINT_ER("driver is null\n");
4774 PRINT_D(HOSTINF_DBG
, "Setting editing station message queue params\n");
4776 memset(&msg
, 0, sizeof(struct host_if_msg
));
4778 msg
.id
= HOST_IF_MSG_EDIT_STATION
;
4781 memcpy(pstrAddStationMsg
, pstrStaParams
, sizeof(struct add_sta_param
));
4782 if (pstrAddStationMsg
->u8NumRates
> 0) {
4783 u8
*rates
= kmalloc(pstrAddStationMsg
->u8NumRates
, GFP_KERNEL
);
4788 memcpy(rates
, pstrStaParams
->pu8Rates
, pstrAddStationMsg
->u8NumRates
);
4789 pstrAddStationMsg
->pu8Rates
= rates
;
4792 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4794 PRINT_ER("wilc_mq_send fail\n");
4799 s32
host_int_set_power_mgmt(struct host_if_drv
*hif_drv
,
4804 struct host_if_msg msg
;
4805 struct power_mgmt_param
*pstrPowerMgmtParam
= &msg
.body
.pwr_mgmt_info
;
4807 PRINT_INFO(HOSTINF_DBG
, "\n\n>> Setting PS to %d <<\n\n", bIsEnabled
);
4810 PRINT_ER("driver is null\n");
4814 PRINT_D(HOSTINF_DBG
, "Setting Power management message queue params\n");
4816 memset(&msg
, 0, sizeof(struct host_if_msg
));
4818 msg
.id
= HOST_IF_MSG_POWER_MGMT
;
4821 pstrPowerMgmtParam
->enabled
= bIsEnabled
;
4822 pstrPowerMgmtParam
->timeout
= u32Timeout
;
4824 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4826 PRINT_ER("wilc_mq_send fail\n");
4830 s32
host_int_setup_multicast_filter(struct host_if_drv
*hif_drv
,
4835 struct host_if_msg msg
;
4836 struct set_multicast
*pstrMulticastFilterParam
= &msg
.body
.multicast_info
;
4840 PRINT_ER("driver is null\n");
4844 PRINT_D(HOSTINF_DBG
, "Setting Multicast Filter params\n");
4846 memset(&msg
, 0, sizeof(struct host_if_msg
));
4848 msg
.id
= HOST_IF_MSG_SET_MULTICAST_FILTER
;
4851 pstrMulticastFilterParam
->enabled
= bIsEnabled
;
4852 pstrMulticastFilterParam
->cnt
= u32count
;
4854 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
4856 PRINT_ER("wilc_mq_send fail\n");
4860 static void *host_int_ParseJoinBssParam(tstrNetworkInfo
*ptstrNetworkInfo
)
4862 struct join_bss_param
*pNewJoinBssParam
= NULL
;
4871 u8 pcipherTotalCount
= 0;
4872 u8 authTotalCount
= 0;
4875 pu8IEs
= ptstrNetworkInfo
->pu8IEs
;
4876 u16IEsLen
= ptstrNetworkInfo
->u16IEsLen
;
4878 pNewJoinBssParam
= kzalloc(sizeof(struct join_bss_param
), GFP_KERNEL
);
4879 if (pNewJoinBssParam
!= NULL
) {
4880 pNewJoinBssParam
->dtim_period
= ptstrNetworkInfo
->u8DtimPeriod
;
4881 pNewJoinBssParam
->beacon_period
= ptstrNetworkInfo
->u16BeaconPeriod
;
4882 pNewJoinBssParam
->cap_info
= ptstrNetworkInfo
->u16CapInfo
;
4883 memcpy(pNewJoinBssParam
->au8bssid
, ptstrNetworkInfo
->au8bssid
, 6);
4884 memcpy((u8
*)pNewJoinBssParam
->ssid
, ptstrNetworkInfo
->au8ssid
, ptstrNetworkInfo
->u8SsidLen
+ 1);
4885 pNewJoinBssParam
->ssid_len
= ptstrNetworkInfo
->u8SsidLen
;
4886 memset(pNewJoinBssParam
->rsn_pcip_policy
, 0xFF, 3);
4887 memset(pNewJoinBssParam
->rsn_auth_policy
, 0xFF, 3);
4889 while (index
< u16IEsLen
) {
4890 if (pu8IEs
[index
] == SUPP_RATES_IE
) {
4891 suppRatesNo
= pu8IEs
[index
+ 1];
4892 pNewJoinBssParam
->supp_rates
[0] = suppRatesNo
;
4895 for (i
= 0; i
< suppRatesNo
; i
++) {
4896 pNewJoinBssParam
->supp_rates
[i
+ 1] = pu8IEs
[index
+ i
];
4898 index
+= suppRatesNo
;
4900 } else if (pu8IEs
[index
] == EXT_SUPP_RATES_IE
) {
4901 extSuppRatesNo
= pu8IEs
[index
+ 1];
4902 if (extSuppRatesNo
> (MAX_RATES_SUPPORTED
- suppRatesNo
))
4903 pNewJoinBssParam
->supp_rates
[0] = MAX_RATES_SUPPORTED
;
4905 pNewJoinBssParam
->supp_rates
[0] += extSuppRatesNo
;
4907 for (i
= 0; i
< (pNewJoinBssParam
->supp_rates
[0] - suppRatesNo
); i
++) {
4908 pNewJoinBssParam
->supp_rates
[suppRatesNo
+ i
+ 1] = pu8IEs
[index
+ i
];
4910 index
+= extSuppRatesNo
;
4912 } else if (pu8IEs
[index
] == HT_CAPABILITY_IE
) {
4913 pNewJoinBssParam
->ht_capable
= true;
4914 index
+= pu8IEs
[index
+ 1] + 2;
4916 } else if ((pu8IEs
[index
] == WMM_IE
) &&
4917 (pu8IEs
[index
+ 2] == 0x00) && (pu8IEs
[index
+ 3] == 0x50) &&
4918 (pu8IEs
[index
+ 4] == 0xF2) &&
4919 (pu8IEs
[index
+ 5] == 0x02) &&
4920 ((pu8IEs
[index
+ 6] == 0x00) || (pu8IEs
[index
+ 6] == 0x01)) &&
4921 (pu8IEs
[index
+ 7] == 0x01)) {
4922 pNewJoinBssParam
->wmm_cap
= true;
4924 if (pu8IEs
[index
+ 8] & BIT(7))
4925 pNewJoinBssParam
->uapsd_cap
= true;
4926 index
+= pu8IEs
[index
+ 1] + 2;
4928 } else if ((pu8IEs
[index
] == P2P_IE
) &&
4929 (pu8IEs
[index
+ 2] == 0x50) && (pu8IEs
[index
+ 3] == 0x6f) &&
4930 (pu8IEs
[index
+ 4] == 0x9a) &&
4931 (pu8IEs
[index
+ 5] == 0x09) && (pu8IEs
[index
+ 6] == 0x0c)) {
4934 pNewJoinBssParam
->tsf
= ptstrNetworkInfo
->u32Tsf
;
4935 pNewJoinBssParam
->noa_enabled
= 1;
4936 pNewJoinBssParam
->idx
= pu8IEs
[index
+ 9];
4938 if (pu8IEs
[index
+ 10] & BIT(7)) {
4939 pNewJoinBssParam
->opp_enabled
= 1;
4940 pNewJoinBssParam
->ct_window
= pu8IEs
[index
+ 10];
4942 pNewJoinBssParam
->opp_enabled
= 0;
4945 PRINT_D(GENERIC_DBG
, "P2P Dump\n");
4946 for (i
= 0; i
< pu8IEs
[index
+ 7]; i
++)
4947 PRINT_D(GENERIC_DBG
, " %x\n", pu8IEs
[index
+ 9 + i
]);
4949 pNewJoinBssParam
->cnt
= pu8IEs
[index
+ 11];
4950 u16P2P_count
= index
+ 12;
4952 memcpy(pNewJoinBssParam
->duration
, pu8IEs
+ u16P2P_count
, 4);
4955 memcpy(pNewJoinBssParam
->interval
, pu8IEs
+ u16P2P_count
, 4);
4958 memcpy(pNewJoinBssParam
->au8StartTime
, pu8IEs
+ u16P2P_count
, 4);
4960 index
+= pu8IEs
[index
+ 1] + 2;
4963 } else if ((pu8IEs
[index
] == RSN_IE
) ||
4964 ((pu8IEs
[index
] == WPA_IE
) && (pu8IEs
[index
+ 2] == 0x00) &&
4965 (pu8IEs
[index
+ 3] == 0x50) && (pu8IEs
[index
+ 4] == 0xF2) &&
4966 (pu8IEs
[index
+ 5] == 0x01))) {
4967 u16 rsnIndex
= index
;
4969 if (pu8IEs
[rsnIndex
] == RSN_IE
) {
4970 pNewJoinBssParam
->mode_802_11i
= 2;
4972 if (pNewJoinBssParam
->mode_802_11i
== 0)
4973 pNewJoinBssParam
->mode_802_11i
= 1;
4978 pNewJoinBssParam
->rsn_grp_policy
= pu8IEs
[rsnIndex
];
4980 jumpOffset
= pu8IEs
[rsnIndex
] * 4;
4981 pcipherCount
= (pu8IEs
[rsnIndex
] > 3) ? 3 : pu8IEs
[rsnIndex
];
4984 for (i
= pcipherTotalCount
, j
= 0; i
< pcipherCount
+ pcipherTotalCount
&& i
< 3; i
++, j
++) {
4985 pNewJoinBssParam
->rsn_pcip_policy
[i
] = pu8IEs
[rsnIndex
+ ((j
+ 1) * 4) - 1];
4987 pcipherTotalCount
+= pcipherCount
;
4988 rsnIndex
+= jumpOffset
;
4990 jumpOffset
= pu8IEs
[rsnIndex
] * 4;
4992 authCount
= (pu8IEs
[rsnIndex
] > 3) ? 3 : pu8IEs
[rsnIndex
];
4995 for (i
= authTotalCount
, j
= 0; i
< authTotalCount
+ authCount
; i
++, j
++) {
4996 pNewJoinBssParam
->rsn_auth_policy
[i
] = pu8IEs
[rsnIndex
+ ((j
+ 1) * 4) - 1];
4998 authTotalCount
+= authCount
;
4999 rsnIndex
+= jumpOffset
;
5001 if (pu8IEs
[index
] == RSN_IE
) {
5002 pNewJoinBssParam
->rsn_cap
[0] = pu8IEs
[rsnIndex
];
5003 pNewJoinBssParam
->rsn_cap
[1] = pu8IEs
[rsnIndex
+ 1];
5006 pNewJoinBssParam
->rsn_found
= true;
5007 index
+= pu8IEs
[index
+ 1] + 2;
5010 index
+= pu8IEs
[index
+ 1] + 2;
5017 return (void *)pNewJoinBssParam
;
5021 void host_int_freeJoinParams(void *pJoinParams
)
5023 if ((struct bss_param
*)pJoinParams
!= NULL
)
5024 kfree((struct bss_param
*)pJoinParams
);
5026 PRINT_ER("Unable to FREE null pointer\n");
5029 s32
host_int_delBASession(struct host_if_drv
*hif_drv
, char *pBSSID
, char TID
)
5032 struct host_if_msg msg
;
5033 struct ba_session_info
*pBASessionInfo
= &msg
.body
.session_info
;
5036 PRINT_ER("driver is null\n");
5040 memset(&msg
, 0, sizeof(struct host_if_msg
));
5042 msg
.id
= HOST_IF_MSG_DEL_BA_SESSION
;
5044 memcpy(pBASessionInfo
->au8Bssid
, pBSSID
, ETH_ALEN
);
5045 pBASessionInfo
->u8Ted
= TID
;
5048 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
5050 PRINT_ER("wilc_mq_send fail\n");
5052 down(&hif_sema_wait_response
);
5057 s32
host_int_del_All_Rx_BASession(struct host_if_drv
*hif_drv
,
5062 struct host_if_msg msg
;
5063 struct ba_session_info
*pBASessionInfo
= &msg
.body
.session_info
;
5066 PRINT_ER("driver is null\n");
5070 memset(&msg
, 0, sizeof(struct host_if_msg
));
5072 msg
.id
= HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS
;
5074 memcpy(pBASessionInfo
->au8Bssid
, pBSSID
, ETH_ALEN
);
5075 pBASessionInfo
->u8Ted
= TID
;
5078 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
5080 PRINT_ER("wilc_mq_send fail\n");
5082 down(&hif_sema_wait_response
);
5087 s32
host_int_setup_ipaddress(struct host_if_drv
*hif_drv
, u8
*u16ipadd
, u8 idx
)
5090 struct host_if_msg msg
;
5095 PRINT_ER("driver is null\n");
5099 memset(&msg
, 0, sizeof(struct host_if_msg
));
5101 msg
.id
= HOST_IF_MSG_SET_IPADDRESS
;
5103 msg
.body
.ip_info
.ip_addr
= u16ipadd
;
5105 msg
.body
.ip_info
.idx
= idx
;
5107 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
5109 PRINT_ER("wilc_mq_send fail\n");
5116 s32
host_int_get_ipaddress(struct host_if_drv
*hif_drv
, u8
*u16ipadd
, u8 idx
)
5119 struct host_if_msg msg
;
5122 PRINT_ER("driver is null\n");
5126 memset(&msg
, 0, sizeof(struct host_if_msg
));
5128 msg
.id
= HOST_IF_MSG_GET_IPADDRESS
;
5130 msg
.body
.ip_info
.ip_addr
= u16ipadd
;
5132 msg
.body
.ip_info
.idx
= idx
;
5134 s32Error
= wilc_mq_send(&hif_msg_q
, &msg
, sizeof(struct host_if_msg
));
5136 PRINT_ER("wilc_mq_send fail\n");