/drivers/net/wireless/tiwlan1251/common/src/core/data_ctrl/Ctrl/TrafficMonitor/RateAdaptation.h

http://github.com/CyanogenMod/cm-kernel · C Header · 182 lines · 100 code · 37 blank · 45 comment · 0 complexity · dc86c3e3d6928d24bfb9b2af993f03e6 MD5 · raw 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. /***************************************************************************/
  36. /* */
  37. /* MODULE: tx.h */
  38. /* PURPOSE: Tx module Header file */
  39. /* */
  40. /***************************************************************************/
  41. #ifndef _RATE_ADAPTATION_H_
  42. #define _RATE_ADAPTATION_H_
  43. #include "osTIType.h"
  44. #include "paramIn.h"
  45. #include "paramOut.h"
  46. #define DEF_LOW_RATE_THRESHOLD DRV_RATE_AUTO /* TBD Below this rate generate roaming event */
  47. #define RATE_ADAPTATION_MODULE_LOG CTRL_DATA_MODULE_LOG
  48. #define TS_EXCEEDS(currTime,expTime) (currTime > expTime)
  49. #define TS_ADVANCE(currTime,expTime,delta) (expTime = currTime + (delta))
  50. /*#define NUM_OF_RATES_ENTRIES 5*/
  51. typedef struct
  52. {
  53. rate_e rate;
  54. UINT8 rateNumber; /* Rate as actual number - used to compare 2 rates */
  55. modulationType_e modulation;
  56. BOOL fourXEnable;
  57. UINT8 rateAdaptFallBack;
  58. UINT8 rateAdaptStepUp;
  59. BOOL valid;
  60. }rateModulation4x_table_t;
  61. typedef struct
  62. {
  63. TI_HANDLE hOs;
  64. TI_HANDLE hReport;
  65. TI_HANDLE hCtrlData;
  66. TI_HANDLE hEvHandler;
  67. /* Rate Adaptation Algorithm Parameters */
  68. UINT32 expirTimeTick;
  69. UINT32 txCount;
  70. UINT32 txFailCount;
  71. UINT32 txRateFallBackCount;
  72. UINT32 txSkipCount;
  73. UINT8 currRateIndex;
  74. UINT8 maxRateIndex;
  75. UINT8 stepUpFlag;
  76. UINT8 stepUpTxPacketsThreshold; /* RATE_NUM_SETPUP_PKTS 10 The amount of packets to commite the alghorithem after step up.*/
  77. UINT8 contTxPacketsThreshold; /*#define WDRV_TX_RATE_NUM_CONT_PKTS 30 The amount of packets to commite the alghorithem in contiuse. */
  78. UINT8 lowRateThreshold;
  79. UINT32 ctrlDataFBShortInterval;
  80. UINT32 ctrlDataFBLongInterval;
  81. TI_HANDLE pTimer;
  82. TI_HANDLE hAPConnection;
  83. UINT32 rateAdapt_timeout;
  84. rateModulation4x_table_t RatesMap[MAX_SUPPORTED_RATES];
  85. tspecsRateParameters_t tspecsRateParameters[MAX_NUM_OF_AC];
  86. } rateAdaptation_t;
  87. rateAdaptation_t* rateAdaptation_create(TI_HANDLE hOs);
  88. TI_STATUS rateAdaptation_config(rateAdaptation_t* pRateAdaptation,
  89. TI_HANDLE hOs,
  90. TI_HANDLE hReport,
  91. TI_HANDLE hCtrlData,
  92. TI_HANDLE hEvHandler,
  93. TI_HANDLE hAPConnection,
  94. rateAdaptationInitParam_t* rateAdaptationInitParam);
  95. TI_STATUS rateAdaptation_destroy(rateAdaptation_t* pRateAdaptation);
  96. TI_STATUS rateAdaptation_start(rateAdaptation_t* pRateAdaptation);
  97. TI_STATUS rateAdaptation_stop(rateAdaptation_t* pRateAdaptation);
  98. TI_STATUS rateAdaptation_stopTimer(rateAdaptation_t* pRateAdaptation);
  99. TI_STATUS rateAdaptation_updateRateAdaptation(rateAdaptation_t* pRateAdaptation,
  100. rate_e actualTxRate,
  101. rate_e requestTxRate,
  102. UINT32 TxStatus,
  103. int txNumWaiting);
  104. TI_STATUS rateAdaptation_configLowRateThrsh(rateAdaptation_t* pRateAdaptation, UINT8 rate);
  105. /* Get functions */
  106. rateModulation4x_table_t* rateAdaptation_getCurrent(rateAdaptation_t* pRateAdaptation);
  107. rate_e rateAdaptation_getCurrentRate(rateAdaptation_t* pRateAdaptation);
  108. modulationType_e rateAdaptation_getCurrentModulation(rateAdaptation_t* pRateAdaptation);
  109. BOOL rateAdaptation_getCurrentFourXEnable(rateAdaptation_t* pRateAdaptation);
  110. /* Set functions */
  111. TI_STATUS rateAdaptation_setCurrentRate(rateAdaptation_t* pRateAdaptation, rate_e rate);
  112. TI_STATUS rateAdaptation_setMaxActivRate(rateAdaptation_t* pRateAdaptation, rate_e rate);
  113. void rateAdaptation_updateModulation(rateAdaptation_t* pRateAdaptation,
  114. modulationType_e modulation,
  115. bssType_e bssType);
  116. void rateAdaptation_update4xEnable(rateAdaptation_t* pRateAdaptation,
  117. BOOL enable4x,
  118. bssType_e bssType);
  119. TI_STATUS rateAdaptation_buildRateMapTable(rateAdaptation_t *pRateAdaptation,
  120. ctrlData_rateAdapt_t *currTable,
  121. UINT32 supportedBitMap,
  122. UINT32 clientBitMap,
  123. modulationType_e modulation,
  124. BOOL enable4x,
  125. bssType_e bssType);
  126. /* utils functions */
  127. TI_STATUS rateAdaptation_Utils_IsRateInBitmap(rateAdaptation_t *pRateAdaptation,
  128. UINT32 ratesBitMap,
  129. rate_e rate);
  130. UINT32 rateAdaptation_Utils_buildRateBitMap(rateAdaptation_t *pRateAdaptation,
  131. ctrlData_rateAdapt_t *currTable,
  132. rate_e rate,
  133. UINT32 supportedBitMap,
  134. UINT32 clientBitMap);
  135. BOOL rateAdaptation_isRateInTable(ctrlData_rateAdapt_t *currTable,
  136. rate_e rate);
  137. void rateAdaptation_setTspecsRateEvent(rateAdaptation_t* pRateAdaptation,
  138. UINT8 acID,
  139. BOOL enableEvent);
  140. void rateAdaptation_setTspecsRateThresholds(rateAdaptation_t* pRateAdaptation,
  141. UINT8 acID,
  142. UINT8 highRateThreshold,
  143. UINT8 lowRateThreshold);
  144. void rateAdaptation_print(rateAdaptation_t* pRateAdaptation);
  145. #endif