wlan_mlo_epcs.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. #define EPCS_MAX_AUTHORIZE_MAC_ADDR 32
  107. /**
  108. * struct epcs_peer_authorize_info - EPCS authorized mac addresses
  109. * @valid: valid index if set t0 true
  110. * @peer_mld_mac: mld mac address
  111. */
  112. struct epcs_peer_authorize_info {
  113. bool valid;
  114. uint8_t peer_mld_mac[QDF_MAC_ADDR_SIZE];
  115. };
  116. /**
  117. * struct wlan_epcs_context - EPCS context if MLD
  118. * @authorize_info: Array of Authorization info containing peer mac address
  119. */
  120. struct wlan_epcs_context {
  121. struct epcs_peer_authorize_info
  122. authorize_info[EPCS_MAX_AUTHORIZE_MAC_ADDR];
  123. };
  124. /**
  125. * struct epcs_frm - EPCS action frame format
  126. * @category: category
  127. * @protected_eht_action: Protected EHT Action
  128. * @dialog_token: Dialog Token
  129. * @status_code: Status Code
  130. * @req: Request frame
  131. * @resp: Response frame
  132. * @bytes: Priority Access Multi-Link element bytes
  133. */
  134. struct epcs_frm {
  135. uint8_t category;
  136. uint8_t protected_eht_action;
  137. uint8_t dialog_token;
  138. union {
  139. struct {
  140. uint8_t bytes[0];
  141. } req;
  142. struct {
  143. uint8_t status_code[2];
  144. uint8_t bytes[0];
  145. } resp;
  146. };
  147. };
  148. /* MIN EPCS request frame length */
  149. #define EPCS_REQ_MIN_LENGTH 3
  150. /* MIN EPCS response frame length */
  151. #define EPCS_RESP_MIN_LENGTH 5
  152. #define epcs_alert(format, args...) \
  153. QDF_TRACE_FATAL(QDF_MODULE_ID_EPCS, format, ## args)
  154. #define epcs_err(format, args...) \
  155. QDF_TRACE_ERROR(QDF_MODULE_ID_EPCS, format, ## args)
  156. #define epcs_warn(format, args...) \
  157. QDF_TRACE_WARN(QDF_MODULE_ID_EPCS, format, ## args)
  158. #define epcs_info(format, args...) \
  159. QDF_TRACE_INFO(QDF_MODULE_ID_EPCS, format, ## args)
  160. #define epcs_debug(format, args...) \
  161. QDF_TRACE_DEBUG(QDF_MODULE_ID_EPCS, format, ## args)
  162. #define epcs_rl_debug(format, args...) \
  163. QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_EPCS, format, ## args)
  164. /**
  165. * wlan_mlo_add_epcs_action_frame() - API to add EPCS action frame
  166. * @frm: Pointer to a frame to add EPCS information
  167. * @args: EPCS action frame related info
  168. * @buf: Pointer to EPCS IE values
  169. *
  170. * Return: Pointer to the updated frame buffer
  171. */
  172. uint8_t *wlan_mlo_add_epcs_action_frame(uint8_t *frm,
  173. struct wlan_action_frame_args *args,
  174. uint8_t *buf);
  175. /**
  176. * wlan_mlo_parse_epcs_action_frame() - API to parse EPCS action frame
  177. * @epcs: Pointer to EPCS information
  178. * @action_frm: EPCS action frame
  179. * @frm_len: frame length
  180. *
  181. * Return: QDF_STATUS
  182. */
  183. QDF_STATUS
  184. wlan_mlo_parse_epcs_action_frame(struct wlan_epcs_info *epcs,
  185. struct wlan_action_frame *action_frm,
  186. uint32_t frm_len);
  187. /**
  188. * wlan_mlo_peer_rcv_cmd() - API to process EPCS command
  189. * @ml_peer: Pointer to ML peer received
  190. * @epcs: Pointer to EPCS information
  191. * @updparam: pointer to fill update parameters
  192. *
  193. * Return: QDF_STATUS
  194. */
  195. QDF_STATUS
  196. wlan_mlo_peer_rcv_cmd(struct wlan_mlo_peer_context *ml_peer,
  197. struct wlan_epcs_info *epcs,
  198. bool *updparam);
  199. /**
  200. * wlan_mlo_peer_rcv_action_frame() - API to process EPCS frame receive event
  201. * @ml_peer: Pointer to ML peer received
  202. * @epcs: Pointer to EPCS information
  203. * @respond: pointer to fill response required or not
  204. * @updparam: pointer to fill update parameters
  205. *
  206. * Return: QDF_STATUS
  207. */
  208. QDF_STATUS
  209. wlan_mlo_peer_rcv_action_frame(struct wlan_mlo_peer_context *ml_peer,
  210. struct wlan_epcs_info *epcs,
  211. bool *respond,
  212. bool *updparam);
  213. /**
  214. * wlan_mlo_update_authorize_epcs_mac_addr() - API to authorize mac addr
  215. * @vdev: pointer to vdev
  216. * @peer_mld_mac: mld mac address
  217. *
  218. * Return: QDF_STATUS
  219. */
  220. QDF_STATUS
  221. wlan_mlo_update_authorize_epcs_mac_addr(struct wlan_objmgr_vdev *vdev,
  222. uint8_t *peer_mld_mac);
  223. /**
  224. * wlan_mlo_update_deauthorize_epcs_mac_addr() - API to deauthorize mac addr
  225. * @vdev: pointer to vdev
  226. * @peer_mld_mac: mld mac address
  227. *
  228. * Return: QDF_STATUS
  229. */
  230. QDF_STATUS
  231. wlan_mlo_update_deauthorize_epcs_mac_addr(struct wlan_objmgr_vdev *vdev,
  232. uint8_t *peer_mld_mac);
  233. #endif /* _WLAN_MLO_EPCS_H_ */