wmi_unified_twt_param.h 14 KB

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