wlan_cfg80211_tdls.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /*
  2. * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * DOC: declares driver functions interfacing with linux kernel
  21. */
  22. #ifndef _WLAN_CFG80211_TDLS_H_
  23. #define _WLAN_CFG80211_TDLS_H_
  24. #include <linux/version.h>
  25. #include <linux/netdevice.h>
  26. #include <linux/completion.h>
  27. #include <net/cfg80211.h>
  28. #include <qca_vendor.h>
  29. #include <wlan_tdls_public_structs.h>
  30. #include <qdf_list.h>
  31. #include <qdf_types.h>
  32. #include <wlan_tdls_ucfg_api.h>
  33. #ifdef FEATURE_WLAN_TDLS
  34. #define TDLS_VDEV_MAGIC 0x54444c53 /* "TDLS" */
  35. /**
  36. * struct osif_tdls_vdev - OS tdls vdev private structure
  37. * @tdls_add_peer_comp: Completion to add tdls peer
  38. * @tdls_del_peer_comp: Completion to delete tdls peer
  39. * @tdls_mgmt_comp: Completion to send tdls mgmt packets
  40. * @tdls_link_establish_req_comp: Completion to establish link, sync to
  41. * send establish params to firmware, not used today.
  42. * @tdls_teardown_comp: Completion to teardown tdls peer
  43. * @tdls_user_cmd_comp: tdls user command completion event
  44. * @tdls_antenna_switch_comp: Completion to switch antenna
  45. * @tdls_add_peer_status: Peer status after add peer
  46. * @mgmt_tx_completion_status: Tdls mgmt frames TX completion status code
  47. * @tdls_user_cmd_len: tdls user command written buffer length
  48. * @tdls_antenna_switch_status: return status after antenna switch
  49. * @tdls_user_cmd_in_progress: tdls user command progress status.
  50. */
  51. struct osif_tdls_vdev {
  52. struct completion tdls_add_peer_comp;
  53. struct completion tdls_del_peer_comp;
  54. struct completion tdls_mgmt_comp;
  55. struct completion tdls_link_establish_req_comp;
  56. struct completion tdls_teardown_comp;
  57. struct completion tdls_user_cmd_comp;
  58. struct completion tdls_antenna_switch_comp;
  59. QDF_STATUS tdls_add_peer_status;
  60. uint32_t mgmt_tx_completion_status;
  61. uint32_t tdls_user_cmd_len;
  62. int tdls_antenna_switch_status;
  63. bool tdls_user_cmd_in_progress;
  64. };
  65. /**
  66. * enum qca_wlan_vendor_tdls_trigger_mode_vdev_map: Maps the user space TDLS
  67. * trigger mode in the host driver.
  68. * @WLAN_VENDOR_TDLS_TRIGGER_MODE_EXPLICIT: TDLS Connection and
  69. * disconnection handled by user space.
  70. * @WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT: TDLS connection and
  71. * disconnection controlled by host driver based on data traffic.
  72. * @WLAN_VENDOR_TDLS_TRIGGER_MODE_EXTERNAL: TDLS connection and
  73. * disconnection jointly controlled by user space and host driver.
  74. */
  75. enum qca_wlan_vendor_tdls_trigger_mode_vdev_map {
  76. WLAN_VENDOR_TDLS_TRIGGER_MODE_EXPLICIT =
  77. QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_EXPLICIT,
  78. WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT =
  79. QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT,
  80. WLAN_VENDOR_TDLS_TRIGGER_MODE_EXTERNAL =
  81. ((QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_EXPLICIT |
  82. QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT) << 1),
  83. };
  84. /**
  85. * wlan_cfg80211_tdls_osif_priv_init() - API to initialize tdls os private
  86. * @vdev: vdev object
  87. *
  88. * API to initialize tdls os private
  89. *
  90. * Return: QDF_STATUS
  91. */
  92. QDF_STATUS wlan_cfg80211_tdls_osif_priv_init(struct wlan_objmgr_vdev *vdev);
  93. /**
  94. * wlan_cfg80211_tdls_osif_priv_deinit() - API to deinitialize tdls os private
  95. * @vdev: vdev object
  96. *
  97. * API to deinitialize tdls os private
  98. *
  99. * Return: None
  100. */
  101. void wlan_cfg80211_tdls_osif_priv_deinit(struct wlan_objmgr_vdev *vdev);
  102. /**
  103. * wlan_cfg80211_tdls_add_peer() - process cfg80211 add TDLS peer request
  104. * @vdev: vdev object
  105. * @mac: MAC address for TDLS peer
  106. *
  107. * Return: 0 for success; negative errno otherwise
  108. */
  109. int wlan_cfg80211_tdls_add_peer(struct wlan_objmgr_vdev *vdev,
  110. const uint8_t *mac);
  111. /**
  112. * wlan_cfg80211_tdls_update_peer() - process cfg80211 update TDLS peer request
  113. * @vdev: vdev object
  114. * @mac: MAC address for TDLS peer
  115. * @params: Pointer to station parameters
  116. *
  117. * Return: 0 for success; negative errno otherwise
  118. */
  119. int wlan_cfg80211_tdls_update_peer(struct wlan_objmgr_vdev *vdev,
  120. const uint8_t *mac,
  121. struct station_parameters *params);
  122. /**
  123. * wlan_cfg80211_tdls_configure_mode() - configure tdls mode
  124. * @vdev: vdev obj manager
  125. * @trigger_mode: tdls trgger mode
  126. *
  127. * Return: 0 for success; negative errno otherwise
  128. */
  129. int wlan_cfg80211_tdls_configure_mode(struct wlan_objmgr_vdev *vdev,
  130. uint32_t trigger_mode);
  131. /**
  132. * wlan_cfg80211_tdls_oper() - process cfg80211 operation on an TDLS peer
  133. * @vdev: vdev object
  134. * @peer: MAC address of the TDLS peer
  135. * @oper: cfg80211 TDLS operation
  136. *
  137. * Return: 0 on success; negative errno otherwise
  138. */
  139. int wlan_cfg80211_tdls_oper(struct wlan_objmgr_vdev *vdev,
  140. const uint8_t *peer,
  141. enum nl80211_tdls_operation oper);
  142. /**
  143. * wlan_cfg80211_tdls_get_all_peers() - get all the TDLS peers from the list
  144. * @vdev: vdev object
  145. * @buf: output buffer
  146. * @buflen: valid length of the output error
  147. *
  148. * Return: length of the output buffer
  149. */
  150. int wlan_cfg80211_tdls_get_all_peers(struct wlan_objmgr_vdev *vdev,
  151. char *buf, int buflen);
  152. /**
  153. * wlan_cfg80211_tdls_is_fw_wideband_capable() - Check whether fw supports
  154. * wideband
  155. * @vdev: Pointer to vdev
  156. *
  157. * Return: true if fw supports 6ghz tdls connection
  158. */
  159. bool wlan_cfg80211_tdls_is_fw_wideband_capable(struct wlan_objmgr_vdev *vdev);
  160. #ifdef WLAN_FEATURE_11AX
  161. /**
  162. * hdd_tdls_is_fw_6ghz_capable() - Check whether fw supports 6ghz band tdls
  163. * @vdev: Pointer to vdev
  164. *
  165. * Return: true if fw supports 6ghz tdls connection
  166. */
  167. bool wlan_cfg80211_tdls_is_fw_6ghz_capable(struct wlan_objmgr_vdev *vdev);
  168. #endif
  169. /**
  170. * wlan_cfg80211_tdls_mgmt() - process tdls management frames from the supplicant
  171. * @vdev: vdev object
  172. * @peer: MAC address of the TDLS peer
  173. * @action_code: type of TDLS mgmt frame to be sent
  174. * @dialog_token: dialog token used in the frame
  175. * @status_code: status to be incuded in the frame
  176. * @peer_capability: peer capability information
  177. * @buf: additional IEs to be included
  178. * @len: length of additional Ies
  179. * @oper: cfg80211 TDLS operation
  180. *
  181. * Return: 0 on success; negative errno otherwise
  182. */
  183. int wlan_cfg80211_tdls_mgmt(struct wlan_objmgr_vdev *vdev,
  184. const uint8_t *peer,
  185. uint8_t action_code, uint8_t dialog_token,
  186. uint16_t status_code, uint32_t peer_capability,
  187. const uint8_t *buf, size_t len);
  188. /**
  189. * wlan_tdls_antenna_switch() - process tdls antenna switch
  190. * @vdev: vdev object
  191. * @mode: antenna mode
  192. *
  193. * Return: 0 on success; -EAGAIN to retry
  194. */
  195. int wlan_tdls_antenna_switch(struct wlan_objmgr_vdev *vdev, uint32_t mode);
  196. /**
  197. * wlan_cfg80211_tdls_event_callback() - callback for tdls module
  198. * @userdata: user data
  199. * @type: request callback type
  200. * @param: passed parameter
  201. *
  202. * This is used by TDLS to sync with os interface
  203. *
  204. * Return: None
  205. */
  206. void wlan_cfg80211_tdls_event_callback(void *userdata,
  207. enum tdls_event_type type,
  208. struct tdls_osif_indication *param);
  209. /**
  210. * wlan_cfg80211_tdls_rx_callback() - Callback for rx mgmt frame
  211. * @user_data: pointer to soc object
  212. * @rx_frame: RX mgmt frame information
  213. *
  214. * This callback will be used to rx frames in os interface.
  215. *
  216. * Return: None
  217. */
  218. void wlan_cfg80211_tdls_rx_callback(void *user_data,
  219. struct tdls_rx_mgmt_frame *rx_frame);
  220. /**
  221. * hdd_notify_tdls_reset_adapter() - notify reset adapter to TDLS
  222. * @vdev: vdev object manager
  223. *
  224. * Notify hdd reset adapter to TDLS component
  225. *
  226. * Return: None
  227. */
  228. void hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev *vdev);
  229. #else /* FEATURE_WLAN_TDLS */
  230. static inline
  231. QDF_STATUS wlan_cfg80211_tdls_osif_priv_init(struct wlan_objmgr_vdev *vdev)
  232. {
  233. return QDF_STATUS_SUCCESS;
  234. }
  235. static inline
  236. void wlan_cfg80211_tdls_osif_priv_deinit(struct wlan_objmgr_vdev *vdev)
  237. {
  238. }
  239. static inline void
  240. hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev *vdev)
  241. {
  242. }
  243. static inline
  244. int wlan_cfg80211_tdls_configure_mode(struct wlan_objmgr_vdev *vdev,
  245. uint32_t trigger_mode)
  246. {
  247. return 0;
  248. }
  249. #endif /* FEATURE_WLAN_TDLS */
  250. #endif /* _WLAN_CFG80211_TDLS_H_ */