wlan_ocb_public_structs.h 11 KB

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