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