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