]> Pileus Git - ~andy/linux/blob - drivers/staging/csr/unifi_priv.h
Merge tag 'fbdev-updates-for-3.6' of git://github.com/schandinat/linux-2.6
[~andy/linux] / drivers / staging / csr / unifi_priv.h
1 /*
2  *****************************************************************************
3  *
4  * FILE : unifi_priv.h
5  *
6  * PURPOSE : Private header file for unifi driver.
7  *
8  *           UDI = UniFi Debug Interface
9  *
10  * Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd.
11  *
12  * Refer to LICENSE.txt included with this source code for details on
13  * the license terms.
14  *
15  *****************************************************************************
16  */
17 #ifndef __LINUX_UNIFI_PRIV_H__
18 #define __LINUX_UNIFI_PRIV_H__ 1
19
20 #include <linux/version.h>
21 #include <linux/module.h>
22 #include <linux/string.h>
23 #include <linux/errno.h>
24 #include <linux/kernel.h>
25 #include <linux/wait.h>
26 #include <linux/sched.h>
27 #include <linux/delay.h>
28 #include <linux/netdevice.h>
29 #include <linux/wireless.h>
30 #include <linux/cdev.h>
31 #include <linux/kthread.h>
32 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19)
33 #include <linux/freezer.h>
34 #endif
35
36 #ifdef CSR_WIFI_SUPPORT_MMC_DRIVER
37 #include <linux/mmc/core.h>
38 #include <linux/mmc/card.h>
39 #include <linux/mmc/host.h>
40 #include <linux/mmc/sdio_func.h>
41 #include <linux/mmc/sdio_ids.h>
42 #include <linux/mmc/sdio.h>
43 #endif /* CSR_WIFI_SUPPORT_MMC_DRIVER */
44
45 #include <linux/fs.h>
46
47 #ifdef ANDROID_BUILD
48 #include <linux/wakelock.h>
49 #endif
50
51 #include "csr_wifi_hip_unifi.h"
52 #include "csr_wifi_hip_unifi_udi.h"
53 #include "csr_wifi_router_lib.h"
54 #include "unifiio.h"
55 #ifndef CSR_WIFI_HIP_TA_DISABLE
56 #include "csr_wifi_vif_utils.h"
57 #endif
58
59 /* Define the unifi_priv_t before include the unifi_native.h */
60 struct unifi_priv;
61 typedef struct unifi_priv unifi_priv_t;
62 #ifdef CSR_SUPPORT_WEXT_AP
63 struct CsrWifiSmeApConfig;
64 typedef struct CsrWifiSmeApConfig CsrWifiSmeApConfig_t;
65 #endif
66 #ifdef CSR_SUPPORT_WEXT
67 #include "unifi_wext.h"
68 #endif
69
70 #ifdef ANDROID_BUILD
71 extern struct wake_lock unifi_sdio_wake_lock;
72 #endif
73
74 #include "unifi_clients.h"
75
76
77 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
78 #include <linux/workqueue.h>
79
80 #undef INIT_WORK
81 #define INIT_WORK(_work, _func)                                         \
82     do {                                                                \
83         INIT_LIST_HEAD(&(_work)->entry);                                \
84         (_work)->pending = 0;                                           \
85         PREPARE_WORK((_work), (_func), (_work));                        \
86         init_timer(&(_work)->timer);                                    \
87     } while(0)
88
89 #endif  /* Linux kernel < 2.6.20 */
90
91
92 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
93 #define UF_NETIF_TX_WAKE_ALL_QUEUES(_netdev)    netif_tx_wake_all_queues(_netdev)
94 #define UF_NETIF_TX_START_ALL_QUEUES(_netdev)   netif_tx_start_all_queues(_netdev)
95 #define UF_NETIF_TX_STOP_ALL_QUEUES(_netdev)    netif_tx_stop_all_queues(_netdev)
96 #else
97 #define UF_NETIF_TX_WAKE_ALL_QUEUES(_netdev)    netif_wake_queue(_netdev)
98 #define UF_NETIF_TX_START_ALL_QUEUES(_netdev)   netif_start_queue(_netdev)
99 #define UF_NETIF_TX_STOP_ALL_QUEUES(_netdev)    netif_stop_queue(_netdev)
100 #endif  /* Linux kernel >= 2.6.27 */
101
102
103 #ifdef CSR_NATIVE_LINUX
104 #include "sme_native/unifi_native.h"
105 #else
106 #include "unifi_sme.h"
107 #endif
108
109 /* The device major number to use when registering the udi driver */
110 #define UNIFI_NAME      "unifi"
111 /*
112  * MAX_UNIFI_DEVS defines the maximum number of UniFi devices that can be present.
113  * This number should be set to the number of SDIO slots supported by the SDIO
114  * host controller on the platform.
115  * Note: If MAX_UNIFI_DEVS value changes, fw_init[] needs to be corrected in drv.c
116  */
117 #define MAX_UNIFI_DEVS  2
118
119 /* 802.11 Mac header offsets */
120 #define MAC_HEADER_SIZE  24
121 #define QOS_CONTROL_HEADER_SIZE 2
122 #define HT_CONTROL_HEADER_SIZE  4
123 #define QOS_DATA 0x8
124 #define QOS_DATA_NULL 0xc
125 #define DATA_NULL 0x04
126 #define FRAME_CONTROL_ORDER_BIT 0x8000
127 #define FRAME_CONTROL_TYPE_FIELD_OFFSET  2
128 #define FRAME_CONTROL_SUBTYPE_FIELD_OFFSET  4
129 #define IEEE802_11_FRAMETYPE_DATA 0x02
130 #define IEEE802_11_FRAMETYPE_CONTROL 0x01
131 #define IEEE802_11_FRAMETYPE_MANAGEMENT 0x00
132 #define IEEE802_11_FRAMETYPE_RESERVED 0x03
133
134 /* octet offset from start of mac header for certain fields */
135 #define IEEE802_11_ADDR3_OFFSET 16
136 #define IEEE802_11_SEQUENCE_CONTROL_OFFSET 22
137 #define IEEE802_11_MAX_DATA_LEN 2304
138
139 /* frame control (FC) masks, for frame control as 16 bit integer */
140 #define IEEE802_11_FC_TO_DS_MASK 0x100
141 #define IEEE802_11_FC_FROM_DS_MASK 0x200
142 #define IEEE802_11_FC_MOREDATA_MASK 0x2000
143 #define IEEE802_11_FC_PROTECTED_MASK 0x4000
144 #define IEEE80211_FC_ORDER_MASK 0x8000
145 #define IEEE80211_FC_SUBTYPE_MASK 0x00f0
146 #define IEEE80211_FC_TYPE_MASK 0x000c
147 #define IEEE80211_FC_PROTO_VERSION_MASK 0x0003
148
149 /*  selected type and subtype combinations as in 7.1.3.1 table 1
150     For frame control as 16 bit integer, or for ls octet
151 */
152 #define IEEE802_11_FC_TYPE_DATA 0x08
153 #define IEEE802_11_FC_TYPE_NULL 0x48
154 #define IEEE802_11_FC_TYPE_QOS_NULL 0xc8
155 #define IEEE802_11_FC_TYPE_QOS_DATA 0x88
156
157 #define IEEE802_11_FC_TYPE_DATA_SUBTYPE_RESERVED 0x0D
158
159 /* qos control (QC) masks for qos control as 16 bit integer, or for ls octet */
160 #define IEEE802_11_QC_TID_MASK 0x0f
161 #define IEEE802_11_QC_A_MSDU_PRESENT 0x80
162
163 #if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND))
164 #define IEEE802_11_QC_NON_TID_BITS_MASK 0xFFF0
165 #endif
166
167 #define CSR_WIFI_EAPOL_M4_HOST_TAG 0x50000000
168 #define IEEE802_11_DATA_FRAME_MAC_HEADER_SIZE 36
169 #define MAX_ACCESS_CATOGORY 4
170
171 /* Time in us to check for inactivity of stations 5 mins */
172 #define INACTIVITY_CHECK_INTERVAL   300000000
173 /* Time in us before a station is flagged as inactive */
174 #define MAX_INACTIVITY_INTERVAL     300000000
175
176
177 /* Define for maximum BA session */
178 #define MAX_SUPPORTED_BA_SESSIONS_TX   1
179 #define MAX_SUPPORTED_BA_SESSIONS_RX   4
180
181 #define MAX_BA_WIND_SIZE 64
182 #define MAC_HEADER_ADDR1_OFFSET     4
183 #define MAC_HEADER_ADDR2_OFFSET     10
184
185 /* Define for age (in us) value for frames in MPDU reorder buffer */
186 #define CSR_WIFI_BA_MPDU_FRAME_AGE_TIMEOUT  30000 /* 30 milli seconds */
187
188 /* This macro used in prepare_and_add_macheader*/
189 #define ADDRESS_ONE_OFFSET 20
190
191 /* Defines for STA inactivity detection */
192 #define     STA_INACTIVE_DETECTION_TRIGGER_THRESHOLD           1                /* in number of stations */
193 #define     STA_INACTIVE_DETECTION_TIMER_INTERVAL              30               /* in seconds */
194 #define     STA_INACTIVE_TIMEOUT_VAL                           120*1000*1000    /* 120 seconds */
195
196 /* Test for modes requiring AP firmware patch */
197 #define CSR_WIFI_HIP_IS_AP_FW(mode) ((((mode) == CSR_WIFI_ROUTER_CTRL_MODE_AP) || \
198                                       ((mode) == CSR_WIFI_ROUTER_CTRL_MODE_P2PGO)) ? TRUE : FALSE)
199
200 /* Defines used in beacon filtering in case of P2P */
201 #define CSR_WIFI_P2P_WILDCARD_SSID_LENGTH        0x7
202 #define CSR_WIFI_80211_FRAME_SUBTYPE_BEACON      0x8
203 #define CSR_WIFI_BEACON_FIXED_LENGTH             12
204 #define CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET        4
205 #define CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK    ((u8)(0xF << CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET))
206
207 #define CSR_WIFI_80211_GET_FRAME_SUBTYPE(frameBuffer) \
208     ((u8)(((u8 *)frameBuffer)[0] & CSR_WIFI_80211_FRAME_SUBTYPE_BIT_MASK) >> CSR_WIFI_FRAME_SUBTYPE_BIT_OFFSET)
209
210 /* For M4 request received via netdev*/
211
212 typedef u8 CsrWifiPacketType;
213 #define CSR_WIFI_UNICAST_PDU   ((CsrWifiPacketType) 0x00)
214 #define CSR_WIFI_MULTICAST_PDU ((CsrWifiPacketType) 0x1)
215 #define CSR_WIFI_BROADCAST_PDU ((CsrWifiPacketType) 0x2)
216
217 #define PRIO_TO_NICE(prio)  ((prio) - MAX_RT_PRIO - 20)
218
219 /* Module parameter variables */
220 extern int buswidth;
221 extern int sdio_clock;
222 extern int use_5g;
223 extern int disable_hw_reset;
224 extern int disable_power_control;
225 extern int enable_wol;
226 extern int sme_debug;
227 extern int fw_init[MAX_UNIFI_DEVS];
228 extern int tl_80211d;
229 extern int sdio_byte_mode;
230 extern int sdio_block_size;
231 extern int coredump_max;
232 extern int run_bh_once;
233 extern int bh_priority;
234 #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
235 extern int log_hip_signals;
236 #endif
237
238 struct dlpriv {
239     const unsigned char *dl_data;
240     int dl_len;
241     void *fw_desc;
242 };
243
244
245 struct uf_thread {
246
247     struct task_struct *thread_task;
248
249     /* wait_queue for waking the unifi_thread kernel thread */
250     wait_queue_head_t wakeup_q;
251     unsigned int wakeup_flag;
252
253     /*
254      * Use it to block the I/O thread when
255      * an error occurs or UniFi is reinitialised.
256      */
257     int block_thread;
258
259     char name[16];
260     int prio;
261 };
262
263 /*
264  * Link list to hold the received packets for the period the port
265  * remains closed.
266  */
267 typedef struct rx_buffered_packets {
268     /* List link structure */
269     struct list_head q;
270     /* Packet to indicate when the port reopens */
271     struct sk_buff *skb;
272     /* Bulkdata to free in case the port closes and need to discard the packet */
273     bulk_data_param_t bulkdata;
274     /* The source address of the packet */
275     CsrWifiMacAddress sa;
276     /* The destination address of the packet */
277     CsrWifiMacAddress da;
278     /* Corresponding signal */
279     CSR_SIGNAL signal;
280 } rx_buffered_packets_t;
281
282
283 typedef u8 CsrWifiAcPowersaveMode;
284 #define CSR_WIFI_AC_TRIGGER_ONLY_ENABLED 0x00
285 #define CSR_WIFI_AC_DELIVERY_ONLY_ENABLE 0X01
286 #define CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED 0X03
287 #define CSR_WIFI_AC_LEGACY_POWER_SAVE 0X02
288
289
290 #define IS_DELIVERY_ENABLED(mode) (mode & CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)? 1: 0
291 #define IS_DELIVERY_AND_TRIGGER_ENABLED(mode) ((mode & CSR_WIFI_AC_DELIVERY_ONLY_ENABLE)||(mode & CSR_WIFI_AC_TRIGGER_AND_DELIVERY_ENABLED))? 1: 0
292 #define IS_DTIM_ACTIVE(flag,hostTag) ((flag == TRUE || hostTag != INVALID_HOST_TAG))
293 #define INVALID_HOST_TAG 0xFFFFFFFF
294 #define UNIFI_TRAFFIC_Q_CONTENTION UNIFI_TRAFFIC_Q_BE
295
296
297
298
299 /* Queue to be used for contention priority */
300
301 /*
302  * Link list to hold the tx packets for the period the peer
303  * powersave/free slots in unifi
304  */
305 typedef struct tx_buffered_packets {
306     /* List link structure */
307     struct list_head q;
308     u16 interfaceTag;
309     CSR_CLIENT_TAG hostTag;
310     CSR_PROCESS_ID leSenderProcessId;
311     CSR_TRANSMISSION_CONTROL transmissionControl;
312     CSR_RATE rate;
313     /* Bulkdata to free in case the port closes and need to discard the packet */
314     bulk_data_desc_t bulkdata;
315     /* The source address of the packet */
316     CsrWifiMacAddress peerMacAddress;
317     CSR_PRIORITY priority;
318 } tx_buffered_packets_t;
319
320 /* station record has this data structure */
321 typedef struct CsrWifiRouterCtrlStaInfo_t {
322
323     /* Sme sends these parameters */
324     CsrWifiMacAddress peerMacAddress;
325     u32 assignedHandle;
326     u8 wmmOrQosEnabled;
327     CsrWifiAcPowersaveMode powersaveMode[MAX_ACCESS_CATOGORY];
328     u16 maxSpLength;
329     u8 uapsdActive;
330     u16 noOfSpFramesSent;
331
332     /* Router/Driver database */
333 #ifdef CSR_SUPPORT_SME
334     unifi_port_cfg_t *peerControlledPort;
335     unifi_port_cfg_t *peerUnControlledPort;
336
337     /* Inactivity feature parameters */
338     struct netInterface_priv *interfacePriv;
339     struct work_struct send_disconnected_ind_task;
340     u8 activity_flag;
341     u16 listenIntervalInTus;
342     CSR_CLIENT_TAG nullDataHostTag;
343
344     /* Activity timestamps for the station */
345     CsrTime lastActivity;
346
347     /* during m/c transmission sp suspended */
348     u8 uspSuspend;
349     CSR_PRIORITY triggerFramePriority;
350 #endif
351     CsrWifiRouterCtrlPeerStatus currentPeerState;
352     struct list_head dataPdu[MAX_ACCESS_CATOGORY];
353     struct list_head mgtFrames;
354     u8 spStatus;
355     u8 prevFrmType;
356     u8 prevFrmAccessCatogory;
357     u8 protection;
358     u16 aid;
359     u8 txSuspend;
360     u8 timSet;
361     /* Dont change the value of below macro for SET & RESET */
362 #define CSR_WIFI_TIM_RESET       0
363 #define CSR_WIFI_TIM_SET         1
364 #define CSR_WIFI_TIM_RESETTING   2
365 #define CSR_WIFI_TIM_SETTING     3
366
367     u8 timRequestPendingFlag;
368     u8 updateTimReqQueued;
369     u16 noOfPktQueued;
370 }CsrWifiRouterCtrlStaInfo_t;
371
372 #ifdef CSR_SUPPORT_WEXT_AP
373 struct CsrWifiSmeApConfig {
374     CsrWifiSsid ssid;
375     u16 channel;
376     CsrWifiNmeApCredentials credentials;
377     u8 max_connections;
378     u8 if_index;
379 };
380 #endif
381
382 #ifdef CSR_WIFI_RX_PATH_SPLIT
383 /* This is a test code and may be removed later*/
384 #define CSR_WIFI_RX_SIGNAL_BUFFER_SIZE    (60+1)
385
386 typedef struct
387 {
388     u8 *bufptr; /* Signal Primitive */
389     bulk_data_param_t data_ptrs; /* Bulk Data pointers */
390     u16 sig_len;
391 }rx_buff_struct_t;
392
393 typedef struct
394 {
395     u8 writePointer; /**< write pointer */
396     u8 readPointer;  /**< read pointer */
397     u8 size;         /**< size of circular buffer */
398     rx_buff_struct_t rx_buff[CSR_WIFI_RX_SIGNAL_BUFFER_SIZE];    /**< Element of ciruclar buffer */
399 } rxCircularBuffer_t;
400
401 void rx_wq_handler(struct work_struct *work);
402 #endif
403
404 struct unifi_priv {
405
406     card_t *card;
407     CsrSdioFunction *sdio;
408
409     /* Index into Unifi_instances[] for this device. */
410     int instance;
411     /* Reference count for this instance */
412     int ref_count;
413
414     /* Firmware images */
415     struct dlpriv fw_sta;
416     struct dlpriv fw_conv;  /* used for conversion of production test image */
417
418     /* Char device related structures */
419     struct cdev unifi_cdev;
420     struct cdev unifiudi_cdev;
421     struct device *unifi_device;
422
423     /* Which wireless interface to use (1 - 2.4GHz, 2 - 5GHz) */
424     CSR_IFINTERFACE if_index;
425
426     /* For multiple interface support */
427     struct net_device *netdev[CSR_WIFI_NUM_INTERFACES];
428     struct netInterface_priv *interfacePriv[CSR_WIFI_NUM_INTERFACES];
429
430     u8 totalInterfaceCount;
431
432     int prev_queue;
433
434     /* Name of node under /proc */
435     char proc_entry_name[64];
436
437     /*
438      * Flags:
439      *  drop_unencrypted
440      *                - Not used?
441      *  netdev_registered
442      *                - whether the netdev has been registered.
443      */
444     unsigned int drop_unencrypted       : 1;
445
446     /* Our list of unifi linux clients. */
447     ul_client_t ul_clients[MAX_UDI_CLIENTS];
448
449     /* Mutex to protect using the logging hook after UDI client is gone */
450     struct semaphore udi_logging_mutex;
451     /* Pointer to the ul_clients[] array */
452     ul_client_t *logging_client;
453
454     /* A ul_client_t* used to send the netdev related MIB requests. */
455     ul_client_t *netdev_client;
456
457     /* The SME ul_client_t pointer. */
458     ul_client_t *sme_cli;
459
460     /* The AMP ul_client_t pointer. */
461     ul_client_t *amp_client;
462
463     /*
464      * Semaphore for locking the top-half to one user process.
465      * This is necessary to prevent multiple processes calling driver
466      * operations. This can happen because the network driver entry points
467      * can be called from multiple processes.
468      */
469 #ifdef USE_DRIVER_LOCK
470     struct semaphore lock;
471 #endif /* USE_DRIVER_LOCK */
472
473     /* Flag to say that an operation was aborted */
474     int io_aborted;
475
476     struct uf_thread bh_thread;
477
478 #define UNIFI_INIT_NONE         0x00
479 #define UNIFI_INIT_IN_PROGRESS  0x01
480 #define UNIFI_INIT_FW_DOWNLOADED 0x02
481 #define UNIFI_INIT_COMPLETED    0x04
482     unsigned char init_progress;
483
484     int sme_is_present;
485
486     /* The WMM features that UniFi uses in the current BSS */
487     unsigned int sta_wmm_capabilities;
488
489     /* Debug only */
490     char last_debug_string[256];
491     unsigned short last_debug_word16[16];
492
493 #ifdef CSR_SUPPORT_SME
494   /* lock to protect the tx queues list */
495     spinlock_t tx_q_lock;
496     u8 allPeerDozing;
497     u8 pausedStaHandle[MAX_ACCESS_CATOGORY];
498     /* Max packet the driver can queue, irrespective of interface number */
499     u16 noOfPktQueuedInDriver;
500 #define CSR_WIFI_DRIVER_SUPPORT_FOR_MAX_PKT_QUEUEING 512
501 #define CSR_WIFI_DRIVER_MAX_PKT_QUEUING_THRESHOLD_PER_PEER 64
502 #define CSR_WIFI_DRIVER_MINIMUM_BROADCAST_PKT_THRESHOLD 3
503
504     u8 routerBufferEnable[MAX_ACCESS_CATOGORY];
505     /* lock to protect stainfo members and priv members*/
506     spinlock_t staRecord_lock;
507 #endif
508 #ifdef CSR_NATIVE_LINUX
509 #ifdef CSR_SUPPORT_WEXT
510     /* wireless config */
511     struct wext_config wext_conf;
512 #endif
513
514     /* Mutex to protect the MLME blocking requests */
515     struct semaphore mlme_blocking_mutex;
516
517     /* The ul_client that provides the blocking API for WEXT calls */
518     ul_client_t *wext_client;
519
520 #endif /* CSR_NATIVE_LINUX */
521
522 #ifdef CSR_SUPPORT_SME
523     wait_queue_head_t sme_request_wq;
524     /* Semaphore to protect the SME blocking requests */
525     struct semaphore sme_sem;
526     /* Structure to hold the SME blocking requests data*/
527     sme_reply_t sme_reply;
528
529     /* Structure to hold a traffic protocol indication */
530     struct ta_ind {
531         struct work_struct task;
532         CsrWifiRouterCtrlTrafficPacketType packet_type;
533         CsrWifiRouterCtrlProtocolDirection direction;
534         CsrWifiMacAddress src_addr;
535         int in_use;
536     } ta_ind_work;
537
538     struct ta_sample_ind {
539         struct work_struct task;
540         CsrWifiRouterCtrlTrafficStats stats;
541         int in_use;
542     } ta_sample_ind_work;
543
544     __be32 sta_ip_address;
545     CsrWifiRouterCtrlSmeVersions    sme_versions;
546
547     /*
548      * Flag to reflect state of unifi_sys_wifi_on_*() progress.
549      * This indicates whether we are in an "wifi on" state when we are
550      * allowed to indication errors with unifi_mgt_wifi_off_ind()
551      */
552     enum {
553         wifi_on_unspecified = -1,
554         wifi_on_in_progress = 0,
555         wifi_on_done = 1,
556     } wifi_on_state;
557
558     /* Userspace TaskId for the SME Set when a wifi on req is received */
559     CsrSchedQid CSR_WIFI_SME_IFACEQUEUE;
560
561     struct work_struct multicast_list_task;
562     /*
563      * The SME installs filters to ask for specific MA-UNITDATA.req
564      * to be passed to different SME components.
565      */
566 #define MAX_MA_UNIDATA_IND_FILTERS      8
567     sme_ma_unidata_ind_filter_t sme_unidata_ind_filters[MAX_MA_UNIDATA_IND_FILTERS];
568
569 /* UNIFI_CFG related parameters */
570     uf_cfg_bcast_packet_filter_t packet_filters;
571     unsigned char *filter_tclas_ies;
572  /* The structure that holds all the connection configuration. */
573     CsrWifiSmeConnectionConfig connection_config;
574 #ifdef CSR_SUPPORT_WEXT
575
576     int ignore_bssid_join;
577     struct iw_statistics wext_wireless_stats;
578
579     /* The MIB and MAC address files contents, read from userspace */
580     CsrWifiSmeDataBlock mib_data;
581     CsrWifiMacAddress sta_mac_address;
582
583     int wep_tx_key_index;
584     wep_key_t wep_keys[NUM_WEPKEYS];
585
586
587 #ifdef CSR_SUPPORT_WEXT_AP
588     CsrWifiSmeApMacConfig ap_mac_config;
589     CsrWifiNmeApConfig group_sec_config;
590     CsrWifiSmeApConfig_t ap_config;
591 #endif
592     struct work_struct sme_config_task;
593
594 #endif /* CSR_SUPPORT_WEXT */
595
596 #endif /* CSR_SUPPORT_SME */
597
598 #ifdef CSR_SME_USERSPACE
599     void *smepriv;
600 #endif /* CSR_SME_USERSPACE */
601
602     card_info_t card_info;
603
604     /* Mutex to protect unifi_send_signal() */
605     spinlock_t send_signal_lock;
606
607
608     /*
609      * The workqueue to offload the TA run
610      * and the multicast addresses list set
611      */
612     struct workqueue_struct *unifi_workqueue;
613
614     unsigned char *mib_cfm_buffer;
615     unsigned int mib_cfm_buffer_length;
616
617     int ptest_mode;     /* Set when in production test mode */
618     int coredump_mode;  /* Set when SME has requested a coredump */
619     u8 wol_suspend; /* Set when suspending with UniFi powered */
620
621 #define UF_UNCONTROLLED_PORT_Q      0
622 #define UF_CONTROLLED_PORT_Q        1
623
624     /* Semaphore to protect the rx queues list */
625     struct semaphore rx_q_sem;
626
627     /* Spinlock to protect M4 data */
628     spinlock_t m4_lock;
629     /* Mutex to protect BA RX data */
630     struct semaphore ba_mutex;
631
632 #if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
633     /* Spinlock to protect the WAPI data */
634     spinlock_t wapi_lock;
635 #endif
636
637 #ifndef ALLOW_Q_PAUSE
638     /* Array to indicate if a particular Tx queue is paused, this may not be
639      * required in a multiqueue implementation since we can directly stop kernel
640      * queues */
641     u8 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX];
642 #endif
643
644 #ifdef CSR_WIFI_RX_PATH_SPLIT
645     struct workqueue_struct *rx_workqueue;
646     struct work_struct rx_work_struct;
647     rxCircularBuffer_t rxSignalBuffer;
648
649 #endif
650
651     u32 rxTcpThroughput;
652     u32 txTcpThroughput;
653     u32 rxUdpThroughput;
654     u32 txUdpThroughput;
655
656 #ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
657     /*Set if multicast KeyID = 1*/
658     u8 wapi_multicast_filter;
659     /*Set if unicast KeyID = 1*/
660     u8 wapi_unicast_filter;
661     u8 wapi_unicast_queued_pkt_filter;
662 #ifdef CSR_WIFI_SECURITY_WAPI_QOSCTRL_MIC_WORKAROUND
663     u8  isWapiConnection;
664 #endif
665 #endif
666
667 #ifdef CSR_WIFI_SPLIT_PATCH
668     CsrWifiRouterCtrlModeSetReq pending_mode_set;
669 #endif
670
671     u8 cmanrTestMode;
672     CSR_RATE cmanrTestModeTransmitRate;
673
674 };
675
676 typedef struct {
677     u16 queue_length[4];
678     u8 os_queue_paused;
679 } unifi_OsQosInfo;
680
681
682 typedef struct {
683     u8 active;
684     bulk_data_param_t bulkdata;
685     CSR_SIGNAL signal;
686     u16 sn;
687     CsrTime recv_time;
688 } frame_desc_struct;
689
690 typedef struct {
691     frame_desc_struct *buffer;
692     u16 wind_size;
693     u16 occupied_slots;
694     struct timer_list timer;
695     u16 timeout;
696     u16 expected_sn;
697     u16 start_sn;
698     u8   trigger_ba_after_ssn;
699     struct netInterface_priv *interfacePriv;
700     u16 tID;
701     CsrWifiMacAddress macAddress;
702     struct work_struct send_ba_err_task;
703 } ba_session_rx_struct;
704
705
706 typedef struct {
707     struct netInterface_priv *interfacePriv;
708     u16 tID;
709     CsrWifiMacAddress macAddress;
710 } ba_session_tx_struct;
711
712 typedef struct netInterface_priv
713 {
714     u16 InterfaceTag;
715     struct unifi_priv *privPtr;
716     ba_session_tx_struct *ba_session_tx[MAX_SUPPORTED_BA_SESSIONS_TX];
717     ba_session_rx_struct *ba_session_rx[MAX_SUPPORTED_BA_SESSIONS_RX];
718     frame_desc_struct ba_complete[MAX_BA_WIND_SIZE];
719     u8 ba_complete_index;
720     u8 queueEnabled[UNIFI_NO_OF_TX_QS];
721     struct work_struct send_m4_ready_task;
722 #ifdef CSR_WIFI_SECURITY_WAPI_ENABLE
723     struct work_struct send_pkt_to_encrypt;
724 #endif
725     struct net_device_stats stats;
726     u8 interfaceMode;
727     u8 protect;
728     CsrWifiMacAddress bssid;
729     /*
730     * Flag to reflect state of CONNECTED indication signal.
731     * This indicates whether we are "joined" an Access Point (i.e. have
732     * nominated an AP and are receiving beacons) but give no indication
733     * of whether we are authenticated and/or associated.
734     */
735     enum {
736         UnifiConnectedUnknown = -1,
737         UnifiNotConnected = 0,
738         UnifiConnected = 1,
739     } connected;
740 #ifdef CSR_SUPPORT_WEXT
741     /* Tracks when we are waiting for a netdevice state change callback */
742     u8 wait_netdev_change;
743     /* True if we have successfully registered for netdev callbacks */
744     u8 netdev_callback_registered;
745 #endif /* CSR_SUPPORT_WEXT */
746     unsigned int netdev_registered;
747 #define UNIFI_MAX_MULTICAST_ADDRESSES 10
748     /* The multicast addresses list that the thread needs to set. */
749     u8 mc_list[UNIFI_MAX_MULTICAST_ADDRESSES*ETH_ALEN];
750     /* The multicast addresses count that the thread needs to set. */
751     int mc_list_count;
752     u32 tag;
753 #ifdef CSR_SUPPORT_SME
754     /* (un)controlled port configuration */
755     unifi_port_config_t controlled_data_port;
756     unifi_port_config_t uncontrolled_data_port;
757
758     /* station record maintenance related data structures */
759     u8 num_stations_joined;
760     CsrWifiRouterCtrlStaInfo_t *(staInfo)[UNIFI_MAX_CONNECTIONS];
761     struct list_head genericMgtFrames;
762     struct list_head genericMulticastOrBroadCastFrames;
763     struct list_head genericMulticastOrBroadCastMgtFrames;
764
765     /* Timer for detecting station inactivity */
766     struct timer_list sta_activity_check_timer;
767     u8 sta_activity_check_enabled;
768
769     /* Timestamp when the last inactivity check was done */
770     CsrTime last_inactivity_check;
771
772     /*number of multicast or borad cast packets  queued*/
773     u16 noOfbroadcastPktQueued;
774 #endif
775     /* A list to hold the buffered uncontrolled port packets */
776     struct list_head rx_uncontrolled_list;
777     /* A list to hold the buffered controlled port packets */
778     struct list_head rx_controlled_list;
779     /* Buffered M4 signal to take care of WPA race condition */
780     CSR_SIGNAL m4_signal;
781     bulk_data_desc_t m4_bulk_data;
782
783 #if (defined(CSR_WIFI_SECURITY_WAPI_ENABLE) && defined(CSR_WIFI_SECURITY_WAPI_SW_ENCRYPTION))
784     /* Buffered WAPI Unicast MA Packet Request for encryption in Sme */
785     CSR_SIGNAL wapi_unicast_ma_pkt_sig;
786     bulk_data_desc_t wapi_unicast_bulk_data;
787 #endif
788
789     /* This should be removed and m4_hostTag should be used for checking*/
790     u8 m4_sent;
791     CSR_CLIENT_TAG m4_hostTag;
792     u8 dtimActive;
793     u8 intraBssEnabled;
794     u32 multicastPduHostTag; /* Used to set the tim after getting
795        a confirm for it */
796     u8 bcTimSet;
797     u8 bcTimSetReqPendingFlag;
798     u8 bcTimSetReqQueued;
799 } netInterface_priv_t;
800
801 #ifndef ALLOW_Q_PAUSE
802 #define net_is_tx_q_paused(priv, q)   (priv->tx_q_paused_flag[q])
803 #define net_tx_q_unpause(priv, q)   (priv->tx_q_paused_flag[q] = 0)
804 #define net_tx_q_pause(priv, q)   (priv->tx_q_paused_flag[q] = 1)
805 #endif
806
807 #ifdef CSR_SUPPORT_SME
808 #define routerStartBuffering(priv,queue) priv->routerBufferEnable[(queue)] = TRUE;
809 #define routerStopBuffering(priv,queue) priv->routerBufferEnable[(queue)]  = FALSE;
810 #define isRouterBufferEnabled(priv,queue) priv->routerBufferEnable[(queue)]
811 #endif
812
813 #ifdef USE_DRIVER_LOCK
814 #define LOCK_DRIVER(_p)         down_interruptible(&(_p)->lock)
815 #define UNLOCK_DRIVER(_p)       up(&(_p)->lock)
816 #else
817 #define LOCK_DRIVER(_p)         (void)(_p); /* as nothing */
818 #define UNLOCK_DRIVER(_p)       (void)(_p); /* as nothing */
819 #endif /* USE_DRIVER_LOCK */
820
821 s32 CsrHipResultToStatus(CsrResult csrResult);
822
823
824 /*
825  * SDIO related functions and callbacks
826  */
827 int  uf_sdio_load(void);
828 void uf_sdio_unload(void);
829 unifi_priv_t *uf_find_instance(int inst);
830 int uf_find_priv(unifi_priv_t *priv);
831 int uf_find_netdev_priv(netInterface_priv_t *priv);
832 unifi_priv_t *uf_get_instance(int inst);
833 void uf_put_instance(int inst);
834 int csr_sdio_linux_install_irq(CsrSdioFunction *sdio);
835 int csr_sdio_linux_remove_irq(CsrSdioFunction *sdio);
836
837 void uf_add_os_device(int bus_id, struct device *os_device);
838 void uf_remove_os_device(int bus_id);
839
840
841
842 /*
843  * Claim/release SDIO
844  *
845  * For multifunction cards, we cannot grub the SDIO lock around the unifi_bh()
846  * as this prevents other functions using SDIO.
847  * Since some of CSR SDIO API is used regardless of trying to lock unifi_bh()
848  * we have followed this scheme:
849  * 1. If a function needs protection only when CSR_WIFI_SINGLE_FUNCTION is defined
850  *    then we call CsrSdioClaim/CsrSdioRelease().
851  * 2. If a function needs protection only when CSR_WIFI_SINGLE_FUNCTION is not defined
852  *    then we call _sdio_claim_host/_sdio_claim_host(). Use of this should be restricted
853  *    to the SDIO glue layer only (e.g. sdio_mmc.c).
854  * 3. If a function needs protection, regardless of the CSR_WIFI_SINGLE_FUNCTION
855  *    then we call directly the sdio_claim_host/sdio_release_host().
856  *    Use of this must be restricted to the SDIO glue layer only (e.g. sdio_mmc.c).
857  *
858  * Note: The _func and function pointers are _not_ the same.
859  * The former is the (struct sdio_func*) context, which restricts the use to the SDIO glue layer.
860  * The latter is the (CsrSdioFunction*) context, which allows calls from all layers.
861  */
862
863 #ifdef CSR_WIFI_SUPPORT_MMC_DRIVER
864
865 #ifdef CSR_WIFI_SINGLE_FUNCTION
866 #define CsrSdioClaim(function)    sdio_claim_host((function)->priv);
867 #define CsrSdioRelease(function)  sdio_release_host((function)->priv);
868
869 #define _sdio_claim_host(_func)
870 #define _sdio_release_host(_func)
871
872 #else
873 #define CsrSdioClaim(function)
874 #define CsrSdioRelease(function)
875
876 #define _sdio_claim_host(_func)     sdio_claim_host(_func)
877 #define _sdio_release_host(_func)   sdio_release_host(_func)
878
879 #endif /* CSR_WIFI_SINGLE_FUNCTION */
880
881 #else
882 #define _sdio_claim_host(_func)
883 #define _sdio_release_host(_func)
884
885 #define CsrSdioClaim(function)
886 #define CsrSdioRelease(function)
887
888 #endif /* CSR_WIFI_SUPPORT_MMC_DRIVER */
889
890
891 /*
892  * Functions to allocate and free an ethernet device.
893  */
894 unifi_priv_t *uf_alloc_netdevice(CsrSdioFunction *sdio_dev, int bus_id);
895 int uf_free_netdevice(unifi_priv_t *priv);
896
897 /* Allocating function for other interfaces */
898 u8 uf_alloc_netdevice_for_other_interfaces(unifi_priv_t *priv, u16 interfaceTag);
899
900 /*
901  * Firmware download related functions.
902  */
903 int uf_run_unifihelper(unifi_priv_t *priv);
904 int uf_request_firmware_files(unifi_priv_t *priv, int is_fw);
905 int uf_release_firmware_files(unifi_priv_t *priv);
906 int uf_release_firmware(unifi_priv_t *priv, struct dlpriv *to_free);
907
908 /*
909  * Functions to create and delete the device nodes.
910  */
911 int uf_create_device_nodes(unifi_priv_t *priv, int bus_id);
912 void uf_destroy_device_nodes(unifi_priv_t *priv);
913
914 /*
915  * Upper Edge Initialisation functions
916  */
917 int uf_init_bh(unifi_priv_t *priv);
918 int uf_init_hw(unifi_priv_t *priv);
919
920 /* Thread related helper functions */
921 int uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void *));
922 void uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread);
923 void uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread);
924
925
926 /*
927  * Unifi Linux functions
928  */
929 void ul_init_clients(unifi_priv_t *priv);
930
931 /* Configuration flags */
932 #define CLI_USING_WIRE_FORMAT   0x0002
933 #define CLI_SME_USERSPACE       0x0020
934 ul_client_t *ul_register_client(unifi_priv_t *priv,
935         unsigned int configuration,
936         udi_event_t udi_event_clbk);
937 int ul_deregister_client(ul_client_t *pcli);
938
939 int ul_send_signal_unpacked(unifi_priv_t *priv,
940                             CSR_SIGNAL *sigptr,
941                             bulk_data_param_t *bulkdata);
942 int ul_send_signal_raw(unifi_priv_t *priv,
943                        unsigned char *sigptr, int siglen,
944                        bulk_data_param_t *bulkdata);
945
946 void ul_log_config_ind(unifi_priv_t *priv, u8 *conf_param, int len);
947
948
949 /*
950  * Data plane operations
951  */
952 /*
953  *      data_tx.c
954  */
955 int uf_verify_m4(unifi_priv_t *priv, const unsigned char *packet,
956         unsigned int length);
957
958 #ifdef CSR_SUPPORT_SME
959 u8 uf_check_broadcast_bssid(unifi_priv_t *priv, const bulk_data_param_t *bulkdata);
960 u8 uf_process_pm_bit_for_peer(unifi_priv_t * priv, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,u8 pmBit,u16 interfaceTag);
961 void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,u16 interfaceTag);
962 int uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb,
963                    struct ethhdr *ehdr, CsrWifiRouterCtrlStaInfo_t * srcStaInfo,
964                    const CSR_SIGNAL *signal,
965                    bulk_data_param_t *bulkdata,
966                    u8 macHeaderLengthInBytes);
967 u8 uf_is_more_data_for_non_delivery_ac(CsrWifiRouterCtrlStaInfo_t *staRecord);
968 void uf_process_wmm_deliver_ac_uapsd (  unifi_priv_t * priv,
969                                         CsrWifiRouterCtrlStaInfo_t * srcStaInfo,
970                                         u16 qosControl,
971                                         u16 interfaceTag);
972
973 void uf_send_buffered_data_from_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList);
974 void uf_send_buffered_data_from_delivery_ac(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo, u8 queue, struct list_head *txList);
975
976 void uf_continue_uapsd(unifi_priv_t *priv, CsrWifiRouterCtrlStaInfo_t * staInfo);
977 void uf_send_qos_null(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo);
978 void uf_send_nulldata(unifi_priv_t * priv,u16 interfaceTag, const u8 *da,CSR_PRIORITY priority,CsrWifiRouterCtrlStaInfo_t * srcStaInfo);
979
980
981
982 #endif
983 CsrResult uf_process_ma_packet_req(unifi_priv_t *priv,  u8 *peerMacAddress, CSR_CLIENT_TAG hostTag, u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl, CSR_RATE TransmitRate, CSR_PRIORITY priority, CSR_PROCESS_ID senderId, bulk_data_param_t *bulkdata);
984 void uf_process_ma_vif_availibility_ind(unifi_priv_t *priv,u8 *sigdata, u32 siglen);
985 #ifdef CSR_SUPPORT_SME
986 void uf_send_buffered_frames(unifi_priv_t *priv,unifi_TrafficQueue queue);
987 int uf_process_station_records_for_sending_data(unifi_priv_t *priv,u16 interfaceTag,
988                                                  CsrWifiRouterCtrlStaInfo_t *srcStaInfo,
989                                                  CsrWifiRouterCtrlStaInfo_t *dstStaInfo);
990 void uf_prepare_send_cfm_list_for_queued_pkts(unifi_priv_t * priv,
991                                                  struct list_head *frames_need_cfm_list,
992                                                  struct list_head * list);
993 void send_auto_ma_packet_confirm(unifi_priv_t *priv,
994                                  netInterface_priv_t *interfacePriv,
995                                  struct list_head *buffered_frames_list);
996 void uf_flush_list(unifi_priv_t * priv, struct list_head * list);
997 tx_buffered_packets_t *dequeue_tx_data_pdu(unifi_priv_t *priv, struct list_head *txList);
998 void resume_unicast_buffered_frames(unifi_priv_t *priv, u16 interfaceTag);
999 void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,u16 interfaceTag);
1000 void resume_suspended_uapsd(unifi_priv_t* priv,u16 interfaceTag);
1001 #endif
1002 /*
1003  *      netdev.c
1004  */
1005
1006 #ifndef P80211_OUI_LEN
1007 #define P80211_OUI_LEN  3
1008 #endif
1009 typedef struct {
1010     u8    dsap;   /* always 0xAA */
1011     u8    ssap;   /* always 0xAA */
1012     u8    ctrl;   /* always 0x03 */
1013     u8    oui[P80211_OUI_LEN];    /* organizational universal id */
1014     u16 protocol;
1015 } __attribute__ ((packed)) llc_snap_hdr_t;
1016 int skb_add_llc_snap(struct net_device *dev, struct sk_buff *skb, int proto);
1017 int skb_80211_to_ether(unifi_priv_t *priv, struct sk_buff *skb,
1018         const unsigned char *daddr, const unsigned char *saddr,
1019         const CSR_SIGNAL *signal,
1020         bulk_data_param_t *bulkdata);
1021
1022 const char *result_code_str(int result);
1023
1024
1025 /* prepares & appends the Mac header for the payload */
1026 int prepare_and_add_macheader(unifi_priv_t *priv,
1027                               struct sk_buff *skb,
1028                               struct sk_buff *newSkb,
1029                               CSR_PRIORITY priority,
1030                               bulk_data_param_t *bulkdata,
1031                               u16 interfaceTag,
1032                               const u8 *daddr,
1033                               const u8 *saddr,
1034                               u8 protection);
1035 CSR_PRIORITY
1036 get_packet_priority(unifi_priv_t *priv, struct sk_buff *skb, const struct ethhdr *ehdr, netInterface_priv_t *interfacePriv);
1037
1038 void
1039 unifi_frame_ma_packet_req(unifi_priv_t *priv, CSR_PRIORITY priority,
1040                           CSR_RATE TransmitRate, CSR_CLIENT_TAG hostTag,
1041                           u16 interfaceTag, CSR_TRANSMISSION_CONTROL transmissionControl,
1042                           CSR_PROCESS_ID leSenderProcessId, u8 *peerMacAddress,
1043                           CSR_SIGNAL *signal);
1044
1045
1046 /* Pack the LSB to include station handle & status of tim set */
1047 #define CSR_WIFI_PACK_SENDER_ID_LSB_FOR_TIM_REQ(handle, timState)  ((handle << 2) | timState)
1048 /* get the station record handle from the sender ID */
1049 #define CSR_WIFI_GET_STATION_HANDLE_FROM_RECEIVER_ID(receiverProcessId) (u8) ((receiverProcessId & 0xff) >> 2)
1050 /* get the timSet status from the sender ID */
1051 #define CSR_WIFI_GET_TIMSET_STATE_FROM_RECEIVER_ID(receiverProcessId)  (u8) (receiverProcessId & 0x03)
1052
1053 /* handle is 6 bits to accomodate in senderId LSB (only 64 station can be associated) */
1054 #define CSR_WIFI_BROADCAST_OR_MULTICAST_HANDLE 0x3F
1055
1056 void update_tim(unifi_priv_t * priv, u16 aid, u8 setTim, u16 interfaceTag, u32 handle);
1057 void uf_handle_tim_cfm(unifi_priv_t *priv, CSR_MLME_SET_TIM_CONFIRM *cfm, u16 senderProcessId);
1058
1059 /* Clear the Peer station Record, in case of wifioff/unexpected card removal */
1060 void CsrWifiRouterCtrlInterfaceReset(unifi_priv_t *priv, u16 interfaceTag);
1061
1062 void scroll_ba_window(unifi_priv_t *priv,
1063                       netInterface_priv_t *interfacePriv,
1064                       ba_session_rx_struct *ba_session,
1065                       u16 sn);
1066
1067 u8 blockack_session_stop(unifi_priv_t *priv,
1068                               u16 interfaceTag,
1069                               CsrWifiRouterCtrlBlockAckRole role,
1070                               u16 tID,
1071                               CsrWifiMacAddress macAddress);
1072 #ifdef CSR_SUPPORT_SME
1073 /* Fetch the protection information from interface Mode */
1074 s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, u16 interfaceTag, const u8 *daddr);
1075 #endif
1076
1077 /* Fetch the station record handler from data base for matching Mac address */
1078 #ifdef CSR_SUPPORT_SME
1079 CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(unifi_priv_t *priv,
1080                                                                                 const u8 *peerMacAddress,
1081                                                                                 u16 interfaceTag);
1082
1083 /* Fetch the station record handler from data base for matching handle */
1084 CsrWifiRouterCtrlStaInfo_t * CsrWifiRouterCtrlGetStationRecordFromHandle(unifi_priv_t *priv,
1085                                                                  u32 handle,
1086                                                                  u16 interfaceTag);
1087
1088 void uf_update_sta_activity(unifi_priv_t *priv, u16 interfaceTag, const u8 *peerMacAddress);
1089 void uf_process_ma_pkt_cfm_for_ap(unifi_priv_t *priv,u16 interfaceTag, const CSR_MA_PACKET_CONFIRM *pkt_cfm);
1090 #endif
1091 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
1092 int uf_install_qdisc(struct net_device *dev);
1093 #endif
1094
1095 void uf_resume_data_plane(unifi_priv_t *priv, int queue,
1096                           CsrWifiMacAddress peer_address,
1097                           u16 interfaceTag);
1098 void uf_free_pending_rx_packets(unifi_priv_t *priv, int queue,
1099         CsrWifiMacAddress peer_address,u16 interfaceTag);
1100
1101 int uf_register_netdev(unifi_priv_t *priv, int numOfInterface);
1102 void uf_unregister_netdev(unifi_priv_t *priv);
1103
1104 void uf_net_get_name(struct net_device *dev, char *name, int len);
1105
1106 void uf_send_queue_info(unifi_priv_t *priv);
1107 u16 uf_get_vif_identifier(CsrWifiRouterCtrlMode mode, u16 tag);
1108
1109 void uf_process_rx_pending_queue(unifi_priv_t *priv, int queue,
1110                                  CsrWifiMacAddress source_address,
1111                                  int indicate, u16 interfaceTag);
1112
1113 #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
1114 int uf_register_hip_offline_debug(unifi_priv_t *priv);
1115 int uf_unregister_hip_offline_debug(unifi_priv_t *priv);
1116 #endif
1117
1118 /*
1119  *      inet.c
1120  */
1121 void uf_register_inet_notifier(void);
1122 void uf_unregister_inet_notifier(void);
1123
1124
1125 /*
1126  * Suspend / Resume handlers
1127  */
1128 void unifi_resume(void *ospriv);
1129 void unifi_suspend(void *ospriv);
1130
1131
1132 #define QOS_CAPABILITY_WMM_ENABLED      0x0001
1133 #define QOS_CAPABILITY_WMM_UAPSD        0x0002
1134 #define QOS_CAPABILITY_ACM_BE_ENABLED   0x0010
1135 #define QOS_CAPABILITY_ACM_BK_ENABLED   0x0020
1136 #define QOS_CAPABILITY_ACM_VI_ENABLED   0x0040
1137 #define QOS_CAPABILITY_ACM_VO_ENABLED   0x0080
1138 #define QOS_CAPABILITY_TS_BE_ENABLED    0x0100
1139 #define QOS_CAPABILITY_TS_BK_ENABLED    0x0200
1140 #define QOS_CAPABILITY_TS_VI_ENABLED    0x0400
1141 #define QOS_CAPABILITY_TS_VO_ENABLED    0x0800
1142
1143
1144 /* EAPOL PDUS */
1145 #ifndef ETH_P_PAE
1146 #define ETH_P_PAE 0x888e
1147 #endif
1148 #ifndef ETH_P_WAI
1149 #define ETH_P_WAI 0x88b4
1150 #endif
1151 /*
1152  * unifi_dbg.c
1153  */
1154 void debug_string_indication(unifi_priv_t *priv,
1155         const unsigned char *extra,
1156         unsigned int extralen);
1157 void debug_word16_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr);
1158 void debug_generic_indication(unifi_priv_t *priv, const CSR_SIGNAL *sigptr);
1159
1160
1161 /*
1162  * putest.c
1163  */
1164 int unifi_putest_start(unifi_priv_t *priv, unsigned char *arg);
1165 int unifi_putest_cmd52_block_read(unifi_priv_t *priv, unsigned char *arg);
1166 int unifi_putest_stop(unifi_priv_t *priv, unsigned char *arg);
1167 int unifi_putest_set_sdio_clock(unifi_priv_t *priv, unsigned char *arg);
1168 int unifi_putest_cmd52_read(unifi_priv_t *priv, unsigned char *arg);
1169 int unifi_putest_coredump_prepare(unifi_priv_t *priv, unsigned char *arg);
1170 int unifi_putest_cmd52_write(unifi_priv_t *priv, unsigned char *arg);
1171 int unifi_putest_gp_read16(unifi_priv_t *priv, unsigned char *arg);
1172 int unifi_putest_gp_write16(unifi_priv_t *priv, unsigned char *arg);
1173
1174 int unifi_putest_dl_fw(unifi_priv_t *priv, unsigned char *arg);
1175 int unifi_putest_dl_fw_buff(unifi_priv_t *priv, unsigned char *arg);
1176
1177 #endif /* __LINUX_UNIFI_PRIV_H__ */