wlan_mlo_epcs.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /**
  17. * DOC: contains EPCS APIs
  18. */
  19. #ifndef _WLAN_MLO_EPCS_H_
  20. #define _WLAN_MLO_EPCS_H_
  21. #include <wlan_cmn_ieee80211.h>
  22. #include <wlan_mlo_mgr_public_structs.h>
  23. #ifdef WMI_AP_SUPPORT
  24. #include <wlan_cmn.h>
  25. #endif
  26. struct wlan_mlo_peer_context;
  27. /**
  28. * enum wlan_epcs_category - epcs category
  29. *
  30. * @WLAN_EPCS_CATEGORY_NONE: none
  31. * @WLAN_EPCS_CATEGORY_REQUEST: EPCS request
  32. * @WLAN_EPCS_CATEGORY_RESPONSE: EPCS response
  33. * @WLAN_EPCS_CATEGORY_TEARDOWN: EPCS teardown
  34. * @WLAN_EPCS_CATEGORY_INVALID: Invalid
  35. */
  36. enum wlan_epcs_category {
  37. WLAN_EPCS_CATEGORY_NONE = 0,
  38. WLAN_EPCS_CATEGORY_REQUEST = 3,
  39. WLAN_EPCS_CATEGORY_RESPONSE = 4,
  40. WLAN_EPCS_CATEGORY_TEARDOWN = 5,
  41. WLAN_EPCS_CATEGORY_INVALID,
  42. };
  43. /**
  44. * struct ml_pa_partner_link_info - Priority Access ML partner information
  45. * @link_id: Link ID
  46. * @edca: EDCA IE
  47. * @muedca: MU EDCA IE
  48. */
  49. struct ml_pa_partner_link_info {
  50. uint8_t link_id;
  51. struct edca_ie edca;
  52. struct muedca_ie muedca;
  53. };
  54. /**
  55. * struct ml_pa_info - priority access ML info
  56. * @mld_mac_addr: MLD mac address
  57. * @num_links: Number of Links
  58. * @link_info: Partner link information
  59. */
  60. struct ml_pa_info {
  61. struct qdf_mac_addr mld_mac_addr;
  62. uint8_t num_links;
  63. struct ml_pa_partner_link_info link_info[WLAN_UMAC_MLO_MAX_VDEVS];
  64. };
  65. /**
  66. * struct wlan_epcs_info - EPCS information of frame
  67. * @cat: frame category
  68. * @dialog_token: dialog token
  69. * @status: status
  70. * @pa_info: Priority access ML info
  71. */
  72. struct wlan_epcs_info {
  73. enum wlan_epcs_category cat;
  74. uint8_t dialog_token;
  75. uint16_t status;
  76. struct ml_pa_info pa_info;
  77. };
  78. /**
  79. * enum peer_epcs_state - epcs stat of peer
  80. * @EPCS_DOWN: EPCS state down
  81. * @EPCS_ENABLE: EPCS state enabled
  82. */
  83. enum peer_epcs_state {
  84. EPCS_DOWN,
  85. EPCS_ENABLE
  86. };
  87. /**
  88. * struct wlan_mlo_peer_epcs_info - Peer EPCS information
  89. * @state: EPCS state of peer
  90. * @self_gen_dialog_token: selfgenerated dialog token
  91. */
  92. struct wlan_mlo_peer_epcs_info {
  93. enum peer_epcs_state state;
  94. uint8_t self_gen_dialog_token;
  95. };
  96. /**
  97. * struct wlan_epcs_context - EPCS context if MLD
  98. */
  99. struct wlan_epcs_context {
  100. };
  101. /**
  102. * struct epcs_frm - EPCS action frame format
  103. * @category: category
  104. * @protected_eht_action: Protected EHT Action
  105. * @dialog_token: Dialog Token
  106. * @status_code: Status Code
  107. * @req: Request frame
  108. * @resp: Response frame
  109. * @bytes: Priority Access Multi-Link element bytes
  110. */
  111. struct epcs_frm {
  112. uint8_t category;
  113. uint8_t protected_eht_action;
  114. uint8_t dialog_token;
  115. union {
  116. struct {
  117. uint8_t bytes[0];
  118. } req;
  119. struct {
  120. uint8_t status_code[2];
  121. uint8_t bytes[0];
  122. } resp;
  123. };
  124. };
  125. /* MIN EPCS request frame length */
  126. #define EPCS_REQ_MIN_LENGTH 3
  127. /* MIN EPCS response frame length */
  128. #define EPCS_RESP_MIN_LENGTH 5
  129. #define epcs_alert(format, args...) \
  130. QDF_TRACE_FATAL(QDF_MODULE_ID_EPCS, format, ## args)
  131. #define epcs_err(format, args...) \
  132. QDF_TRACE_ERROR(QDF_MODULE_ID_EPCS, format, ## args)
  133. #define epcs_warn(format, args...) \
  134. QDF_TRACE_WARN(QDF_MODULE_ID_EPCS, format, ## args)
  135. #define epcs_info(format, args...) \
  136. QDF_TRACE_INFO(QDF_MODULE_ID_EPCS, format, ## args)
  137. #define epcs_debug(format, args...) \
  138. QDF_TRACE_DEBUG(QDF_MODULE_ID_EPCS, format, ## args)
  139. #define epcs_rl_debug(format, args...) \
  140. QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_EPCS, format, ## args)
  141. /**
  142. * wlan_mlo_add_epcs_action_frame() - API to add EPCS action frame
  143. * @frm: Pointer to a frame to add EPCS information
  144. * @args: EPCS action frame related info
  145. * @buf: Pointer to EPCS IE values
  146. *
  147. * Return: Pointer to the updated frame buffer
  148. */
  149. uint8_t *wlan_mlo_add_epcs_action_frame(uint8_t *frm,
  150. struct wlan_action_frame_args *args,
  151. uint8_t *buf);
  152. /**
  153. * wlan_mlo_parse_epcs_action_frame() - API to parse EPCS action frame
  154. * @epcs: Pointer to EPCS information
  155. * @action_frm: EPCS action frame
  156. * @frm_len: frame length
  157. *
  158. * Return: QDF_STATUS
  159. */
  160. QDF_STATUS
  161. wlan_mlo_parse_epcs_action_frame(struct wlan_epcs_info *epcs,
  162. struct wlan_action_frame *action_frm,
  163. uint32_t frm_len);
  164. /**
  165. * wlan_mlo_peer_rcv_cmd() - API to process EPCS command
  166. * @ml_peer: Pointer to ML peer received
  167. * @epcs: Pointer to EPCS information
  168. * @updparam: pointer to fill update parameters
  169. *
  170. * Return: QDF_STATUS
  171. */
  172. QDF_STATUS
  173. wlan_mlo_peer_rcv_cmd(struct wlan_mlo_peer_context *ml_peer,
  174. struct wlan_epcs_info *epcs,
  175. bool *updparam);
  176. /**
  177. * wlan_mlo_peer_rcv_action_frame() - API to process EPCS frame receive event
  178. * @ml_peer: Pointer to ML peer received
  179. * @epcs: Pointer to EPCS information
  180. * @respond: pointer to fill response required or not
  181. * @updparam: pointer to fill update parameters
  182. *
  183. * Return: QDF_STATUS
  184. */
  185. QDF_STATUS
  186. wlan_mlo_peer_rcv_action_frame(struct wlan_mlo_peer_context *ml_peer,
  187. struct wlan_epcs_info *epcs,
  188. bool *respond,
  189. bool *updparam);
  190. #endif /* _WLAN_MLO_EPCS_H_ */