wmi_unified_atf_param.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /*
  19. * This file contains the API definitions for the Unified Wireless Module
  20. * Interface (WMI).
  21. */
  22. #ifndef _WMI_UNIFIED_ATF_PARAM_H_
  23. #define _WMI_UNIFIED_ATF_PARAM_H_
  24. #define ATF_ACTIVED_MAX_CLIENTS 50
  25. #define ATF_ACTIVED_MAX_ATFGROUPS 16
  26. /**
  27. * struct atf_peer_info - ATF peer info params
  28. * @peer_macaddr: peer mac addr
  29. * @percentage_peer: percentage of air time for this peer
  30. * @vdev_id: Associated vdev id
  31. * @pdev_id: Associated pdev id
  32. */
  33. typedef struct {
  34. struct wmi_macaddr_t peer_macaddr;
  35. uint32_t percentage_peer;
  36. uint32_t vdev_id;
  37. uint32_t pdev_id;
  38. } atf_peer_info;
  39. /**
  40. * struct bwf_peer_info_t - BWF peer info params
  41. * @peer_macaddr: peer mac addr
  42. * @throughput: Throughput
  43. * @max_airtime: Max airtime
  44. * @priority: Priority level
  45. * @reserved: Reserved array
  46. * @vdev_id: Associated vdev id
  47. * @pdev_id: Associated pdev id
  48. */
  49. typedef struct {
  50. struct wmi_macaddr_t peer_macaddr;
  51. uint32_t throughput;
  52. uint32_t max_airtime;
  53. uint32_t priority;
  54. uint32_t reserved[4];
  55. uint32_t vdev_id;
  56. uint32_t pdev_id;
  57. } bwf_peer_info;
  58. /**
  59. * struct set_bwf_params - BWF params
  60. * @num_peers: number of peers
  61. * @atf_peer_info: BWF peer info
  62. */
  63. struct set_bwf_params {
  64. uint32_t num_peers;
  65. bwf_peer_info peer_info[1];
  66. };
  67. /**
  68. * struct atf_peer_ext_info - ATF peer ext info params
  69. * @peer_macaddr: peer mac address
  70. * @group_index: group index
  71. * @atf_index_reserved: ATF index rsvd
  72. * @vdev_id: Associated vdev id
  73. * @pdev_id: Associated pdev id
  74. */
  75. typedef struct {
  76. struct wmi_macaddr_t peer_macaddr;
  77. uint32_t group_index;
  78. uint32_t atf_index_reserved;
  79. uint16_t vdev_id;
  80. uint16_t pdev_id;
  81. } atf_peer_ext_info;
  82. /**
  83. * struct set_atf_params - ATF params
  84. * @num_peers: number of peers
  85. * @atf_peer_info: ATF peer info
  86. */
  87. struct set_atf_params {
  88. uint32_t num_peers;
  89. atf_peer_info peer_info[ATF_ACTIVED_MAX_CLIENTS];
  90. };
  91. /**
  92. * struct atf_peer_request_params - ATF peer req params
  93. * @num_peers: number of peers
  94. * @atf_peer_ext_info: ATF peer ext info
  95. */
  96. struct atf_peer_request_params {
  97. uint32_t num_peers;
  98. atf_peer_ext_info peer_ext_info[ATF_ACTIVED_MAX_CLIENTS];
  99. };
  100. /**
  101. * struct atf_group_info - ATF group info params
  102. * @percentage_group: Percentage AT for group
  103. * @atf_group_units_reserved: ATF group information
  104. * @pdev_id: Associated pdev id
  105. */
  106. typedef struct {
  107. uint32_t percentage_group;
  108. uint32_t atf_group_units_reserved;
  109. uint32_t pdev_id;
  110. } atf_group_info;
  111. /**
  112. * struct atf_grouping_params - ATF grouping params
  113. * @num_groups: number of groups
  114. * @group_inf: Group informaition
  115. */
  116. struct atf_grouping_params {
  117. uint32_t num_groups;
  118. atf_group_info group_info[ATF_ACTIVED_MAX_ATFGROUPS];
  119. };
  120. /**
  121. * struct atf_group_wmm_ac_info - ATF group AC info params
  122. * @atf_config_ac_be: Relative ATF% for BE traffic
  123. * @atf_config_ac_bk: Relative ATF% for BK traffic
  124. * @atf_config_ac_vi: Relative ATF% for VI traffic
  125. * @atf_config_ac_vo: Relative ATF% for VO traffic
  126. * @reserved: Reserved for future use
  127. */
  128. struct atf_group_wmm_ac_info {
  129. uint32_t atf_config_ac_be;
  130. uint32_t atf_config_ac_bk;
  131. uint32_t atf_config_ac_vi;
  132. uint32_t atf_config_ac_vo;
  133. uint32_t reserved[2];
  134. };
  135. /**
  136. * struct atf_grp_ac_params - ATF group AC config params
  137. * @num_groups: number of groups
  138. * @group_inf: Group informaition
  139. */
  140. struct atf_group_ac_params {
  141. uint32_t num_groups;
  142. struct atf_group_wmm_ac_info group_info[ATF_ACTIVED_MAX_ATFGROUPS];
  143. };
  144. enum {
  145. WMI_HOST_ATF_PEER_STATS_DISABLED = 0,
  146. WMI_HOST_ATF_PEER_STATS_ENABLED = 1,
  147. };
  148. #define WMI_HOST_ATF_PEER_STATS_GET_PEER_AST_IDX(token_info) \
  149. (token_info.field1 & 0xffff)
  150. #define WMI_HOST_ATF_PEER_STATS_GET_USED_TOKENS(token_info) \
  151. ((token_info.field2 & 0xffff0000) >> 16)
  152. #define WMI_HOST_ATF_PEER_STATS_GET_UNUSED_TOKENS(token_info) \
  153. (token_info.field2 & 0xffff)
  154. #define WMI_HOST_ATF_PEER_STATS_SET_PEER_AST_IDX(token_info, peer_ast_idx) \
  155. do { \
  156. token_info.field1 &= 0xffff0000; \
  157. token_info.field1 |= ((peer_ast_idx) & 0xffff); \
  158. } while (0)
  159. #define WMI_HOST_ATF_PEER_STATS_SET_USED_TOKENS(token_info, used_token) \
  160. do { \
  161. token_info.field2 &= 0x0000ffff; \
  162. token_info.field2 |= (((used_token) & 0xffff) << 16); \
  163. } while (0)
  164. #define WMI_HOST_ATF_PEER_STATS_SET_UNUSED_TOKENS(token_info, unused_token) \
  165. do { \
  166. token_info.field2 &= 0xffff0000; \
  167. token_info.field2 |= ((unused_token) & 0xffff); \
  168. } while (0)
  169. /**
  170. * struct wmi_host_atf_peer_stats_info
  171. * @field1: bits 15:0 peer_ast_index WMI_ATF_PEER_STATS_GET_PEER_AST_IDX
  172. * bits 31:16 reserved
  173. * @field2: bits 15:0 used tokens WMI_ATF_PEER_STATS_GET_USED_TOKENS
  174. * bits 31:16 unused tokens WMI_ATF_PEER_STATS_GET_UNUSED_TOKENS
  175. * @field3: for future use
  176. */
  177. typedef struct {
  178. uint32_t field1;
  179. uint32_t field2;
  180. uint32_t field3;
  181. } wmi_host_atf_peer_stats_info;
  182. /**
  183. * struct wmi_host_atf_peer_stats_event
  184. * @pdev_id: pdev_id
  185. * @num_atf_peers: number of peers in token_info_list
  186. * @comp_usable_airtime: computed usable airtime in tokens
  187. * @reserved[4]: reserved for future use
  188. * @wmi_host_atf_peer_stats_info token_info_list: list of num_atf_peers
  189. */
  190. typedef struct {
  191. uint32_t pdev_id;
  192. uint32_t num_atf_peers;
  193. uint32_t comp_usable_airtime;
  194. uint32_t reserved[4];
  195. wmi_host_atf_peer_stats_info token_info_list[1];
  196. } wmi_host_atf_peer_stats_event;
  197. #endif /* _WMI_UNIFIED_ATF_PARAM_H_ */