os_if_nan.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: declares nan component os interface APIs
  20. */
  21. #ifndef _OS_IF_NAN_H_
  22. #define _OS_IF_NAN_H_
  23. #include "qdf_types.h"
  24. #ifdef WLAN_FEATURE_NAN
  25. #include "nan_public_structs.h"
  26. #include "nan_ucfg_api.h"
  27. /**
  28. * struct ndi_find_vdev_filter - find vdev filter object. this can be extended
  29. * @ifname: interface name of vdev
  30. * @found_vdev: found vdev object matching one or more of above params
  31. */
  32. struct ndi_find_vdev_filter {
  33. char *ifname;
  34. struct wlan_objmgr_vdev *found_vdev;
  35. };
  36. /**
  37. * os_if_nan_process_ndp_cmd: os_if api to handle nan request message
  38. * @psoc: pointer to psoc object
  39. * @data: request data. contains vendor cmd tlvs
  40. * @data_len: length of data
  41. * @is_ndp_allowed: Indicates whether to allow NDP creation.
  42. * NDI creation is always allowed.
  43. *
  44. * Return: status of operation
  45. */
  46. int os_if_nan_process_ndp_cmd(struct wlan_objmgr_psoc *psoc,
  47. const void *data, int data_len,
  48. bool is_ndp_allowed);
  49. /**
  50. * os_if_nan_register_hdd_callbacks: os_if api to register hdd callbacks
  51. * @psoc: pointer to psoc object
  52. * @cb_obj: struct pointer containing callbacks
  53. *
  54. * Return: status of operation
  55. */
  56. int os_if_nan_register_hdd_callbacks(struct wlan_objmgr_psoc *psoc,
  57. struct nan_callbacks *cb_obj);
  58. /**
  59. * os_if_nan_register_lim_callbacks: os_if api to register lim callbacks
  60. * @psoc: pointer to psoc object
  61. * @cb_obj: struct pointer containing callbacks
  62. *
  63. * Return: status of operation
  64. */
  65. int os_if_nan_register_lim_callbacks(struct wlan_objmgr_psoc *psoc,
  66. struct nan_callbacks *cb_obj);
  67. /**
  68. * os_if_nan_post_ndi_create_rsp: os_if api to pos ndi create rsp to umac nan
  69. * component
  70. * @psoc: pointer to psoc object
  71. * @vdev_id: vdev id of ndi
  72. * @success: if create was success or failure
  73. *
  74. * Return: None
  75. */
  76. void os_if_nan_post_ndi_create_rsp(struct wlan_objmgr_psoc *psoc,
  77. uint8_t vdev_id, bool success);
  78. /**
  79. * os_if_nan_post_ndi_delete_rsp: os_if api to pos ndi delete rsp to umac nan
  80. * component
  81. * @psoc: pointer to psoc object
  82. * @vdev_id: vdev id of ndi
  83. * @success: if delete was success or failure
  84. *
  85. * Return: None
  86. */
  87. void os_if_nan_post_ndi_delete_rsp(struct wlan_objmgr_psoc *psoc,
  88. uint8_t vdev_id, bool success);
  89. /**
  90. * os_if_nan_ndi_session_end: os_if api to process ndi session end
  91. * component
  92. * @vdev: pointer to vdev deleted
  93. *
  94. * Return: None
  95. */
  96. void os_if_nan_ndi_session_end(struct wlan_objmgr_vdev *vdev);
  97. /**
  98. * os_if_nan_set_ndi_state: os_if api set NDI state
  99. * @vdev: pointer to vdev deleted
  100. * @state: value to set
  101. *
  102. * Return: status of operation
  103. */
  104. static inline QDF_STATUS os_if_nan_set_ndi_state(struct wlan_objmgr_vdev *vdev,
  105. uint32_t state)
  106. {
  107. return ucfg_nan_set_ndi_state(vdev, state);
  108. }
  109. /**
  110. * os_if_nan_set_ndp_create_transaction_id: set ndp create transaction id
  111. * @vdev: pointer to vdev object
  112. * @val: value to set
  113. *
  114. * Return: status of operation
  115. */
  116. static inline QDF_STATUS os_if_nan_set_ndp_create_transaction_id(
  117. struct wlan_objmgr_vdev *vdev,
  118. uint16_t val)
  119. {
  120. return ucfg_nan_set_ndp_create_transaction_id(vdev, val);
  121. }
  122. /**
  123. * os_if_nan_set_ndp_delete_transaction_id: set ndp delete transaction id
  124. * @vdev: pointer to vdev object
  125. * @val: value to set
  126. *
  127. * Return: status of operation
  128. */
  129. static inline QDF_STATUS os_if_nan_set_ndp_delete_transaction_id(
  130. struct wlan_objmgr_vdev *vdev,
  131. uint16_t val)
  132. {
  133. return ucfg_nan_set_ndp_delete_transaction_id(vdev, val);
  134. }
  135. /**
  136. * os_if_nan_legacy_req: os_if api to handle NAN requests attached to the vendor
  137. * command QCA_NL80211_VENDOR_SUBCMD_NAN
  138. * @psoc: pointer to psoc object
  139. * @data: request data. contains vendor cmd tlvs
  140. * @data_len: length of data
  141. *
  142. * Return: status of operation
  143. */
  144. int os_if_nan_legacy_req(struct wlan_objmgr_psoc *psoc, const void *data,
  145. int data_len);
  146. /**
  147. * os_if_process_nan_req: os_if api to handle NAN requests attached to the
  148. * vendor command QCA_NL80211_VENDOR_SUBCMD_NAN_EXT
  149. * @psoc: pointer to psoc object
  150. * @data: request data. contains vendor cmd tlvs
  151. * @data_len: length of data
  152. *
  153. * Return: status of operation
  154. */
  155. int os_if_process_nan_req(struct wlan_objmgr_psoc *psoc,
  156. const void *data, int data_len);
  157. #else
  158. static inline void os_if_nan_post_ndi_create_rsp(struct wlan_objmgr_psoc *psoc,
  159. uint8_t vdev_id, bool success)
  160. {
  161. }
  162. static inline void os_if_nan_post_ndi_delete_rsp(struct wlan_objmgr_psoc *psoc,
  163. uint8_t vdev_id, bool success)
  164. {
  165. }
  166. #endif /* WLAN_FEATURE_NAN */
  167. #endif