wlan_ocb_public_structs.h 11 KB

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