Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame^] | 2 | * Copyright (c) 2012-2013 Qualcomm Atheros, Inc. |
| 3 | * All Rights Reserved. |
| 4 | * Qualcomm Atheros Confidential and Proprietary. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 5 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6 | /**========================================================================= |
| 7 | * |
| 8 | * \file wlan_qct_wdi_ds.c |
| 9 | * |
| 10 | * \brief define Dataservice API |
| 11 | * |
| 12 | * WLAN Device Abstraction layer External API for Dataservice |
| 13 | * DESCRIPTION |
| 14 | * This file contains the external API implemntation exposed by the |
| 15 | * wlan device abstarction layer module. |
| 16 | * |
| 17 | * Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved. |
| 18 | * Qualcomm Confidential and Proprietary |
| 19 | */ |
| 20 | |
| 21 | |
| 22 | #include "wlan_qct_wdi.h" |
| 23 | #include "wlan_qct_wdi_i.h" |
| 24 | #include "wlan_qct_wdi_ds.h" |
| 25 | #include "wlan_qct_wdi_ds_i.h" |
| 26 | #include "wlan_qct_wdi_dts.h" |
| 27 | #include "wlan_qct_wdi_dp.h" |
| 28 | #include "wlan_qct_wdi_sta.h" |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | /* DAL registration function. |
| 34 | * Parameters: |
| 35 | * pContext:Cookie that should be passed back to the caller along |
| 36 | * with the callback. |
| 37 | * pfnTxCompleteCallback:Callback function that is to be invoked to return |
| 38 | * packets which have been transmitted. |
| 39 | * pfnRxPacketCallback:Callback function that is to be invoked to deliver |
| 40 | * packets which have been received |
| 41 | * pfnTxFlowControlCallback:Callback function that is to be invoked to |
| 42 | * indicate/clear congestion. |
| 43 | * |
| 44 | * Return Value: SUCCESS Completed successfully. |
| 45 | * FAILURE_XXX Request was rejected due XXX Reason. |
| 46 | * |
| 47 | */ |
| 48 | WDI_Status WDI_DS_Register( void *pContext, |
| 49 | WDI_DS_TxCompleteCallback pfnTxCompleteCallback, |
| 50 | WDI_DS_RxPacketCallback pfnRxPacketCallback, |
| 51 | WDI_DS_TxFlowControlCallback pfnTxFlowControlCallback, |
| 52 | void *pCallbackContext) |
| 53 | { |
| 54 | WDI_DS_ClientDataType *pClientData; |
| 55 | wpt_uint8 bssLoop; |
| 56 | |
| 57 | // Do Sanity checks |
| 58 | if (NULL == pContext || |
| 59 | NULL == pCallbackContext || |
| 60 | NULL == pfnTxCompleteCallback || |
| 61 | NULL == pfnRxPacketCallback || |
| 62 | NULL == pfnTxFlowControlCallback) { |
| 63 | return WDI_STATUS_E_FAILURE; |
| 64 | } |
| 65 | |
| 66 | pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext); |
| 67 | if (NULL == pClientData) |
| 68 | { |
| 69 | return WDI_STATUS_MEM_FAILURE; |
| 70 | } |
| 71 | |
| 72 | // Store callbacks in client structure |
| 73 | pClientData->pcontext = pContext; |
| 74 | pClientData->receiveFrameCB = pfnRxPacketCallback; |
| 75 | pClientData->txCompleteCB = pfnTxCompleteCallback; |
| 76 | pClientData->txResourceCB = pfnTxFlowControlCallback; |
| 77 | pClientData->pCallbackContext = pCallbackContext; |
| 78 | |
| 79 | for(bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++) |
| 80 | { |
| 81 | pClientData->staIdxPerBssIdxTable[bssLoop].isUsed = 0; |
| 82 | pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx = WDI_DS_INDEX_INVALID; |
| 83 | pClientData->staIdxPerBssIdxTable[bssLoop].staIdx = WDI_DS_INDEX_INVALID; |
| 84 | } |
| 85 | return WDI_STATUS_SUCCESS; |
| 86 | } |
| 87 | |
| 88 | |
| 89 | |
| 90 | /* DAL Transmit function. |
| 91 | * Parameters: |
| 92 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 93 | * pFrame:Refernce to PAL frame. |
| 94 | * more: Does the invokee have more than one packet pending? |
| 95 | * Return Value: SUCCESS Completed successfully. |
| 96 | * FAILURE_XXX Request was rejected due XXX Reason. |
| 97 | * |
| 98 | */ |
| 99 | |
| 100 | |
| 101 | WDI_Status WDI_DS_TxPacket(void *pContext, |
| 102 | wpt_packet *pFrame, |
| 103 | wpt_boolean more) |
| 104 | { |
| 105 | WDI_DS_ClientDataType *pClientData; |
| 106 | wpt_uint8 ucSwFrameTXXlation; |
| 107 | wpt_uint8 ucUP; |
| 108 | wpt_uint8 ucTypeSubtype; |
Kiet Lam | 9b11b01 | 2013-10-24 11:43:30 +0530 | [diff] [blame] | 109 | wpt_uint8 isEapol; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | wpt_uint8 alignment; |
| 111 | wpt_uint8 ucTxFlag; |
Chet Lanctot | 4b08862 | 2013-05-22 16:09:22 -0700 | [diff] [blame] | 112 | wpt_uint8 ucProtMgmtFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 113 | wpt_uint8* pSTAMACAddress; |
| 114 | wpt_uint8* pAddr2MACAddress; |
| 115 | WDI_DS_TxMetaInfoType *pTxMetadata; |
| 116 | void *physBDHeader, *pvBDHeader; |
| 117 | wpt_uint8 ucType; |
| 118 | WDI_DS_BdMemPoolType *pMemPool; |
| 119 | wpt_uint8 ucBdPoolType; |
| 120 | wpt_uint8 staId; |
Yue Ma | f74c986 | 2013-03-21 16:36:15 -0700 | [diff] [blame] | 121 | WDI_Status wdiStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 122 | |
| 123 | // Do Sanity checks |
| 124 | if (NULL == pContext) |
| 125 | { |
| 126 | return WDI_STATUS_E_FAILURE; |
| 127 | } |
| 128 | |
| 129 | pClientData = (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext); |
| 130 | if (NULL == pClientData || pClientData->suspend) |
| 131 | { |
| 132 | return WDI_STATUS_E_FAILURE; |
| 133 | } |
| 134 | |
| 135 | // extract metadata from PAL packet |
| 136 | pTxMetadata = WDI_DS_ExtractTxMetaData(pFrame); |
| 137 | ucSwFrameTXXlation = pTxMetadata->fdisableFrmXlt; |
| 138 | ucTypeSubtype = pTxMetadata->typeSubtype; |
| 139 | ucUP = pTxMetadata->fUP; |
Kiet Lam | 9b11b01 | 2013-10-24 11:43:30 +0530 | [diff] [blame] | 140 | isEapol = pTxMetadata->isEapol; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 141 | ucTxFlag = pTxMetadata->txFlags; |
Chet Lanctot | 4b08862 | 2013-05-22 16:09:22 -0700 | [diff] [blame] | 142 | ucProtMgmtFrame = pTxMetadata->fProtMgmtFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 143 | pSTAMACAddress = &(pTxMetadata->fSTAMACAddress[0]); |
| 144 | pAddr2MACAddress = &(pTxMetadata->addr2MACAddress[0]); |
| 145 | |
| 146 | /*------------------------------------------------------------------------ |
| 147 | Get type and subtype of the frame first |
| 148 | ------------------------------------------------------------------------*/ |
| 149 | ucType = (ucTypeSubtype & WDI_FRAME_TYPE_MASK) >> WDI_FRAME_TYPE_OFFSET; |
| 150 | switch(ucType) |
| 151 | { |
| 152 | case WDI_MAC_DATA_FRAME: |
Hoonki Lee | e10ce39 | 2013-02-26 11:47:00 -0800 | [diff] [blame] | 153 | #ifdef FEATURE_WLAN_TDLS |
| 154 | /* I utilizes TDLS mgmt frame always sent at BD_RATE2. (See limProcessTdls.c) |
| 155 | Assumption here is data frame sent by WDA_TxPacket() <- HalTxFrame/HalTxFrameWithComplete() |
| 156 | should take managment path. As of today, only TDLS feature has special data frame |
| 157 | which needs to be treated as mgmt. |
| 158 | */ |
| 159 | if((!pTxMetadata->isEapol) && |
| 160 | ((pTxMetadata->txFlags & WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME) != WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME)) |
| 161 | #else |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 162 | if(!pTxMetadata->isEapol) |
Hoonki Lee | e10ce39 | 2013-02-26 11:47:00 -0800 | [diff] [blame] | 163 | #endif |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 164 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 165 | pMemPool = &(pClientData->dataMemPool); |
| 166 | ucBdPoolType = WDI_DATA_POOL_ID; |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 167 | break; |
| 168 | } |
| 169 | // intentional fall-through to handle eapol packet as mgmt |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 170 | case WDI_MAC_MGMT_FRAME: |
| 171 | pMemPool = &(pClientData->mgmtMemPool); |
| 172 | ucBdPoolType = WDI_MGMT_POOL_ID; |
| 173 | break; |
| 174 | default: |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 175 | return WDI_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | // Allocate BD header from pool |
| 179 | pvBDHeader = WDI_DS_MemPoolAlloc(pMemPool, &physBDHeader, ucBdPoolType); |
| 180 | if(NULL == pvBDHeader) |
| 181 | return WDI_STATUS_E_FAILURE; |
| 182 | |
| 183 | WDI_SetBDPointers(pFrame, pvBDHeader, physBDHeader); |
| 184 | |
| 185 | alignment = 0; |
| 186 | WDI_DS_PrepareBDHeader(pFrame, ucSwFrameTXXlation, alignment); |
| 187 | |
Yue Ma | f74c986 | 2013-03-21 16:36:15 -0700 | [diff] [blame] | 188 | wdiStatus = WDI_FillTxBd(pContext, ucTypeSubtype, pSTAMACAddress, pAddr2MACAddress, |
Kiet Lam | 9b11b01 | 2013-10-24 11:43:30 +0530 | [diff] [blame] | 189 | &ucUP, 1, pvBDHeader, ucTxFlag /* No ACK */, ucProtMgmtFrame, 0, isEapol, &staId); |
Yue Ma | f74c986 | 2013-03-21 16:36:15 -0700 | [diff] [blame] | 190 | |
| 191 | if(WDI_STATUS_SUCCESS != wdiStatus) |
| 192 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | WDI_DS_MemPoolFree(pMemPool, pvBDHeader, physBDHeader); |
Yue Ma | f74c986 | 2013-03-21 16:36:15 -0700 | [diff] [blame] | 194 | return wdiStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 195 | } |
Kumar Anand | 90ca3dd | 2013-01-18 15:24:47 -0800 | [diff] [blame] | 196 | |
| 197 | pTxMetadata->staIdx = staId; |
| 198 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 199 | // Send packet to transport layer. |
| 200 | if(eWLAN_PAL_STATUS_SUCCESS !=WDTS_TxPacket(pContext, pFrame)){ |
| 201 | WDI_DS_MemPoolFree(pMemPool, pvBDHeader, physBDHeader); |
| 202 | return WDI_STATUS_E_FAILURE; |
| 203 | } |
| 204 | |
| 205 | /* resource count only for data packet */ |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 206 | // EAPOL packet doesn't use data mem pool if being treated as higher priority |
Hoonki Lee | e10ce39 | 2013-02-26 11:47:00 -0800 | [diff] [blame] | 207 | #ifdef FEATURE_WLAN_TDLS |
| 208 | /* I utilizes TDLS mgmt frame always sent at BD_RATE2. (See limProcessTdls.c) |
| 209 | Assumption here is data frame sent by WDA_TxPacket() <- HalTxFrame/HalTxFrameWithComplete() |
| 210 | should take managment path. As of today, only TDLS feature has special data frame |
| 211 | which needs to be treated as mgmt. |
| 212 | */ |
| 213 | if((WDI_MAC_DATA_FRAME == ucType) && (!pTxMetadata->isEapol) && ((pTxMetadata->txFlags & WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME) != WDI_USE_BD_RATE2_FOR_MANAGEMENT_FRAME)) |
| 214 | #else |
Madan Mohan Koyyalamudi | 1541a5b | 2012-10-29 16:18:21 -0700 | [diff] [blame] | 215 | if(WDI_MAC_DATA_FRAME == ucType && (!pTxMetadata->isEapol)) |
Hoonki Lee | e10ce39 | 2013-02-26 11:47:00 -0800 | [diff] [blame] | 216 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 217 | { |
| 218 | WDI_DS_MemPoolIncreaseReserveCount(pMemPool, staId); |
| 219 | } |
| 220 | return WDI_STATUS_SUCCESS; |
| 221 | } |
| 222 | |
| 223 | |
| 224 | /* DAL Transmit Complete function. |
| 225 | * Parameters: |
| 226 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 227 | * ucTxResReq:TX resource number required by TL |
| 228 | * Return Value: SUCCESS Completed successfully. |
| 229 | * FAILURE_XXX Request was rejected due XXX Reason. |
| 230 | * |
| 231 | */ |
| 232 | |
| 233 | |
| 234 | WDI_Status WDI_DS_TxComplete(void *pContext, wpt_uint32 ucTxResReq) |
| 235 | { |
| 236 | // Do Sanity checks |
| 237 | if(NULL == pContext) |
| 238 | return WDI_STATUS_E_FAILURE; |
| 239 | |
| 240 | // Send notification to transport layer. |
| 241 | if(eWLAN_PAL_STATUS_SUCCESS !=WDTS_CompleteTx(pContext, ucTxResReq)) |
| 242 | { |
| 243 | return WDI_STATUS_E_FAILURE; |
| 244 | } |
| 245 | |
| 246 | return WDI_STATUS_SUCCESS; |
| 247 | } |
| 248 | |
| 249 | /* DAL Suspend Transmit function. |
| 250 | * Parameters: |
| 251 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 252 | * Return Value: SUCCESS Completed successfully. |
| 253 | * FAILURE_XXX Request was rejected due XXX Reason. |
| 254 | * |
| 255 | */ |
| 256 | |
| 257 | |
| 258 | WDI_Status WDI_DS_TxSuspend(void *pContext) |
| 259 | { |
| 260 | WDI_DS_ClientDataType *pClientData = |
| 261 | (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext); |
| 262 | pClientData->suspend = 1; |
| 263 | |
| 264 | return WDI_STATUS_SUCCESS; |
| 265 | |
| 266 | } |
| 267 | |
| 268 | |
| 269 | /* DAL Resume Transmit function. |
| 270 | * Parameters: |
| 271 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 272 | * Return Value: SUCCESS Completed successfully. |
| 273 | * FAILURE_XXX Request was rejected due XXX Reason. |
| 274 | * |
| 275 | */ |
| 276 | |
| 277 | |
| 278 | WDI_Status WDI_DS_TxResume(void *pContext) |
| 279 | { |
| 280 | WDI_DS_ClientDataType *pClientData = |
| 281 | (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext); |
| 282 | |
| 283 | pClientData->suspend = 0; |
| 284 | |
| 285 | return WDI_STATUS_SUCCESS; |
| 286 | } |
| 287 | |
| 288 | /* DAL Get Available Resource Count. |
| 289 | * This is the number of free descririptor in DXE |
| 290 | * Parameters: |
| 291 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 292 | * wdiResPool: - identifier of resource pool |
| 293 | * Return Value: number of resources available |
| 294 | * This is the number of free descririptor in DXE |
| 295 | * |
| 296 | */ |
| 297 | |
| 298 | wpt_uint32 WDI_GetAvailableResCount(void *pContext,WDI_ResPoolType wdiResPool) |
| 299 | { |
| 300 | WDI_DS_ClientDataType *pClientData = |
| 301 | (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext); |
| 302 | |
| 303 | switch(wdiResPool) |
| 304 | { |
| 305 | case WDI_MGMT_POOL_ID: |
| 306 | return (WDI_DS_HI_PRI_RES_NUM - 2*WDI_DS_GetAvailableResCount(&pClientData->mgmtMemPool)); |
| 307 | case WDI_DATA_POOL_ID: |
| 308 | return WDTS_GetFreeTxDataResNumber(pContext); |
| 309 | default: |
| 310 | return 0; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /* DAL Get resrved Resource Count per STA. |
| 315 | * Parameters: |
| 316 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 317 | * wdiResPool: - identifier of resource pool |
| 318 | * staId: STA ID |
| 319 | * Return Value: number of resources reserved per STA |
| 320 | * |
| 321 | */ |
| 322 | wpt_uint32 WDI_DS_GetReservedResCountPerSTA(void *pContext,WDI_ResPoolType wdiResPool, wpt_uint8 staId) |
| 323 | { |
| 324 | WDI_DS_ClientDataType *pClientData = |
| 325 | (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext); |
| 326 | switch(wdiResPool) |
| 327 | { |
| 328 | case WDI_MGMT_POOL_ID: |
| 329 | return WDI_DS_MemPoolGetRsvdResCountPerSTA(&pClientData->mgmtMemPool, staId); |
| 330 | case WDI_DATA_POOL_ID: |
| 331 | return WDI_DS_MemPoolGetRsvdResCountPerSTA(&pClientData->dataMemPool, staId); |
| 332 | default: |
| 333 | return 0; |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | /* DAL STA info add into memPool. |
| 338 | * Parameters: |
| 339 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 340 | * staId: STA ID |
| 341 | * Return Value: number of resources reserved per STA |
| 342 | * |
| 343 | */ |
| 344 | WDI_Status WDI_DS_AddSTAMemPool(void *pContext, wpt_uint8 staIndex) |
| 345 | { |
| 346 | WDI_Status status = WDI_STATUS_SUCCESS; |
| 347 | WDI_DS_ClientDataType *pClientData = |
| 348 | (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext); |
| 349 | |
| 350 | status = WDI_DS_MemPoolAddSTA(&pClientData->mgmtMemPool, staIndex); |
| 351 | if(WDI_STATUS_SUCCESS != status) |
| 352 | { |
| 353 | /* Add STA into MGMT memPool Fail */ |
| 354 | return status; |
| 355 | } |
| 356 | |
| 357 | status = WDI_DS_MemPoolAddSTA(&pClientData->dataMemPool, staIndex); |
| 358 | if(WDI_STATUS_SUCCESS != status) |
| 359 | { |
| 360 | /* Add STA into DATA memPool Fail */ |
| 361 | return status; |
| 362 | } |
| 363 | |
| 364 | return WDI_STATUS_SUCCESS; |
| 365 | } |
| 366 | |
| 367 | /* DAL STA info del from memPool. |
| 368 | * Parameters: |
| 369 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 370 | * staId: STA ID |
| 371 | * Return Value: number of resources reserved per STA |
| 372 | * |
| 373 | */ |
| 374 | WDI_Status WDI_DS_DelSTAMemPool(void *pContext, wpt_uint8 staIndex) |
| 375 | { |
| 376 | WDI_Status status = WDI_STATUS_SUCCESS; |
| 377 | WDI_DS_ClientDataType *pClientData = |
| 378 | (WDI_DS_ClientDataType *) WDI_DS_GetDatapathContext(pContext); |
| 379 | |
| 380 | status = WDI_DS_MemPoolDelSTA(&pClientData->mgmtMemPool, staIndex); |
| 381 | if(WDI_STATUS_SUCCESS != status) |
| 382 | { |
| 383 | /* Del STA from MGMT memPool Fail */ |
| 384 | return status; |
| 385 | } |
| 386 | status = WDI_DS_MemPoolDelSTA(&pClientData->dataMemPool, staIndex); |
| 387 | if(WDI_STATUS_SUCCESS != status) |
| 388 | { |
| 389 | /* Del STA from DATA memPool Fail */ |
| 390 | return status; |
| 391 | } |
| 392 | return WDI_STATUS_SUCCESS; |
| 393 | } |
| 394 | |
| 395 | /* DAL Set STA index associated with BSS index. |
| 396 | * Parameters: |
| 397 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 398 | * bssIdx: BSS index |
| 399 | * staId: STA index associated with BSS index |
| 400 | * Return Status: Found empty slot |
| 401 | * |
| 402 | */ |
| 403 | WDI_Status WDI_DS_SetStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx) |
| 404 | { |
| 405 | WDI_DS_ClientDataType *pClientData; |
| 406 | wpt_uint8 bssLoop; |
| 407 | |
| 408 | pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext); |
| 409 | for (bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++) |
| 410 | { |
| 411 | if ((pClientData->staIdxPerBssIdxTable[bssLoop].isUsed) && |
| 412 | (bssIdx == pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx) && |
| 413 | (staIdx == pClientData->staIdxPerBssIdxTable[bssLoop].staIdx)) |
| 414 | { |
| 415 | return WDI_STATUS_SUCCESS; |
| 416 | } |
| 417 | |
| 418 | if (0 == pClientData->staIdxPerBssIdxTable[bssLoop].isUsed) |
| 419 | { |
| 420 | pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx = bssIdx; |
| 421 | pClientData->staIdxPerBssIdxTable[bssLoop].staIdx = staIdx; |
| 422 | pClientData->staIdxPerBssIdxTable[bssLoop].isUsed = 1; |
| 423 | return WDI_STATUS_SUCCESS; |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | /* Could not find empty slot */ |
| 428 | return WDI_STATUS_E_FAILURE; |
| 429 | } |
| 430 | |
| 431 | /* DAL Get 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 | */ |
| 439 | WDI_Status WDI_DS_GetStaIdxFromBssIdx(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(bssIdx == pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx) |
| 448 | { |
| 449 | /* Found BSS index from slot */ |
| 450 | *staIdx = pClientData->staIdxPerBssIdxTable[bssLoop].staIdx; |
| 451 | return WDI_STATUS_SUCCESS; |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | /* Could not find associated STA index with BSS index */ |
| 456 | return WDI_STATUS_E_FAILURE; |
| 457 | } |
| 458 | |
| 459 | /* DAL Clear STA index associated with BSS index. |
| 460 | * Parameters: |
| 461 | * pContext:Cookie that should be passed back to the caller along with the callback. |
| 462 | * bssIdx: BSS index |
| 463 | * staId: STA index associated with BSS index |
| 464 | * Return Status: Found empty slot |
| 465 | * |
| 466 | */ |
| 467 | WDI_Status WDI_DS_ClearStaIdxPerBssIdx(void *pContext, wpt_uint8 bssIdx, wpt_uint8 staIdx) |
| 468 | { |
| 469 | WDI_DS_ClientDataType *pClientData; |
| 470 | wpt_uint8 bssLoop; |
| 471 | |
| 472 | pClientData = (WDI_DS_ClientDataType *)WDI_DS_GetDatapathContext(pContext); |
| 473 | for(bssLoop = 0; bssLoop < WDI_DS_MAX_SUPPORTED_BSS; bssLoop++) |
| 474 | { |
| 475 | if((bssIdx == pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx) && |
| 476 | (staIdx == pClientData->staIdxPerBssIdxTable[bssLoop].staIdx)) |
| 477 | { |
| 478 | pClientData->staIdxPerBssIdxTable[bssLoop].bssIdx = WDI_DS_INDEX_INVALID; |
| 479 | pClientData->staIdxPerBssIdxTable[bssLoop].staIdx = WDI_DS_INDEX_INVALID; |
| 480 | pClientData->staIdxPerBssIdxTable[bssLoop].isUsed = 0; |
| 481 | return WDI_STATUS_SUCCESS; |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | /* Could not find associated STA index with BSS index */ |
| 486 | return WDI_STATUS_E_FAILURE; |
| 487 | } |
Madan Mohan Koyyalamudi | 01cba04 | 2013-01-10 21:56:05 -0800 | [diff] [blame] | 488 | |
Kumar Anand | 90ca3dd | 2013-01-18 15:24:47 -0800 | [diff] [blame] | 489 | /* @brief: WDI_DS_GetTrafficStats |
Madan Mohan Koyyalamudi | 01cba04 | 2013-01-10 21:56:05 -0800 | [diff] [blame] | 490 | * This function should be invoked to fetch the current stats |
| 491 | * Parameters: |
| 492 | * pStats:Pointer to the collected stats |
| 493 | * len: length of buffer pointed to by pStats |
| 494 | * Return Status: None |
| 495 | */ |
| 496 | void WDI_DS_GetTrafficStats(WDI_TrafficStatsType** pStats, wpt_uint32 *len) |
| 497 | { |
| 498 | return WDTS_GetTrafficStats(pStats, len); |
| 499 | } |
| 500 | |
Kumar Anand | 90ca3dd | 2013-01-18 15:24:47 -0800 | [diff] [blame] | 501 | /* @brief: WDI_DS_DeactivateTrafficStats |
Madan Mohan Koyyalamudi | 01cba04 | 2013-01-10 21:56:05 -0800 | [diff] [blame] | 502 | * This function should be invoked to deactivate traffic stats collection |
| 503 | * Parameters: None |
| 504 | * Return Status: None |
| 505 | */ |
| 506 | void WDI_DS_DeactivateTrafficStats(void) |
| 507 | { |
| 508 | return WDTS_DeactivateTrafficStats(); |
| 509 | } |
| 510 | |
Kumar Anand | 90ca3dd | 2013-01-18 15:24:47 -0800 | [diff] [blame] | 511 | /* @brief: WDI_DS_ActivateTrafficStats |
Madan Mohan Koyyalamudi | 01cba04 | 2013-01-10 21:56:05 -0800 | [diff] [blame] | 512 | * This function should be invoked to activate traffic stats collection |
| 513 | * Parameters: None |
| 514 | * Return Status: None |
| 515 | */ |
| 516 | void WDI_DS_ActivateTrafficStats(void) |
| 517 | { |
| 518 | return WDTS_ActivateTrafficStats(); |
| 519 | } |
| 520 | |
Kumar Anand | 90ca3dd | 2013-01-18 15:24:47 -0800 | [diff] [blame] | 521 | /* @brief: WDI_DS_ClearTrafficStats |
Madan Mohan Koyyalamudi | 01cba04 | 2013-01-10 21:56:05 -0800 | [diff] [blame] | 522 | * This function should be invoked to clear all past stats |
| 523 | * Parameters: None |
| 524 | * Return Status: None |
| 525 | */ |
| 526 | void WDI_DS_ClearTrafficStats(void) |
| 527 | { |
| 528 | return WDTS_ClearTrafficStats(); |
| 529 | } |
| 530 | |