blob: 4f88b99f6c05c4f754519a0c5992e4479ff15160 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Sravan Kumar Kairamd9e8cbb2017-01-17 12:17:28 +05302 * Copyright (c) 2012-2013, 2016-2017 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
Sravan Kumar Kairamd9e8cbb2017-01-17 12:17:28 +053056 wpt_uint8 isWai:1; //WAPI 0 - not WAI 1 WAI
57 wpt_uint8 isArp:1; //0 - not ARP 1 - ARP
Jeff Johnson295189b2012-06-20 16:38:30 -070058 wpt_uint8 fdisableFrmXlt:1; //0 - Let ADU do FT. 1 - bypass ADU FT
59 wpt_uint8 qosEnabled:1; //0 - non-Qos 1 - Qos
60 wpt_uint8 fenableWDS:1; //0 - not WDS 1 WDS
Sravan Kumar Kairamd9e8cbb2017-01-17 12:17:28 +053061 wpt_uint8 reserved1:2;
Jeff Johnson295189b2012-06-20 16:38:30 -070062 wpt_uint8 typeSubtype;
63 wpt_uint8 fUP;
64 wpt_uint8 fSTAMACAddress[6];
65 wpt_uint8 addr2MACAddress[6];
66 wpt_uint8 frmType;
67 wpt_uint8 fStaType;
Chet Lanctot4b088622013-05-22 16:09:22 -070068 wpt_uint8 fProtMgmtFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -070069 wpt_uint16 fPktlen;
70 wpt_status txCompleteStatus;
Kumar Anand90ca3dd2013-01-18 15:24:47 -080071 wpt_uint8 staIdx;
Ganesh Kondabattini10e67352015-03-16 17:41:57 +053072 wpt_uint32 txBdToken;
Jeff Johnson295189b2012-06-20 16:38:30 -070073} WDI_DS_TxMetaInfoType;
74
75
76typedef enum
77{
78 WDI_DS_OPCODE_INVALID = 0,
79 WDI_DS_OPCODE_QCUR_FWDBUF = 1,
80 WDI_DS_OPCODE_FWDBUF_FWDCUR = 2,
81 WDI_DS_OPCODE_QCUR = 3,
82 WDI_DS_OPCODE_FWDBUF_QUEUECUR = 4,
83 WDI_DS_OPCODE_FWDBUF_DROPCUR = 5,
84 WDI_DS_OPCODE_FWDALL_DROPCUR = 6,
85 WDI_DS_OPCODE_FWDALL_QCUR = 7,
86 WDI_DS_OPCODE_TEARDOWN = 8,
87 WDI_DS_OPCODE_DROPCUR = 9,
88 WDI_DS_OPCODE_MAX
89}WDI_DS_BAOpCodeEnumType;
90
Mihir Sheteccafc0c2015-04-17 16:13:15 +053091#define WDI_DS_LOG_PKT_TYPE_LEN 4
Mihir Shete2187b8c2015-03-18 16:54:29 +053092typedef enum
93{
94 WDI_DS_PACKET_LOG = 1<<0,
95
96 // Insert new values before this
97
98 // If the value of WDI_DS_MAX LOG is increased please
99 // make sure to change the data type of
100 // WDI_DS_RxMetaInfoType.loggingData from wpt_uint8
101 // to accommodate more values
Mihir Sheteccafc0c2015-04-17 16:13:15 +0530102 WDI_DS_MAX_LOG = 1<<31
Mihir Shete2187b8c2015-03-18 16:54:29 +0530103}WDI_DS_LoggingDataEnumType;
104
Jeff Johnson295189b2012-06-20 16:38:30 -0700105typedef struct
106{
107 wpt_uint8 staId;
108 wpt_uint8 addr3Idx;
109 wpt_uint8 rxChannel;
110 wpt_uint8 type:2;
111 wpt_uint8 subtype:4;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -0700112 wpt_uint8 rfBand:2;
Jeff Johnson295189b2012-06-20 16:38:30 -0700113
114 wpt_uint16 rtsf:1; //For beacon only. 1 ~V Riva TSF is bigger(later) than the one received
115 wpt_uint16 bsf:1; //1 Riva sends the last beacon, 0 not.
116 wpt_uint16 unknownUcastPkt:1; //1 ~V unicast frame received with unknown A2
117 wpt_uint16 scan:1; //1 frame received in scan state. 0 not.
118 wpt_uint16 dpuSig:3; //DPU signature
119 wpt_uint16 ft:1; //0~Wframe translation is not done. 1~Wdone
120 wpt_uint16 ne:1; //1 ~V frame is not encrypted OTA. This is for WAPI~Rs WAI packet.
121 wpt_uint16 llcr:1; // Has the LLC been stripped by H/W
122 wpt_uint16 bcast:1; //0 ~V unicast frame 1 ~V broadcast/multicast frame
123 wpt_uint16 tid:4;
124 wpt_uint16 reserved1:1;
125 wpt_uint8 dpuFeedback;
126 wpt_int8 snr;
127
128 wpt_uint32 currentPktSeqNo:12; /*current sequence number */
129 wpt_uint32 ampdu_reorderOpcode:4;
130 wpt_uint32 ampdu_reorderSlotIdx:6;
131 wpt_uint32 ampdu_reorderFwdIdx:6;
132 wpt_uint32 reserved3:4;
133
134 wpt_uint16 amsdu_size;
135 wpt_uint32 amsdu_asf:1;
136 wpt_uint32 amsdu_esf:1;
137 wpt_uint32 amsdu_lsf:1;
138 wpt_uint32 amsdu_aef:1;
139 wpt_uint32 reserved2:4;
140
141 wpt_uint8 *mpduHeaderPtr;
142 wpt_uint8 *mpduDataPtr;
143 wpt_uint32 mpduLength;
144 wpt_uint32 mpduHeaderLength;
145
146 wpt_uint32 rateIndex;
147 wpt_uint32 rxpFlags;
148 wpt_uint32 mclkRxTimestamp;
149
150 //Flow control frames
151 wpt_uint8 fc;
152 wpt_uint32 fcSTATxQStatus:16;
153 wpt_uint32 fcSTAThreshIndMask:16;
154 wpt_uint32 fcSTAPwrSaveStateMask:16;
155 wpt_uint32 fcSTAValidMask:16;
156
157 wpt_uint16 fcStaTxDisabledBitmap;
158 wpt_uint8 fcSTATxQLen[12]; // one byte per STA.
159 wpt_uint8 fcSTACurTxRate[12]; // current Tx rate for each sta.
160
161 wpt_uint64 replayCount;
162
163 wpt_uint32 rssi0;
164 wpt_uint32 rssi1;
Chet Lanctot186b5732013-03-18 10:26:30 -0700165
166#ifdef WLAN_FEATURE_11W
167 wpt_uint32 rmf:1;
168#endif
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700169#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
170 wpt_uint32 offloadScanLearn;
171 wpt_uint32 roamCandidateInd;
Kapil Gupta04ab1992016-06-26 13:36:51 +0530172 wpt_uint32 perRoamCndInd;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700173#endif
Dino Mycle41bdc942014-06-10 11:30:24 +0530174#ifdef WLAN_FEATURE_EXTSCAN
175 wpt_uint32 extscanBuffer;
176#endif
Mihir Sheteccafc0c2015-04-17 16:13:15 +0530177 wpt_uint32 loggingData;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530178 wpt_uint32 indType;
Jeff Johnson295189b2012-06-20 16:38:30 -0700179} WDI_DS_RxMetaInfoType;
180
181typedef struct sPktMetaInfo
182{
183 union
184 {
185 WDI_DS_TxMetaInfoType txMetaInfo;
186 WDI_DS_RxMetaInfoType rxMetaInfo;
187 } u;
188} WDI_DS_MetaInfoType;
189
Mihir Shete5affadc2015-05-29 20:54:57 +0530190typedef struct
191{
Sravan Kumar Kairam80d06ee2015-09-28 12:53:20 +0530192 wpt_uint16 status;
Mihir Shete5affadc2015-05-29 20:54:57 +0530193 wpt_boolean active;
194 wpt_uint64 logBuffAddress[MAX_NUM_OF_BUFFER];
195 wpt_uint32 logBuffLength[MAX_NUM_OF_BUFFER];
Karthick Sa6616c32015-07-22 14:49:02 +0530196 /* Log type i.e. Mgmt frame = 0, QXDM = 1, FW Mem dump = 2 */
197 wpt_uint8 logType;
198 /* Indicate if Last segment of log is received*/
199 wpt_boolean done;
Hanumantha Reddy Pothulae00a7e22015-09-15 20:11:30 +0530200 wpt_uint16 reasonCode;
Mihir Shete5affadc2015-05-29 20:54:57 +0530201} WDI_DS_LoggingSessionType;
202
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530203
204/*----------------------------------------------------------------------------
205 * WDI_AddStaParams
206 * -------------------------------------------------------------------------*/
207typedef struct
208{
209 wpt_uint8 ucSTAIdx;
210 wpt_uint8 ucWmmEnabled;
211 wpt_uint8 ucHTCapable;
212
213 /* MAC Address of STA */
214 wpt_macAddr staMacAddr;
215
216 /*MAC Address of the BSS*/
217 wpt_macAddr macBSSID;
218
219 /* Field to indicate if this is sta entry for itself STA adding entry for itself
220 * or remote (AP adding STA after successful association.
221 * This may or may not be required in production driver.
222 * 0 - Self, 1 other/remote, 2 - bssid
223 */
224 wpt_uint8 ucStaType;
225
226
227 /*DPU Information*/
228 wpt_uint8 dpuIndex; // DPU table index
229 wpt_uint8 dpuSig; // DPU signature
230 wpt_uint8 bcastDpuIndex;
231 wpt_uint8 bcastDpuSignature;
232 wpt_uint8 bcastMgmtDpuIndex;
233 wpt_uint8 bcastMgmtDpuSignature;
234
235
236 /*RMF enabled/disabled*/
237 wpt_uint8 ucRmfEnabled;
238
239 /* Index into the BSS Session table */
240 wpt_uint8 ucBSSIdx;
241
242}WDI_AddStaParams;
243
244
Jeff Johnson295189b2012-06-20 16:38:30 -0700245WPT_STATIC WPT_INLINE WDI_DS_RxMetaInfoType* WDI_DS_ExtractRxMetaData (wpt_packet *pFrame)
246{
247 WDI_DS_RxMetaInfoType * pRxMetadata =
248 &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.rxMetaInfo;
249 return pRxMetadata;
250}
251
252
253WPT_STATIC WPT_INLINE WDI_DS_TxMetaInfoType* WDI_DS_ExtractTxMetaData (wpt_packet *pFrame)
254{
255 WDI_DS_TxMetaInfoType * pTxMetadata =
256 &((WDI_DS_MetaInfoType *)WPAL_PACKET_GET_METAINFO_POINTER(pFrame))->u.txMetaInfo;
257 return pTxMetadata;
258}
259
260
261typedef void (*WDI_DS_TxCompleteCallback)(void *pContext, wpt_packet *pFrame);
262typedef void (*WDI_DS_RxPacketCallback) (void *pContext, wpt_packet *pFrame);
263typedef void (*WDI_DS_TxFlowControlCallback)(void *pContext, wpt_uint8 ac_mask);
Hanumantha Reddy Pothulae00a7e22015-09-15 20:11:30 +0530264typedef void (*WDI_DS_RxLogCallback)(wpt_uint8 logType);
Jeff Johnson295189b2012-06-20 16:38:30 -0700265
266
267
268/* DAL registration function.
269 * Parameters:
270 * pContext:Cookie that should be passed back to the caller along
271 * with the callback.
272 * pfnTxCompleteCallback:Callback function that is to be invoked to return
273 * packets which have been transmitted.
274 * pfnRxPacketCallback:Callback function that is to be invoked to deliver
275 * packets which have been received
276 * pfnTxFlowControlCallback:Callback function that is to be invoked to
277 * indicate/clear congestion.
278 *
279 * Return Value: SUCCESS Completed successfully.
280 * FAILURE_XXX Request was rejected due XXX Reason.
281 *
282 */
283WDI_Status WDI_DS_Register( void *pContext,
284 WDI_DS_TxCompleteCallback pfnTxCompleteCallback,
285 WDI_DS_RxPacketCallback pfnRxPacketCallback,
286 WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback,
Mihir Shete5affadc2015-05-29 20:54:57 +0530287 WDI_DS_RxLogCallback pfnRxLogCallback,
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 void *pCallbackContext);
289
290
291
292/* DAL Transmit function.
293 * Parameters:
294 * pContext:Cookie that should be passed back to the caller along with the callback.
295 * pFrame:Refernce to PAL frame.
296 * more: Does the invokee have more than one packet pending?
297 * Return Value: SUCCESS Completed successfully.
298 * FAILURE_XXX Request was rejected due XXX Reason.
299 *
300 */
301
302
303WDI_Status WDI_DS_TxPacket(void *pContext,
304 wpt_packet *pFrame,
305 wpt_boolean more);
306
307
308/* DAL Transmit Complete function.
309 * Parameters:
310 * pContext:Cookie that should be passed back to the caller along with the callback.
311 * ucTxResReq:TX resource number required by TL
312 * Return Value: SUCCESS Completed successfully.
313 * FAILURE_XXX Request was rejected due XXX Reason.
314 *
315 */
316
317
318WDI_Status WDI_DS_TxComplete(void *pContext, wpt_uint32 ucTxResReq);
319
320/* DAL Suspend Transmit function.
321 * Parameters:
322 * pContext:Cookie that should be passed back to the caller along with the callback.
323 * Return Value: SUCCESS Completed successfully.
324 * FAILURE_XXX Request was rejected due XXX Reason.
325 *
326 */
327
328
329WDI_Status WDI_DS_TxSuspend(void *pContext);
330
331
332/* DAL Resume Transmit function.
333 * Parameters:
334 * pContext:Cookie that should be passed back to the caller along with the callback.
335 * Return Value: SUCCESS Completed successfully.
336 * FAILURE_XXX Request was rejected due XXX Reason.
337 *
338 */
339
340
341WDI_Status WDI_DS_TxResume(void *pContext);
342
343/* DAL Get Reserved resource by STA
344 * Parameters:
345 * pContext:Cookie that should be passed back to the caller along with the callback.
346 * wdiResPool: MemPool, MGMT ot DATA
347 * staId: STA ID
348 * Return Value: Number of reserved resouce count
349 *
350 */
351wpt_uint32 WDI_DS_GetReservedResCountPerSTA(void *pContext,
352 WDI_ResPoolType wdiResPool,
353 wpt_uint8 staId);
354
355/* DAL ADD STA into memPool
356 * Parameters:
357 * pContext:Cookie that should be passed back to the caller along with the callback.
358 * staId: STA ID
359 * Return Value: SUCCESS or FAIL
360 *
361 */
362WDI_Status WDI_DS_AddSTAMemPool(void *pContext, wpt_uint8 staIndex);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530363/**
364 @brief WDI_STATableFindStaidByAddr - Given a station mac address, search
365 for the corresponding station index from the Station Table.
366
367 @param pWDICtx: Context pointer
368staAddr: station address
369pucStaId: output station id
370
371@see
372@return Result of the function call
373*/
374WDI_Status
375WDI_STATableFindStaidByAddr
376(
377 void* pWDICtx,
378 wpt_macAddr staAddr,
379 wpt_uint8* pucStaId
380 );
381
382/**
383 * @brief WDI_STATableAddSta - Function to Add Station
384 *
385 *
386 * @param pWDICtx: pointer to the WLAN DAL context
387 * pwdiParam: station parameters
388 *
389 * @see
390 * @return Result of the function call
391 * */
392WDI_Status
393WDI_STATableAddSta
394(
395 void* pWDICtx,
396 WDI_AddStaParams* pwdiParam
397 );
398
399
400/**
401 * @brief WDI_STATableDelSta - Function to Delete a Station
402 *
403 *
404 * @param pWDICtx: pointer to the WLAN DAL context
405 * ucSTAIdx: station to be deleted
406 *
407 * @see
408 * @return Result of the function call
409 */
410WDI_Status
411WDI_STATableDelSta
412(
413 void* pWDICtx,
414 wpt_uint8 ucSTAIdx
415 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700416
417/* DAL Remove STA from memPool
418 * Parameters:
419 * pContext:Cookie that should be passed back to the caller along with the callback.
420 * staId: STA ID
421 * Return Value: SUCCESS or FAIL
422 *
423 */
424WDI_Status WDI_DS_DelSTAMemPool(void *pContext, wpt_uint8 staIndex);
425
426/* DAL Set STA index associated with BSS index.
427 * Parameters:
428 * pContext:Cookie that should be passed back to the caller along with the callback.
429 * bssIdx: BSS index
430 * staId: STA index associated with BSS index
431 * Return Status: Found empty slot
432 *
433 */
434WDI_Status WDI_DS_SetStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
435
436/* DAL Get STA index associated with BSS index.
437 * Parameters:
438 * pContext:Cookie that should be passed back to the caller along with the callback.
439 * bssIdx: BSS index
440 * staId: STA index associated with BSS index
441 * Return Status: Found empty slot
442 *
443 */
444WDI_Status WDI_DS_GetStaIdxFromBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 *staIdx);
445
446/* DAL Clear STA index associated with BSS index.
447 * Parameters:
448 * pContext:Cookie that should be passed back to the caller along with the callback.
449 * bssIdx: BSS index
450 * staId: STA index associated with BSS index
451 * Return Status: Found empty slot
452 *
453 */
454WDI_Status WDI_DS_ClearStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx);
455
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800456/* @brief: WDI_DS_GetTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800457 * This function should be invoked to fetch the current stats
458 * Parameters:
459 * pStats:Pointer to the collected stats
460 * len: length of buffer pointed to by pStats
461 * Return Status: None
462 */
463void WDI_DS_GetTrafficStats(WDI_TrafficStatsType** pStats, wpt_uint32 *len);
464
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800465/* @brief: WDI_DS_DeactivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800466 * This function should be invoked to deactivate traffic stats collection
467 * Parameters: None
468 * Return Status: None
469 */
470void WDI_DS_DeactivateTrafficStats(void);
471
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800472/* @brief: WDI_DS_ActivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800473 * This function should be invoked to activate traffic stats collection
474 * Parameters: None
475 * Return Status: None
476 */
477void WDI_DS_ActivateTrafficStats(void);
478
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800479/* @brief: WDI_DS_ClearTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800480 * This function should be invoked to clear all past stats
481 * Parameters: None
482 * Return Status: None
483 */
484void WDI_DS_ClearTrafficStats(void);
485
Mihir Shetecb352cd2015-05-25 10:58:59 +0530486void *WDI_DS_GetLoggingMbPhyAddr(void *pContext);
Mihir Shete5affadc2015-05-29 20:54:57 +0530487void *WDI_DS_GetLoggingMbAddr(void *pContext);
488void *WDI_DS_GetLoggingSession(void *pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700489#endif