os_if_son.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /*
  2. * Copyright (c) 2021, The Linux Foundation. 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. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  10. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  12. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  13. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. */
  15. /**
  16. * DOC : os_if_son.h
  17. *
  18. * WLAN Host Device Driver file for son (Self Organizing Network)
  19. * support.
  20. *
  21. */
  22. #ifndef _OS_IF_SON_H_
  23. #define _OS_IF_SON_H_
  24. #include <qdf_types.h>
  25. #include <wlan_objmgr_vdev_obj.h>
  26. #include <wlan_objmgr_psoc_obj.h>
  27. #include <wlan_objmgr_pdev_obj.h>
  28. #include <wlan_reg_ucfg_api.h>
  29. #include <ieee80211_external.h>
  30. /**
  31. * struct son_callbacks - struct containing callback to non-converged driver
  32. * @os_if_is_acs_in_progress: whether acs is in progress or not
  33. * @os_if_set_chan_ext_offset: set chan extend offset
  34. * @os_if_get_chan_ext_offset: get chan extend offset
  35. * @os_if_set_bandwidth: set band width
  36. * @os_if_get_bandwidth: get band width
  37. * @os_if_set_chan: set chan
  38. * @os_if_set_country_code: set country code
  39. * @os_if_set_candidate_freq: set freq to switch after radar detection
  40. * @os_if_get_candidate_freq: get freq to switch after radar detection
  41. * @os_if_set_phymode: set phy mode
  42. * @os_if_get_phymode: get phy mode
  43. */
  44. struct son_callbacks {
  45. uint32_t (*os_if_is_acs_in_progress)(struct wlan_objmgr_vdev *vdev);
  46. int (*os_if_set_chan_ext_offset)(
  47. struct wlan_objmgr_vdev *vdev,
  48. enum sec20_chan_offset son_chan_ext_offset);
  49. enum sec20_chan_offset (*os_if_get_chan_ext_offset)(
  50. struct wlan_objmgr_vdev *vdev);
  51. int (*os_if_set_bandwidth)(struct wlan_objmgr_vdev *vdev,
  52. uint32_t son_bandwidth);
  53. uint32_t (*os_if_get_bandwidth)(struct wlan_objmgr_vdev *vdev);
  54. int (*os_if_set_chan)(struct wlan_objmgr_vdev *vdev, int chan,
  55. enum wlan_band_id son_band);
  56. uint32_t (*os_if_get_sta_count)(struct wlan_objmgr_vdev *vdev);
  57. int (*os_if_set_country_code)(struct wlan_objmgr_vdev *vdev,
  58. char *country_code);
  59. int (*os_if_set_candidate_freq)(struct wlan_objmgr_vdev *vdev,
  60. qdf_freq_t freq);
  61. qdf_freq_t (*os_if_get_candidate_freq)(struct wlan_objmgr_vdev *vdev);
  62. int (*os_if_set_phymode)(struct wlan_objmgr_vdev *vdev,
  63. enum ieee80211_phymode mode);
  64. enum ieee80211_phymode (*os_if_get_phymode)(
  65. struct wlan_objmgr_vdev *vdev);
  66. };
  67. /**
  68. * os_if_son_register_hdd_callbacks() - register son hdd callback
  69. * @psoc: psoc
  70. * @cb_obj: pointer to callback
  71. *
  72. * Return: void
  73. */
  74. void os_if_son_register_hdd_callbacks(struct wlan_objmgr_psoc *psoc,
  75. struct son_callbacks *cb_obj);
  76. /**
  77. * os_if_son_get_freq() - get freq
  78. * @vdev: vdev
  79. *
  80. * Return: freq of given vdev
  81. */
  82. qdf_freq_t os_if_son_get_freq(struct wlan_objmgr_vdev *vdev);
  83. /**
  84. * os_if_son_is_acs_in_progress() - whether ACS in progress or not
  85. * @vdev: vdev
  86. *
  87. * Return: true if ACS is in progress
  88. */
  89. uint32_t os_if_son_is_acs_in_progress(struct wlan_objmgr_vdev *vdev);
  90. /**
  91. * os_if_son_is_cac_in_progress() - whether CAC is in progress or not
  92. * @vdev: vdev
  93. *
  94. * Return: true if CAC is in progress
  95. */
  96. uint32_t os_if_son_is_cac_in_progress(struct wlan_objmgr_vdev *vdev);
  97. /**
  98. * os_if_son_set_chan_ext_offset() - set chan extend offset
  99. * @vdev: vdev
  100. * @son_chan_ext_offset son chan extend offset
  101. *
  102. * Return: 0 on success, negative errno on failure
  103. */
  104. int os_if_son_set_chan_ext_offset(struct wlan_objmgr_vdev *vdev,
  105. enum sec20_chan_offset son_chan_ext_offset);
  106. /**
  107. * os_if_son_get_chan_ext_offset() - get chan extend offset
  108. * @vdev: vdev
  109. *
  110. * Return: enum sec20_chan_offset
  111. */
  112. enum sec20_chan_offset os_if_son_get_chan_ext_offset(
  113. struct wlan_objmgr_vdev *vdev);
  114. /**
  115. * os_if_son_set_bandwidth() - set band width
  116. * @vdev: vdev
  117. * @son_bandwidth: band width
  118. *
  119. * Return: 0 on success, negative errno on failure
  120. */
  121. int os_if_son_set_bandwidth(struct wlan_objmgr_vdev *vdev,
  122. uint32_t son_bandwidth);
  123. /**
  124. * os_if_son_get_bandwidth() - get band width
  125. * @vdev: vdev
  126. *
  127. * Return: band width
  128. */
  129. uint32_t os_if_son_get_bandwidth(struct wlan_objmgr_vdev *vdev);
  130. /**
  131. * os_if_son_get_band_info() - get band info
  132. * @vdev: vdev
  133. *
  134. * Return: band info
  135. */
  136. uint32_t os_if_son_get_band_info(struct wlan_objmgr_vdev *vdev);
  137. /**
  138. * os_if_son_get_chan_list() - get a list of chan information
  139. * @vdev: vdev
  140. * @ic_chans: chan information array to get
  141. * @chan_info: pointer to ieee80211_channel_info to get
  142. * @ic_nchans: number of chan information it gets
  143. * @flag_160: flag indicating the API to fill the center frequencies of 160MHz.
  144. *
  145. * Return: 0 on success, negative errno on failure
  146. */
  147. int os_if_son_get_chan_list(struct wlan_objmgr_vdev *vdev,
  148. struct ieee80211_ath_channel *ic_chans,
  149. struct ieee80211_channel_info *chan_info,
  150. uint8_t *ic_nchans, bool flag_160);
  151. /**
  152. * os_if_son_get_sta_count() - get connected STA count
  153. * @vdev: vdev
  154. *
  155. * Return: connected STA count
  156. */
  157. uint32_t os_if_son_get_sta_count(struct wlan_objmgr_vdev *vdev);
  158. /**
  159. * os_if_son_get_bssid() - get bssid of given vdev
  160. * @vdev: vdev
  161. * @bssid: pointer to BSSID
  162. *
  163. * Return: 0 if BSSID is gotten successfully
  164. */
  165. int os_if_son_get_bssid(struct wlan_objmgr_vdev *vdev,
  166. uint8_t bssid[QDF_MAC_ADDR_SIZE]);
  167. /**
  168. * os_if_son_get_ssid() - get ssid of given vdev
  169. * @vdev: vdev
  170. * @ssid: pointer to SSID
  171. * @ssid_len: ssid length
  172. *
  173. * Return: 0 if SSID is gotten successfully
  174. */
  175. int os_if_son_get_ssid(struct wlan_objmgr_vdev *vdev,
  176. char ssid[WLAN_SSID_MAX_LEN + 1],
  177. uint8_t *ssid_len);
  178. /**
  179. * os_if_son_set_chan() - set chan
  180. * @vdev: vdev
  181. * @chan: given chan
  182. * @son_band: given band
  183. *
  184. * Return: 0 on success, negative errno on failure
  185. */
  186. int os_if_son_set_chan(struct wlan_objmgr_vdev *vdev,
  187. int chan, enum wlan_band_id son_band);
  188. /**
  189. * os_if_son_set_cac_timeout() - set cac timeout
  190. * @vdev: vdev
  191. * @cac_timeout: cac timeount to set
  192. *
  193. * Return: 0 if cac time out is set successfully
  194. */
  195. int os_if_son_set_cac_timeout(struct wlan_objmgr_vdev *vdev,
  196. int cac_timeout);
  197. /**
  198. * os_if_son_get_cac_timeout() - get cac timeout
  199. * @vdev: vdev
  200. * @cac_timeout: cac timeout to get
  201. *
  202. * Return 0 if cac time out is get successfully
  203. */
  204. int os_if_son_get_cac_timeout(struct wlan_objmgr_vdev *vdev,
  205. int *cac_timeout);
  206. /**
  207. * os_if_son_set_country_code() - set country code
  208. * @vdev: vdev
  209. * @country_code: country code to set
  210. *
  211. * Return: 0 if country code is set successfully
  212. */
  213. int os_if_son_set_country_code(struct wlan_objmgr_vdev *vdev,
  214. char *country_code);
  215. /**
  216. * os_if_son_get_country_code() - get country code
  217. * @vdev: vdev
  218. * @country_code: country code to get
  219. *
  220. * Return: 0 if country code is get successfully
  221. */
  222. int os_if_son_get_country_code(struct wlan_objmgr_vdev *vdev,
  223. char *country_code);
  224. /**
  225. * os_if_son_set_candidate_freq() - set freq to switch after radar detection
  226. * @vdev: vdev
  227. * @freq: freq to switch
  228. *
  229. * Return: 0 if candidate freq is set successfully
  230. */
  231. int os_if_son_set_candidate_freq(struct wlan_objmgr_vdev *vdev,
  232. qdf_freq_t freq);
  233. /**
  234. * os_if_son_get_candidate_freq() - get freq to switch after radar detection
  235. * @vdev: vdev
  236. *
  237. * Return: candidate freq to switch after radar detection
  238. */
  239. qdf_freq_t os_if_son_get_candidate_freq(struct wlan_objmgr_vdev *vdev);
  240. /**
  241. * os_if_son_get_phymode() - get phy mode
  242. * @vdev: vdev
  243. *
  244. * Return: enum ieee80211_phymode
  245. */
  246. enum ieee80211_phymode os_if_son_get_phymode(struct wlan_objmgr_vdev *vdev);
  247. /**
  248. * os_if_son_set_phymode() - set phy mode
  249. * @vdev: vdev
  250. * @mode: son phy mode to set
  251. *
  252. * Return: 0 on success, negative errno on failure
  253. */
  254. int os_if_son_set_phymode(struct wlan_objmgr_vdev *vdev,
  255. enum ieee80211_phymode mode);
  256. #endif