blob: ac4512a83cd8c0c89f26a18b65459d3b9278a5a0 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Sravan Kumar Kairamd9e8cbb2017-01-17 12:17:28 +05302 * Copyright (c) 2012-2013, 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/**=========================================================================
29 *
30 * \file wlan_qct_wdi_ds.c
31 *
32 * \brief define Dataservice API
33 *
34 * WLAN Device Abstraction layer External API for Dataservice
35 * DESCRIPTION
36 * This file contains the external API implemntation exposed by the
37 * wlan device abstarction layer module.
38 *
Jeff Johnson295189b2012-06-20 16:38:30 -070039 */
40
41
42#include "wlan_qct_wdi.h"
43#include "wlan_qct_wdi_i.h"
44#include "wlan_qct_wdi_ds.h"
45#include "wlan_qct_wdi_ds_i.h"
46#include "wlan_qct_wdi_dts.h"
47#include "wlan_qct_wdi_dp.h"
48#include "wlan_qct_wdi_sta.h"
49
50
51
52
53/* DAL registration function.
54 * Parameters:
55 * pContext:Cookie that should be passed back to the caller along
56 * with the callback.
57 * pfnTxCompleteCallback:Callback function that is to be invoked to return
58 * packets which have been transmitted.
59 * pfnRxPacketCallback:Callback function that is to be invoked to deliver
60 * packets which have been received
61 * pfnTxFlowControlCallback:Callback function that is to be invoked to
62 * indicate/clear congestion.
63 *
64 * Return Value: SUCCESS Completed successfully.
65 * FAILURE_XXX Request was rejected due XXX Reason.
66 *
67 */
68WDI_Status WDI_DS_Register( void *pContext,
69 WDI_DS_TxCompleteCallback pfnTxCompleteCallback,
70 WDI_DS_RxPacketCallback pfnRxPacketCallback,
71 WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback,
Mihir Shete5affadc2015-05-29 20:54:57 +053072 WDI_DS_RxLogCallback pfnRxLogCallback,
Jeff Johnson295189b2012-06-20 16:38:30 -070073 void *pCallbackContext)
74{
75 WDI_DS_ClientDataType *pClientData;
76 wpt_uint8 bssLoop;
77
78 // Do Sanity checks
79 if (NULL == pContext ||
80 NULL == pCallbackContext ||
81 NULL == pfnTxCompleteCallback ||
82 NULL == pfnRxPacketCallback ||
83 NULL == pfnTxFlowControlCallback) {
84 return WDI_STATUS_E_FAILURE;
85 }
86
87 pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext);
88 if (NULL == pClientData)
89 {
90 return WDI_STATUS_MEM_FAILURE;
91 }
92
93 // Store callbacks in client structure
94 pClientData->pcontext = pContext;
95 pClientData->receiveFrameCB = pfnRxPacketCallback;
96 pClientData->txCompleteCB = pfnTxCompleteCallback;
97 pClientData->txResourceCB = pfnTxFlowControlCallback;
Mihir Shete5affadc2015-05-29 20:54:57 +053098 pClientData->rxLogCB = pfnRxLogCallback;
Jeff Johnson295189b2012-06-20 16:38:30 -070099 pClientData->pCallbackContext = pCallbackContext;
100
101 for(bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++)
102 {
103 pClientData->staIdxPerBssIdxTable[bssLoop].isUsed = 0;
104 pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx = WDI_DS_INDEX_INVALID;
105 pClientData->staIdxPerBssIdxTable[bssLoop].staIdx = WDI_DS_INDEX_INVALID;
106 }
107 return WDI_STATUS_SUCCESS;
108}
109
110
111
112/* DAL Transmit function.
113 * Parameters:
114 * pContext:Cookie that should be passed back to the caller along with the callback.
115 * pFrame:Refernce to PAL frame.
116 * more: Does the invokee have more than one packet pending?
117 * Return Value: SUCCESS Completed successfully.
118 * FAILURE_XXX Request was rejected due XXX Reason.
119 *
120 */
121
122
123WDI_Status WDI_DS_TxPacket(void *pContext,
124 wpt_packet *pFrame,
125 wpt_boolean more)
126{
127 WDI_DS_ClientDataType *pClientData;
128 wpt_uint8 ucSwFrameTXXlation;
129 wpt_uint8 ucUP;
130 wpt_uint8 ucTypeSubtype;
Kiet Lam9b11b012013-10-24 11:43:30 +0530131 wpt_uint8 isEapol;
Sravan Kumar Kairamd9e8cbb2017-01-17 12:17:28 +0530132 wpt_uint8 isArp;
Jeff Johnson295189b2012-06-20 16:38:30 -0700133 wpt_uint8 alignment;
Chandrasekaran Manishekar7218fa22014-06-26 10:34:25 +0530134 wpt_uint32 ucTxFlag;
Chet Lanctot4b088622013-05-22 16:09:22 -0700135 wpt_uint8 ucProtMgmtFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -0700136 wpt_uint8* pSTAMACAddress;
137 wpt_uint8* pAddr2MACAddress;
138 WDI_DS_TxMetaInfoType *pTxMetadata;
139 void *physBDHeader, *pvBDHeader;
140 wpt_uint8 ucType;
141 WDI_DS_BdMemPoolType *pMemPool;
142 wpt_uint8 ucBdPoolType;
143 wpt_uint8 staId;
Yue Maf74c9862013-03-21 16:36:15 -0700144 WDI_Status wdiStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700145
146 // Do Sanity checks
147 if (NULL == pContext)
148 {
149 return WDI_STATUS_E_FAILURE;
150 }
151
152 pClientData = (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
153 if (NULL == pClientData || pClientData->suspend)
154 {
155 return WDI_STATUS_E_FAILURE;
156 }
157
158 // extract metadata from PAL packet
159 pTxMetadata = WDI_DS_ExtractTxMetaData(pFrame);
160 ucSwFrameTXXlation = pTxMetadata->fdisableFrmXlt;
161 ucTypeSubtype = pTxMetadata->typeSubtype;
162 ucUP = pTxMetadata->fUP;
Kiet Lam9b11b012013-10-24 11:43:30 +0530163 isEapol = pTxMetadata->isEapol;
Sravan Kumar Kairamd9e8cbb2017-01-17 12:17:28 +0530164 isArp = pTxMetadata->isArp;
Jeff Johnson295189b2012-06-20 16:38:30 -0700165 ucTxFlag = pTxMetadata->txFlags;
Chet Lanctot4b088622013-05-22 16:09:22 -0700166 ucProtMgmtFrame = pTxMetadata->fProtMgmtFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -0700167 pSTAMACAddress = &(pTxMetadata->fSTAMACAddress[0]);
168 pAddr2MACAddress = &(pTxMetadata->addr2MACAddress[0]);
169
170 /*------------------------------------------------------------------------
171 Get type and subtype of the frame first
172 ------------------------------------------------------------------------*/
173 ucType = (ucTypeSubtype & WDI_FRAME_TYPE_MASK) >> WDI_FRAME_TYPE_OFFSET;
174 switch(ucType)
175 {
176 case WDI_MAC_DATA_FRAME:
Hoonki Leee10ce392013-02-26 11:47:00 -0800177#ifdef FEATURE_WLAN_TDLS
178 /* I utilizes TDLS mgmt frame always sent at BD_RATE2. (See limProcessTdls.c)
179 Assumption here is data frame sent by WDA_TxPacket() <- HalTxFrame/HalTxFrameWithComplete()
180 should take managment path. As of today, only TDLS feature has special data frame
181 which needs to be treated as mgmt.
182 */
183 if((!pTxMetadata->isEapol) &&
184 ((pTxMetadata->txFlags & WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME) != WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME))
185#else
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -0700186 if(!pTxMetadata->isEapol)
Hoonki Leee10ce392013-02-26 11:47:00 -0800187#endif
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -0700188 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 pMemPool = &(pClientData->dataMemPool);
190 ucBdPoolType = WDI_DATA_POOL_ID;
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -0700191 break;
192 }
193 // intentional fall-through to handle eapol packet as mgmt
Jeff Johnson295189b2012-06-20 16:38:30 -0700194 case WDI_MAC_MGMT_FRAME:
195 pMemPool = &(pClientData->mgmtMemPool);
196 ucBdPoolType = WDI_MGMT_POOL_ID;
197 break;
198 default:
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -0700199 return WDI_STATUS_E_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700200 }
201
202 // Allocate BD header from pool
203 pvBDHeader = WDI_DS_MemPoolAlloc(pMemPool, &physBDHeader, ucBdPoolType);
204 if(NULL == pvBDHeader)
205 return WDI_STATUS_E_FAILURE;
206
207 WDI_SetBDPointers(pFrame, pvBDHeader, physBDHeader);
208
209 alignment = 0;
210 WDI_DS_PrepareBDHeader(pFrame, ucSwFrameTXXlation, alignment);
Agarwal Ashisha8e81f52014-04-02 01:59:52 +0530211 if (pTxMetadata->isEapol)
212 {
213 WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
214 "Packet Length is %d\n", pTxMetadata->fPktlen);
215 }
Asodi T,Venkateswara Reddy9826c872017-01-18 19:08:25 +0530216
217 if (pTxMetadata->isArp)
218 {
219 WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
220 "%s :Transmitting ARP packet",__func__);
221 }
222
Yue Maf74c9862013-03-21 16:36:15 -0700223 wdiStatus = WDI_FillTxBd(pContext, ucTypeSubtype, pSTAMACAddress, pAddr2MACAddress,
Sravan Kumar Kairamd9e8cbb2017-01-17 12:17:28 +0530224 &ucUP, 1, pvBDHeader, ucTxFlag /* No ACK */, ucProtMgmtFrame, 0, isEapol, isArp,
225 &staId, pTxMetadata->txBdToken);
Yue Maf74c9862013-03-21 16:36:15 -0700226
227 if(WDI_STATUS_SUCCESS != wdiStatus)
228 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 WDI_DS_MemPoolFree(pMemPool, pvBDHeader, physBDHeader);
Yue Maf74c9862013-03-21 16:36:15 -0700230 return wdiStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 }
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800232
233 pTxMetadata->staIdx = staId;
234
Jeff Johnson295189b2012-06-20 16:38:30 -0700235 // Send packet to transport layer.
236 if(eWLAN_PAL_STATUS_SUCCESS !=WDTS_TxPacket(pContext, pFrame)){
237 WDI_DS_MemPoolFree(pMemPool, pvBDHeader, physBDHeader);
238 return WDI_STATUS_E_FAILURE;
239 }
240
241 /* resource count only for data packet */
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -0700242 // EAPOL packet doesn't use data mem pool if being treated as higher priority
Hoonki Leee10ce392013-02-26 11:47:00 -0800243#ifdef FEATURE_WLAN_TDLS
244 /* I utilizes TDLS mgmt frame always sent at BD_RATE2. (See limProcessTdls.c)
245 Assumption here is data frame sent by WDA_TxPacket() <- HalTxFrame/HalTxFrameWithComplete()
246 should take managment path. As of today, only TDLS feature has special data frame
247 which needs to be treated as mgmt.
248 */
249 if((WDI_MAC_DATA_FRAME == ucType) && (!pTxMetadata->isEapol) && ((pTxMetadata->txFlags & WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME) != WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME))
250#else
Madan Mohan Koyyalamudi1541a5b2012-10-29 16:18:21 -0700251 if(WDI_MAC_DATA_FRAME == ucType && (!pTxMetadata->isEapol))
Hoonki Leee10ce392013-02-26 11:47:00 -0800252#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 {
254 WDI_DS_MemPoolIncreaseReserveCount(pMemPool, staId);
255 }
256 return WDI_STATUS_SUCCESS;
257}
258
259
260/* DAL Transmit Complete function.
261 * Parameters:
262 * pContext:Cookie that should be passed back to the caller along with the callback.
263 * ucTxResReq:TX resource number required by TL
264 * Return Value: SUCCESS Completed successfully.
265 * FAILURE_XXX Request was rejected due XXX Reason.
266 *
267 */
268
269
270WDI_Status WDI_DS_TxComplete(void *pContext, wpt_uint32 ucTxResReq)
271{
272 // Do Sanity checks
273 if(NULL == pContext)
274 return WDI_STATUS_E_FAILURE;
275
276 // Send notification to transport layer.
277 if(eWLAN_PAL_STATUS_SUCCESS !=WDTS_CompleteTx(pContext, ucTxResReq))
278 {
279 return WDI_STATUS_E_FAILURE;
280 }
281
282 return WDI_STATUS_SUCCESS;
283}
284
285/* DAL Suspend Transmit function.
286 * Parameters:
287 * pContext:Cookie that should be passed back to the caller along with the callback.
288 * Return Value: SUCCESS Completed successfully.
289 * FAILURE_XXX Request was rejected due XXX Reason.
290 *
291 */
292
293
294WDI_Status WDI_DS_TxSuspend(void *pContext)
295{
296 WDI_DS_ClientDataType *pClientData =
297 (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
298 pClientData->suspend = 1;
299
300 return WDI_STATUS_SUCCESS;
301
302}
303
304
305/* DAL Resume Transmit function.
306 * Parameters:
307 * pContext:Cookie that should be passed back to the caller along with the callback.
308 * Return Value: SUCCESS Completed successfully.
309 * FAILURE_XXX Request was rejected due XXX Reason.
310 *
311 */
312
313
314WDI_Status WDI_DS_TxResume(void *pContext)
315{
316 WDI_DS_ClientDataType *pClientData =
317 (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
318
319 pClientData->suspend = 0;
320
321 return WDI_STATUS_SUCCESS;
322}
323
324/* DAL Get Available Resource Count.
325 * This is the number of free descririptor in DXE
326 * Parameters:
327 * pContext:Cookie that should be passed back to the caller along with the callback.
328 * wdiResPool: - identifier of resource pool
329 * Return Value: number of resources available
330 * This is the number of free descririptor in DXE
331 *
332 */
333
334wpt_uint32 WDI_GetAvailableResCount(void *pContext,WDI_ResPoolType wdiResPool)
335{
336 WDI_DS_ClientDataType *pClientData =
337 (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
338
339 switch(wdiResPool)
340 {
341 case WDI_MGMT_POOL_ID:
342 return (WDI_DS_HI_PRI_RES_NUM - 2*WDI_DS_GetAvailableResCount(&pClientData->mgmtMemPool));
343 case WDI_DATA_POOL_ID:
344 return WDTS_GetFreeTxDataResNumber(pContext);
345 default:
346 return 0;
347 }
348}
349
350/* DAL Get resrved Resource Count per STA.
351 * Parameters:
352 * pContext:Cookie that should be passed back to the caller along with the callback.
353 * wdiResPool: - identifier of resource pool
354 * staId: STA ID
355 * Return Value: number of resources reserved per STA
356 *
357 */
358wpt_uint32 WDI_DS_GetReservedResCountPerSTA(void *pContext,WDI_ResPoolType wdiResPool, wpt_uint8 staId)
359{
360 WDI_DS_ClientDataType *pClientData =
361 (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
362 switch(wdiResPool)
363 {
364 case WDI_MGMT_POOL_ID:
365 return WDI_DS_MemPoolGetRsvdResCountPerSTA(&pClientData->mgmtMemPool, staId);
366 case WDI_DATA_POOL_ID:
367 return WDI_DS_MemPoolGetRsvdResCountPerSTA(&pClientData->dataMemPool, staId);
368 default:
369 return 0;
370 }
371}
372
373/* DAL STA info add into memPool.
374 * Parameters:
375 * pContext:Cookie that should be passed back to the caller along with the callback.
376 * staId: STA ID
377 * Return Value: number of resources reserved per STA
378 *
379 */
380WDI_Status WDI_DS_AddSTAMemPool(void *pContext, wpt_uint8 staIndex)
381{
382 WDI_Status status = WDI_STATUS_SUCCESS;
383 WDI_DS_ClientDataType *pClientData =
384 (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
385
386 status = WDI_DS_MemPoolAddSTA(&pClientData->mgmtMemPool, staIndex);
387 if(WDI_STATUS_SUCCESS != status)
388 {
389 /* Add STA into MGMT memPool Fail */
390 return status;
391 }
392
393 status = WDI_DS_MemPoolAddSTA(&pClientData->dataMemPool, staIndex);
394 if(WDI_STATUS_SUCCESS != status)
395 {
396 /* Add STA into DATA memPool Fail */
397 return status;
398 }
399
400 return WDI_STATUS_SUCCESS;
401}
402
403/* DAL STA info del from memPool.
404 * Parameters:
405 * pContext:Cookie that should be passed back to the caller along with the callback.
406 * staId: STA ID
407 * Return Value: number of resources reserved per STA
408 *
409 */
410WDI_Status WDI_DS_DelSTAMemPool(void *pContext, wpt_uint8 staIndex)
411{
412 WDI_Status status = WDI_STATUS_SUCCESS;
413 WDI_DS_ClientDataType *pClientData =
414 (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext);
415
416 status = WDI_DS_MemPoolDelSTA(&pClientData->mgmtMemPool, staIndex);
417 if(WDI_STATUS_SUCCESS != status)
418 {
419 /* Del STA from MGMT memPool Fail */
420 return status;
421 }
422 status = WDI_DS_MemPoolDelSTA(&pClientData->dataMemPool, staIndex);
423 if(WDI_STATUS_SUCCESS != status)
424 {
425 /* Del STA from DATA memPool Fail */
426 return status;
427 }
428 return WDI_STATUS_SUCCESS;
429}
430
431/* DAL Set STA index associated with BSS index.
432 * Parameters:
433 * pContext:Cookie that should be passed back to the caller along with the callback.
434 * bssIdx: BSS index
435 * staId: STA index associated with BSS index
436 * Return Status: Found empty slot
437 *
438 */
439WDI_Status WDI_DS_SetStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx)
440{
441 WDI_DS_ClientDataType *pClientData;
442 wpt_uint8 bssLoop;
443
444 pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext);
445 for (bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++)
446 {
447 if ((pClientData->staIdxPerBssIdxTable[bssLoop].isUsed) &&
448 (bssIdx == pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx) &&
449 (staIdx == pClientData->staIdxPerBssIdxTable[bssLoop].staIdx))
450 {
451 return WDI_STATUS_SUCCESS;
452 }
453
454 if (0 == pClientData->staIdxPerBssIdxTable[bssLoop].isUsed)
455 {
456 pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx = bssIdx;
457 pClientData->staIdxPerBssIdxTable[bssLoop].staIdx = staIdx;
458 pClientData->staIdxPerBssIdxTable[bssLoop].isUsed = 1;
459 return WDI_STATUS_SUCCESS;
460 }
461 }
462
463 /* Could not find empty slot */
464 return WDI_STATUS_E_FAILURE;
465}
466
467/* DAL Get STA index associated with BSS index.
468 * Parameters:
469 * pContext:Cookie that should be passed back to the caller along with the callback.
470 * bssIdx: BSS index
471 * staId: STA index associated with BSS index
472 * Return Status: Found empty slot
473 *
474 */
475WDI_Status WDI_DS_GetStaIdxFromBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 *staIdx)
476{
477 WDI_DS_ClientDataType *pClientData;
478 wpt_uint8 bssLoop;
479
480 pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext);
481 for(bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++)
482 {
483 if(bssIdx == pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx)
484 {
485 /* Found BSS index from slot */
486 *staIdx = pClientData->staIdxPerBssIdxTable[bssLoop].staIdx;
487 return WDI_STATUS_SUCCESS;
488 }
489 }
490
491 /* Could not find associated STA index with BSS index */
492 return WDI_STATUS_E_FAILURE;
493}
494
495/* DAL Clear STA index associated with BSS index.
496 * Parameters:
497 * pContext:Cookie that should be passed back to the caller along with the callback.
498 * bssIdx: BSS index
499 * staId: STA index associated with BSS index
500 * Return Status: Found empty slot
501 *
502 */
503WDI_Status WDI_DS_ClearStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx)
504{
505 WDI_DS_ClientDataType *pClientData;
506 wpt_uint8 bssLoop;
507
508 pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext);
509 for(bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++)
510 {
511 if((bssIdx == pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx) &&
512 (staIdx == pClientData->staIdxPerBssIdxTable[bssLoop].staIdx))
513 {
514 pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx = WDI_DS_INDEX_INVALID;
515 pClientData->staIdxPerBssIdxTable[bssLoop].staIdx = WDI_DS_INDEX_INVALID;
516 pClientData->staIdxPerBssIdxTable[bssLoop].isUsed = 0;
517 return WDI_STATUS_SUCCESS;
518 }
519 }
520
521 /* Could not find associated STA index with BSS index */
522 return WDI_STATUS_E_FAILURE;
523}
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800524
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800525/* @brief: WDI_DS_GetTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800526 * This function should be invoked to fetch the current stats
527 * Parameters:
528 * pStats:Pointer to the collected stats
529 * len: length of buffer pointed to by pStats
530 * Return Status: None
531 */
532void WDI_DS_GetTrafficStats(WDI_TrafficStatsType** pStats, wpt_uint32 *len)
533{
534 return WDTS_GetTrafficStats(pStats, len);
535}
536
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800537/* @brief: WDI_DS_DeactivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800538 * This function should be invoked to deactivate traffic stats collection
539 * Parameters: None
540 * Return Status: None
541 */
542void WDI_DS_DeactivateTrafficStats(void)
543{
544 return WDTS_DeactivateTrafficStats();
545}
546
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800547/* @brief: WDI_DS_ActivateTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800548 * This function should be invoked to activate traffic stats collection
549 * Parameters: None
550 * Return Status: None
551 */
552void WDI_DS_ActivateTrafficStats(void)
553{
554 return WDTS_ActivateTrafficStats();
555}
556
Kumar Anand90ca3dd2013-01-18 15:24:47 -0800557/* @brief: WDI_DS_ClearTrafficStats
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800558 * This function should be invoked to clear all past stats
559 * Parameters: None
560 * Return Status: None
561 */
562void WDI_DS_ClearTrafficStats(void)
563{
564 return WDTS_ClearTrafficStats();
565}
566