wlan_mlo_epcs.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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_ie_present: EDCA IE present
  47. * @muedca_ie_present: MU EDCA IE present
  48. * @ven_wme_ie_present: WME IE present
  49. * @edca: EDCA IE
  50. * @muedca: MU EDCA IE
  51. * @ven_wme_ie_bytes: WME IE
  52. */
  53. struct ml_pa_partner_link_info {
  54. uint8_t link_id;
  55. uint8_t edca_ie_present:1,
  56. muedca_ie_present:1,
  57. ven_wme_ie_present:1;
  58. union {
  59. struct edca_ie edca;
  60. uint8_t ven_wme_ie_bytes[WLAN_VENDOR_WME_IE_LEN + 2];
  61. };
  62. struct muedca_ie muedca;
  63. };
  64. /**
  65. * struct ml_pa_info - priority access ML info
  66. * @mld_mac_addr: MLD mac address
  67. * @num_links: Number of Links
  68. * @link_info: Partner link information
  69. */
  70. struct ml_pa_info {
  71. struct qdf_mac_addr mld_mac_addr;
  72. uint8_t num_links;
  73. struct ml_pa_partner_link_info link_info[WLAN_UMAC_MLO_MAX_VDEVS];
  74. };
  75. /**
  76. * struct wlan_epcs_info - EPCS information of frame
  77. * @cat: frame category
  78. * @dialog_token: dialog token
  79. * @status: status
  80. * @pa_info: Priority access ML info
  81. */
  82. struct wlan_epcs_info {
  83. enum wlan_epcs_category cat;
  84. uint8_t dialog_token;
  85. uint16_t status;
  86. struct ml_pa_info pa_info;
  87. };
  88. /**
  89. * enum peer_epcs_state - epcs stat of peer
  90. * @EPCS_DOWN: EPCS state down
  91. * @EPCS_ENABLE: EPCS state enabled
  92. */
  93. enum peer_epcs_state {
  94. EPCS_DOWN,
  95. EPCS_ENABLE
  96. };
  97. /**
  98. * struct wlan_mlo_peer_epcs_info - Peer EPCS information
  99. * @state: EPCS state of peer
  100. * @self_gen_dialog_token: selfgenerated dialog token
  101. */
  102. struct wlan_mlo_peer_epcs_info {
  103. enum peer_epcs_state state;
  104. uint8_t self_gen_dialog_token;
  105. };
  106. /**
  107. * struct wlan_epcs_context - EPCS context if MLD
  108. */
  109. struct wlan_epcs_context {
  110. };
  111. /**
  112. * struct epcs_frm - EPCS action frame format
  113. * @category: category
  114. * @protected_eht_action: Protected EHT Action
  115. * @dialog_token: Dialog Token
  116. * @status_code: Status Code
  117. * @req: Request frame
  118. * @resp: Response frame
  119. * @bytes: Priority Access Multi-Link element bytes
  120. */
  121. struct epcs_frm {
  122. uint8_t category;
  123. uint8_t protected_eht_action;
  124. uint8_t dialog_token;
  125. union {
  126. struct {
  127. uint8_t bytes[0];
  128. } req;
  129. struct {
  130. uint8_t status_code[2];
  131. uint8_t bytes[0];
  132. } resp;
  133. };
  134. };
  135. /* MIN EPCS request frame length */
  136. #define EPCS_REQ_MIN_LENGTH 3
  137. /* MIN EPCS response frame length */
  138. #define EPCS_RESP_MIN_LENGTH 5
  139. #define epcs_alert(format, args...) \
  140. QDF_TRACE_FATAL(QDF_MODULE_ID_EPCS, format, ## args)
  141. #define epcs_err(format, args...) \
  142. QDF_TRACE_ERROR(QDF_MODULE_ID_EPCS, format, ## args)
  143. #define epcs_warn(format, args...) \
  144. QDF_TRACE_WARN(QDF_MODULE_ID_EPCS, format, ## args)
  145. #define epcs_info(format, args...) \
  146. QDF_TRACE_INFO(QDF_MODULE_ID_EPCS, format, ## args)
  147. #define epcs_debug(format, args...) \
  148. QDF_TRACE_DEBUG(QDF_MODULE_ID_EPCS, format, ## args)
  149. #define epcs_rl_debug(format, args...) \
  150. QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_EPCS, format, ## args)
  151. /**
  152. * wlan_mlo_add_epcs_action_frame() - API to add EPCS action frame
  153. * @frm: Pointer to a frame to add EPCS information
  154. * @args: EPCS action frame related info
  155. * @buf: Pointer to EPCS IE values
  156. *
  157. * Return: Pointer to the updated frame buffer
  158. */
  159. uint8_t *wlan_mlo_add_epcs_action_frame(uint8_t *frm,
  160. struct wlan_action_frame_args *args,
  161. uint8_t *buf);
  162. /**
  163. * wlan_mlo_parse_epcs_action_frame() - API to parse EPCS action frame
  164. * @epcs: Pointer to EPCS information
  165. * @action_frm: EPCS action frame
  166. * @frm_len: frame length
  167. *
  168. * Return: QDF_STATUS
  169. */
  170. QDF_STATUS
  171. wlan_mlo_parse_epcs_action_frame(struct wlan_epcs_info *epcs,
  172. struct wlan_action_frame *action_frm,
  173. uint32_t frm_len);
  174. /**
  175. * wlan_mlo_peer_rcv_cmd() - API to process EPCS command
  176. * @ml_peer: Pointer to ML peer received
  177. * @epcs: Pointer to EPCS information
  178. * @updparam: pointer to fill update parameters
  179. *
  180. * Return: QDF_STATUS
  181. */
  182. QDF_STATUS
  183. wlan_mlo_peer_rcv_cmd(struct wlan_mlo_peer_context *ml_peer,
  184. struct wlan_epcs_info *epcs,
  185. bool *updparam);
  186. /**
  187. * wlan_mlo_peer_rcv_action_frame() - API to process EPCS frame receive event
  188. * @ml_peer: Pointer to ML peer received
  189. * @epcs: Pointer to EPCS information
  190. * @respond: pointer to fill response required or not
  191. * @updparam: pointer to fill update parameters
  192. *
  193. * Return: QDF_STATUS
  194. */
  195. QDF_STATUS
  196. wlan_mlo_peer_rcv_action_frame(struct wlan_mlo_peer_context *ml_peer,
  197. struct wlan_epcs_info *epcs,
  198. bool *respond,
  199. bool *updparam);
  200. #endif /* _WLAN_MLO_EPCS_H_ */