wlan_ocb_public_structs.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. /*
  2. * Copyright (c) 2018-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: contains ocb structure definitions
  20. */
  21. #ifndef _WLAN_OCB_STRUCTS_H_
  22. #define _WLAN_OCB_STRUCTS_H_
  23. #include <qdf_status.h>
  24. /* number of vdevs that can support OCB */
  25. #define OCB_VDEVS_NUM 1
  26. /* maximum number of channels that can do OCB */
  27. #define OCB_CHANNELS_NUM 2
  28. /* maximum number of channels in an OCB schedule */
  29. #define OCB_SCHEDULES_NUM 2
  30. /* Don't add the RX stats header to packets received on this channel */
  31. #define OCB_CHANNEL_FLAG_DISABLE_RX_STATS_HDR (1 << 0)
  32. /* The size of the utc time in bytes. */
  33. #define OCB_SIZE_UTC_TIME (10)
  34. /* The size of the utc time error in bytes. */
  35. #define OCB_SIZE_UTC_TIME_ERROR (5)
  36. #define OCB_CHANNEL_MAX (5)
  37. /**
  38. * struct ocb_utc_param - parameters to set UTC time
  39. * @vdev_id: vdev id
  40. * @utc_time: number of nanoseconds from Jan 1st 1958
  41. * @time_error: the error in the UTC time. All 1's for unknown
  42. */
  43. struct ocb_utc_param {
  44. uint32_t vdev_id;
  45. uint8_t utc_time[OCB_SIZE_UTC_TIME];
  46. uint8_t time_error[OCB_SIZE_UTC_TIME_ERROR];
  47. };
  48. /**
  49. * struct ocb_timing_advert_param - parameters to start/stop
  50. * timing advertisement
  51. * @vdev_id: vdev id
  52. * @chan_freq: frequency on which to advertise (unit in Mhz)
  53. * @repeat_rate: the number of times it will send TA in 5 seconds
  54. * @timestamp_offset: offset of the timestamp field in the TA frame
  55. * @time_value_offset: offset of the time_value field in the TA frame
  56. * @template_length: size in bytes of the TA frame
  57. * @template_value: the TA frame
  58. */
  59. struct ocb_timing_advert_param {
  60. uint32_t vdev_id;
  61. uint32_t chan_freq;
  62. uint32_t repeat_rate;
  63. uint32_t timestamp_offset;
  64. uint32_t time_value_offset;
  65. uint32_t template_length;
  66. uint8_t *template_value;
  67. };
  68. /**
  69. * struct ocb_dcc_get_stats_param - parameters to get DCC stats
  70. * @vdev_id: vdev id
  71. * @channel_count: number of dcc channels
  72. * @request_array_len: size in bytes of the request array
  73. * @request_array: the request array
  74. */
  75. struct ocb_dcc_get_stats_param {
  76. uint32_t vdev_id;
  77. uint32_t channel_count;
  78. uint32_t request_array_len;
  79. void *request_array;
  80. };
  81. /**
  82. * struct ocb_dcc_update_ndl_param - parameters to update NDL
  83. * @vdev_id: vdev id
  84. * @channel_count: number of channels to be updated
  85. * @dcc_ndl_chan_list_len: size in bytes of the ndl_chan array
  86. * @dcc_ndl_chan_list: the ndl_chan array
  87. * @dcc_ndl_active_state_list_len: size in bytes of the active_state array
  88. * @dcc_ndl_active_state_list: the active state array
  89. */
  90. struct ocb_dcc_update_ndl_param {
  91. uint32_t vdev_id;
  92. uint32_t channel_count;
  93. uint32_t dcc_ndl_chan_list_len;
  94. void *dcc_ndl_chan_list;
  95. uint32_t dcc_ndl_active_state_list_len;
  96. void *dcc_ndl_active_state_list;
  97. };
  98. /**
  99. * struct ocb_config_schdl - parameters for channel scheduling
  100. * @chan_freq: frequency of the channel (unit in Mhz)
  101. * @total_duration: duration of the schedule (unit in ms)
  102. * @guard_interval: guard interval on the start of the schedule (unit in ms)
  103. */
  104. struct ocb_config_schdl {
  105. uint32_t chan_freq;
  106. uint32_t total_duration;
  107. uint32_t guard_interval;
  108. };
  109. /**
  110. * struct ocb_wmm_param - WMM parameters
  111. * @aifsn: AIFS number
  112. * @cwmin: value of CWmin
  113. * @cwmax: value of CWmax
  114. */
  115. struct ocb_wmm_param {
  116. uint8_t aifsn;
  117. uint8_t cwmin;
  118. uint8_t cwmax;
  119. };
  120. /**
  121. * struct ocb_config_chan - parameters to configure a channel
  122. * @chan_freq: frequency of the channel (unit in MHz)
  123. * @bandwidth: bandwidth of the channel, either 10 or 20 MHz
  124. * @mac_address: MAC address assigned to this channel
  125. * @qos_params: QoS parameters
  126. * @max_pwr: maximum transmit power of the channel (dBm)
  127. * @min_pwr: minimum transmit power of the channel (dBm)
  128. * @reg_pwr: maximum transmit power specified by the regulatory domain (dBm)
  129. * @antenna_max: maximum antenna gain specified by the regulatory domain (dB)
  130. * @flags: bit0: 0 enable RX stats on this channel; 1 disable RX stats
  131. * bit1: flag to indicate TSF expiry time in TX control.
  132. * 0 relative time is used. 1 absolute time is used.
  133. * bit2: Frame mode from user layer.
  134. * 0 for 802.3 frame, 1 for 802.11 frame.
  135. * @ch_mode: channel mode
  136. */
  137. struct ocb_config_chan {
  138. uint32_t chan_freq;
  139. uint32_t bandwidth;
  140. struct qdf_mac_addr mac_address;
  141. struct ocb_wmm_param qos_params[QCA_WLAN_AC_ALL];
  142. uint32_t max_pwr;
  143. uint32_t min_pwr;
  144. uint8_t reg_pwr;
  145. uint8_t antenna_max;
  146. uint16_t flags;
  147. uint32_t ch_mode;
  148. };
  149. /**
  150. * struct ocb_config - parameters for OCB vdev config
  151. * @vdev_id: vdev id
  152. * @channel_count: number of channels
  153. * @schedule_size: size of the channel schedule
  154. * @flags: reserved
  155. * @channels: array of OCB channels
  156. * @schedule: array of OCB schedule elements
  157. * @dcc_ndl_chan_list_len: size in bytes of the ndl_chan array
  158. * @dcc_ndl_chan_list: array of dcc channel info
  159. * @dcc_ndl_active_state_list_len: size in bytes of the active state array
  160. * @dcc_ndl_active_state_list: array of active states
  161. */
  162. struct ocb_config {
  163. uint32_t vdev_id;
  164. uint32_t channel_count;
  165. uint32_t schedule_size;
  166. uint32_t flags;
  167. struct ocb_config_chan *channels;
  168. struct ocb_config_schdl *schedule;
  169. uint32_t dcc_ndl_chan_list_len;
  170. void *dcc_ndl_chan_list;
  171. uint32_t dcc_ndl_active_state_list_len;
  172. void *dcc_ndl_active_state_list;
  173. };
  174. /**
  175. * enum ocb_channel_config_status - ocb config status
  176. * @OCB_CHANNEL_CONFIG_SUCCESS: success
  177. * @OCB_CHANNEL_CONFIG_FAIL: failure
  178. * @OCB_CHANNEL_CONFIG_STATUS_MAX: place holder, not a real status
  179. */
  180. enum ocb_channel_config_status {
  181. OCB_CHANNEL_CONFIG_SUCCESS = 0,
  182. OCB_CHANNEL_CONFIG_FAIL,
  183. OCB_CHANNEL_CONFIG_STATUS_MAX
  184. };
  185. /**
  186. * struct ocb_set_config_response - ocb config status
  187. * @status: response status. OCB_CHANNEL_CONFIG_SUCCESS for success.
  188. */
  189. struct ocb_set_config_response {
  190. enum ocb_channel_config_status status;
  191. };
  192. /**
  193. * struct ocb_get_tsf_timer_response - TSF timer response
  194. * @vdev_id: vdev id
  195. * @timer_high: higher 32-bits of the timer
  196. * @timer_low: lower 32-bits of the timer
  197. */
  198. struct ocb_get_tsf_timer_response {
  199. uint32_t vdev_id;
  200. uint32_t timer_high;
  201. uint32_t timer_low;
  202. };
  203. /**
  204. * struct ocb_get_tsf_timer_param - parameters to get tsf timer
  205. * @vdev_id: vdev id
  206. */
  207. struct ocb_get_tsf_timer_param {
  208. uint32_t vdev_id;
  209. };
  210. /**
  211. * struct ocb_dcc_get_stats_response - DCC stats response
  212. * @vdev_id: vdev id
  213. * @num_channels: number of dcc channels
  214. * @channel_stats_array_len: size in bytes of the stats array
  215. * @channel_stats_array: the stats array
  216. */
  217. struct ocb_dcc_get_stats_response {
  218. uint32_t vdev_id;
  219. uint32_t num_channels;
  220. uint32_t channel_stats_array_len;
  221. void *channel_stats_array;
  222. };
  223. /**
  224. * struct ocb_dcc_clear_stats_param - parameters to clear DCC stats
  225. * @vdev_id: vdev id
  226. * @dcc_stats_bitmap: bitmap of clear option
  227. */
  228. struct ocb_dcc_clear_stats_param {
  229. uint32_t vdev_id;
  230. uint32_t dcc_stats_bitmap;
  231. };
  232. /**
  233. * struct ocb_dcc_update_ndl_response - NDP update response
  234. * @vdev_id: vdev id
  235. * @status: response status
  236. */
  237. struct ocb_dcc_update_ndl_response {
  238. uint32_t vdev_id;
  239. uint32_t status;
  240. };
  241. /**
  242. * struct wlan_ocb_rx_ops - structure containing rx ops for OCB
  243. * @ocb_set_config_status: fp to get channel config status
  244. * @ocb_tsf_timer: fp to get TSF timer
  245. * @ocb_dcc_ndl_update: fp to get NDL update status
  246. * @ocb_dcc_stats_indicate: fp to get DCC stats
  247. */
  248. struct wlan_ocb_rx_ops {
  249. QDF_STATUS (*ocb_set_config_status)(struct wlan_objmgr_psoc *psoc,
  250. uint32_t status);
  251. QDF_STATUS (*ocb_tsf_timer)(struct wlan_objmgr_psoc *psoc,
  252. struct ocb_get_tsf_timer_response *response);
  253. QDF_STATUS (*ocb_dcc_ndl_update)(struct wlan_objmgr_psoc *psoc,
  254. struct ocb_dcc_update_ndl_response *resp);
  255. QDF_STATUS (*ocb_dcc_stats_indicate)(struct wlan_objmgr_psoc *psoc,
  256. struct ocb_dcc_get_stats_response *response, bool indicate);
  257. };
  258. /**
  259. * struct wlan_ocb_tx_ops - structures containing tx ops for OCB
  260. * @ocb_set_config: fp to set channel config
  261. * @ocb_set_utc_time: fp to set utc time
  262. * @ocb_start_timing_advert: fp to start timing advertisement
  263. * @ocb_stop_timing_advert: fp to stop timing advertisement
  264. * @ocb_get_tsf_timer: fp to get tsf timer
  265. * @ocb_dcc_get_stats: fp to get DCC stats
  266. * @ocb_dcc_clear_stats: fp to clear DCC stats
  267. * @ocb_dcc_update_ndl: fp to update ndl
  268. * @ocb_reg_ev_handler: fp to register event handler
  269. * @ocb_unreg_ev_handler: fp to unregister event handler
  270. */
  271. struct wlan_ocb_tx_ops {
  272. QDF_STATUS (*ocb_set_config)(struct wlan_objmgr_psoc *psoc,
  273. struct ocb_config *config);
  274. QDF_STATUS (*ocb_set_utc_time)(struct wlan_objmgr_psoc *psoc,
  275. struct ocb_utc_param *utc);
  276. QDF_STATUS (*ocb_start_timing_advert)(struct wlan_objmgr_psoc *psoc,
  277. struct ocb_timing_advert_param *timing_advert);
  278. QDF_STATUS (*ocb_stop_timing_advert)(struct wlan_objmgr_psoc *psoc,
  279. struct ocb_timing_advert_param *timing_advert);
  280. QDF_STATUS (*ocb_get_tsf_timer)(struct wlan_objmgr_psoc *psoc,
  281. struct ocb_get_tsf_timer_param *request);
  282. QDF_STATUS (*ocb_dcc_get_stats)(struct wlan_objmgr_psoc *psoc,
  283. struct ocb_dcc_get_stats_param *get_stats_param);
  284. QDF_STATUS (*ocb_dcc_clear_stats)(struct wlan_objmgr_psoc *psoc,
  285. struct ocb_dcc_clear_stats_param *clear_stats);
  286. QDF_STATUS (*ocb_dcc_update_ndl)(struct wlan_objmgr_psoc *psoc,
  287. struct ocb_dcc_update_ndl_param *update_ndl_param);
  288. QDF_STATUS (*ocb_reg_ev_handler)(struct wlan_objmgr_psoc *psoc,
  289. void *arg);
  290. QDF_STATUS (*ocb_unreg_ev_handler)(struct wlan_objmgr_psoc *psoc,
  291. void *arg);
  292. };
  293. typedef void (*ocb_sync_callback)(void *context, void *response);
  294. /**
  295. * struct ocb_callback - structure containing callback to legacy driver
  296. * @ocb_set_config_context: context for set channel config callback
  297. * @ocb_set_config_callback: set channel config callback
  298. * @ocb_get_tsf_timer_context: context for get tsf timer callback
  299. * @ocb_get_tsf_timer_callback: get tsf timer callback
  300. * @ocb_dcc_get_stats_context: context for get DCC stats callback
  301. * @ocb_dcc_get_stats_callback: get DCC stats callback
  302. * @ocb_dcc_update_ndl_context: context for NDL update callback
  303. * @ocb_dcc_update_ndl_callback: NDL update callback
  304. * @ocb_dcc_stats_event_context: context for DCC stats event callback
  305. * @ocb_dcc_stats_event_callback: DCC stats event callback
  306. * @start_ocb_vdev: start ocb callback
  307. */
  308. struct ocb_callbacks {
  309. void *ocb_set_config_context;
  310. ocb_sync_callback ocb_set_config_callback;
  311. void *ocb_get_tsf_timer_context;
  312. ocb_sync_callback ocb_get_tsf_timer_callback;
  313. void *ocb_dcc_get_stats_context;
  314. ocb_sync_callback ocb_dcc_get_stats_callback;
  315. void *ocb_dcc_update_ndl_context;
  316. ocb_sync_callback ocb_dcc_update_ndl_callback;
  317. void *ocb_dcc_stats_event_context;
  318. ocb_sync_callback ocb_dcc_stats_event_callback;
  319. QDF_STATUS (*start_ocb_vdev)(struct ocb_config *config);
  320. };
  321. #endif