phydm_hal_txbf_api.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #include "mp_precomp.h"
  2. #include "phydm_precomp.h"
  3. #if (defined(CONFIG_BB_TXBF_API))
  4. #if (RTL8822B_SUPPORT == 1)
  5. /*Add by YuChen for 8822B MU-MIMO API*/
  6. /*this function is only used for BFer*/
  7. u8
  8. phydm_get_ndpa_rate(
  9. void *p_dm_void
  10. )
  11. {
  12. struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
  13. u8 ndpa_rate = ODM_RATE6M;
  14. if (p_dm_odm->rssi_min >= 30) /*link RSSI > 30%*/
  15. ndpa_rate = ODM_RATE24M;
  16. else if (p_dm_odm->rssi_min <= 25)
  17. ndpa_rate = ODM_RATE6M;
  18. ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_TRACE, ("[%s] ndpa_rate = 0x%x\n", __func__, ndpa_rate));
  19. return ndpa_rate;
  20. }
  21. /*this function is only used for BFer*/
  22. u8
  23. phydm_get_beamforming_sounding_info(
  24. void *p_dm_void,
  25. u16 *troughput,
  26. u8 total_bfee_num,
  27. u8 *tx_rate
  28. )
  29. {
  30. u8 idx = 0;
  31. u8 soundingdecision = 0xff;
  32. struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
  33. for (idx = 0; idx < total_bfee_num; idx++) {
  34. if (((tx_rate[idx] >= ODM_RATEVHTSS3MCS7) && (tx_rate[idx] <= ODM_RATEVHTSS3MCS9)))
  35. soundingdecision = soundingdecision & ~(1 << idx);
  36. }
  37. for (idx = 0; idx < total_bfee_num; idx++) {
  38. if (troughput[idx] <= 10)
  39. soundingdecision = soundingdecision & ~(1 << idx);
  40. }
  41. ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_TRACE, ("[%s] soundingdecision = 0x%x\n", __func__, soundingdecision));
  42. return soundingdecision;
  43. }
  44. /*this function is only used for BFer*/
  45. u8
  46. phydm_get_mu_bfee_snding_decision(
  47. void *p_dm_void,
  48. u16 throughput
  49. )
  50. {
  51. u8 snding_score = 0;
  52. struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
  53. /*throughput unit is Mbps*/
  54. if (throughput >= 500)
  55. snding_score = 100;
  56. else if (throughput >= 450)
  57. snding_score = 90;
  58. else if (throughput >= 400)
  59. snding_score = 80;
  60. else if (throughput >= 350)
  61. snding_score = 70;
  62. else if (throughput >= 300)
  63. snding_score = 60;
  64. else if (throughput >= 250)
  65. snding_score = 50;
  66. else if (throughput >= 200)
  67. snding_score = 40;
  68. else if (throughput >= 150)
  69. snding_score = 30;
  70. else if (throughput >= 100)
  71. snding_score = 20;
  72. else if (throughput >= 50)
  73. snding_score = 10;
  74. else
  75. snding_score = 0;
  76. ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_TRACE, ("[%s] snding_score = 0x%x\n", __func__, snding_score));
  77. return snding_score;
  78. }
  79. #endif
  80. #if (DM_ODM_SUPPORT_TYPE != ODM_AP)
  81. u8
  82. beamforming_get_htndp_tx_rate(
  83. void *p_dm_void,
  84. u8 comp_steering_num_of_bfer
  85. )
  86. {
  87. struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
  88. u8 nr_index = 0;
  89. u8 ndp_tx_rate;
  90. /*Find nr*/
  91. #if (RTL8814A_SUPPORT == 1)
  92. if (p_dm_odm->support_ic_type & ODM_RTL8814A)
  93. nr_index = tx_bf_nr(hal_txbf_8814a_get_ntx(p_dm_odm), comp_steering_num_of_bfer);
  94. else
  95. #endif
  96. nr_index = tx_bf_nr(1, comp_steering_num_of_bfer);
  97. switch (nr_index) {
  98. case 1:
  99. ndp_tx_rate = ODM_MGN_MCS8;
  100. break;
  101. case 2:
  102. ndp_tx_rate = ODM_MGN_MCS16;
  103. break;
  104. case 3:
  105. ndp_tx_rate = ODM_MGN_MCS24;
  106. break;
  107. default:
  108. ndp_tx_rate = ODM_MGN_MCS8;
  109. break;
  110. }
  111. return ndp_tx_rate;
  112. }
  113. u8
  114. beamforming_get_vht_ndp_tx_rate(
  115. void *p_dm_void,
  116. u8 comp_steering_num_of_bfer
  117. )
  118. {
  119. struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
  120. u8 nr_index = 0;
  121. u8 ndp_tx_rate;
  122. /*Find nr*/
  123. #if (RTL8814A_SUPPORT == 1)
  124. if (p_dm_odm->support_ic_type & ODM_RTL8814A)
  125. nr_index = tx_bf_nr(hal_txbf_8814a_get_ntx(p_dm_odm), comp_steering_num_of_bfer);
  126. else
  127. #endif
  128. nr_index = tx_bf_nr(1, comp_steering_num_of_bfer);
  129. switch (nr_index) {
  130. case 1:
  131. ndp_tx_rate = ODM_MGN_VHT2SS_MCS0;
  132. break;
  133. case 2:
  134. ndp_tx_rate = ODM_MGN_VHT3SS_MCS0;
  135. break;
  136. case 3:
  137. ndp_tx_rate = ODM_MGN_VHT4SS_MCS0;
  138. break;
  139. default:
  140. ndp_tx_rate = ODM_MGN_VHT2SS_MCS0;
  141. break;
  142. }
  143. return ndp_tx_rate;
  144. }
  145. #endif
  146. #endif