]>
Commit | Line | Data |
---|---|---|
c5c77ba1 | 1 | #include "host_interface.h" |
c5c77ba1 JK |
2 | #include "coreconfigurator.h" |
3 | ||
63d03e47 | 4 | extern u8 connecting; |
c5c77ba1 JK |
5 | |
6 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP | |
da711eb6 | 7 | extern struct timer_list hDuringIpTimer; |
c5c77ba1 JK |
8 | #endif |
9 | ||
c5c77ba1 | 10 | /*BugID_5137*/ |
63d03e47 | 11 | extern u8 g_wilc_initialized; |
c5c77ba1 JK |
12 | /*****************************************************************************/ |
13 | /* Macros */ | |
14 | /*****************************************************************************/ | |
15 | ||
16 | /* Message types of the Host IF Message Queue*/ | |
9eac3a15 CL |
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 | |
d85f5326 | 56 | |
e54d5b75 CL |
57 | #define HOST_IF_SCAN_TIMEOUT 4000 |
58 | #define HOST_IF_CONNECT_TIMEOUT 9500 | |
c5c77ba1 | 59 | |
e54d5b75 CL |
60 | #define BA_SESSION_DEFAULT_BUFFER_SIZE 16 |
61 | #define BA_SESSION_DEFAULT_TIMEOUT 1000 | |
62 | #define BLOCK_ACK_REQ_SIZE 0x14 | |
c5c77ba1 JK |
63 | /*****************************************************************************/ |
64 | /* Type Definitions */ | |
65 | /*****************************************************************************/ | |
66 | ||
67 | /*! | |
68 | * @struct tstrHostIFCfgParamAttr | |
69 | * @brief Structure to hold Host IF CFG Params Attributes | |
70 | * @details | |
71 | * @todo | |
72 | * @sa | |
73 | * @author Mai Daftedar | |
74 | * @date 02 April 2012 | |
75 | * @version 1.0 | |
76 | */ | |
77 | typedef struct _tstrHostIFCfgParamAttr { | |
78 | tstrCfgParamVal pstrCfgParamVal; | |
79 | ||
80 | } tstrHostIFCfgParamAttr; | |
81 | ||
82 | /*! | |
83 | * @struct tstrHostIFwpaAttr | |
84 | * @brief Structure to hold Host IF Scan Attributes | |
85 | * @details | |
86 | * @todo | |
87 | * @sa | |
88 | * @author Mai Daftedar | |
89 | * @date 25 March 2012 | |
90 | * @version 1.0 | |
91 | */ | |
92 | typedef struct _tstrHostIFwpaAttr { | |
63d03e47 GKH |
93 | u8 *pu8key; |
94 | const u8 *pu8macaddr; | |
95 | u8 *pu8seq; | |
96 | u8 u8seqlen; | |
97 | u8 u8keyidx; | |
98 | u8 u8Keylen; | |
99 | u8 u8Ciphermode; | |
c5c77ba1 JK |
100 | } tstrHostIFwpaAttr; |
101 | ||
102 | ||
103 | /*! | |
104 | * @struct tstrHostIFwepAttr | |
105 | * @brief Structure to hold Host IF Scan Attributes | |
106 | * @details | |
107 | * @todo | |
108 | * @sa | |
109 | * @author Mai Daftedar | |
110 | * @date 25 March 2012 | |
111 | * @version 1.0 | |
112 | */ | |
113 | typedef struct _tstrHostIFwepAttr { | |
63d03e47 GKH |
114 | u8 *pu8WepKey; |
115 | u8 u8WepKeylen; | |
116 | u8 u8Wepidx; | |
117 | u8 u8mode; | |
c5c77ba1 JK |
118 | AUTHTYPE_T tenuAuth_type; |
119 | ||
120 | } tstrHostIFwepAttr; | |
121 | ||
122 | /*! | |
123 | * @struct tuniHostIFkeyAttr | |
124 | * @brief Structure to hold Host IF Scan Attributes | |
125 | * @details | |
126 | * @todo | |
127 | * @sa | |
128 | * @author Mai Daftedar | |
129 | * @date 25 March 2012 | |
130 | * @version 1.0 | |
131 | */ | |
132 | typedef union _tuniHostIFkeyAttr { | |
133 | tstrHostIFwepAttr strHostIFwepAttr; | |
134 | tstrHostIFwpaAttr strHostIFwpaAttr; | |
135 | tstrHostIFpmkidAttr strHostIFpmkidAttr; | |
136 | } tuniHostIFkeyAttr; | |
137 | ||
138 | /*! | |
139 | * @struct tstrHostIFkeyAttr | |
140 | * @brief Structure to hold Host IF Scan Attributes | |
141 | * @details | |
142 | * @todo | |
143 | * @sa | |
144 | * @author Mai Daftedar | |
145 | * @date 25 March 2012 | |
146 | * @version 1.0 | |
147 | */ | |
148 | typedef struct _tstrHostIFkeyAttr { | |
149 | tenuKeyType enuKeyType; | |
63d03e47 | 150 | u8 u8KeyAction; |
c5c77ba1 JK |
151 | tuniHostIFkeyAttr uniHostIFkeyAttr; |
152 | } tstrHostIFkeyAttr; | |
153 | ||
154 | ||
155 | ||
156 | ||
157 | /*! | |
158 | * @struct tstrHostIFscanAttr | |
159 | * @brief Structure to hold Host IF Scan Attributes | |
160 | * @details | |
161 | * @todo | |
162 | * @sa | |
163 | * @author Mostafa Abu Bakr | |
164 | * @date 25 March 2012 | |
165 | * @version 1.0 | |
166 | */ | |
167 | typedef struct _tstrHostIFscanAttr { | |
63d03e47 GKH |
168 | u8 u8ScanSource; |
169 | u8 u8ScanType; | |
170 | u8 *pu8ChnlFreqList; | |
171 | u8 u8ChnlListLen; | |
172 | u8 *pu8IEs; | |
c5c77ba1 JK |
173 | size_t IEsLen; |
174 | tWILCpfScanResult pfScanResult; | |
175 | void *pvUserArg; | |
176 | /*BugID_4189*/ | |
177 | tstrHiddenNetwork strHiddenNetwork; | |
178 | ||
179 | } tstrHostIFscanAttr; | |
180 | ||
181 | /*! | |
182 | * @struct tstrHostIFconnectAttr | |
183 | * @brief Structure to hold Host IF Connect Attributes | |
184 | * @details | |
185 | * @todo | |
186 | * @sa | |
187 | * @author Mostafa Abu Bakr | |
188 | * @date 25 March 2012 | |
189 | * @version 1.0 | |
190 | */ | |
191 | typedef struct _tstrHostIFconnectAttr { | |
63d03e47 GKH |
192 | u8 *pu8bssid; |
193 | u8 *pu8ssid; | |
c5c77ba1 | 194 | size_t ssidLen; |
63d03e47 | 195 | u8 *pu8IEs; |
c5c77ba1 | 196 | size_t IEsLen; |
63d03e47 | 197 | u8 u8security; |
c5c77ba1 JK |
198 | tWILCpfConnectResult pfConnectResult; |
199 | void *pvUserArg; | |
200 | AUTHTYPE_T tenuAuth_type; | |
63d03e47 | 201 | u8 u8channel; |
c5c77ba1 JK |
202 | void *pJoinParams; |
203 | } tstrHostIFconnectAttr; | |
204 | ||
205 | /*! | |
206 | * @struct tstrRcvdGnrlAsyncInfo | |
207 | * @brief Structure to hold Received General Asynchronous info | |
208 | * @details | |
209 | * @todo | |
210 | * @sa | |
211 | * @author Mostafa Abu Bakr | |
212 | * @date 25 March 2012 | |
213 | * @version 1.0 | |
214 | */ | |
215 | typedef struct _tstrRcvdGnrlAsyncInfo { | |
63d03e47 | 216 | u8 *pu8Buffer; |
4e4467fd | 217 | u32 u32Length; |
c5c77ba1 JK |
218 | } tstrRcvdGnrlAsyncInfo; |
219 | ||
220 | /*! | |
221 | * @struct tstrHostIFSetChan | |
222 | * @brief Set Channel message body | |
223 | * @details | |
224 | * @todo | |
225 | * @sa | |
226 | * @author Mai Daftedar | |
227 | * @date 25 March 2012 | |
228 | * @version 1.0 | |
229 | */ | |
230 | typedef struct _tstrHostIFSetChan { | |
63d03e47 | 231 | u8 u8SetChan; |
c5c77ba1 JK |
232 | } tstrHostIFSetChan; |
233 | ||
234 | /*! | |
235 | * @struct tstrHostIFSetChan | |
236 | * @brief Get Channel message body | |
237 | * @details | |
238 | * @todo | |
239 | * @sa | |
240 | * @author Mai Daftedar | |
241 | * @date 01 Jule 2012 | |
242 | * @version 1.0 | |
243 | */ | |
244 | typedef struct _tstrHostIFGetChan { | |
63d03e47 | 245 | u8 u8GetChan; |
c5c77ba1 JK |
246 | } tstrHostIFGetChan; |
247 | ||
248 | /*bug3819: Add Scan acomplete notification to host*/ | |
249 | /*! | |
250 | * @struct tstrScanComplete | |
251 | * @brief hold received Async. Scan Complete message body | |
252 | * @details | |
253 | * @todo | |
254 | * @sa | |
255 | * @author zsalah | |
256 | * @date 25 March 2012 | |
257 | * @version 1.0 | |
258 | */ | |
259 | /*typedef struct _tstrScanComplete | |
260 | * { | |
63d03e47 | 261 | * u8* pu8Buffer; |
4e4467fd | 262 | * u32 u32Length; |
c5c77ba1 JK |
263 | * } tstrScanComplete;*/ |
264 | ||
265 | /*! | |
266 | * @struct tstrHostIFSetBeacon | |
267 | * @brief Set Beacon message body | |
268 | * @details | |
269 | * @todo | |
270 | * @sa | |
271 | * @author Adham Abozaeid | |
272 | * @date 10 July 2012 | |
273 | * @version 1.0 | |
274 | */ | |
275 | typedef struct _tstrHostIFSetBeacon { | |
4e4467fd CL |
276 | u32 u32Interval; /*!< Beacon Interval. Period between two successive beacons on air */ |
277 | u32 u32DTIMPeriod; /*!< DTIM Period. Indicates how many Beacon frames | |
c5c77ba1 | 278 | * (including the current frame) appear before the next DTIM */ |
4e4467fd | 279 | u32 u32HeadLen; /*!< Length of the head buffer in bytes */ |
63d03e47 | 280 | u8 *pu8Head; /*!< Pointer to the beacon's head buffer. Beacon's head is the part |
c5c77ba1 | 281 | * from the beacon's start till the TIM element, NOT including the TIM */ |
4e4467fd | 282 | u32 u32TailLen; /*!< Length of the tail buffer in bytes */ |
63d03e47 | 283 | u8 *pu8Tail; /*!< Pointer to the beacon's tail buffer. Beacon's tail starts just |
c5c77ba1 JK |
284 | * after the TIM inormation element */ |
285 | } tstrHostIFSetBeacon; | |
286 | ||
287 | ||
288 | ||
289 | /*! | |
290 | * @struct tstrHostIFDelBeacon | |
291 | * @brief Del Beacon message body | |
292 | * @details | |
293 | * @todo | |
294 | * @sa | |
295 | * @author Adham Abozaeid | |
296 | * @date 15 July 2012 | |
297 | * @version 1.0 | |
298 | */ | |
299 | typedef struct _tstrHostIFDelBeacon { | |
63d03e47 | 300 | u8 u8dummy; |
c5c77ba1 JK |
301 | } tstrHostIFDelBeacon; |
302 | ||
303 | /*! | |
304 | * @struct tstrHostIFSetMulti | |
305 | * @brief set Multicast filter Address | |
306 | * @details | |
307 | * @todo | |
308 | * @sa | |
309 | * @author Abdelrahman Sobhy | |
310 | * @date 30 August 2013 | |
311 | * @version 1.0 Description | |
312 | */ | |
313 | ||
314 | typedef struct { | |
72ed4dc7 | 315 | bool bIsEnabled; |
4e4467fd | 316 | u32 u32count; |
c5c77ba1 JK |
317 | } tstrHostIFSetMulti; |
318 | ||
319 | /*! | |
320 | * @struct tstrHostIFDelAllSta | |
321 | * @brief Deauth station message body | |
322 | * @details | |
323 | * @todo | |
324 | * @sa | |
325 | * @author Mai Daftedar | |
326 | * @date 09 April 2014 | |
327 | * @version 1.0 Description | |
328 | */ | |
329 | ||
330 | typedef struct { | |
63d03e47 GKH |
331 | u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN]; |
332 | u8 u8Num_AssocSta; | |
c5c77ba1 JK |
333 | } tstrHostIFDelAllSta; |
334 | ||
335 | /*! | |
336 | * @struct tstrHostIFDelSta | |
337 | * @brief Delete station message body | |
338 | * @details | |
339 | * @todo | |
340 | * @sa | |
341 | * @author Adham Abozaeid | |
342 | * @date 15 July 2012 | |
343 | * @version 1.0 Description | |
344 | */ | |
345 | ||
346 | typedef struct { | |
63d03e47 | 347 | u8 au8MacAddr[ETH_ALEN]; |
c5c77ba1 JK |
348 | } tstrHostIFDelSta; |
349 | ||
350 | /*! | |
351 | * @struct tstrTimerCb | |
352 | * @brief Timer callback message body | |
353 | * @details | |
354 | * @todo | |
355 | * @sa | |
356 | * @author Mostafa Abu Bakr | |
357 | * @date 25 March 2012 | |
358 | * @version 1.0 | |
359 | */ | |
360 | typedef struct _tstrTimerCb { | |
361 | void *pvUsrArg; /*!< Private data passed at timer start */ | |
362 | } tstrTimerCb; | |
363 | ||
364 | /*! | |
365 | * @struct tstrHostIfPowerMgmtParam | |
366 | * @brief Power management message body | |
367 | * @details | |
368 | * @todo | |
369 | * @sa | |
370 | * @author Adham Abozaeid | |
371 | * @date 24 November 2012 | |
372 | * @version 1.0 | |
373 | */ | |
374 | typedef struct { | |
375 | ||
72ed4dc7 | 376 | bool bIsEnabled; |
4e4467fd | 377 | u32 u32Timeout; |
c5c77ba1 JK |
378 | } tstrHostIfPowerMgmtParam; |
379 | ||
380 | /*! | |
381 | * @struct tstrHostIFSetIPAddr | |
382 | * @brief set IP Address message body | |
383 | * @details | |
384 | * @todo | |
385 | * @sa | |
386 | * @author Abdelrahman Sobhy | |
387 | * @date 30 August 2013 | |
388 | * @version 1.0 Description | |
389 | */ | |
390 | ||
391 | typedef struct { | |
63d03e47 GKH |
392 | u8 *au8IPAddr; |
393 | u8 idx; | |
c5c77ba1 JK |
394 | } tstrHostIFSetIPAddr; |
395 | ||
396 | /*! | |
397 | * @struct tstrHostIfStaInactiveT | |
398 | * @brief Get station message body | |
399 | * @details | |
400 | * @todo | |
401 | * @sa | |
402 | * @author Mai Daftedar | |
403 | * @date 16 April 2013 | |
404 | * @version 1.0 | |
405 | */ | |
406 | typedef struct { | |
63d03e47 | 407 | u8 mac[6]; |
c5c77ba1 JK |
408 | |
409 | } tstrHostIfStaInactiveT; | |
410 | /**/ | |
411 | /*! | |
412 | * @union tuniHostIFmsgBody | |
413 | * @brief Message body for the Host Interface message_q | |
414 | * @details | |
415 | * @todo | |
416 | * @sa | |
417 | * @author Mostafa Abu Bakr | |
418 | * @date 25 March 2012 | |
419 | * @version 1.0 | |
420 | */ | |
421 | typedef union _tuniHostIFmsgBody { | |
422 | tstrHostIFscanAttr strHostIFscanAttr; /*!< Host IF Scan Request Attributes message body */ | |
423 | tstrHostIFconnectAttr strHostIFconnectAttr; /*!< Host IF Connect Request Attributes message body */ | |
424 | tstrRcvdNetworkInfo strRcvdNetworkInfo; /*!< Received Asynchronous Network Info message body */ | |
425 | tstrRcvdGnrlAsyncInfo strRcvdGnrlAsyncInfo; /*!< Received General Asynchronous Info message body */ | |
426 | tstrHostIFkeyAttr strHostIFkeyAttr; /*!<>*/ | |
427 | tstrHostIFCfgParamAttr strHostIFCfgParamAttr; /*! <CFG Parameter message Body> */ | |
428 | tstrHostIFSetChan strHostIFSetChan; | |
429 | tstrHostIFGetChan strHostIFGetChan; | |
430 | tstrHostIFSetBeacon strHostIFSetBeacon; /*!< Set beacon message body */ | |
431 | tstrHostIFDelBeacon strHostIFDelBeacon; /*!< Del beacon message body */ | |
432 | tstrWILC_AddStaParam strAddStaParam; /*!< Add station message body */ | |
433 | tstrHostIFDelSta strDelStaParam; /*!< Del Station message body */ | |
434 | tstrWILC_AddStaParam strEditStaParam; /*!< Edit station message body */ | |
435 | /* tstrScanComplete strScanComplete; / *Received Async. Scan Complete message body* / */ | |
436 | tstrTimerCb strTimerCb; /*!< Timer callback message body */ | |
437 | tstrHostIfPowerMgmtParam strPowerMgmtparam; /*!< Power Management message body */ | |
438 | tstrHostIfStaInactiveT strHostIfStaInactiveT; | |
439 | tstrHostIFSetIPAddr strHostIfSetIP; | |
440 | tstrHostIfSetDrvHandler strHostIfSetDrvHandler; | |
441 | tstrHostIFSetMulti strHostIfSetMulti; | |
442 | tstrHostIfSetOperationMode strHostIfSetOperationMode; | |
443 | tstrHostIfSetMacAddress strHostIfSetMacAddress; | |
444 | tstrHostIfGetMacAddress strHostIfGetMacAddress; | |
445 | tstrHostIfBASessionInfo strHostIfBASessionInfo; | |
446 | #ifdef WILC_P2P | |
447 | tstrHostIfRemainOnChan strHostIfRemainOnChan; | |
448 | tstrHostIfRegisterFrame strHostIfRegisterFrame; | |
449 | #endif | |
576917ad | 450 | char *pUserData; |
c5c77ba1 JK |
451 | tstrHostIFDelAllSta strHostIFDelAllSta; |
452 | } tuniHostIFmsgBody; | |
453 | ||
454 | /*! | |
455 | * @struct tstrHostIFmsg | |
456 | * @brief Host Interface message | |
457 | * @details | |
458 | * @todo | |
459 | * @sa | |
460 | * @author Mostafa Abu Bakr | |
461 | * @date 25 March 2012 | |
462 | * @version 1.0 | |
463 | */ | |
464 | typedef struct _tstrHostIFmsg { | |
d85f5326 | 465 | u16 u16MsgId; /*!< Message ID */ |
c5c77ba1 | 466 | tuniHostIFmsgBody uniHostIFmsgBody; /*!< Message body */ |
11f58c88 | 467 | tstrWILC_WFIDrv *drvHandler; |
c5c77ba1 JK |
468 | } tstrHostIFmsg; |
469 | ||
470 | #ifdef CONNECT_DIRECT | |
471 | typedef struct _tstrWidJoinReqExt { | |
576917ad | 472 | char SSID[MAX_SSID_LEN]; |
63d03e47 GKH |
473 | u8 u8channel; |
474 | u8 BSSID[6]; | |
c5c77ba1 JK |
475 | } tstrWidJoinReqExt; |
476 | #endif | |
477 | ||
478 | /*Bug4218: Parsing Join Param*/ | |
479 | #ifdef WILC_PARSE_SCAN_IN_HOST | |
480 | /*Struct containg joinParam of each AP*/ | |
481 | typedef struct _tstrJoinBssParam { | |
482 | BSSTYPE_T bss_type; | |
63d03e47 | 483 | u8 dtim_period; |
d85f5326 CL |
484 | u16 beacon_period; |
485 | u16 cap_info; | |
63d03e47 | 486 | u8 au8bssid[6]; |
576917ad | 487 | char ssid[MAX_SSID_LEN]; |
63d03e47 GKH |
488 | u8 ssidLen; |
489 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; | |
490 | u8 ht_capable; | |
491 | u8 wmm_cap; | |
492 | u8 uapsd_cap; | |
72ed4dc7 | 493 | bool rsn_found; |
63d03e47 GKH |
494 | u8 rsn_grp_policy; |
495 | u8 mode_802_11i; | |
496 | u8 rsn_pcip_policy[3]; | |
497 | u8 rsn_auth_policy[3]; | |
498 | u8 rsn_cap[2]; | |
c5c77ba1 JK |
499 | struct _tstrJoinParam *nextJoinBss; |
500 | #ifdef WILC_P2P | |
4e4467fd | 501 | u32 tsf; |
63d03e47 GKH |
502 | u8 u8NoaEnbaled; |
503 | u8 u8OppEnable; | |
504 | u8 u8CtWindow; | |
505 | u8 u8Count; | |
506 | u8 u8Index; | |
507 | u8 au8Duration[4]; | |
508 | u8 au8Interval[4]; | |
509 | u8 au8StartTime[4]; | |
c5c77ba1 JK |
510 | #endif |
511 | } tstrJoinBssParam; | |
512 | /*Bug4218: Parsing Join Param*/ | |
513 | /*a linked list table containing needed join parameters entries for each AP found in most recent scan*/ | |
514 | typedef struct _tstrBssTable { | |
63d03e47 | 515 | u8 u8noBssEntries; |
c5c77ba1 JK |
516 | tstrJoinBssParam *head; |
517 | tstrJoinBssParam *tail; | |
518 | } tstrBssTable; | |
519 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ | |
520 | ||
521 | typedef enum { | |
522 | SCAN_TIMER = 0, | |
523 | CONNECT_TIMER = 1, | |
524 | SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF | |
525 | } tenuScanConnTimer; | |
526 | ||
527 | /*****************************************************************************/ | |
528 | /* */ | |
529 | /* Global Variabls */ | |
530 | /* */ | |
531 | /*****************************************************************************/ | |
d42ab083 JK |
532 | /* Zero is not used, because a zero ID means termination */ |
533 | static tstrWILC_WFIDrv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; | |
6fdb302c DM |
534 | tstrWILC_WFIDrv *terminated_handle; |
535 | tstrWILC_WFIDrv *gWFiDrvHandle; | |
c5c77ba1 | 536 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
72ed4dc7 | 537 | bool g_obtainingIP = false; |
c5c77ba1 | 538 | #endif |
63d03e47 | 539 | u8 P2P_LISTEN_STATE; |
1999bd52 | 540 | static struct task_struct *HostIFthreadHandler; |
c5c77ba1 | 541 | static WILC_MsgQueueHandle gMsgQHostIF; |
83383ea3 | 542 | static struct semaphore hSemHostIFthrdEnd; |
c5c77ba1 | 543 | |
83383ea3 AB |
544 | struct semaphore hSemDeinitDrvHandle; |
545 | static struct semaphore hWaitResponse; | |
546 | struct semaphore hSemHostIntDeinit; | |
da711eb6 | 547 | struct timer_list g_hPeriodicRSSI; |
c5c77ba1 JK |
548 | |
549 | ||
550 | ||
63d03e47 | 551 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
c5c77ba1 JK |
552 | |
553 | #ifndef CONNECT_DIRECT | |
63d03e47 | 554 | static u8 gapu8RcvdSurveyResults[2][MAX_SURVEY_RESULT_FRAG_SIZE]; |
c5c77ba1 JK |
555 | #endif |
556 | ||
63d03e47 | 557 | static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE]; |
c5c77ba1 | 558 | |
72ed4dc7 | 559 | bool gbScanWhileConnected = false; |
c5c77ba1 | 560 | |
ca356ada CL |
561 | static s8 gs8Rssi; |
562 | static s8 gs8lnkspd; | |
63d03e47 GKH |
563 | static u8 gu8Chnl; |
564 | static u8 gs8SetIP[2][4]; | |
565 | static u8 gs8GetIP[2][4]; | |
c5c77ba1 | 566 | #ifdef WILC_AP_EXTERNAL_MLME |
4e4467fd | 567 | static u32 gu32InactiveTime; |
63d03e47 | 568 | static u8 gu8DelBcn; |
c5c77ba1 | 569 | #endif |
4e4467fd | 570 | static u32 gu32WidConnRstHack; |
c5c77ba1 JK |
571 | |
572 | /*BugID_5137*/ | |
63d03e47 GKH |
573 | u8 *gu8FlushedJoinReq; |
574 | u8 *gu8FlushedInfoElemAsoc; | |
575 | u8 gu8Flushed11iMode; | |
576 | u8 gu8FlushedAuthType; | |
4e4467fd CL |
577 | u32 gu32FlushedJoinReqSize; |
578 | u32 gu32FlushedInfoElemAsocSize; | |
8a625cad | 579 | tstrWILC_WFIDrv *gu8FlushedJoinReqDrvHandler; |
c5c77ba1 JK |
580 | #define REAL_JOIN_REQ 0 |
581 | #define FLUSHED_JOIN_REQ 1 | |
582 | #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ | |
583 | ||
584 | /*Bug4218: Parsing Join Param*/ | |
585 | #ifdef WILC_PARSE_SCAN_IN_HOST | |
586 | /*Bug4218: Parsing Join Param*/ | |
587 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); | |
588 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ | |
589 | ||
4e4467fd | 590 | extern void chip_sleep_manually(u32 u32SleepTime); |
c5c77ba1 JK |
591 | extern int linux_wlan_get_num_conn_ifcs(void); |
592 | ||
d42ab083 JK |
593 | static int add_handler_in_list(tstrWILC_WFIDrv *handler) |
594 | { | |
595 | int i; | |
596 | ||
597 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { | |
598 | if (!wfidrv_list[i]) { | |
599 | wfidrv_list[i] = handler; | |
600 | return 0; | |
601 | } | |
602 | } | |
603 | ||
604 | return -ENOBUFS; | |
605 | } | |
606 | ||
607 | static int remove_handler_in_list(tstrWILC_WFIDrv *handler) | |
608 | { | |
609 | int i; | |
610 | ||
611 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { | |
612 | if (wfidrv_list[i] == handler) { | |
613 | wfidrv_list[i] = NULL; | |
614 | return 0; | |
615 | } | |
616 | } | |
617 | ||
618 | return -EINVAL; | |
619 | } | |
620 | ||
621 | static int get_id_from_handler(tstrWILC_WFIDrv *handler) | |
622 | { | |
623 | int i; | |
624 | ||
625 | if (!handler) | |
626 | return 0; | |
627 | ||
628 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { | |
629 | if (wfidrv_list[i] == handler) | |
630 | return i; | |
631 | } | |
632 | ||
633 | return 0; | |
634 | } | |
635 | ||
636 | static tstrWILC_WFIDrv *get_handler_from_id(int id) | |
637 | { | |
6ae9ac0b | 638 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
d42ab083 JK |
639 | return NULL; |
640 | return wfidrv_list[id]; | |
641 | } | |
642 | ||
c5c77ba1 JK |
643 | /** |
644 | * @brief Handle_SetChannel | |
645 | * @details Sending config packet to firmware to set channel | |
646 | * @param[in] tstrHostIFSetChan* pstrHostIFSetChan | |
647 | * @return Error code. | |
648 | * @author | |
649 | * @date | |
650 | * @version 1.0 | |
651 | */ | |
2b05df55 | 652 | static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetChan *pstrHostIFSetChan) |
c5c77ba1 JK |
653 | { |
654 | ||
e6e12661 | 655 | s32 s32Error = 0; |
c5c77ba1 JK |
656 | tstrWID strWID; |
657 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
658 | ||
659 | /*prepare configuration packet*/ | |
d85f5326 | 660 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
c5c77ba1 | 661 | strWID.enuWIDtype = WID_CHAR; |
576917ad DL |
662 | strWID.ps8WidVal = (char *)&(pstrHostIFSetChan->u8SetChan); |
663 | strWID.s32ValueSize = sizeof(char); | |
c5c77ba1 JK |
664 | |
665 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); | |
666 | /*Sending Cfg*/ | |
d42ab083 JK |
667 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
668 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
669 | if (s32Error) { |
670 | PRINT_ER("Failed to set channel\n"); | |
24db713f | 671 | return -EINVAL; |
c5c77ba1 JK |
672 | } |
673 | ||
674 | return s32Error; | |
675 | } | |
676 | /** | |
677 | * @brief Handle_SetWfiDrvHandler | |
678 | * @details Sending config packet to firmware to set driver handler | |
679 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler | |
680 | * @return Error code. | |
681 | * @author | |
682 | * @date | |
683 | * @version 1.0 | |
684 | */ | |
53a84401 JK |
685 | static s32 Handle_SetWfiDrvHandler(tstrWILC_WFIDrv *drvHandler, |
686 | tstrHostIfSetDrvHandler *pstrHostIfSetDrvHandler) | |
c5c77ba1 JK |
687 | { |
688 | ||
e6e12661 | 689 | s32 s32Error = 0; |
c5c77ba1 | 690 | tstrWID strWID; |
53a84401 | 691 | tstrWILC_WFIDrv *pstrWFIDrv = drvHandler; |
c5c77ba1 JK |
692 | |
693 | ||
694 | /*prepare configuration packet*/ | |
d85f5326 | 695 | strWID.u16WIDid = (u16)WID_SET_DRV_HANDLER; |
c5c77ba1 | 696 | strWID.enuWIDtype = WID_INT; |
ca356ada | 697 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetDrvHandler->u32Address); |
4e4467fd | 698 | strWID.s32ValueSize = sizeof(u32); |
c5c77ba1 JK |
699 | |
700 | /*Sending Cfg*/ | |
701 | ||
d42ab083 JK |
702 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
703 | pstrHostIfSetDrvHandler->u32Address); | |
c5c77ba1 | 704 | |
53a84401 | 705 | if (pstrWFIDrv == NULL) |
83383ea3 | 706 | up(&hSemDeinitDrvHandle); |
c5c77ba1 JK |
707 | |
708 | ||
709 | if (s32Error) { | |
710 | PRINT_ER("Failed to set driver handler\n"); | |
24db713f | 711 | return -EINVAL; |
c5c77ba1 JK |
712 | } |
713 | ||
714 | return s32Error; | |
715 | } | |
716 | ||
717 | /** | |
718 | * @brief Handle_SetWfiAPDrvHandler | |
719 | * @details Sending config packet to firmware to set driver handler | |
720 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler | |
721 | * @return Error code. | |
722 | * @author | |
723 | * @date | |
724 | * @version 1.0 | |
725 | */ | |
2b05df55 | 726 | static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetOperationMode *pstrHostIfSetOperationMode) |
c5c77ba1 JK |
727 | { |
728 | ||
e6e12661 | 729 | s32 s32Error = 0; |
c5c77ba1 JK |
730 | tstrWID strWID; |
731 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
732 | ||
733 | ||
734 | /*prepare configuration packet*/ | |
d85f5326 | 735 | strWID.u16WIDid = (u16)WID_SET_OPERATION_MODE; |
c5c77ba1 | 736 | strWID.enuWIDtype = WID_INT; |
ca356ada | 737 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetOperationMode->u32Mode); |
4e4467fd | 738 | strWID.s32ValueSize = sizeof(u32); |
c5c77ba1 JK |
739 | |
740 | /*Sending Cfg*/ | |
03b2d5e7 | 741 | PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv); |
c5c77ba1 | 742 | |
d42ab083 JK |
743 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
744 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
745 | |
746 | ||
c590b9a4 | 747 | if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE) |
83383ea3 | 748 | up(&hSemDeinitDrvHandle); |
c5c77ba1 JK |
749 | |
750 | ||
751 | if (s32Error) { | |
752 | PRINT_ER("Failed to set driver handler\n"); | |
24db713f | 753 | return -EINVAL; |
c5c77ba1 JK |
754 | } |
755 | ||
756 | return s32Error; | |
757 | } | |
758 | ||
759 | /** | |
760 | * @brief host_int_set_IPAddress | |
761 | * @details Setting IP address params in message queue | |
63d03e47 | 762 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
c5c77ba1 JK |
763 | * @return Error code. |
764 | * @author | |
765 | * @date | |
766 | * @version 1.0 | |
767 | */ | |
2b05df55 | 768 | s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
c5c77ba1 JK |
769 | { |
770 | ||
e6e12661 | 771 | s32 s32Error = 0; |
c5c77ba1 JK |
772 | tstrWID strWID; |
773 | char firmwareIPAddress[4] = {0}; | |
774 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
775 | ||
776 | if (pu8IPAddr[0] < 192) | |
777 | pu8IPAddr[0] = 0; | |
778 | ||
b3a02832 | 779 | PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr); |
c5c77ba1 | 780 | |
d00d2ba3 | 781 | memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); |
c5c77ba1 JK |
782 | |
783 | /*prepare configuration packet*/ | |
d85f5326 | 784 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
c5c77ba1 | 785 | strWID.enuWIDtype = WID_STR; |
63d03e47 | 786 | strWID.ps8WidVal = (u8 *)pu8IPAddr; |
c5c77ba1 JK |
787 | strWID.s32ValueSize = IP_ALEN; |
788 | ||
d42ab083 JK |
789 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
790 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
791 | |
792 | ||
218dc407 | 793 | host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx); |
c5c77ba1 JK |
794 | |
795 | if (s32Error) { | |
24db713f LK |
796 | PRINT_ER("Failed to set IP address\n"); |
797 | return -EINVAL; | |
c5c77ba1 JK |
798 | } |
799 | ||
24db713f | 800 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
c5c77ba1 JK |
801 | |
802 | return s32Error; | |
803 | } | |
804 | ||
805 | ||
806 | /** | |
807 | * @brief Handle_get_IPAddress | |
808 | * @details Setting IP address params in message queue | |
63d03e47 | 809 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
c5c77ba1 JK |
810 | * @return Error code. |
811 | * @author | |
812 | * @date | |
813 | * @version 1.0 | |
814 | */ | |
2b05df55 | 815 | s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
c5c77ba1 JK |
816 | { |
817 | ||
e6e12661 | 818 | s32 s32Error = 0; |
c5c77ba1 JK |
819 | tstrWID strWID; |
820 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
821 | ||
822 | /*prepare configuration packet*/ | |
d85f5326 | 823 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
c5c77ba1 | 824 | strWID.enuWIDtype = WID_STR; |
f3052587 | 825 | strWID.ps8WidVal = kmalloc(IP_ALEN, GFP_KERNEL); |
c5c77ba1 JK |
826 | strWID.s32ValueSize = IP_ALEN; |
827 | ||
d42ab083 JK |
828 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
829 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 830 | |
b3a02832 | 831 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal); |
c5c77ba1 | 832 | |
d00d2ba3 | 833 | memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); |
c5c77ba1 JK |
834 | |
835 | /*get the value by searching the local copy*/ | |
49188af2 | 836 | kfree(strWID.ps8WidVal); |
c5c77ba1 | 837 | |
1a646e7e | 838 | if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) |
218dc407 | 839 | host_int_setup_ipaddress(pstrWFIDrv, gs8SetIP[idx], idx); |
c5c77ba1 | 840 | |
e6e12661 | 841 | if (s32Error != 0) { |
c5c77ba1 | 842 | PRINT_ER("Failed to get IP address\n"); |
24db713f | 843 | return -EINVAL; |
c5c77ba1 JK |
844 | } |
845 | ||
24db713f LK |
846 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
847 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]); | |
848 | PRINT_INFO(HOSTINF_DBG, "\n"); | |
c5c77ba1 JK |
849 | |
850 | return s32Error; | |
851 | } | |
852 | ||
853 | ||
854 | /*BugId_5077*/ | |
855 | /** | |
856 | * @brief Handle_SetMacAddress | |
857 | * @details Setting mac address | |
858 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler | |
859 | * @return Error code. | |
860 | * @author Amr Abdel-Moghny | |
861 | * @date November 2013 | |
862 | * @version 7.0 | |
863 | */ | |
2b05df55 | 864 | static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAddress *pstrHostIfSetMacAddress) |
c5c77ba1 JK |
865 | { |
866 | ||
e6e12661 | 867 | s32 s32Error = 0; |
c5c77ba1 JK |
868 | tstrWID strWID; |
869 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
f3052587 | 870 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
78c87591 | 871 | |
c5c77ba1 JK |
872 | if (mac_buf == NULL) { |
873 | PRINT_ER("No buffer to send mac address\n"); | |
e6e12661 | 874 | return -EFAULT; |
c5c77ba1 | 875 | } |
d00d2ba3 | 876 | memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); |
c5c77ba1 JK |
877 | |
878 | /*prepare configuration packet*/ | |
d85f5326 | 879 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
c5c77ba1 JK |
880 | strWID.enuWIDtype = WID_STR; |
881 | strWID.ps8WidVal = mac_buf; | |
882 | strWID.s32ValueSize = ETH_ALEN; | |
310a28fd | 883 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.ps8WidVal); |
c5c77ba1 | 884 | /*Sending Cfg*/ |
d42ab083 JK |
885 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
886 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
887 | if (s32Error) { |
888 | PRINT_ER("Failed to set mac address\n"); | |
24db713f | 889 | s32Error = -EFAULT; |
c5c77ba1 JK |
890 | } |
891 | ||
49188af2 | 892 | kfree(mac_buf); |
c5c77ba1 JK |
893 | return s32Error; |
894 | } | |
895 | ||
896 | ||
897 | /*BugID_5213*/ | |
898 | /** | |
899 | * @brief Handle_GetMacAddress | |
900 | * @details Getting mac address | |
901 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler | |
902 | * @return Error code. | |
903 | * @author Amr Abdel-Moghny | |
904 | * @date JAN 2013 | |
905 | * @version 8.0 | |
906 | */ | |
2b05df55 | 907 | static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress) |
c5c77ba1 JK |
908 | { |
909 | ||
e6e12661 | 910 | s32 s32Error = 0; |
c5c77ba1 JK |
911 | tstrWID strWID; |
912 | ||
913 | /*prepare configuration packet*/ | |
d85f5326 | 914 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
c5c77ba1 JK |
915 | strWID.enuWIDtype = WID_STR; |
916 | strWID.ps8WidVal = pstrHostIfGetMacAddress->u8MacAddress; | |
917 | strWID.s32ValueSize = ETH_ALEN; | |
918 | ||
919 | /*Sending Cfg*/ | |
d42ab083 JK |
920 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, false, |
921 | get_id_from_handler(drvHandler)); | |
c5c77ba1 JK |
922 | if (s32Error) { |
923 | PRINT_ER("Failed to get mac address\n"); | |
24db713f | 924 | s32Error = -EFAULT; |
c5c77ba1 | 925 | } |
83383ea3 | 926 | up(&hWaitResponse); |
c5c77ba1 JK |
927 | |
928 | return s32Error; | |
929 | } | |
930 | ||
931 | ||
932 | /** | |
933 | * @brief Handle_CfgParam | |
934 | * @details Sending config packet to firmware to set CFG params | |
935 | * @param[in] tstrHostIFCfgParamAttr* strHostIFCfgParamAttr | |
936 | * @return Error code. | |
937 | * @author | |
938 | * @date | |
939 | * @version 1.0 | |
940 | */ | |
2b05df55 | 941 | static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, tstrHostIFCfgParamAttr *strHostIFCfgParamAttr) |
c5c77ba1 | 942 | { |
e6e12661 | 943 | s32 s32Error = 0; |
c5c77ba1 | 944 | tstrWID strWIDList[32]; |
63d03e47 | 945 | u8 u8WidCnt = 0; |
c5c77ba1 JK |
946 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
947 | ||
948 | ||
83383ea3 | 949 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
c5c77ba1 JK |
950 | |
951 | ||
952 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); | |
953 | ||
954 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BSS_TYPE) { | |
955 | /*----------------------------------------------------------*/ | |
956 | /*Input Value: INFRASTRUCTURE = 1, */ | |
957 | /* INDEPENDENT= 2, */ | |
958 | /* ANY_BSS= 3 */ | |
959 | /*----------------------------------------------------------*/ | |
960 | /* validate input then copy>> need to check value 4 and 5 */ | |
961 | if (strHostIFCfgParamAttr->pstrCfgParamVal.bss_type < 6) { | |
962 | strWIDList[u8WidCnt].u16WIDid = WID_BSS_TYPE; | |
ca356ada | 963 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
c5c77ba1 | 964 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
576917ad | 965 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
63d03e47 | 966 | pstrWFIDrv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
c5c77ba1 | 967 | } else { |
24db713f LK |
968 | PRINT_ER("check value 6 over\n"); |
969 | s32Error = -EINVAL; | |
970 | goto ERRORHANDLER; | |
c5c77ba1 JK |
971 | } |
972 | u8WidCnt++; | |
973 | } | |
974 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTH_TYPE) { | |
975 | /*------------------------------------------------------*/ | |
976 | /*Input Values: OPEN_SYSTEM = 0, */ | |
977 | /* SHARED_KEY = 1, */ | |
978 | /* ANY = 2 */ | |
979 | /*------------------------------------------------------*/ | |
980 | /*validate Possible values*/ | |
981 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 1 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 2 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 5) { | |
982 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TYPE; | |
ca356ada | 983 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
c5c77ba1 | 984 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
576917ad | 985 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
63d03e47 | 986 | pstrWFIDrv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
c5c77ba1 | 987 | } else { |
24db713f LK |
988 | PRINT_ER("Impossible value \n"); |
989 | s32Error = -EINVAL; | |
990 | goto ERRORHANDLER; | |
c5c77ba1 JK |
991 | } |
992 | u8WidCnt++; | |
993 | } | |
994 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTHEN_TIMEOUT) { | |
995 | /* range is 1 to 65535. */ | |
996 | if (strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout < 65536) { | |
997 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TIMEOUT; | |
ca356ada | 998 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
c5c77ba1 | 999 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
d85f5326 | 1000 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
c5c77ba1 JK |
1001 | pstrWFIDrv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
1002 | } else { | |
24db713f LK |
1003 | PRINT_ER("Range(1 ~ 65535) over\n"); |
1004 | s32Error = -EINVAL; | |
1005 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1006 | } |
1007 | u8WidCnt++; | |
1008 | } | |
1009 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & POWER_MANAGEMENT) { | |
1010 | /*-----------------------------------------------------------*/ | |
1011 | /*Input Values: NO_POWERSAVE = 0, */ | |
1012 | /* MIN_FAST_PS = 1, */ | |
1013 | /* MAX_FAST_PS = 2, */ | |
1014 | /* MIN_PSPOLL_PS = 3, */ | |
1015 | /* MAX_PSPOLL_PS = 4 */ | |
1016 | /*----------------------------------------------------------*/ | |
1017 | if (strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode < 5) { | |
1018 | strWIDList[u8WidCnt].u16WIDid = WID_POWER_MANAGEMENT; | |
ca356ada | 1019 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
c5c77ba1 | 1020 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
576917ad | 1021 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
63d03e47 | 1022 | pstrWFIDrv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
c5c77ba1 | 1023 | } else { |
24db713f LK |
1024 | PRINT_ER("Invalide power mode\n"); |
1025 | s32Error = -EINVAL; | |
1026 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1027 | } |
1028 | u8WidCnt++; | |
1029 | } | |
1030 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_SHORT) { | |
1031 | /* range from 1 to 256 */ | |
1032 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit < 256)) { | |
1033 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_RETRY_LIMIT; | |
ca356ada | 1034 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
c5c77ba1 | 1035 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
d85f5326 | 1036 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
c5c77ba1 JK |
1037 | pstrWFIDrv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
1038 | } else { | |
24db713f LK |
1039 | PRINT_ER("Range(1~256) over\n"); |
1040 | s32Error = -EINVAL; | |
1041 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1042 | } |
1043 | u8WidCnt++; | |
1044 | } | |
1045 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_LONG) { | |
1046 | /* range from 1 to 256 */ | |
1047 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit < 256)) { | |
1048 | strWIDList[u8WidCnt].u16WIDid = WID_LONG_RETRY_LIMIT; | |
ca356ada | 1049 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
c5c77ba1 JK |
1050 | |
1051 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; | |
d85f5326 | 1052 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
c5c77ba1 JK |
1053 | pstrWFIDrv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
1054 | } else { | |
24db713f LK |
1055 | PRINT_ER("Range(1~256) over\n"); |
1056 | s32Error = -EINVAL; | |
1057 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1058 | } |
1059 | u8WidCnt++; | |
1060 | } | |
1061 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & FRAG_THRESHOLD) { | |
1062 | ||
1063 | if (strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold < 7937) { | |
1064 | strWIDList[u8WidCnt].u16WIDid = WID_FRAG_THRESHOLD; | |
ca356ada | 1065 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
c5c77ba1 | 1066 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
d85f5326 | 1067 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
c5c77ba1 JK |
1068 | pstrWFIDrv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
1069 | } else { | |
24db713f LK |
1070 | PRINT_ER("Threshold Range fail\n"); |
1071 | s32Error = -EINVAL; | |
1072 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1073 | } |
1074 | u8WidCnt++; | |
1075 | } | |
1076 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RTS_THRESHOLD) { | |
1077 | /* range 256 to 65535 */ | |
1078 | if (strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold < 65536) { | |
1079 | strWIDList[u8WidCnt].u16WIDid = WID_RTS_THRESHOLD; | |
ca356ada | 1080 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
c5c77ba1 | 1081 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
d85f5326 | 1082 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
c5c77ba1 JK |
1083 | pstrWFIDrv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
1084 | } else { | |
24db713f LK |
1085 | PRINT_ER("Threshold Range fail\n"); |
1086 | s32Error = -EINVAL; | |
1087 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1088 | } |
1089 | u8WidCnt++; | |
1090 | } | |
1091 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PREAMBLE) { | |
1092 | /*-----------------------------------------------------*/ | |
1093 | /*Input Values: Short= 0, */ | |
1094 | /* Long= 1, */ | |
1095 | /* Auto= 2 */ | |
1096 | /*------------------------------------------------------*/ | |
1097 | if (strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type < 3) { | |
1098 | strWIDList[u8WidCnt].u16WIDid = WID_PREAMBLE; | |
ca356ada | 1099 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
c5c77ba1 | 1100 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
576917ad | 1101 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
c5c77ba1 JK |
1102 | pstrWFIDrv->strCfgValues.preamble_type = strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
1103 | } else { | |
24db713f LK |
1104 | PRINT_ER("Preamle Range(0~2) over\n"); |
1105 | s32Error = -EINVAL; | |
1106 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1107 | } |
1108 | u8WidCnt++; | |
1109 | } | |
1110 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SHORT_SLOT_ALLOWED) { | |
1111 | if (strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed < 2) { | |
1112 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_SLOT_ALLOWED; | |
ca356ada | 1113 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
c5c77ba1 | 1114 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
576917ad | 1115 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
63d03e47 | 1116 | pstrWFIDrv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
c5c77ba1 | 1117 | } else { |
24db713f LK |
1118 | PRINT_ER("Short slot(2) over\n"); |
1119 | s32Error = -EINVAL; | |
1120 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1121 | } |
1122 | u8WidCnt++; | |
1123 | } | |
1124 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & TXOP_PROT_DISABLE) { | |
1125 | /*Description: used to Disable RTS-CTS protection for TXOP burst*/ | |
1126 | /*transmission when the acknowledgement policy is No-Ack or Block-Ack */ | |
1127 | /* this information is useful for external supplicant */ | |
1128 | /*Input Values: 1 for enable and 0 for disable. */ | |
1129 | if (strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled < 2) { | |
1130 | strWIDList[u8WidCnt].u16WIDid = WID_11N_TXOP_PROT_DISABLE; | |
ca356ada | 1131 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
c5c77ba1 | 1132 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
576917ad | 1133 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
63d03e47 | 1134 | pstrWFIDrv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
c5c77ba1 | 1135 | } else { |
24db713f LK |
1136 | PRINT_ER("TXOP prot disable\n"); |
1137 | s32Error = -EINVAL; | |
1138 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1139 | } |
1140 | u8WidCnt++; | |
1141 | } | |
1142 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BEACON_INTERVAL) { | |
1143 | /* range is 1 to 65535. */ | |
1144 | if (strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval < 65536) { | |
1145 | strWIDList[u8WidCnt].u16WIDid = WID_BEACON_INTERVAL; | |
ca356ada | 1146 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
c5c77ba1 | 1147 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
d85f5326 | 1148 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
c5c77ba1 JK |
1149 | pstrWFIDrv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
1150 | } else { | |
24db713f LK |
1151 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
1152 | s32Error = -EINVAL; | |
1153 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1154 | } |
1155 | u8WidCnt++; | |
1156 | } | |
1157 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & DTIM_PERIOD) { | |
1158 | /* range is 1 to 255. */ | |
1159 | if (strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period < 256) { | |
1160 | strWIDList[u8WidCnt].u16WIDid = WID_DTIM_PERIOD; | |
ca356ada | 1161 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
c5c77ba1 | 1162 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
576917ad | 1163 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
c5c77ba1 JK |
1164 | pstrWFIDrv->strCfgValues.dtim_period = strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
1165 | } else { | |
24db713f LK |
1166 | PRINT_ER("DTIM range(1~255) fail\n"); |
1167 | s32Error = -EINVAL; | |
1168 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1169 | } |
1170 | u8WidCnt++; | |
1171 | } | |
1172 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY) { | |
1173 | /*----------------------------------------------------------------------*/ | |
1174 | /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */ | |
1175 | /* SITE_SURVEY_ALL_CH = 1, */ | |
1176 | /* SITE_SURVEY_OFF = 2 */ | |
1177 | /*----------------------------------------------------------------------*/ | |
1178 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled < 3) { | |
1179 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY; | |
ca356ada | 1180 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
c5c77ba1 | 1181 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
576917ad | 1182 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
63d03e47 | 1183 | pstrWFIDrv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
c5c77ba1 | 1184 | } else { |
24db713f LK |
1185 | PRINT_ER("Site survey disable\n"); |
1186 | s32Error = -EINVAL; | |
1187 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1188 | } |
1189 | u8WidCnt++; | |
1190 | } | |
1191 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY_SCAN_TIME) { | |
1192 | /* range is 1 to 65535. */ | |
1193 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time < 65536) { | |
1194 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY_SCAN_TIME; | |
ca356ada | 1195 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
c5c77ba1 | 1196 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
d85f5326 | 1197 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
c5c77ba1 JK |
1198 | pstrWFIDrv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
1199 | } else { | |
24db713f LK |
1200 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
1201 | s32Error = -EINVAL; | |
1202 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1203 | } |
1204 | u8WidCnt++; | |
1205 | } | |
1206 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & ACTIVE_SCANTIME) { | |
1207 | /* range is 1 to 65535. */ | |
1208 | if (strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time < 65536) { | |
1209 | strWIDList[u8WidCnt].u16WIDid = WID_ACTIVE_SCAN_TIME; | |
ca356ada | 1210 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
c5c77ba1 | 1211 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
d85f5326 | 1212 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
c5c77ba1 JK |
1213 | pstrWFIDrv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
1214 | } else { | |
24db713f LK |
1215 | PRINT_ER("Active scan time(1~65535) over\n"); |
1216 | s32Error = -EINVAL; | |
1217 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1218 | } |
1219 | u8WidCnt++; | |
1220 | } | |
1221 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PASSIVE_SCANTIME) { | |
1222 | /* range is 1 to 65535. */ | |
1223 | if (strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time < 65536) { | |
1224 | strWIDList[u8WidCnt].u16WIDid = WID_PASSIVE_SCAN_TIME; | |
ca356ada | 1225 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
c5c77ba1 | 1226 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
d85f5326 | 1227 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
c5c77ba1 JK |
1228 | pstrWFIDrv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
1229 | } else { | |
24db713f LK |
1230 | PRINT_ER("Passive scan time(1~65535) over\n"); |
1231 | s32Error = -EINVAL; | |
1232 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1233 | } |
1234 | u8WidCnt++; | |
1235 | } | |
1236 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & CURRENT_TX_RATE) { | |
1237 | CURRENT_TX_RATE_T curr_tx_rate = strHostIFCfgParamAttr->pstrCfgParamVal.curr_tx_rate; | |
1238 | /*----------------------------------------------------------------------*/ | |
1239 | /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */ | |
1240 | /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */ | |
1241 | /*----------------------------------------------------------------------*/ | |
1242 | /* validate rate */ | |
1243 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 | |
1244 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 | |
1245 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 | |
1246 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 | |
1247 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 | |
1248 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { | |
1249 | strWIDList[u8WidCnt].u16WIDid = WID_CURRENT_TX_RATE; | |
ca356ada | 1250 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&curr_tx_rate; |
c5c77ba1 | 1251 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
d85f5326 | 1252 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
63d03e47 | 1253 | pstrWFIDrv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
c5c77ba1 | 1254 | } else { |
24db713f LK |
1255 | PRINT_ER("out of TX rate\n"); |
1256 | s32Error = -EINVAL; | |
1257 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1258 | } |
1259 | u8WidCnt++; | |
1260 | } | |
d42ab083 JK |
1261 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, |
1262 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 1263 | |
2b9d5b48 | 1264 | if (s32Error) |
c5c77ba1 JK |
1265 | PRINT_ER("Error in setting CFG params\n"); |
1266 | ||
24db713f | 1267 | ERRORHANDLER: |
83383ea3 | 1268 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
c5c77ba1 JK |
1269 | return s32Error; |
1270 | } | |
1271 | ||
1272 | ||
1273 | /** | |
1274 | * @brief Handle_wait_msg_q_empty | |
1275 | * @details this should be the last msg and then the msg Q becomes idle | |
1276 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr | |
1277 | * @return Error code. | |
1278 | * @author | |
1279 | * @date | |
1280 | * @version 1.0 | |
1281 | */ | |
fb4ec9ca | 1282 | static s32 Handle_wait_msg_q_empty(void) |
c5c77ba1 | 1283 | { |
e6e12661 | 1284 | s32 s32Error = 0; |
78c87591 | 1285 | |
c5c77ba1 | 1286 | g_wilc_initialized = 0; |
83383ea3 | 1287 | up(&hWaitResponse); |
c5c77ba1 JK |
1288 | return s32Error; |
1289 | } | |
1290 | ||
1291 | /** | |
1292 | * @brief Handle_Scan | |
1293 | * @details Sending config packet to firmware to set the scan params | |
1294 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr | |
1295 | * @return Error code. | |
1296 | * @author | |
1297 | * @date | |
1298 | * @version 1.0 | |
1299 | */ | |
2b05df55 | 1300 | static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) |
c5c77ba1 | 1301 | { |
e6e12661 | 1302 | s32 s32Error = 0; |
c5c77ba1 | 1303 | tstrWID strWIDList[5]; |
4e4467fd CL |
1304 | u32 u32WidsCount = 0; |
1305 | u32 i; | |
63d03e47 GKH |
1306 | u8 *pu8Buffer; |
1307 | u8 valuesize = 0; | |
1308 | u8 *pu8HdnNtwrksWidVal = NULL; | |
c5c77ba1 JK |
1309 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
1310 | ||
1311 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); | |
03b2d5e7 | 1312 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate); |
c5c77ba1 JK |
1313 | |
1314 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; | |
1315 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; | |
1316 | ||
1317 | #ifdef WILC_P2P | |
c5c77ba1 JK |
1318 | #endif |
1319 | ||
1320 | if ((pstrWFIDrv->enuHostIFstate >= HOST_IF_SCANNING) && (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTED)) { | |
1321 | /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */ | |
1322 | PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", pstrWFIDrv->enuHostIFstate); | |
24db713f LK |
1323 | PRINT_ER("Already scan\n"); |
1324 | s32Error = -EBUSY; | |
1325 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1326 | } |
1327 | ||
1328 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP | |
1329 | if (g_obtainingIP || connecting) { | |
1330 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); | |
24db713f LK |
1331 | PRINT_ER("Don't do obss scan\n"); |
1332 | s32Error = -EBUSY; | |
1333 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1334 | } |
1335 | #endif | |
1336 | ||
1337 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); | |
1338 | ||
1339 | ||
1340 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount = 0; | |
1341 | ||
1342 | /*BugID_4189*/ | |
d85f5326 | 1343 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ; |
c5c77ba1 JK |
1344 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
1345 | ||
2b9d5b48 | 1346 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) |
c5c77ba1 | 1347 | valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
f3052587 | 1348 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
c5c77ba1 | 1349 | strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; |
b1413b60 | 1350 | if (strWIDList[u32WidsCount].ps8WidVal != NULL) { |
c5c77ba1 JK |
1351 | pu8Buffer = strWIDList[u32WidsCount].ps8WidVal; |
1352 | ||
1353 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; | |
1354 | ||
1355 | PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum); | |
1356 | ||
1357 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { | |
1358 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; | |
d00d2ba3 | 1359 | memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); |
c5c77ba1 JK |
1360 | pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
1361 | } | |
1362 | ||
1363 | ||
1364 | ||
fb4ec9ca | 1365 | strWIDList[u32WidsCount].s32ValueSize = (s32)(valuesize + 1); |
c5c77ba1 JK |
1366 | u32WidsCount++; |
1367 | } | |
1368 | ||
1369 | /*filling cfg param array*/ | |
1370 | ||
1371 | /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */ | |
1372 | { | |
1373 | /* IEs to be inserted in Probe Request */ | |
1374 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_PROBE; | |
1375 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; | |
1376 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8IEs; | |
1377 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->IEsLen; | |
1378 | u32WidsCount++; | |
1379 | } | |
1380 | ||
1381 | /*Scan Type*/ | |
1382 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_TYPE; | |
1383 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; | |
576917ad | 1384 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 1385 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanType)); |
c5c77ba1 JK |
1386 | u32WidsCount++; |
1387 | ||
1388 | /*list of channels to be scanned*/ | |
1389 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_CHANNEL_LIST; | |
1390 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; | |
1391 | ||
1392 | /* Bug 4648: Convert channel numbers to start from 0 not 1. */ | |
1393 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) { | |
1394 | int i; | |
1395 | ||
1396 | for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { | |
2b9d5b48 | 1397 | if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) |
c5c77ba1 | 1398 | pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; |
c5c77ba1 JK |
1399 | } |
1400 | } | |
1401 | ||
1402 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8ChnlFreqList; | |
1403 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->u8ChnlListLen; | |
1404 | u32WidsCount++; | |
1405 | ||
1406 | /*Scan Request*/ | |
1407 | strWIDList[u32WidsCount].u16WIDid = WID_START_SCAN_REQ; | |
1408 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; | |
576917ad | 1409 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 1410 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource)); |
c5c77ba1 JK |
1411 | u32WidsCount++; |
1412 | ||
1413 | /*keep the state as is , no need to change it*/ | |
1414 | /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ | |
1415 | ||
78174ada | 1416 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
72ed4dc7 | 1417 | gbScanWhileConnected = true; |
78174ada | 1418 | else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) |
72ed4dc7 | 1419 | gbScanWhileConnected = false; |
c5c77ba1 | 1420 | |
d42ab083 JK |
1421 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
1422 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 1423 | |
24db713f | 1424 | if (s32Error) |
c5c77ba1 | 1425 | PRINT_ER("Failed to send scan paramters config packet\n"); |
24db713f | 1426 | else |
c5c77ba1 | 1427 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
c5c77ba1 | 1428 | |
24db713f LK |
1429 | ERRORHANDLER: |
1430 | if (s32Error) { | |
8972d0fe | 1431 | del_timer(&pstrWFIDrv->hScanTimer); |
c5c77ba1 JK |
1432 | /*if there is an ongoing scan request*/ |
1433 | Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); | |
1434 | } | |
1435 | ||
1436 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ | |
1437 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { | |
49188af2 | 1438 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
c5c77ba1 JK |
1439 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
1440 | } | |
1441 | ||
1442 | /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ | |
1443 | if (pstrHostIFscanAttr->pu8IEs != NULL) { | |
49188af2 | 1444 | kfree(pstrHostIFscanAttr->pu8IEs); |
c5c77ba1 JK |
1445 | pstrHostIFscanAttr->pu8IEs = NULL; |
1446 | } | |
1447 | if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { | |
49188af2 | 1448 | kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); |
c5c77ba1 JK |
1449 | pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; |
1450 | } | |
1451 | ||
1452 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ | |
1453 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { | |
49188af2 | 1454 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
c5c77ba1 JK |
1455 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
1456 | } | |
1457 | ||
2b9d5b48 | 1458 | if (pu8HdnNtwrksWidVal != NULL) |
49188af2 | 1459 | kfree(pu8HdnNtwrksWidVal); |
c5c77ba1 JK |
1460 | |
1461 | return s32Error; | |
1462 | } | |
1463 | ||
1464 | /** | |
1465 | * @brief Handle_ScanDone | |
1466 | * @details Call scan notification callback function | |
1467 | * @param[in] NONE | |
1468 | * @return Error code. | |
1469 | * @author | |
1470 | * @date | |
1471 | * @version 1.0 | |
1472 | */ | |
2b05df55 | 1473 | static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent) |
c5c77ba1 | 1474 | { |
e6e12661 | 1475 | s32 s32Error = 0; |
c5c77ba1 JK |
1476 | |
1477 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
1478 | ||
1479 | ||
63d03e47 | 1480 | u8 u8abort_running_scan; |
c5c77ba1 JK |
1481 | tstrWID strWID; |
1482 | ||
1483 | ||
1484 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); | |
1485 | ||
1486 | /*BugID_4978*/ | |
1487 | /*Ask FW to abort the running scan, if any*/ | |
1488 | if (enuEvent == SCAN_EVENT_ABORTED) { | |
1489 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); | |
1490 | u8abort_running_scan = 1; | |
d85f5326 | 1491 | strWID.u16WIDid = (u16)WID_ABORT_RUNNING_SCAN; |
c5c77ba1 | 1492 | strWID.enuWIDtype = WID_CHAR; |
ca356ada | 1493 | strWID.ps8WidVal = (s8 *)&u8abort_running_scan; |
576917ad | 1494 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
1495 | |
1496 | /*Sending Cfg*/ | |
d42ab083 JK |
1497 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
1498 | get_id_from_handler(pstrWFIDrv)); | |
24db713f | 1499 | if (s32Error) { |
c5c77ba1 | 1500 | PRINT_ER("Failed to set abort running scan\n"); |
24db713f | 1501 | s32Error = -EFAULT; |
c5c77ba1 JK |
1502 | } |
1503 | } | |
1504 | ||
1505 | if (pstrWFIDrv == NULL) { | |
1506 | PRINT_ER("Driver handler is NULL\n"); | |
1507 | return s32Error; | |
1508 | } | |
1509 | ||
1510 | /*if there is an ongoing scan request*/ | |
1511 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { | |
b1413b60 | 1512 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL, |
c5c77ba1 JK |
1513 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
1514 | /*delete current scan request*/ | |
1515 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; | |
1516 | } | |
1517 | ||
1518 | return s32Error; | |
1519 | } | |
1520 | ||
1521 | /** | |
1522 | * @brief Handle_Connect | |
1523 | * @details Sending config packet to firmware to starting connection | |
1524 | * @param[in] tstrHostIFconnectAttr* pstrHostIFconnectAttr | |
1525 | * @return Error code. | |
1526 | * @author | |
1527 | * @date | |
1528 | * @version 1.0 | |
1529 | */ | |
63d03e47 | 1530 | u8 u8ConnectedSSID[6] = {0}; |
2b05df55 | 1531 | static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *pstrHostIFconnectAttr) |
c5c77ba1 JK |
1532 | { |
1533 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; | |
e6e12661 | 1534 | s32 s32Error = 0; |
c5c77ba1 | 1535 | tstrWID strWIDList[8]; |
4e4467fd | 1536 | u32 u32WidsCount = 0, dummyval = 0; |
c5c77ba1 JK |
1537 | /* char passphrase[] = "12345678"; */ |
1538 | #ifndef CONNECT_DIRECT | |
e6e12661 | 1539 | s32 s32Err = 0; |
4e4467fd | 1540 | u32 i; |
63d03e47 | 1541 | u8 u8bssDscListIndex; |
b1413b60 | 1542 | wid_site_survey_reslts_s *pstrSurveyResults = NULL; |
c5c77ba1 | 1543 | #else |
63d03e47 | 1544 | u8 *pu8CurrByte = NULL; |
c5c77ba1 JK |
1545 | /*Bug4218: Parsing Join Param*/ |
1546 | #ifdef WILC_PARSE_SCAN_IN_HOST | |
1547 | tstrJoinBssParam *ptstrJoinBssParam; | |
1548 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ | |
1549 | ||
1550 | #endif | |
1551 | ||
1552 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); | |
1553 | ||
1554 | #ifndef CONNECT_DIRECT | |
3a79a7f7 | 1555 | memset(gapu8RcvdSurveyResults, 0, sizeof(gapu8RcvdSurveyResults)); |
c5c77ba1 JK |
1556 | |
1557 | ||
1558 | PRINT_D(HOSTINF_DBG, "Getting site survey results\n"); | |
218dc407 | 1559 | s32Err = host_int_get_site_survey_results(pstrWFIDrv, |
c5c77ba1 JK |
1560 | gapu8RcvdSurveyResults, |
1561 | MAX_SURVEY_RESULT_FRAG_SIZE); | |
1562 | if (s32Err) { | |
1563 | PRINT_ER("Failed to get site survey results\n"); | |
24db713f LK |
1564 | s32Error = -EFAULT; |
1565 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1566 | } |
1567 | s32Err = ParseSurveyResults(gapu8RcvdSurveyResults, &pstrSurveyResults, | |
1568 | &pstrWFIDrv->u32SurveyResultsCount); | |
1569 | ||
1570 | ||
e6e12661 | 1571 | if (s32Err == 0) { |
c5c77ba1 JK |
1572 | /* use the parsed info in pstrSurveyResults, then deallocate it */ |
1573 | PRINT_D(HOSTINF_DBG, "Copying site survey results in global structure, then deallocate\n"); | |
1574 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { | |
d00d2ba3 | 1575 | memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i], |
c5c77ba1 JK |
1576 | sizeof(wid_site_survey_reslts_s)); |
1577 | } | |
1578 | ||
1579 | DeallocateSurveyResults(pstrSurveyResults); | |
1580 | } else { | |
24db713f LK |
1581 | PRINT_ER("ParseSurveyResults() Error\n"); |
1582 | s32Error = -EFAULT; | |
1583 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1584 | } |
1585 | ||
1586 | ||
1587 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { | |
1a646e7e | 1588 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].SSID, |
c5c77ba1 JK |
1589 | pstrHostIFconnectAttr->pu8ssid, |
1590 | pstrHostIFconnectAttr->ssidLen) == 0) { | |
1591 | PRINT_INFO(HOSTINF_DBG, "Network with required SSID is found %s\n", pstrHostIFconnectAttr->pu8ssid); | |
1592 | if (pstrHostIFconnectAttr->pu8bssid == NULL) { | |
1593 | /* BSSID is not passed from the user, so decision of matching | |
1594 | * is done by SSID only */ | |
1595 | PRINT_INFO(HOSTINF_DBG, "BSSID is not passed from the user\n"); | |
1596 | break; | |
1597 | } else { | |
1598 | /* BSSID is also passed from the user, so decision of matching | |
1599 | * should consider also this passed BSSID */ | |
1600 | ||
1a646e7e | 1601 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID, |
c5c77ba1 JK |
1602 | pstrHostIFconnectAttr->pu8bssid, |
1603 | 6) == 0) { | |
1604 | PRINT_INFO(HOSTINF_DBG, "BSSID is passed from the user and matched\n"); | |
1605 | break; | |
1606 | } | |
1607 | } | |
1608 | } | |
1609 | } | |
1610 | ||
1611 | if (i < pstrWFIDrv->u32SurveyResultsCount) { | |
1612 | u8bssDscListIndex = i; | |
1613 | ||
03b2d5e7 | 1614 | PRINT_INFO(HOSTINF_DBG, "Connecting to network of Bss Idx%d and SSID %s and channel%d\n", |
c5c77ba1 JK |
1615 | u8bssDscListIndex, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].SSID, |
1616 | pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].Channel); | |
1617 | ||
1618 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); | |
1619 | ||
1620 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { | |
f3052587 | 1621 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
d00d2ba3 | 1622 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
c5c77ba1 JK |
1623 | } |
1624 | ||
1625 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; | |
1626 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { | |
f3052587 | 1627 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
d00d2ba3 | 1628 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
c5c77ba1 JK |
1629 | pstrHostIFconnectAttr->ssidLen); |
1630 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; | |
1631 | } | |
1632 | ||
1633 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; | |
1634 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { | |
f3052587 | 1635 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
d00d2ba3 | 1636 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
c5c77ba1 JK |
1637 | pstrHostIFconnectAttr->IEsLen); |
1638 | } | |
1639 | ||
1640 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; | |
1641 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; | |
1642 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; | |
1643 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; | |
1644 | ||
1645 | ||
1646 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ | |
1647 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ | |
1648 | { | |
1649 | /* IEs to be inserted in Association Request */ | |
1650 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; | |
1651 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; | |
1652 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; | |
1653 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; | |
1654 | u32WidsCount++; | |
1655 | } | |
d85f5326 | 1656 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
c5c77ba1 | 1657 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
576917ad | 1658 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 1659 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
c5c77ba1 JK |
1660 | u32WidsCount++; |
1661 | ||
1662 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); | |
1663 | ||
d85f5326 | 1664 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
c5c77ba1 | 1665 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
576917ad | 1666 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 1667 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
c5c77ba1 JK |
1668 | u32WidsCount++; |
1669 | ||
1670 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); | |
1671 | /* | |
d85f5326 | 1672 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
c5c77ba1 JK |
1673 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
1674 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); | |
ca356ada | 1675 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
c5c77ba1 JK |
1676 | * u32WidsCount++; |
1677 | */ | |
1678 | ||
d85f5326 | 1679 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ; |
c5c77ba1 | 1680 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
576917ad | 1681 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 1682 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)&u8bssDscListIndex; |
c5c77ba1 JK |
1683 | u32WidsCount++; |
1684 | ||
c5c77ba1 JK |
1685 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
1686 | * firmware at chip reset when processing the WIDs of the Connect Request. | |
1687 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ | |
1688 | /* ////////////////////// */ | |
1689 | gu32WidConnRstHack = 0; | |
1690 | /* ////////////////////// */ | |
c5c77ba1 | 1691 | |
d42ab083 JK |
1692 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
1693 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 1694 | if (s32Error) { |
24db713f LK |
1695 | PRINT_ER("failed to send config packet\n"); |
1696 | s32Error = -EINVAL; | |
1697 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1698 | } else { |
1699 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; | |
1700 | } | |
1701 | ||
1702 | } else { | |
1703 | PRINT_ER("Required BSSID not found\n"); | |
24db713f LK |
1704 | s32Error = -ENOENT; |
1705 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1706 | } |
1707 | ||
1708 | #else | |
1709 | ||
1710 | /* if we try to connect to an already connected AP then discard the request */ | |
1711 | ||
1a646e7e | 1712 | if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
c5c77ba1 | 1713 | |
e6e12661 | 1714 | s32Error = 0; |
c5c77ba1 JK |
1715 | PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); |
1716 | return s32Error; | |
1717 | } | |
1718 | ||
1719 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); | |
1720 | ||
1721 | /*Bug4218: Parsing Join Param*/ | |
1722 | #ifdef WILC_PARSE_SCAN_IN_HOST | |
1723 | ptstrJoinBssParam = (tstrJoinBssParam *)pstrHostIFconnectAttr->pJoinParams; | |
1724 | if (ptstrJoinBssParam == NULL) { | |
1725 | PRINT_ER("Required BSSID not found\n"); | |
24db713f LK |
1726 | s32Error = -ENOENT; |
1727 | goto ERRORHANDLER; | |
c5c77ba1 JK |
1728 | } |
1729 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ | |
1730 | ||
c5c77ba1 | 1731 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
f3052587 | 1732 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
d00d2ba3 | 1733 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
c5c77ba1 JK |
1734 | } |
1735 | ||
1736 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; | |
1737 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { | |
f3052587 | 1738 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
d00d2ba3 | 1739 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
c5c77ba1 JK |
1740 | pstrHostIFconnectAttr->ssidLen); |
1741 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; | |
1742 | } | |
1743 | ||
1744 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; | |
1745 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { | |
f3052587 | 1746 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
d00d2ba3 | 1747 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
c5c77ba1 JK |
1748 | pstrHostIFconnectAttr->IEsLen); |
1749 | } | |
1750 | ||
1751 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; | |
1752 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; | |
1753 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; | |
1754 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; | |
1755 | ||
1756 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; | |
1757 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; | |
4e4467fd | 1758 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
ca356ada | 1759 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
c5c77ba1 JK |
1760 | u32WidsCount++; |
1761 | ||
1762 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; | |
1763 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; | |
4e4467fd | 1764 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
ca356ada | 1765 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
c5c77ba1 JK |
1766 | u32WidsCount++; |
1767 | ||
1768 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; | |
1769 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; | |
4e4467fd | 1770 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
ca356ada | 1771 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
c5c77ba1 JK |
1772 | u32WidsCount++; |
1773 | ||
1774 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ | |
1775 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ | |
1776 | { | |
1777 | /* IEs to be inserted in Association Request */ | |
1778 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; | |
1779 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; | |
1780 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; | |
1781 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; | |
1782 | u32WidsCount++; | |
1783 | ||
1784 | /*BugID_5137*/ | |
1a646e7e | 1785 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
c5c77ba1 JK |
1786 | |
1787 | gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; | |
f3052587 | 1788 | gu8FlushedInfoElemAsoc = kmalloc(gu32FlushedInfoElemAsocSize, GFP_KERNEL); |
c5c77ba1 JK |
1789 | memcpy(gu8FlushedInfoElemAsoc, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
1790 | gu32FlushedInfoElemAsocSize); | |
1791 | } | |
1792 | } | |
d85f5326 | 1793 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
c5c77ba1 | 1794 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
576917ad | 1795 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 1796 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
c5c77ba1 JK |
1797 | u32WidsCount++; |
1798 | ||
1799 | /*BugID_5137*/ | |
1a646e7e | 1800 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
c5c77ba1 JK |
1801 | gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security; |
1802 | ||
1803 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); | |
1804 | ||
1805 | ||
d85f5326 | 1806 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
c5c77ba1 | 1807 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
576917ad | 1808 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 1809 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
c5c77ba1 JK |
1810 | u32WidsCount++; |
1811 | ||
1812 | /*BugID_5137*/ | |
1a646e7e | 1813 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
63d03e47 | 1814 | gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type; |
c5c77ba1 JK |
1815 | |
1816 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); | |
1817 | /* | |
d85f5326 | 1818 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
c5c77ba1 JK |
1819 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
1820 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); | |
ca356ada | 1821 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
c5c77ba1 JK |
1822 | * u32WidsCount++; |
1823 | */ | |
1824 | ||
1825 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", | |
1826 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel); | |
1827 | ||
1828 | ||
1829 | #ifndef WILC_PARSE_SCAN_IN_HOST | |
d85f5326 | 1830 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
c5c77ba1 JK |
1831 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
1832 | strWIDList[u32WidsCount].s32ValueSize = MAX_SSID_LEN + 7; | |
f3052587 | 1833 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
c5c77ba1 | 1834 | |
24db713f LK |
1835 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) { |
1836 | s32Error = -EFAULT; | |
1837 | goto ERRORHANDLER; | |
1838 | } | |
c5c77ba1 JK |
1839 | |
1840 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; | |
1841 | ||
1842 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { | |
d00d2ba3 | 1843 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
c5c77ba1 JK |
1844 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
1845 | } | |
1846 | pu8CurrByte += MAX_SSID_LEN; | |
1847 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { | |
1848 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; | |
1849 | } else { | |
1850 | PRINT_ER("Channel out of range\n"); | |
1851 | *(pu8CurrByte++) = 0xFF; | |
1852 | } | |
2b9d5b48 | 1853 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
d00d2ba3 | 1854 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
c5c77ba1 JK |
1855 | pu8CurrByte += 6; |
1856 | ||
1857 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ | |
1858 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; | |
1859 | ||
1860 | #else | |
1861 | ||
d85f5326 | 1862 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
c5c77ba1 JK |
1863 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
1864 | ||
1865 | /*Sending NoA attributes during connection*/ | |
1866 | strWIDList[u32WidsCount].s32ValueSize = 112; /* 79; */ | |
f3052587 | 1867 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
c5c77ba1 JK |
1868 | |
1869 | /*BugID_5137*/ | |
1a646e7e | 1870 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
c5c77ba1 | 1871 | gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; |
f3052587 | 1872 | gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL); |
c5c77ba1 | 1873 | } |
24db713f LK |
1874 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) { |
1875 | s32Error = -EFAULT; | |
1876 | goto ERRORHANDLER; | |
1877 | } | |
c5c77ba1 JK |
1878 | |
1879 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; | |
1880 | ||
1881 | ||
1882 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { | |
d00d2ba3 | 1883 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
c5c77ba1 JK |
1884 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
1885 | } | |
1886 | pu8CurrByte += MAX_SSID_LEN; | |
1887 | ||
1888 | /* BSS type*/ | |
1889 | *(pu8CurrByte++) = INFRASTRUCTURE; | |
1890 | /* Channel*/ | |
1891 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { | |
1892 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; | |
1893 | } else { | |
1894 | PRINT_ER("Channel out of range\n"); | |
1895 | *(pu8CurrByte++) = 0xFF; | |
1896 | } | |
1897 | /* Cap Info*/ | |
1898 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; | |
1899 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; | |
1900 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); | |
1901 | ||
1902 | /* sa*/ | |
2b9d5b48 | 1903 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
d00d2ba3 | 1904 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
c5c77ba1 JK |
1905 | pu8CurrByte += 6; |
1906 | ||
1907 | /* bssid*/ | |
2b9d5b48 | 1908 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
d00d2ba3 | 1909 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
c5c77ba1 JK |
1910 | pu8CurrByte += 6; |
1911 | ||
1912 | /* Beacon Period*/ | |
1913 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; | |
1914 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; | |
1915 | PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); | |
1916 | /* DTIM Period*/ | |
1917 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; | |
1918 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); | |
1919 | /* Supported rates*/ | |
d00d2ba3 | 1920 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
c5c77ba1 JK |
1921 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
1922 | ||
1923 | /* wmm cap*/ | |
1924 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; | |
1925 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); | |
1926 | /* uapsd cap*/ | |
1927 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; | |
1928 | ||
1929 | /* ht cap*/ | |
1930 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; | |
1931 | /* copy this information to the user request */ | |
1932 | pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable; | |
1933 | ||
1934 | /* rsn found*/ | |
1935 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; | |
1936 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); | |
1937 | /* rsn group policy*/ | |
1938 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; | |
1939 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); | |
1940 | /* mode_802_11i*/ | |
1941 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; | |
1942 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); | |
1943 | /* rsn pcip policy*/ | |
d00d2ba3 | 1944 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
c5c77ba1 JK |
1945 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
1946 | ||
1947 | /* rsn auth policy*/ | |
d00d2ba3 | 1948 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
c5c77ba1 JK |
1949 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
1950 | ||
1951 | /* rsn auth policy*/ | |
d00d2ba3 | 1952 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
c5c77ba1 JK |
1953 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
1954 | ||
1955 | /*BugID_5137*/ | |
1956 | *(pu8CurrByte++) = REAL_JOIN_REQ; | |
1957 | ||
1958 | #ifdef WILC_P2P | |
1959 | *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled; | |
1960 | if (ptstrJoinBssParam->u8NoaEnbaled) { | |
1961 | PRINT_D(HOSTINF_DBG, "NOA present\n"); | |
1962 | ||
1963 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; | |
1964 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; | |
1965 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; | |
1966 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; | |
1967 | ||
1968 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Index; | |
1969 | ||
1970 | *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable; | |
1971 | ||
1972 | if (ptstrJoinBssParam->u8OppEnable) | |
1973 | *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow; | |
1974 | ||
1975 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; | |
1976 | ||
d00d2ba3 | 1977 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); |
c5c77ba1 JK |
1978 | |
1979 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); | |
1980 | ||
d00d2ba3 | 1981 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); |
c5c77ba1 JK |
1982 | |
1983 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); | |
1984 | ||
d00d2ba3 | 1985 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); |
c5c77ba1 JK |
1986 | |
1987 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); | |
1988 | ||
1989 | } else | |
1990 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); | |
1991 | #endif | |
1992 | ||
1993 | ||
1994 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ | |
1995 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; | |
1996 | ||
1997 | ||
1998 | #endif /* #ifdef WILC_PARSE_SCAN_IN_HOST*/ | |
1999 | u32WidsCount++; | |
2000 | ||
c5c77ba1 JK |
2001 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
2002 | * firmware at chip reset when processing the WIDs of the Connect Request. | |
2003 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ | |
2004 | /* ////////////////////// */ | |
2005 | gu32WidConnRstHack = 0; | |
2006 | /* ////////////////////// */ | |
c5c77ba1 JK |
2007 | |
2008 | /*BugID_5137*/ | |
1a646e7e | 2009 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
c5c77ba1 | 2010 | memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); |
8a625cad | 2011 | gu8FlushedJoinReqDrvHandler = pstrWFIDrv; |
c5c77ba1 JK |
2012 | } |
2013 | ||
2014 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); | |
2015 | ||
2016 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { | |
d00d2ba3 | 2017 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); |
c5c77ba1 | 2018 | |
310a28fd AK |
2019 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->pu8bssid); |
2020 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); | |
c5c77ba1 JK |
2021 | } |
2022 | ||
d42ab083 JK |
2023 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
2024 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 2025 | if (s32Error) { |
24db713f LK |
2026 | PRINT_ER("failed to send config packet\n"); |
2027 | s32Error = -EFAULT; | |
2028 | goto ERRORHANDLER; | |
c5c77ba1 JK |
2029 | } else { |
2030 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); | |
2031 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; | |
2032 | } | |
2033 | #endif | |
2034 | ||
24db713f LK |
2035 | ERRORHANDLER: |
2036 | if (s32Error) { | |
c5c77ba1 JK |
2037 | tstrConnectInfo strConnectInfo; |
2038 | ||
8972d0fe | 2039 | del_timer(&pstrWFIDrv->hConnectTimer); |
c5c77ba1 JK |
2040 | |
2041 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); | |
2042 | ||
2cc46837 | 2043 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
c5c77ba1 JK |
2044 | |
2045 | if (pstrHostIFconnectAttr->pfConnectResult != NULL) { | |
2b9d5b48 | 2046 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
d00d2ba3 | 2047 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
c5c77ba1 JK |
2048 | |
2049 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { | |
2050 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; | |
f3052587 | 2051 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
d00d2ba3 | 2052 | memcpy(strConnectInfo.pu8ReqIEs, |
c5c77ba1 JK |
2053 | pstrHostIFconnectAttr->pu8IEs, |
2054 | pstrHostIFconnectAttr->IEsLen); | |
2055 | } | |
2056 | ||
2057 | pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP, | |
2058 | &strConnectInfo, | |
2059 | MAC_DISCONNECTED, | |
2060 | NULL, | |
2061 | pstrHostIFconnectAttr->pvUserArg); | |
2062 | /*Change state to idle*/ | |
2063 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; | |
2064 | /* Deallocation */ | |
2065 | if (strConnectInfo.pu8ReqIEs != NULL) { | |
49188af2 | 2066 | kfree(strConnectInfo.pu8ReqIEs); |
c5c77ba1 JK |
2067 | strConnectInfo.pu8ReqIEs = NULL; |
2068 | } | |
2069 | ||
2070 | } else { | |
03b2d5e7 | 2071 | PRINT_ER("Connect callback function pointer is NULL\n"); |
c5c77ba1 JK |
2072 | } |
2073 | } | |
2074 | ||
2075 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); | |
2076 | /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ | |
2077 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { | |
49188af2 | 2078 | kfree(pstrHostIFconnectAttr->pu8bssid); |
c5c77ba1 JK |
2079 | pstrHostIFconnectAttr->pu8bssid = NULL; |
2080 | } | |
2081 | ||
2082 | /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ | |
2083 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { | |
49188af2 | 2084 | kfree(pstrHostIFconnectAttr->pu8ssid); |
c5c77ba1 JK |
2085 | pstrHostIFconnectAttr->pu8ssid = NULL; |
2086 | } | |
2087 | ||
2088 | /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ | |
2089 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { | |
49188af2 | 2090 | kfree(pstrHostIFconnectAttr->pu8IEs); |
c5c77ba1 JK |
2091 | pstrHostIFconnectAttr->pu8IEs = NULL; |
2092 | } | |
2093 | ||
2b9d5b48 | 2094 | if (pu8CurrByte != NULL) |
49188af2 | 2095 | kfree(pu8CurrByte); |
c5c77ba1 JK |
2096 | return s32Error; |
2097 | } | |
2098 | ||
2099 | /** | |
2100 | * @brief Handle_FlushConnect | |
2101 | * @details Sending config packet to firmware to flush an old connection | |
2102 | * after switching FW from station one to hybrid one | |
2103 | * @param[in] void * drvHandler | |
2104 | * @return Error code. | |
2105 | * @author Amr Abdel-Moghny | |
2106 | * @date 19 DEC 2013 | |
2107 | * @version 8.0 | |
2108 | */ | |
2109 | ||
2b05df55 | 2110 | static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler) |
c5c77ba1 | 2111 | { |
e6e12661 | 2112 | s32 s32Error = 0; |
c5c77ba1 | 2113 | tstrWID strWIDList[5]; |
4e4467fd | 2114 | u32 u32WidsCount = 0; |
63d03e47 | 2115 | u8 *pu8CurrByte = NULL; |
c5c77ba1 JK |
2116 | |
2117 | ||
2118 | /* IEs to be inserted in Association Request */ | |
2119 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; | |
2120 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; | |
2121 | strWIDList[u32WidsCount].ps8WidVal = gu8FlushedInfoElemAsoc; | |
2122 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedInfoElemAsocSize; | |
2123 | u32WidsCount++; | |
2124 | ||
d85f5326 | 2125 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
c5c77ba1 | 2126 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
576917ad | 2127 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 2128 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(gu8Flushed11iMode)); |
c5c77ba1 JK |
2129 | u32WidsCount++; |
2130 | ||
2131 | ||
2132 | ||
d85f5326 | 2133 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
c5c77ba1 | 2134 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
576917ad | 2135 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 2136 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&gu8FlushedAuthType); |
c5c77ba1 JK |
2137 | u32WidsCount++; |
2138 | ||
2139 | ||
2140 | #ifdef WILC_PARSE_SCAN_IN_HOST | |
d85f5326 | 2141 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
c5c77ba1 JK |
2142 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
2143 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedJoinReqSize; | |
ca356ada | 2144 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)gu8FlushedJoinReq; |
c5c77ba1 JK |
2145 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
2146 | ||
2147 | pu8CurrByte += FLUSHED_BYTE_POS; | |
2148 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; | |
2149 | ||
2150 | u32WidsCount++; | |
2151 | ||
2152 | #endif | |
2153 | ||
d42ab083 JK |
2154 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
2155 | get_id_from_handler(gu8FlushedJoinReqDrvHandler)); | |
c5c77ba1 | 2156 | if (s32Error) { |
24db713f LK |
2157 | PRINT_ER("failed to send config packet\n"); |
2158 | s32Error = -EINVAL; | |
c5c77ba1 JK |
2159 | } |
2160 | ||
2161 | return s32Error; | |
2162 | } | |
2163 | ||
2164 | /** | |
2165 | * @brief Handle_ConnectTimeout | |
2166 | * @details Call connect notification callback function indicating connection failure | |
2167 | * @param[in] NONE | |
2168 | * @return Error code. | |
2169 | * @author | |
2170 | * @date | |
2171 | * @version 1.0 | |
2172 | */ | |
2b05df55 | 2173 | static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) |
c5c77ba1 | 2174 | { |
e6e12661 | 2175 | s32 s32Error = 0; |
c5c77ba1 JK |
2176 | tstrConnectInfo strConnectInfo; |
2177 | tstrWID strWID; | |
d85f5326 | 2178 | u16 u16DummyReasonCode = 0; |
c5c77ba1 JK |
2179 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
2180 | ||
2181 | if (pstrWFIDrv == NULL) { | |
2182 | PRINT_ER("Driver handler is NULL\n"); | |
2183 | return s32Error; | |
2184 | } | |
2185 | ||
2186 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; | |
2187 | ||
72ed4dc7 | 2188 | gbScanWhileConnected = false; |
c5c77ba1 JK |
2189 | |
2190 | ||
2cc46837 | 2191 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
c5c77ba1 JK |
2192 | |
2193 | ||
2194 | /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, | |
2195 | * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying | |
2196 | * WID_DISCONNECT} */ | |
2197 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { | |
2198 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { | |
d00d2ba3 | 2199 | memcpy(strConnectInfo.au8bssid, |
c5c77ba1 JK |
2200 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
2201 | } | |
2202 | ||
2203 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { | |
2204 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; | |
f3052587 | 2205 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
d00d2ba3 | 2206 | memcpy(strConnectInfo.pu8ReqIEs, |
c5c77ba1 JK |
2207 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
2208 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); | |
2209 | } | |
2210 | ||
2211 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, | |
2212 | &strConnectInfo, | |
2213 | MAC_DISCONNECTED, | |
2214 | NULL, | |
2215 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); | |
2216 | ||
2217 | /* Deallocation of strConnectInfo.pu8ReqIEs */ | |
2218 | if (strConnectInfo.pu8ReqIEs != NULL) { | |
49188af2 | 2219 | kfree(strConnectInfo.pu8ReqIEs); |
c5c77ba1 JK |
2220 | strConnectInfo.pu8ReqIEs = NULL; |
2221 | } | |
2222 | } else { | |
03b2d5e7 | 2223 | PRINT_ER("Connect callback function pointer is NULL\n"); |
c5c77ba1 JK |
2224 | } |
2225 | ||
2226 | /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying | |
2227 | * WID_DISCONNECT} */ | |
d85f5326 | 2228 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
c5c77ba1 | 2229 | strWID.enuWIDtype = WID_CHAR; |
ca356ada | 2230 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
576917ad | 2231 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
2232 | |
2233 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); | |
2234 | ||
d42ab083 JK |
2235 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
2236 | get_id_from_handler(pstrWFIDrv)); | |
2b9d5b48 | 2237 | if (s32Error) |
c5c77ba1 | 2238 | PRINT_ER("Failed to send dissconect config packet\n"); |
c5c77ba1 JK |
2239 | |
2240 | /* Deallocation of the Saved Connect Request in the global Handle */ | |
2241 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; | |
2242 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { | |
49188af2 | 2243 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
c5c77ba1 JK |
2244 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
2245 | } | |
2246 | ||
2247 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { | |
49188af2 | 2248 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
c5c77ba1 JK |
2249 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
2250 | } | |
2251 | ||
2252 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; | |
2253 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { | |
49188af2 | 2254 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
c5c77ba1 JK |
2255 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
2256 | } | |
2257 | ||
2cc46837 | 2258 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
c5c77ba1 JK |
2259 | /*BugID_5213*/ |
2260 | /*Freeing flushed join request params on connect timeout*/ | |
8a625cad | 2261 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
49188af2 | 2262 | kfree(gu8FlushedJoinReq); |
c5c77ba1 JK |
2263 | gu8FlushedJoinReq = NULL; |
2264 | } | |
8a625cad | 2265 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
49188af2 | 2266 | kfree(gu8FlushedInfoElemAsoc); |
c5c77ba1 JK |
2267 | gu8FlushedInfoElemAsoc = NULL; |
2268 | } | |
2269 | ||
2270 | return s32Error; | |
2271 | } | |
2272 | ||
2273 | /** | |
2274 | * @brief Handle_RcvdNtwrkInfo | |
2275 | * @details Handling received network information | |
2276 | * @param[in] tstrRcvdNetworkInfo* pstrRcvdNetworkInfo | |
2277 | * @return Error code. | |
2278 | * @author | |
2279 | * @date | |
2280 | * @version 1.0 | |
2281 | */ | |
2b05df55 | 2282 | static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdNetworkInfo *pstrRcvdNetworkInfo) |
c5c77ba1 | 2283 | { |
4e4467fd | 2284 | u32 i; |
72ed4dc7 | 2285 | bool bNewNtwrkFound; |
c5c77ba1 JK |
2286 | |
2287 | ||
2288 | ||
e6e12661 | 2289 | s32 s32Error = 0; |
c5c77ba1 JK |
2290 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
2291 | void *pJoinParams = NULL; | |
2292 | ||
2293 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
2294 | ||
2295 | ||
2296 | ||
72ed4dc7 | 2297 | bNewNtwrkFound = true; |
c5c77ba1 JK |
2298 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
2299 | ||
2300 | /*if there is a an ongoing scan request*/ | |
2301 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { | |
2302 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); | |
2303 | ParseNetworkInfo(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo); | |
2304 | if ((pstrNetworkInfo == NULL) | |
b1413b60 | 2305 | || (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == NULL)) { |
24db713f LK |
2306 | PRINT_ER("driver is null\n"); |
2307 | s32Error = -EINVAL; | |
2308 | goto done; | |
c5c77ba1 JK |
2309 | } |
2310 | ||
2311 | /* check whether this network is discovered before */ | |
2312 | for (i = 0; i < pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount; i++) { | |
2313 | ||
2314 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && | |
2315 | (pstrNetworkInfo->au8bssid != NULL)) { | |
1a646e7e | 2316 | if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, |
c5c77ba1 JK |
2317 | pstrNetworkInfo->au8bssid, 6) == 0) { |
2318 | if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { | |
2319 | /*we have already found this network with better rssi, so keep the old cached one and don't | |
2320 | * send anything to the upper layer */ | |
2321 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); | |
2322 | goto done; | |
2323 | } else { | |
2324 | /* here the same already found network is found again but with a better rssi, so just update | |
2325 | * the rssi for this cached network and send this updated network to the upper layer but | |
2326 | * don't add a new record for it */ | |
2327 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; | |
72ed4dc7 | 2328 | bNewNtwrkFound = false; |
c5c77ba1 JK |
2329 | break; |
2330 | } | |
2331 | } | |
2332 | } | |
2333 | } | |
2334 | ||
72ed4dc7 | 2335 | if (bNewNtwrkFound == true) { |
c5c77ba1 JK |
2336 | /* here it is confirmed that it is a new discovered network, |
2337 | * so add its record then call the User CallBack function */ | |
2338 | ||
2339 | PRINT_D(HOSTINF_DBG, "New network found\n"); | |
2340 | ||
2341 | if (pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { | |
2342 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; | |
2343 | ||
2344 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) | |
2345 | && (pstrNetworkInfo->au8bssid != NULL)) { | |
d00d2ba3 | 2346 | memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, |
c5c77ba1 JK |
2347 | pstrNetworkInfo->au8bssid, 6); |
2348 | ||
2349 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++; | |
2350 | ||
72ed4dc7 | 2351 | pstrNetworkInfo->bNewNetwork = true; |
c5c77ba1 JK |
2352 | /*Bug4218: Parsing Join Param*/ |
2353 | /* add new BSS to JoinBssTable */ | |
2354 | #ifdef WILC_PARSE_SCAN_IN_HOST | |
2355 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); | |
2356 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ | |
2357 | ||
2358 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, | |
2359 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, | |
2360 | pJoinParams); | |
2361 | ||
2362 | ||
2363 | } | |
2364 | } else { | |
03b2d5e7 | 2365 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
c5c77ba1 JK |
2366 | } |
2367 | } else { | |
72ed4dc7 | 2368 | pstrNetworkInfo->bNewNetwork = false; |
c5c77ba1 JK |
2369 | /* just call the User CallBack function to send the same discovered network with its updated RSSI */ |
2370 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, | |
2371 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); | |
2372 | } | |
2373 | } | |
2374 | ||
c5c77ba1 JK |
2375 | done: |
2376 | /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ | |
2377 | if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { | |
49188af2 | 2378 | kfree(pstrRcvdNetworkInfo->pu8Buffer); |
c5c77ba1 JK |
2379 | pstrRcvdNetworkInfo->pu8Buffer = NULL; |
2380 | } | |
2381 | ||
2382 | /*free structure allocated*/ | |
b1413b60 | 2383 | if (pstrNetworkInfo != NULL) { |
c5c77ba1 | 2384 | DeallocateNetworkInfo(pstrNetworkInfo); |
b1413b60 | 2385 | pstrNetworkInfo = NULL; |
c5c77ba1 JK |
2386 | } |
2387 | ||
2388 | return s32Error; | |
2389 | } | |
2390 | ||
2391 | /** | |
2392 | * @brief Handle_RcvdGnrlAsyncInfo | |
2393 | * @details Handling received asynchrous general network information | |
2394 | * @param[in] tstrRcvdGnrlAsyncInfo* pstrRcvdGnrlAsyncInfo | |
2395 | * @return Error code. | |
2396 | * @author | |
2397 | * @date | |
2398 | * @version 1.0 | |
2399 | */ | |
2b05df55 | 2400 | static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsyncInfo *pstrRcvdGnrlAsyncInfo) |
c5c77ba1 JK |
2401 | { |
2402 | /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ | |
2403 | /* which carries only 1 WID which have WID ID = WID_STATUS */ | |
e6e12661 | 2404 | s32 s32Error = 0; |
63d03e47 GKH |
2405 | u8 u8MsgType = 0; |
2406 | u8 u8MsgID = 0; | |
d85f5326 CL |
2407 | u16 u16MsgLen = 0; |
2408 | u16 u16WidID = (u16)WID_NIL; | |
63d03e47 GKH |
2409 | u8 u8WidLen = 0; |
2410 | u8 u8MacStatus; | |
2411 | u8 u8MacStatusReasonCode; | |
2412 | u8 u8MacStatusAdditionalInfo; | |
c5c77ba1 JK |
2413 | tstrConnectInfo strConnectInfo; |
2414 | tstrDisconnectNotifInfo strDisconnectNotifInfo; | |
e6e12661 | 2415 | s32 s32Err = 0; |
c5c77ba1 | 2416 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
78c87591 | 2417 | |
2b9d5b48 | 2418 | if (pstrWFIDrv == NULL) |
c5c77ba1 | 2419 | PRINT_ER("Driver handler is NULL\n"); |
c5c77ba1 JK |
2420 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, |
2421 | pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); | |
2422 | ||
2423 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || | |
2424 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) || | |
2425 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { | |
2426 | if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) || | |
b1413b60 | 2427 | (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) { |
24db713f LK |
2428 | PRINT_ER("driver is null\n"); |
2429 | return -EINVAL; | |
c5c77ba1 JK |
2430 | } |
2431 | ||
2432 | u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0]; | |
2433 | ||
2434 | /* Check whether the received message type is 'I' */ | |
2435 | if ('I' != u8MsgType) { | |
2436 | PRINT_ER("Received Message format incorrect.\n"); | |
24db713f | 2437 | return -EFAULT; |
c5c77ba1 JK |
2438 | } |
2439 | ||
2440 | /* Extract message ID */ | |
2441 | u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1]; | |
2442 | ||
2443 | /* Extract message Length */ | |
2444 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]); | |
2445 | ||
2446 | /* Extract WID ID [expected to be = WID_STATUS] */ | |
2447 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]); | |
2448 | ||
2449 | /* Extract WID Length [expected to be = 1] */ | |
2450 | u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6]; | |
2451 | ||
2452 | /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */ | |
2453 | u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7]; | |
2454 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8]; | |
2455 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9]; | |
2456 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); | |
2457 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { | |
2458 | /* our station had sent Association Request frame, so here it will get the Association Response frame then parse it */ | |
4e4467fd | 2459 | u32 u32RcvdAssocRespInfoLen; |
c5c77ba1 JK |
2460 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
2461 | ||
2462 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); | |
2463 | ||
2cc46837 | 2464 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
c5c77ba1 JK |
2465 | |
2466 | if (u8MacStatus == MAC_CONNECTED) { | |
2cc46837 | 2467 | memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
c5c77ba1 | 2468 | |
218dc407 | 2469 | host_int_get_assoc_res_info(pstrWFIDrv, |
c5c77ba1 JK |
2470 | gapu8RcvdAssocResp, |
2471 | MAX_ASSOC_RESP_FRAME_SIZE, | |
2472 | &u32RcvdAssocRespInfoLen); | |
2473 | ||
2474 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); | |
2475 | ||
2476 | if (u32RcvdAssocRespInfoLen != 0) { | |
2477 | ||
2478 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); | |
2479 | s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, | |
2480 | &pstrConnectRespInfo); | |
2481 | if (s32Err) { | |
03b2d5e7 | 2482 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
c5c77ba1 JK |
2483 | } else { |
2484 | /* use the necessary parsed Info from the Received Association Response */ | |
2485 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; | |
2486 | ||
2487 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { | |
2488 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); | |
2489 | if (pstrConnectRespInfo->pu8RespIEs != NULL) { | |
2490 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; | |
2491 | ||
2492 | ||
f3052587 | 2493 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
d00d2ba3 | 2494 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
c5c77ba1 JK |
2495 | pstrConnectRespInfo->u16RespIEsLen); |
2496 | } | |
2497 | } | |
2498 | ||
2499 | /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */ | |
2500 | if (pstrConnectRespInfo != NULL) { | |
2501 | DeallocateAssocRespInfo(pstrConnectRespInfo); | |
2502 | pstrConnectRespInfo = NULL; | |
2503 | } | |
2504 | } | |
2505 | } | |
2506 | } | |
2507 | ||
2508 | /* The station has just received mac status and it also received assoc. response which | |
2509 | * it was waiting for. | |
2510 | * So check first the matching between the received mac status and the received status code in Asoc Resp */ | |
2511 | if ((u8MacStatus == MAC_CONNECTED) && | |
2512 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { | |
03b2d5e7 | 2513 | PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); |
2cc46837 | 2514 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
c5c77ba1 JK |
2515 | |
2516 | } else if (u8MacStatus == MAC_DISCONNECTED) { | |
2517 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); | |
2cc46837 | 2518 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
c5c77ba1 JK |
2519 | } |
2520 | ||
2521 | /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ | |
2522 | /* through a structure of type tstrConnectRespInfo */ | |
2523 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { | |
2524 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); | |
d00d2ba3 | 2525 | memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
c5c77ba1 JK |
2526 | |
2527 | if ((u8MacStatus == MAC_CONNECTED) && | |
2528 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { | |
d00d2ba3 | 2529 | memcpy(pstrWFIDrv->au8AssociatedBSSID, |
c5c77ba1 JK |
2530 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); |
2531 | } | |
2532 | } | |
2533 | ||
2534 | ||
2535 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { | |
2536 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; | |
f3052587 | 2537 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
d00d2ba3 | 2538 | memcpy(strConnectInfo.pu8ReqIEs, |
c5c77ba1 JK |
2539 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
2540 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); | |
2541 | } | |
2542 | ||
2543 | ||
8972d0fe | 2544 | del_timer(&pstrWFIDrv->hConnectTimer); |
c5c77ba1 JK |
2545 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
2546 | &strConnectInfo, | |
2547 | u8MacStatus, | |
2548 | NULL, | |
2549 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); | |
2550 | ||
2551 | ||
2552 | /* if received mac status is MAC_CONNECTED and | |
2553 | * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED | |
2554 | * else change state to IDLE */ | |
2555 | if ((u8MacStatus == MAC_CONNECTED) && | |
2556 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { | |
2557 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP | |
2558 | ||
218dc407 | 2559 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
c5c77ba1 JK |
2560 | #endif |
2561 | ||
2562 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); | |
2563 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTED; | |
2564 | ||
2565 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP | |
2566 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); | |
72ed4dc7 | 2567 | g_obtainingIP = true; |
9eb06643 GKH |
2568 | mod_timer(&hDuringIpTimer, |
2569 | jiffies + msecs_to_jiffies(10000)); | |
c5c77ba1 JK |
2570 | #endif |
2571 | ||
2572 | #ifdef WILC_PARSE_SCAN_IN_HOST | |
2573 | /* open a BA session if possible */ | |
2574 | /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */ | |
2575 | ||
2576 | #endif | |
2577 | ||
2578 | /* host_int_addBASession(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid,0, */ | |
2579 | /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */ | |
2580 | } else { | |
2581 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); | |
2582 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; | |
72ed4dc7 | 2583 | gbScanWhileConnected = false; |
c5c77ba1 JK |
2584 | } |
2585 | ||
2586 | /* Deallocation */ | |
2587 | if (strConnectInfo.pu8RespIEs != NULL) { | |
49188af2 | 2588 | kfree(strConnectInfo.pu8RespIEs); |
c5c77ba1 JK |
2589 | strConnectInfo.pu8RespIEs = NULL; |
2590 | } | |
2591 | ||
2592 | if (strConnectInfo.pu8ReqIEs != NULL) { | |
49188af2 | 2593 | kfree(strConnectInfo.pu8ReqIEs); |
c5c77ba1 JK |
2594 | strConnectInfo.pu8ReqIEs = NULL; |
2595 | } | |
2596 | ||
2597 | ||
2598 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; | |
2599 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { | |
49188af2 | 2600 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
c5c77ba1 JK |
2601 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
2602 | } | |
2603 | ||
2604 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { | |
49188af2 | 2605 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
c5c77ba1 JK |
2606 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
2607 | } | |
2608 | ||
2609 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; | |
2610 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { | |
49188af2 | 2611 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
c5c77ba1 JK |
2612 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
2613 | } | |
2614 | ||
2615 | } else if ((u8MacStatus == MAC_DISCONNECTED) && | |
2616 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)) { | |
2617 | /* Disassociation or Deauthentication frame has been received */ | |
2618 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); | |
2619 | ||
2cc46837 | 2620 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
c5c77ba1 JK |
2621 | |
2622 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { | |
03b2d5e7 | 2623 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); |
8972d0fe | 2624 | del_timer(&pstrWFIDrv->hScanTimer); |
c5c77ba1 JK |
2625 | Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); |
2626 | } | |
2627 | ||
2628 | strDisconnectNotifInfo.u16reason = 0; | |
2629 | strDisconnectNotifInfo.ie = NULL; | |
2630 | strDisconnectNotifInfo.ie_len = 0; | |
2631 | ||
2632 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { | |
2633 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP | |
2634 | ||
72ed4dc7 | 2635 | g_obtainingIP = false; |
218dc407 | 2636 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
c5c77ba1 JK |
2637 | #endif |
2638 | ||
2639 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, | |
2640 | NULL, | |
2641 | 0, | |
2642 | &strDisconnectNotifInfo, | |
2643 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); | |
2644 | ||
2645 | } else { | |
03b2d5e7 | 2646 | PRINT_ER("Connect result callback function is NULL\n"); |
c5c77ba1 JK |
2647 | } |
2648 | ||
2cc46837 | 2649 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
c5c77ba1 JK |
2650 | |
2651 | ||
2652 | /* Deallocation */ | |
2653 | ||
2654 | /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they | |
2655 | * should be deallocated here */ | |
2656 | /* | |
2657 | * if(strDisconnectNotifInfo.ie != NULL) | |
2658 | * { | |
49188af2 | 2659 | * kfree(strDisconnectNotifInfo.ie); |
c5c77ba1 JK |
2660 | * strDisconnectNotifInfo.ie = NULL; |
2661 | * } | |
2662 | */ | |
2663 | ||
2664 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; | |
2665 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { | |
49188af2 | 2666 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
c5c77ba1 JK |
2667 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
2668 | } | |
2669 | ||
2670 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { | |
49188af2 | 2671 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
c5c77ba1 JK |
2672 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
2673 | } | |
2674 | ||
2675 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; | |
2676 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { | |
49188af2 | 2677 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
c5c77ba1 JK |
2678 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
2679 | } | |
2680 | ||
2681 | /*BugID_5213*/ | |
2682 | /*Freeing flushed join request params on receiving*/ | |
2683 | /*MAC_DISCONNECTED while connected*/ | |
8a625cad | 2684 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
49188af2 | 2685 | kfree(gu8FlushedJoinReq); |
c5c77ba1 JK |
2686 | gu8FlushedJoinReq = NULL; |
2687 | } | |
8a625cad | 2688 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
49188af2 | 2689 | kfree(gu8FlushedInfoElemAsoc); |
c5c77ba1 JK |
2690 | gu8FlushedInfoElemAsoc = NULL; |
2691 | } | |
2692 | ||
2693 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; | |
72ed4dc7 | 2694 | gbScanWhileConnected = false; |
c5c77ba1 JK |
2695 | |
2696 | } else if ((u8MacStatus == MAC_DISCONNECTED) && | |
2697 | (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { | |
2698 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n"); | |
03b2d5e7 | 2699 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
c5c77ba1 | 2700 | /*Abort the running scan*/ |
8972d0fe | 2701 | del_timer(&pstrWFIDrv->hScanTimer); |
2b9d5b48 | 2702 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) |
2b05df55 | 2703 | Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); |
c5c77ba1 | 2704 | |
c5c77ba1 JK |
2705 | } |
2706 | ||
2707 | } | |
2708 | ||
c5c77ba1 JK |
2709 | /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
2710 | if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { | |
49188af2 | 2711 | kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); |
c5c77ba1 JK |
2712 | pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; |
2713 | } | |
2714 | ||
2715 | return s32Error; | |
2716 | } | |
2717 | ||
2718 | /** | |
2719 | * @brief Handle_Key | |
2720 | * @details Sending config packet to firmware to set key | |
2721 | * @param[in] tstrHostIFkeyAttr* pstrHostIFkeyAttr | |
2722 | * @return Error code. | |
2723 | * @author | |
2724 | * @date | |
2725 | * @version 1.0 | |
2726 | */ | |
2b05df55 | 2727 | static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) |
c5c77ba1 | 2728 | { |
e6e12661 | 2729 | s32 s32Error = 0; |
c5c77ba1 JK |
2730 | tstrWID strWID; |
2731 | #ifdef WILC_AP_EXTERNAL_MLME | |
2732 | tstrWID strWIDList[5]; | |
2733 | #endif | |
63d03e47 GKH |
2734 | u8 i; |
2735 | u8 *pu8keybuf; | |
ca356ada CL |
2736 | s8 s8idxarray[1]; |
2737 | s8 ret = 0; | |
c5c77ba1 JK |
2738 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
2739 | ||
2740 | ||
2741 | switch (pstrHostIFkeyAttr->enuKeyType) { | |
2742 | ||
2743 | ||
2744 | case WEP: | |
2745 | ||
2746 | #ifdef WILC_AP_EXTERNAL_MLME | |
2747 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { | |
2748 | ||
2749 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); | |
2750 | PRINT_D(GENERIC_DBG, "ID Hostint is %d\n", (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); | |
d85f5326 | 2751 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
c5c77ba1 | 2752 | strWIDList[0].enuWIDtype = WID_CHAR; |
576917ad | 2753 | strWIDList[0].s32ValueSize = sizeof(char); |
ca356ada | 2754 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8mode)); |
c5c77ba1 JK |
2755 | |
2756 | strWIDList[1].u16WIDid = WID_AUTH_TYPE; | |
2757 | strWIDList[1].enuWIDtype = WID_CHAR; | |
576917ad | 2758 | strWIDList[1].s32ValueSize = sizeof(char); |
ca356ada | 2759 | strWIDList[1].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type)); |
c5c77ba1 | 2760 | |
d85f5326 | 2761 | strWIDList[2].u16WIDid = (u16)WID_KEY_ID; |
c5c77ba1 JK |
2762 | strWIDList[2].enuWIDtype = WID_CHAR; |
2763 | ||
ca356ada | 2764 | strWIDList[2].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
576917ad | 2765 | strWIDList[2].s32ValueSize = sizeof(char); |
c5c77ba1 JK |
2766 | |
2767 | ||
f3052587 | 2768 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, GFP_KERNEL); |
c5c77ba1 JK |
2769 | |
2770 | ||
2771 | if (pu8keybuf == NULL) { | |
2772 | PRINT_ER("No buffer to send Key\n"); | |
2773 | return -1; | |
2774 | } | |
2775 | ||
d00d2ba3 | 2776 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
c5c77ba1 JK |
2777 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
2778 | ||
2779 | ||
49188af2 | 2780 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
c5c77ba1 | 2781 | |
d85f5326 | 2782 | strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE; |
c5c77ba1 JK |
2783 | strWIDList[3].enuWIDtype = WID_STR; |
2784 | strWIDList[3].s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen; | |
ca356ada | 2785 | strWIDList[3].ps8WidVal = (s8 *)pu8keybuf; |
c5c77ba1 JK |
2786 | |
2787 | ||
d42ab083 JK |
2788 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, |
2789 | get_id_from_handler(pstrWFIDrv)); | |
49188af2 | 2790 | kfree(pu8keybuf); |
c5c77ba1 JK |
2791 | |
2792 | ||
2793 | } | |
2794 | #endif | |
2795 | ||
2796 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { | |
2797 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); | |
f3052587 | 2798 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2, GFP_KERNEL); |
c5c77ba1 JK |
2799 | if (pu8keybuf == NULL) { |
2800 | PRINT_ER("No buffer to send Key\n"); | |
2801 | return -1; | |
2802 | } | |
2803 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; | |
2804 | ||
d00d2ba3 | 2805 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); |
c5c77ba1 | 2806 | |
d00d2ba3 | 2807 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
c5c77ba1 JK |
2808 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
2809 | ||
49188af2 | 2810 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
c5c77ba1 | 2811 | |
d85f5326 | 2812 | strWID.u16WIDid = (u16)WID_ADD_WEP_KEY; |
c5c77ba1 | 2813 | strWID.enuWIDtype = WID_STR; |
ca356ada | 2814 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
c5c77ba1 JK |
2815 | strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2; |
2816 | ||
d42ab083 JK |
2817 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
2818 | get_id_from_handler(pstrWFIDrv)); | |
49188af2 | 2819 | kfree(pu8keybuf); |
c5c77ba1 JK |
2820 | } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { |
2821 | ||
2822 | PRINT_D(HOSTINF_DBG, "Removing key\n"); | |
d85f5326 | 2823 | strWID.u16WIDid = (u16)WID_REMOVE_WEP_KEY; |
c5c77ba1 JK |
2824 | strWID.enuWIDtype = WID_STR; |
2825 | ||
ca356ada | 2826 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
c5c77ba1 JK |
2827 | strWID.ps8WidVal = s8idxarray; |
2828 | strWID.s32ValueSize = 1; | |
2829 | ||
d42ab083 JK |
2830 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
2831 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 2832 | } else { |
d85f5326 | 2833 | strWID.u16WIDid = (u16)WID_KEY_ID; |
c5c77ba1 | 2834 | strWID.enuWIDtype = WID_CHAR; |
ca356ada | 2835 | strWID.ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
576917ad | 2836 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
2837 | |
2838 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); | |
2839 | ||
d42ab083 JK |
2840 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
2841 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 2842 | } |
83383ea3 | 2843 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 JK |
2844 | break; |
2845 | ||
2846 | case WPARxGtk: | |
2847 | #ifdef WILC_AP_EXTERNAL_MLME | |
2848 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { | |
f3052587 | 2849 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
c5c77ba1 JK |
2850 | if (pu8keybuf == NULL) { |
2851 | PRINT_ER("No buffer to send RxGTK Key\n"); | |
2852 | ret = -1; | |
2853 | goto _WPARxGtk_end_case_; | |
2854 | } | |
2855 | ||
2cc46837 | 2856 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
c5c77ba1 JK |
2857 | |
2858 | ||
2859 | /*|----------------------------------------------------------------------------| | |
2860 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | | |
2861 | * |------------|---------|-------|------------|---------------|----------------| | |
2862 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ | |
2863 | ||
2864 | ||
2865 | ||
2866 | if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL) | |
d00d2ba3 | 2867 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
c5c77ba1 JK |
2868 | |
2869 | ||
d00d2ba3 | 2870 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
c5c77ba1 | 2871 | |
d00d2ba3 | 2872 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
c5c77ba1 | 2873 | |
d00d2ba3 | 2874 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
c5c77ba1 JK |
2875 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
2876 | /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ | |
d85f5326 | 2877 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
c5c77ba1 | 2878 | strWIDList[0].enuWIDtype = WID_CHAR; |
576917ad | 2879 | strWIDList[0].s32ValueSize = sizeof(char); |
ca356ada | 2880 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
c5c77ba1 | 2881 | |
d85f5326 | 2882 | strWIDList[1].u16WIDid = (u16)WID_ADD_RX_GTK; |
c5c77ba1 | 2883 | strWIDList[1].enuWIDtype = WID_STR; |
ca356ada | 2884 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
c5c77ba1 JK |
2885 | strWIDList[1].s32ValueSize = RX_MIC_KEY_MSG_LEN; |
2886 | ||
d42ab083 JK |
2887 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
2888 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 2889 | |
49188af2 | 2890 | kfree(pu8keybuf); |
c5c77ba1 JK |
2891 | |
2892 | /* ////////////////////////// */ | |
83383ea3 | 2893 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 JK |
2894 | /* ///////////////////////// */ |
2895 | } | |
2896 | ||
2897 | #endif | |
2898 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { | |
2899 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); | |
2900 | ||
f3052587 | 2901 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
c5c77ba1 JK |
2902 | if (pu8keybuf == NULL) { |
2903 | PRINT_ER("No buffer to send RxGTK Key\n"); | |
2904 | ret = -1; | |
2905 | goto _WPARxGtk_end_case_; | |
2906 | } | |
2907 | ||
2cc46837 | 2908 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
c5c77ba1 JK |
2909 | |
2910 | ||
2911 | /*|----------------------------------------------------------------------------| | |
2912 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | | |
2913 | * |------------|---------|-------|------------|---------------|----------------| | |
2914 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ | |
2915 | ||
78174ada | 2916 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
d00d2ba3 | 2917 | memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); |
78174ada | 2918 | else |
03b2d5e7 | 2919 | PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n"); |
c5c77ba1 | 2920 | |
d00d2ba3 | 2921 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
c5c77ba1 | 2922 | |
d00d2ba3 | 2923 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
c5c77ba1 | 2924 | |
d00d2ba3 CL |
2925 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
2926 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, | |
c5c77ba1 JK |
2927 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
2928 | ||
d85f5326 | 2929 | strWID.u16WIDid = (u16)WID_ADD_RX_GTK; |
c5c77ba1 | 2930 | strWID.enuWIDtype = WID_STR; |
ca356ada | 2931 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
c5c77ba1 JK |
2932 | strWID.s32ValueSize = RX_MIC_KEY_MSG_LEN; |
2933 | ||
d42ab083 JK |
2934 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
2935 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 2936 | |
49188af2 | 2937 | kfree(pu8keybuf); |
c5c77ba1 JK |
2938 | |
2939 | /* ////////////////////////// */ | |
83383ea3 | 2940 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 JK |
2941 | /* ///////////////////////// */ |
2942 | } | |
2943 | _WPARxGtk_end_case_: | |
49188af2 CL |
2944 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
2945 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); | |
c5c77ba1 JK |
2946 | if (ret == -1) |
2947 | return ret; | |
2948 | ||
2949 | break; | |
2950 | ||
2951 | case WPAPtk: | |
2952 | #ifdef WILC_AP_EXTERNAL_MLME | |
2953 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { | |
2954 | ||
2955 | ||
f3052587 | 2956 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
c5c77ba1 JK |
2957 | |
2958 | ||
2959 | ||
2960 | if (pu8keybuf == NULL) { | |
2961 | PRINT_ER("No buffer to send PTK Key\n"); | |
2962 | ret = -1; | |
2963 | goto _WPAPtk_end_case_; | |
2964 | ||
2965 | } | |
2966 | ||
2967 | /*|-----------------------------------------------------------------------------| | |
2968 | * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key | | |
2969 | * |----------------|------------ |--------------|----------------|---------------| | |
2970 | | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | | |
2971 | |-----------------------------------------------------------------------------|*/ | |
2972 | ||
d00d2ba3 | 2973 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
c5c77ba1 | 2974 | |
d00d2ba3 CL |
2975 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
2976 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); | |
c5c77ba1 | 2977 | /*16 byte TK*/ |
d00d2ba3 | 2978 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
c5c77ba1 JK |
2979 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
2980 | ||
2981 | ||
d85f5326 | 2982 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
c5c77ba1 | 2983 | strWIDList[0].enuWIDtype = WID_CHAR; |
576917ad | 2984 | strWIDList[0].s32ValueSize = sizeof(char); |
ca356ada | 2985 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
c5c77ba1 | 2986 | |
d85f5326 | 2987 | strWIDList[1].u16WIDid = (u16)WID_ADD_PTK; |
c5c77ba1 | 2988 | strWIDList[1].enuWIDtype = WID_STR; |
ca356ada | 2989 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
c5c77ba1 JK |
2990 | strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1; |
2991 | ||
d42ab083 JK |
2992 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
2993 | get_id_from_handler(pstrWFIDrv)); | |
49188af2 | 2994 | kfree(pu8keybuf); |
c5c77ba1 JK |
2995 | |
2996 | /* ////////////////////////// */ | |
83383ea3 | 2997 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 JK |
2998 | /* ///////////////////////// */ |
2999 | } | |
3000 | #endif | |
3001 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { | |
3002 | ||
3003 | ||
f3052587 | 3004 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
c5c77ba1 JK |
3005 | |
3006 | ||
3007 | ||
3008 | if (pu8keybuf == NULL) { | |
3009 | PRINT_ER("No buffer to send PTK Key\n"); | |
3010 | ret = -1; | |
3011 | goto _WPAPtk_end_case_; | |
3012 | ||
3013 | } | |
3014 | ||
3015 | /*|-----------------------------------------------------------------------------| | |
3016 | * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | | |
3017 | * |----------------|------------|--------------|----------------|---------------| | |
3018 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | | |
3019 | |-----------------------------------------------------------------------------|*/ | |
3020 | ||
d00d2ba3 | 3021 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
c5c77ba1 | 3022 | |
d00d2ba3 | 3023 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
c5c77ba1 | 3024 | /*16 byte TK*/ |
d00d2ba3 | 3025 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
c5c77ba1 JK |
3026 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
3027 | ||
3028 | ||
d85f5326 | 3029 | strWID.u16WIDid = (u16)WID_ADD_PTK; |
c5c77ba1 | 3030 | strWID.enuWIDtype = WID_STR; |
ca356ada | 3031 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
c5c77ba1 JK |
3032 | strWID.s32ValueSize = PTK_KEY_MSG_LEN; |
3033 | ||
d42ab083 JK |
3034 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
3035 | get_id_from_handler(pstrWFIDrv)); | |
49188af2 | 3036 | kfree(pu8keybuf); |
c5c77ba1 JK |
3037 | |
3038 | /* ////////////////////////// */ | |
83383ea3 | 3039 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 JK |
3040 | /* ///////////////////////// */ |
3041 | } | |
3042 | ||
3043 | _WPAPtk_end_case_: | |
49188af2 | 3044 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
c5c77ba1 JK |
3045 | if (ret == -1) |
3046 | return ret; | |
3047 | ||
3048 | break; | |
3049 | ||
3050 | ||
3051 | case PMKSA: | |
3052 | ||
3053 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); | |
3054 | ||
f3052587 | 3055 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
c5c77ba1 JK |
3056 | if (pu8keybuf == NULL) { |
3057 | PRINT_ER("No buffer to send PMKSA Key\n"); | |
3058 | return -1; | |
3059 | } | |
3060 | ||
3061 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; | |
3062 | ||
3063 | for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) { | |
3064 | ||
d00d2ba3 CL |
3065 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); |
3066 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, PMKID_LEN); | |
c5c77ba1 JK |
3067 | } |
3068 | ||
d85f5326 | 3069 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
c5c77ba1 | 3070 | strWID.enuWIDtype = WID_STR; |
ca356ada | 3071 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
c5c77ba1 JK |
3072 | strWID.s32ValueSize = (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1; |
3073 | ||
d42ab083 JK |
3074 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
3075 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 3076 | |
49188af2 | 3077 | kfree(pu8keybuf); |
c5c77ba1 JK |
3078 | break; |
3079 | } | |
3080 | ||
3081 | if (s32Error) | |
3082 | PRINT_ER("Failed to send key config packet\n"); | |
3083 | ||
3084 | ||
3085 | return s32Error; | |
3086 | } | |
3087 | ||
3088 | ||
3089 | /** | |
3090 | * @brief Handle_Disconnect | |
3091 | * @details Sending config packet to firmware to disconnect | |
3092 | * @param[in] NONE | |
3093 | * @return NONE | |
3094 | * @author | |
3095 | * @date | |
3096 | * @version 1.0 | |
3097 | */ | |
2b05df55 | 3098 | static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) |
c5c77ba1 JK |
3099 | { |
3100 | tstrWID strWID; | |
3101 | ||
e6e12661 | 3102 | s32 s32Error = 0; |
d85f5326 | 3103 | u16 u16DummyReasonCode = 0; |
c5c77ba1 JK |
3104 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
3105 | ||
3106 | ||
d85f5326 | 3107 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
c5c77ba1 | 3108 | strWID.enuWIDtype = WID_CHAR; |
ca356ada | 3109 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
576917ad | 3110 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
3111 | |
3112 | ||
3113 | ||
3114 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); | |
3115 | ||
3116 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP | |
3117 | ||
72ed4dc7 | 3118 | g_obtainingIP = false; |
218dc407 | 3119 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
c5c77ba1 JK |
3120 | #endif |
3121 | ||
2cc46837 | 3122 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
c5c77ba1 | 3123 | |
d42ab083 JK |
3124 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
3125 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
3126 | |
3127 | if (s32Error) { | |
3128 | PRINT_ER("Failed to send dissconect config packet\n"); | |
c5c77ba1 JK |
3129 | } else { |
3130 | tstrDisconnectNotifInfo strDisconnectNotifInfo; | |
3131 | ||
2cc46837 | 3132 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
c5c77ba1 JK |
3133 | |
3134 | strDisconnectNotifInfo.u16reason = 0; | |
3135 | strDisconnectNotifInfo.ie = NULL; | |
3136 | strDisconnectNotifInfo.ie_len = 0; | |
3137 | ||
3138 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { | |
8972d0fe | 3139 | del_timer(&pstrWFIDrv->hScanTimer); |
b1413b60 | 3140 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
c5c77ba1 JK |
3141 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
3142 | ||
b1413b60 | 3143 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
c5c77ba1 JK |
3144 | } |
3145 | ||
3146 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { | |
3147 | ||
3148 | /*BugID_5193*/ | |
3149 | /*Stop connect timer, if connection in progress*/ | |
3150 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { | |
3151 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); | |
8972d0fe | 3152 | del_timer(&pstrWFIDrv->hConnectTimer); |
c5c77ba1 JK |
3153 | } |
3154 | ||
3155 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, | |
3156 | 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); | |
3157 | } else { | |
03b2d5e7 | 3158 | PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); |
c5c77ba1 JK |
3159 | } |
3160 | ||
72ed4dc7 | 3161 | gbScanWhileConnected = false; |
c5c77ba1 JK |
3162 | |
3163 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; | |
3164 | ||
2cc46837 | 3165 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
c5c77ba1 JK |
3166 | |
3167 | ||
3168 | /* Deallocation */ | |
3169 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; | |
3170 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { | |
49188af2 | 3171 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
c5c77ba1 JK |
3172 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
3173 | } | |
3174 | ||
3175 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { | |
49188af2 | 3176 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
c5c77ba1 JK |
3177 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
3178 | } | |
3179 | ||
3180 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; | |
3181 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { | |
49188af2 | 3182 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
c5c77ba1 JK |
3183 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
3184 | } | |
3185 | ||
3186 | ||
3187 | /*BugID_5137*/ | |
8a625cad | 3188 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
49188af2 | 3189 | kfree(gu8FlushedJoinReq); |
c5c77ba1 JK |
3190 | gu8FlushedJoinReq = NULL; |
3191 | } | |
8a625cad | 3192 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
49188af2 | 3193 | kfree(gu8FlushedInfoElemAsoc); |
c5c77ba1 JK |
3194 | gu8FlushedInfoElemAsoc = NULL; |
3195 | } | |
3196 | ||
3197 | } | |
3198 | ||
c5c77ba1 | 3199 | /* ////////////////////////// */ |
83383ea3 | 3200 | up(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
c5c77ba1 JK |
3201 | /* ///////////////////////// */ |
3202 | ||
3203 | } | |
3204 | ||
3205 | ||
2b05df55 | 3206 | void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler) |
c5c77ba1 JK |
3207 | { |
3208 | tstrWILC_WFIDrv *pstrWFIDrv; | |
3209 | ||
3210 | pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
b1413b60 | 3211 | if (pstrWFIDrv == NULL) |
c5c77ba1 JK |
3212 | return; |
3213 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) { | |
3214 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); | |
218dc407 | 3215 | host_int_disconnect(pstrWFIDrv, 1); |
c5c77ba1 JK |
3216 | } |
3217 | } | |
2b05df55 | 3218 | static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler) |
c5c77ba1 JK |
3219 | { |
3220 | ||
3221 | ||
e6e12661 | 3222 | s32 s32Error = 0; |
c5c77ba1 JK |
3223 | tstrWID strWID; |
3224 | static char dummy = 9; | |
3225 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
3226 | ||
d85f5326 | 3227 | strWID.u16WIDid = (u16)WID_LOGTerminal_Switch; |
c5c77ba1 JK |
3228 | strWID.enuWIDtype = WID_CHAR; |
3229 | strWID.ps8WidVal = &dummy; | |
576917ad | 3230 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 | 3231 | |
d42ab083 JK |
3232 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
3233 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
3234 | |
3235 | ||
3236 | if (s32Error) { | |
3237 | PRINT_D(HOSTINF_DBG, "Failed to switch log terminal\n"); | |
24db713f LK |
3238 | PRINT_ER("Failed to switch log terminal\n"); |
3239 | return -EINVAL; | |
c5c77ba1 JK |
3240 | } |
3241 | ||
24db713f | 3242 | PRINT_INFO(HOSTINF_DBG, "MAC address set ::\n"); |
c5c77ba1 JK |
3243 | |
3244 | return s32Error; | |
3245 | } | |
3246 | ||
3247 | /** | |
3248 | * @brief Handle_GetChnl | |
3249 | * @details Sending config packet to get channel | |
3250 | * @param[in] NONE | |
3251 | * @return NONE | |
3252 | * | |
3253 | * @author | |
3254 | * @date | |
3255 | * @version 1.0 | |
3256 | */ | |
2b05df55 | 3257 | static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler) |
c5c77ba1 JK |
3258 | { |
3259 | ||
e6e12661 | 3260 | s32 s32Error = 0; |
c5c77ba1 JK |
3261 | tstrWID strWID; |
3262 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ | |
3263 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
78c87591 | 3264 | |
d85f5326 | 3265 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
c5c77ba1 | 3266 | strWID.enuWIDtype = WID_CHAR; |
ca356ada | 3267 | strWID.ps8WidVal = (s8 *)&gu8Chnl; |
576917ad | 3268 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
3269 | |
3270 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); | |
3271 | ||
d42ab083 JK |
3272 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
3273 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
3274 | /*get the value by searching the local copy*/ |
3275 | if (s32Error) { | |
3276 | PRINT_ER("Failed to get channel number\n"); | |
24db713f | 3277 | s32Error = -EFAULT; |
c5c77ba1 JK |
3278 | } |
3279 | ||
83383ea3 | 3280 | up(&(pstrWFIDrv->hSemGetCHNL)); |
c5c77ba1 JK |
3281 | |
3282 | return s32Error; | |
3283 | ||
3284 | ||
3285 | ||
3286 | } | |
3287 | ||
3288 | ||
3289 | /** | |
3290 | * @brief Handle_GetRssi | |
3291 | * @details Sending config packet to get RSSI | |
3292 | * @param[in] NONE | |
3293 | * @return NONE | |
3294 | * @author | |
3295 | * @date | |
3296 | * @version 1.0 | |
3297 | */ | |
2b05df55 | 3298 | static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler) |
c5c77ba1 | 3299 | { |
e6e12661 | 3300 | s32 s32Error = 0; |
c5c77ba1 JK |
3301 | tstrWID strWID; |
3302 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
3303 | ||
d85f5326 | 3304 | strWID.u16WIDid = (u16)WID_RSSI; |
c5c77ba1 JK |
3305 | strWID.enuWIDtype = WID_CHAR; |
3306 | strWID.ps8WidVal = &gs8Rssi; | |
576917ad | 3307 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
3308 | |
3309 | /*Sending Cfg*/ | |
3310 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); | |
3311 | ||
d42ab083 JK |
3312 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
3313 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
3314 | if (s32Error) { |
3315 | PRINT_ER("Failed to get RSSI value\n"); | |
24db713f | 3316 | s32Error = -EFAULT; |
c5c77ba1 JK |
3317 | } |
3318 | ||
83383ea3 | 3319 | up(&(pstrWFIDrv->hSemGetRSSI)); |
c5c77ba1 JK |
3320 | |
3321 | ||
3322 | } | |
3323 | ||
3324 | ||
2b05df55 | 3325 | static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler) |
c5c77ba1 | 3326 | { |
e6e12661 | 3327 | s32 s32Error = 0; |
c5c77ba1 JK |
3328 | tstrWID strWID; |
3329 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
3330 | ||
3331 | gs8lnkspd = 0; | |
3332 | ||
d85f5326 | 3333 | strWID.u16WIDid = (u16)WID_LINKSPEED; |
c5c77ba1 JK |
3334 | strWID.enuWIDtype = WID_CHAR; |
3335 | strWID.ps8WidVal = &gs8lnkspd; | |
576917ad | 3336 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
3337 | /*Sending Cfg*/ |
3338 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); | |
3339 | ||
d42ab083 JK |
3340 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
3341 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
3342 | if (s32Error) { |
3343 | PRINT_ER("Failed to get LINKSPEED value\n"); | |
24db713f | 3344 | s32Error = -EFAULT; |
c5c77ba1 JK |
3345 | } |
3346 | ||
83383ea3 | 3347 | up(&(pstrWFIDrv->hSemGetLINKSPEED)); |
c5c77ba1 JK |
3348 | |
3349 | ||
3350 | } | |
3351 | ||
2b05df55 | 3352 | s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics) |
c5c77ba1 JK |
3353 | { |
3354 | tstrWID strWIDList[5]; | |
fbc2fe16 | 3355 | u32 u32WidsCount = 0, s32Error = 0; |
c5c77ba1 JK |
3356 | |
3357 | strWIDList[u32WidsCount].u16WIDid = WID_LINKSPEED; | |
3358 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; | |
576917ad | 3359 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 3360 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u8LinkSpeed)); |
c5c77ba1 JK |
3361 | u32WidsCount++; |
3362 | ||
3363 | strWIDList[u32WidsCount].u16WIDid = WID_RSSI; | |
3364 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; | |
576917ad | 3365 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
ca356ada | 3366 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->s8RSSI)); |
c5c77ba1 JK |
3367 | u32WidsCount++; |
3368 | ||
3369 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; | |
3370 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; | |
4e4467fd | 3371 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
ca356ada | 3372 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxCount)); |
c5c77ba1 JK |
3373 | u32WidsCount++; |
3374 | ||
3375 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; | |
3376 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; | |
4e4467fd | 3377 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
ca356ada | 3378 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32RxCount)); |
c5c77ba1 JK |
3379 | u32WidsCount++; |
3380 | ||
3381 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; | |
3382 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; | |
4e4467fd | 3383 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
ca356ada | 3384 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxFailureCount)); |
c5c77ba1 JK |
3385 | u32WidsCount++; |
3386 | ||
d42ab083 JK |
3387 | s32Error = SendConfigPkt(GET_CFG, strWIDList, u32WidsCount, false, |
3388 | get_id_from_handler(drvHandler)); | |
c5c77ba1 | 3389 | |
24db713f | 3390 | if (s32Error) |
c5c77ba1 | 3391 | PRINT_ER("Failed to send scan paramters config packet\n"); |
24db713f | 3392 | |
83383ea3 | 3393 | up(&hWaitResponse); |
c5c77ba1 JK |
3394 | return 0; |
3395 | ||
3396 | } | |
3397 | ||
3398 | ||
3399 | #ifdef WILC_AP_EXTERNAL_MLME | |
3400 | ||
3401 | ||
3402 | /** | |
3403 | * @brief Handle_Get_InActiveTime | |
3404 | * @details Sending config packet to set mac adddress for station and | |
3405 | * get inactive time | |
3406 | * @param[in] NONE | |
3407 | * @return NONE | |
3408 | * | |
3409 | * @author | |
3410 | * @date | |
3411 | * @version 1.0 | |
3412 | */ | |
2b05df55 | 3413 | static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaInactiveT *strHostIfStaInactiveT) |
c5c77ba1 JK |
3414 | { |
3415 | ||
e6e12661 | 3416 | s32 s32Error = 0; |
63d03e47 | 3417 | u8 *stamac; |
c5c77ba1 JK |
3418 | tstrWID strWID; |
3419 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
3420 | ||
3421 | ||
d85f5326 | 3422 | strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
c5c77ba1 JK |
3423 | strWID.enuWIDtype = WID_STR; |
3424 | strWID.s32ValueSize = ETH_ALEN; | |
f3052587 | 3425 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
c5c77ba1 JK |
3426 | |
3427 | ||
3428 | stamac = strWID.ps8WidVal; | |
d00d2ba3 | 3429 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
c5c77ba1 JK |
3430 | |
3431 | ||
3432 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); | |
3433 | ||
3434 | ||
d42ab083 JK |
3435 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
3436 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
3437 | /*get the value by searching the local copy*/ |
3438 | if (s32Error) { | |
3439 | PRINT_ER("Failed to SET incative time\n"); | |
24db713f | 3440 | return -EFAULT; |
c5c77ba1 JK |
3441 | } |
3442 | ||
3443 | ||
d85f5326 | 3444 | strWID.u16WIDid = (u16)WID_GET_INACTIVE_TIME; |
c5c77ba1 | 3445 | strWID.enuWIDtype = WID_INT; |
ca356ada | 3446 | strWID.ps8WidVal = (s8 *)&gu32InactiveTime; |
4e4467fd | 3447 | strWID.s32ValueSize = sizeof(u32); |
c5c77ba1 JK |
3448 | |
3449 | ||
d42ab083 JK |
3450 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
3451 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
3452 | /*get the value by searching the local copy*/ |
3453 | if (s32Error) { | |
3454 | PRINT_ER("Failed to get incative time\n"); | |
24db713f | 3455 | return -EFAULT; |
c5c77ba1 JK |
3456 | } |
3457 | ||
3458 | ||
3459 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime); | |
3460 | ||
83383ea3 | 3461 | up(&(pstrWFIDrv->hSemInactiveTime)); |
c5c77ba1 JK |
3462 | |
3463 | return s32Error; | |
3464 | ||
3465 | ||
3466 | ||
3467 | } | |
3468 | ||
3469 | ||
3470 | /** | |
3471 | * @brief Handle_AddBeacon | |
3472 | * @details Sending config packet to add beacon | |
3473 | * @param[in] tstrHostIFSetBeacon* pstrSetBeaconParam | |
3474 | * @return NONE | |
3475 | * @author | |
3476 | * @date | |
3477 | * @version 1.0 | |
3478 | */ | |
2b05df55 | 3479 | static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *pstrSetBeaconParam) |
c5c77ba1 | 3480 | { |
e6e12661 | 3481 | s32 s32Error = 0; |
c5c77ba1 | 3482 | tstrWID strWID; |
63d03e47 | 3483 | u8 *pu8CurrByte; |
c5c77ba1 | 3484 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
78c87591 | 3485 | |
c5c77ba1 JK |
3486 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
3487 | ||
d85f5326 | 3488 | strWID.u16WIDid = (u16)WID_ADD_BEACON; |
c5c77ba1 JK |
3489 | strWID.enuWIDtype = WID_BIN; |
3490 | strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; | |
f3052587 | 3491 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
2b9d5b48 | 3492 | if (strWID.ps8WidVal == NULL) |
24db713f | 3493 | goto ERRORHANDLER; |
c5c77ba1 JK |
3494 | |
3495 | pu8CurrByte = strWID.ps8WidVal; | |
3496 | *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); | |
3497 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF); | |
3498 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF); | |
3499 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF); | |
3500 | ||
3501 | *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF); | |
3502 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF); | |
3503 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF); | |
3504 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF); | |
3505 | ||
3506 | *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF); | |
3507 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF); | |
3508 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF); | |
3509 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF); | |
3510 | ||
3511 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen); | |
3512 | pu8CurrByte += pstrSetBeaconParam->u32HeadLen; | |
3513 | ||
3514 | *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF); | |
3515 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF); | |
3516 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF); | |
3517 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF); | |
3518 | ||
3519 | /* Bug 4599 : if tail length = 0 skip copying */ | |
3520 | if (pstrSetBeaconParam->pu8Tail > 0) | |
3521 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen); | |
3522 | pu8CurrByte += pstrSetBeaconParam->u32TailLen; | |
3523 | ||
3524 | ||
3525 | ||
3526 | /*Sending Cfg*/ | |
d42ab083 JK |
3527 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
3528 | get_id_from_handler(pstrWFIDrv)); | |
24db713f | 3529 | if (s32Error) |
c5c77ba1 | 3530 | PRINT_ER("Failed to send add beacon config packet\n"); |
c5c77ba1 | 3531 | |
24db713f | 3532 | ERRORHANDLER: |
969effe9 GKH |
3533 | kfree(strWID.ps8WidVal); |
3534 | kfree(pstrSetBeaconParam->pu8Head); | |
3535 | kfree(pstrSetBeaconParam->pu8Tail); | |
c5c77ba1 JK |
3536 | } |
3537 | ||
3538 | ||
3539 | /** | |
3540 | * @brief Handle_AddBeacon | |
3541 | * @details Sending config packet to delete beacon | |
3542 | * @param[in] tstrHostIFDelBeacon* pstrDelBeacon | |
3543 | * @return NONE | |
3544 | * @author | |
3545 | * @date | |
3546 | * @version 1.0 | |
3547 | */ | |
2b05df55 | 3548 | static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelBeacon *pstrDelBeacon) |
c5c77ba1 | 3549 | { |
e6e12661 | 3550 | s32 s32Error = 0; |
c5c77ba1 | 3551 | tstrWID strWID; |
63d03e47 | 3552 | u8 *pu8CurrByte; |
c5c77ba1 | 3553 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
78c87591 | 3554 | |
d85f5326 | 3555 | strWID.u16WIDid = (u16)WID_DEL_BEACON; |
c5c77ba1 | 3556 | strWID.enuWIDtype = WID_CHAR; |
576917ad | 3557 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
3558 | strWID.ps8WidVal = &gu8DelBcn; |
3559 | ||
2b9d5b48 | 3560 | if (strWID.ps8WidVal == NULL) |
24db713f | 3561 | return; |
c5c77ba1 JK |
3562 | |
3563 | pu8CurrByte = strWID.ps8WidVal; | |
3564 | ||
3565 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); | |
3566 | /* TODO: build del beacon message*/ | |
3567 | ||
3568 | /*Sending Cfg*/ | |
d42ab083 JK |
3569 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
3570 | get_id_from_handler(pstrWFIDrv)); | |
24db713f | 3571 | if (s32Error) |
c5c77ba1 | 3572 | PRINT_ER("Failed to send delete beacon config packet\n"); |
c5c77ba1 JK |
3573 | } |
3574 | ||
3575 | ||
3576 | /** | |
3577 | * @brief WILC_HostIf_PackStaParam | |
3578 | * @details Handling packing of the station params in a buffer | |
63d03e47 | 3579 | * @param[in] u8* pu8Buffer, tstrWILC_AddStaParam* pstrStationParam |
c5c77ba1 JK |
3580 | * @return NONE |
3581 | * @author | |
3582 | * @date | |
3583 | * @version 1.0 | |
3584 | */ | |
4e4467fd | 3585 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrStationParam) |
c5c77ba1 | 3586 | { |
63d03e47 | 3587 | u8 *pu8CurrByte; |
c5c77ba1 JK |
3588 | |
3589 | pu8CurrByte = pu8Buffer; | |
3590 | ||
3591 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); | |
d00d2ba3 | 3592 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
c5c77ba1 JK |
3593 | pu8CurrByte += ETH_ALEN; |
3594 | ||
3595 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; | |
3596 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; | |
3597 | ||
3598 | *pu8CurrByte++ = pstrStationParam->u8NumRates; | |
2b9d5b48 | 3599 | if (pstrStationParam->u8NumRates > 0) |
d00d2ba3 | 3600 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
c5c77ba1 JK |
3601 | pu8CurrByte += pstrStationParam->u8NumRates; |
3602 | ||
3603 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; | |
3604 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; | |
3605 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; | |
3606 | ||
3607 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; | |
d00d2ba3 | 3608 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
c5c77ba1 JK |
3609 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
3610 | ||
3611 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; | |
3612 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; | |
3613 | ||
3614 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; | |
3615 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; | |
3616 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; | |
3617 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; | |
3618 | ||
3619 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; | |
3620 | ||
3621 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; | |
3622 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; | |
3623 | ||
3624 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; | |
3625 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; | |
3626 | ||
3627 | return pu8CurrByte - pu8Buffer; | |
3628 | } | |
3629 | ||
3630 | /** | |
3631 | * @brief Handle_AddStation | |
3632 | * @details Sending config packet to add station | |
3633 | * @param[in] tstrWILC_AddStaParam* pstrStationParam | |
3634 | * @return NONE | |
3635 | * @author | |
3636 | * @date | |
3637 | * @version 1.0 | |
3638 | */ | |
2b05df55 | 3639 | static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) |
c5c77ba1 | 3640 | { |
e6e12661 | 3641 | s32 s32Error = 0; |
c5c77ba1 | 3642 | tstrWID strWID; |
63d03e47 | 3643 | u8 *pu8CurrByte; |
c5c77ba1 | 3644 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
78c87591 | 3645 | |
c5c77ba1 | 3646 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
d85f5326 | 3647 | strWID.u16WIDid = (u16)WID_ADD_STA; |
c5c77ba1 JK |
3648 | strWID.enuWIDtype = WID_BIN; |
3649 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; | |
3650 | ||
f3052587 | 3651 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
2b9d5b48 | 3652 | if (strWID.ps8WidVal == NULL) |
24db713f | 3653 | goto ERRORHANDLER; |
c5c77ba1 JK |
3654 | |
3655 | pu8CurrByte = strWID.ps8WidVal; | |
3656 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); | |
3657 | ||
3658 | /*Sending Cfg*/ | |
d42ab083 JK |
3659 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
3660 | get_id_from_handler(pstrWFIDrv)); | |
e6e12661 | 3661 | if (s32Error != 0) |
c5c77ba1 | 3662 | PRINT_ER("Failed to send add station config packet\n"); |
c5c77ba1 | 3663 | |
24db713f | 3664 | ERRORHANDLER: |
969effe9 GKH |
3665 | kfree(pstrStationParam->pu8Rates); |
3666 | kfree(strWID.ps8WidVal); | |
c5c77ba1 JK |
3667 | } |
3668 | ||
3669 | /** | |
3670 | * @brief Handle_DelAllSta | |
3671 | * @details Sending config packet to delete station | |
3672 | * @param[in] tstrHostIFDelSta* pstrDelStaParam | |
3673 | * @return NONE | |
3674 | * @author | |
3675 | * @date | |
3676 | * @version 1.0 | |
3677 | */ | |
2b05df55 | 3678 | static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) |
c5c77ba1 | 3679 | { |
e6e12661 | 3680 | s32 s32Error = 0; |
78c87591 | 3681 | |
c5c77ba1 | 3682 | tstrWID strWID; |
63d03e47 | 3683 | u8 *pu8CurrByte; |
c5c77ba1 | 3684 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
63d03e47 | 3685 | u8 i; |
3703480b | 3686 | u8 au8Zero_Buff[6] = {0}; |
78c87591 | 3687 | |
d85f5326 | 3688 | strWID.u16WIDid = (u16)WID_DEL_ALL_STA; |
c5c77ba1 JK |
3689 | strWID.enuWIDtype = WID_STR; |
3690 | strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; | |
3691 | ||
03b2d5e7 | 3692 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
c5c77ba1 | 3693 | |
f3052587 | 3694 | strWID.ps8WidVal = kmalloc((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1, GFP_KERNEL); |
2b9d5b48 | 3695 | if (strWID.ps8WidVal == NULL) |
24db713f | 3696 | goto ERRORHANDLER; |
c5c77ba1 JK |
3697 | |
3698 | pu8CurrByte = strWID.ps8WidVal; | |
3699 | ||
3700 | *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta; | |
3701 | ||
3702 | for (i = 0; i < MAX_NUM_STA; i++) { | |
3703 | if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) | |
d00d2ba3 | 3704 | memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); |
c5c77ba1 JK |
3705 | else |
3706 | continue; | |
3707 | ||
3708 | pu8CurrByte += ETH_ALEN; | |
3709 | } | |
3710 | ||
3711 | /*Sending Cfg*/ | |
d42ab083 JK |
3712 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
3713 | get_id_from_handler(pstrWFIDrv)); | |
24db713f | 3714 | if (s32Error) |
83cc9be5 | 3715 | PRINT_ER("Failed to send add station config packet\n"); |
c5c77ba1 | 3716 | |
24db713f | 3717 | ERRORHANDLER: |
969effe9 | 3718 | kfree(strWID.ps8WidVal); |
c5c77ba1 | 3719 | |
83383ea3 | 3720 | up(&hWaitResponse); |
c5c77ba1 JK |
3721 | } |
3722 | ||
3723 | ||
3724 | /** | |
3725 | * @brief Handle_DelStation | |
3726 | * @details Sending config packet to delete station | |
3727 | * @param[in] tstrHostIFDelSta* pstrDelStaParam | |
3728 | * @return NONE | |
3729 | * @author | |
3730 | * @date | |
3731 | * @version 1.0 | |
3732 | */ | |
2b05df55 | 3733 | static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pstrDelStaParam) |
c5c77ba1 | 3734 | { |
e6e12661 | 3735 | s32 s32Error = 0; |
c5c77ba1 | 3736 | tstrWID strWID; |
63d03e47 | 3737 | u8 *pu8CurrByte; |
c5c77ba1 JK |
3738 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
3739 | ||
d85f5326 | 3740 | strWID.u16WIDid = (u16)WID_REMOVE_STA; |
c5c77ba1 JK |
3741 | strWID.enuWIDtype = WID_BIN; |
3742 | strWID.s32ValueSize = ETH_ALEN; | |
3743 | ||
03b2d5e7 | 3744 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
c5c77ba1 | 3745 | |
f3052587 | 3746 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
2b9d5b48 | 3747 | if (strWID.ps8WidVal == NULL) |
24db713f | 3748 | goto ERRORHANDLER; |
c5c77ba1 JK |
3749 | |
3750 | pu8CurrByte = strWID.ps8WidVal; | |
3751 | ||
d00d2ba3 | 3752 | memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); |
c5c77ba1 JK |
3753 | |
3754 | /*Sending Cfg*/ | |
d42ab083 JK |
3755 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
3756 | get_id_from_handler(pstrWFIDrv)); | |
24db713f | 3757 | if (s32Error) |
83cc9be5 | 3758 | PRINT_ER("Failed to send add station config packet\n"); |
c5c77ba1 | 3759 | |
24db713f | 3760 | ERRORHANDLER: |
969effe9 | 3761 | kfree(strWID.ps8WidVal); |
c5c77ba1 JK |
3762 | } |
3763 | ||
3764 | ||
3765 | /** | |
3766 | * @brief Handle_EditStation | |
3767 | * @details Sending config packet to edit station | |
3768 | * @param[in] tstrWILC_AddStaParam* pstrStationParam | |
3769 | * @return NONE | |
3770 | * @author | |
3771 | * @date | |
3772 | * @version 1.0 | |
3773 | */ | |
2b05df55 | 3774 | static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) |
c5c77ba1 | 3775 | { |
e6e12661 | 3776 | s32 s32Error = 0; |
c5c77ba1 | 3777 | tstrWID strWID; |
63d03e47 | 3778 | u8 *pu8CurrByte; |
c5c77ba1 JK |
3779 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
3780 | ||
d85f5326 | 3781 | strWID.u16WIDid = (u16)WID_EDIT_STA; |
c5c77ba1 JK |
3782 | strWID.enuWIDtype = WID_BIN; |
3783 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; | |
3784 | ||
3785 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); | |
f3052587 | 3786 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
2b9d5b48 | 3787 | if (strWID.ps8WidVal == NULL) |
24db713f | 3788 | goto ERRORHANDLER; |
c5c77ba1 JK |
3789 | |
3790 | pu8CurrByte = strWID.ps8WidVal; | |
3791 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); | |
3792 | ||
3793 | /*Sending Cfg*/ | |
d42ab083 JK |
3794 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
3795 | get_id_from_handler(pstrWFIDrv)); | |
24db713f | 3796 | if (s32Error) |
c5c77ba1 | 3797 | PRINT_ER("Failed to send edit station config packet\n"); |
c5c77ba1 | 3798 | |
24db713f | 3799 | ERRORHANDLER: |
969effe9 GKH |
3800 | kfree(pstrStationParam->pu8Rates); |
3801 | kfree(strWID.ps8WidVal); | |
c5c77ba1 JK |
3802 | } |
3803 | #endif /*WILC_AP_EXTERNAL_MLME*/ | |
3804 | ||
3805 | #ifdef WILC_P2P | |
3806 | /** | |
3807 | * @brief Handle_RemainOnChan | |
3808 | * @details Sending config packet to edit station | |
3809 | * @param[in] tstrWILC_AddStaParam* pstrStationParam | |
3810 | * @return NONE | |
3811 | * @author | |
3812 | * @date | |
3813 | * @version 1.0 | |
3814 | */ | |
2b05df55 | 3815 | static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
c5c77ba1 | 3816 | { |
e6e12661 | 3817 | s32 s32Error = 0; |
63d03e47 | 3818 | u8 u8remain_on_chan_flag; |
c5c77ba1 JK |
3819 | tstrWID strWID; |
3820 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; | |
3821 | ||
3822 | /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/ | |
3823 | if (!pstrWFIDrv->u8RemainOnChan_pendingreq) { | |
3824 | pstrWFIDrv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid; | |
3825 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; | |
3826 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; | |
3827 | pstrWFIDrv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel; | |
3828 | pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; | |
3829 | } else { | |
3830 | /*Set the channel to use it as a wid val*/ | |
3831 | pstrHostIfRemainOnChan->u16Channel = pstrWFIDrv->strHostIfRemainOnChan.u16Channel; | |
3832 | } | |
3833 | ||
3834 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { | |
3835 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); | |
3836 | pstrWFIDrv->u8RemainOnChan_pendingreq = 1; | |
24db713f LK |
3837 | s32Error = -EBUSY; |
3838 | goto ERRORHANDLER; | |
c5c77ba1 JK |
3839 | } |
3840 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { | |
3841 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while connecting return\n"); | |
24db713f LK |
3842 | s32Error = -EBUSY; |
3843 | goto ERRORHANDLER; | |
c5c77ba1 JK |
3844 | } |
3845 | ||
3846 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP | |
3847 | if (g_obtainingIP || connecting) { | |
3848 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); | |
24db713f LK |
3849 | s32Error = -EBUSY; |
3850 | goto ERRORHANDLER; | |
c5c77ba1 JK |
3851 | } |
3852 | #endif | |
3853 | ||
3854 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); | |
3855 | ||
72ed4dc7 | 3856 | u8remain_on_chan_flag = true; |
d85f5326 | 3857 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
c5c77ba1 JK |
3858 | strWID.enuWIDtype = WID_STR; |
3859 | strWID.s32ValueSize = 2; | |
f3052587 | 3860 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
c5c77ba1 | 3861 | |
24db713f LK |
3862 | if (strWID.ps8WidVal == NULL) { |
3863 | s32Error = -ENOMEM; | |
3864 | goto ERRORHANDLER; | |
3865 | } | |
c5c77ba1 JK |
3866 | |
3867 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; | |
ca356ada | 3868 | strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
c5c77ba1 JK |
3869 | |
3870 | /*Sending Cfg*/ | |
d42ab083 JK |
3871 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
3872 | get_id_from_handler(pstrWFIDrv)); | |
e6e12661 | 3873 | if (s32Error != 0) |
c5c77ba1 | 3874 | PRINT_ER("Failed to set remain on channel\n"); |
c5c77ba1 | 3875 | |
24db713f | 3876 | ERRORHANDLER: |
c5c77ba1 JK |
3877 | { |
3878 | P2P_LISTEN_STATE = 1; | |
9eb06643 GKH |
3879 | pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv; |
3880 | mod_timer(&pstrWFIDrv->hRemainOnChannel, | |
3881 | jiffies + | |
3882 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); | |
c5c77ba1 JK |
3883 | |
3884 | /*Calling CFG ready_on_channel*/ | |
2b9d5b48 | 3885 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) |
c5c77ba1 | 3886 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid); |
c5c77ba1 JK |
3887 | |
3888 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) | |
3889 | pstrWFIDrv->u8RemainOnChan_pendingreq = 0; | |
3890 | } | |
3891 | return s32Error; | |
3892 | } | |
3893 | ||
3894 | /** | |
3895 | * @brief Handle_RegisterFrame | |
3896 | * @details | |
3897 | * @param[in] | |
3898 | * @return NONE | |
3899 | * @author | |
3900 | * @date | |
3901 | * @version 1.0 | |
3902 | */ | |
2b05df55 | 3903 | static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame) |
c5c77ba1 | 3904 | { |
e6e12661 | 3905 | s32 s32Error = 0; |
c5c77ba1 | 3906 | tstrWID strWID; |
63d03e47 | 3907 | u8 *pu8CurrByte; |
c5c77ba1 JK |
3908 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
3909 | ||
3910 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); | |
3911 | ||
3912 | /*prepare configuration packet*/ | |
d85f5326 | 3913 | strWID.u16WIDid = (u16)WID_REGISTER_FRAME; |
c5c77ba1 | 3914 | strWID.enuWIDtype = WID_STR; |
f3052587 | 3915 | strWID.ps8WidVal = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
2b9d5b48 | 3916 | if (strWID.ps8WidVal == NULL) |
24db713f | 3917 | return -ENOMEM; |
c5c77ba1 JK |
3918 | |
3919 | pu8CurrByte = strWID.ps8WidVal; | |
3920 | ||
3921 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; | |
3922 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; | |
d00d2ba3 | 3923 | memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); |
c5c77ba1 JK |
3924 | |
3925 | ||
d85f5326 | 3926 | strWID.s32ValueSize = sizeof(u16) + 2; |
c5c77ba1 JK |
3927 | |
3928 | ||
3929 | /*Sending Cfg*/ | |
d42ab083 JK |
3930 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
3931 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
3932 | if (s32Error) { |
3933 | PRINT_ER("Failed to frame register config packet\n"); | |
24db713f | 3934 | s32Error = -EINVAL; |
c5c77ba1 JK |
3935 | } |
3936 | ||
3937 | return s32Error; | |
3938 | ||
3939 | } | |
3940 | ||
3941 | /** | |
3942 | * @brief Handle_ListenStateExpired | |
3943 | * @details Handle of listen state expiration | |
3944 | * @param[in] NONE | |
3945 | * @return Error code. | |
3946 | * @author | |
3947 | * @date | |
3948 | * @version 1.0 | |
3949 | */ | |
3950 | #define FALSE_FRMWR_CHANNEL 100 | |
2b05df55 | 3951 | static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
c5c77ba1 | 3952 | { |
63d03e47 | 3953 | u8 u8remain_on_chan_flag; |
c5c77ba1 | 3954 | tstrWID strWID; |
e6e12661 | 3955 | s32 s32Error = 0; |
c5c77ba1 JK |
3956 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
3957 | ||
3958 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); | |
3959 | ||
3960 | /*BugID_5477*/ | |
3961 | /*Make sure we are already in listen state*/ | |
3962 | /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/ | |
3963 | if (P2P_LISTEN_STATE) { | |
72ed4dc7 | 3964 | u8remain_on_chan_flag = false; |
d85f5326 | 3965 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
c5c77ba1 JK |
3966 | strWID.enuWIDtype = WID_STR; |
3967 | strWID.s32ValueSize = 2; | |
f3052587 | 3968 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
c5c77ba1 | 3969 | |
2b9d5b48 | 3970 | if (strWID.ps8WidVal == NULL) |
c5c77ba1 | 3971 | PRINT_ER("Failed to allocate memory\n"); |
c5c77ba1 JK |
3972 | |
3973 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; | |
3974 | strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL; | |
3975 | ||
3976 | /*Sending Cfg*/ | |
d42ab083 JK |
3977 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
3978 | get_id_from_handler(pstrWFIDrv)); | |
e6e12661 | 3979 | if (s32Error != 0) { |
c5c77ba1 JK |
3980 | PRINT_ER("Failed to set remain on channel\n"); |
3981 | goto _done_; | |
3982 | } | |
3983 | ||
3984 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired) { | |
3985 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired(pstrWFIDrv->strHostIfRemainOnChan.pVoid | |
3986 | , pstrHostIfRemainOnChan->u32ListenSessionID); | |
3987 | } | |
3988 | P2P_LISTEN_STATE = 0; | |
3989 | } else { | |
3990 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); | |
e6e12661 | 3991 | s32Error = -EFAULT; |
c5c77ba1 JK |
3992 | } |
3993 | ||
3994 | _done_: | |
3995 | return s32Error; | |
3996 | } | |
3997 | ||
3998 | ||
3999 | /** | |
4000 | * @brief ListenTimerCB | |
4001 | * @details Callback function of remain-on-channel timer | |
4002 | * @param[in] NONE | |
4003 | * @return Error code. | |
4004 | * @author | |
4005 | * @date | |
4006 | * @version 1.0 | |
4007 | */ | |
93dee8ee | 4008 | static void ListenTimerCB(unsigned long arg) |
c5c77ba1 | 4009 | { |
e6e12661 | 4010 | s32 s32Error = 0; |
c5c77ba1 | 4011 | tstrHostIFmsg strHostIFmsg; |
93dee8ee | 4012 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
c5c77ba1 | 4013 | /*Stopping remain-on-channel timer*/ |
8972d0fe | 4014 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
c5c77ba1 JK |
4015 | |
4016 | /* prepare the Timer Callback message */ | |
2cc46837 | 4017 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4018 | strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
4019 | strHostIFmsg.drvHandler = pstrWFIDrv; | |
4020 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; | |
4021 | ||
4022 | /* send the message */ | |
79198138 | 4023 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 4024 | if (s32Error) |
24db713f | 4025 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
4026 | } |
4027 | #endif | |
4028 | ||
4029 | ||
4030 | /** | |
4031 | * @brief Handle_EditStation | |
4032 | * @details Sending config packet to edit station | |
4033 | * @param[in] tstrWILC_AddStaParam* pstrStationParam | |
4034 | * @return NONE | |
4035 | * @author | |
4036 | * @date | |
4037 | * @version 1.0 | |
4038 | */ | |
2b05df55 | 4039 | static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, tstrHostIfPowerMgmtParam *strPowerMgmtParam) |
c5c77ba1 | 4040 | { |
e6e12661 | 4041 | s32 s32Error = 0; |
c5c77ba1 | 4042 | tstrWID strWID; |
ca356ada | 4043 | s8 s8PowerMode; |
c5c77ba1 | 4044 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
78c87591 | 4045 | |
d85f5326 | 4046 | strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; |
c5c77ba1 | 4047 | |
78174ada | 4048 | if (strPowerMgmtParam->bIsEnabled == true) |
c5c77ba1 | 4049 | s8PowerMode = MIN_FAST_PS; |
78174ada | 4050 | else |
c5c77ba1 | 4051 | s8PowerMode = NO_POWERSAVE; |
c5c77ba1 JK |
4052 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
4053 | strWID.ps8WidVal = &s8PowerMode; | |
576917ad | 4054 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
4055 | |
4056 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); | |
4057 | ||
4058 | /*Sending Cfg*/ | |
d42ab083 JK |
4059 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
4060 | get_id_from_handler(pstrWFIDrv)); | |
24db713f | 4061 | if (s32Error) |
c5c77ba1 | 4062 | PRINT_ER("Failed to send power management config packet\n"); |
c5c77ba1 JK |
4063 | } |
4064 | ||
4065 | /** | |
4066 | * @brief Handle_SetMulticastFilter | |
4067 | * @details Set Multicast filter in firmware | |
4068 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti | |
4069 | * @return NONE | |
4070 | * @author asobhy | |
4071 | * @date | |
4072 | * @version 1.0 | |
4073 | */ | |
2b05df55 | 4074 | static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetMulti *strHostIfSetMulti) |
c5c77ba1 | 4075 | { |
e6e12661 | 4076 | s32 s32Error = 0; |
c5c77ba1 | 4077 | tstrWID strWID; |
63d03e47 | 4078 | u8 *pu8CurrByte; |
c5c77ba1 JK |
4079 | |
4080 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); | |
4081 | ||
d85f5326 | 4082 | strWID.u16WIDid = (u16)WID_SETUP_MULTICAST_FILTER; |
c5c77ba1 JK |
4083 | strWID.enuWIDtype = WID_BIN; |
4084 | strWID.s32ValueSize = sizeof(tstrHostIFSetMulti) + ((strHostIfSetMulti->u32count) * ETH_ALEN); | |
f3052587 | 4085 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
2b9d5b48 | 4086 | if (strWID.ps8WidVal == NULL) |
24db713f | 4087 | goto ERRORHANDLER; |
c5c77ba1 JK |
4088 | |
4089 | pu8CurrByte = strWID.ps8WidVal; | |
4090 | *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); | |
4091 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF); | |
4092 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF); | |
4093 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF); | |
4094 | ||
4095 | *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF); | |
4096 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF); | |
4097 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF); | |
4098 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF); | |
4099 | ||
4100 | if ((strHostIfSetMulti->u32count) > 0) | |
4101 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN)); | |
4102 | ||
4103 | /*Sending Cfg*/ | |
d42ab083 JK |
4104 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
4105 | get_id_from_handler(drvHandler)); | |
24db713f | 4106 | if (s32Error) |
c5c77ba1 | 4107 | PRINT_ER("Failed to send setup multicast config packet\n"); |
c5c77ba1 | 4108 | |
24db713f | 4109 | ERRORHANDLER: |
969effe9 | 4110 | kfree(strWID.ps8WidVal); |
c5c77ba1 JK |
4111 | |
4112 | } | |
4113 | ||
4114 | ||
4115 | /*BugID_5222*/ | |
4116 | /** | |
4117 | * @brief Handle_AddBASession | |
4118 | * @details Add block ack session | |
4119 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti | |
4120 | * @return NONE | |
4121 | * @author Amr Abdel-Moghny | |
4122 | * @date Feb. 2014 | |
4123 | * @version 9.0 | |
4124 | */ | |
2b05df55 | 4125 | static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
c5c77ba1 | 4126 | { |
e6e12661 | 4127 | s32 s32Error = 0; |
c5c77ba1 JK |
4128 | tstrWID strWID; |
4129 | int AddbaTimeout = 100; | |
4130 | char *ptr = NULL; | |
4131 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
4132 | ||
03b2d5e7 | 4133 | PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n", |
c5c77ba1 JK |
4134 | strHostIfBASessionInfo->au8Bssid[0], |
4135 | strHostIfBASessionInfo->au8Bssid[1], | |
4136 | strHostIfBASessionInfo->au8Bssid[2], | |
4137 | strHostIfBASessionInfo->u16BufferSize, | |
4138 | strHostIfBASessionInfo->u16SessionTimeout, | |
4139 | strHostIfBASessionInfo->u8Ted); | |
4140 | ||
d85f5326 | 4141 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
c5c77ba1 | 4142 | strWID.enuWIDtype = WID_STR; |
f3052587 | 4143 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
c5c77ba1 JK |
4144 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
4145 | ptr = strWID.ps8WidVal; | |
4146 | /* *ptr++ = 0x14; */ | |
4147 | *ptr++ = 0x14; | |
4148 | *ptr++ = 0x3; | |
4149 | *ptr++ = 0x0; | |
d00d2ba3 | 4150 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
c5c77ba1 JK |
4151 | ptr += ETH_ALEN; |
4152 | *ptr++ = strHostIfBASessionInfo->u8Ted; | |
4153 | /* BA Policy*/ | |
4154 | *ptr++ = 1; | |
4155 | /* Buffer size*/ | |
4156 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); | |
4157 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); | |
4158 | /* BA timeout*/ | |
4159 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); | |
4160 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); | |
4161 | /* ADDBA timeout*/ | |
4162 | *ptr++ = (AddbaTimeout & 0xFF); | |
4163 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); | |
4164 | /* Group Buffer Max Frames*/ | |
4165 | *ptr++ = 8; | |
4166 | /* Group Buffer Timeout */ | |
4167 | *ptr++ = 0; | |
4168 | ||
d42ab083 JK |
4169 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
4170 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
4171 | if (s32Error) |
4172 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); | |
4173 | ||
4174 | ||
d85f5326 | 4175 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
c5c77ba1 JK |
4176 | strWID.enuWIDtype = WID_STR; |
4177 | strWID.s32ValueSize = 15; | |
4178 | ptr = strWID.ps8WidVal; | |
4179 | /* *ptr++ = 0x14; */ | |
4180 | *ptr++ = 15; | |
4181 | *ptr++ = 7; | |
4182 | *ptr++ = 0x2; | |
d00d2ba3 | 4183 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
c5c77ba1 JK |
4184 | ptr += ETH_ALEN; |
4185 | /* TID*/ | |
4186 | *ptr++ = strHostIfBASessionInfo->u8Ted; | |
4187 | /* Max Num MSDU */ | |
4188 | *ptr++ = 8; | |
4189 | /* BA timeout*/ | |
4190 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); | |
4191 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); | |
4192 | /*Ack-Policy */ | |
4193 | *ptr++ = 3; | |
d42ab083 JK |
4194 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
4195 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
4196 | |
4197 | if (strWID.ps8WidVal != NULL) | |
49188af2 | 4198 | kfree(strWID.ps8WidVal); |
c5c77ba1 JK |
4199 | |
4200 | return s32Error; | |
4201 | ||
4202 | } | |
4203 | ||
4204 | ||
4205 | /*BugID_5222*/ | |
4206 | /** | |
4207 | * @brief Handle_DelBASession | |
4208 | * @details Delete block ack session | |
4209 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti | |
4210 | * @return NONE | |
4211 | * @author Amr Abdel-Moghny | |
4212 | * @date Feb. 2013 | |
4213 | * @version 9.0 | |
4214 | */ | |
2b05df55 | 4215 | static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
c5c77ba1 | 4216 | { |
e6e12661 | 4217 | s32 s32Error = 0; |
c5c77ba1 JK |
4218 | tstrWID strWID; |
4219 | char *ptr = NULL; | |
4220 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
4221 | ||
03b2d5e7 | 4222 | PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", |
c5c77ba1 JK |
4223 | strHostIfBASessionInfo->au8Bssid[0], |
4224 | strHostIfBASessionInfo->au8Bssid[1], | |
4225 | strHostIfBASessionInfo->au8Bssid[2], | |
4226 | strHostIfBASessionInfo->u8Ted); | |
4227 | ||
d85f5326 | 4228 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
c5c77ba1 | 4229 | strWID.enuWIDtype = WID_STR; |
f3052587 | 4230 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
c5c77ba1 JK |
4231 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
4232 | ptr = strWID.ps8WidVal; | |
4233 | /* *ptr++ = 0x14; */ | |
4234 | *ptr++ = 0x14; | |
4235 | *ptr++ = 0x3; | |
4236 | *ptr++ = 0x2; | |
d00d2ba3 | 4237 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
c5c77ba1 JK |
4238 | ptr += ETH_ALEN; |
4239 | *ptr++ = strHostIfBASessionInfo->u8Ted; | |
4240 | /* BA direction = recipent*/ | |
4241 | *ptr++ = 0; | |
4242 | /* Delba Reason */ | |
4243 | *ptr++ = 32; /* Unspecific QOS reason */ | |
4244 | ||
d42ab083 JK |
4245 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
4246 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
4247 | if (s32Error) |
4248 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); | |
4249 | ||
4250 | ||
d85f5326 | 4251 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
c5c77ba1 JK |
4252 | strWID.enuWIDtype = WID_STR; |
4253 | strWID.s32ValueSize = 15; | |
4254 | ptr = strWID.ps8WidVal; | |
4255 | /* *ptr++ = 0x14; */ | |
4256 | *ptr++ = 15; | |
4257 | *ptr++ = 7; | |
4258 | *ptr++ = 0x3; | |
d00d2ba3 | 4259 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
c5c77ba1 JK |
4260 | ptr += ETH_ALEN; |
4261 | /* TID*/ | |
4262 | *ptr++ = strHostIfBASessionInfo->u8Ted; | |
4263 | ||
d42ab083 JK |
4264 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
4265 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
4266 | |
4267 | if (strWID.ps8WidVal != NULL) | |
49188af2 | 4268 | kfree(strWID.ps8WidVal); |
c5c77ba1 JK |
4269 | |
4270 | /*BugID_5222*/ | |
83383ea3 | 4271 | up(&hWaitResponse); |
c5c77ba1 JK |
4272 | |
4273 | return s32Error; | |
4274 | ||
4275 | } | |
4276 | ||
4277 | ||
4278 | /** | |
4279 | * @brief Handle_DelAllRxBASessions | |
4280 | * @details Delete all Rx BA sessions | |
4281 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti | |
4282 | * @return NONE | |
4283 | * @author Abdelrahman Sobhy | |
4284 | * @date Feb. 2013 | |
4285 | * @version 9.0 | |
4286 | */ | |
2b05df55 | 4287 | static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
c5c77ba1 | 4288 | { |
e6e12661 | 4289 | s32 s32Error = 0; |
c5c77ba1 JK |
4290 | tstrWID strWID; |
4291 | char *ptr = NULL; | |
4292 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; | |
4293 | ||
03b2d5e7 | 4294 | PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", |
c5c77ba1 JK |
4295 | strHostIfBASessionInfo->au8Bssid[0], |
4296 | strHostIfBASessionInfo->au8Bssid[1], | |
4297 | strHostIfBASessionInfo->au8Bssid[2], | |
4298 | strHostIfBASessionInfo->u8Ted); | |
4299 | ||
d85f5326 | 4300 | strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; |
c5c77ba1 | 4301 | strWID.enuWIDtype = WID_STR; |
f3052587 | 4302 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
c5c77ba1 JK |
4303 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
4304 | ptr = strWID.ps8WidVal; | |
4305 | *ptr++ = 0x14; | |
4306 | *ptr++ = 0x3; | |
4307 | *ptr++ = 0x2; | |
d00d2ba3 | 4308 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
c5c77ba1 JK |
4309 | ptr += ETH_ALEN; |
4310 | *ptr++ = strHostIfBASessionInfo->u8Ted; | |
4311 | /* BA direction = recipent*/ | |
4312 | *ptr++ = 0; | |
4313 | /* Delba Reason */ | |
4314 | *ptr++ = 32; /* Unspecific QOS reason */ | |
4315 | ||
d42ab083 JK |
4316 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
4317 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
4318 | if (s32Error) |
4319 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); | |
4320 | ||
4321 | ||
4322 | if (strWID.ps8WidVal != NULL) | |
49188af2 | 4323 | kfree(strWID.ps8WidVal); |
c5c77ba1 JK |
4324 | |
4325 | /*BugID_5222*/ | |
83383ea3 | 4326 | up(&hWaitResponse); |
c5c77ba1 JK |
4327 | |
4328 | return s32Error; | |
4329 | ||
4330 | } | |
4331 | ||
4332 | /** | |
4333 | * @brief hostIFthread | |
4334 | * @details Main thread to handle message queue requests | |
4335 | * @param[in] void* pvArg | |
4336 | * @return NONE | |
4337 | * @author | |
4338 | * @date | |
4339 | * @version 1.0 | |
4340 | */ | |
1999bd52 | 4341 | static int hostIFthread(void *pvArg) |
c5c77ba1 | 4342 | { |
4e4467fd | 4343 | u32 u32Ret; |
c5c77ba1 JK |
4344 | tstrHostIFmsg strHostIFmsg; |
4345 | tstrWILC_WFIDrv *pstrWFIDrv; | |
4346 | ||
2cc46837 | 4347 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4348 | |
4349 | while (1) { | |
b986e33e | 4350 | wilc_mq_recv(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), &u32Ret); |
c5c77ba1 JK |
4351 | pstrWFIDrv = (tstrWILC_WFIDrv *)strHostIFmsg.drvHandler; |
4352 | if (strHostIFmsg.u16MsgId == HOST_IF_MSG_EXIT) { | |
4353 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); | |
4354 | break; | |
4355 | } | |
4356 | ||
4357 | ||
4358 | /*Re-Queue HIF message*/ | |
4359 | if ((!g_wilc_initialized)) { | |
4360 | PRINT_D(GENERIC_DBG, "--WAIT--"); | |
80e29c7a | 4361 | usleep_range(200 * 1000, 200 * 1000); |
79198138 | 4362 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4363 | continue; |
4364 | } | |
4365 | ||
4366 | if (strHostIFmsg.u16MsgId == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { | |
4367 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); | |
79198138 | 4368 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
80e29c7a | 4369 | usleep_range(2 * 1000, 2 * 1000); |
c5c77ba1 JK |
4370 | continue; |
4371 | } | |
4372 | ||
4373 | switch (strHostIFmsg.u16MsgId) { | |
4374 | case HOST_IF_MSG_Q_IDLE: | |
4375 | Handle_wait_msg_q_empty(); | |
4376 | break; | |
4377 | ||
4378 | case HOST_IF_MSG_SCAN: | |
4379 | Handle_Scan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr); | |
4380 | break; | |
4381 | ||
4382 | case HOST_IF_MSG_CONNECT: | |
4383 | Handle_Connect(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr); | |
4384 | break; | |
4385 | ||
4386 | /*BugID_5137*/ | |
4387 | case HOST_IF_MSG_FLUSH_CONNECT: | |
4388 | Handle_FlushConnect(strHostIFmsg.drvHandler); | |
4389 | break; | |
4390 | ||
4391 | case HOST_IF_MSG_RCVD_NTWRK_INFO: | |
4392 | Handle_RcvdNtwrkInfo(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo); | |
4393 | break; | |
4394 | ||
4395 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: | |
4396 | Handle_RcvdGnrlAsyncInfo(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo); | |
4397 | break; | |
4398 | ||
4399 | case HOST_IF_MSG_KEY: | |
4400 | Handle_Key(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr); | |
4401 | break; | |
4402 | ||
4403 | case HOST_IF_MSG_CFG_PARAMS: | |
4404 | ||
4405 | Handle_CfgParam(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr); | |
4406 | break; | |
4407 | ||
4408 | case HOST_IF_MSG_SET_CHANNEL: | |
4409 | Handle_SetChannel(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan); | |
4410 | break; | |
4411 | ||
4412 | case HOST_IF_MSG_DISCONNECT: | |
4413 | Handle_Disconnect(strHostIFmsg.drvHandler); | |
4414 | break; | |
4415 | ||
4416 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: | |
8972d0fe | 4417 | del_timer(&pstrWFIDrv->hScanTimer); |
c5c77ba1 JK |
4418 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
4419 | ||
4420 | /*BugID_5213*/ | |
4421 | /*Allow chip sleep, only if both interfaces are not connected*/ | |
2b9d5b48 | 4422 | if (!linux_wlan_get_num_conn_ifcs()) |
c5c77ba1 | 4423 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
c5c77ba1 JK |
4424 | |
4425 | Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_DONE); | |
4426 | ||
4427 | #ifdef WILC_P2P | |
4428 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) | |
4429 | Handle_RemainOnChan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan); | |
4430 | #endif | |
4431 | ||
4432 | break; | |
4433 | ||
4434 | case HOST_IF_MSG_GET_RSSI: | |
4435 | Handle_GetRssi(strHostIFmsg.drvHandler); | |
4436 | break; | |
4437 | ||
4438 | case HOST_IF_MSG_GET_LINKSPEED: | |
4439 | Handle_GetLinkspeed(strHostIFmsg.drvHandler); | |
4440 | break; | |
4441 | ||
4442 | case HOST_IF_MSG_GET_STATISTICS: | |
4443 | Handle_GetStatistics(strHostIFmsg.drvHandler, (tstrStatistics *)strHostIFmsg.uniHostIFmsgBody.pUserData); | |
4444 | break; | |
4445 | ||
4446 | case HOST_IF_MSG_GET_CHNL: | |
4447 | Handle_GetChnl(strHostIFmsg.drvHandler); | |
4448 | break; | |
4449 | ||
4450 | #ifdef WILC_AP_EXTERNAL_MLME | |
4451 | case HOST_IF_MSG_ADD_BEACON: | |
4452 | Handle_AddBeacon(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon); | |
4453 | break; | |
4454 | ||
4455 | case HOST_IF_MSG_DEL_BEACON: | |
4456 | Handle_DelBeacon(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFDelBeacon); | |
4457 | break; | |
4458 | ||
4459 | case HOST_IF_MSG_ADD_STATION: | |
4460 | Handle_AddStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strAddStaParam); | |
4461 | break; | |
4462 | ||
4463 | case HOST_IF_MSG_DEL_STATION: | |
4464 | Handle_DelStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strDelStaParam); | |
4465 | break; | |
4466 | ||
4467 | case HOST_IF_MSG_EDIT_STATION: | |
4468 | Handle_EditStation(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strEditStaParam); | |
4469 | break; | |
4470 | ||
4471 | case HOST_IF_MSG_GET_INACTIVETIME: | |
4472 | Handle_Get_InActiveTime(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT); | |
4473 | break; | |
4474 | ||
4475 | #endif /*WILC_AP_EXTERNAL_MLME*/ | |
4476 | case HOST_IF_MSG_SCAN_TIMER_FIRED: | |
4477 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); | |
4478 | ||
4479 | Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_ABORTED); | |
4480 | break; | |
4481 | ||
4482 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: | |
03b2d5e7 | 4483 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
c5c77ba1 JK |
4484 | Handle_ConnectTimeout(strHostIFmsg.drvHandler); |
4485 | break; | |
4486 | ||
4487 | case HOST_IF_MSG_POWER_MGMT: | |
4488 | Handle_PowerManagement(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam); | |
4489 | break; | |
4490 | ||
4491 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: | |
53a84401 JK |
4492 | Handle_SetWfiDrvHandler(strHostIFmsg.drvHandler, |
4493 | &strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler); | |
c5c77ba1 JK |
4494 | break; |
4495 | ||
4496 | case HOST_IF_MSG_SET_OPERATION_MODE: | |
4497 | Handle_SetOperationMode(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode); | |
4498 | break; | |
4499 | ||
4500 | case HOST_IF_MSG_SET_IPADDRESS: | |
4501 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); | |
4502 | Handle_set_IPAddress(strHostIFmsg.drvHandler, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx); | |
4503 | break; | |
4504 | ||
4505 | case HOST_IF_MSG_GET_IPADDRESS: | |
4506 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); | |
4507 | Handle_get_IPAddress(strHostIFmsg.drvHandler, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr, strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx); | |
4508 | break; | |
4509 | ||
4510 | /*BugID_5077*/ | |
4511 | case HOST_IF_MSG_SET_MAC_ADDRESS: | |
4512 | Handle_SetMacAddress(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress); | |
4513 | break; | |
4514 | ||
4515 | /*BugID_5213*/ | |
4516 | case HOST_IF_MSG_GET_MAC_ADDRESS: | |
4517 | Handle_GetMacAddress(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress); | |
4518 | break; | |
4519 | ||
4520 | #ifdef WILC_P2P | |
4521 | case HOST_IF_MSG_REMAIN_ON_CHAN: | |
4522 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); | |
4523 | Handle_RemainOnChan(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan); | |
4524 | break; | |
4525 | ||
4526 | case HOST_IF_MSG_REGISTER_FRAME: | |
4527 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); | |
4528 | Handle_RegisterFrame(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame); | |
4529 | break; | |
4530 | ||
4531 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: | |
4532 | Handle_ListenStateExpired(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan); | |
4533 | break; | |
4534 | ||
4535 | #endif | |
4536 | case HOST_IF_MSG_SET_MULTICAST_FILTER: | |
4537 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); | |
4538 | Handle_SetMulticastFilter(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti); | |
4539 | break; | |
4540 | ||
4541 | /*BugID_5222*/ | |
4542 | case HOST_IF_MSG_ADD_BA_SESSION: | |
4543 | Handle_AddBASession(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo); | |
4544 | break; | |
4545 | ||
4546 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: | |
4547 | Handle_DelAllRxBASessions(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo); | |
4548 | break; | |
4549 | ||
4550 | case HOST_IF_MSG_DEL_ALL_STA: | |
4551 | Handle_DelAllSta(strHostIFmsg.drvHandler, &strHostIFmsg.uniHostIFmsgBody.strHostIFDelAllSta); | |
4552 | break; | |
4553 | ||
4554 | default: | |
03b2d5e7 | 4555 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
c5c77ba1 JK |
4556 | break; |
4557 | } | |
4558 | } | |
4559 | ||
4560 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); | |
83383ea3 | 4561 | up(&hSemHostIFthrdEnd); |
1999bd52 | 4562 | return 0; |
c5c77ba1 JK |
4563 | } |
4564 | ||
93dee8ee | 4565 | static void TimerCB_Scan(unsigned long arg) |
c5c77ba1 | 4566 | { |
93dee8ee | 4567 | void *pvArg = (void *)arg; |
c5c77ba1 JK |
4568 | tstrHostIFmsg strHostIFmsg; |
4569 | ||
4570 | /* prepare the Timer Callback message */ | |
2cc46837 | 4571 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4572 | strHostIFmsg.drvHandler = pvArg; |
4573 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN_TIMER_FIRED; | |
4574 | ||
4575 | /* send the message */ | |
79198138 | 4576 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4577 | } |
4578 | ||
93dee8ee | 4579 | static void TimerCB_Connect(unsigned long arg) |
c5c77ba1 | 4580 | { |
93dee8ee | 4581 | void *pvArg = (void *)arg; |
c5c77ba1 JK |
4582 | tstrHostIFmsg strHostIFmsg; |
4583 | ||
4584 | /* prepare the Timer Callback message */ | |
2cc46837 | 4585 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4586 | strHostIFmsg.drvHandler = pvArg; |
4587 | strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT_TIMER_FIRED; | |
4588 | ||
4589 | /* send the message */ | |
79198138 | 4590 | wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4591 | } |
4592 | ||
4593 | ||
4594 | /** | |
4595 | * @brief removes wpa/wpa2 keys | |
4596 | * @details only in BSS STA mode if External Supplicant support is enabled. | |
4597 | * removes all WPA/WPA2 station key entries from MAC hardware. | |
4598 | * @param[in,out] handle to the wifi driver | |
4599 | * @param[in] 6 bytes of Station Adress in the station entry table | |
4600 | * @return Error code indicating success/failure | |
4601 | * @note | |
4602 | * @author zsalah | |
4603 | * @date 8 March 2012 | |
4604 | * @version 1.0 | |
4605 | */ | |
4606 | /* Check implementation in core adding 9 bytes to the input! */ | |
218dc407 | 4607 | s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress) |
c5c77ba1 | 4608 | { |
e6e12661 | 4609 | s32 s32Error = 0; |
c5c77ba1 JK |
4610 | tstrWID strWID; |
4611 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ | |
4612 | ||
d85f5326 | 4613 | strWID.u16WIDid = (u16)WID_REMOVE_KEY; |
c5c77ba1 | 4614 | strWID.enuWIDtype = WID_STR; |
ca356ada | 4615 | strWID.ps8WidVal = (s8 *)pu8StaAddress; |
c5c77ba1 JK |
4616 | strWID.s32ValueSize = 6; |
4617 | ||
4618 | return s32Error; | |
4619 | ||
4620 | } | |
4621 | ||
4622 | /** | |
4623 | * @brief removes WEP key | |
4624 | * @details valid only in BSS STA mode if External Supplicant support is enabled. | |
4625 | * remove a WEP key entry from MAC HW. | |
4626 | * The BSS Station automatically finds the index of the entry using its | |
4627 | * BSS ID and removes that entry from the MAC hardware. | |
4628 | * @param[in,out] handle to the wifi driver | |
4629 | * @param[in] 6 bytes of Station Adress in the station entry table | |
4630 | * @return Error code indicating success/failure | |
4631 | * @note NO need for the STA add since it is not used for processing | |
4632 | * @author zsalah | |
4633 | * @date 8 March 2012 | |
4634 | * @version 1.0 | |
4635 | */ | |
218dc407 | 4636 | s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx) |
c5c77ba1 | 4637 | { |
e6e12661 | 4638 | s32 s32Error = 0; |
c5c77ba1 JK |
4639 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
4640 | tstrHostIFmsg strHostIFmsg; | |
4641 | ||
4642 | ||
24db713f LK |
4643 | if (pstrWFIDrv == NULL) { |
4644 | s32Error = -EFAULT; | |
4645 | PRINT_ER("Failed to send setup multicast config packet\n"); | |
4646 | return s32Error; | |
4647 | } | |
c5c77ba1 JK |
4648 | |
4649 | /* prepare the Remove Wep Key Message */ | |
2cc46837 | 4650 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4651 | |
4652 | ||
4653 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; | |
4654 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; | |
4655 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = REMOVEKEY; | |
4656 | strHostIFmsg.drvHandler = hWFIDrv; | |
4657 | ||
4658 | ||
4659 | ||
4660 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4661 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx; | |
4662 | ||
4663 | /* send the message */ | |
79198138 | 4664 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 | 4665 | if (s32Error) |
03b2d5e7 | 4666 | PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); |
83383ea3 | 4667 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 | 4668 | |
c5c77ba1 JK |
4669 | return s32Error; |
4670 | } | |
4671 | ||
4672 | /** | |
4673 | * @brief sets WEP default key | |
4674 | * @details Sets the index of the WEP encryption key in use, | |
4675 | * in the key table | |
4676 | * @param[in,out] handle to the wifi driver | |
4677 | * @param[in] key index ( 0, 1, 2, 3) | |
4678 | * @return Error code indicating success/failure | |
4679 | * @note | |
4680 | * @author zsalah | |
4681 | * @date 8 March 2012 | |
4682 | * @version 1.0 | |
4683 | */ | |
218dc407 | 4684 | s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) |
c5c77ba1 | 4685 | { |
e6e12661 | 4686 | s32 s32Error = 0; |
c5c77ba1 JK |
4687 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
4688 | tstrHostIFmsg strHostIFmsg; | |
4689 | ||
4690 | ||
24db713f LK |
4691 | if (pstrWFIDrv == NULL) { |
4692 | s32Error = -EFAULT; | |
4693 | PRINT_ER("driver is null\n"); | |
4694 | return s32Error; | |
4695 | } | |
c5c77ba1 JK |
4696 | |
4697 | /* prepare the Key Message */ | |
2cc46837 | 4698 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4699 | |
4700 | ||
4701 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; | |
4702 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; | |
4703 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = DEFAULTKEY; | |
4704 | strHostIFmsg.drvHandler = hWFIDrv; | |
4705 | ||
4706 | ||
4707 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4708 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index; | |
4709 | ||
4710 | /* send the message */ | |
79198138 | 4711 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4712 | if (s32Error) |
4713 | PRINT_ER("Error in sending message queue : Default key index\n"); | |
83383ea3 | 4714 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 | 4715 | |
c5c77ba1 JK |
4716 | return s32Error; |
4717 | } | |
4718 | ||
4719 | /** | |
4720 | * @brief sets WEP deafault key | |
4721 | * @details valid only in BSS STA mode if External Supplicant support is enabled. | |
4722 | * sets WEP key entry into MAC hardware when it receives the | |
4723 | * corresponding request from NDIS. | |
4724 | * @param[in,out] handle to the wifi driver | |
4725 | * @param[in] message containing WEP Key in the following format | |
4726 | *|---------------------------------------| | |
4727 | *|Key ID Value | Key Length | Key | | |
4728 | *|-------------|------------|------------| | |
4729 | | 1byte | 1byte | Key Length | | |
4730 | ||---------------------------------------| | |
4731 | | | |
4732 | * @return Error code indicating success/failure | |
4733 | * @note | |
4734 | * @author zsalah | |
4735 | * @date 8 March 2012 | |
4736 | * @version 1.0 | |
4737 | */ | |
218dc407 | 4738 | s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx) |
c5c77ba1 JK |
4739 | { |
4740 | ||
e6e12661 | 4741 | s32 s32Error = 0; |
c5c77ba1 JK |
4742 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
4743 | tstrHostIFmsg strHostIFmsg; | |
4744 | ||
24db713f LK |
4745 | if (pstrWFIDrv == NULL) { |
4746 | s32Error = -EFAULT; | |
4747 | PRINT_ER("driver is null\n"); | |
4748 | return s32Error; | |
4749 | } | |
c5c77ba1 JK |
4750 | |
4751 | /* prepare the Key Message */ | |
2cc46837 | 4752 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4753 | |
4754 | ||
4755 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; | |
4756 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; | |
4757 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; | |
4758 | strHostIFmsg.drvHandler = hWFIDrv; | |
4759 | ||
4760 | ||
4761 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
f3052587 | 4762 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
c5c77ba1 | 4763 | |
d00d2ba3 | 4764 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
c5c77ba1 JK |
4765 | pu8WepKey, u8WepKeylen); |
4766 | ||
4767 | ||
4768 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4769 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); | |
4770 | ||
4771 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4772 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; | |
4773 | ||
4774 | /* send the message */ | |
79198138 | 4775 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4776 | if (s32Error) |
4777 | PRINT_ER("Error in sending message queue :WEP Key\n"); | |
83383ea3 | 4778 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 | 4779 | |
c5c77ba1 JK |
4780 | return s32Error; |
4781 | ||
4782 | } | |
4783 | ||
4784 | #ifdef WILC_AP_EXTERNAL_MLME | |
4785 | /** | |
4786 | * | |
4787 | * @brief host_int_add_wep_key_bss_ap | |
4788 | * @details valid only in BSS AP mode if External Supplicant support is enabled. | |
4789 | * sets WEP key entry into MAC hardware when it receives the | |
4790 | * | |
4791 | * corresponding request from NDIS. | |
4792 | * @param[in,out] handle to the wifi driver | |
4793 | * | |
4794 | * | |
4795 | * @return Error code indicating success/failure | |
4796 | * @note | |
4797 | * @author mdaftedar | |
4798 | * @date 28 FEB 2013 | |
4799 | * @version 1.0 | |
4800 | */ | |
218dc407 | 4801 | s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type) |
c5c77ba1 JK |
4802 | { |
4803 | ||
e6e12661 | 4804 | s32 s32Error = 0; |
c5c77ba1 JK |
4805 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
4806 | tstrHostIFmsg strHostIFmsg; | |
63d03e47 | 4807 | u8 i; |
c5c77ba1 | 4808 | |
24db713f LK |
4809 | if (pstrWFIDrv == NULL) { |
4810 | s32Error = -EFAULT; | |
4811 | PRINT_ER("driver is null\n"); | |
4812 | return s32Error; | |
4813 | } | |
c5c77ba1 JK |
4814 | |
4815 | /* prepare the Key Message */ | |
2cc46837 | 4816 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4817 | |
4818 | if (INFO) { | |
4819 | for (i = 0; i < u8WepKeylen; i++) | |
4820 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]); | |
4821 | } | |
4822 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; | |
4823 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WEP; | |
4824 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; | |
4825 | strHostIFmsg.drvHandler = hWFIDrv; | |
4826 | ||
4827 | ||
4828 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
f3052587 | 4829 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
c5c77ba1 JK |
4830 | |
4831 | ||
d00d2ba3 | 4832 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
c5c77ba1 JK |
4833 | pu8WepKey, (u8WepKeylen)); |
4834 | ||
4835 | ||
4836 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4837 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); | |
4838 | ||
4839 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4840 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; | |
4841 | ||
4842 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4843 | uniHostIFkeyAttr.strHostIFwepAttr.u8mode = u8mode; | |
4844 | ||
4845 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4846 | uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type; | |
4847 | /* send the message */ | |
79198138 | 4848 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4849 | |
4850 | if (s32Error) | |
4851 | PRINT_ER("Error in sending message queue :WEP Key\n"); | |
83383ea3 | 4852 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 | 4853 | |
c5c77ba1 JK |
4854 | return s32Error; |
4855 | ||
4856 | } | |
4857 | #endif | |
4858 | /** | |
4859 | * @brief adds ptk Key | |
4860 | * @details | |
4861 | * @param[in,out] handle to the wifi driver | |
4862 | * @param[in] message containing PTK Key in the following format | |
4863 | *|-----------------------------------------------------------------------------| | |
4864 | *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | | |
4865 | *|----------------|------------|--------------|----------------|---------------| | |
4866 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | | |
4867 | ||-----------------------------------------------------------------------------| | |
4868 | * @return Error code indicating success/failure | |
4869 | * @note | |
4870 | * @author zsalah | |
4871 | * @date 8 March 2012 | |
4872 | * @version 1.0 | |
4873 | */ | |
218dc407 | 4874 | s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, |
63d03e47 | 4875 | const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) |
c5c77ba1 | 4876 | { |
e6e12661 | 4877 | s32 s32Error = 0; |
c5c77ba1 JK |
4878 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
4879 | tstrHostIFmsg strHostIFmsg; | |
63d03e47 | 4880 | u8 u8KeyLen = u8PtkKeylen; |
4e4467fd | 4881 | u32 i; |
78c87591 | 4882 | |
24db713f LK |
4883 | if (pstrWFIDrv == NULL) { |
4884 | s32Error = -EFAULT; | |
4885 | PRINT_ER("driver is null\n"); | |
4886 | return s32Error; | |
4887 | } | |
2b9d5b48 | 4888 | if (pu8RxMic != NULL) |
c5c77ba1 | 4889 | u8KeyLen += RX_MIC_KEY_LEN; |
2b9d5b48 | 4890 | if (pu8TxMic != NULL) |
c5c77ba1 | 4891 | u8KeyLen += TX_MIC_KEY_LEN; |
c5c77ba1 JK |
4892 | |
4893 | /* prepare the Key Message */ | |
2cc46837 | 4894 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4895 | |
4896 | ||
4897 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; | |
4898 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WPAPtk; | |
4899 | #ifdef WILC_AP_EXTERNAL_MLME | |
4900 | if (mode == AP_MODE) { | |
4901 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; | |
4902 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4903 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8Idx; | |
4904 | } | |
4905 | #endif | |
4906 | if (mode == STATION_MODE) | |
4907 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; | |
4908 | ||
4909 | ||
4910 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
f3052587 | 4911 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
c5c77ba1 JK |
4912 | |
4913 | ||
d00d2ba3 | 4914 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
c5c77ba1 JK |
4915 | pu8Ptk, u8PtkKeylen); |
4916 | ||
4917 | if (pu8RxMic != NULL) { | |
4918 | ||
d00d2ba3 | 4919 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
c5c77ba1 JK |
4920 | pu8RxMic, RX_MIC_KEY_LEN); |
4921 | if (INFO) { | |
4922 | for (i = 0; i < RX_MIC_KEY_LEN; i++) | |
4923 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); | |
4924 | } | |
4925 | } | |
4926 | if (pu8TxMic != NULL) { | |
4927 | ||
d00d2ba3 | 4928 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
c5c77ba1 JK |
4929 | pu8TxMic, TX_MIC_KEY_LEN); |
4930 | if (INFO) { | |
4931 | for (i = 0; i < TX_MIC_KEY_LEN; i++) | |
4932 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); | |
4933 | } | |
4934 | } | |
4935 | ||
4936 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4937 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; | |
4938 | ||
4939 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4940 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; | |
4941 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
4942 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr = mac_addr; | |
4943 | strHostIFmsg.drvHandler = hWFIDrv; | |
4944 | ||
4945 | /* send the message */ | |
79198138 | 4946 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4947 | |
4948 | if (s32Error) | |
4949 | PRINT_ER("Error in sending message queue: PTK Key\n"); | |
4950 | ||
4951 | /* ////////////// */ | |
83383ea3 | 4952 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 JK |
4953 | /* /////// */ |
4954 | ||
c5c77ba1 JK |
4955 | return s32Error; |
4956 | } | |
4957 | ||
4958 | /** | |
4959 | * @brief adds Rx GTk Key | |
4960 | * @details | |
4961 | * @param[in,out] handle to the wifi driver | |
4962 | * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic | |
4963 | * u8GtkKeylen :The total key length | |
4964 | * | |
4965 | * @return Error code indicating success/failure | |
4966 | * @note | |
4967 | * @author zsalah | |
4968 | * @date 8 March 2012 | |
4969 | * @version 1.0 | |
4970 | */ | |
218dc407 | 4971 | s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, |
4e4467fd | 4972 | u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, |
63d03e47 | 4973 | const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) |
c5c77ba1 | 4974 | { |
e6e12661 | 4975 | s32 s32Error = 0; |
c5c77ba1 JK |
4976 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
4977 | tstrHostIFmsg strHostIFmsg; | |
63d03e47 | 4978 | u8 u8KeyLen = u8GtkKeylen; |
c5c77ba1 | 4979 | |
24db713f LK |
4980 | if (pstrWFIDrv == NULL) { |
4981 | s32Error = -EFAULT; | |
4982 | PRINT_ER("driver is null\n"); | |
4983 | return s32Error; | |
4984 | } | |
c5c77ba1 | 4985 | /* prepare the Key Message */ |
2cc46837 | 4986 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
4987 | |
4988 | ||
2b9d5b48 | 4989 | if (pu8RxMic != NULL) |
c5c77ba1 | 4990 | u8KeyLen += RX_MIC_KEY_LEN; |
2b9d5b48 | 4991 | if (pu8TxMic != NULL) |
c5c77ba1 | 4992 | u8KeyLen += TX_MIC_KEY_LEN; |
c5c77ba1 JK |
4993 | if (KeyRSC != NULL) { |
4994 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
f3052587 | 4995 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
c5c77ba1 | 4996 | |
d00d2ba3 | 4997 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, |
c5c77ba1 JK |
4998 | KeyRSC, u32KeyRSClen); |
4999 | } | |
5000 | ||
5001 | ||
5002 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; | |
5003 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = WPARxGtk; | |
5004 | strHostIFmsg.drvHandler = hWFIDrv; | |
5005 | ||
5006 | #ifdef WILC_AP_EXTERNAL_MLME | |
5007 | if (mode == AP_MODE) { | |
5008 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; | |
5009 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; | |
5010 | } | |
5011 | #endif | |
5012 | if (mode == STATION_MODE) | |
5013 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; | |
5014 | ||
5015 | ||
5016 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
f3052587 | 5017 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8KeyLen, GFP_KERNEL); |
c5c77ba1 | 5018 | |
d00d2ba3 | 5019 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
c5c77ba1 JK |
5020 | pu8RxGtk, u8GtkKeylen); |
5021 | ||
5022 | if (pu8RxMic != NULL) { | |
5023 | ||
d00d2ba3 | 5024 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
c5c77ba1 JK |
5025 | pu8RxMic, RX_MIC_KEY_LEN); |
5026 | ||
5027 | } | |
5028 | if (pu8TxMic != NULL) { | |
5029 | ||
d00d2ba3 | 5030 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
c5c77ba1 JK |
5031 | pu8TxMic, TX_MIC_KEY_LEN); |
5032 | ||
5033 | } | |
5034 | ||
5035 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
5036 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8KeyIdx; | |
5037 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
5038 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; | |
5039 | ||
5040 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. | |
5041 | uniHostIFkeyAttr.strHostIFwpaAttr.u8seqlen = u32KeyRSClen; | |
5042 | ||
5043 | ||
5044 | ||
5045 | /* send the message */ | |
79198138 | 5046 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5047 | if (s32Error) |
5048 | PRINT_ER("Error in sending message queue: RX GTK\n"); | |
5049 | /* ////////////// */ | |
83383ea3 | 5050 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
c5c77ba1 JK |
5051 | /* /////// */ |
5052 | ||
c5c77ba1 JK |
5053 | return s32Error; |
5054 | } | |
c5c77ba1 | 5055 | |
c5c77ba1 JK |
5056 | /** |
5057 | * @brief host_int_set_pmkid_info | |
5058 | * @details caches the pmkid valid only in BSS STA mode if External Supplicant | |
5059 | * support is enabled. This Function sets the PMKID in firmware | |
5060 | * when host drivr receives the corresponding request from NDIS. | |
5061 | * The firmware then includes theset PMKID in the appropriate | |
5062 | * management frames | |
5063 | * @param[in,out] handle to the wifi driver | |
5064 | * @param[in] message containing PMKID Info in the following format | |
5065 | *|-----------------------------------------------------------------| | |
5066 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | | |
5067 | *|-----------|------------|----------|-------|----------|----------| | |
5068 | | 1 | 6 | 16 | ... | 6 | 16 | | |
5069 | ||-----------------------------------------------------------------| | |
5070 | * @return Error code indicating success/failure | |
5071 | * @note | |
5072 | * @author zsalah | |
5073 | * @date 8 March 2012 | |
5074 | * @version 1.0 | |
5075 | */ | |
218dc407 | 5076 | s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray) |
c5c77ba1 | 5077 | { |
e6e12661 | 5078 | s32 s32Error = 0; |
c5c77ba1 JK |
5079 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
5080 | tstrHostIFmsg strHostIFmsg; | |
4e4467fd | 5081 | u32 i; |
c5c77ba1 JK |
5082 | |
5083 | ||
24db713f LK |
5084 | if (pstrWFIDrv == NULL) { |
5085 | s32Error = -EFAULT; | |
5086 | PRINT_ER("driver is null\n"); | |
5087 | return s32Error; | |
5088 | } | |
c5c77ba1 JK |
5089 | |
5090 | /* prepare the Key Message */ | |
2cc46837 | 5091 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5092 | |
5093 | strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; | |
5094 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = PMKSA; | |
5095 | strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; | |
5096 | strHostIFmsg.drvHandler = hWFIDrv; | |
5097 | ||
5098 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { | |
5099 | ||
d00d2ba3 | 5100 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, |
c5c77ba1 JK |
5101 | ETH_ALEN); |
5102 | ||
d00d2ba3 | 5103 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, |
c5c77ba1 JK |
5104 | PMKID_LEN); |
5105 | } | |
5106 | ||
5107 | /* send the message */ | |
79198138 | 5108 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5109 | if (s32Error) |
5110 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); | |
5111 | ||
c5c77ba1 JK |
5112 | return s32Error; |
5113 | } | |
5114 | ||
5115 | /** | |
5116 | * @brief gets the cached the pmkid info | |
5117 | * @details valid only in BSS STA mode if External Supplicant | |
5118 | * support is enabled. This Function sets the PMKID in firmware | |
5119 | * when host drivr receives the corresponding request from NDIS. | |
5120 | * The firmware then includes theset PMKID in the appropriate | |
5121 | * management frames | |
5122 | * @param[in,out] handle to the wifi driver, | |
5123 | * message containing PMKID Info in the following format | |
5124 | *|-----------------------------------------------------------------| | |
5125 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | | |
5126 | *|-----------|------------|----------|-------|----------|----------| | |
5127 | | 1 | 6 | 16 | ... | 6 | 16 | | |
5128 | ||-----------------------------------------------------------------| | |
5129 | * @param[in] | |
5130 | * @return Error code indicating success/failure | |
5131 | * @note | |
5132 | * @author zsalah | |
5133 | * @date 8 March 2012 | |
5134 | * @version 1.0 | |
5135 | */ | |
218dc407 | 5136 | s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, |
4e4467fd | 5137 | u32 u32PmkidInfoLen) |
c5c77ba1 | 5138 | { |
e6e12661 | 5139 | s32 s32Error = 0; |
c5c77ba1 JK |
5140 | tstrWID strWID; |
5141 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ | |
5142 | ||
d85f5326 | 5143 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
c5c77ba1 JK |
5144 | strWID.enuWIDtype = WID_STR; |
5145 | strWID.s32ValueSize = u32PmkidInfoLen; | |
5146 | strWID.ps8WidVal = pu8PmkidInfoArray; | |
5147 | ||
5148 | return s32Error; | |
5149 | } | |
5150 | ||
5151 | /** | |
5152 | * @brief sets the pass phrase | |
5153 | * @details AP/STA mode. This function gives the pass phrase used to | |
5154 | * generate the Pre-Shared Key when WPA/WPA2 is enabled | |
5155 | * The length of the field can vary from 8 to 64 bytes, | |
5156 | * the lower layer should get the | |
5157 | * @param[in,out] handle to the wifi driver, | |
5158 | * @param[in] String containing PSK | |
5159 | * @return Error code indicating success/failure | |
5160 | * @note | |
5161 | * @author zsalah | |
5162 | * @date 8 March 2012 | |
5163 | * @version 1.0 | |
5164 | */ | |
218dc407 | 5165 | s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, |
63d03e47 | 5166 | u8 u8Psklength) |
c5c77ba1 | 5167 | { |
e6e12661 | 5168 | s32 s32Error = 0; |
c5c77ba1 | 5169 | tstrWID strWID; |
c5c77ba1 | 5170 | |
c5c77ba1 JK |
5171 | /*validating psk length*/ |
5172 | if ((u8Psklength > 7) && (u8Psklength < 65)) { | |
d85f5326 | 5173 | strWID.u16WIDid = (u16)WID_11I_PSK; |
c5c77ba1 JK |
5174 | strWID.enuWIDtype = WID_STR; |
5175 | strWID.ps8WidVal = pu8PassPhrase; | |
5176 | strWID.s32ValueSize = u8Psklength; | |
5177 | } | |
5178 | ||
5179 | return s32Error; | |
5180 | } | |
5181 | /** | |
5182 | * @brief host_int_get_MacAddress | |
5183 | * @details gets mac address | |
5184 | * @param[in,out] handle to the wifi driver, | |
5185 | * | |
5186 | * @return Error code indicating success/failure | |
5187 | * @note | |
5188 | * @author mdaftedar | |
5189 | * @date 19 April 2012 | |
5190 | * @version 1.0 | |
5191 | */ | |
218dc407 | 5192 | s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
c5c77ba1 | 5193 | { |
e6e12661 | 5194 | s32 s32Error = 0; |
c5c77ba1 JK |
5195 | tstrHostIFmsg strHostIFmsg; |
5196 | ||
5197 | ||
5198 | /* prepare the Message */ | |
2cc46837 | 5199 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5200 | |
5201 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_MAC_ADDRESS; | |
5202 | strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress.u8MacAddress = pu8MacAddress; | |
5203 | strHostIFmsg.drvHandler = hWFIDrv; | |
5204 | /* send the message */ | |
79198138 | 5205 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5206 | if (s32Error) { |
5207 | PRINT_ER("Failed to send get mac address\n"); | |
e6e12661 | 5208 | return -EFAULT; |
c5c77ba1 JK |
5209 | } |
5210 | ||
83383ea3 | 5211 | down(&hWaitResponse); |
c5c77ba1 JK |
5212 | return s32Error; |
5213 | } | |
5214 | ||
5215 | /** | |
5216 | * @brief host_int_set_MacAddress | |
5217 | * @details sets mac address | |
5218 | * @param[in,out] handle to the wifi driver, | |
5219 | * | |
5220 | * @return Error code indicating success/failure | |
5221 | * @note | |
5222 | * @author mabubakr | |
5223 | * @date 16 July 2012 | |
5224 | * @version 1.0 | |
5225 | */ | |
218dc407 | 5226 | s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
c5c77ba1 | 5227 | { |
e6e12661 | 5228 | s32 s32Error = 0; |
c5c77ba1 JK |
5229 | tstrHostIFmsg strHostIFmsg; |
5230 | ||
5231 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); | |
5232 | ||
5233 | /* prepare setting mac address message */ | |
2cc46837 | 5234 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 | 5235 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MAC_ADDRESS; |
d00d2ba3 | 5236 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); |
c5c77ba1 JK |
5237 | strHostIFmsg.drvHandler = hWFIDrv; |
5238 | ||
79198138 | 5239 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
24db713f | 5240 | if (s32Error) |
c5c77ba1 | 5241 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
c5c77ba1 JK |
5242 | |
5243 | return s32Error; | |
5244 | ||
5245 | } | |
5246 | ||
5247 | /** | |
5248 | * @brief host_int_get_RSNAConfigPSKPassPhrase | |
5249 | * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to | |
5250 | * generate the Pre-Shared Key when WPA/WPA2 is enabled | |
5251 | * The length of the field can vary from 8 to 64 bytes, | |
5252 | * the lower layer should get the | |
5253 | * @param[in,out] handle to the wifi driver, | |
5254 | * String containing PSK | |
5255 | * @return Error code indicating success/failure | |
5256 | * @note | |
5257 | * @author zsalah | |
5258 | * @date 8 March 2012 | |
5259 | * @version 1.0 | |
5260 | */ | |
218dc407 | 5261 | s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, |
63d03e47 | 5262 | u8 *pu8PassPhrase, u8 u8Psklength) |
c5c77ba1 | 5263 | { |
e6e12661 | 5264 | s32 s32Error = 0; |
c5c77ba1 JK |
5265 | tstrWID strWID; |
5266 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ | |
5267 | ||
d85f5326 | 5268 | strWID.u16WIDid = (u16)WID_11I_PSK; |
c5c77ba1 JK |
5269 | strWID.enuWIDtype = WID_STR; |
5270 | strWID.s32ValueSize = u8Psklength; | |
5271 | strWID.ps8WidVal = pu8PassPhrase; | |
5272 | ||
5273 | return s32Error; | |
5274 | } | |
5275 | ||
5276 | /** | |
5277 | * @brief host_int_get_site_survey_results | |
5278 | * @details gets the site survey results | |
5279 | * @param[in,out] handle to the wifi driver, | |
5280 | * Message containing site survey results in the | |
5281 | * following format | |
5282 | *|---------------------------------------------------| | |
5283 | | MsgLength | fragNo. | MsgBodyLength | MsgBody | | |
5284 | ||-----------|-----------|---------------|-----------| | |
5285 | | 1 | 1 | 1 | 1 | | |
5286 | | ----------------------------------------- | ---------------- | |
5287 | | | |
5288 | ||---------------------------------------| | |
5289 | | Network1 | Netweork2 | ... | Network5 | | |
5290 | ||---------------------------------------| | |
5291 | | 44 | 44 | ... | 44 | | |
5292 | | -------------------------- | --------------------------------------- | |
5293 | | | |
5294 | ||---------------------------------------------------------------------| | |
5295 | | SSID | BSS Type | Channel | Security Status| BSSID | RSSI |Reserved | | |
5296 | | | |
5297 | | | |
5298 | ||------|----------|---------|----------------|-------|------|---------| | |
5299 | | 33 | 1 | 1 | 1 | 6 | 1 | 1 | | |
5300 | ||---------------------------------------------------------------------| | |
5301 | * @return Error code indicating success/failure | |
5302 | * @note | |
5303 | * @author zsalah | |
5304 | * @date 8 March 2012 | |
5305 | * @version 1.0 | |
5306 | */ | |
5307 | #ifndef CONNECT_DIRECT | |
218dc407 | 5308 | s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv, |
63d03e47 | 5309 | u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], |
4e4467fd | 5310 | u32 u32MaxSiteSrvyFragLen) |
c5c77ba1 | 5311 | { |
e6e12661 | 5312 | s32 s32Error = 0; |
c5c77ba1 JK |
5313 | tstrWID astrWIDList[2]; |
5314 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; | |
5315 | ||
d85f5326 | 5316 | astrWIDList[0].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
c5c77ba1 JK |
5317 | astrWIDList[0].enuWIDtype = WID_STR; |
5318 | astrWIDList[0].ps8WidVal = ppu8RcvdSiteSurveyResults[0]; | |
5319 | astrWIDList[0].s32ValueSize = u32MaxSiteSrvyFragLen; | |
5320 | ||
d85f5326 | 5321 | astrWIDList[1].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
c5c77ba1 JK |
5322 | astrWIDList[1].enuWIDtype = WID_STR; |
5323 | astrWIDList[1].ps8WidVal = ppu8RcvdSiteSurveyResults[1]; | |
5324 | astrWIDList[1].s32ValueSize = u32MaxSiteSrvyFragLen; | |
5325 | ||
d42ab083 JK |
5326 | s32Error = SendConfigPkt(GET_CFG, astrWIDList, 2, true, |
5327 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
5328 | |
5329 | /*get the value by searching the local copy*/ | |
5330 | if (s32Error) { | |
5331 | PRINT_ER("Failed to send config packet to get survey results\n"); | |
24db713f | 5332 | s32Error = -EINVAL; |
c5c77ba1 JK |
5333 | } |
5334 | ||
5335 | return s32Error; | |
5336 | } | |
5337 | #endif | |
5338 | ||
5339 | /** | |
5340 | * @brief sets a start scan request | |
5341 | * @details | |
5342 | * @param[in,out] handle to the wifi driver, | |
5343 | * @param[in] Scan Source one of the following values | |
5344 | * DEFAULT_SCAN 0 | |
5345 | * USER_SCAN BIT0 | |
5346 | * OBSS_PERIODIC_SCAN BIT1 | |
5347 | * OBSS_ONETIME_SCAN BIT2 | |
5348 | * @return Error code indicating success/failure | |
5349 | * @note | |
5350 | * @author zsalah | |
5351 | * @date 8 March 2012 | |
5352 | * @version 1.0 | |
5353 | */ | |
218dc407 | 5354 | s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource) |
c5c77ba1 | 5355 | { |
e6e12661 | 5356 | s32 s32Error = 0; |
c5c77ba1 JK |
5357 | tstrWID strWID; |
5358 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ | |
5359 | ||
d85f5326 | 5360 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
c5c77ba1 | 5361 | strWID.enuWIDtype = WID_CHAR; |
ca356ada | 5362 | strWID.ps8WidVal = (s8 *)&scanSource; |
576917ad | 5363 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
5364 | |
5365 | return s32Error; | |
5366 | } | |
5367 | ||
5368 | /** | |
5369 | * @brief host_int_get_start_scan_req | |
5370 | * @details gets a start scan request | |
5371 | * @param[in,out] handle to the wifi driver, | |
5372 | * @param[in] Scan Source one of the following values | |
5373 | * DEFAULT_SCAN 0 | |
5374 | * USER_SCAN BIT0 | |
5375 | * OBSS_PERIODIC_SCAN BIT1 | |
5376 | * OBSS_ONETIME_SCAN BIT2 | |
5377 | * @return Error code indicating success/failure | |
5378 | * @note | |
5379 | * @author zsalah | |
5380 | * @date 8 March 2012 | |
5381 | * @version 1.0 | |
5382 | */ | |
5383 | ||
218dc407 | 5384 | s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource) |
c5c77ba1 | 5385 | { |
e6e12661 | 5386 | s32 s32Error = 0; |
c5c77ba1 JK |
5387 | tstrWID strWID; |
5388 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ | |
5389 | ||
d85f5326 | 5390 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
c5c77ba1 | 5391 | strWID.enuWIDtype = WID_CHAR; |
ca356ada | 5392 | strWID.ps8WidVal = (s8 *)pu8ScanSource; |
576917ad | 5393 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
5394 | |
5395 | return s32Error; | |
5396 | } | |
5397 | ||
5398 | /** | |
5399 | * @brief host_int_set_join_req | |
5400 | * @details sets a join request | |
5401 | * @param[in,out] handle to the wifi driver, | |
5402 | * @param[in] Index of the bss descriptor | |
5403 | * @return Error code indicating success/failure | |
5404 | * @note | |
5405 | * @author zsalah | |
5406 | * @date 8 March 2012 | |
5407 | * @version 1.0 | |
5408 | */ | |
218dc407 | 5409 | s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, |
057d1e97 | 5410 | const u8 *pu8ssid, size_t ssidLen, |
63d03e47 | 5411 | const u8 *pu8IEs, size_t IEsLen, |
c5c77ba1 | 5412 | tWILCpfConnectResult pfConnectResult, void *pvUserArg, |
63d03e47 GKH |
5413 | u8 u8security, AUTHTYPE_T tenuAuth_type, |
5414 | u8 u8channel, | |
c5c77ba1 JK |
5415 | void *pJoinParams) |
5416 | { | |
e6e12661 | 5417 | s32 s32Error = 0; |
c5c77ba1 JK |
5418 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
5419 | tstrHostIFmsg strHostIFmsg; | |
5420 | tenuScanConnTimer enuScanConnTimer; | |
5421 | ||
24db713f LK |
5422 | if (pstrWFIDrv == NULL || pfConnectResult == NULL) { |
5423 | s32Error = -EFAULT; | |
5424 | PRINT_ER("Driver is null\n"); | |
5425 | return s32Error; | |
5426 | } | |
c5c77ba1 JK |
5427 | |
5428 | if (hWFIDrv == NULL) { | |
24db713f LK |
5429 | PRINT_ER("Driver is null\n"); |
5430 | return -EFAULT; | |
c5c77ba1 JK |
5431 | } |
5432 | ||
5433 | if (pJoinParams == NULL) { | |
5434 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); | |
24db713f | 5435 | return -EFAULT; |
c5c77ba1 | 5436 | } |
24db713f | 5437 | |
c5c77ba1 | 5438 | /* prepare the Connect Message */ |
2cc46837 | 5439 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5440 | |
5441 | strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT; | |
5442 | ||
5443 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.u8security = u8security; | |
5444 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.tenuAuth_type = tenuAuth_type; | |
5445 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.u8channel = u8channel; | |
5446 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pfConnectResult = pfConnectResult; | |
5447 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pvUserArg = pvUserArg; | |
5448 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pJoinParams = pJoinParams; | |
5449 | strHostIFmsg.drvHandler = hWFIDrv; | |
5450 | ||
5451 | if (pu8bssid != NULL) { | |
f3052587 | 5452 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = kmalloc(6, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
d00d2ba3 | 5453 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid, |
c5c77ba1 JK |
5454 | pu8bssid, 6); |
5455 | } | |
5456 | ||
5457 | if (pu8ssid != NULL) { | |
5458 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.ssidLen = ssidLen; | |
f3052587 | 5459 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = kmalloc(ssidLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
d00d2ba3 | 5460 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid, |
c5c77ba1 JK |
5461 | |
5462 | pu8ssid, ssidLen); | |
5463 | } | |
5464 | ||
5465 | if (pu8IEs != NULL) { | |
5466 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.IEsLen = IEsLen; | |
f3052587 | 5467 | strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
d00d2ba3 | 5468 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, |
c5c77ba1 JK |
5469 | pu8IEs, IEsLen); |
5470 | } | |
78174ada | 5471 | if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) |
c5c77ba1 | 5472 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING; |
78174ada | 5473 | else |
c5c77ba1 JK |
5474 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); |
5475 | ||
5476 | /* send the message */ | |
79198138 | 5477 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5478 | if (s32Error) { |
5479 | PRINT_ER("Failed to send message queue: Set join request\n"); | |
24db713f | 5480 | return -EFAULT; |
c5c77ba1 JK |
5481 | } |
5482 | ||
5483 | enuScanConnTimer = CONNECT_TIMER; | |
9eb06643 GKH |
5484 | pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv; |
5485 | mod_timer(&pstrWFIDrv->hConnectTimer, | |
5486 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); | |
c5c77ba1 | 5487 | |
c5c77ba1 JK |
5488 | return s32Error; |
5489 | } | |
5490 | ||
5491 | /** | |
5492 | * @brief Flush a join request parameters to FW, but actual connection | |
5493 | * @details The function is called in situation where WILC is connected to AP and | |
5494 | * required to switch to hybrid FW for P2P connection | |
5495 | * @param[in] handle to the wifi driver, | |
5496 | * @return Error code indicating success/failure | |
5497 | * @note | |
5498 | * @author Amr Abdel-Moghny | |
5499 | * @date 19 DEC 2013 | |
5500 | * @version 8.0 | |
5501 | */ | |
5502 | ||
218dc407 | 5503 | s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) |
c5c77ba1 | 5504 | { |
e6e12661 | 5505 | s32 s32Error = 0; |
c5c77ba1 JK |
5506 | tstrHostIFmsg strHostIFmsg; |
5507 | ||
5508 | if (!gu8FlushedJoinReq) { | |
e6e12661 | 5509 | s32Error = -EFAULT; |
c5c77ba1 JK |
5510 | return s32Error; |
5511 | } | |
5512 | ||
5513 | ||
24db713f LK |
5514 | if (hWFIDrv == NULL) { |
5515 | s32Error = -EFAULT; | |
5516 | PRINT_ER("Driver is null\n"); | |
5517 | return s32Error; | |
5518 | } | |
c5c77ba1 JK |
5519 | |
5520 | strHostIFmsg.u16MsgId = HOST_IF_MSG_FLUSH_CONNECT; | |
5521 | strHostIFmsg.drvHandler = hWFIDrv; | |
5522 | ||
5523 | /* send the message */ | |
79198138 | 5524 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5525 | if (s32Error) { |
5526 | PRINT_ER("Failed to send message queue: Flush join request\n"); | |
24db713f | 5527 | return -EFAULT; |
c5c77ba1 JK |
5528 | } |
5529 | ||
c5c77ba1 JK |
5530 | return s32Error; |
5531 | } | |
5532 | ||
5533 | /** | |
5534 | * @brief host_int_disconnect | |
5535 | * @details disconnects from the currently associated network | |
5536 | * @param[in,out] handle to the wifi driver, | |
5537 | * @param[in] Reason Code of the Disconnection | |
5538 | * @return Error code indicating success/failure | |
5539 | * @note | |
5540 | * @author zsalah | |
5541 | * @date 8 March 2012 | |
5542 | * @version 1.0 | |
5543 | */ | |
218dc407 | 5544 | s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) |
c5c77ba1 | 5545 | { |
e6e12661 | 5546 | s32 s32Error = 0; |
c5c77ba1 JK |
5547 | tstrHostIFmsg strHostIFmsg; |
5548 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; | |
5549 | ||
b1413b60 | 5550 | if (pstrWFIDrv == NULL) { |
24db713f LK |
5551 | PRINT_ER("Driver is null\n"); |
5552 | return -EFAULT; | |
c5c77ba1 JK |
5553 | } |
5554 | ||
5555 | /* prepare the Disconnect Message */ | |
2cc46837 | 5556 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5557 | |
5558 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DISCONNECT; | |
5559 | strHostIFmsg.drvHandler = hWFIDrv; | |
5560 | ||
5561 | /* send the message */ | |
79198138 | 5562 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5563 | if (s32Error) |
5564 | PRINT_ER("Failed to send message queue: disconnect\n"); | |
5565 | /* ////////////// */ | |
83383ea3 | 5566 | down(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
c5c77ba1 JK |
5567 | /* /////// */ |
5568 | ||
c5c77ba1 JK |
5569 | return s32Error; |
5570 | } | |
5571 | ||
5572 | /** | |
5573 | * @brief host_int_disconnect_station | |
5574 | * @details disconnects a sta | |
5575 | * @param[in,out] handle to the wifi driver, | |
5576 | * @param[in] Association Id of the station to be disconnected | |
5577 | * @return Error code indicating success/failure | |
5578 | * @note | |
5579 | * @author zsalah | |
5580 | * @date 8 March 2012 | |
5581 | * @version 1.0 | |
5582 | */ | |
218dc407 | 5583 | s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id) |
c5c77ba1 | 5584 | { |
e6e12661 | 5585 | s32 s32Error = 0; |
c5c77ba1 JK |
5586 | tstrWID strWID; |
5587 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ | |
5588 | ||
d85f5326 | 5589 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
c5c77ba1 | 5590 | strWID.enuWIDtype = WID_CHAR; |
ca356ada | 5591 | strWID.ps8WidVal = (s8 *)&assoc_id; |
576917ad | 5592 | strWID.s32ValueSize = sizeof(char); |
c5c77ba1 JK |
5593 | |
5594 | return s32Error; | |
5595 | } | |
5596 | ||
5597 | /** | |
5598 | * @brief host_int_get_assoc_req_info | |
5599 | * @details gets a Association request info | |
5600 | * @param[in,out] handle to the wifi driver, | |
5601 | * Message containg assoc. req info in the following format | |
5602 | * ------------------------------------------------------------------------ | |
5603 | | Management Frame Format | | |
5604 | ||-------------------------------------------------------------------| | |
5605 | ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS | | |
5606 | ||-------------|--------|--|--|-----|----------------|----------|----| | |
5607 | | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 | | |
5608 | ||-------------------------------------------------------------------| | |
5609 | | | | |
5610 | | Association Request Frame - Frame Body | | |
5611 | ||-------------------------------------------------------------------| | |
5612 | | Capability Information | Listen Interval | SSID | Supported Rates | | |
5613 | ||------------------------|-----------------|------|-----------------| | |
5614 | | 2 | 2 | 2-34 | 3-10 | | |
5615 | | --------------------------------------------------------------------- | |
5616 | * @return Error code indicating success/failure | |
5617 | * @note | |
5618 | * @author zsalah | |
5619 | * @date 8 March 2012 | |
5620 | * @version 1.0 | |
5621 | */ | |
5622 | ||
218dc407 | 5623 | s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, |
4e4467fd | 5624 | u32 u32AssocReqInfoLen) |
c5c77ba1 | 5625 | { |
e6e12661 | 5626 | s32 s32Error = 0; |
c5c77ba1 JK |
5627 | tstrWID strWID; |
5628 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ | |
5629 | ||
d85f5326 | 5630 | strWID.u16WIDid = (u16)WID_ASSOC_REQ_INFO; |
c5c77ba1 JK |
5631 | strWID.enuWIDtype = WID_STR; |
5632 | strWID.ps8WidVal = pu8AssocReqInfo; | |
5633 | strWID.s32ValueSize = u32AssocReqInfoLen; | |
5634 | ||
5635 | ||
5636 | return s32Error; | |
5637 | } | |
5638 | ||
5639 | /** | |
5640 | * @brief gets a Association Response info | |
5641 | * @details | |
5642 | * @param[in,out] handle to the wifi driver, | |
5643 | * Message containg assoc. resp info | |
5644 | * @return Error code indicating success/failure | |
5645 | * @note | |
5646 | * @author zsalah | |
5647 | * @date 8 March 2012 | |
5648 | * @version 1.0 | |
5649 | */ | |
218dc407 | 5650 | s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, |
4e4467fd | 5651 | u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) |
c5c77ba1 | 5652 | { |
e6e12661 | 5653 | s32 s32Error = 0; |
c5c77ba1 JK |
5654 | tstrWID strWID; |
5655 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; | |
5656 | ||
b1413b60 | 5657 | if (pstrWFIDrv == NULL) { |
24db713f LK |
5658 | PRINT_ER("Driver is null\n"); |
5659 | return -EFAULT; | |
c5c77ba1 JK |
5660 | } |
5661 | ||
d85f5326 | 5662 | strWID.u16WIDid = (u16)WID_ASSOC_RES_INFO; |
c5c77ba1 JK |
5663 | strWID.enuWIDtype = WID_STR; |
5664 | strWID.ps8WidVal = pu8AssocRespInfo; | |
5665 | strWID.s32ValueSize = u32MaxAssocRespInfoLen; | |
5666 | ||
5667 | ||
5668 | /* Sending Configuration packet */ | |
d42ab083 JK |
5669 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
5670 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 5671 | if (s32Error) { |
c5c77ba1 | 5672 | *pu32RcvdAssocRespInfoLen = 0; |
24db713f LK |
5673 | PRINT_ER("Failed to send association response config packet\n"); |
5674 | return -EINVAL; | |
c5c77ba1 JK |
5675 | } else { |
5676 | *pu32RcvdAssocRespInfoLen = strWID.s32ValueSize; | |
5677 | } | |
5678 | ||
c5c77ba1 JK |
5679 | return s32Error; |
5680 | } | |
5681 | ||
5682 | /** | |
5683 | * @brief gets a Association Response info | |
5684 | * @details Valid only in STA mode. This function gives the RSSI | |
5685 | * values observed in all the channels at the time of scanning. | |
5686 | * The length of the field is 1 greater that the total number of | |
5687 | * channels supported. Byte 0 contains the number of channels while | |
5688 | * each of Byte N contains the observed RSSI value for the channel index N. | |
5689 | * @param[in,out] handle to the wifi driver, | |
5690 | * array of scanned channels' RSSI | |
5691 | * @return Error code indicating success/failure | |
5692 | * @note | |
5693 | * @author zsalah | |
5694 | * @date 8 March 2012 | |
5695 | * @version 1.0 | |
5696 | */ | |
218dc407 | 5697 | s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, |
4e4467fd | 5698 | u32 u32RxPowerLevelLen) |
c5c77ba1 | 5699 | { |
e6e12661 | 5700 | s32 s32Error = 0; |
c5c77ba1 JK |
5701 | tstrWID strWID; |
5702 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ | |
5703 | ||
d85f5326 | 5704 | strWID.u16WIDid = (u16)WID_RX_POWER_LEVEL; |
c5c77ba1 JK |
5705 | strWID.enuWIDtype = WID_STR; |
5706 | strWID.ps8WidVal = pu8RxPowerLevel; | |
5707 | strWID.s32ValueSize = u32RxPowerLevelLen; | |
5708 | ||
5709 | ||
5710 | return s32Error; | |
5711 | } | |
5712 | ||
5713 | /** | |
5714 | * @brief sets a channel | |
5715 | * @details | |
5716 | * @param[in,out] handle to the wifi driver, | |
5717 | * @param[in] Index of the channel to be set | |
5718 | *|-------------------------------------------------------------------| | |
5719 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | | |
5720 | | Input: 1 2 14 | | |
5721 | ||-------------------------------------------------------------------| | |
5722 | * @return Error code indicating success/failure | |
5723 | * @note | |
5724 | * @author zsalah | |
5725 | * @date 8 March 2012 | |
5726 | * @version 1.0 | |
5727 | */ | |
218dc407 | 5728 | s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) |
c5c77ba1 | 5729 | { |
e6e12661 | 5730 | s32 s32Error = 0; |
c5c77ba1 JK |
5731 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
5732 | tstrHostIFmsg strHostIFmsg; | |
5733 | ||
24db713f LK |
5734 | if (pstrWFIDrv == NULL) { |
5735 | PRINT_ER("driver is null\n"); | |
5736 | return -EFAULT; | |
5737 | } | |
c5c77ba1 JK |
5738 | |
5739 | /* prepare the set channel message */ | |
2cc46837 | 5740 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5741 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_CHANNEL; |
5742 | strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan.u8SetChan = u8ChNum; | |
5743 | strHostIFmsg.drvHandler = hWFIDrv; | |
5744 | ||
79198138 | 5745 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
24db713f LK |
5746 | if (s32Error) { |
5747 | PRINT_ER("wilc mq send fail\n"); | |
5748 | s32Error = -EINVAL; | |
c5c77ba1 JK |
5749 | } |
5750 | ||
5751 | return s32Error; | |
5752 | } | |
5753 | ||
5754 | ||
fb4ec9ca | 5755 | s32 host_int_wait_msg_queue_idle(void) |
c5c77ba1 | 5756 | { |
e6e12661 | 5757 | s32 s32Error = 0; |
c5c77ba1 JK |
5758 | |
5759 | tstrHostIFmsg strHostIFmsg; | |
5760 | ||
5761 | /* prepare the set driver handler message */ | |
5762 | ||
2cc46837 | 5763 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 | 5764 | strHostIFmsg.u16MsgId = HOST_IF_MSG_Q_IDLE; |
79198138 | 5765 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
24db713f LK |
5766 | if (s32Error) { |
5767 | PRINT_ER("wilc mq send fail\n"); | |
5768 | s32Error = -EINVAL; | |
c5c77ba1 JK |
5769 | } |
5770 | ||
5771 | /* wait untill MSG Q is empty */ | |
83383ea3 | 5772 | down(&hWaitResponse); |
c5c77ba1 JK |
5773 | |
5774 | return s32Error; | |
5775 | ||
5776 | } | |
5777 | ||
218dc407 | 5778 | s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address) |
c5c77ba1 | 5779 | { |
e6e12661 | 5780 | s32 s32Error = 0; |
c5c77ba1 JK |
5781 | |
5782 | tstrHostIFmsg strHostIFmsg; | |
5783 | ||
5784 | ||
5785 | /* prepare the set driver handler message */ | |
5786 | ||
2cc46837 | 5787 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 | 5788 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
d42ab083 | 5789 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = get_id_from_handler(u32address); |
53a84401 | 5790 | strHostIFmsg.drvHandler = u32address; |
c5c77ba1 | 5791 | |
79198138 | 5792 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
24db713f LK |
5793 | if (s32Error) { |
5794 | PRINT_ER("wilc mq send fail\n"); | |
5795 | s32Error = -EINVAL; | |
c5c77ba1 JK |
5796 | } |
5797 | ||
5798 | return s32Error; | |
5799 | } | |
5800 | ||
5801 | ||
5802 | ||
218dc407 | 5803 | s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode) |
c5c77ba1 | 5804 | { |
e6e12661 | 5805 | s32 s32Error = 0; |
c5c77ba1 JK |
5806 | |
5807 | tstrHostIFmsg strHostIFmsg; | |
5808 | ||
5809 | ||
5810 | /* prepare the set driver handler message */ | |
5811 | ||
2cc46837 | 5812 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5813 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_OPERATION_MODE; |
5814 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode.u32Mode = u32mode; | |
5815 | strHostIFmsg.drvHandler = hWFIDrv; | |
5816 | ||
79198138 | 5817 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
24db713f LK |
5818 | if (s32Error) { |
5819 | PRINT_ER("wilc mq send fail\n"); | |
5820 | s32Error = -EINVAL; | |
c5c77ba1 JK |
5821 | } |
5822 | ||
5823 | return s32Error; | |
5824 | } | |
5825 | ||
5826 | /** | |
5827 | * @brief gets the current channel index | |
5828 | * @details | |
5829 | * @param[in,out] handle to the wifi driver, | |
5830 | * current channel index | |
5831 | *|-----------------------------------------------------------------------| | |
5832 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | | |
5833 | | Input: 1 2 14 | | |
5834 | ||-----------------------------------------------------------------------| | |
5835 | * @return Error code indicating success/failure | |
5836 | * @note | |
5837 | * @author zsalah | |
5838 | * @date 8 March 2012 | |
5839 | * @version 1.0 | |
5840 | */ | |
218dc407 | 5841 | s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) |
c5c77ba1 | 5842 | { |
e6e12661 | 5843 | s32 s32Error = 0; |
c5c77ba1 JK |
5844 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
5845 | tstrHostIFmsg strHostIFmsg; | |
5846 | ||
b1413b60 | 5847 | if (pstrWFIDrv == NULL) { |
24db713f LK |
5848 | PRINT_ER("driver is null\n"); |
5849 | return -EFAULT; | |
c5c77ba1 JK |
5850 | } |
5851 | ||
5852 | /* prepare the Get Channel Message */ | |
2cc46837 | 5853 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5854 | |
5855 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_CHNL; | |
5856 | strHostIFmsg.drvHandler = hWFIDrv; | |
5857 | ||
5858 | /* send the message */ | |
79198138 | 5859 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 | 5860 | if (s32Error) |
24db713f | 5861 | PRINT_ER("wilc mq send fail\n"); |
83383ea3 | 5862 | down(&(pstrWFIDrv->hSemGetCHNL)); |
c5c77ba1 JK |
5863 | /* gu8Chnl = 11; */ |
5864 | ||
5865 | *pu8ChNo = gu8Chnl; | |
5866 | ||
c5c77ba1 JK |
5867 | return s32Error; |
5868 | ||
5869 | ||
5870 | } | |
5871 | ||
5872 | ||
5873 | /** | |
5874 | * @brief host_int_test_set_int_wid | |
5875 | * @details Test function for setting wids | |
4e4467fd | 5876 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr |
c5c77ba1 JK |
5877 | * @return Error code indicating success/failure |
5878 | * @note | |
5879 | * @author zsalah | |
5880 | * @date 8 March 2012 | |
5881 | * @version 1.0 | |
5882 | */ | |
218dc407 | 5883 | s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr) |
c5c77ba1 | 5884 | { |
e6e12661 | 5885 | s32 s32Error = 0; |
c5c77ba1 JK |
5886 | tstrWID strWID; |
5887 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; | |
5888 | ||
5889 | ||
b1413b60 | 5890 | if (pstrWFIDrv == NULL) { |
24db713f LK |
5891 | PRINT_ER("driver is null\n"); |
5892 | return -EFAULT; | |
c5c77ba1 JK |
5893 | } |
5894 | ||
5895 | /*prepare configuration packet*/ | |
d85f5326 | 5896 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
c5c77ba1 | 5897 | strWID.enuWIDtype = WID_INT; |
576917ad | 5898 | strWID.ps8WidVal = (char *)&u32TestMemAddr; |
4e4467fd | 5899 | strWID.s32ValueSize = sizeof(u32); |
c5c77ba1 JK |
5900 | |
5901 | /*Sending Cfg*/ | |
d42ab083 JK |
5902 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
5903 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 | 5904 | if (s32Error) { |
24db713f LK |
5905 | PRINT_ER("Failed to set wid value\n"); |
5906 | return -EINVAL; | |
c5c77ba1 JK |
5907 | } else { |
5908 | PRINT_D(HOSTINF_DBG, "Successfully set wid value\n"); | |
5909 | ||
5910 | } | |
5911 | ||
c5c77ba1 JK |
5912 | return s32Error; |
5913 | } | |
5914 | ||
5915 | #ifdef WILC_AP_EXTERNAL_MLME | |
5916 | /** | |
5917 | * @brief host_int_get_inactive_time | |
5918 | * @details | |
5919 | * @param[in,out] handle to the wifi driver, | |
5920 | * current sta macaddress, inactive_time | |
5921 | * @return | |
5922 | * @note | |
5923 | * @author | |
5924 | * @date | |
5925 | * @version 1.0 | |
5926 | */ | |
218dc407 | 5927 | s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime) |
c5c77ba1 | 5928 | { |
e6e12661 | 5929 | s32 s32Error = 0; |
c5c77ba1 JK |
5930 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
5931 | tstrHostIFmsg strHostIFmsg; | |
5932 | ||
b1413b60 | 5933 | if (pstrWFIDrv == NULL) { |
24db713f LK |
5934 | PRINT_ER("driver is null\n"); |
5935 | return -EFAULT; | |
c5c77ba1 JK |
5936 | } |
5937 | ||
2cc46837 | 5938 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5939 | |
5940 | ||
d00d2ba3 | 5941 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT.mac, |
c5c77ba1 JK |
5942 | mac, ETH_ALEN); |
5943 | ||
5944 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_INACTIVETIME; | |
5945 | strHostIFmsg.drvHandler = hWFIDrv; | |
5946 | ||
5947 | /* send the message */ | |
79198138 | 5948 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
5949 | if (s32Error) |
5950 | PRINT_ER("Failed to send get host channel param's message queue "); | |
5951 | ||
83383ea3 | 5952 | down(&(pstrWFIDrv->hSemInactiveTime)); |
c5c77ba1 JK |
5953 | |
5954 | *pu32InactiveTime = gu32InactiveTime; | |
5955 | ||
c5c77ba1 JK |
5956 | return s32Error; |
5957 | } | |
5958 | #endif | |
5959 | /** | |
5960 | * @brief host_int_test_get_int_wid | |
5961 | * @details Test function for getting wids | |
4e4467fd | 5962 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32* pu32TestMemAddr |
c5c77ba1 JK |
5963 | * @return Error code indicating success/failure |
5964 | * @note | |
5965 | * @author zsalah | |
5966 | * @date 8 March 2012 | |
5967 | * @version 1.0 | |
5968 | */ | |
218dc407 | 5969 | s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr) |
c5c77ba1 JK |
5970 | { |
5971 | ||
e6e12661 | 5972 | s32 s32Error = 0; |
c5c77ba1 JK |
5973 | tstrWID strWID; |
5974 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; | |
5975 | ||
5976 | ||
b1413b60 | 5977 | if (pstrWFIDrv == NULL) { |
24db713f LK |
5978 | PRINT_ER("driver is null\n"); |
5979 | return -EFAULT; | |
c5c77ba1 JK |
5980 | } |
5981 | ||
d85f5326 | 5982 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
c5c77ba1 | 5983 | strWID.enuWIDtype = WID_INT; |
ca356ada | 5984 | strWID.ps8WidVal = (s8 *)pu32TestMemAddr; |
4e4467fd | 5985 | strWID.s32ValueSize = sizeof(u32); |
c5c77ba1 | 5986 | |
d42ab083 JK |
5987 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
5988 | get_id_from_handler(pstrWFIDrv)); | |
c5c77ba1 JK |
5989 | /*get the value by searching the local copy*/ |
5990 | if (s32Error) { | |
24db713f LK |
5991 | PRINT_ER("Failed to get wid value\n"); |
5992 | return -EINVAL; | |
c5c77ba1 JK |
5993 | } else { |
5994 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); | |
5995 | ||
5996 | } | |
5997 | ||
c5c77ba1 JK |
5998 | return s32Error; |
5999 | } | |
6000 | ||
6001 | ||
6002 | /** | |
6003 | * @brief host_int_get_rssi | |
6004 | * @details gets the currently maintained RSSI value for the station. | |
6005 | * The received signal strength value in dB. | |
6006 | * The range of valid values is -128 to 0. | |
6007 | * @param[in,out] handle to the wifi driver, | |
6008 | * rssi value in dB | |
6009 | * @return Error code indicating success/failure | |
6010 | * @note | |
6011 | * @author zsalah | |
6012 | * @date 8 March 2012 | |
6013 | * @version 1.0 | |
6014 | */ | |
218dc407 | 6015 | s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) |
c5c77ba1 | 6016 | { |
e6e12661 | 6017 | s32 s32Error = 0; |
c5c77ba1 JK |
6018 | tstrHostIFmsg strHostIFmsg; |
6019 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; | |
6020 | ||
6021 | ||
6022 | /* prepare the Get RSSI Message */ | |
2cc46837 | 6023 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6024 | |
6025 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; | |
6026 | strHostIFmsg.drvHandler = hWFIDrv; | |
6027 | ||
6028 | /* send the message */ | |
79198138 | 6029 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6030 | if (s32Error) { |
6031 | PRINT_ER("Failed to send get host channel param's message queue "); | |
e6e12661 | 6032 | return -EFAULT; |
c5c77ba1 JK |
6033 | } |
6034 | ||
83383ea3 | 6035 | down(&(pstrWFIDrv->hSemGetRSSI)); |
c5c77ba1 JK |
6036 | |
6037 | ||
6038 | if (ps8Rssi == NULL) { | |
6039 | PRINT_ER("RSS pointer value is null"); | |
e6e12661 | 6040 | return -EFAULT; |
c5c77ba1 JK |
6041 | } |
6042 | ||
6043 | ||
6044 | *ps8Rssi = gs8Rssi; | |
6045 | ||
6046 | ||
6047 | return s32Error; | |
6048 | } | |
6049 | ||
218dc407 | 6050 | s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) |
c5c77ba1 JK |
6051 | { |
6052 | tstrHostIFmsg strHostIFmsg; | |
e6e12661 | 6053 | s32 s32Error = 0; |
c5c77ba1 JK |
6054 | |
6055 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; | |
6056 | ||
6057 | ||
6058 | ||
6059 | /* prepare the Get LINKSPEED Message */ | |
2cc46837 | 6060 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6061 | |
6062 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_LINKSPEED; | |
6063 | strHostIFmsg.drvHandler = hWFIDrv; | |
6064 | ||
6065 | /* send the message */ | |
79198138 | 6066 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6067 | if (s32Error) { |
6068 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); | |
e6e12661 | 6069 | return -EFAULT; |
c5c77ba1 JK |
6070 | } |
6071 | ||
83383ea3 | 6072 | down(&(pstrWFIDrv->hSemGetLINKSPEED)); |
c5c77ba1 JK |
6073 | |
6074 | ||
6075 | if (ps8lnkspd == NULL) { | |
6076 | PRINT_ER("LINKSPEED pointer value is null"); | |
e6e12661 | 6077 | return -EFAULT; |
c5c77ba1 JK |
6078 | } |
6079 | ||
6080 | ||
6081 | *ps8lnkspd = gs8lnkspd; | |
6082 | ||
6083 | ||
6084 | return s32Error; | |
6085 | } | |
6086 | ||
218dc407 | 6087 | s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics) |
c5c77ba1 | 6088 | { |
e6e12661 | 6089 | s32 s32Error = 0; |
c5c77ba1 JK |
6090 | tstrHostIFmsg strHostIFmsg; |
6091 | ||
6092 | ||
6093 | /* prepare the Get RSSI Message */ | |
2cc46837 | 6094 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6095 | |
6096 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_STATISTICS; | |
576917ad | 6097 | strHostIFmsg.uniHostIFmsgBody.pUserData = (char *)pstrStatistics; |
c5c77ba1 JK |
6098 | strHostIFmsg.drvHandler = hWFIDrv; |
6099 | /* send the message */ | |
79198138 | 6100 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6101 | if (s32Error) { |
6102 | PRINT_ER("Failed to send get host channel param's message queue "); | |
e6e12661 | 6103 | return -EFAULT; |
c5c77ba1 JK |
6104 | } |
6105 | ||
83383ea3 | 6106 | down(&hWaitResponse); |
c5c77ba1 JK |
6107 | return s32Error; |
6108 | } | |
6109 | ||
6110 | ||
6111 | /** | |
6112 | * @brief host_int_scan | |
6113 | * @details scans a set of channels | |
6114 | * @param[in,out] handle to the wifi driver, | |
6115 | * @param[in] Scan source | |
6116 | * Scan Type PASSIVE_SCAN = 0, | |
6117 | * ACTIVE_SCAN = 1 | |
6118 | * Channels Array | |
6119 | * Channels Array length | |
6120 | * Scan Callback function | |
6121 | * @return Error code indicating success/failure | |
6122 | * @note | |
6123 | * @author zsalah | |
6124 | * @date 8 March 2012 | |
6125 | * @version 1.0 | |
6126 | */ | |
218dc407 | 6127 | s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, |
63d03e47 GKH |
6128 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
6129 | u8 u8ChnlListLen, const u8 *pu8IEs, | |
c5c77ba1 JK |
6130 | size_t IEsLen, tWILCpfScanResult ScanResult, |
6131 | void *pvUserArg, tstrHiddenNetwork *pstrHiddenNetwork) | |
6132 | { | |
e6e12661 | 6133 | s32 s32Error = 0; |
c5c77ba1 JK |
6134 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
6135 | tstrHostIFmsg strHostIFmsg; | |
6136 | tenuScanConnTimer enuScanConnTimer; | |
6137 | ||
24db713f LK |
6138 | if (pstrWFIDrv == NULL || ScanResult == NULL) { |
6139 | PRINT_ER("pstrWFIDrv or ScanResult = NULL\n"); | |
6140 | return -EFAULT; | |
6141 | } | |
c5c77ba1 JK |
6142 | |
6143 | /* prepare the Scan Message */ | |
2cc46837 | 6144 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6145 | |
6146 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN; | |
6147 | ||
6148 | if (pstrHiddenNetwork != NULL) { | |
6149 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; | |
6150 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum; | |
6151 | ||
6152 | } else | |
6153 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); | |
6154 | ||
6155 | strHostIFmsg.drvHandler = hWFIDrv; | |
6156 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ScanSource = u8ScanSource; | |
6157 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ScanType = u8ScanType; | |
6158 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pfScanResult = ScanResult; | |
6159 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pvUserArg = pvUserArg; | |
6160 | ||
6161 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen; | |
f3052587 | 6162 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = kmalloc(u8ChnlListLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
d00d2ba3 | 6163 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList, |
c5c77ba1 JK |
6164 | pu8ChnlFreqList, u8ChnlListLen); |
6165 | ||
6166 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.IEsLen = IEsLen; | |
f3052587 | 6167 | strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
d00d2ba3 | 6168 | memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs, |
c5c77ba1 JK |
6169 | pu8IEs, IEsLen); |
6170 | ||
6171 | /* send the message */ | |
79198138 | 6172 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 | 6173 | if (s32Error) { |
24db713f LK |
6174 | PRINT_ER("Error in sending message queue\n"); |
6175 | return -EINVAL; | |
c5c77ba1 JK |
6176 | } |
6177 | ||
6178 | enuScanConnTimer = SCAN_TIMER; | |
6179 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); | |
9eb06643 GKH |
6180 | pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv; |
6181 | mod_timer(&pstrWFIDrv->hScanTimer, | |
6182 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); | |
c5c77ba1 | 6183 | |
c5c77ba1 JK |
6184 | return s32Error; |
6185 | ||
6186 | } | |
6187 | /** | |
6188 | * @brief hif_set_cfg | |
6189 | * @details sets configuration wids values | |
6190 | * @param[in,out] handle to the wifi driver, | |
6191 | * @param[in] WID, WID value | |
6192 | * @return Error code indicating success/failure | |
6193 | * @note | |
6194 | * @author zsalah | |
6195 | * @date 8 March 2012 | |
6196 | * @version 1.0 | |
6197 | */ | |
218dc407 | 6198 | s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) |
c5c77ba1 JK |
6199 | { |
6200 | ||
e6e12661 | 6201 | s32 s32Error = 0; |
c5c77ba1 JK |
6202 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
6203 | ||
6204 | tstrHostIFmsg strHostIFmsg; | |
6205 | ||
6206 | ||
24db713f LK |
6207 | if (pstrWFIDrv == NULL) { |
6208 | PRINT_ER("pstrWFIDrv NULL\n"); | |
6209 | return -EFAULT; | |
6210 | } | |
c5c77ba1 | 6211 | /* prepare the WiphyParams Message */ |
2cc46837 | 6212 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6213 | strHostIFmsg.u16MsgId = HOST_IF_MSG_CFG_PARAMS; |
6214 | strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr.pstrCfgParamVal = *pstrCfgParamVal; | |
6215 | strHostIFmsg.drvHandler = hWFIDrv; | |
6216 | ||
79198138 | 6217 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 | 6218 | |
c5c77ba1 JK |
6219 | return s32Error; |
6220 | ||
6221 | } | |
6222 | ||
6223 | ||
6224 | /** | |
6225 | * @brief hif_get_cfg | |
6226 | * @details gets configuration wids values | |
6227 | * @param[in,out] handle to the wifi driver, | |
6228 | * WID value | |
6229 | * @param[in] WID, | |
6230 | * @return Error code indicating success/failure | |
6231 | * @note | |
6232 | * @author zsalah | |
6233 | * | |
6234 | * @date 8 March 2012 | |
6235 | * @version 1.0 | |
6236 | */ | |
218dc407 | 6237 | s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value) |
c5c77ba1 | 6238 | { |
e6e12661 | 6239 | s32 s32Error = 0; |
c5c77ba1 JK |
6240 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
6241 | ||
83383ea3 | 6242 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
c5c77ba1 | 6243 | |
b1413b60 | 6244 | if (pstrWFIDrv == NULL) { |
24db713f LK |
6245 | PRINT_ER("pstrWFIDrv NULL\n"); |
6246 | return -EFAULT; | |
c5c77ba1 JK |
6247 | } |
6248 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); | |
6249 | switch (u16WID) { | |
6250 | ||
6251 | case WID_BSS_TYPE: | |
d85f5326 | 6252 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.bss_type; |
c5c77ba1 JK |
6253 | break; |
6254 | ||
6255 | case WID_AUTH_TYPE: | |
d85f5326 | 6256 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.auth_type; |
c5c77ba1 JK |
6257 | break; |
6258 | ||
6259 | case WID_AUTH_TIMEOUT: | |
6260 | *pu16WID_Value = pstrWFIDrv->strCfgValues.auth_timeout; | |
6261 | break; | |
6262 | ||
6263 | case WID_POWER_MANAGEMENT: | |
d85f5326 | 6264 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.power_mgmt_mode; |
c5c77ba1 JK |
6265 | break; |
6266 | ||
6267 | case WID_SHORT_RETRY_LIMIT: | |
6268 | *pu16WID_Value = pstrWFIDrv->strCfgValues.short_retry_limit; | |
6269 | break; | |
6270 | ||
6271 | case WID_LONG_RETRY_LIMIT: | |
6272 | *pu16WID_Value = pstrWFIDrv->strCfgValues.long_retry_limit; | |
6273 | break; | |
6274 | ||
6275 | case WID_FRAG_THRESHOLD: | |
6276 | *pu16WID_Value = pstrWFIDrv->strCfgValues.frag_threshold; | |
6277 | break; | |
6278 | ||
6279 | case WID_RTS_THRESHOLD: | |
6280 | *pu16WID_Value = pstrWFIDrv->strCfgValues.rts_threshold; | |
6281 | break; | |
6282 | ||
6283 | case WID_PREAMBLE: | |
d85f5326 | 6284 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.preamble_type; |
c5c77ba1 JK |
6285 | break; |
6286 | ||
6287 | case WID_SHORT_SLOT_ALLOWED: | |
d85f5326 | 6288 | *pu16WID_Value = (u16) pstrWFIDrv->strCfgValues.short_slot_allowed; |
c5c77ba1 JK |
6289 | break; |
6290 | ||
6291 | case WID_11N_TXOP_PROT_DISABLE: | |
d85f5326 | 6292 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.txop_prot_disabled; |
c5c77ba1 JK |
6293 | break; |
6294 | ||
6295 | case WID_BEACON_INTERVAL: | |
6296 | *pu16WID_Value = pstrWFIDrv->strCfgValues.beacon_interval; | |
6297 | break; | |
6298 | ||
6299 | case WID_DTIM_PERIOD: | |
d85f5326 | 6300 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.dtim_period; |
c5c77ba1 JK |
6301 | break; |
6302 | ||
6303 | case WID_SITE_SURVEY: | |
d85f5326 | 6304 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.site_survey_enabled; |
c5c77ba1 JK |
6305 | break; |
6306 | ||
6307 | case WID_SITE_SURVEY_SCAN_TIME: | |
6308 | *pu16WID_Value = pstrWFIDrv->strCfgValues.site_survey_scan_time; | |
6309 | break; | |
6310 | ||
6311 | case WID_ACTIVE_SCAN_TIME: | |
6312 | *pu16WID_Value = pstrWFIDrv->strCfgValues.active_scan_time; | |
6313 | break; | |
6314 | ||
6315 | case WID_PASSIVE_SCAN_TIME: | |
6316 | *pu16WID_Value = pstrWFIDrv->strCfgValues.passive_scan_time; | |
6317 | break; | |
6318 | ||
6319 | case WID_CURRENT_TX_RATE: | |
6320 | *pu16WID_Value = pstrWFIDrv->strCfgValues.curr_tx_rate; | |
6321 | break; | |
6322 | ||
6323 | default: | |
6324 | break; | |
6325 | } | |
6326 | ||
83383ea3 | 6327 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
c5c77ba1 | 6328 | |
c5c77ba1 JK |
6329 | return s32Error; |
6330 | ||
6331 | } | |
6332 | ||
6333 | /*****************************************************************************/ | |
6334 | /* Notification Functions */ | |
6335 | /*****************************************************************************/ | |
6336 | /** | |
6337 | * @brief notifies host with join and leave requests | |
6338 | * @details This function prepares an Information frame having the | |
6339 | * information about a joining/leaving station. | |
6340 | * @param[in,out] handle to the wifi driver, | |
6341 | * @param[in] 6 byte Sta Adress | |
6342 | * Join or leave flag: | |
6343 | * Join = 1, | |
6344 | * Leave =0 | |
6345 | * @return Error code indicating success/failure | |
6346 | * @note | |
6347 | * @author zsalah | |
6348 | * @date 8 March 2012 | |
6349 | * @version 1.0 | |
6350 | */ | |
6351 | void host_int_send_join_leave_info_to_host | |
72ed4dc7 | 6352 | (u16 assocId, u8 *stationAddr, bool joining) |
c5c77ba1 JK |
6353 | { |
6354 | } | |
6355 | /** | |
6356 | * @brief notifies host with stations found in scan | |
6357 | * @details sends the beacon/probe response from scan | |
6358 | * @param[in,out] handle to the wifi driver, | |
6359 | * @param[in] Sta Address, | |
6360 | * Frame length, | |
6361 | * Rssi of the Station found | |
6362 | * @return Error code indicating success/failure | |
6363 | * @note | |
6364 | * @author zsalah | |
6365 | * @date 8 March 2012 | |
6366 | * @version 1.0 | |
6367 | */ | |
6368 | ||
93dee8ee | 6369 | static void GetPeriodicRSSI(unsigned long arg) |
c5c77ba1 | 6370 | { |
93dee8ee | 6371 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
78c87591 | 6372 | |
c5c77ba1 JK |
6373 | if (pstrWFIDrv == NULL) { |
6374 | PRINT_ER("Driver handler is NULL\n"); | |
6375 | return; | |
6376 | } | |
6377 | ||
6378 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { | |
e6e12661 | 6379 | s32 s32Error = 0; |
c5c77ba1 JK |
6380 | tstrHostIFmsg strHostIFmsg; |
6381 | ||
6382 | /* prepare the Get RSSI Message */ | |
2cc46837 | 6383 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6384 | |
6385 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; | |
6386 | strHostIFmsg.drvHandler = pstrWFIDrv; | |
6387 | ||
6388 | /* send the message */ | |
79198138 | 6389 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6390 | if (s32Error) { |
6391 | PRINT_ER("Failed to send get host channel param's message queue "); | |
6392 | return; | |
6393 | } | |
6394 | } | |
9eb06643 GKH |
6395 | g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv; |
6396 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); | |
c5c77ba1 JK |
6397 | } |
6398 | ||
6399 | ||
6400 | void host_int_send_network_info_to_host | |
ca356ada | 6401 | (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi) |
c5c77ba1 JK |
6402 | { |
6403 | } | |
6404 | /** | |
6405 | * @brief host_int_init | |
6406 | * @details host interface initialization function | |
6407 | * @param[in,out] handle to the wifi driver, | |
6408 | * @note | |
6409 | * @author zsalah | |
6410 | * @date 8 March 2012 | |
6411 | * @version 1.0 | |
6412 | */ | |
4e4467fd CL |
6413 | static u32 u32Intialized; |
6414 | static u32 msgQ_created; | |
6415 | static u32 clients_count; | |
c5c77ba1 | 6416 | |
218dc407 | 6417 | s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) |
c5c77ba1 | 6418 | { |
e6e12661 | 6419 | s32 s32Error = 0; |
c5c77ba1 | 6420 | tstrWILC_WFIDrv *pstrWFIDrv; |
d42ab083 | 6421 | int err; |
c5c77ba1 JK |
6422 | |
6423 | /*if(u32Intialized == 1) | |
6424 | * { | |
6425 | * PRINT_D(HOSTINF_DBG,"Host interface is previously initialized\n"); | |
6426 | * *phWFIDrv = (WILC_WFIDrvHandle)gWFiDrvHandle; //Will be adjusted later for P2P | |
6427 | * return 0; | |
6428 | * } */ | |
6429 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); | |
6430 | ||
72ed4dc7 | 6431 | gbScanWhileConnected = false; |
c5c77ba1 | 6432 | |
83383ea3 | 6433 | sema_init(&hWaitResponse, 0); |
c5c77ba1 JK |
6434 | |
6435 | ||
6436 | ||
6437 | /*Allocate host interface private structure*/ | |
f3052587 | 6438 | pstrWFIDrv = kmalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL); |
b1413b60 | 6439 | if (pstrWFIDrv == NULL) { |
e6e12661 | 6440 | s32Error = -ENOMEM; |
c5c77ba1 JK |
6441 | PRINT_ER("Failed to allocate memory\n"); |
6442 | goto _fail_timer_2; | |
6443 | } | |
2cc46837 | 6444 | memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); |
c5c77ba1 | 6445 | /*return driver handle to user*/ |
218dc407 | 6446 | *phWFIDrv = pstrWFIDrv; |
c5c77ba1 | 6447 | /*save into globl handle*/ |
d42ab083 JK |
6448 | err = add_handler_in_list(pstrWFIDrv); |
6449 | if (err) { | |
e6e12661 | 6450 | s32Error = -EFAULT; |
d42ab083 JK |
6451 | goto _fail_timer_2; |
6452 | } | |
c5c77ba1 JK |
6453 | |
6454 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP | |
6455 | ||
72ed4dc7 | 6456 | g_obtainingIP = false; |
c5c77ba1 JK |
6457 | #endif |
6458 | ||
8a14330f | 6459 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", pstrWFIDrv); |
c5c77ba1 JK |
6460 | /* /////////////////////////////////////// */ |
6461 | if (clients_count == 0) { | |
83383ea3 AB |
6462 | sema_init(&hSemHostIFthrdEnd, 0); |
6463 | sema_init(&hSemDeinitDrvHandle, 0); | |
c5c77ba1 | 6464 | /*BugID_5348*/ |
83383ea3 AB |
6465 | sema_init(&hSemHostIntDeinit, 1); |
6466 | } | |
6467 | ||
6468 | sema_init(&(pstrWFIDrv->hSemTestKeyBlock), 0); | |
6469 | sema_init(&(pstrWFIDrv->hSemTestDisconnectBlock), 0); | |
6470 | sema_init(&(pstrWFIDrv->hSemGetRSSI), 0); | |
6471 | sema_init(&(pstrWFIDrv->hSemGetLINKSPEED), 0); | |
6472 | sema_init(&(pstrWFIDrv->hSemGetCHNL), 0); | |
6473 | sema_init(&(pstrWFIDrv->hSemInactiveTime), 0); | |
c5c77ba1 JK |
6474 | |
6475 | /* /////////////////////////////////////// */ | |
6476 | ||
6477 | ||
6478 | ||
6479 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); | |
6480 | ||
6481 | if (clients_count == 0) { | |
cd08fc78 | 6482 | s32Error = wilc_mq_create(&gMsgQHostIF); |
c5c77ba1 JK |
6483 | |
6484 | if (s32Error < 0) { | |
6485 | PRINT_ER("Failed to creat MQ\n"); | |
6486 | goto _fail_; | |
6487 | } | |
6488 | msgQ_created = 1; | |
1999bd52 AB |
6489 | HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread"); |
6490 | if (IS_ERR(HostIFthreadHandler)) { | |
c5c77ba1 | 6491 | PRINT_ER("Failed to creat Thread\n"); |
e6e12661 | 6492 | s32Error = -EFAULT; |
c5c77ba1 JK |
6493 | goto _fail_mq_; |
6494 | } | |
507d7fc5 GKH |
6495 | setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, |
6496 | (unsigned long)pstrWFIDrv); | |
9eb06643 | 6497 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
c5c77ba1 JK |
6498 | } |
6499 | ||
6500 | ||
93dee8ee | 6501 | setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0); |
c5c77ba1 | 6502 | |
93dee8ee | 6503 | setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0); |
c5c77ba1 JK |
6504 | |
6505 | #ifdef WILC_P2P | |
6506 | /*Remain on channel timer*/ | |
93dee8ee | 6507 | setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0); |
c5c77ba1 JK |
6508 | #endif |
6509 | ||
83383ea3 AB |
6510 | sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); |
6511 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); | |
c5c77ba1 | 6512 | |
c5c77ba1 | 6513 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
72ed4dc7 | 6514 | /* gWFiDrvHandle->bPendingConnRequest = false; */ |
c5c77ba1 JK |
6515 | |
6516 | /*Initialize CFG WIDS Defualt Values*/ | |
6517 | ||
6518 | pstrWFIDrv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; | |
6519 | pstrWFIDrv->strCfgValues.scan_source = DEFAULT_SCAN; | |
6520 | pstrWFIDrv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; | |
6521 | pstrWFIDrv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; | |
6522 | pstrWFIDrv->strCfgValues.curr_tx_rate = AUTORATE; | |
6523 | ||
6524 | ||
6525 | #ifdef WILC_P2P | |
6526 | ||
6527 | pstrWFIDrv->u64P2p_MgmtTimeout = 0; | |
6528 | ||
6529 | #endif | |
6530 | ||
6531 | 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", | |
6532 | ||
6533 | pstrWFIDrv->strCfgValues.site_survey_enabled, pstrWFIDrv->strCfgValues.scan_source, | |
6534 | pstrWFIDrv->strCfgValues.active_scan_time, pstrWFIDrv->strCfgValues.passive_scan_time, | |
6535 | pstrWFIDrv->strCfgValues.curr_tx_rate); | |
6536 | ||
6537 | ||
83383ea3 | 6538 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
c5c77ba1 JK |
6539 | |
6540 | /*TODO Code to setup simulation to be removed later*/ | |
6541 | /*Intialize configurator module*/ | |
6542 | s32Error = CoreConfiguratorInit(); | |
6543 | if (s32Error < 0) { | |
6544 | PRINT_ER("Failed to initialize core configurator\n"); | |
6545 | goto _fail_mem_; | |
6546 | } | |
6547 | ||
c5c77ba1 JK |
6548 | u32Intialized = 1; |
6549 | clients_count++; /* increase number of created entities */ | |
6550 | ||
6551 | return s32Error; | |
6552 | ||
6553 | ||
6554 | _fail_mem_: | |
b1413b60 | 6555 | if (pstrWFIDrv != NULL) |
49188af2 | 6556 | kfree(pstrWFIDrv); |
c5c77ba1 | 6557 | #ifdef WILC_P2P |
4183e979 | 6558 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
c5c77ba1 JK |
6559 | #endif |
6560 | _fail_timer_2: | |
83383ea3 | 6561 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
4183e979 | 6562 | del_timer_sync(&pstrWFIDrv->hConnectTimer); |
4183e979 | 6563 | del_timer_sync(&pstrWFIDrv->hScanTimer); |
1999bd52 | 6564 | kthread_stop(HostIFthreadHandler); |
c5c77ba1 | 6565 | _fail_mq_: |
1b128f63 | 6566 | wilc_mq_destroy(&gMsgQHostIF); |
c5c77ba1 JK |
6567 | _fail_: |
6568 | return s32Error; | |
6569 | ||
6570 | ||
6571 | } | |
6572 | /** | |
6573 | * @brief host_int_deinit | |
6574 | * @details host interface initialization function | |
6575 | * @param[in,out] handle to the wifi driver, | |
6576 | * @note | |
6577 | * @author zsalah | |
6578 | * @date 8 March 2012 | |
6579 | * @version 1.0 | |
6580 | */ | |
6581 | ||
218dc407 | 6582 | s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) |
c5c77ba1 | 6583 | { |
e6e12661 | 6584 | s32 s32Error = 0; |
c5c77ba1 | 6585 | tstrHostIFmsg strHostIFmsg; |
d42ab083 | 6586 | int ret; |
c5c77ba1 JK |
6587 | |
6588 | /*obtain driver handle*/ | |
6589 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; | |
6590 | /*if(u32Intialized == 0) | |
6591 | * { | |
6592 | * PRINT_ER("Host Interface is not initialized\n"); | |
6593 | * return 0; | |
6594 | * }*/ | |
6595 | ||
6596 | /*BugID_5348*/ | |
6597 | ||
6598 | if (pstrWFIDrv == NULL) { | |
6599 | PRINT_ER("pstrWFIDrv = NULL\n"); | |
6600 | return 0; | |
6601 | } | |
6602 | ||
83383ea3 | 6603 | down(&hSemHostIntDeinit); |
c5c77ba1 JK |
6604 | |
6605 | terminated_handle = pstrWFIDrv; | |
6606 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); | |
6607 | ||
6608 | /*BugID_5348*/ | |
6609 | /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ | |
6610 | /*to guarantee handling all messages befor proceeding*/ | |
4183e979 | 6611 | if (del_timer_sync(&pstrWFIDrv->hScanTimer)) { |
03b2d5e7 | 6612 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
c5c77ba1 JK |
6613 | /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ |
6614 | } | |
6615 | ||
4183e979 | 6616 | if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) { |
03b2d5e7 | 6617 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
c5c77ba1 JK |
6618 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
6619 | } | |
6620 | ||
6621 | ||
4183e979 | 6622 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
03b2d5e7 | 6623 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
c5c77ba1 JK |
6624 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
6625 | } | |
6626 | ||
6627 | #ifdef WILC_P2P | |
6628 | /*Destroy Remain-onchannel Timer*/ | |
4183e979 | 6629 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
c5c77ba1 JK |
6630 | #endif |
6631 | ||
218dc407 | 6632 | host_int_set_wfi_drv_handler(NULL); |
83383ea3 | 6633 | down(&hSemDeinitDrvHandle); |
c5c77ba1 JK |
6634 | |
6635 | ||
6636 | /*Calling the CFG80211 scan done function with the abort flag set to true*/ | |
6637 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { | |
b1413b60 | 6638 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
c5c77ba1 JK |
6639 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
6640 | ||
b1413b60 | 6641 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
c5c77ba1 JK |
6642 | } |
6643 | /*deinit configurator and simulator*/ | |
c5c77ba1 | 6644 | CoreConfiguratorDeInit(); |
c5c77ba1 JK |
6645 | |
6646 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; | |
6647 | ||
72ed4dc7 | 6648 | gbScanWhileConnected = false; |
c5c77ba1 | 6649 | |
2cc46837 | 6650 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6651 | |
6652 | if (clients_count == 1) { | |
4183e979 | 6653 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
03b2d5e7 | 6654 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
c5c77ba1 JK |
6655 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
6656 | } | |
6657 | strHostIFmsg.u16MsgId = HOST_IF_MSG_EXIT; | |
6658 | strHostIFmsg.drvHandler = hWFIDrv; | |
6659 | ||
6660 | ||
79198138 | 6661 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
e6e12661 | 6662 | if (s32Error != 0) |
c5c77ba1 | 6663 | PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error); |
c5c77ba1 | 6664 | |
83383ea3 | 6665 | down(&hSemHostIFthrdEnd); |
c5c77ba1 | 6666 | |
1b128f63 | 6667 | wilc_mq_destroy(&gMsgQHostIF); |
c5c77ba1 | 6668 | msgQ_created = 0; |
c5c77ba1 JK |
6669 | } |
6670 | ||
83383ea3 | 6671 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
c5c77ba1 JK |
6672 | |
6673 | /*Setting the gloabl driver handler with NULL*/ | |
6674 | u32Intialized = 0; | |
6675 | /* gWFiDrvHandle = NULL; */ | |
d42ab083 JK |
6676 | ret = remove_handler_in_list(pstrWFIDrv); |
6677 | if (ret) | |
e6e12661 | 6678 | s32Error = -ENOENT; |
d42ab083 | 6679 | |
b1413b60 | 6680 | if (pstrWFIDrv != NULL) { |
49188af2 | 6681 | kfree(pstrWFIDrv); |
b1413b60 | 6682 | /* pstrWFIDrv=NULL; */ |
c5c77ba1 JK |
6683 | |
6684 | } | |
6685 | ||
6686 | clients_count--; /* Decrease number of created entities */ | |
b1413b60 | 6687 | terminated_handle = NULL; |
83383ea3 | 6688 | up(&hSemHostIntDeinit); |
c5c77ba1 JK |
6689 | return s32Error; |
6690 | } | |
6691 | ||
6692 | ||
6693 | /** | |
6694 | * @brief NetworkInfoReceived | |
6695 | * @details function to to be called when network info packet is received | |
6696 | * @param[in] pu8Buffer the received packet | |
6697 | * @param[in] u32Length length of the received packet | |
6698 | * @return none | |
6699 | * @note | |
6700 | * @author | |
6701 | * @date 1 Mar 2012 | |
6702 | * @version 1.0 | |
6703 | */ | |
4e4467fd | 6704 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
c5c77ba1 | 6705 | { |
e6e12661 | 6706 | s32 s32Error = 0; |
c5c77ba1 | 6707 | tstrHostIFmsg strHostIFmsg; |
d42ab083 | 6708 | int id; |
b1413b60 | 6709 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
c5c77ba1 | 6710 | |
d42ab083 JK |
6711 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
6712 | pstrWFIDrv = get_handler_from_id(id); | |
c5c77ba1 JK |
6713 | |
6714 | ||
6715 | ||
6716 | ||
b1413b60 | 6717 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
8a14330f | 6718 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", pstrWFIDrv); |
c5c77ba1 JK |
6719 | return; |
6720 | } | |
6721 | ||
6722 | /* prepare the Asynchronous Network Info message */ | |
2cc46837 | 6723 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6724 | |
6725 | strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_NTWRK_INFO; | |
6726 | strHostIFmsg.drvHandler = pstrWFIDrv; | |
6727 | ||
6728 | strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.u32Length = u32Length; | |
f3052587 | 6729 | strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
d00d2ba3 | 6730 | memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer, |
c5c77ba1 JK |
6731 | pu8Buffer, u32Length); |
6732 | ||
6733 | /* send the message */ | |
79198138 | 6734 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 6735 | if (s32Error) |
c5c77ba1 | 6736 | PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error); |
c5c77ba1 JK |
6737 | } |
6738 | ||
6739 | /** | |
6740 | * @brief GnrlAsyncInfoReceived | |
6741 | * @details function to be called when general Asynchronous info packet is received | |
6742 | * @param[in] pu8Buffer the received packet | |
6743 | * @param[in] u32Length length of the received packet | |
6744 | * @return none | |
6745 | * @note | |
6746 | * @author | |
6747 | * @date 15 Mar 2012 | |
6748 | * @version 1.0 | |
6749 | */ | |
4e4467fd | 6750 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
c5c77ba1 | 6751 | { |
e6e12661 | 6752 | s32 s32Error = 0; |
c5c77ba1 | 6753 | tstrHostIFmsg strHostIFmsg; |
d42ab083 | 6754 | int id; |
b1413b60 | 6755 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
c5c77ba1 JK |
6756 | |
6757 | /*BugID_5348*/ | |
83383ea3 | 6758 | down(&hSemHostIntDeinit); |
c5c77ba1 | 6759 | |
d42ab083 JK |
6760 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
6761 | pstrWFIDrv = get_handler_from_id(id); | |
03b2d5e7 | 6762 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
c5c77ba1 JK |
6763 | |
6764 | ||
6765 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { | |
6766 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); | |
6767 | /*BugID_5348*/ | |
83383ea3 | 6768 | up(&hSemHostIntDeinit); |
c5c77ba1 JK |
6769 | return; |
6770 | } | |
6771 | ||
b1413b60 | 6772 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL) { |
c5c77ba1 JK |
6773 | /* received mac status is not needed when there is no current Connect Request */ |
6774 | PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n"); | |
6775 | /*BugID_5348*/ | |
83383ea3 | 6776 | up(&hSemHostIntDeinit); |
c5c77ba1 JK |
6777 | return; |
6778 | } | |
6779 | ||
6780 | /* prepare the General Asynchronous Info message */ | |
2cc46837 | 6781 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6782 | |
6783 | ||
6784 | strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; | |
6785 | strHostIFmsg.drvHandler = pstrWFIDrv; | |
6786 | ||
6787 | ||
6788 | strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.u32Length = u32Length; | |
f3052587 | 6789 | strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
d00d2ba3 | 6790 | memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer, |
c5c77ba1 JK |
6791 | pu8Buffer, u32Length); |
6792 | ||
6793 | /* send the message */ | |
79198138 | 6794 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 6795 | if (s32Error) |
c5c77ba1 | 6796 | PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", s32Error); |
c5c77ba1 JK |
6797 | |
6798 | /*BugID_5348*/ | |
83383ea3 | 6799 | up(&hSemHostIntDeinit); |
c5c77ba1 JK |
6800 | } |
6801 | ||
6802 | /** | |
6803 | * @brief host_int_ScanCompleteReceived | |
6804 | * @details Setting scan complete received notifcation in message queue | |
4e4467fd | 6805 | * @param[in] u8* pu8Buffer, u32 u32Length |
c5c77ba1 JK |
6806 | * @return Error code. |
6807 | * @author | |
6808 | * @date | |
6809 | * @version 1.0 | |
6810 | */ | |
4e4467fd | 6811 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
c5c77ba1 | 6812 | { |
e6e12661 | 6813 | s32 s32Error = 0; |
c5c77ba1 | 6814 | tstrHostIFmsg strHostIFmsg; |
d42ab083 | 6815 | int id; |
b1413b60 | 6816 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
78c87591 | 6817 | |
d42ab083 JK |
6818 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
6819 | pstrWFIDrv = get_handler_from_id(id); | |
c5c77ba1 JK |
6820 | |
6821 | ||
8a14330f | 6822 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv); |
c5c77ba1 | 6823 | |
2b9d5b48 | 6824 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) |
c5c77ba1 | 6825 | return; |
c5c77ba1 JK |
6826 | |
6827 | /*if there is an ongoing scan request*/ | |
6828 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { | |
6829 | /* prepare theScan Done message */ | |
2cc46837 | 6830 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6831 | |
6832 | strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_SCAN_COMPLETE; | |
6833 | strHostIFmsg.drvHandler = pstrWFIDrv; | |
6834 | ||
6835 | ||
6836 | /* will be deallocated by the receiving thread */ | |
6837 | /*no need to send message body*/ | |
6838 | ||
6839 | /*strHostIFmsg.uniHostIFmsgBody.strScanComplete.u32Length = u32Length; | |
63d03e47 | 6840 | * strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); |
d00d2ba3 | 6841 | * memcpy(strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer, |
c5c77ba1 JK |
6842 | * pu8Buffer, u32Length); */ |
6843 | ||
6844 | /* send the message */ | |
79198138 | 6845 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 6846 | if (s32Error) |
c5c77ba1 | 6847 | PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", s32Error); |
c5c77ba1 JK |
6848 | } |
6849 | ||
6850 | ||
6851 | return; | |
6852 | ||
6853 | } | |
6854 | ||
6855 | #ifdef WILC_P2P | |
6856 | /** | |
6857 | * @brief host_int_remain_on_channel | |
6858 | * @details | |
6859 | * @param[in] Handle to wifi driver | |
6860 | * Duration to remain on channel | |
6861 | * Channel to remain on | |
6862 | * Pointer to fn to be called on receive frames in listen state | |
6863 | * Pointer to remain-on-channel expired fn | |
6864 | * Priv | |
6865 | * @return Error code. | |
6866 | * @author | |
6867 | * @date | |
6868 | * @version 1.0 | |
6869 | */ | |
218dc407 | 6870 | s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg) |
c5c77ba1 | 6871 | { |
e6e12661 | 6872 | s32 s32Error = 0; |
c5c77ba1 JK |
6873 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
6874 | tstrHostIFmsg strHostIFmsg; | |
6875 | ||
24db713f LK |
6876 | if (pstrWFIDrv == NULL) { |
6877 | PRINT_ER("driver is null\n"); | |
6878 | return -EFAULT; | |
6879 | } | |
c5c77ba1 JK |
6880 | |
6881 | /* prepare the remainonchan Message */ | |
2cc46837 | 6882 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6883 | |
6884 | /* prepare the WiphyParams Message */ | |
6885 | strHostIFmsg.u16MsgId = HOST_IF_MSG_REMAIN_ON_CHAN; | |
6886 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u16Channel = chan; | |
6887 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pRemainOnChanExpired = RemainOnChanExpired; | |
6888 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pRemainOnChanReady = RemainOnChanReady; | |
6889 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.pVoid = pvUserArg; | |
6890 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32duration = u32duration; | |
6891 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; | |
6892 | strHostIFmsg.drvHandler = hWFIDrv; | |
6893 | ||
79198138 | 6894 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 6895 | if (s32Error) |
24db713f | 6896 | PRINT_ER("wilc mq send fail\n"); |
c5c77ba1 JK |
6897 | |
6898 | return s32Error; | |
6899 | } | |
6900 | ||
6901 | /** | |
6902 | * @brief host_int_ListenStateExpired | |
6903 | * @details | |
6904 | * @param[in] Handle to wifi driver | |
6905 | * Duration to remain on channel | |
6906 | * Channel to remain on | |
6907 | * Pointer to fn to be called on receive frames in listen state | |
6908 | * Pointer to remain-on-channel expired fn | |
6909 | * Priv | |
6910 | * @return Error code. | |
6911 | * @author | |
6912 | * @date | |
6913 | * @version 1.0 | |
6914 | */ | |
218dc407 | 6915 | s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) |
c5c77ba1 | 6916 | { |
e6e12661 | 6917 | s32 s32Error = 0; |
c5c77ba1 JK |
6918 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
6919 | tstrHostIFmsg strHostIFmsg; | |
6920 | ||
24db713f LK |
6921 | if (pstrWFIDrv == NULL) { |
6922 | PRINT_ER("driver is null\n"); | |
6923 | return -EFAULT; | |
6924 | } | |
c5c77ba1 JK |
6925 | |
6926 | /*Stopping remain-on-channel timer*/ | |
8972d0fe | 6927 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
c5c77ba1 JK |
6928 | |
6929 | /* prepare the timer fire Message */ | |
2cc46837 | 6930 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6931 | strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
6932 | strHostIFmsg.drvHandler = hWFIDrv; | |
6933 | strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; | |
6934 | ||
79198138 | 6935 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 6936 | if (s32Error) |
24db713f | 6937 | PRINT_ER("wilc mq send fail\n"); |
c5c77ba1 | 6938 | |
c5c77ba1 JK |
6939 | return s32Error; |
6940 | } | |
6941 | ||
6942 | /** | |
6943 | * @brief host_int_frame_register | |
6944 | * @details | |
6945 | * @param[in] Handle to wifi driver | |
6946 | * @return Error code. | |
6947 | * @author | |
6948 | * @date | |
6949 | * @version 1.0*/ | |
218dc407 | 6950 | s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg) |
c5c77ba1 | 6951 | { |
e6e12661 | 6952 | s32 s32Error = 0; |
c5c77ba1 JK |
6953 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
6954 | tstrHostIFmsg strHostIFmsg; | |
6955 | ||
24db713f LK |
6956 | if (pstrWFIDrv == NULL) { |
6957 | PRINT_ER("driver is null\n"); | |
6958 | return -EFAULT; | |
6959 | } | |
c5c77ba1 | 6960 | |
2cc46837 | 6961 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
6962 | |
6963 | /* prepare the WiphyParams Message */ | |
6964 | strHostIFmsg.u16MsgId = HOST_IF_MSG_REGISTER_FRAME; | |
6965 | switch (u16FrameType) { | |
6966 | case ACTION: | |
6967 | PRINT_D(HOSTINF_DBG, "ACTION\n"); | |
6968 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u8Regid = ACTION_FRM_IDX; | |
6969 | break; | |
6970 | ||
6971 | case PROBE_REQ: | |
6972 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); | |
6973 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u8Regid = PROBE_REQ_IDX; | |
6974 | break; | |
6975 | ||
6976 | default: | |
6977 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); | |
6978 | break; | |
6979 | } | |
6980 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.u16FrameType = u16FrameType; | |
6981 | strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.bReg = bReg; | |
6982 | strHostIFmsg.drvHandler = hWFIDrv; | |
6983 | ||
79198138 | 6984 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 6985 | if (s32Error) |
24db713f | 6986 | PRINT_ER("wilc mq send fail\n"); |
c5c77ba1 JK |
6987 | |
6988 | return s32Error; | |
6989 | ||
6990 | ||
6991 | } | |
6992 | #endif | |
6993 | ||
6994 | #ifdef WILC_AP_EXTERNAL_MLME | |
6995 | /** | |
6996 | * @brief host_int_add_beacon | |
6997 | * @details Setting add beacon params in message queue | |
4e4467fd CL |
6998 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, |
6999 | * u32 u32DTIMPeriod,u32 u32HeadLen, u8* pu8Head, | |
7000 | * u32 u32TailLen, u8* pu8Tail | |
c5c77ba1 JK |
7001 | * @return Error code. |
7002 | * @author | |
7003 | * @date | |
7004 | * @version 1.0 | |
7005 | */ | |
218dc407 | 7006 | s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, |
4e4467fd CL |
7007 | u32 u32DTIMPeriod, |
7008 | u32 u32HeadLen, u8 *pu8Head, | |
7009 | u32 u32TailLen, u8 *pu8Tail) | |
c5c77ba1 | 7010 | { |
e6e12661 | 7011 | s32 s32Error = 0; |
c5c77ba1 JK |
7012 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7013 | tstrHostIFmsg strHostIFmsg; | |
7014 | tstrHostIFSetBeacon *pstrSetBeaconParam = &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon; | |
7015 | ||
24db713f LK |
7016 | if (pstrWFIDrv == NULL) { |
7017 | PRINT_ER("driver is null\n"); | |
7018 | return -EFAULT; | |
7019 | } | |
c5c77ba1 | 7020 | |
2cc46837 | 7021 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7022 | |
7023 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); | |
7024 | ||
7025 | ||
7026 | /* prepare the WiphyParams Message */ | |
7027 | strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BEACON; | |
7028 | strHostIFmsg.drvHandler = hWFIDrv; | |
7029 | pstrSetBeaconParam->u32Interval = u32Interval; | |
7030 | pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; | |
7031 | pstrSetBeaconParam->u32HeadLen = u32HeadLen; | |
f3052587 | 7032 | pstrSetBeaconParam->pu8Head = kmalloc(u32HeadLen, GFP_KERNEL); |
24db713f LK |
7033 | if (pstrSetBeaconParam->pu8Head == NULL) { |
7034 | s32Error = -ENOMEM; | |
7035 | goto ERRORHANDLER; | |
7036 | } | |
d00d2ba3 | 7037 | memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); |
c5c77ba1 JK |
7038 | pstrSetBeaconParam->u32TailLen = u32TailLen; |
7039 | ||
7040 | /* Bug 4599 : if tail length = 0 skip allocating & copying */ | |
7041 | if (u32TailLen > 0) { | |
f3052587 | 7042 | pstrSetBeaconParam->pu8Tail = kmalloc(u32TailLen, GFP_KERNEL); |
24db713f LK |
7043 | if (pstrSetBeaconParam->pu8Tail == NULL) { |
7044 | s32Error = -ENOMEM; | |
7045 | goto ERRORHANDLER; | |
7046 | } | |
d00d2ba3 | 7047 | memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); |
c5c77ba1 JK |
7048 | } else { |
7049 | pstrSetBeaconParam->pu8Tail = NULL; | |
7050 | } | |
7051 | ||
79198138 | 7052 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7053 | if (s32Error) |
24db713f | 7054 | PRINT_ER("wilc mq send fail\n"); |
c5c77ba1 | 7055 | |
24db713f LK |
7056 | ERRORHANDLER: |
7057 | if (s32Error) { | |
2b9d5b48 | 7058 | if (pstrSetBeaconParam->pu8Head != NULL) |
49188af2 | 7059 | kfree(pstrSetBeaconParam->pu8Head); |
c5c77ba1 | 7060 | |
2b9d5b48 | 7061 | if (pstrSetBeaconParam->pu8Tail != NULL) |
49188af2 | 7062 | kfree(pstrSetBeaconParam->pu8Tail); |
c5c77ba1 JK |
7063 | } |
7064 | ||
7065 | return s32Error; | |
7066 | ||
7067 | } | |
7068 | ||
7069 | ||
7070 | /** | |
7071 | * @brief host_int_del_beacon | |
7072 | * @details Setting add beacon params in message queue | |
7073 | * @param[in] WILC_WFIDrvHandle hWFIDrv | |
7074 | * @return Error code. | |
7075 | * @author | |
7076 | * @date | |
7077 | * @version 1.0 | |
7078 | */ | |
218dc407 | 7079 | s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) |
c5c77ba1 | 7080 | { |
e6e12661 | 7081 | s32 s32Error = 0; |
c5c77ba1 JK |
7082 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7083 | tstrHostIFmsg strHostIFmsg; | |
7084 | ||
24db713f LK |
7085 | if (pstrWFIDrv == NULL) { |
7086 | PRINT_ER("driver is null\n"); | |
7087 | return -EFAULT; | |
7088 | } | |
c5c77ba1 JK |
7089 | |
7090 | /* prepare the WiphyParams Message */ | |
7091 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BEACON; | |
7092 | strHostIFmsg.drvHandler = hWFIDrv; | |
7093 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); | |
7094 | ||
79198138 | 7095 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
7dc1d0cc LK |
7096 | if (s32Error) |
7097 | PRINT_ER("wilc_mq_send fail\n"); | |
c5c77ba1 | 7098 | |
c5c77ba1 JK |
7099 | return s32Error; |
7100 | } | |
7101 | ||
7102 | ||
7103 | /** | |
7104 | * @brief host_int_add_station | |
7105 | * @details Setting add station params in message queue | |
7106 | * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams | |
7107 | * @return Error code. | |
7108 | * @author | |
7109 | * @date | |
7110 | * @version 1.0 | |
7111 | */ | |
218dc407 | 7112 | s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) |
c5c77ba1 | 7113 | { |
e6e12661 | 7114 | s32 s32Error = 0; |
c5c77ba1 JK |
7115 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7116 | tstrHostIFmsg strHostIFmsg; | |
7117 | tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam; | |
7118 | ||
7119 | ||
24db713f LK |
7120 | if (pstrWFIDrv == NULL) { |
7121 | PRINT_ER("driver is null\n"); | |
7122 | return -EFAULT; | |
7123 | } | |
c5c77ba1 | 7124 | |
2cc46837 | 7125 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7126 | |
7127 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); | |
7128 | ||
7129 | ||
7130 | /* prepare the WiphyParams Message */ | |
7131 | strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_STATION; | |
7132 | strHostIFmsg.drvHandler = hWFIDrv; | |
7133 | ||
d00d2ba3 | 7134 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); |
c5c77ba1 | 7135 | if (pstrAddStationMsg->u8NumRates > 0) { |
f3052587 | 7136 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
78c87591 | 7137 | |
7ae43363 LK |
7138 | if (!rates) |
7139 | return -ENOMEM; | |
c5c77ba1 | 7140 | |
d00d2ba3 | 7141 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
057d1e97 | 7142 | pstrAddStationMsg->pu8Rates = rates; |
c5c77ba1 JK |
7143 | } |
7144 | ||
7145 | ||
79198138 | 7146 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7147 | if (s32Error) |
24db713f | 7148 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
7149 | return s32Error; |
7150 | } | |
7151 | ||
7152 | /** | |
7153 | * @brief host_int_del_station | |
7154 | * @details Setting delete station params in message queue | |
63d03e47 | 7155 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr |
c5c77ba1 JK |
7156 | * @return Error code. |
7157 | * @author | |
7158 | * @date | |
7159 | * @version 1.0 | |
7160 | */ | |
218dc407 | 7161 | s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr) |
c5c77ba1 | 7162 | { |
e6e12661 | 7163 | s32 s32Error = 0; |
c5c77ba1 JK |
7164 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7165 | tstrHostIFmsg strHostIFmsg; | |
7166 | tstrHostIFDelSta *pstrDelStationMsg = &strHostIFmsg.uniHostIFmsgBody.strDelStaParam; | |
7167 | ||
24db713f LK |
7168 | if (pstrWFIDrv == NULL) { |
7169 | PRINT_ER("driver is null\n"); | |
7170 | return -EFAULT; | |
7171 | } | |
c5c77ba1 | 7172 | |
2cc46837 | 7173 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7174 | |
7175 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); | |
7176 | ||
7177 | ||
7178 | ||
7179 | /* prepare the WiphyParams Message */ | |
7180 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_STATION; | |
7181 | strHostIFmsg.drvHandler = hWFIDrv; | |
7182 | ||
7183 | /*BugID_4795: Handling situation of deleting all stations*/ | |
b1413b60 | 7184 | if (pu8MacAddr == NULL) |
2cc46837 | 7185 | memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); |
c5c77ba1 | 7186 | else |
d00d2ba3 | 7187 | memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); |
c5c77ba1 | 7188 | |
79198138 | 7189 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7190 | if (s32Error) |
24db713f | 7191 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
7192 | return s32Error; |
7193 | } | |
7194 | /** | |
7195 | * @brief host_int_del_allstation | |
7196 | * @details Setting del station params in message queue | |
63d03e47 | 7197 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]s |
c5c77ba1 JK |
7198 | * @return Error code. |
7199 | * @author | |
7200 | * @date | |
7201 | * @version 1.0 | |
7202 | */ | |
218dc407 | 7203 | s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) |
c5c77ba1 | 7204 | { |
e6e12661 | 7205 | s32 s32Error = 0; |
c5c77ba1 JK |
7206 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7207 | tstrHostIFmsg strHostIFmsg; | |
7208 | tstrHostIFDelAllSta *pstrDelAllStationMsg = &strHostIFmsg.uniHostIFmsgBody.strHostIFDelAllSta; | |
63d03e47 | 7209 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
4e4467fd | 7210 | u32 i; |
63d03e47 | 7211 | u8 u8AssocNumb = 0; |
c5c77ba1 JK |
7212 | |
7213 | ||
24db713f LK |
7214 | if (pstrWFIDrv == NULL) { |
7215 | PRINT_ER("driver is null\n"); | |
7216 | return -EFAULT; | |
7217 | } | |
c5c77ba1 | 7218 | |
2cc46837 | 7219 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7220 | |
7221 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); | |
7222 | ||
7223 | /* prepare the WiphyParams Message */ | |
7224 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_ALL_STA; | |
7225 | strHostIFmsg.drvHandler = hWFIDrv; | |
7226 | ||
7227 | /* Handling situation of deauthenticing all associated stations*/ | |
7228 | for (i = 0; i < MAX_NUM_STA; i++) { | |
7229 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { | |
d00d2ba3 | 7230 | memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); |
c5c77ba1 JK |
7231 | PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", pstrDelAllStationMsg->au8Sta_DelAllSta[i][0], pstrDelAllStationMsg->au8Sta_DelAllSta[i][1], pstrDelAllStationMsg->au8Sta_DelAllSta[i][2], pstrDelAllStationMsg->au8Sta_DelAllSta[i][3], pstrDelAllStationMsg->au8Sta_DelAllSta[i][4], |
7232 | pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]); | |
7233 | u8AssocNumb++; | |
7234 | } | |
7235 | } | |
7236 | if (!u8AssocNumb) { | |
7237 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); | |
7238 | return s32Error; | |
7239 | } | |
7240 | ||
7241 | pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb; | |
79198138 | 7242 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7243 | |
7244 | ||
2b9d5b48 | 7245 | if (s32Error) |
24db713f | 7246 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 | 7247 | |
83383ea3 | 7248 | down(&hWaitResponse); |
c5c77ba1 JK |
7249 | |
7250 | return s32Error; | |
7251 | ||
7252 | } | |
7253 | ||
7254 | /** | |
7255 | * @brief host_int_edit_station | |
7256 | * @details Setting edit station params in message queue | |
7257 | * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams | |
7258 | * @return Error code. | |
7259 | * @author | |
7260 | * @date | |
7261 | * @version 1.0 | |
7262 | */ | |
218dc407 | 7263 | s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) |
c5c77ba1 | 7264 | { |
e6e12661 | 7265 | s32 s32Error = 0; |
c5c77ba1 JK |
7266 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7267 | tstrHostIFmsg strHostIFmsg; | |
7268 | tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam; | |
7269 | ||
24db713f LK |
7270 | if (pstrWFIDrv == NULL) { |
7271 | PRINT_ER("driver is null\n"); | |
7272 | return -EFAULT; | |
7273 | } | |
c5c77ba1 JK |
7274 | |
7275 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); | |
7276 | ||
2cc46837 | 7277 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7278 | |
7279 | ||
7280 | /* prepare the WiphyParams Message */ | |
7281 | strHostIFmsg.u16MsgId = HOST_IF_MSG_EDIT_STATION; | |
7282 | strHostIFmsg.drvHandler = hWFIDrv; | |
7283 | ||
d00d2ba3 | 7284 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); |
c5c77ba1 | 7285 | if (pstrAddStationMsg->u8NumRates > 0) { |
f3052587 | 7286 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
78c87591 | 7287 | |
7ae43363 LK |
7288 | if (!rates) |
7289 | return -ENOMEM; | |
7290 | ||
d00d2ba3 | 7291 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
057d1e97 | 7292 | pstrAddStationMsg->pu8Rates = rates; |
c5c77ba1 JK |
7293 | } |
7294 | ||
79198138 | 7295 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7296 | if (s32Error) |
24db713f LK |
7297 | PRINT_ER("wilc_mq_send fail\n"); |
7298 | ||
c5c77ba1 JK |
7299 | return s32Error; |
7300 | } | |
7301 | #endif /*WILC_AP_EXTERNAL_MLME*/ | |
fbc2fe16 | 7302 | u32 wilc_get_chipid(u8); |
c5c77ba1 | 7303 | |
218dc407 | 7304 | s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Timeout) |
c5c77ba1 | 7305 | { |
e6e12661 | 7306 | s32 s32Error = 0; |
c5c77ba1 JK |
7307 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7308 | tstrHostIFmsg strHostIFmsg; | |
7309 | tstrHostIfPowerMgmtParam *pstrPowerMgmtParam = &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam; | |
7310 | ||
03b2d5e7 | 7311 | PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d <<\n\n", bIsEnabled); |
c5c77ba1 | 7312 | |
24db713f LK |
7313 | if (pstrWFIDrv == NULL) { |
7314 | PRINT_ER("driver is null\n"); | |
7315 | return -EFAULT; | |
7316 | } | |
c5c77ba1 JK |
7317 | |
7318 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); | |
7319 | ||
2cc46837 | 7320 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7321 | |
7322 | ||
7323 | /* prepare the WiphyParams Message */ | |
7324 | strHostIFmsg.u16MsgId = HOST_IF_MSG_POWER_MGMT; | |
7325 | strHostIFmsg.drvHandler = hWFIDrv; | |
7326 | ||
7327 | pstrPowerMgmtParam->bIsEnabled = bIsEnabled; | |
7328 | pstrPowerMgmtParam->u32Timeout = u32Timeout; | |
7329 | ||
7330 | ||
79198138 | 7331 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7332 | if (s32Error) |
24db713f | 7333 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
7334 | return s32Error; |
7335 | } | |
7336 | ||
218dc407 | 7337 | s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32count) |
c5c77ba1 | 7338 | { |
e6e12661 | 7339 | s32 s32Error = 0; |
c5c77ba1 JK |
7340 | |
7341 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; | |
7342 | tstrHostIFmsg strHostIFmsg; | |
7343 | tstrHostIFSetMulti *pstrMulticastFilterParam = &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti; | |
7344 | ||
7345 | ||
24db713f LK |
7346 | if (pstrWFIDrv == NULL) { |
7347 | PRINT_ER("driver is null\n"); | |
7348 | return -EFAULT; | |
7349 | } | |
c5c77ba1 JK |
7350 | |
7351 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); | |
7352 | ||
2cc46837 | 7353 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7354 | |
7355 | ||
7356 | /* prepare the WiphyParams Message */ | |
7357 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MULTICAST_FILTER; | |
7358 | strHostIFmsg.drvHandler = hWFIDrv; | |
7359 | ||
7360 | pstrMulticastFilterParam->bIsEnabled = bIsEnabled; | |
7361 | pstrMulticastFilterParam->u32count = u32count; | |
7362 | ||
79198138 | 7363 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7364 | if (s32Error) |
24db713f | 7365 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
7366 | return s32Error; |
7367 | } | |
7368 | ||
7369 | ||
7370 | ||
7371 | /*Bug4218: Parsing Join Param*/ | |
7372 | #ifdef WILC_PARSE_SCAN_IN_HOST | |
7373 | ||
7374 | /*Bug4218: Parsing Join Param*/ | |
7375 | /** | |
7376 | * @brief host_int_ParseJoinBssParam | |
7377 | * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry | |
7378 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo | |
7379 | * @return | |
7380 | * @author zsalah | |
7381 | * @date | |
7382 | * @version 1.0**/ | |
7383 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) | |
7384 | { | |
7385 | tstrJoinBssParam *pNewJoinBssParam = NULL; | |
63d03e47 | 7386 | u8 *pu8IEs; |
d85f5326 CL |
7387 | u16 u16IEsLen; |
7388 | u16 index = 0; | |
63d03e47 GKH |
7389 | u8 suppRatesNo = 0; |
7390 | u8 extSuppRatesNo; | |
d85f5326 | 7391 | u16 jumpOffset; |
63d03e47 GKH |
7392 | u8 pcipherCount; |
7393 | u8 authCount; | |
7394 | u8 pcipherTotalCount = 0; | |
7395 | u8 authTotalCount = 0; | |
7396 | u8 i, j; | |
c5c77ba1 JK |
7397 | |
7398 | pu8IEs = ptstrNetworkInfo->pu8IEs; | |
7399 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; | |
7400 | ||
f3052587 | 7401 | pNewJoinBssParam = kmalloc(sizeof(tstrJoinBssParam), GFP_KERNEL); |
c5c77ba1 | 7402 | if (pNewJoinBssParam != NULL) { |
2cc46837 | 7403 | memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); |
c5c77ba1 JK |
7404 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
7405 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; | |
7406 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; | |
d00d2ba3 | 7407 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
c5c77ba1 JK |
7408 | /*for(i=0; i<6;i++) |
7409 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ | |
d00d2ba3 | 7410 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
c5c77ba1 | 7411 | pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; |
2cc46837 CL |
7412 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
7413 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); | |
c5c77ba1 JK |
7414 | /*for(i=0; i<pNewJoinBssParam->ssidLen;i++) |
7415 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ | |
7416 | ||
7417 | /* parse supported rates: */ | |
7418 | while (index < u16IEsLen) { | |
7419 | /* supportedRates IE */ | |
7420 | if (pu8IEs[index] == SUPP_RATES_IE) { | |
7421 | /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */ | |
7422 | suppRatesNo = pu8IEs[index + 1]; | |
7423 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; | |
7424 | index += 2; /* skipping ID and length bytes; */ | |
7425 | ||
7426 | for (i = 0; i < suppRatesNo; i++) { | |
7427 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; | |
7428 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */ | |
7429 | } | |
7430 | index += suppRatesNo; | |
7431 | continue; | |
7432 | } | |
7433 | /* Ext SupportedRates IE */ | |
7434 | else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { | |
7435 | /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */ | |
7436 | /* checking if no of ext. supp and supp rates < max limit */ | |
7437 | extSuppRatesNo = pu8IEs[index + 1]; | |
7438 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) | |
7439 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; | |
7440 | else | |
7441 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; | |
7442 | index += 2; | |
7443 | /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */ | |
7444 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) { | |
7445 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; | |
7446 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */ | |
7447 | } | |
7448 | index += extSuppRatesNo; | |
7449 | continue; | |
7450 | } | |
7451 | /* HT Cap. IE */ | |
7452 | else if (pu8IEs[index] == HT_CAPABILITY_IE) { | |
7453 | /* if IE found set the flag */ | |
0be1eb74 | 7454 | pNewJoinBssParam->ht_capable = true; |
c5c77ba1 JK |
7455 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
7456 | /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */ | |
7457 | continue; | |
7458 | } else if ((pu8IEs[index] == WMM_IE) && /* WMM Element ID */ | |
7459 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && | |
7460 | (pu8IEs[index + 4] == 0xF2) && /* OUI */ | |
7461 | (pu8IEs[index + 5] == 0x02) && /* OUI Type */ | |
7462 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && /* OUI Sub Type */ | |
7463 | (pu8IEs[index + 7] == 0x01)) { | |
7464 | /* Presence of WMM Info/Param element indicates WMM capability */ | |
0be1eb74 | 7465 | pNewJoinBssParam->wmm_cap = true; |
c5c77ba1 JK |
7466 | |
7467 | /* Check if Bit 7 is set indicating U-APSD capability */ | |
2b9d5b48 | 7468 | if (pu8IEs[index + 8] & (1 << 7)) |
0be1eb74 | 7469 | pNewJoinBssParam->uapsd_cap = true; |
c5c77ba1 JK |
7470 | index += pu8IEs[index + 1] + 2; |
7471 | continue; | |
7472 | } | |
7473 | #ifdef WILC_P2P | |
7474 | else if ((pu8IEs[index] == P2P_IE) && /* P2P Element ID */ | |
7475 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && | |
7476 | (pu8IEs[index + 4] == 0x9a) && /* OUI */ | |
7477 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ | |
d85f5326 | 7478 | u16 u16P2P_count; |
78c87591 | 7479 | |
c5c77ba1 JK |
7480 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
7481 | pNewJoinBssParam->u8NoaEnbaled = 1; | |
7482 | pNewJoinBssParam->u8Index = pu8IEs[index + 9]; | |
7483 | ||
7484 | /* Check if Bit 7 is set indicating Opss capability */ | |
7485 | if (pu8IEs[index + 10] & (1 << 7)) { | |
7486 | pNewJoinBssParam->u8OppEnable = 1; | |
7487 | pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10]; | |
7488 | } else | |
7489 | pNewJoinBssParam->u8OppEnable = 0; | |
7490 | /* HOSTINF_DBG */ | |
03b2d5e7 | 7491 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
c5c77ba1 | 7492 | for (i = 0; i < pu8IEs[index + 7]; i++) |
03b2d5e7 | 7493 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
c5c77ba1 JK |
7494 | |
7495 | pNewJoinBssParam->u8Count = pu8IEs[index + 11]; | |
7496 | u16P2P_count = index + 12; | |
7497 | ||
d00d2ba3 | 7498 | memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); |
c5c77ba1 JK |
7499 | u16P2P_count += 4; |
7500 | ||
d00d2ba3 | 7501 | memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); |
c5c77ba1 JK |
7502 | u16P2P_count += 4; |
7503 | ||
d00d2ba3 | 7504 | memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); |
c5c77ba1 JK |
7505 | |
7506 | index += pu8IEs[index + 1] + 2; | |
7507 | continue; | |
7508 | ||
7509 | } | |
7510 | #endif | |
7511 | else if ((pu8IEs[index] == RSN_IE) || | |
7512 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && | |
7513 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && | |
7514 | (pu8IEs[index + 5] == 0x01))) { | |
d85f5326 | 7515 | u16 rsnIndex = index; |
c5c77ba1 JK |
7516 | /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]); |
7517 | * for(i=0; i<pu8IEs[rsnIndex+1]; i++) | |
7518 | * { | |
7519 | * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]); | |
7520 | * }*/ | |
7521 | if (pu8IEs[rsnIndex] == RSN_IE) { | |
7522 | pNewJoinBssParam->mode_802_11i = 2; | |
7523 | /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */ | |
7524 | } else { /* check if rsn was previously parsed */ | |
7525 | if (pNewJoinBssParam->mode_802_11i == 0) | |
7526 | pNewJoinBssParam->mode_802_11i = 1; | |
7527 | /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */ | |
7528 | rsnIndex += 4; | |
7529 | } | |
7530 | rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ | |
7531 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; | |
7532 | rsnIndex++; | |
03b2d5e7 | 7533 | /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ |
c5c77ba1 JK |
7534 | /* initialize policies with invalid values */ |
7535 | ||
7536 | jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ | |
7537 | ||
7538 | /*parsing pairwise cipher*/ | |
7539 | ||
7540 | /* saving 3 pcipher max. */ | |
7541 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; | |
7542 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ | |
7543 | ||
03b2d5e7 | 7544 | /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ |
c5c77ba1 JK |
7545 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { |
7546 | /* each count corresponds to 4 bytes, only last byte is saved */ | |
7547 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; | |
7548 | /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */ | |
7549 | } | |
7550 | pcipherTotalCount += pcipherCount; | |
7551 | rsnIndex += jumpOffset; | |
7552 | ||
7553 | jumpOffset = pu8IEs[rsnIndex] * 4; | |
7554 | ||
7555 | /*parsing AKM suite (auth_policy)*/ | |
7556 | /* saving 3 auth policies max. */ | |
7557 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; | |
7558 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ | |
7559 | ||
7560 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) { | |
7561 | /* each count corresponds to 4 bytes, only last byte is saved */ | |
7562 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; | |
7563 | } | |
7564 | authTotalCount += authCount; | |
7565 | rsnIndex += jumpOffset; | |
7566 | /*pasring rsn cap. only if rsn IE*/ | |
7567 | if (pu8IEs[index] == RSN_IE) { | |
7568 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; | |
7569 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; | |
7570 | rsnIndex += 2; | |
7571 | } | |
f717c0eb | 7572 | pNewJoinBssParam->rsn_found = true; |
c5c77ba1 JK |
7573 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
7574 | continue; | |
7575 | } else | |
7576 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ | |
7577 | ||
7578 | } | |
7579 | ||
7580 | ||
7581 | } | |
7582 | ||
7583 | return (void *)pNewJoinBssParam; | |
7584 | ||
7585 | } | |
7586 | ||
7587 | void host_int_freeJoinParams(void *pJoinParams) | |
7588 | { | |
7589 | if ((tstrJoinBssParam *)pJoinParams != NULL) | |
49188af2 | 7590 | kfree((tstrJoinBssParam *)pJoinParams); |
c5c77ba1 JK |
7591 | else |
7592 | PRINT_ER("Unable to FREE null pointer\n"); | |
7593 | } | |
7594 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ | |
7595 | ||
7596 | ||
7597 | /** | |
7598 | * @brief host_int_addBASession | |
7599 | * @details Open a block Ack session with the given parameters | |
7600 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo | |
7601 | * @return | |
7602 | * @author anoureldin | |
7603 | * @date | |
7604 | * @version 1.0**/ | |
7605 | ||
2b05df55 | 7606 | static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID, short int BufferSize, |
c5c77ba1 JK |
7607 | short int SessionTimeout, void *drvHandler) |
7608 | { | |
e6e12661 | 7609 | s32 s32Error = 0; |
c5c77ba1 JK |
7610 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7611 | tstrHostIFmsg strHostIFmsg; | |
7612 | tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; | |
7613 | ||
24db713f LK |
7614 | if (pstrWFIDrv == NULL) { |
7615 | PRINT_ER("driver is null\n"); | |
7616 | return -EFAULT; | |
7617 | } | |
c5c77ba1 | 7618 | |
2cc46837 | 7619 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7620 | |
7621 | /* prepare the WiphyParams Message */ | |
7622 | strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BA_SESSION; | |
7623 | ||
7624 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); | |
7625 | pBASessionInfo->u8Ted = TID; | |
7626 | pBASessionInfo->u16BufferSize = BufferSize; | |
7627 | pBASessionInfo->u16SessionTimeout = SessionTimeout; | |
7628 | strHostIFmsg.drvHandler = hWFIDrv; | |
7629 | ||
79198138 | 7630 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7631 | if (s32Error) |
24db713f | 7632 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
7633 | |
7634 | return s32Error; | |
7635 | } | |
7636 | ||
7637 | ||
218dc407 | 7638 | s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
c5c77ba1 | 7639 | { |
e6e12661 | 7640 | s32 s32Error = 0; |
c5c77ba1 JK |
7641 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7642 | tstrHostIFmsg strHostIFmsg; | |
7643 | tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; | |
7644 | ||
24db713f LK |
7645 | if (pstrWFIDrv == NULL) { |
7646 | PRINT_ER("driver is null\n"); | |
7647 | return -EFAULT; | |
7648 | } | |
c5c77ba1 | 7649 | |
2cc46837 | 7650 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7651 | |
7652 | /* prepare the WiphyParams Message */ | |
7653 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BA_SESSION; | |
7654 | ||
7655 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); | |
7656 | pBASessionInfo->u8Ted = TID; | |
7657 | strHostIFmsg.drvHandler = hWFIDrv; | |
7658 | ||
79198138 | 7659 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7660 | if (s32Error) |
24db713f | 7661 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
7662 | |
7663 | /*BugID_5222*/ | |
83383ea3 | 7664 | down(&hWaitResponse); |
c5c77ba1 JK |
7665 | |
7666 | return s32Error; | |
7667 | } | |
7668 | ||
218dc407 | 7669 | s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
c5c77ba1 | 7670 | { |
e6e12661 | 7671 | s32 s32Error = 0; |
c5c77ba1 JK |
7672 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7673 | tstrHostIFmsg strHostIFmsg; | |
7674 | tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; | |
7675 | ||
24db713f LK |
7676 | if (pstrWFIDrv == NULL) { |
7677 | PRINT_ER("driver is null\n"); | |
7678 | return -EFAULT; | |
7679 | } | |
c5c77ba1 | 7680 | |
2cc46837 | 7681 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7682 | |
7683 | /* prepare the WiphyParams Message */ | |
7684 | strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; | |
7685 | ||
7686 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); | |
7687 | pBASessionInfo->u8Ted = TID; | |
7688 | strHostIFmsg.drvHandler = hWFIDrv; | |
7689 | ||
79198138 | 7690 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7691 | if (s32Error) |
24db713f | 7692 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
7693 | |
7694 | /*BugID_5222*/ | |
83383ea3 | 7695 | down(&hWaitResponse); |
c5c77ba1 JK |
7696 | |
7697 | return s32Error; | |
7698 | } | |
7699 | ||
7700 | /** | |
7701 | * @brief host_int_setup_ipaddress | |
7702 | * @details setup IP in firmware | |
7703 | * @param[in] Handle to wifi driver | |
7704 | * @return Error code. | |
7705 | * @author Abdelrahman Sobhy | |
7706 | * @date | |
7707 | * @version 1.0*/ | |
218dc407 | 7708 | s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
c5c77ba1 | 7709 | { |
e6e12661 | 7710 | s32 s32Error = 0; |
c5c77ba1 JK |
7711 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7712 | tstrHostIFmsg strHostIFmsg; | |
7713 | ||
7714 | /* TODO: Enable This feature on softap firmware */ | |
7715 | return 0; | |
7716 | ||
24db713f LK |
7717 | if (pstrWFIDrv == NULL) { |
7718 | PRINT_ER("driver is null\n"); | |
7719 | return -EFAULT; | |
7720 | } | |
c5c77ba1 | 7721 | |
2cc46837 | 7722 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7723 | |
7724 | /* prepare the WiphyParams Message */ | |
7725 | strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_IPADDRESS; | |
7726 | ||
7727 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd; | |
7728 | strHostIFmsg.drvHandler = hWFIDrv; | |
7729 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; | |
7730 | ||
79198138 | 7731 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7732 | if (s32Error) |
24db713f | 7733 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
7734 | |
7735 | return s32Error; | |
7736 | ||
7737 | ||
7738 | } | |
7739 | ||
7740 | /** | |
7741 | * @brief host_int_get_ipaddress | |
7742 | * @details Get IP from firmware | |
7743 | * @param[in] Handle to wifi driver | |
7744 | * @return Error code. | |
7745 | * @author Abdelrahman Sobhy | |
7746 | * @date | |
7747 | * @version 1.0*/ | |
218dc407 | 7748 | s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
c5c77ba1 | 7749 | { |
e6e12661 | 7750 | s32 s32Error = 0; |
c5c77ba1 JK |
7751 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
7752 | tstrHostIFmsg strHostIFmsg; | |
7753 | ||
24db713f LK |
7754 | if (pstrWFIDrv == NULL) { |
7755 | PRINT_ER("driver is null\n"); | |
7756 | return -EFAULT; | |
7757 | } | |
c5c77ba1 | 7758 | |
2cc46837 | 7759 | memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); |
c5c77ba1 JK |
7760 | |
7761 | /* prepare the WiphyParams Message */ | |
7762 | strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_IPADDRESS; | |
7763 | ||
7764 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd; | |
bf903c1e SS |
7765 | strHostIFmsg.drvHandler = hWFIDrv; |
7766 | strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; | |
c5c77ba1 | 7767 | |
79198138 | 7768 | s32Error = wilc_mq_send(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); |
2b9d5b48 | 7769 | if (s32Error) |
24db713f | 7770 | PRINT_ER("wilc_mq_send fail\n"); |
c5c77ba1 JK |
7771 | |
7772 | return s32Error; | |
7773 | ||
7774 | ||
7775 | } |