utils_mlo.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. /*
  18. * DOC: contains MLO manager containing util public api's
  19. */
  20. #ifndef _WLAN_UTILS_MLO_H_
  21. #define _WLAN_UTILS_MLO_H_
  22. #include <wlan_cmn_ieee80211.h>
  23. #include "wlan_mlo_mgr_public_structs.h"
  24. #include <wlan_cm_ucfg_api.h>
  25. #include <wlan_objmgr_vdev_obj.h>
  26. #ifdef WLAN_FEATURE_11BE_MLO
  27. #define FC0_IEEE_MGMT_FRM 0x10
  28. #define FC1_IEEE_MGMT_FRM 0x00
  29. /**
  30. * util_gen_link_assoc_rsp - Generate link association response
  31. *
  32. * @frame: association response frame ptr
  33. * @len: length of assoc rsp frame
  34. * @link_addr: link mac addr
  35. * @new_ie: Generated Link assoc rsp
  36. *
  37. * Return: true if vdev is a link vdev, false otherwise
  38. */
  39. QDF_STATUS
  40. util_gen_link_assoc_rsp(uint8_t *frame, qdf_size_t len,
  41. struct qdf_mac_addr link_addr, uint8_t *new_ie);
  42. /**
  43. * util_find_mlie - Find the first Multi-Link element or the start of the first
  44. * Multi-Link element fragment sequence in a given buffer containing elements,
  45. * if a Multi-Link element or element fragment sequence exists in the given
  46. * buffer.
  47. *
  48. * @buf: Buffer to be searched for the Multi-Link element or the start of the
  49. * Multi-Link element fragment sequence
  50. * @buflen: Length of the buffer
  51. * @mlieseq: Pointer to location where the starting address of the Multi-Link
  52. * element or Multi-Link element fragment sequence should be updated if found
  53. * in the given buffer. The value NULL will be updated to this location if the
  54. * element or element fragment sequence is not found. This should be ignored by
  55. * the caller if the function returns error.
  56. * @mlieseqlen: Pointer to location where the total length of the Multi-Link
  57. * element or Multi-Link element fragment sequence should be updated if found
  58. * in the given buffer. This should be ignored by the caller if the function
  59. * returns error, or if the function indicates that the element or element
  60. * fragment sequence was not found by providing a starting address of NULL.
  61. *
  62. * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
  63. * the reason for error in the case of failure
  64. */
  65. QDF_STATUS
  66. util_find_mlie(uint8_t *buf, qdf_size_t buflen, uint8_t **mlieseq,
  67. qdf_size_t *mlieseqlen);
  68. /**
  69. * util_get_mlie_variant - Get the variant of the given Multi-Link element or
  70. * element fragment sequence.
  71. *
  72. * @mlieseq: Starting address of the Multi-Link element or Multi-Link element
  73. * fragment sequence
  74. * @mlieseqlen: Total length of the Multi-Link element or Multi-Link element
  75. * fragment sequence
  76. * @variant: Pointer to the location where the value of the variant should be
  77. * updated. On success, the value should be interpreted by the caller as a
  78. * member of enum wlan_ml_variant. (This enum is not directly used as an
  79. * argument, so that non-MLO code that happens to call this function does not
  80. * need to be aware of the definition of the enum, though such a call would
  81. * ultimately result in an error). The value should be ignored by the caller if
  82. * the function returns error.
  83. *
  84. * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
  85. * the reason for error in the case of failure
  86. */
  87. QDF_STATUS
  88. util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
  89. int *variant);
  90. /**
  91. * util_get_bvmlie_mldmacaddr - Get the MLD MAC address from a given Basic
  92. * variant Multi-Link element or element fragment sequence.
  93. *
  94. * @mlieseq: Starting address of the Multi-Link element or Multi-Link element
  95. * fragment sequence
  96. * @mlieseqlen: Total length of the Multi-Link element or Multi-Link element
  97. * fragment sequence
  98. * @mldmacaddrfound: Pointer to the location where a boolean status should be
  99. * updated indicating whether the MLD MAC address was found or not. This should
  100. * be ignored by the caller if the function returns error.
  101. * @linkid: Pointer to the location where the MLD MAC address should be updated.
  102. * This should be ignored by the caller if the function returns error, or if the
  103. * function indicates that the MLD MAC address was not found.
  104. *
  105. * Return: QDF_STATUS_SUCCESS in the case of success, QDF_STATUS value giving
  106. * the reason for error in the case of failure
  107. */
  108. QDF_STATUS
  109. util_get_bvmlie_mldmacaddr(uint8_t *mlieseq, qdf_size_t mlieseqlen,
  110. bool *mldmacaddrfound,
  111. struct qdf_mac_addr *mldmacaddr);
  112. #else
  113. static inline QDF_STATUS
  114. util_gen_link_assoc_rsp(uint8_t *frame, qdf_size_t len,
  115. struct qdf_mac_addr link_addr, uint8_t *new_ie)
  116. {
  117. return QDF_STATUS_E_NOSUPPORT;
  118. }
  119. static inline QDF_STATUS
  120. util_find_mlie(uint8_t *buf, qdf_size_t buflen, uint8_t **mlieseq,
  121. qdf_size_t *mlieseqlen)
  122. {
  123. return QDF_STATUS_E_NOSUPPORT;
  124. }
  125. static inline QDF_STATUS
  126. util_get_mlie_variant(uint8_t *mlieseq, qdf_size_t mlieseqlen,
  127. int *variant)
  128. {
  129. return QDF_STATUS_E_NOSUPPORT;
  130. }
  131. static inline QDF_STATUS
  132. util_get_bvmlie_mldmacaddr(uint8_t *mlieseq, qdf_size_t mlieseqlen,
  133. bool *mldmacaddrfound,
  134. struct qdf_mac_addr *mldmacaddr)
  135. {
  136. return QDF_STATUS_E_NOSUPPORT;
  137. }
  138. #endif /* WLAN_FEATURE_11BE_MLO */
  139. #endif /* _WLAN_UTILS_MLO_H_ */