blob: ba95c7618ff7611b0e71035b935158f1b519f08e [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{
189 wpt_boolean active;
190 wpt_uint64 logBuffAddress[MAX_NUM_OF_BUFFER];
191 wpt_uint32 logBuffLength[MAX_NUM_OF_BUFFER];
Karthick Sa6616c32015-07-22 14:49:02 +0530192 /* Log type i.e. Mgmt frame = 0, QXDM = 1, FW Mem dump = 2 */
193 wpt_uint8 logType;
194 /* Indicate if Last segment of log is received*/
195 wpt_boolean done;
Hanumantha Reddy Pothulae00a7e22015-09-15 20:11:30 +0530196 wpt_uint16 reasonCode;
Mihir Shete5affadc2015-05-29 20:54:57 +0530197} WDI_DS_LoggingSessionType;
198
Jeff Johnson295189b2012-06-20 16:38:30 -0700199WPT_STATIC WPT_INLINE WDI_DS_RxMetaInfoType* WDI_DS_ExtractRxMetaData (wpt_packet *pFrame)
200{
201 WDI_DS_RxMetaInfoType * pRxMetadata =
202 &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.rxMetaInfo;
203 return pRxMetadata;
204}
205
206
207WPT_STATIC WPT_INLINE WDI_DS_TxMetaInfoType* WDI_DS_ExtractTxMetaData (wpt_packet *pFrame)
208{
209 WDI_DS_TxMetaInfoType * pTxMetadata =
210 &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.txMetaInfo;
211 return pTxMetadata;
212}
213
214
215typedef void (*WDI_DS_TxCompleteCallback)(void *pContext, wpt_packet *pFrame);
216typedef void (*WDI_DS_RxPacketCallback) (void *pContext, wpt_packet *pFrame);
217typedef void (*WDI_DS_TxFlowControlCallback)(void *pContext, wpt_uint8 ac_mask);
Hanumantha Reddy Pothulae00a7e22015-09-15 20:11:30 +0530218typedef void (*WDI_DS_RxLogCallback)(wpt_uint8 logType);
Jeff Johnson295189b2012-06-20 16:38:30 -0700219
220
221
222/* DAL registration function.
223 * Parameters:
224 * pContext:Cookie that should be passed back to the caller along
225 * with the callback.
226 * pfnTxCompleteCallback:Callback function that is to be invoked to return
227 * packets which have been transmitted.
228 * pfnRxPacketCallback:Callback function that is to be invoked to deliver
229 * packets which have been received
230 * pfnTxFlowControlCallback:Callback function that is to be invoked to
231 * indicate/clear congestion.
232 *
233 * Return Value: SUCCESS Completed successfully.
234 * FAILURE_XXX Request was rejected due XXX Reason.
235 *
236 */
237WDI_Status WDI_DS_Register( void *pContext,
238 WDI_DS_TxCompleteCallback pfnTxCompleteCallback,
239 WDI_DS_RxPacketCallback pfnRxPacketCallback,
240 WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback,
Mihir Shete5affadc2015-05-29 20:54:57 +0530241 WDI_DS_RxLogCallback pfnRxLogCallback,
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 void *pCallbackContext);
243
244
245
246/* DAL Transmit function.
247 * Parameters:
248 * pContext:Cookie that should be passed back to the caller along with the callback.
249 * pFrame:Refernce to PAL frame.
250 * more: Does the invokee have more than one packet pending?
251 * Return Value: SUCCESS Completed successfully.
252 * FAILURE_XXX Request was rejected due XXX Reason.
253 *
254 */
255
256
257WDI_Status WDI_DS_TxPacket(void *pContext,
258 wpt_packet *pFrame,
259 wpt_boolean more);
260
261
262/* DAL Transmit Complete function.
263 * Parameters:
264 * pContext:Cookie that should be passed back to the caller along with the callback.
265 * ucTxResReq:TX resource number required by TL
266 * Return Value: SUCCESS Completed successfully.
267 * FAILURE_XXX Request was rejected due XXX Reason.
268 *
269 */
270
271
272WDI_Status WDI_DS_TxComplete(void *pContext, wpt_uint32 ucTxResReq);
273
274/* DAL Suspend Transmit function.
275 * Parameters:
276 * pContext:Cookie that should be passed back to the caller along with the callback.
277 * Return Value: SUCCESS Completed successfully.
278 * FAILURE_XXX Request was rejected due XXX Reason.
279 *
280 */
281
282
283WDI_Status WDI_DS_TxSuspend(void *pContext);
284
285
286/* DAL Resume Transmit function.
287 * Parameters:
288 * pContext:Cookie that should be passed back to the caller along with the callback.
289 * Return Value: SUCCESS Completed successfully.
290 * FAILURE_XXX Request was rejected due XXX Reason.
291 *
292 */
293
294
295WDI_Status WDI_DS_TxResume(void *pContext);
296
297/* DAL Get Reserved resource by STA
298 * Parameters:
299 * pContext:Cookie that should be passed back to the caller along with the callback.
300 * wdiResPool: MemPool, MGMT ot DATA
301 * staId: STA ID
302 * Return Value: Number of reserved resouce count
303 *
304 */
305wpt_uint32 WDI_DS_GetReservedResCountPerSTA(void *pContext,
306 WDI_ResPoolType wdiResPool,
307 wpt_uint8 staId);
308
309/* DAL ADD STA into memPool
310 * Parameters:
311 * pContext:Cookie that should be passed back to the caller along with the callback.
312 * staId: STA ID
313 * Return Value: SUCCESS or FAIL
314 *
315 */
316WDI_Status WDI_DS_AddSTAMemPool(void *pContext, wpt_uint8 staIndex);
317
318/* DAL Remove STA from memPool
319 * Parameters:
320 * pContext:Cookie that should be passed back to the caller along with the callback.
321 * staId: STA ID
322 * Return Value: SUCCESS or FAIL
323 *
324 */
325WDI_Status WDI_DS_DelSTAMemPool(void *pContext, wpt_uint8 staIndex);
326
327/* DAL Set STA index associated with BSS index.
328 * Parameters:
329 * pContext:Cookie that should be passed back to the caller along with the callback.
330 * bssIdx: BSS index
331 * staId: STA index associated with BSS index
332 * Return Status: Found empty slot
333 *
334 */
335WDI_Status WDI_DS_SetStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
336
337/* DAL Get STA index associated with BSS index.
338 * Parameters:
339 * pContext:Cookie that should be passed back to the caller along with the callback.
340 * bssIdx: BSS index
341 * staId: STA index associated with BSS index
342 * Return Status: Found empty slot
343 *
344 */
345WDI_Status WDI_DS_GetStaIdxFromBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 *staIdx);
346
347/* DAL Clear STA index associated with BSS index.
348 * Parameters:
349 * pContext:Cookie that should be passed back to the caller along with the callback.
350 * bssIdx: BSS index
351 * staId: STA index associated with BSS index
352 * Return Status: Found empty slot
353 *
354 */
355WDI_Status WDI_DS_ClearStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
356
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800357/* @brief: WDI_DS_GetTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800358 * This function should be invoked to fetch the current stats
359 * Parameters:
360 * pStats:Pointer to the collected stats
361 * len: length of buffer pointed to by pStats
362 * Return Status: None
363 */
364void WDI_DS_GetTrafficStats(WDI_TrafficStatsType** pStats, wpt_uint32 *len);
365
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800366/* @brief: WDI_DS_DeactivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800367 * This function should be invoked to deactivate traffic stats collection
368 * Parameters: None
369 * Return Status: None
370 */
371void WDI_DS_DeactivateTrafficStats(void);
372
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800373/* @brief: WDI_DS_ActivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800374 * This function should be invoked to activate traffic stats collection
375 * Parameters: None
376 * Return Status: None
377 */
378void WDI_DS_ActivateTrafficStats(void);
379
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800380/* @brief: WDI_DS_ClearTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800381 * This function should be invoked to clear all past stats
382 * Parameters: None
383 * Return Status: None
384 */
385void WDI_DS_ClearTrafficStats(void);
386
Mihir Shetecb352cd2015-05-25 10:58:59 +0530387void *WDI_DS_GetLoggingMbPhyAddr(void *pContext);
Mihir Shete5affadc2015-05-29 20:54:57 +0530388void *WDI_DS_GetLoggingMbAddr(void *pContext);
389void *WDI_DS_GetLoggingSession(void *pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700390#endif