staging: wilc1000: rename u8RemainOnChan_pendingreq of struct host_if_drv
[firefly-linux-kernel-4.4.55.git] / drivers / staging / wilc1000 / host_interface.h
1 /*!
2  *  @file       host_interface.h
3  *  @brief      File containg host interface APIs
4  *  @author     zsalah
5  *  @sa         host_interface.c
6  *  @date       8 March 2012
7  *  @version    1.0
8  */
9
10 #ifndef HOST_INT_H
11 #define HOST_INT_H
12
13 #include "coreconfigurator.h"
14
15 #define IP_ALEN  4
16
17 #define IDLE_MODE       0x00
18 #define AP_MODE         0x01
19 #define STATION_MODE    0x02
20 #define GO_MODE         0x03
21 #define CLIENT_MODE     0x04
22
23
24 #define MAX_NUM_STA                             9
25 #define ACTIVE_SCAN_TIME                        10
26 #define PASSIVE_SCAN_TIME                       1200
27 #define MIN_SCAN_TIME                           10
28 #define MAX_SCAN_TIME                           1200
29 #define DEFAULT_SCAN                            0
30 #define USER_SCAN                               BIT(0)
31 #define OBSS_PERIODIC_SCAN                      BIT(1)
32 #define OBSS_ONETIME_SCAN                       BIT(2)
33 #define GTK_RX_KEY_BUFF_LEN                     24
34 #define ADDKEY                                  0x1
35 #define REMOVEKEY                               0x2
36 #define DEFAULTKEY                              0x4
37 #define ADDKEY_AP                               0x8
38 #define MAX_NUM_SCANNED_NETWORKS                100
39 #define MAX_NUM_SCANNED_NETWORKS_SHADOW         130
40 #define MAX_NUM_PROBED_SSID                     10
41 #define CHANNEL_SCAN_TIME                       250
42
43 #define TX_MIC_KEY_LEN                          8
44 #define RX_MIC_KEY_LEN                          8
45 #define PTK_KEY_LEN                             16
46
47 #define TX_MIC_KEY_MSG_LEN                      26
48 #define RX_MIC_KEY_MSG_LEN                      48
49 #define PTK_KEY_MSG_LEN                         39
50
51 #define PMKSA_KEY_LEN                           22
52 #define ETH_ALEN                                6
53 #define PMKID_LEN                               16
54 #define WILC_MAX_NUM_PMKIDS                     16
55 #define WILC_SUPP_MCS_SET_SIZE                  16
56 #define WILC_ADD_STA_LENGTH                     40
57 #define SCAN_EVENT_DONE_ABORTED
58 #define NUM_CONCURRENT_IFC                      2
59
60 struct rf_info {
61         u8 u8LinkSpeed;
62         s8 s8RSSI;
63         u32 u32TxCount;
64         u32 u32RxCount;
65         u32 u32TxFailureCount;
66 };
67
68 enum host_if_state {
69         HOST_IF_IDLE                    = 0,
70         HOST_IF_SCANNING                = 1,
71         HOST_IF_CONNECTING              = 2,
72         HOST_IF_WAITING_CONN_RESP       = 3,
73         HOST_IF_CONNECTED               = 4,
74         HOST_IF_P2P_LISTEN              = 5,
75         HOST_IF_FORCE_32BIT             = 0xFFFFFFFF
76 };
77
78 struct host_if_pmkid {
79         u8 bssid[ETH_ALEN];
80         u8 pmkid[PMKID_LEN];
81 };
82
83 struct host_if_pmkid_attr {
84         u8 numpmkid;
85         struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
86 };
87
88 enum CURRENT_TXRATE {
89         AUTORATE        = 0,
90         MBPS_1          = 1,
91         MBPS_2          = 2,
92         MBPS_5_5        = 5,
93         MBPS_11         = 11,
94         MBPS_6          = 6,
95         MBPS_9          = 9,
96         MBPS_12         = 12,
97         MBPS_18         = 18,
98         MBPS_24         = 24,
99         MBPS_36         = 36,
100         MBPS_48         = 48,
101         MBPS_54         = 54
102 };
103
104 struct cfg_param_val {
105         u32 flag;
106         u8 ht_enable;
107         u8 bss_type;
108         u8 auth_type;
109         u16 auth_timeout;
110         u8 power_mgmt_mode;
111         u16 short_retry_limit;
112         u16 long_retry_limit;
113         u16 frag_threshold;
114         u16 rts_threshold;
115         u16 preamble_type;
116         u8 short_slot_allowed;
117         u8 txop_prot_disabled;
118         u16 beacon_interval;
119         u16 dtim_period;
120         enum SITESURVEY site_survey_enabled;
121         u16 site_survey_scan_time;
122         u8 scan_source;
123         u16 active_scan_time;
124         u16 passive_scan_time;
125         enum CURRENT_TXRATE curr_tx_rate;
126
127 };
128
129 enum cfg_param {
130         RETRY_SHORT             = BIT(0),
131         RETRY_LONG              = BIT(1),
132         FRAG_THRESHOLD          = BIT(2),
133         RTS_THRESHOLD           = BIT(3),
134         BSS_TYPE                = BIT(4),
135         AUTH_TYPE               = BIT(5),
136         AUTHEN_TIMEOUT          = BIT(6),
137         POWER_MANAGEMENT        = BIT(7),
138         PREAMBLE                = BIT(8),
139         SHORT_SLOT_ALLOWED      = BIT(9),
140         TXOP_PROT_DISABLE       = BIT(10),
141         BEACON_INTERVAL         = BIT(11),
142         DTIM_PERIOD             = BIT(12),
143         SITE_SURVEY             = BIT(13),
144         SITE_SURVEY_SCAN_TIME   = BIT(14),
145         ACTIVE_SCANTIME         = BIT(15),
146         PASSIVE_SCANTIME        = BIT(16),
147         CURRENT_TX_RATE         = BIT(17),
148         HT_ENABLE               = BIT(18),
149 };
150
151 struct found_net_info {
152         u8 au8bssid[6];
153         s8 s8rssi;
154 };
155
156 enum scan_event {
157         SCAN_EVENT_NETWORK_FOUND        = 0,
158         SCAN_EVENT_DONE                 = 1,
159         SCAN_EVENT_ABORTED              = 2,
160         SCAN_EVENT_FORCE_32BIT          = 0xFFFFFFFF
161 };
162
163 enum conn_event {
164         CONN_DISCONN_EVENT_CONN_RESP            = 0,
165         CONN_DISCONN_EVENT_DISCONN_NOTIF        = 1,
166         CONN_DISCONN_EVENT_FORCE_32BIT          = 0xFFFFFFFF
167 };
168
169 enum KEY_TYPE {
170         WEP,
171         WPARxGtk,
172         WPAPtk,
173         PMKSA,
174 };
175
176
177 /*Scan callBack function definition*/
178 typedef void (*wilc_scan_result)(enum scan_event, tstrNetworkInfo *,
179                                   void *, void *);
180
181 /*Connect callBack function definition*/
182 typedef void (*wilc_connect_result)(enum conn_event,
183                                      tstrConnectInfo *,
184                                      u8,
185                                      tstrDisconnectNotifInfo *,
186                                      void *);
187
188 typedef void (*wilc_remain_on_chan_expired)(void *, u32);  /*Remain on channel expiration callback function*/
189 typedef void (*wilc_remain_on_chan_ready)(void *); /*Remain on channel callback function*/
190
191 /*!
192  *  @struct             rcvd_net_info
193  *  @brief              Structure to hold Received Asynchronous Network info
194  *  @details
195  *  @todo
196  *  @sa
197  *  @author             Mostafa Abu Bakr
198  *  @date               25 March 2012
199  *  @version            1.0
200  */
201 struct rcvd_net_info {
202         u8 *buffer;
203         u32 len;
204 };
205
206 struct hidden_net_info {
207         u8  *pu8ssid;
208         u8 u8ssidlen;
209 };
210
211 struct hidden_network {
212         struct hidden_net_info *pstrHiddenNetworkInfo;
213         u8 u8ssidnum;
214 };
215
216 struct user_scan_req {
217         /* Scan user call back function */
218         wilc_scan_result pfUserScanResult;
219
220         /* User specific parameter to be delivered through the Scan User Callback function */
221         void *u32UserScanPvoid;
222
223         u32 u32RcvdChCount;
224         struct found_net_info astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS];
225 };
226
227 struct user_conn_req {
228         u8 *pu8bssid;
229         u8 *pu8ssid;
230         u8 u8security;
231         enum AUTHTYPE tenuAuth_type;
232         size_t ssidLen;
233         u8 *pu8ConnReqIEs;
234         size_t ConnReqIEsLen;
235         /* Connect user call back function */
236         wilc_connect_result pfUserConnectResult;
237         bool IsHTCapable;
238         /* User specific parameter to be delivered through the Connect User Callback function */
239         void *u32UserConnectPvoid;
240 };
241
242 struct drv_handler {
243         u32 handler;
244 };
245
246 struct op_mode {
247         u32 mode;
248 };
249
250 struct set_mac_addr {
251         u8 mac_addr[ETH_ALEN];
252 };
253
254 struct get_mac_addr {
255         u8 *mac_addr;
256 };
257
258 struct ba_session_info {
259         u8 au8Bssid[ETH_ALEN];
260         u8 u8Ted;
261         u16 u16BufferSize;
262         u16 u16SessionTimeout;
263 };
264
265 struct remain_ch {
266         u16 u16Channel;
267         u32 u32duration;
268         wilc_remain_on_chan_expired pRemainOnChanExpired;
269         wilc_remain_on_chan_ready pRemainOnChanReady;
270         void *pVoid;
271         u32 u32ListenSessionID;
272 };
273
274 struct reg_frame {
275         bool bReg;
276         u16 u16FrameType;
277         u8 u8Regid;
278 };
279
280
281 #define ACTION                  0xD0
282 #define PROBE_REQ               0x40
283 #define PROBE_RESP              0x50
284 #define ACTION_FRM_IDX          0
285 #define PROBE_REQ_IDX           1
286
287
288 enum p2p_listen_state {
289         P2P_IDLE,
290         P2P_LISTEN,
291         P2P_GRP_FORMATION
292 };
293
294 struct host_if_drv {
295         struct user_scan_req usr_scan_req;
296         struct user_conn_req usr_conn_req;
297         struct remain_ch remain_on_ch;
298         u8 remain_on_ch_pending;
299         u64 u64P2p_MgmtTimeout;
300         u8 u8P2PConnect;
301
302         enum host_if_state enuHostIFstate;
303
304         u8 au8AssociatedBSSID[ETH_ALEN];
305         struct cfg_param_val strCfgValues;
306 /* semaphores */
307         struct semaphore gtOsCfgValuesSem;
308         struct semaphore hSemTestKeyBlock;
309
310         struct semaphore hSemTestDisconnectBlock;
311         struct semaphore hSemGetRSSI;
312         struct semaphore hSemGetLINKSPEED;
313         struct semaphore hSemGetCHNL;
314         struct semaphore hSemInactiveTime;
315 /* timer handlers */
316         struct timer_list hScanTimer;
317         struct timer_list hConnectTimer;
318         struct timer_list hRemainOnChannel;
319
320         bool IFC_UP;
321 };
322
323 struct add_sta_param {
324         u8 au8BSSID[ETH_ALEN];
325         u16 u16AssocID;
326         u8 u8NumRates;
327         const u8 *pu8Rates;
328         bool bIsHTSupported;
329         u16 u16HTCapInfo;
330         u8 u8AmpduParams;
331         u8 au8SuppMCsSet[16];
332         u16 u16HTExtParams;
333         u32 u32TxBeamformingCap;
334         u8 u8ASELCap;
335         u16 u16FlagsMask;               /*<! Determines which of u16FlagsSet were changed>*/
336         u16 u16FlagsSet;                /*<! Decoded according to tenuWILC_StaFlag */
337 };
338
339 /*****************************************************************************/
340 /*                                                                                                                                                       */
341 /*                                                      Host Interface API                                                               */
342 /*                                                                                                                                                       */
343 /*****************************************************************************/
344
345 /**
346  *  @brief              removes wpa/wpa2 keys
347  *  @details    only in BSS STA mode if External Supplicant support is enabled.
348  *                              removes all WPA/WPA2 station key entries from MAC hardware.
349  *  @param[in,out] handle to the wifi driver
350  *  @param[in]  6 bytes of Station Adress in the station entry table
351  *  @return             Error code indicating success/failure
352  *  @note
353  *  @author             zsalah
354  *  @date               8 March 2012
355  *  @version            1.0
356  */
357 s32 host_int_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
358 /**
359  *  @brief              removes WEP key
360  *  @details    valid only in BSS STA mode if External Supplicant support is enabled.
361  *                              remove a WEP key entry from MAC HW.
362  *                              The BSS Station automatically finds the index of the entry using its
363  *                              BSS ID and removes that entry from the MAC hardware.
364  *  @param[in,out] handle to the wifi driver
365  *  @param[in]  6 bytes of Station Adress in the station entry table
366  *  @return             Error code indicating success/failure
367  *  @note               NO need for the STA add since it is not used for processing
368  *  @author             zsalah
369  *  @date               8 March 2012
370  *  @version            1.0
371  */
372 int host_int_remove_wep_key(struct host_if_drv *wfi_drv, u8 index);
373 /**
374  *  @brief              sets WEP deafault key
375  *  @details    Sets the index of the WEP encryption key in use,
376  *                              in the key table
377  *  @param[in,out] handle to the wifi driver
378  *  @param[in]  key index ( 0, 1, 2, 3)
379  *  @return             Error code indicating success/failure
380  *  @note
381  *  @author             zsalah
382  *  @date               8 March 2012
383  *  @version            1.0
384  */
385 int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index);
386
387 /**
388  *  @brief              sets WEP deafault key
389  *  @details    valid only in BSS STA mode if External Supplicant support is enabled.
390  *                              sets WEP key entry into MAC hardware when it receives the
391  *                              corresponding request from NDIS.
392  *  @param[in,out] handle to the wifi driver
393  *  @param[in]  message containing WEP Key in the following format
394  *|---------------------------------------|
395  *|Key ID Value | Key Length |  Key             |
396  *|-------------|------------|------------|
397  |      1byte     |             1byte  | Key Length     |
398  ||---------------------------------------|
399  |
400  *  @return             Error code indicating success/failure
401  *  @note
402  *  @author             zsalah
403  *  @date               8 March 2012
404  *  @version            1.0
405  */
406 s32 host_int_add_wep_key_bss_sta(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx);
407 /**
408  *  @brief              host_int_add_wep_key_bss_ap
409  *  @details    valid only in AP mode if External Supplicant support is enabled.
410  *                              sets WEP key entry into MAC hardware when it receives the
411  *                              corresponding request from NDIS.
412  *  @param[in,out] handle to the wifi driver
413  *
414  *
415  *  @return             Error code indicating success/failure
416  *  @note
417  *  @author             mdaftedar
418  *  @date               28 Feb 2013
419  *  @version            1.0
420  */
421 s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type);
422
423 /**
424  *  @brief              adds ptk Key
425  *  @details
426  *  @param[in,out] handle to the wifi driver
427  *  @param[in]  message containing PTK Key in the following format
428  *|-------------------------------------------------------------------------|
429  *|Sta Adress | Key Length |    Temporal Key | Rx Michael Key |Tx Michael Key |
430  *|-----------|------------|---------------|----------------|---------------|
431  |      6 bytes |       1byte    |   16 bytes    |        8 bytes         |        8 bytes        |
432  ||-------------------------------------------------------------------------|
433  *  @return             Error code indicating success/failure
434  *  @note
435  *  @author             zsalah
436  *  @date               8 March 2012
437  *  @version            1.0
438  */
439 s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen,
440                              const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx);
441
442 /**
443  *  @brief              host_int_get_inactive_time
444  *  @details
445  *  @param[in,out] handle to the wifi driver
446  *  @param[in]  message containing inactive time
447  *
448  *  @return             Error code indicating success/failure
449  *  @note
450  *  @author             mdaftedar
451  *  @date               15 April 2013
452  *  @version            1.0
453  */
454 s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime);
455
456 /**
457  *  @brief              adds Rx GTk Key
458  *  @details
459  *  @param[in,out] handle to the wifi driver
460  *  @param[in]  message containing Rx GTK Key in the following format
461  *|----------------------------------------------------------------------------|
462  *|Sta Address | Key RSC | KeyID | Key Length | Temporal Key    | Rx Michael Key |
463  *|------------|---------|-------|------------|---------------|----------------|
464  |      6 bytes  | 8 byte  |1 byte |  1 byte    |   16 bytes    |         8 bytes        |
465  ||----------------------------------------------------------------------------|
466  *  @return             Error code indicating success/failure
467  *  @note
468  *  @author             zsalah
469  *  @date               8 March 2012
470  *  @version            1.0
471  */
472 s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen,
473                                 u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC,
474                                 const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode);
475
476
477 /**
478  *  @brief              adds Tx GTk Key
479  *  @details
480  *  @param[in,out] handle to the wifi driver
481  *  @param[in]  message containing Tx GTK Key in the following format
482  *|----------------------------------------------------|
483  | KeyID | Key Length | Temporal Key    | Tx Michael Key |
484  ||-------|------------|--------------|----------------|
485  ||1 byte |  1 byte      |   16 bytes   |         8 bytes        |
486  ||----------------------------------------------------|
487  *  @return             Error code indicating success/failure
488  *  @note
489  *  @author             zsalah
490  *  @date               8 March 2012
491  *  @version            1.0
492  */
493 s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx);
494
495 /**
496  *  @brief              caches the pmkid
497  *  @details    valid only in BSS STA mode if External Supplicant
498  *                              support is enabled. This Function sets the PMKID in firmware
499  *                              when host drivr receives the corresponding request from NDIS.
500  *                              The firmware then includes theset PMKID in the appropriate
501  *                              management frames
502  *  @param[in,out] handle to the wifi driver
503  *  @param[in]  message containing PMKID Info in the following format
504  *|-----------------------------------------------------------------|
505  *|NumEntries | BSSID[1] | PMKID[1] |  ...      | BSSID[K] | PMKID[K] |
506  *|-----------|------------|----------|-------|----------|----------|
507  |         1    |               6        |   16         |  ...  |        6         |    16        |
508  ||-----------------------------------------------------------------|
509  *  @return             Error code indicating success/failure
510  *  @note
511  *  @author             zsalah
512  *  @date               8 March 2012
513  *  @version            1.0
514  */
515
516 s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray);
517 /**
518  *  @brief              gets the cached the pmkid info
519  *  @details    valid only in BSS STA mode if External Supplicant
520  *                              support is enabled. This Function sets the PMKID in firmware
521  *                              when host drivr receives the corresponding request from NDIS.
522  *                              The firmware then includes theset PMKID in the appropriate
523  *                              management frames
524  *  @param[in,out] handle to the wifi driver,
525  *
526  *                                message containing PMKID Info in the following format
527  *|-----------------------------------------------------------------|
528  *|NumEntries | BSSID[1] | PMKID[1] |  ...      | BSSID[K] | PMKID[K] |
529  *|-----------|------------|----------|-------|----------|----------|
530  |         1    |               6        |   16         |  ...  |        6         |    16        |
531  ||-----------------------------------------------------------------|
532  *  @param[in]
533  *  @return             Error code indicating success/failure
534  *  @note
535  *  @author             zsalah
536  *  @date               8 March 2012
537  *  @version            1.0
538  */
539
540 s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray,
541                                     u32 u32PmkidInfoLen);
542
543 /**
544  *  @brief              sets the pass phrase
545  *  @details    AP/STA mode. This function gives the pass phrase used to
546  *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
547  *                              The length of the field can vary from 8 to 64 bytes,
548  *                              the lower layer should get the
549  *  @param[in,out] handle to the wifi driver,
550  *  @param[in]   String containing PSK
551  *  @return             Error code indicating success/failure
552  *  @note
553  *  @author             zsalah
554  *  @date               8 March 2012
555  *  @version            1.0
556  */
557 s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase,
558                                                  u8 u8Psklength);
559 /**
560  *  @brief              gets the pass phrase
561  *  @details    AP/STA mode. This function gets the pass phrase used to
562  *                              generate the Pre-Shared Key when WPA/WPA2 is enabled
563  *                              The length of the field can vary from 8 to 64 bytes,
564  *                              the lower layer should get the
565  *  @param[in,out] handle to the wifi driver,
566  *                                String containing PSK
567  *  @return             Error code indicating success/failure
568  *  @note
569  *  @author             zsalah
570  *  @date               8 March 2012
571  *  @version            1.0
572  */
573 s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv,
574                                                  u8 *pu8PassPhrase, u8 u8Psklength);
575
576 /**
577  *  @brief              gets mac address
578  *  @details
579  *  @param[in,out] handle to the wifi driver,
580  *
581  *  @return             Error code indicating success/failure
582  *  @note
583  *  @author             mdaftedar
584  *  @date               19 April 2012
585  *  @version            1.0
586  */
587 s32 host_int_get_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
588
589 /**
590  *  @brief              sets mac address
591  *  @details
592  *  @param[in,out] handle to the wifi driver,
593  *
594  *  @return             Error code indicating success/failure
595  *  @note
596  *  @author             mabubakr
597  *  @date               16 July 2012
598  *  @version            1.0
599  */
600 s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress);
601
602 /**
603  *  @brief              wait until msg q is empty
604  *  @details
605  *  @param[in,out]
606  *
607  *  @return             Error code indicating success/failure
608  *  @note
609  *  @author             asobhy
610  *  @date               19 march 2014
611  *  @version            1.0
612  */
613 int host_int_wait_msg_queue_idle(void);
614
615 /**
616  *  @brief              sets a start scan request
617  *  @details
618  *  @param[in,out] handle to the wifi driver,
619  *  @param[in]  Scan Source one of the following values
620  *                              DEFAULT_SCAN        0
621  *                              USER_SCAN           BIT0
622  *                              OBSS_PERIODIC_SCAN  BIT1
623  *                              OBSS_ONETIME_SCAN   BIT2
624  *  @return             Error code indicating success/failure
625  *  @note
626  *  @author             zsalah
627  *  @date               8 March 2012
628  *  @version            1.0
629  */
630
631 s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource);
632 /**
633  *  @brief              gets scan source of the last scan
634  *  @details
635  *  @param[in,out] handle to the wifi driver,
636  *                              Scan Source one of the following values
637  *                              DEFAULT_SCAN        0
638  *                              USER_SCAN           BIT0
639  *                              OBSS_PERIODIC_SCAN  BIT1
640  *                              OBSS_ONETIME_SCAN   BIT2
641  *  @return             Error code indicating success/failure
642  *  @note
643  *  @author             zsalah
644  *  @date               8 March 2012
645  *  @version            1.0
646  */
647 s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource);
648
649 /**
650  *  @brief              sets a join request
651  *  @details
652  *  @param[in,out] handle to the wifi driver,
653  *  @param[in]  Index of the bss descriptor
654  *  @return             Error code indicating success/failure
655  *  @note
656  *  @author             zsalah
657  *  @date               8 March 2012
658  *  @version            1.0
659  */
660
661 s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid,
662                                   const u8 *pu8ssid, size_t ssidLen,
663                                   const u8 *pu8IEs, size_t IEsLen,
664                                   wilc_connect_result pfConnectResult, void *pvUserArg,
665                                   u8 u8security, enum AUTHTYPE tenuAuth_type,
666                                   u8 u8channel,
667                                   void *pJoinParams);
668
669 /**
670  *  @brief              Flush a join request parameters to FW, but actual connection
671  *  @details    The function is called in situation where WILC is connected to AP and
672  *                      required to switch to hybrid FW for P2P connection
673  *  @param[in] handle to the wifi driver,
674  *  @return             Error code indicating success/failure
675  *  @note
676  *  @author             Amr Abdel-Moghny
677  *  @date               19 DEC 2013
678  *  @version            8.0
679  */
680
681 s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv);
682
683
684 /**
685  *  @brief              disconnects from the currently associated network
686  *  @details
687  *  @param[in,out] handle to the wifi driver,
688  *  @param[in]  Reason Code of the Disconnection
689  *  @return             Error code indicating success/failure
690  *  @note
691  *  @author             zsalah
692  *  @date               8 March 2012
693  *  @version            1.0
694  */
695 s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode);
696
697 /**
698  *  @brief              disconnects a sta
699  *  @details
700  *  @param[in,out] handle to the wifi driver,
701  *  @param[in]  Association Id of the station to be disconnected
702  *  @return             Error code indicating success/failure
703  *  @note
704  *  @author             zsalah
705  *  @date               8 March 2012
706  *  @version            1.0
707  */
708 s32 host_int_disconnect_station(struct host_if_drv *hWFIDrv, u8 assoc_id);
709 /**
710  *  @brief              gets a Association request info
711  *  @details
712  *  @param[in,out] handle to the wifi driver,
713  *                              Message containg assoc. req info in the following format
714  * ------------------------------------------------------------------------
715  |                        Management Frame Format                    |
716  ||-------------------------------------------------------------------|
717  ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS |
718  ||-------------|--------|--|--|-----|----------------|----------|----|
719  | 2           |2       |6 |6 |6    |           2       |0 - 2312  | 4  |
720  ||-------------------------------------------------------------------|
721  |                                                                   |
722  |             Association Request Frame - Frame Body                |
723  ||-------------------------------------------------------------------|
724  | Capability Information | Listen Interval | SSID | Supported Rates |
725  ||------------------------|-----------------|------|-----------------|
726  |                      2            |           2         | 2-34 |             3-10        |
727  | ---------------------------------------------------------------------
728  *  @return             Error code indicating success/failure
729  *  @note
730  *  @author             zsalah
731  *  @date               8 March 2012
732  *  @version            1.0
733  */
734
735 s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo,
736                                         u32 u32AssocReqInfoLen);
737 /**
738  *  @brief              gets a Association Response info
739  *  @details
740  *  @param[in,out] handle to the wifi driver,
741  *                              Message containg assoc. resp info
742  *  @return             Error code indicating success/failure
743  *  @note
744  *  @author             zsalah
745  *  @date               8 March 2012
746  *  @version            1.0
747  */
748
749 s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo,
750                                         u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen);
751 /**
752  *  @brief              gets a Association Response info
753  *  @details    Valid only in STA mode. This function gives the RSSI
754  *                              values observed in all the channels at the time of scanning.
755  *                              The length of the field is 1 greater that the total number of
756  *                              channels supported. Byte 0 contains the number of channels while
757  *                              each of Byte N contains the observed RSSI value for the channel index N.
758  *  @param[in,out] handle to the wifi driver,
759  *                              array of scanned channels' RSSI
760  *  @return             Error code indicating success/failure
761  *  @note
762  *  @author             zsalah
763  *  @date               8 March 2012
764  *  @version            1.0
765  */
766 s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, u8 *pu8RxPowerLevel,
767                                         u32 u32RxPowerLevelLen);
768
769 /**
770  *  @brief              sets a channel
771  *  @details
772  *  @param[in,out] handle to the wifi driver,
773  *  @param[in]  Index of the channel to be set
774  *|-------------------------------------------------------------------|
775  |          CHANNEL1      CHANNEL2 ....                      CHANNEL14  |
776  |  Input:         1             2                                                  14  |
777  ||-------------------------------------------------------------------|
778  *  @return             Error code indicating success/failure
779  *  @note
780  *  @author             zsalah
781  *  @date               8 March 2012
782  *  @version            1.0
783  */
784 int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel);
785
786 /**
787  *  @brief              gets the current channel index
788  *  @details
789  *  @param[in,out] handle to the wifi driver,
790  *                              current channel index
791  *|-----------------------------------------------------------------------|
792  |          CHANNEL1      CHANNEL2 ....                     CHANNEL14   |
793  |  Input:         1             2                                 14   |
794  ||-----------------------------------------------------------------------|
795  *  @return             Error code indicating success/failure
796  *  @note
797  *  @author             zsalah
798  *  @date               8 March 2012
799  *  @version            1.0
800  */
801 s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo);
802 /**
803  *  @brief              gets the sta rssi
804  *  @details    gets the currently maintained RSSI value for the station.
805  *                              The received signal strength value in dB.
806  *                              The range of valid values is -128 to 0.
807  *  @param[in,out] handle to the wifi driver,
808  *                              rssi value in dB
809  *  @return             Error code indicating success/failure
810  *  @note
811  *  @author             zsalah
812  *  @date               8 March 2012
813  *  @version            1.0
814  */
815 s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi);
816 s32 host_int_get_link_speed(struct host_if_drv *hWFIDrv, s8 *ps8lnkspd);
817 /**
818  *  @brief              scans a set of channels
819  *  @details
820  *  @param[in,out] handle to the wifi driver,
821  *  @param[in]          Scan source
822  *                              Scan Type       PASSIVE_SCAN = 0,
823  *                                                      ACTIVE_SCAN  = 1
824  *                              Channels Array
825  *                              Channels Array length
826  *                              Scan Callback function
827  *                              User Argument to be delivered back through the Scan Cllback function
828  *  @return             Error code indicating success/failure
829  *  @note
830  *  @author             zsalah
831  *  @date               8 March 2012
832  *  @version            1.0
833  */
834 s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource,
835                           u8 u8ScanType, u8 *pu8ChnlFreqList,
836                           u8 u8ChnlListLen, const u8 *pu8IEs,
837                           size_t IEsLen, wilc_scan_result ScanResult,
838                           void *pvUserArg,
839                           struct hidden_network *pstrHiddenNetwork);
840 /**
841  *  @brief              sets configuration wids values
842  *  @details
843  *  @param[in,out] handle to the wifi driver,
844  *  @param[in]  WID, WID value
845  *  @return             Error code indicating success/failure
846  *  @note
847  *  @author             zsalah
848  *  @date               8 March 2012
849  *  @version            1.0
850  */
851 s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal);
852
853 /**
854  *  @brief              gets configuration wids values
855  *  @details
856  *  @param[in,out] handle to the wifi driver,
857  *                              WID value
858  *  @param[in]  WID,
859  *  @return             Error code indicating success/failure
860  *  @note
861  *  @author             zsalah
862  *  @date               8 March 2012
863  *  @version            1.0
864  */
865 s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value);
866 /*****************************************************************************/
867 /*                                                      Notification Functions                                                   */
868 /*****************************************************************************/
869 /**
870  *  @brief              host interface initialization function
871  *  @details
872  *  @param[in,out] handle to the wifi driver,
873  *  @note
874  *  @author             zsalah
875  *  @date               8 March 2012
876  *  @version            1.0
877  */
878 s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv);
879
880 /**
881  *  @brief              host interface initialization function
882  *  @details
883  *  @param[in,out] handle to the wifi driver,
884  *  @note
885  *  @author             zsalah
886  *  @date               8 March 2012
887  *  @version            1.0
888  */
889 s32 host_int_deinit(struct host_if_drv *hWFIDrv);
890
891
892 /*!
893  *  @fn         s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv,u8 u8Index)
894  *  @brief              Sends a beacon to the firmware to be transmitted over the air
895  *  @details
896  *  @param[in,out]      hWFIDrv         handle to the wifi driver
897  *  @param[in]  u32Interval     Beacon Interval. Period between two successive beacons on air
898  *  @param[in]  u32DTIMPeriod DTIM Period. Indicates how many Beacon frames
899  *              (including the current frame) appear before the next DTIM
900  *  @param[in]  u32Headlen      Length of the head buffer in bytes
901  *  @param[in]  pu8Head         Pointer to the beacon's head buffer. Beacon's head
902  *              is the part from the beacon's start till the TIM element, NOT including the TIM
903  *  @param[in]  u32Taillen      Length of the tail buffer in bytes
904  *  @param[in]  pu8Tail         Pointer to the beacon's tail buffer. Beacon's tail
905  *              starts just after the TIM inormation element
906  *  @return     0 for Success, error otherwise
907  *  @todo
908  *  @sa
909  *  @author             Adham Abozaeid
910  *  @date               10 Julys 2012
911  *  @version            1.0 Description
912  *
913  */
914 s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval,
915                                 u32 u32DTIMPeriod,
916                                 u32 u32HeadLen, u8 *pu8Head,
917                                 u32 u32TailLen, u8 *pu8tail);
918
919
920 /*!
921  *  @fn         s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv)
922  *  @brief              Removes the beacon and stops trawilctting it over the air
923  *  @details
924  *  @param[in,out]      hWFIDrv         handle to the wifi driver
925  *  @return     0 for Success, error otherwise
926  *  @todo
927  *  @sa
928  *  @author             Adham Abozaeid
929  *  @date               10 Julys 2012
930  *  @version            1.0 Description
931  */
932 s32 host_int_del_beacon(struct host_if_drv *hWFIDrv);
933
934 /*!
935  *  @fn         s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv,
936  *                                       struct add_sta_param *pstrStaParams)
937  *  @brief              Notifies the firmware with a new associated stations
938  *  @details
939  *  @param[in,out]      hWFIDrv         handle to the wifi driver
940  *  @param[in]  pstrStaParams   Station's parameters
941  *  @return     0 for Success, error otherwise
942  *  @todo
943  *  @sa
944  *  @author             Adham Abozaeid
945  *  @date               12 July 2012
946  *  @version            1.0 Description
947  */
948 s32 host_int_add_station(struct host_if_drv *hWFIDrv,
949                          struct add_sta_param *pstrStaParams);
950
951 /*!
952  *  @fn         s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr)
953  *  @brief              Deauthenticates clients when group is terminating
954  *  @details
955  *  @param[in,out]      hWFIDrv         handle to the wifi driver
956  *  @param[in]  pu8MacAddr      Station's mac address
957  *  @return     0 for Success, error otherwise
958  *  @todo
959  *  @sa
960  *  @author             Mai Daftedar
961  *  @date               09 April 2014
962  *  @version            1.0 Description
963  */
964 s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]);
965
966 /*!
967  *  @fn         s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr)
968  *  @brief              Notifies the firmware with a new deleted station
969  *  @details
970  *  @param[in,out]      hWFIDrv         handle to the wifi driver
971  *  @param[in]  pu8MacAddr      Station's mac address
972  *  @return     0 for Success, error otherwise
973  *  @todo
974  *  @sa
975  *  @author             Adham Abozaeid
976  *  @date               15 July 2012
977  *  @version            1.0 Description
978  */
979 s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr);
980
981 /*!
982  *  @fn         s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv,
983  *                                        struct add_sta_param *pstrStaParams)
984  *  @brief              Notifies the firmware with new parameters of an already associated station
985  *  @details
986  *  @param[in,out]      hWFIDrv         handle to the wifi driver
987  *  @param[in]  pstrStaParams   Station's parameters
988  *  @return     0 for Success, error otherwise
989  *  @todo
990  *  @sa
991  *  @author             Adham Abozaeid
992  *  @date               15 July 2012
993  *  @version            1.0 Description
994  */
995 s32 host_int_edit_station(struct host_if_drv *hWFIDrv,
996                           struct add_sta_param *pstrStaParams);
997
998 /*!
999  *  @fn         s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout)
1000  *  @brief              Set the power management mode to enabled or disabled
1001  *  @details
1002  *  @param[in,out]      hWFIDrv         handle to the wifi driver
1003  *  @param[in]  bIsEnabled      TRUE if enabled, FALSE otherwise
1004  *  @param[in]  u32Timeout      A timeout value of -1 allows the driver to adjust
1005  *                                                      the dynamic ps timeout value
1006  *  @return     0 for Success, error otherwise
1007  *  @todo
1008  *  @sa
1009  *  @author             Adham Abozaeid
1010  *  @date               24 November 2012
1011  *  @version            1.0 Description
1012  */
1013 s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32Timeout);
1014 /*  @param[in,out]      hWFIDrv         handle to the wifi driver
1015  *  @param[in]  bIsEnabled      TRUE if enabled, FALSE otherwise
1016  *  @param[in]  u8count         count of mac address entries in the filter table
1017  *
1018  *  @return     0 for Success, error otherwise
1019  *  @todo
1020  *  @sa
1021  *  @author             Adham Abozaeid
1022  *  @date               24 November 2012
1023  *  @version            1.0 Description
1024  */
1025 s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32count);
1026 /**
1027  *  @brief           host_int_setup_ipaddress
1028  *  @details       set IP address on firmware
1029  *  @param[in]
1030  *  @return         Error code.
1031  *  @author             Abdelrahman Sobhy
1032  *  @date
1033  *  @version    1.0
1034  */
1035 s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
1036
1037
1038 /**
1039  *  @brief           host_int_delBASession
1040  *  @details       Delete single Rx BA session
1041  *  @param[in]
1042  *  @return         Error code.
1043  *  @author             Abdelrahman Sobhy
1044  *  @date
1045  *  @version    1.0
1046  */
1047 s32 host_int_delBASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
1048
1049 /**
1050  *  @brief           host_int_delBASession
1051  *  @details       Delete all Rx BA session
1052  *  @param[in]
1053  *  @return         Error code.
1054  *  @author             Abdelrahman Sobhy
1055  *  @date
1056  *  @version    1.0
1057  */
1058 s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID);
1059
1060
1061 /**
1062  *  @brief           host_int_get_ipaddress
1063  *  @details       get IP address on firmware
1064  *  @param[in]
1065  *  @return         Error code.
1066  *  @author             Abdelrahman Sobhy
1067  *  @date
1068  *  @version    1.0
1069  */
1070 s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx);
1071
1072 /**
1073  *  @brief           host_int_remain_on_channel
1074  *  @details
1075  *  @param[in]
1076  *  @return         Error code.
1077  *  @author
1078  *  @date
1079  *  @version    1.0
1080  */
1081 s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg);
1082
1083 /**
1084  *  @brief              host_int_ListenStateExpired
1085  *  @details
1086  *  @param[in]          Handle to wifi driver
1087  *                              Duration to remain on channel
1088  *                              Channel to remain on
1089  *                              Pointer to fn to be called on receive frames in listen state
1090  *                              Pointer to remain-on-channel expired fn
1091  *                              Priv
1092  *  @return             Error code.
1093  *  @author
1094  *  @date
1095  *  @version            1.0
1096  */
1097 s32 host_int_ListenStateExpired(struct host_if_drv *hWFIDrv, u32 u32SessionID);
1098
1099 /**
1100  *  @brief           host_int_frame_register
1101  *  @details
1102  *  @param[in]
1103  *  @return         Error code.
1104  *  @author
1105  *  @date
1106  *  @version    1.0
1107  */
1108 s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool bReg);
1109 /**
1110  *  @brief           host_int_set_wfi_drv_handler
1111  *  @details
1112  *  @param[in]
1113  *  @return         Error code.
1114  *  @author
1115  *  @date
1116  *  @version    1.0
1117  */
1118 int host_int_set_wfi_drv_handler(struct host_if_drv *address);
1119 int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode);
1120
1121 static s32 Handle_ScanDone(struct host_if_drv *drvHandler, enum scan_event enuEvent);
1122
1123 void host_int_freeJoinParams(void *pJoinParams);
1124
1125 s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics);
1126
1127 #endif