PageRenderTime 73ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 1ms

/drivers/net/wireless/tiwlan1251/common/src/Management/QOS/qosMngr.c

https://bitbucket.org/cyanogenmod/cm-kernel
C | 3167 lines | 1820 code | 559 blank | 788 comment | 359 complexity | f9c69b539fa06e4fa3e07914d3e5c3c6 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0

Large files files are truncated, but you can click here to view the full file

  1. /****************************************************************************
  2. **+-----------------------------------------------------------------------+**
  3. **| |**
  4. **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
  5. **| All rights reserved. |**
  6. **| |**
  7. **| Redistribution and use in source and binary forms, with or without |**
  8. **| modification, are permitted provided that the following conditions |**
  9. **| are met: |**
  10. **| |**
  11. **| * Redistributions of source code must retain the above copyright |**
  12. **| notice, this list of conditions and the following disclaimer. |**
  13. **| * Redistributions in binary form must reproduce the above copyright |**
  14. **| notice, this list of conditions and the following disclaimer in |**
  15. **| the documentation and/or other materials provided with the |**
  16. **| distribution. |**
  17. **| * Neither the name Texas Instruments nor the names of its |**
  18. **| contributors may be used to endorse or promote products derived |**
  19. **| from this software without specific prior written permission. |**
  20. **| |**
  21. **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
  22. **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
  23. **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
  24. **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
  25. **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
  26. **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
  27. **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
  28. **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
  29. **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
  30. **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
  31. **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
  32. **| |**
  33. **+-----------------------------------------------------------------------+**
  34. ****************************************************************************/
  35. /** \file qosMngr.c
  36. * \brief QOS module interface
  37. *
  38. * \see qosMngr.h
  39. */
  40. /****************************************************************************************************/
  41. /* */
  42. /* MODULE: qosMGr.c */
  43. /* PURPOSE: QOS module interface. */
  44. /* This module handles the QOS manager configuration. */
  45. /* */
  46. /****************************************************************************************************/
  47. #include "report.h"
  48. #include "osApi.h"
  49. #include "paramOut.h"
  50. #include "paramIn.h"
  51. #include "utils.h"
  52. #include "siteMgrApi.h"
  53. #include "public_infoele.h"
  54. #include "whalCtrl_api.h"
  55. #include "qosMngr.h"
  56. #include "qosMngr_API.h"
  57. #include "qosMngr_QueueMapping.h"
  58. #include "smeSmApi.h"
  59. #include "EvHandler.h"
  60. #ifdef EXC_MODULE_INCLUDED
  61. #include "excMngr.h"
  62. #include "excTSMngr.h"
  63. #endif
  64. static int NonQosTagToACTable[MAX_NUM_OF_802_1d_TAGS] = { NonQosTag0ToAC, NonQosTag1ToAC, NonQosTag2ToAC, NonQosTag3ToAC, NonQosTag4ToAC, NonQosTag5ToAC, NonQosTag6ToAC, NonQosTag7ToAC };
  65. /* This structure is now shared between the qosMngr and TxData to allow PS_POLL voice delivery mode for NON_QOS AP */
  66. int WMEQosTagToACTable[MAX_NUM_OF_802_1d_TAGS] = { WMEQosTag0ToAC, WMEQosTag1ToAC, WMEQosTag2ToAC, WMEQosTag3ToAC, WMEQosTag4ToAC, WMEQosTag5ToAC, WMEQosTag6ToAC, WMEQosTag7ToAC };
  67. /* This array is now shared between qosMngr and TxData */
  68. UINT8 wmeAcToUpIndex[MAX_NUM_OF_AC] = {0,1,4,6};
  69. /* Used to indicate no user priority is assigned for AC */
  70. #define INACTIVE_USER_PRIORITY 0xFF
  71. /********************************************************************************/
  72. /* Internal functions prototypes. */
  73. /********************************************************************************/
  74. static void release_module(qosMngr_t *pQosMngr, UINT32 initVec);
  75. static TI_STATUS verifyAndConfigTrafficParams(qosMngr_t *pQosMngr, queueTrafficParams_t *pQtrafficParams);
  76. static TI_STATUS verifyAndConfigQosParams(qosMngr_t *pQosMngr,acQosParams_t *pAcQosParams);
  77. static TI_STATUS getWMEInfoElement(qosMngr_t *pQosMngr,UINT8 *pWMEie,UINT8 *pLen);
  78. static TI_STATUS verifyWmeIeParams(qosMngr_t *pQosMngr,UINT8 *pQosIeParams);
  79. static TI_STATUS updateACParams(qosMngr_t *pQosMngr,ACParameters_t *pAcParams);
  80. static void updateTagToAcTable(qosMngr_t *pQosMngr,acTrfcType_e *pProtocolTagToACTable);
  81. static TI_STATUS setWmeSiteParams(qosMngr_t *pQosMngr, UINT8 *pQosIeParams);
  82. void qosMngr_resetAdmCtrlParameters(TI_HANDLE hQosMngr);
  83. static TI_STATUS qosMngr_getCurrAcStatus(TI_HANDLE hQosMngr, OS_802_11_AC_UPSD_STATUS_PARAMS *pAcStatusParams);
  84. static void deleteTspecConfiguration(qosMngr_t *pQosMngr, UINT8 acID);
  85. static void setNonQosAdmissionState(qosMngr_t *pQosMngr, UINT8 acID);
  86. static void qosMngr_storeTspecCandidateParams (tspecInfo_t *pCandidateParams, OS_802_11_QOS_TSPEC_PARAMS *pTSPECParams, UINT8 ac);
  87. /********************************************************************************
  88. * qosMngr_create *
  89. ********************************************************************************
  90. DESCRIPTION: QOS module creation function, called by the config mgr in creation phase.
  91. performs the following:
  92. - Allocate the QOS MNGR handle.
  93. INPUT: hOs - Handle to OS
  94. OUTPUT:
  95. RETURN: Handle to the QOS MNGR module on success, NULL otherwise
  96. ************************************************************************/
  97. TI_HANDLE qosMngr_create(TI_HANDLE hOs)
  98. {
  99. qosMngr_t *pQosMngr = NULL;
  100. UINT32 initVec = 0;
  101. if(!hOs)
  102. return NULL;
  103. /* allocating the WME object */
  104. pQosMngr = os_memoryAlloc(hOs,sizeof(qosMngr_t));
  105. if (pQosMngr == NULL)
  106. return NULL;
  107. initVec |= (1 << QOS_MNGR_INIT_BIT_LOCAL_VECTOR);
  108. /* create admission control object */
  109. pQosMngr->pTrafficAdmCtrl = trafficAdmCtrl_create(hOs);
  110. if (pQosMngr->pTrafficAdmCtrl == NULL)
  111. {
  112. qosMngr_destroy(pQosMngr);
  113. return NULL;
  114. }
  115. initVec |= (1 << QOS_MNGR_INIT_BIT_ADM_CTRL);
  116. return(pQosMngr);
  117. }
  118. /************************************************************************
  119. * qosMngr_destroy *
  120. ************************************************************************
  121. DESCRIPTION: QOS MNGR module destroy function, called by the config mgr in
  122. the destroy phase
  123. performs the following:
  124. - Free all memory alocated by the module
  125. INPUT: hQosMngr - QOS Manager handle.
  126. OUTPUT:
  127. RETURN: OK on success, NOK otherwise
  128. ************************************************************************/
  129. TI_STATUS qosMngr_destroy(TI_HANDLE hQosMngr)
  130. {
  131. UINT32 initVec;
  132. qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
  133. if (pQosMngr == NULL)
  134. return OK;
  135. initVec = 0xFFFF;
  136. release_module(pQosMngr, initVec);
  137. return OK;
  138. }
  139. /***********************************************************************
  140. * release_module
  141. ***********************************************************************
  142. DESCRIPTION: Called by the destroy function or by the create function (on failure)
  143. Go over the vector, for each bit that is set, release the corresponding module.
  144. INPUT: pQosMngr - QOS Mngr pointer.
  145. initVec - Vector that contains a bit set for each module thah had been initiualized
  146. OUTPUT:
  147. RETURN: OK on success, NOK otherwise
  148. ************************************************************************/
  149. static void release_module(qosMngr_t *pQosMngr, UINT32 initVec)
  150. {
  151. if (initVec & (1 << QOS_MNGR_INIT_BIT_ADM_CTRL))
  152. trafficAdmCtrl_unload(pQosMngr->pTrafficAdmCtrl);
  153. if (initVec & (1 << QOS_MNGR_INIT_BIT_LOCAL_VECTOR))
  154. utils_nullMemoryFree(pQosMngr->hOs, pQosMngr, sizeof(qosMngr_t));
  155. initVec = 0;
  156. }
  157. /************************************************************************
  158. * qosMngr_config *
  159. ************************************************************************
  160. DESCRIPTION: QOS Manager module configuration function, called by the config
  161. mgr in configuration phase
  162. performs the following:
  163. - Reset & initiailzes local variables
  164. - Init the handles to be used by the module
  165. INPUT: hQosMngr - Qos Manager handle.
  166. List of handles to be used by the module
  167. pQosMngrInitParams - Init table of the module.
  168. OUTPUT:
  169. RETURN: OK on success, NOK otherwise
  170. ************************************************************************/
  171. TI_STATUS qosMngr_config(TI_HANDLE hQosMngr,
  172. TI_HANDLE hHalCtrl,
  173. TI_HANDLE hSiteMgr,
  174. TI_HANDLE hReport,
  175. TI_HANDLE hOs,
  176. TI_HANDLE hTxData,
  177. TI_HANDLE hMeasurementMngr,
  178. TI_HANDLE hSmeSm,
  179. TI_HANDLE hMemMgr,
  180. TI_HANDLE hCtrlData,
  181. TI_HANDLE hEvHandler,
  182. TI_HANDLE hExcMgr,
  183. QosMngrInitParams_t *pQosMngrInitParams)
  184. {
  185. qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
  186. paramInfo_t param;
  187. UINT8 acID;
  188. TI_STATUS status;
  189. /* init handles */
  190. pQosMngr->hOs = hOs;
  191. pQosMngr->hReport = hReport;
  192. pQosMngr->hSiteMgr = hSiteMgr;
  193. pQosMngr->hHalCtrl = hHalCtrl;
  194. pQosMngr->hTxData = hTxData;
  195. pQosMngr->hMeasurementMngr = hMeasurementMngr;
  196. pQosMngr->hSmeSm = hSmeSm;
  197. pQosMngr->hMemMgr = hMemMgr;
  198. pQosMngr->hCtrlData = hCtrlData;
  199. pQosMngr->hEvHandler = hEvHandler;
  200. pQosMngr->hExcMgr = hExcMgr;
  201. pQosMngr->isConnected = FALSE;
  202. /* init params */
  203. pQosMngr->WMEEnable = pQosMngrInitParams->wmeEnable;
  204. pQosMngr->trafficAdmCtrlEnable = pQosMngrInitParams->trafficAdmCtrlEnable;
  205. pQosMngr->tagZeroConverHeader = pQosMngrInitParams->qosTagZeroConverHeader;
  206. pQosMngr->qosPacketBurstEnable = pQosMngrInitParams->PacketBurstEnable;
  207. pQosMngr->qosPacketBurstTxOpLimit = pQosMngrInitParams->PacketBurstTxOpLimit;
  208. pQosMngr->desiredPsMode = pQosMngrInitParams->desiredPsMode;
  209. pQosMngr->activeProtocol = NONE_QOS;
  210. pQosMngr->WMESiteSupport = FALSE;
  211. pQosMngr->desiredMaxSpLen = pQosMngrInitParams->desiredMaxSpLen;
  212. pQosMngr->desiredVoiceDeliveryProtocol = PS_SCHEME_LEGACY_PSPOLL;
  213. pQosMngr->voiceTspecConfigured = FALSE;
  214. pQosMngr->videoTspecConfigured = FALSE;
  215. pQosMngr->performTSPECRenegotiation = FALSE;
  216. pQosMngr->TSPECNegotiationResultCallb = NULL;
  217. pQosMngr->TSPECNegotiationResultModule = NULL;
  218. /* No template has been set for UPSD */
  219. pQosMngr->QosNullDataTemplateUserPriority = 0xFF;
  220. /* configure admission control parameters */
  221. qosMngr_resetAdmCtrlParameters(pQosMngr);
  222. status = trafficAdmCtrl_config(pQosMngr->pTrafficAdmCtrl,
  223. pQosMngr->hTxData,
  224. pQosMngr->hReport,
  225. pQosMngr->hOs,
  226. pQosMngr,
  227. pQosMngr->hCtrlData,
  228. pQosMngr->hMemMgr,
  229. pQosMngr->hExcMgr,
  230. &pQosMngrInitParams->trafficAdmCtrlInitParams);
  231. if(status != OK)
  232. return NOK;
  233. /*
  234. * configure per AC traffic parameters
  235. */
  236. for(acID = FIRST_AC_INDEX;acID < MAX_NUM_OF_AC; acID++)
  237. {
  238. /*
  239. * setting ac traffic params for TrafficCategoryCfg (TNET configuration
  240. * The parameters can be changed in run-time, so they are saved in "init params"
  241. * for 'disconnecting' .
  242. * the parameters being set in setSite; "select" phase.
  243. */
  244. pQosMngr->acParams[acID].QtrafficParams.queueID = acID;
  245. pQosMngr->acParams[acID].QtrafficParams.channelType = CHANNEL_TYPE_EDCF;
  246. pQosMngr->acParams[acID].QtrafficParams.tsid = acID;
  247. pQosMngr->acParams[acID].QtrafficParams.dot11EDCATableMSDULifeTime = 0;
  248. pQosMngr->acParams[acID].QtrafficParams.psScheme = PS_SCHEME_LEGACY;
  249. pQosMngr->acParams[acID].QtrafficParams.ackPolicy = pQosMngrInitParams->acAckPolicy[acID];
  250. pQosMngr->acParams[acID].QtrafficParams.APSDConf[0] = 0;
  251. pQosMngr->acParams[acID].QtrafficParams.APSDConf[1] = 0;
  252. /*
  253. * Update the qTrafficInitParams as well
  254. */
  255. os_memoryCopy(hOs,&(pQosMngr->acParams[acID].QTrafficInitParams),&(pQosMngr->acParams[acID].QtrafficParams),sizeof(queueTrafficParams_t));
  256. /* will be config only after select */
  257. verifyAndConfigTrafficParams(pQosMngr,&(pQosMngr->acParams[acID].QtrafficParams));
  258. /*
  259. * setting ac QoS params for acQosParams (TNET configuration)
  260. * The parameters can be changed in run-time, so they are saved in "init params"
  261. * for 'disconnecting'.
  262. * the parameters being set in setSite; "select" phase.
  263. */
  264. pQosMngr->acParams[acID].acQosParams.ac = acID;
  265. pQosMngr->acParams[acID].acQosParams.aifsn = AIFS_DEF;
  266. pQosMngr->acParams[acID].acQosParams.cwMax = CW_MAX_DEF;
  267. pQosMngr->acParams[acID].acQosParams.cwMin = CW_MIN_MAX;
  268. pQosMngr->acParams[acID].acQosParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
  269. pQosMngr->acParams[acID].msduLifeTimeParam = pQosMngrInitParams->MsduLifeTime[acID];
  270. /* The protocol is NONE_QOS. If Packet Burst is Enable, */
  271. /* then, the BE queue is configured to the TxOP Limit of Packet burst */
  272. /* (that is, 3 ms) and the txopContinuation is set to qosPacketBurstEnable */
  273. /* The protocol is NONE_QOS. If Packet Burst is Enable, */
  274. /* then, the BE queue is configured to the TxOP Limit of Packet burst */
  275. /* (that is, 3 ms) and the txopContinuation is set to qosPacketBurstEnable */
  276. if (acID == QOS_AC_BE)
  277. {
  278. if (pQosMngr->qosPacketBurstEnable==TRUE)
  279. {
  280. pQosMngr->acParams[QOS_AC_BE].acQosParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
  281. }
  282. else
  283. {
  284. pQosMngr->acParams[QOS_AC_BE].acQosParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
  285. }
  286. }
  287. /*
  288. * Update the acQosInitParams as well
  289. */
  290. os_memoryCopy(hOs,&(pQosMngr->acParams[acID].acQosInitParams),&(pQosMngr->acParams[acID].acQosParams),sizeof(acQosParams_t));
  291. /* will be config only after select */
  292. verifyAndConfigQosParams(hQosMngr,&(pQosMngr->acParams[acID].acQosParams));
  293. /*
  294. * setting ps mode per ac for protocol specific configuration.
  295. */
  296. /* validity check - allow to set the desired Ps mode per-AC to UPSD ONLY IF the station supports UPSD */
  297. if ((pQosMngrInitParams->desiredPsMode == PS_SCHEME_UPSD_TRIGGER) && (pQosMngrInitParams->desiredWmeAcPsMode[acID] == PS_SCHEME_UPSD_TRIGGER))
  298. {
  299. pQosMngr->acParams[acID].desiredWmeAcPsMode = PS_SCHEME_UPSD_TRIGGER;
  300. }
  301. else
  302. {
  303. pQosMngr->acParams[acID].desiredWmeAcPsMode = PS_SCHEME_LEGACY_PSPOLL;
  304. }
  305. pQosMngr->acParams[acID].currentWmeAcPsMode = PS_SCHEME_LEGACY_PSPOLL; /* default configuration is legacy PS for all queues */
  306. /*
  307. * configure TxData per AC params
  308. */
  309. param.content.txDataQosParams.acID = acID;
  310. param.content.txDataQosParams.acTrfcCtrl.PsMode = PS_SCHEME_LEGACY;
  311. param.content.txDataQosParams.acTrfcCtrl.QueueIndex = acID;
  312. param.content.txDataQosParams.acTrfcCtrl.TxQueueSize = pQosMngrInitParams->TxQueueSize[acID];
  313. param.content.txDataQosParams.acTrfcCtrl.QueueOvFlowPolicy = pQosMngrInitParams->QueueOvFlowPolicy[acID];
  314. param.content.txDataQosParams.acTrfcCtrl.MsduLifeTime = pQosMngrInitParams->MsduLifeTime[acID];
  315. param.content.txDataQosParams.acTrfcCtrl.ackPolicy = ACK_POLICY_LEGACY; /* working with Non - Qos method */
  316. param.paramType = TX_DATA_PS_MODE_PARAM;
  317. txData_setParam(pQosMngr->hTxData,&param);
  318. param.paramType = TX_DATA_CONFIG_TX_QUEUE_SIZE;
  319. txData_setParam(pQosMngr->hTxData,&param);
  320. param.paramType = TX_DATA_CONFIG_TX_QUEUE_OVFLOW_POLICY;
  321. txData_setParam(pQosMngr->hTxData,&param);
  322. param.paramType = TX_DATA_CONFIG_AC_MSDU_LIFE_TIME;
  323. txData_setParam(pQosMngr->hTxData,&param);
  324. param.paramType = TX_DATA_CONFIG_AC_ACK_POLICY;
  325. txData_setParam(pQosMngr->hTxData,&param);
  326. /* setting wme Ack Policy */
  327. pQosMngr->acParams[acID].wmeAcAckPolicy = pQosMngrInitParams->acAckPolicy[acID];
  328. /* Set admission state per AC for non-QoS and update the Tx module. */
  329. setNonQosAdmissionState(pQosMngr, acID);
  330. }
  331. pQosMngr->headerConvetMode = LEGACY_CONVERT;
  332. param.content.txDataQosParams.qosParams.headerConverMode = LEGACY_CONVERT;
  333. /* Update the Tx tag to AC tables for legacy mode. */
  334. updateTagToAcTable(pQosMngr, (acTrfcType_e *)NonQosTagToACTable);
  335. param.paramType = TX_DATA_CONVERT_HEADER_MODE;
  336. txData_setParam(pQosMngr->hTxData,&param);
  337. param.paramType = TX_DATA_CONVERT_TAG_ZERO_HEADER_MODE;
  338. param.content.txDataQosParams.qosParams.convertTagZeroFrames = pQosMngrInitParams->qosTagZeroConverHeader;
  339. txData_setParam(pQosMngr->hTxData,&param);
  340. WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  341. ("qosMngr_config : QoS configuration complete!"));
  342. return OK;
  343. }
  344. /************************************************************************
  345. * qosMngr_resetAdmCtrlParameters *
  346. ************************************************************************
  347. DESCRIPTION: reset the admCtrl parameters
  348. INPUT: hQosMngr - Qos Manager handle.
  349. OUTPUT:
  350. RETURN:
  351. ************************************************************************/
  352. void qosMngr_resetAdmCtrlParameters(TI_HANDLE hQosMngr)
  353. {
  354. UINT8 acID;
  355. qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
  356. /* reset admission control parameters */
  357. for(acID = FIRST_AC_INDEX ; acID < MAX_NUM_OF_AC ; acID++)
  358. {
  359. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].AC = (acTrfcType_e)acID;
  360. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority = INACTIVE_USER_PRIORITY; /* Setting invalid user Priority to prevent GET_TSPEC or DELETE */
  361. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].nominalMsduSize = 0;
  362. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].minimumPHYRate = 0;
  363. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].meanDataRate = 0;
  364. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].surplausBwAllowance = 0;
  365. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].mediumTime = 0;
  366. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].UPSDFlag = 0;
  367. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].streamDirection = BI_DIRECTIONAL;
  368. pQosMngr->resourceMgmtTable.currentTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
  369. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].AC = (acTrfcType_e)acID;
  370. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].userPriority = INACTIVE_USER_PRIORITY; /* Setting invalid user Priority to prevent GET_TSPEC or DELETE */
  371. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].nominalMsduSize = 0;
  372. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].minimumPHYRate = 0;
  373. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].meanDataRate = 0;
  374. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].surplausBwAllowance = 0;
  375. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].mediumTime = 0;
  376. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].UPSDFlag = 0;
  377. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].streamDirection = BI_DIRECTIONAL;
  378. pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState = AC_NOT_ADMITTED;
  379. pQosMngr->resourceMgmtTable.totalAllocatedMediumTime = 0;
  380. }
  381. }
  382. /************************************************************************
  383. * qosMngr_disconnect *
  384. ************************************************************************
  385. DESCRIPTION: the function is called upon driver disconnecting to reset all
  386. QOS parameters to init values.
  387. INPUT: hQosMngr - Qos Manager handle.
  388. OUTPUT:
  389. RETURN: OK on success, NOK otherwise
  390. ************************************************************************/
  391. TI_STATUS qosMngr_disconnect(TI_HANDLE hQosMngr)
  392. {
  393. qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
  394. paramInfo_t param;
  395. UINT8 acID;
  396. TI_STATUS status;
  397. if(hQosMngr == NULL)
  398. return OK;
  399. pQosMngr->activeProtocol = NONE_QOS;
  400. pQosMngr->WMESiteSupport = FALSE;
  401. /* clear admission control params */
  402. qosMngr_resetAdmCtrlParameters(pQosMngr);
  403. trafficAdmCtrl_stop(pQosMngr->pTrafficAdmCtrl);
  404. for(acID = FIRST_AC_INDEX;acID < MAX_NUM_OF_AC; acID++)
  405. {
  406. /* disable event in rate adaptation */
  407. ctrlData_setTspecsRateEvent(pQosMngr->hCtrlData, acID, FALSE);
  408. /* Disable medium time events in TX */
  409. txData_setAdmisionCtrlParams(pQosMngr->hTxData, acID, 0 , 0, FALSE);
  410. /* The protocol after disconnect is NONE_QOS. If Packet Burst is Enabled, the BE queue InitParams
  411. is configured to the TxOP Limit of Packet burst (that is, 3 ms) and the
  412. txopContinuation is set to qosPacketBurstEnable. */
  413. if (acID == QOS_AC_BE)
  414. {
  415. if (pQosMngr->qosPacketBurstEnable==TRUE)
  416. {
  417. pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
  418. }
  419. else
  420. {
  421. pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
  422. }
  423. }
  424. /* Copy init traffic params (non-QoS defaults) to current traffic params, and config to HAL and TNET. */
  425. os_memoryCopy(pQosMngr->hOs,&(pQosMngr->acParams[acID].acQosParams),&(pQosMngr->acParams[acID].acQosInitParams),sizeof(acQosParams_t));
  426. /*
  427. * Update the qTrafficInitParams as well
  428. */
  429. os_memoryCopy(pQosMngr->hOs,&(pQosMngr->acParams[acID].QtrafficParams),&(pQosMngr->acParams[acID].QTrafficInitParams),sizeof(queueTrafficParams_t));
  430. pQosMngr->acParams[acID].currentWmeAcPsMode = PS_SCHEME_LEGACY_PSPOLL; /* default configuration is legacy PS for all queues */
  431. /*
  432. * setting TxData params, only PS , Txoplimit and Admission State and AC status
  433. * can be changed and reset to defaults.
  434. */
  435. param.content.txDataQosParams.acID = acID;
  436. param.content.txDataQosParams.acTrfcCtrl.PsMode = PS_SCHEME_LEGACY;
  437. param.content.txDataQosParams.acTrfcCtrl.ackPolicy = ACK_POLICY_LEGACY; /* working with Non - Qos method */
  438. param.content.txDataQosParams.acTrfcCtrl.MsduLifeTime = pQosMngr->acParams[acID].msduLifeTimeParam;
  439. param.paramType = TX_DATA_CONFIG_AC_MSDU_LIFE_TIME;
  440. txData_setParam(pQosMngr->hTxData, &param);
  441. param.paramType = TX_DATA_PS_MODE_PARAM;
  442. txData_setParam(pQosMngr->hTxData,&param);
  443. param.paramType = TX_DATA_CONFIG_AC_ACK_POLICY;
  444. txData_setParam(pQosMngr->hTxData,&param);
  445. /* Set admission state per AC for non-QoS and update the Tx module. */
  446. setNonQosAdmissionState(pQosMngr, acID);
  447. }
  448. /*
  449. * configure only BE AC
  450. * NOTE : this is done after "disconnect" or Init phase so those are defaults BE params
  451. */
  452. /*
  453. * configureQueue
  454. */
  455. status = verifyAndConfigTrafficParams(hQosMngr,&(pQosMngr->acParams[QOS_AC_BE].QtrafficParams));
  456. if (status != OK)
  457. {
  458. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  459. ("qosMngr_setSite:failed to init NON_QOS Queue Traffic parameters!!!\n\n"));
  460. return status;
  461. }
  462. /*
  463. * configureAC
  464. */
  465. status = verifyAndConfigQosParams(hQosMngr,&(pQosMngr->acParams[QOS_AC_BE].acQosParams));
  466. if (status != OK)
  467. {
  468. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  469. ("qosMngr_setSite:failed to init NON_QOS AC QoS parameters!!!\n\n"));
  470. return status;
  471. }
  472. /*
  473. * reset TxData globals parameters: header converting to legacy and Tag to Ac table without
  474. * QOS
  475. */
  476. pQosMngr->headerConvetMode = LEGACY_CONVERT;
  477. param.content.txDataQosParams.qosParams.headerConverMode = LEGACY_CONVERT;
  478. /* Update the Tx and HAL tag to AC tables for legacy mode. */
  479. updateTagToAcTable(pQosMngr, (acTrfcType_e *)NonQosTagToACTable);
  480. param.paramType = TX_DATA_CONVERT_HEADER_MODE;
  481. txData_setParam(pQosMngr->hTxData,&param);
  482. /* Update our internal state */
  483. pQosMngr->isConnected = FALSE;
  484. /* Mark that no Qos Null template is currently set into firmware */
  485. pQosMngr->QosNullDataTemplateUserPriority = 0xFF;
  486. pQosMngr->voiceTspecConfigured = FALSE;
  487. pQosMngr->videoTspecConfigured = FALSE;
  488. /* Mark that no Qos Null template is currently set into firmware */
  489. pQosMngr->QosNullDataTemplateUserPriority = 0xFF;
  490. WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  491. ("qosMngr_disconnect : QoS disconnect complete!"));
  492. #ifdef EXC_MODULE_INCLUDED
  493. measurementMgr_stopTsMetrics(pQosMngr->hMeasurementMngr);
  494. #endif
  495. return OK;
  496. }
  497. /************************************************************************
  498. * qosMngr_connect *
  499. ************************************************************************
  500. DESCRIPTION: the function is called upon driver connection to inform all
  501. the other modules about the voice mode
  502. INPUT: hQosMngr - Qos Manager handle.
  503. OUTPUT:
  504. RETURN: OK on success, NOK otherwise
  505. ************************************************************************/
  506. TI_STATUS qosMngr_connect(TI_HANDLE hQosMngr)
  507. {
  508. qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
  509. psPollTemplate_t psPollTemplate;
  510. whalCtrl_setTemplate_t templateStruct;
  511. QosNullDataTemplate_t QosNullDataTemplate;
  512. UINT8 acID,UPSDCnt=0;
  513. if (pQosMngr->isConnected == TRUE)
  514. {
  515. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_connect : Already connected !!!\n"));
  516. return OK;
  517. }
  518. /* Send PsPoll template to HAL */
  519. templateStruct.pTemplate = (UINT8 *)&psPollTemplate;
  520. templateStruct.templateType = PS_POLL_TEMPLATE;
  521. buildPsPollTemplate(pQosMngr->hSiteMgr, &templateStruct);
  522. whalCtrl_SetTemplate(pQosMngr->hHalCtrl, &templateStruct);
  523. /* Update our internal state */
  524. pQosMngr->isConnected = TRUE;
  525. /* Set Qos-Null Data template into firmware */
  526. for(acID = FIRST_AC_INDEX;acID < MAX_NUM_OF_AC; acID++)
  527. {
  528. /* Set QOS Null data template into the firmware (only if at least one AC is configured as UPSD )*/
  529. if (pQosMngr->acParams[acID].currentWmeAcPsMode == PS_SCHEME_UPSD_TRIGGER)
  530. {
  531. UPSDCnt++;
  532. if ( pQosMngr->acParams[acID].apInitAdmissionState != ADMISSION_REQUIRED )
  533. {
  534. pQosMngr->QosNullDataTemplateUserPriority = wmeAcToUpIndex[acID];
  535. templateStruct.pTemplate = (UINT8 *)&QosNullDataTemplate;
  536. templateStruct.templateType = QOS_NULL_DATA_TEMPLATE;
  537. buildQosNullDataTemplate(pQosMngr->hSiteMgr, &templateStruct,pQosMngr->QosNullDataTemplateUserPriority);
  538. whalCtrl_SetTemplate(pQosMngr->hHalCtrl, &templateStruct);
  539. WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  540. ("setWmeSiteParams: Setting QOS Null data for UserPriority %d (belongs to AC %d)\n",wmeAcToUpIndex[acID],acID));
  541. break; /* Only need to set ONE template, so after setting it, we can exit the loop */
  542. }
  543. }
  544. }
  545. /* If MAX_NUM_OF_AC (4) ACs were found as UPSD, but we still haven't configured any UP in the Qos Null data template, it must mean all ACs require admission - not valid*/
  546. if ((pQosMngr->QosNullDataTemplateUserPriority == 0xFF) && (UPSDCnt == MAX_NUM_OF_AC))
  547. {
  548. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_connect : QOS Null Data template not set since all ACs require admission !!!\n"));
  549. }
  550. return OK;
  551. }
  552. /************************************************************************
  553. * qosMngr_evalSite *
  554. ************************************************************************
  555. DESCRIPTION: Evaluate the site for the selction algorithm
  556. In case the station is configure to work in UPSD mode
  557. prefer a site that support UPSD and return 1.
  558. All other case return 0.
  559. INPUT: siteAPSDSupport - the UPSD capabilit of the site
  560. OUTPUT:
  561. RETURN: 1 - evaluation is good...
  562. 0 - evaluation can be better....
  563. ************************************************************************/
  564. UINT8 qosMngr_evalSite(TI_HANDLE hQosMngr, BOOL siteAPSDSupport)
  565. {
  566. qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
  567. if (pQosMngr->desiredPsMode == PS_SCHEME_UPSD_TRIGGER && siteAPSDSupport)
  568. {
  569. return 1;
  570. }
  571. return 0;
  572. }
  573. /************************************************************************
  574. * qosMngr_getParamsPatial *
  575. ************************************************************************
  576. DESCRIPTION: The function is an API for external modules to qet qos parameters
  577. INPUT: hQosMngr - Qos Manager handle.
  578. pParamInfo - qos parameters information.
  579. OUTPUT:
  580. RETURN: OK on success, NOK otherwise
  581. ************************************************************************/
  582. TI_STATUS qosMngr_getParamsPatial(TI_HANDLE hQosMngr,paramInfoPartial_t *pParamInfo)
  583. {
  584. qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
  585. if(pQosMngr == NULL)
  586. return NOK;
  587. WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_getParams: %x\n", pParamInfo->paramType));
  588. switch(pParamInfo->paramType)
  589. {
  590. case QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC:
  591. /* Check if voice call present. If so, store current TSPEC configuration */
  592. pParamInfo->content.TspecConfigure.voiceTspecConfigure = (UINT8)pQosMngr->voiceTspecConfigured;
  593. pParamInfo->content.TspecConfigure.videoTspecConfigure = (UINT8)pQosMngr->videoTspecConfigured;
  594. WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_getParams: QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC=%d\n", pQosMngr->voiceTspecConfigured));
  595. if (pQosMngr->voiceTspecConfigured == TRUE)
  596. {
  597. OS_802_11_QOS_TSPEC_PARAMS *pTspecParams;
  598. tspecInfo_t *pConfiguredParams;
  599. /* Store voice TSPEC params - must be configured */
  600. pTspecParams = &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6];
  601. pConfiguredParams = &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_6];
  602. pTspecParams->uUserPriority = pConfiguredParams->userPriority;
  603. pTspecParams->uNominalMSDUsize = pConfiguredParams->nominalMsduSize;
  604. pTspecParams->uMeanDataRate = pConfiguredParams->meanDataRate;
  605. pTspecParams->uMinimumPHYRate = pConfiguredParams->minimumPHYRate;
  606. pTspecParams->uSurplusBandwidthAllowance = pConfiguredParams->surplausBwAllowance;
  607. pTspecParams->uAPSDFlag = pConfiguredParams->UPSDFlag;
  608. pTspecParams->uMediumTime = pConfiguredParams->mediumTime;
  609. }
  610. else
  611. {
  612. pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6].uUserPriority = MAX_USER_PRIORITY;
  613. }
  614. if (pQosMngr->videoTspecConfigured == TRUE)
  615. {
  616. OS_802_11_QOS_TSPEC_PARAMS *pTspecParams;
  617. tspecInfo_t *pConfiguredParams;
  618. /* Store signalling TSPEC params if configured in user priority 4 */
  619. pTspecParams = &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4];
  620. pConfiguredParams = &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_4];
  621. pTspecParams->uUserPriority = pConfiguredParams->userPriority;
  622. pTspecParams->uNominalMSDUsize = pConfiguredParams->nominalMsduSize;
  623. pTspecParams->uMeanDataRate = pConfiguredParams->meanDataRate;
  624. pTspecParams->uMinimumPHYRate = pConfiguredParams->minimumPHYRate;
  625. pTspecParams->uSurplusBandwidthAllowance = pConfiguredParams->surplausBwAllowance;
  626. pTspecParams->uAPSDFlag = pConfiguredParams->UPSDFlag;
  627. pTspecParams->uMediumTime = pConfiguredParams->mediumTime;
  628. }
  629. else
  630. {
  631. pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4].uUserPriority = MAX_USER_PRIORITY;
  632. }
  633. break;
  634. default:
  635. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  636. ("qosMngr_getParamsExtend Error: unknown paramType 0x%x!\n",pParamInfo->paramType));
  637. return (PARAM_NOT_SUPPORTED);
  638. }
  639. return OK;
  640. }
  641. /************************************************************************
  642. * qosMngr_getACparams *
  643. ************************************************************************
  644. DESCRIPTION: The function is an API for external modules to qet qos parameters
  645. INPUT: hQosMngr - Qos Manager handle.
  646. pParamInfo - qos parameters information.
  647. OUTPUT:
  648. RETURN: OK on success, NOK otherwise
  649. ************************************************************************/
  650. TI_STATUS qosMngr_getParams(TI_HANDLE hQosMngr,paramInfo_t *pParamInfo)
  651. {
  652. acTrfcType_e acID;
  653. qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
  654. if(pQosMngr == NULL)
  655. return NOK;
  656. WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_getParams: %x\n", pParamInfo->paramType));
  657. switch(pParamInfo->paramType)
  658. {
  659. case QOS_PACKET_BURST_ENABLE:
  660. pParamInfo->content.qosPacketBurstEnb = pQosMngr->qosPacketBurstEnable;
  661. break;
  662. case QOS_MNGR_CURRENT_PS_MODE:
  663. pParamInfo->content.currentPsMode = pQosMngr->currentPsMode;
  664. break;
  665. case QOS_MNGR_ACTIVE_PROTOCOL:
  666. pParamInfo->content.qosSiteProtocol = pQosMngr->activeProtocol;
  667. break;
  668. case QOS_MNGR_GET_DESIRED_PS_MODE:
  669. pParamInfo->content.qosDesiredPsMode.uDesiredPsMode = pQosMngr->desiredPsMode;
  670. for(acID = FIRST_AC_INDEX; acID < MAX_NUM_OF_AC ; acID++ )
  671. pParamInfo->content.qosDesiredPsMode.uDesiredWmeAcPsMode[acID] = pQosMngr->acParams[acID].desiredWmeAcPsMode;
  672. break;
  673. case QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC:
  674. /* Check if voice call present. If so, store current TSPEC configuration */
  675. pParamInfo->content.TspecConfigure.voiceTspecConfigure = (UINT8)pQosMngr->voiceTspecConfigured;
  676. pParamInfo->content.TspecConfigure.videoTspecConfigure = (UINT8)pQosMngr->videoTspecConfigured;
  677. WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_getParams: QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC=%d\n", pQosMngr->voiceTspecConfigured));
  678. if (pQosMngr->voiceTspecConfigured == TRUE)
  679. {
  680. OS_802_11_QOS_TSPEC_PARAMS *pTspecParams;
  681. tspecInfo_t *pConfiguredParams;
  682. /* Store voice TSPEC params - must be configured */
  683. pTspecParams = &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6];
  684. pConfiguredParams = &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_6];
  685. pTspecParams->uUserPriority = pConfiguredParams->userPriority;
  686. pTspecParams->uNominalMSDUsize = pConfiguredParams->nominalMsduSize;
  687. pTspecParams->uMeanDataRate = pConfiguredParams->meanDataRate;
  688. pTspecParams->uMinimumPHYRate = pConfiguredParams->minimumPHYRate;
  689. pTspecParams->uSurplusBandwidthAllowance = pConfiguredParams->surplausBwAllowance;
  690. pTspecParams->uAPSDFlag = pConfiguredParams->UPSDFlag;
  691. pTspecParams->uMediumTime = pConfiguredParams->mediumTime;
  692. }
  693. else
  694. {
  695. pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6].uUserPriority = MAX_USER_PRIORITY;
  696. }
  697. if (pQosMngr->videoTspecConfigured == TRUE)
  698. {
  699. OS_802_11_QOS_TSPEC_PARAMS *pTspecParams;
  700. tspecInfo_t *pConfiguredParams;
  701. /* Store signalling TSPEC params if configured in user priority 4 */
  702. pTspecParams = &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4];
  703. pConfiguredParams = &pQosMngr->resourceMgmtTable.candidateTspecInfo[USER_PRIORITY_4];
  704. pTspecParams->uUserPriority = pConfiguredParams->userPriority;
  705. pTspecParams->uNominalMSDUsize = pConfiguredParams->nominalMsduSize;
  706. pTspecParams->uMeanDataRate = pConfiguredParams->meanDataRate;
  707. pTspecParams->uMinimumPHYRate = pConfiguredParams->minimumPHYRate;
  708. pTspecParams->uSurplusBandwidthAllowance = pConfiguredParams->surplausBwAllowance;
  709. pTspecParams->uAPSDFlag = pConfiguredParams->UPSDFlag;
  710. pTspecParams->uMediumTime = pConfiguredParams->mediumTime;
  711. }
  712. else
  713. {
  714. pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4].uUserPriority = MAX_USER_PRIORITY;
  715. }
  716. break;
  717. default:
  718. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  719. ("qosMngr_getParams Error: unknown paramType 0x%x!\n",pParamInfo->paramType));
  720. return (PARAM_NOT_SUPPORTED);
  721. /* break; - unreachable */
  722. }
  723. return OK;
  724. }
  725. /************************************************************************
  726. * qosMngr_setParams *
  727. ************************************************************************
  728. DESCRIPTION: The function is an API for external modules to set qos parameters
  729. INPUT: hQosMngr - Qos Manager handle.
  730. pParamInfo - qos parameters information.
  731. OUTPUT:
  732. RETURN: OK on success, NOK otherwise
  733. ************************************************************************/
  734. TI_STATUS qosMngr_setParams(TI_HANDLE hQosMngr,paramInfo_t *pParamInfo)
  735. {
  736. qosMngr_t *pQosMngr = (qosMngr_t *)hQosMngr;
  737. paramInfo_t param;
  738. whalParamInfo_t whalParam;
  739. acTrfcType_e acID;
  740. TI_STATUS status;
  741. if(pQosMngr == NULL)
  742. return NOK;
  743. if(pParamInfo == NULL)
  744. {
  745. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  746. ("qosMngr_setParams :Error trying to set NULL params!\n"));
  747. return NOK;
  748. }
  749. WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG, ("qosMngr_setParams: %x\n", pParamInfo->paramType));
  750. switch(pParamInfo->paramType)
  751. {
  752. case QOS_PACKET_BURST_ENABLE:
  753. if (pParamInfo->content.qosPacketBurstEnb > QOS_PACKET_BURST_ENABLE_MAX)
  754. return (PARAM_VALUE_NOT_VALID);
  755. /* No change */
  756. if (pParamInfo->content.qosPacketBurstEnb == pQosMngr->qosPacketBurstEnable)
  757. return OK;
  758. /* Update the qosPacketBurstEnable parameter */
  759. pQosMngr->qosPacketBurstEnable = pParamInfo->content.qosPacketBurstEnb;
  760. /* Packet burst enable changed from F to T */
  761. if (pParamInfo->content.qosPacketBurstEnb == TRUE)
  762. {
  763. /* Update the acTrafficInitParams of BE to the packet burst def*/
  764. pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
  765. /* Update the acTrafficParams of BE and the hal to the packet burst def*/
  766. if (pQosMngr->activeProtocol == NONE_QOS)
  767. {
  768. pQosMngr->acParams[QOS_AC_BE].acQosParams.txopLimit = pQosMngr->qosPacketBurstTxOpLimit;
  769. /* verify the parameters and update the hal */
  770. status = verifyAndConfigQosParams(hQosMngr,&(pQosMngr->acParams[QOS_AC_BE].acQosParams));
  771. if(status != OK)
  772. return status;
  773. }
  774. }
  775. /* Packet burst enable changed from T to F*/
  776. else
  777. {
  778. /* Update the acTrafficInitParams of BE to the AC def*/
  779. pQosMngr->acParams[QOS_AC_BE].acQosInitParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
  780. /* Update the acTrafficParams of BE and the hal to the AC def*/
  781. if (pQosMngr->activeProtocol == NONE_QOS)
  782. {
  783. pQosMngr->acParams[QOS_AC_BE].acQosParams.txopLimit = QOS_TX_OP_LIMIT_DEF;
  784. /* verify the parameters and update the hal */
  785. status = verifyAndConfigQosParams(hQosMngr,&(pQosMngr->acParams[QOS_AC_BE].acQosParams));
  786. if(status != OK)
  787. return status;
  788. }
  789. }
  790. break;
  791. case QOS_MNGR_SET_SITE_PROTOCOL:
  792. if(pParamInfo->content.qosSiteProtocol == WME)
  793. pQosMngr->WMESiteSupport = TRUE;
  794. else
  795. pQosMngr->WMESiteSupport = FALSE;
  796. break;
  797. case QOS_MNGR_SET_OS_PARAMS:
  798. if((acTrfcType_e)pParamInfo->content.qosOsParams.acID > QOS_HIGHEST_AC_INDEX)
  799. {
  800. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  801. ("qosMngr_setParams :Error trying to set invalid acId: %d param",pParamInfo->content.qosOsParams.acID));
  802. return (PARAM_VALUE_NOT_VALID);
  803. }
  804. if((pParamInfo->content.qosOsParams.VoiceDeliveryProtocol != TRUE) && (pParamInfo->content.qosOsParams.VoiceDeliveryProtocol != FALSE))
  805. {
  806. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  807. ("qosMngr_setParams :Error trying to set invalid VoiceDeliveryProtocol: %d param",pParamInfo->content.qosOsParams.VoiceDeliveryProtocol));
  808. return (PARAM_VALUE_NOT_VALID);
  809. }
  810. if((pParamInfo->content.qosOsParams.VoiceDeliveryProtocol == TRUE) && ((PSScheme_e)pParamInfo->content.qosOsParams.PSDeliveryProtocol == PS_SCHEME_UPSD_TRIGGER))
  811. {
  812. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  813. ("qosMngr_setParams Error: trying to set invalid VoiceDeliveryProtocol == PS_POLL and PSDeliveryProtocol = UPSD\n"));
  814. return (PARAM_VALUE_NOT_VALID);
  815. }
  816. if((pParamInfo->content.qosOsParams.VoiceDeliveryProtocol == TRUE) && ((acTrfcType_e)pParamInfo->content.qosOsParams.acID != QOS_AC_VO))
  817. {
  818. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  819. ("qosMngr_setParams Error: trying to set invalid VoiceDeliveryProtocol == PS_POLL and AC != VOICE \n"));
  820. return (PARAM_VALUE_NOT_VALID);
  821. }
  822. if(((PSScheme_e)pParamInfo->content.qosOsParams.PSDeliveryProtocol != PS_SCHEME_LEGACY_PSPOLL) && ((PSScheme_e)pParamInfo->content.qosOsParams.PSDeliveryProtocol != PS_SCHEME_UPSD_TRIGGER))
  823. {
  824. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  825. ("qosMngr_setParams :Error trying to set invalid PSDeliveryProtocol: %d param\n",pParamInfo->content.qosOsParams.PSDeliveryProtocol));
  826. return (PARAM_VALUE_NOT_VALID);
  827. }
  828. /* config tidConf */
  829. acID = (acTrfcType_e)pParamInfo->content.qosOsParams.acID;
  830. /* Convert TRUE/FALSE setting (from Utility Adapter) to PS_POLL or PS_NONE settings */
  831. if (pParamInfo->content.qosOsParams.VoiceDeliveryProtocol == FALSE)
  832. {
  833. pParamInfo->content.qosOsParams.VoiceDeliveryProtocol = PS_SCHEME_LEGACY;
  834. }
  835. if (pParamInfo->content.qosOsParams.VoiceDeliveryProtocol == TRUE)
  836. {
  837. pParamInfo->content.qosOsParams.VoiceDeliveryProtocol = PS_SCHEME_LEGACY_PSPOLL;
  838. }
  839. if( (pParamInfo->content.qosOsParams.PSDeliveryProtocol != pQosMngr->acParams[acID].desiredWmeAcPsMode) &&
  840. (pQosMngr->isConnected == TRUE) )
  841. {
  842. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  843. ("qosMngr_setParams :Error trying to set new PS protocol while connected"));
  844. return (PARAM_VALUE_NOT_VALID);
  845. }
  846. /* UPSD_FW open in upsd integration */
  847. /* set the current PS mode. In not connected state it is always Legacy since the currentPsMode only
  848. update after connection */
  849. pQosMngr->acParams[acID].QtrafficParams.psScheme = pQosMngr->acParams[acID].currentWmeAcPsMode;
  850. pQosMngr->acParams[acID].msduLifeTimeParam = pParamInfo->content.qosOsParams.MaxLifeTime;
  851. status = verifyAndConfigTrafficParams(pQosMngr,&(pQosMngr->acParams[acID].QtrafficParams));
  852. if(status != OK)
  853. return status;
  854. /* set txData Voice Delivery Protocol mode */
  855. if(acID == QOS_AC_VO)
  856. pQosMngr->desiredVoiceDeliveryProtocol = pParamInfo->content.qosOsParams.VoiceDeliveryProtocol;
  857. param.content.txDataQosParams.acID = acID;
  858. param.content.txDataQosParams.acTrfcCtrl.PsMode = pParamInfo->content.qosOsParams.VoiceDeliveryProtocol;
  859. param.paramType = TX_DATA_PS_MODE_PARAM;
  860. txData_setParam(pQosMngr->hTxData,&param);
  861. param.content.txDataQosParams.acTrfcCtrl.MsduLifeTime = pParamInfo->content.qosOsParams.MaxLifeTime;
  862. param.paramType = TX_DATA_CONFIG_AC_MSDU_LIFE_TIME;
  863. txData_setParam(pQosMngr->hTxData,&param);
  864. /* synch psPoll mode with qosMngr */
  865. /* Update the PsMode parameter */
  866. pQosMngr->acParams[acID].desiredWmeAcPsMode = pParamInfo->content.qosOsParams.PSDeliveryProtocol;
  867. break;
  868. case QOS_MNGR_CURRENT_PS_MODE:
  869. if( (pQosMngr->activeProtocol == WME) && (pQosMngr->desiredPsMode == PS_SCHEME_UPSD_TRIGGER) && (pParamInfo->content.currentPsMode == PS_SCHEME_UPSD_TRIGGER) )
  870. pQosMngr->currentPsMode = PS_SCHEME_UPSD_TRIGGER;
  871. else
  872. pQosMngr->currentPsMode = PS_SCHEME_LEGACY_PSPOLL;
  873. break;
  874. case QOS_MNGR_ADD_TSPEC_REQUEST:
  875. pQosMngr->TSPECNegotiationResultCallb = NULL;
  876. pQosMngr->TSPECNegotiationResultModule = NULL;
  877. return (qosMngr_requestAdmission(hQosMngr, &pParamInfo->content.qosAddTspecRequest));
  878. /* break; - unreachable */
  879. case QOS_MNGR_RESEND_TSPEC_REQUEST:
  880. WLAN_REPORT_INFORMATION(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  881. ("qosMngr_setParams: QOS_MNGR_RESEND_TSPEC_REQUEST\n"));
  882. pQosMngr->TSPECNegotiationResultCallb = (qosMngrCallb_t)pParamInfo->content.qosRenegotiateTspecRequest.callback;
  883. pQosMngr->TSPECNegotiationResultModule = pParamInfo->content.qosRenegotiateTspecRequest.handler;
  884. status = qosMngr_requestAdmission(hQosMngr, &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_6]);
  885. if ((status == OK) && (pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4].uUserPriority != MAX_USER_PRIORITY))
  886. {
  887. status = qosMngr_requestAdmission(hQosMngr, &pQosMngr->tspecRenegotiationParams[USER_PRIORITY_4]);
  888. }
  889. return (status);
  890. /* break; - unreachable */
  891. case QOS_MNGR_DEL_TSPEC_REQUEST:
  892. return (qosMngr_deleteAdmission(hQosMngr, &pParamInfo->content.qosDelTspecRequest));
  893. /* break; - unreachable */
  894. case QOS_MNGR_AC_STATUS:
  895. return (qosMngr_getCurrAcStatus (hQosMngr,&pParamInfo->content.qosCurrentAcStatus));
  896. /* break; - unreachable */
  897. case QOS_MNGR_AP_QOS_PARAMETERS: /* API GetAPQosParameters */
  898. acID = (acTrfcType_e) pParamInfo->content.qosApQosParams.uAC;
  899. if(acID > QOS_HIGHEST_AC_INDEX)
  900. {
  901. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  902. ("qosMngr_setParams :Error trying to set invalid acId: %d param\n",pParamInfo->content.qosApQosParams.uAC));
  903. return (PARAM_VALUE_NOT_VALID);
  904. }
  905. if(pQosMngr->isConnected == FALSE)
  906. {
  907. return NOT_CONNECTED;
  908. }
  909. if(pQosMngr->activeProtocol == NONE_QOS)
  910. {
  911. return NO_QOS_AP;
  912. }
  913. pParamInfo->content.qosApQosParams.uAssocAdmissionCtrlFlag = pQosMngr->acParams[acID].apInitAdmissionState; /* admission flag */
  914. pParamInfo->content.qosApQosParams.uAIFS = pQosMngr->acParams[acID].acQosParams.aifsn;
  915. pParamInfo->content.qosApQosParams.uCwMin = (1 << pQosMngr->acParams[acID].acQosParams.cwMin)-1;
  916. pParamInfo->content.qosApQosParams.uCwMax = (1 << pQosMngr->acParams[acID].acQosParams.cwMax)-1;
  917. pParamInfo->content.qosApQosParams.uTXOPLimit = pQosMngr->acParams[acID].acQosParams.txopLimit << 5;
  918. break;
  919. case QOS_MNGR_OS_TSPEC_PARAMS:
  920. if( pParamInfo->content.qosTspecParameters.uUserPriority > MAX_USER_PRIORITY )
  921. {
  922. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  923. ("qosMngr_getTspecParams: userPriority > 7 -> Ignore !!!\n"));
  924. return NOK;
  925. }
  926. if(pQosMngr->isConnected == FALSE)
  927. {
  928. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  929. ("qosMngr_getTspecParams: Not connected - Ignoring request !!!\n"));
  930. return NOT_CONNECTED;
  931. }
  932. if(pQosMngr->activeProtocol == NONE_QOS)
  933. {
  934. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  935. ("qosMngr_getTspecParams: Not connected to QOS AP - Ignoring reqeust !!!\n"));
  936. return NO_QOS_AP;
  937. }
  938. acID = (acTrfcType_e)WMEQosTagToACTable[pParamInfo->content.qosTspecParameters.uUserPriority];
  939. /* check if signaling is already in process*/
  940. if(pQosMngr->resourceMgmtTable.candidateTspecInfo[acID].trafficAdmState == AC_WAIT_ADMISSION)
  941. {
  942. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,("qosMngr_requestAdmission: AC = %d , TSPEC Signaling is in progress -> Ignoring request !!!\n",acID));
  943. return TRAFIC_ADM_PENDING;
  944. }
  945. /* check if UP is admitted or not */
  946. if(pQosMngr->resourceMgmtTable.currentTspecInfo[acID].userPriority != pParamInfo->content.qosTspecParameters.uUserPriority)
  947. {
  948. WLAN_REPORT_ERROR(pQosMngr->hReport, QOS_MANAGER_MODULE_LOG,
  949. ("qosMngr_getTspecParams: user priority is not admitted. -> Ignore !!!\n"));
  950. return USER_PRIORITY_NOT_ADMITTED;
  951. }
  952. pParamInfo->content.qosTspecParameters.uMeanDataRate = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].meanDataRate;
  953. pParamInfo->content.qosTspecParameters.uNominalMSDUsize = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].nominalMsduSize;
  954. pParamInfo->content.qosTspecParameters.uAPSDFlag = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].UPSDFlag;
  955. pParamInfo->content.qosTspecParameters.uMinimumPHYRate = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].minimumPHYRate;
  956. pParamInfo->content.qosTspecParameters.uSurplusBandwidthAllowance = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].surplausBwAllowance;
  957. pParamInfo->content.qosTspecParameters.uMediumTime = pQosMngr->resourceMgmtTable.currentTspecInfo[acID].mediumTime;
  958. break;
  959. case QOS_SET_RATE_THRESHOLD:
  960. ctrlData_setTspecsRateThresholds(pQosMngr->hCtrlData,
  961. (UINT8)pParamInfo->content.QOSRateThreshold.uAC,

Large files files are truncated, but you can click here to view the full file