mto.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * ==================================================================
  3. * MTO.H
  4. *
  5. * Copyright (c) 2003 Winbond Electronics Corp. All rights reserved.
  6. * ==================================================================
  7. */
  8. #ifndef __MTO_H__
  9. #define __MTO_H__
  10. #include <linux/types.h>
  11. struct wbsoft_priv;
  12. #define MTO_PREAMBLE_LONG WLAN_PREAMBLE_TYPE_LONG
  13. #define MTO_PREAMBLE_SHORT WLAN_PREAMBLE_TYPE_SHORT
  14. /* Defines the parameters used in the MAC Throughput Optimization algorithm */
  15. struct wb35_mto_params {
  16. u32 TxFlowCount; /* to judge what kind the tx flow(sparse or busy) is */
  17. /* --------- DTO threshold parameters ------------- */
  18. u16 DTO_PeriodicCheckCycle;
  19. u16 DTO_RssiThForAntDiv;
  20. u16 DTO_TxCountThForCalcNewRate;
  21. u16 DTO_TxRateIncTh;
  22. u16 DTO_TxRateDecTh;
  23. u16 DTO_TxRateEqTh;
  24. u16 DTO_TxRateBackOff;
  25. u16 DTO_TxRetryRateReduce;
  26. u16 DTO_TxPowerIndex; /* 0 ~ 31 */
  27. u16 reserved_1;
  28. /* ------------------------------------------------ */
  29. u8 PowerChangeEnable;
  30. u8 AntDiversityEnable;
  31. u8 CCA_Mode;
  32. u8 CCA_Mode_Setup;
  33. u8 Preamble_Type;
  34. u8 PreambleChangeEnable;
  35. u8 DataRateLevel;
  36. u8 DataRateChangeEnable;
  37. u8 FragThresholdLevel;
  38. u8 FragThresholdChangeEnable;
  39. u16 RTSThreshold;
  40. u16 RTSThreshold_Setup;
  41. u32 AvgIdleSlot;
  42. u32 Pr_Interf;
  43. u32 AvgGapBtwnInterf;
  44. u8 RTSChangeEnable;
  45. u8 Ant_sel;
  46. u8 aging_timeout;
  47. u8 reserved_2;
  48. u32 Cnt_Ant[2];
  49. u32 SQ_Ant[2];
  50. u8 FallbackRateLevel;
  51. u8 OfdmRateLevel;
  52. u8 RatePolicy;
  53. u8 reserved_3[3];
  54. /* For RSSI turning */
  55. s32 RSSI_high;
  56. s32 RSSI_low;
  57. };
  58. #define MTO_DATA() (adapter->sMtoPara)
  59. #define MTO_HAL() (&adapter->sHwData)
  60. #define MTO_SET_PREAMBLE_TYPE(x) /* Turbo mark LM_PREAMBLE_TYPE(&pcore_data->lm_data) = (x) */
  61. #define MTO_ENABLE (adapter->sLocalPara.TxRateMode == RATE_AUTO)
  62. #define MTO_TXPOWER_FROM_EEPROM (adapter->sHwData.PowerIndexFromEEPROM)
  63. #define LOCAL_ANTENNA_NO() (adapter->sLocalPara.bAntennaNo)
  64. #define LOCAL_IS_CONNECTED() (adapter->sLocalPara.wConnectedSTAindex != 0)
  65. #define MTO_INITTXRATE_MODE (adapter->sHwData.SoftwareSet&0x2) /* bit 1 */
  66. #define MTO_POWER_CHANGE_ENABLE() MTO_DATA().PowerChangeEnable
  67. #define MTO_CCA_MODE() MTO_DATA().CCA_Mode
  68. #define MTO_CCA_MODE_SETUP() MTO_DATA().CCA_Mode_Setup
  69. #define MTO_PREAMBLE_TYPE() MTO_DATA().Preamble_Type
  70. #define MTO_PREAMBLE_CHANGE_ENABLE() MTO_DATA().PreambleChangeEnable
  71. #define MTO_RATE_LEVEL() MTO_DATA().DataRateLevel
  72. #define MTO_OFDM_RATE_LEVEL() MTO_DATA().OfdmRateLevel
  73. #define MTO_RATE_CHANGE_ENABLE() MTO_DATA().DataRateChangeEnable
  74. #define MTO_FRAG_TH_LEVEL() MTO_DATA().FragThresholdLevel
  75. #define MTO_FRAG_CHANGE_ENABLE() MTO_DATA().FragThresholdChangeEnable
  76. #define MTO_RTS_THRESHOLD() MTO_DATA().RTSThreshold
  77. #define MTO_RTS_CHANGE_ENABLE() MTO_DATA().RTSChangeEnable
  78. #define MTO_RTS_THRESHOLD_SETUP() MTO_DATA().RTSThreshold_Setup
  79. #define MTO_AVG_IDLE_SLOT() MTO_DATA().AvgIdleSlot
  80. #define MTO_PR_INTERF() MTO_DATA().Pr_Interf
  81. #define MTO_AVG_GAP_BTWN_INTERF() MTO_DATA().AvgGapBtwnInterf
  82. #define MTO_CNT_ANT(x) MTO_DATA().Cnt_Ant[(x)]
  83. #define MTO_SQ_ANT(x) MTO_DATA().SQ_Ant[(x)]
  84. #define MTO_AGING_TIMEOUT() MTO_DATA().aging_timeout
  85. #define MTO_TXFLOWCOUNT() MTO_DATA().TxFlowCount
  86. /* --------- DTO threshold parameters ------------- */
  87. #define MTOPARA_PERIODIC_CHECK_CYCLE() MTO_DATA().DTO_PeriodicCheckCycle
  88. #define MTOPARA_RSSI_TH_FOR_ANTDIV() MTO_DATA().DTO_RssiThForAntDiv
  89. #define MTOPARA_TXCOUNT_TH_FOR_CALC_RATE() MTO_DATA().DTO_TxCountThForCalcNewRate
  90. #define MTOPARA_TXRATE_INC_TH() MTO_DATA().DTO_TxRateIncTh
  91. #define MTOPARA_TXRATE_DEC_TH() MTO_DATA().DTO_TxRateDecTh
  92. #define MTOPARA_TXRATE_EQ_TH() MTO_DATA().DTO_TxRateEqTh
  93. #define MTOPARA_TXRATE_BACKOFF() MTO_DATA().DTO_TxRateBackOff
  94. #define MTOPARA_TXRETRYRATE_REDUCE() MTO_DATA().DTO_TxRetryRateReduce
  95. #define MTOPARA_TXPOWER_INDEX() MTO_DATA().DTO_TxPowerIndex
  96. /* ------------------------------------------------ */
  97. extern u16 MTO_Frag_Th_Tbl[];
  98. #define MTO_DATA_RATE() MTO_Data_Rate_Tbl[MTO_RATE_LEVEL()]
  99. #define MTO_FRAG_TH() MTO_Frag_Th_Tbl[MTO_FRAG_TH_LEVEL()]
  100. extern void MTO_Init(struct wbsoft_priv *);
  101. extern void MTO_PeriodicTimerExpired(struct wbsoft_priv *);
  102. extern void MTO_SetDTORateRange(struct wbsoft_priv *, u8 *, u8);
  103. extern u8 MTO_GetTxRate(struct wbsoft_priv *adapter, u32 fpdu_len);
  104. extern u8 MTO_GetTxFallbackRate(struct wbsoft_priv *adapter);
  105. extern void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 t0, u8 index);
  106. #endif /* __MTO_H__ */