wmi_unified_twt_param.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. /*
  2. * Copyright (c) 2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file contains the API definitions for the TWT WMI APIs.
  23. */
  24. #ifndef _WMI_UNIFIED_TWT_PARAM_H_
  25. #define _WMI_UNIFIED_TWT_PARAM_H_
  26. /**
  27. * @pdev_id: pdev_id for identifying the MAC.
  28. * @sta_cong_timer_ms: STA TWT congestion timer TO value in terms of ms
  29. * @mbss_support: Flag indicating if AP TWT feature supported in
  30. * MBSS mode or not.
  31. * @default_slot_size: This is the default value for the TWT slot setup
  32. * by AP (units = microseconds)
  33. * @congestion_thresh_setup: Minimum congestion required to start setting
  34. * up TWT sessions
  35. * @congestion_thresh_teardown: Minimum congestion below which TWT will be
  36. * torn down (in percent of occupied airtime)
  37. * @congestion_thresh_critical: Threshold above which TWT will not be active
  38. * (in percent of occupied airtime)
  39. * @interference_thresh_teardown: Minimum interference above that TWT
  40. * will not be active. The interference parameters use an
  41. * abstract method of evaluating interference.
  42. * The parameters are in percent, ranging from 0 for no
  43. * interference, to 100 for interference extreme enough
  44. * to completely block the signal of interest.
  45. * @interference_thresh_setup: Minimum interference below that TWT session
  46. * can be setup. The interference parameters use an
  47. * abstract method of evaluating interference.
  48. * The parameters are in percent, ranging from 0 for no
  49. * interference, to 100 for interference extreme enough
  50. * to completely block the signal of interest.
  51. * @min_no_sta_setup: Minimum no of STA required to start TWT setup
  52. * @min_no_sta_teardown: Minimum no of STA below which TWT will be torn down
  53. * @no_of_bcast_mcast_slots: Number of default slot sizes reserved for
  54. * BCAST/MCAST delivery
  55. * @min_no_twt_slots: Minimum no of available slots for TWT to be operational
  56. * @max_no_sta_twt: Max no of STA with which TWT is possible
  57. * (must be <= the wmi_resource_config's twt_ap_sta_count value)
  58. * * The below interval parameters have units of milliseconds.
  59. * @mode_check_interval: Interval between two successive check to decide the
  60. * mode of TWT. (units = milliseconds)
  61. * @add_sta_slot_interval: Interval between decisions making to create
  62. * TWT slots for STAs. (units = milliseconds)
  63. * @remove_sta_slot_interval: Inrerval between decisions making to remove TWT
  64. * slot of STAs. (units = milliseconds)
  65. */
  66. struct wmi_twt_enable_param {
  67. uint32_t pdev_id;
  68. uint32_t sta_cong_timer_ms;
  69. uint32_t mbss_support;
  70. uint32_t default_slot_size;
  71. uint32_t congestion_thresh_setup;
  72. uint32_t congestion_thresh_teardown;
  73. uint32_t congestion_thresh_critical;
  74. uint32_t interference_thresh_teardown;
  75. uint32_t interference_thresh_setup;
  76. uint32_t min_no_sta_setup;
  77. uint32_t min_no_sta_teardown;
  78. uint32_t no_of_bcast_mcast_slots;
  79. uint32_t min_no_twt_slots;
  80. uint32_t max_no_sta_twt;
  81. uint32_t mode_check_interval;
  82. uint32_t add_sta_slot_interval;
  83. uint32_t remove_sta_slot_interval;
  84. };
  85. /* status code of enabling TWT
  86. * WMI_ENABLE_TWT_STATUS_OK: enabling TWT successfully completed
  87. * WMI_ENABLE_TWT_STATUS_ALREADY_ENABLED: TWT already enabled
  88. * WMI_ENABLE_TWT_STATUS_NOT_READY: FW not ready for enabling TWT
  89. * WMI_ENABLE_TWT_INVALID_PARAM: invalid parameters
  90. * WMI_ENABLE_TWT_STATUS_UNKNOWN_ERROR: enabling TWT failed with an
  91. * unknown reason
  92. */
  93. enum WMI_HOST_ENABLE_TWT_STATUS {
  94. WMI_HOST_ENABLE_TWT_STATUS_OK,
  95. WMI_HOST_ENABLE_TWT_STATUS_ALREADY_ENABLED,
  96. WMI_HOST_ENABLE_TWT_STATUS_NOT_READY,
  97. WMI_HOST_ENABLE_TWT_INVALID_PARAM,
  98. WMI_HOST_ENABLE_TWT_STATUS_UNKNOWN_ERROR,
  99. };
  100. /** struct wmi_twt_enable_complete_event_param:
  101. * @pdev_is: pdev_id for identifying the MAC.
  102. * @status: From enum WMI_HOST_ENABLE_TWT_STATUS
  103. */
  104. struct wmi_twt_enable_complete_event_param {
  105. uint32_t pdev_id;
  106. uint32_t status;
  107. };
  108. /** struct wmi_twt_disable_param:
  109. * @pdev_id: pdev_id for identifying the MAC.
  110. */
  111. struct wmi_twt_disable_param {
  112. uint32_t pdev_id;
  113. };
  114. /** struct wmi_twt_disable_complete_event:
  115. * @pdev_id: pdev_id for identifying the MAC.
  116. */
  117. struct wmi_twt_disable_complete_event {
  118. uint32_t pdev_id;
  119. };
  120. /* from IEEE 802.11ah section 9.4.2.200 */
  121. enum WMI_HOST_TWT_COMMAND {
  122. WMI_HOST_TWT_COMMAND_REQUEST_TWT = 0,
  123. WMI_HOST_TWT_COMMAND_SUGGEST_TWT = 1,
  124. WMI_HOST_TWT_COMMAND_DEMAND_TWT = 2,
  125. WMI_HOST_TWT_COMMAND_TWT_GROUPING = 3,
  126. WMI_HOST_TWT_COMMAND_ACCEPT_TWT = 4,
  127. WMI_HOST_TWT_COMMAND_ALTERNATE_TWT = 5,
  128. WMI_HOST_TWT_COMMAND_DICTATE_TWT = 6,
  129. WMI_HOST_TWT_COMMAND_REJECT_TWT = 7,
  130. };
  131. /** struct wmi_twt_add_dialog_param -
  132. * @vdev_id: VDEV identifier
  133. * @peer_macaddr: peer MAC address when vdev is AP VDEV
  134. * @dialog_id: diaglog_id (TWT dialog ID)
  135. * This dialog ID must be unique within its vdev.
  136. * @wake_intvl_us: TWT Wake Interval in units of us
  137. * @wake_intvl_mantis: TWT Wake Interval Mantissa
  138. * - wake_intvl_mantis must be <= 0xFFFF
  139. * - wake_intvl_us must be divided evenly by wake_intvl_mantis,
  140. * i.e., wake_intvl_us % wake_intvl_mantis == 0
  141. * - the quotient of wake_intvl_us/wake_intvl_mantis must be
  142. * 2 to N-th(0<=N<=31) power,
  143. * i.e., wake_intvl_us/wake_intvl_mantis == 2^N, 0<=N<=31
  144. * @wake_dura_us: TWT Wake Duration in units of us, must be <= 0xFFFF
  145. * wake_dura_us must be divided evenly by 256,
  146. * i.e., wake_dura_us % 256 == 0
  147. * @sp_offset_us: this long time after TWT setup the 1st SP will start.
  148. * @twt_cmd: cmd from enum WMI_HOST_TWT_COMAND
  149. * @flag_bcast: 0 means Individual TWT,
  150. * 1 means Broadcast TWT
  151. * @flag_trigger: 0 means non-Trigger-enabled TWT,
  152. * 1 means means Trigger-enabled TWT
  153. * @flag_flow_type: 0 means announced TWT,
  154. * 1 means un-announced TWT
  155. * @flag_protection: 0 means TWT protection is required,
  156. * 1 means TWT protection is not required
  157. */
  158. struct wmi_twt_add_dialog_param {
  159. uint32_t vdev_id;
  160. uint8_t peer_macaddr[6];
  161. uint32_t dialog_id;
  162. uint32_t wake_intvl_us;
  163. uint32_t wake_intvl_mantis;
  164. uint32_t wake_dura_us;
  165. uint32_t sp_offset_us;
  166. enum WMI_HOST_TWT_COMMAND twt_cmd;
  167. uint32_t
  168. flag_bcast:1,
  169. flag_trigger:1,
  170. flag_flow_type:1,
  171. flag_protection:1;
  172. };
  173. /* enum - status code of adding TWT dialog
  174. * WMI_HOST_ADD_TWT_STATUS_OK: adding TWT dialog successfully completed
  175. * WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED: TWT not enabled
  176. * WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID: TWT dialog ID is already used
  177. * WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM: invalid parameters
  178. * WMI_HOST_ADD_TWT_STATUS_NOT_READY: FW not ready
  179. * WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE: FW resource exhausted
  180. * WMI_HOST_ADD_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
  181. * request/response frame
  182. * WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE: peer AP did not send the response frame
  183. * WMI_HOST_ADD_TWT_STATUS_DENIED: AP did not accept the request
  184. * WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR: adding TWT dialog failed with
  185. * an unknown reason
  186. */
  187. enum WMI_HOST_ADD_TWT_STATUS {
  188. WMI_HOST_ADD_TWT_STATUS_OK,
  189. WMI_HOST_ADD_TWT_STATUS_TWT_NOT_ENABLED,
  190. WMI_HOST_ADD_TWT_STATUS_USED_DIALOG_ID,
  191. WMI_HOST_ADD_TWT_STATUS_INVALID_PARAM,
  192. WMI_HOST_ADD_TWT_STATUS_NOT_READY,
  193. WMI_HOST_ADD_TWT_STATUS_NO_RESOURCE,
  194. WMI_HOST_ADD_TWT_STATUS_NO_ACK,
  195. WMI_HOST_ADD_TWT_STATUS_NO_RESPONSE,
  196. WMI_HOST_ADD_TWT_STATUS_DENIED,
  197. WMI_HOST_ADD_TWT_STATUS_UNKNOWN_ERROR,
  198. };
  199. /** struct wmi_twt_add_dialog_complete_param -
  200. * @vdev_id: VDEV identifier
  201. * @dialog_id: TWT dialog ID
  202. * @status: refer to WMI_HOST_ADD_TWT_STATUS enum
  203. */
  204. struct wmi_twt_add_dialog_complete_event_param {
  205. uint32_t vdev_id;
  206. uint32_t dialog_id;
  207. uint32_t status;
  208. };
  209. /** struct wmi_twt_del_dialog_param -
  210. * @vdev_id: VDEV identifier
  211. * @dialog_id: TWT dialog ID
  212. */
  213. struct wmi_twt_del_dialog_param {
  214. uint32_t vdev_id;
  215. uint32_t dialog_id;
  216. };
  217. /* status code of deleting TWT dialog
  218. * WMI_HOST_DEL_TWT_STATUS_OK: deleting TWT dialog successfully completed
  219. * WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
  220. * WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM: invalid parameters
  221. * WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
  222. * this dialog
  223. * WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE: FW resource exhausted
  224. * WMI_HOST_DEL_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the request/response
  225. * frame
  226. * WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR: deleting TWT dialog failed with an
  227. * unknown reason
  228. */
  229. enum WMI_HOST_DEL_TWT_STATUS {
  230. WMI_HOST_DEL_TWT_STATUS_OK,
  231. WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_NOT_EXIST,
  232. WMI_HOST_DEL_TWT_STATUS_INVALID_PARAM,
  233. WMI_HOST_DEL_TWT_STATUS_DIALOG_ID_BUSY,
  234. WMI_HOST_DEL_TWT_STATUS_NO_RESOURCE,
  235. WMI_HOST_DEL_TWT_STATUS_NO_ACK,
  236. WMI_HOST_DEL_TWT_STATUS_UNKNOWN_ERROR,
  237. };
  238. /** struct wmi_twt_del_dialog_complete_event_param -
  239. * @vdev_id: VDEV identifier
  240. * @dialog_id: TWT dialog ID
  241. * @status: refer to WMI_HOST_DEL_TWT_STATUS enum
  242. */
  243. struct wmi_twt_del_dialog_complete_event_param {
  244. uint32_t vdev_id;
  245. uint32_t dialog_id;
  246. uint32_t status;
  247. };
  248. /** struct wmi_twt_pause_dialog_cmd_param -
  249. * @vdev_id: VDEV identifier
  250. * @dialog_id: TWT dialog ID
  251. */
  252. struct wmi_twt_pause_dialog_cmd_param {
  253. uint32_t vdev_id;
  254. uint32_t dialog_id;
  255. };
  256. /* enum WMI_HOST_PAUSE_TWT_STATUS - status code of pausing TWT dialog
  257. * WMI_HOST_PAUSE_TWT_STATUS_OK: pausing TWT dialog successfully completed
  258. * WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
  259. * WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM: invalid parameters
  260. * WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
  261. * this dialog
  262. * WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE: FW resource exhausted
  263. * WMI_HOST_PAUSE_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
  264. * request/response frame
  265. * WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR: pausing TWT dialog failed with an
  266. * unknown reason
  267. */
  268. enum WMI_HOST_PAUSE_TWT_STATUS {
  269. WMI_HOST_PAUSE_TWT_STATUS_OK,
  270. WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_NOT_EXIST,
  271. WMI_HOST_PAUSE_TWT_STATUS_INVALID_PARAM,
  272. WMI_HOST_PAUSE_TWT_STATUS_DIALOG_ID_BUSY,
  273. WMI_HOST_PAUSE_TWT_STATUS_NO_RESOURCE,
  274. WMI_HOST_PAUSE_TWT_STATUS_NO_ACK,
  275. WMI_HOST_PAUSE_TWT_STATUS_UNKNOWN_ERROR,
  276. };
  277. /** struct wmi_twt_pause_dialog_complete_event_param -
  278. * @vdev_id: VDEV identifier
  279. * @dialog_id: TWT dialog ID
  280. * @status: refer to WMI_HOST_PAUSE_TWT_STATUS
  281. */
  282. struct wmi_twt_pause_dialog_complete_event_param {
  283. uint32_t vdev_id;
  284. uint32_t dialog_id;
  285. uint32_t status;
  286. };
  287. /** struct wmi_twt_resume_dialog_cmd_param -
  288. * @vdev_id: VDEV identifier
  289. * @dialog_id: TWT dialog ID
  290. * @sp_offset_us: this long time after TWT resumed the 1st SP will start
  291. */
  292. struct wmi_twt_resume_dialog_cmd_param {
  293. uint32_t vdev_id;
  294. uint32_t dialog_id;
  295. uint32_t sp_offset_us;
  296. };
  297. /* enum WMI_HOST_RESUME_TWT_STATUS - status code of resuming TWT dialog
  298. * WMI_HOST_RESUME_TWT_STATUS_OK: resuming TWT dialog successfully completed
  299. * WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST: TWT dialog ID not exists
  300. * WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM: invalid parameters
  301. * WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY: FW is in the process of handling
  302. * this dialog
  303. * WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED: dialog not paused currently
  304. * WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE: FW resource exhausted
  305. * WMI_HOST_RESUME_TWT_STATUS_NO_ACK: peer AP/STA did not ACK the
  306. * request/response frame
  307. * WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR: resuming TWT dialog failed with an
  308. * unknown reason
  309. */
  310. enum WMI_HOST_RESUME_TWT_STATUS {
  311. WMI_HOST_RESUME_TWT_STATUS_OK,
  312. WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_NOT_EXIST,
  313. WMI_HOST_RESUME_TWT_STATUS_INVALID_PARAM,
  314. WMI_HOST_RESUME_TWT_STATUS_DIALOG_ID_BUSY,
  315. WMI_HOST_RESUME_TWT_STATUS_NOT_PAUSED,
  316. WMI_HOST_RESUME_TWT_STATUS_NO_RESOURCE,
  317. WMI_HOST_RESUME_TWT_STATUS_NO_ACK,
  318. WMI_HOST_RESUME_TWT_STATUS_UNKNOWN_ERROR,
  319. };
  320. /** struct wmi_twt_resume_dialog_complete_event_param -
  321. * @vdev_id: VDEV identifier
  322. * @dialog_id: TWT dialog ID
  323. * @status: refer to WMI_HOST_RESUME_TWT_STATUS
  324. */
  325. struct wmi_twt_resume_dialog_complete_event_param {
  326. uint32_t vdev_id;
  327. uint32_t dialog_id;
  328. uint32_t status;
  329. };
  330. #endif /* _WMI_UNIFIED_TWT_PARAM_H_ */