blob: a7c7a0278ea427883e4154f953f700b7adcf5b33 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam1ed83fc2014-02-19 01:15:45 -08002 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam1ed83fc2014-02-19 01:15:45 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028#if !defined( __WLAN_QCT_WTI_DS_H )
29#define __WLAN_QCT_WTI_DS_H
30
31/**=========================================================================
32 *
33 * \file wlan_qct_wdi_ds.h
34 *
35 * \brief define Dataservice API
36 *
37 * WLAN Device Abstraction layer External API for Dataservice
38 * DESCRIPTION
39 * This file contains the external API exposed by the
40 * wlan device abstarction layer module.
41 *
Jeff Johnson295189b2012-06-20 16:38:30 -070042 */
43
44
45#include "wlan_qct_pal_type.h"
46#include "wlan_qct_pal_status.h"
47#include "wlan_qct_pal_packet.h"
48#include "wlan_qct_wdi.h"
49
50
51typedef struct
52{
53 wpt_uint32 txFlags;
54 wpt_uint8 ac;
55 wpt_uint8 isEapol:1; //0 - not eapol 1 - eapol
56 wpt_uint8 isWai:1; //WAPI 0 - not WAI 1 WAI
57 wpt_uint8 fdisableFrmXlt:1; //0 - Let ADU do FT. 1 - bypass ADU FT
58 wpt_uint8 qosEnabled:1; //0 - non-Qos 1 - Qos
59 wpt_uint8 fenableWDS:1; //0 - not WDS 1 WDS
60 wpt_uint8 reserved1:3;
61 wpt_uint8 typeSubtype;
62 wpt_uint8 fUP;
63 wpt_uint8 fSTAMACAddress[6];
64 wpt_uint8 addr2MACAddress[6];
65 wpt_uint8 frmType;
66 wpt_uint8 fStaType;
Chet Lanctot4b088622013-05-22 16:09:22 -070067 wpt_uint8 fProtMgmtFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -070068 wpt_uint16 fPktlen;
69 wpt_status txCompleteStatus;
Kumar Anand90ca3dd2013-01-18 15:24:47 -080070 wpt_uint8 staIdx;
Ganesh Kondabattini10e67352015-03-16 17:41:57 +053071 wpt_uint32 txBdToken;
Jeff Johnson295189b2012-06-20 16:38:30 -070072} WDI_DS_TxMetaInfoType;
73
74
75typedef enum
76{
77 WDI_DS_OPCODE_INVALID = 0,
78 WDI_DS_OPCODE_QCUR_FWDBUF = 1,
79 WDI_DS_OPCODE_FWDBUF_FWDCUR = 2,
80 WDI_DS_OPCODE_QCUR = 3,
81 WDI_DS_OPCODE_FWDBUF_QUEUECUR = 4,
82 WDI_DS_OPCODE_FWDBUF_DROPCUR = 5,
83 WDI_DS_OPCODE_FWDALL_DROPCUR = 6,
84 WDI_DS_OPCODE_FWDALL_QCUR = 7,
85 WDI_DS_OPCODE_TEARDOWN = 8,
86 WDI_DS_OPCODE_DROPCUR = 9,
87 WDI_DS_OPCODE_MAX
88}WDI_DS_BAOpCodeEnumType;
89
Mihir Sheteccafc0c2015-04-17 16:13:15 +053090#define WDI_DS_LOG_PKT_TYPE_LEN 4
Mihir Shete2187b8c2015-03-18 16:54:29 +053091typedef enum
92{
93 WDI_DS_PACKET_LOG = 1<<0,
94
95 // Insert new values before this
96
97 // If the value of WDI_DS_MAX LOG is increased please
98 // make sure to change the data type of
99 // WDI_DS_RxMetaInfoType.loggingData from wpt_uint8
100 // to accommodate more values
Mihir Sheteccafc0c2015-04-17 16:13:15 +0530101 WDI_DS_MAX_LOG = 1<<31
Mihir Shete2187b8c2015-03-18 16:54:29 +0530102}WDI_DS_LoggingDataEnumType;
103
Jeff Johnson295189b2012-06-20 16:38:30 -0700104typedef struct
105{
106 wpt_uint8 staId;
107 wpt_uint8 addr3Idx;
108 wpt_uint8 rxChannel;
109 wpt_uint8 type:2;
110 wpt_uint8 subtype:4;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -0700111 wpt_uint8 rfBand:2;
Jeff Johnson295189b2012-06-20 16:38:30 -0700112
113 wpt_uint16 rtsf:1; //For beacon only. 1 ~V Riva TSF is bigger(later) than the one received
114 wpt_uint16 bsf:1; //1 Riva sends the last beacon, 0 not.
115 wpt_uint16 unknownUcastPkt:1; //1 ~V unicast frame received with unknown A2
116 wpt_uint16 scan:1; //1 frame received in scan state. 0 not.
117 wpt_uint16 dpuSig:3; //DPU signature
118 wpt_uint16 ft:1; //0~Wframe translation is not done. 1~Wdone
119 wpt_uint16 ne:1; //1 ~V frame is not encrypted OTA. This is for WAPI~Rs WAI packet.
120 wpt_uint16 llcr:1; // Has the LLC been stripped by H/W
121 wpt_uint16 bcast:1; //0 ~V unicast frame 1 ~V broadcast/multicast frame
122 wpt_uint16 tid:4;
123 wpt_uint16 reserved1:1;
124 wpt_uint8 dpuFeedback;
125 wpt_int8 snr;
126
127 wpt_uint32 currentPktSeqNo:12; /*current sequence number */
128 wpt_uint32 ampdu_reorderOpcode:4;
129 wpt_uint32 ampdu_reorderSlotIdx:6;
130 wpt_uint32 ampdu_reorderFwdIdx:6;
131 wpt_uint32 reserved3:4;
132
133 wpt_uint16 amsdu_size;
134 wpt_uint32 amsdu_asf:1;
135 wpt_uint32 amsdu_esf:1;
136 wpt_uint32 amsdu_lsf:1;
137 wpt_uint32 amsdu_aef:1;
138 wpt_uint32 reserved2:4;
139
140 wpt_uint8 *mpduHeaderPtr;
141 wpt_uint8 *mpduDataPtr;
142 wpt_uint32 mpduLength;
143 wpt_uint32 mpduHeaderLength;
144
145 wpt_uint32 rateIndex;
146 wpt_uint32 rxpFlags;
147 wpt_uint32 mclkRxTimestamp;
148
149 //Flow control frames
150 wpt_uint8 fc;
151 wpt_uint32 fcSTATxQStatus:16;
152 wpt_uint32 fcSTAThreshIndMask:16;
153 wpt_uint32 fcSTAPwrSaveStateMask:16;
154 wpt_uint32 fcSTAValidMask:16;
155
156 wpt_uint16 fcStaTxDisabledBitmap;
157 wpt_uint8 fcSTATxQLen[12]; // one byte per STA.
158 wpt_uint8 fcSTACurTxRate[12]; // current Tx rate for each sta.
159
160 wpt_uint64 replayCount;
161
162 wpt_uint32 rssi0;
163 wpt_uint32 rssi1;
Chet Lanctot186b5732013-03-18 10:26:30 -0700164
165#ifdef WLAN_FEATURE_11W
166 wpt_uint32 rmf:1;
167#endif
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700168#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
169 wpt_uint32 offloadScanLearn;
170 wpt_uint32 roamCandidateInd;
171#endif
Dino Mycle41bdc942014-06-10 11:30:24 +0530172#ifdef WLAN_FEATURE_EXTSCAN
173 wpt_uint32 extscanBuffer;
174#endif
Mihir Sheteccafc0c2015-04-17 16:13:15 +0530175 wpt_uint32 loggingData;
Jeff Johnson295189b2012-06-20 16:38:30 -0700176} WDI_DS_RxMetaInfoType;
177
178typedef struct sPktMetaInfo
179{
180 union
181 {
182 WDI_DS_TxMetaInfoType txMetaInfo;
183 WDI_DS_RxMetaInfoType rxMetaInfo;
184 } u;
185} WDI_DS_MetaInfoType;
186
Mihir Shete5affadc2015-05-29 20:54:57 +0530187typedef struct
188{
Sravan Kumar Kairam80d06ee2015-09-28 12:53:20 +0530189 wpt_uint16 status;
Mihir Shete5affadc2015-05-29 20:54:57 +0530190 wpt_boolean active;
191 wpt_uint64 logBuffAddress[MAX_NUM_OF_BUFFER];
192 wpt_uint32 logBuffLength[MAX_NUM_OF_BUFFER];
Karthick Sa6616c32015-07-22 14:49:02 +0530193 /* Log type i.e. Mgmt frame = 0, QXDM = 1, FW Mem dump = 2 */
194 wpt_uint8 logType;
195 /* Indicate if Last segment of log is received*/
196 wpt_boolean done;
Hanumantha Reddy Pothulae00a7e22015-09-15 20:11:30 +0530197 wpt_uint16 reasonCode;
Mihir Shete5affadc2015-05-29 20:54:57 +0530198} WDI_DS_LoggingSessionType;
199
Jeff Johnson295189b2012-06-20 16:38:30 -0700200WPT_STATIC WPT_INLINE WDI_DS_RxMetaInfoType* WDI_DS_ExtractRxMetaData (wpt_packet *pFrame)
201{
202 WDI_DS_RxMetaInfoType * pRxMetadata =
203 &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.rxMetaInfo;
204 return pRxMetadata;
205}
206
207
208WPT_STATIC WPT_INLINE WDI_DS_TxMetaInfoType* WDI_DS_ExtractTxMetaData (wpt_packet *pFrame)
209{
210 WDI_DS_TxMetaInfoType * pTxMetadata =
211 &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.txMetaInfo;
212 return pTxMetadata;
213}
214
215
216typedef void (*WDI_DS_TxCompleteCallback)(void *pContext, wpt_packet *pFrame);
217typedef void (*WDI_DS_RxPacketCallback) (void *pContext, wpt_packet *pFrame);
218typedef void (*WDI_DS_TxFlowControlCallback)(void *pContext, wpt_uint8 ac_mask);
Hanumantha Reddy Pothulae00a7e22015-09-15 20:11:30 +0530219typedef void (*WDI_DS_RxLogCallback)(wpt_uint8 logType);
Jeff Johnson295189b2012-06-20 16:38:30 -0700220
221
222
223/* DAL registration function.
224 * Parameters:
225 * pContext:Cookie that should be passed back to the caller along
226 * with the callback.
227 * pfnTxCompleteCallback:Callback function that is to be invoked to return
228 * packets which have been transmitted.
229 * pfnRxPacketCallback:Callback function that is to be invoked to deliver
230 * packets which have been received
231 * pfnTxFlowControlCallback:Callback function that is to be invoked to
232 * indicate/clear congestion.
233 *
234 * Return Value: SUCCESS Completed successfully.
235 * FAILURE_XXX Request was rejected due XXX Reason.
236 *
237 */
238WDI_Status WDI_DS_Register( void *pContext,
239 WDI_DS_TxCompleteCallback pfnTxCompleteCallback,
240 WDI_DS_RxPacketCallback pfnRxPacketCallback,
241 WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback,
Mihir Shete5affadc2015-05-29 20:54:57 +0530242 WDI_DS_RxLogCallback pfnRxLogCallback,
Jeff Johnson295189b2012-06-20 16:38:30 -0700243 void *pCallbackContext);
244
245
246
247/* DAL Transmit function.
248 * Parameters:
249 * pContext:Cookie that should be passed back to the caller along with the callback.
250 * pFrame:Refernce to PAL frame.
251 * more: Does the invokee have more than one packet pending?
252 * Return Value: SUCCESS Completed successfully.
253 * FAILURE_XXX Request was rejected due XXX Reason.
254 *
255 */
256
257
258WDI_Status WDI_DS_TxPacket(void *pContext,
259 wpt_packet *pFrame,
260 wpt_boolean more);
261
262
263/* DAL Transmit Complete function.
264 * Parameters:
265 * pContext:Cookie that should be passed back to the caller along with the callback.
266 * ucTxResReq:TX resource number required by TL
267 * Return Value: SUCCESS Completed successfully.
268 * FAILURE_XXX Request was rejected due XXX Reason.
269 *
270 */
271
272
273WDI_Status WDI_DS_TxComplete(void *pContext, wpt_uint32 ucTxResReq);
274
275/* DAL Suspend Transmit function.
276 * Parameters:
277 * pContext:Cookie that should be passed back to the caller along with the callback.
278 * Return Value: SUCCESS Completed successfully.
279 * FAILURE_XXX Request was rejected due XXX Reason.
280 *
281 */
282
283
284WDI_Status WDI_DS_TxSuspend(void *pContext);
285
286
287/* DAL Resume Transmit function.
288 * Parameters:
289 * pContext:Cookie that should be passed back to the caller along with the callback.
290 * Return Value: SUCCESS Completed successfully.
291 * FAILURE_XXX Request was rejected due XXX Reason.
292 *
293 */
294
295
296WDI_Status WDI_DS_TxResume(void *pContext);
297
298/* DAL Get Reserved resource by STA
299 * Parameters:
300 * pContext:Cookie that should be passed back to the caller along with the callback.
301 * wdiResPool: MemPool, MGMT ot DATA
302 * staId: STA ID
303 * Return Value: Number of reserved resouce count
304 *
305 */
306wpt_uint32 WDI_DS_GetReservedResCountPerSTA(void *pContext,
307 WDI_ResPoolType wdiResPool,
308 wpt_uint8 staId);
309
310/* DAL ADD STA into memPool
311 * Parameters:
312 * pContext:Cookie that should be passed back to the caller along with the callback.
313 * staId: STA ID
314 * Return Value: SUCCESS or FAIL
315 *
316 */
317WDI_Status WDI_DS_AddSTAMemPool(void *pContext, wpt_uint8 staIndex);
318
319/* DAL Remove STA from memPool
320 * Parameters:
321 * pContext:Cookie that should be passed back to the caller along with the callback.
322 * staId: STA ID
323 * Return Value: SUCCESS or FAIL
324 *
325 */
326WDI_Status WDI_DS_DelSTAMemPool(void *pContext, wpt_uint8 staIndex);
327
328/* DAL Set STA index associated with BSS index.
329 * Parameters:
330 * pContext:Cookie that should be passed back to the caller along with the callback.
331 * bssIdx: BSS index
332 * staId: STA index associated with BSS index
333 * Return Status: Found empty slot
334 *
335 */
336WDI_Status WDI_DS_SetStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
337
338/* DAL Get STA index associated with BSS index.
339 * Parameters:
340 * pContext:Cookie that should be passed back to the caller along with the callback.
341 * bssIdx: BSS index
342 * staId: STA index associated with BSS index
343 * Return Status: Found empty slot
344 *
345 */
346WDI_Status WDI_DS_GetStaIdxFromBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 *staIdx);
347
348/* DAL Clear STA index associated with BSS index.
349 * Parameters:
350 * pContext:Cookie that should be passed back to the caller along with the callback.
351 * bssIdx: BSS index
352 * staId: STA index associated with BSS index
353 * Return Status: Found empty slot
354 *
355 */
356WDI_Status WDI_DS_ClearStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
357
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800358/* @brief: WDI_DS_GetTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800359 * This function should be invoked to fetch the current stats
360 * Parameters:
361 * pStats:Pointer to the collected stats
362 * len: length of buffer pointed to by pStats
363 * Return Status: None
364 */
365void WDI_DS_GetTrafficStats(WDI_TrafficStatsType** pStats, wpt_uint32 *len);
366
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800367/* @brief: WDI_DS_DeactivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800368 * This function should be invoked to deactivate traffic stats collection
369 * Parameters: None
370 * Return Status: None
371 */
372void WDI_DS_DeactivateTrafficStats(void);
373
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800374/* @brief: WDI_DS_ActivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800375 * This function should be invoked to activate traffic stats collection
376 * Parameters: None
377 * Return Status: None
378 */
379void WDI_DS_ActivateTrafficStats(void);
380
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800381/* @brief: WDI_DS_ClearTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800382 * This function should be invoked to clear all past stats
383 * Parameters: None
384 * Return Status: None
385 */
386void WDI_DS_ClearTrafficStats(void);
387
Mihir Shetecb352cd2015-05-25 10:58:59 +0530388void *WDI_DS_GetLoggingMbPhyAddr(void *pContext);
Mihir Shete5affadc2015-05-29 20:54:57 +0530389void *WDI_DS_GetLoggingMbAddr(void *pContext);
390void *WDI_DS_GetLoggingSession(void *pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700391#endif