blob: e3be91a84f22e28a01218ade08651a502ef43afa [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kapil Gupta04ab1992016-06-26 13:36:51 +05302 * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
Kiet Lam1ed83fc2014-02-19 01:15:45 -08003 *
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;
Kapil Gupta04ab1992016-06-26 13:36:51 +0530171 wpt_uint32 perRoamCndInd;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700172#endif
Dino Mycle41bdc942014-06-10 11:30:24 +0530173#ifdef WLAN_FEATURE_EXTSCAN
174 wpt_uint32 extscanBuffer;
175#endif
Mihir Sheteccafc0c2015-04-17 16:13:15 +0530176 wpt_uint32 loggingData;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530177 wpt_uint32 indType;
Jeff Johnson295189b2012-06-20 16:38:30 -0700178} WDI_DS_RxMetaInfoType;
179
180typedef struct sPktMetaInfo
181{
182 union
183 {
184 WDI_DS_TxMetaInfoType txMetaInfo;
185 WDI_DS_RxMetaInfoType rxMetaInfo;
186 } u;
187} WDI_DS_MetaInfoType;
188
Mihir Shete5affadc2015-05-29 20:54:57 +0530189typedef struct
190{
Sravan Kumar Kairam80d06ee2015-09-28 12:53:20 +0530191 wpt_uint16 status;
Mihir Shete5affadc2015-05-29 20:54:57 +0530192 wpt_boolean active;
193 wpt_uint64 logBuffAddress[MAX_NUM_OF_BUFFER];
194 wpt_uint32 logBuffLength[MAX_NUM_OF_BUFFER];
Karthick Sa6616c32015-07-22 14:49:02 +0530195 /* Log type i.e. Mgmt frame = 0, QXDM = 1, FW Mem dump = 2 */
196 wpt_uint8 logType;
197 /* Indicate if Last segment of log is received*/
198 wpt_boolean done;
Hanumantha Reddy Pothulae00a7e22015-09-15 20:11:30 +0530199 wpt_uint16 reasonCode;
Mihir Shete5affadc2015-05-29 20:54:57 +0530200} WDI_DS_LoggingSessionType;
201
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530202
203/*----------------------------------------------------------------------------
204 * WDI_AddStaParams
205 * -------------------------------------------------------------------------*/
206typedef struct
207{
208 wpt_uint8 ucSTAIdx;
209 wpt_uint8 ucWmmEnabled;
210 wpt_uint8 ucHTCapable;
211
212 /* MAC Address of STA */
213 wpt_macAddr staMacAddr;
214
215 /*MAC Address of the BSS*/
216 wpt_macAddr macBSSID;
217
218 /* Field to indicate if this is sta entry for itself STA adding entry for itself
219 * or remote (AP adding STA after successful association.
220 * This may or may not be required in production driver.
221 * 0 - Self, 1 other/remote, 2 - bssid
222 */
223 wpt_uint8 ucStaType;
224
225
226 /*DPU Information*/
227 wpt_uint8 dpuIndex; // DPU table index
228 wpt_uint8 dpuSig; // DPU signature
229 wpt_uint8 bcastDpuIndex;
230 wpt_uint8 bcastDpuSignature;
231 wpt_uint8 bcastMgmtDpuIndex;
232 wpt_uint8 bcastMgmtDpuSignature;
233
234
235 /*RMF enabled/disabled*/
236 wpt_uint8 ucRmfEnabled;
237
238 /* Index into the BSS Session table */
239 wpt_uint8 ucBSSIdx;
240
241}WDI_AddStaParams;
242
243
Jeff Johnson295189b2012-06-20 16:38:30 -0700244WPT_STATIC WPT_INLINE WDI_DS_RxMetaInfoType* WDI_DS_ExtractRxMetaData (wpt_packet *pFrame)
245{
246 WDI_DS_RxMetaInfoType * pRxMetadata =
247 &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.rxMetaInfo;
248 return pRxMetadata;
249}
250
251
252WPT_STATIC WPT_INLINE WDI_DS_TxMetaInfoType* WDI_DS_ExtractTxMetaData (wpt_packet *pFrame)
253{
254 WDI_DS_TxMetaInfoType * pTxMetadata =
255 &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.txMetaInfo;
256 return pTxMetadata;
257}
258
259
260typedef void (*WDI_DS_TxCompleteCallback)(void *pContext, wpt_packet *pFrame);
261typedef void (*WDI_DS_RxPacketCallback) (void *pContext, wpt_packet *pFrame);
262typedef void (*WDI_DS_TxFlowControlCallback)(void *pContext, wpt_uint8 ac_mask);
Hanumantha Reddy Pothulae00a7e22015-09-15 20:11:30 +0530263typedef void (*WDI_DS_RxLogCallback)(wpt_uint8 logType);
Jeff Johnson295189b2012-06-20 16:38:30 -0700264
265
266
267/* DAL registration function.
268 * Parameters:
269 * pContext:Cookie that should be passed back to the caller along
270 * with the callback.
271 * pfnTxCompleteCallback:Callback function that is to be invoked to return
272 * packets which have been transmitted.
273 * pfnRxPacketCallback:Callback function that is to be invoked to deliver
274 * packets which have been received
275 * pfnTxFlowControlCallback:Callback function that is to be invoked to
276 * indicate/clear congestion.
277 *
278 * Return Value: SUCCESS Completed successfully.
279 * FAILURE_XXX Request was rejected due XXX Reason.
280 *
281 */
282WDI_Status WDI_DS_Register( void *pContext,
283 WDI_DS_TxCompleteCallback pfnTxCompleteCallback,
284 WDI_DS_RxPacketCallback pfnRxPacketCallback,
285 WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback,
Mihir Shete5affadc2015-05-29 20:54:57 +0530286 WDI_DS_RxLogCallback pfnRxLogCallback,
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 void *pCallbackContext);
288
289
290
291/* DAL Transmit function.
292 * Parameters:
293 * pContext:Cookie that should be passed back to the caller along with the callback.
294 * pFrame:Refernce to PAL frame.
295 * more: Does the invokee have more than one packet pending?
296 * Return Value: SUCCESS Completed successfully.
297 * FAILURE_XXX Request was rejected due XXX Reason.
298 *
299 */
300
301
302WDI_Status WDI_DS_TxPacket(void *pContext,
303 wpt_packet *pFrame,
304 wpt_boolean more);
305
306
307/* DAL Transmit Complete function.
308 * Parameters:
309 * pContext:Cookie that should be passed back to the caller along with the callback.
310 * ucTxResReq:TX resource number required by TL
311 * Return Value: SUCCESS Completed successfully.
312 * FAILURE_XXX Request was rejected due XXX Reason.
313 *
314 */
315
316
317WDI_Status WDI_DS_TxComplete(void *pContext, wpt_uint32 ucTxResReq);
318
319/* DAL Suspend Transmit function.
320 * Parameters:
321 * pContext:Cookie that should be passed back to the caller along with the callback.
322 * Return Value: SUCCESS Completed successfully.
323 * FAILURE_XXX Request was rejected due XXX Reason.
324 *
325 */
326
327
328WDI_Status WDI_DS_TxSuspend(void *pContext);
329
330
331/* DAL Resume Transmit function.
332 * Parameters:
333 * pContext:Cookie that should be passed back to the caller along with the callback.
334 * Return Value: SUCCESS Completed successfully.
335 * FAILURE_XXX Request was rejected due XXX Reason.
336 *
337 */
338
339
340WDI_Status WDI_DS_TxResume(void *pContext);
341
342/* DAL Get Reserved resource by STA
343 * Parameters:
344 * pContext:Cookie that should be passed back to the caller along with the callback.
345 * wdiResPool: MemPool, MGMT ot DATA
346 * staId: STA ID
347 * Return Value: Number of reserved resouce count
348 *
349 */
350wpt_uint32 WDI_DS_GetReservedResCountPerSTA(void *pContext,
351 WDI_ResPoolType wdiResPool,
352 wpt_uint8 staId);
353
354/* DAL ADD STA into memPool
355 * Parameters:
356 * pContext:Cookie that should be passed back to the caller along with the callback.
357 * staId: STA ID
358 * Return Value: SUCCESS or FAIL
359 *
360 */
361WDI_Status WDI_DS_AddSTAMemPool(void *pContext, wpt_uint8 staIndex);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530362/**
363 @brief WDI_STATableFindStaidByAddr - Given a station mac address, search
364 for the corresponding station index from the Station Table.
365
366 @param pWDICtx: Context pointer
367staAddr: station address
368pucStaId: output station id
369
370@see
371@return Result of the function call
372*/
373WDI_Status
374WDI_STATableFindStaidByAddr
375(
376 void* pWDICtx,
377 wpt_macAddr staAddr,
378 wpt_uint8* pucStaId
379 );
380
381/**
382 * @brief WDI_STATableAddSta - Function to Add Station
383 *
384 *
385 * @param pWDICtx: pointer to the WLAN DAL context
386 * pwdiParam: station parameters
387 *
388 * @see
389 * @return Result of the function call
390 * */
391WDI_Status
392WDI_STATableAddSta
393(
394 void* pWDICtx,
395 WDI_AddStaParams* pwdiParam
396 );
397
398
399/**
400 * @brief WDI_STATableDelSta - Function to Delete a Station
401 *
402 *
403 * @param pWDICtx: pointer to the WLAN DAL context
404 * ucSTAIdx: station to be deleted
405 *
406 * @see
407 * @return Result of the function call
408 */
409WDI_Status
410WDI_STATableDelSta
411(
412 void* pWDICtx,
413 wpt_uint8 ucSTAIdx
414 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700415
416/* DAL Remove STA from memPool
417 * Parameters:
418 * pContext:Cookie that should be passed back to the caller along with the callback.
419 * staId: STA ID
420 * Return Value: SUCCESS or FAIL
421 *
422 */
423WDI_Status WDI_DS_DelSTAMemPool(void *pContext, wpt_uint8 staIndex);
424
425/* DAL Set STA index associated with BSS index.
426 * Parameters:
427 * pContext:Cookie that should be passed back to the caller along with the callback.
428 * bssIdx: BSS index
429 * staId: STA index associated with BSS index
430 * Return Status: Found empty slot
431 *
432 */
433WDI_Status WDI_DS_SetStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
434
435/* DAL Get STA index associated with BSS index.
436 * Parameters:
437 * pContext:Cookie that should be passed back to the caller along with the callback.
438 * bssIdx: BSS index
439 * staId: STA index associated with BSS index
440 * Return Status: Found empty slot
441 *
442 */
443WDI_Status WDI_DS_GetStaIdxFromBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 *staIdx);
444
445/* DAL Clear STA index associated with BSS index.
446 * Parameters:
447 * pContext:Cookie that should be passed back to the caller along with the callback.
448 * bssIdx: BSS index
449 * staId: STA index associated with BSS index
450 * Return Status: Found empty slot
451 *
452 */
453WDI_Status WDI_DS_ClearStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
454
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800455/* @brief: WDI_DS_GetTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800456 * This function should be invoked to fetch the current stats
457 * Parameters:
458 * pStats:Pointer to the collected stats
459 * len: length of buffer pointed to by pStats
460 * Return Status: None
461 */
462void WDI_DS_GetTrafficStats(WDI_TrafficStatsType** pStats, wpt_uint32 *len);
463
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800464/* @brief: WDI_DS_DeactivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800465 * This function should be invoked to deactivate traffic stats collection
466 * Parameters: None
467 * Return Status: None
468 */
469void WDI_DS_DeactivateTrafficStats(void);
470
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800471/* @brief: WDI_DS_ActivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800472 * This function should be invoked to activate traffic stats collection
473 * Parameters: None
474 * Return Status: None
475 */
476void WDI_DS_ActivateTrafficStats(void);
477
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800478/* @brief: WDI_DS_ClearTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800479 * This function should be invoked to clear all past stats
480 * Parameters: None
481 * Return Status: None
482 */
483void WDI_DS_ClearTrafficStats(void);
484
Mihir Shetecb352cd2015-05-25 10:58:59 +0530485void *WDI_DS_GetLoggingMbPhyAddr(void *pContext);
Mihir Shete5affadc2015-05-29 20:54:57 +0530486void *WDI_DS_GetLoggingMbAddr(void *pContext);
487void *WDI_DS_GetLoggingSession(void *pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700488#endif