diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 58f421ccbf..29fa51f738 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -58,6 +58,9 @@ #ifdef WLAN_SUPPORT_GREEN_AP #include "wlan_green_ap_api.h" #endif +#ifdef WLAN_FEATURE_DSRC +#include "wlan_ocb_public_structs.h" +#endif typedef qdf_nbuf_t wmi_buf_t; #define wmi_buf_data(_buf) qdf_nbuf_data(_buf) @@ -552,20 +555,140 @@ QDF_STATUS wmi_unified_set_smps_params(void *wmi_hdl, uint8_t vdev_id, QDF_STATUS wmi_unified_set_mimops(void *wmi_hdl, uint8_t vdev_id, int value); -QDF_STATUS wmi_unified_ocb_set_utc_time(void *wmi_hdl, - struct ocb_utc_param *utc); - -QDF_STATUS wmi_unified_ocb_start_timing_advert(void *wmi_hdl, +#ifdef WLAN_FEATURE_DSRC +/** + * wmi_unified_ocb_start_timing_advert() - start sending the timing + * advertisement frames on a channel + * @wmi_handle: pointer to the wmi handle + * @timing_advert: pointer to the timing advertisement struct + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_ocb_start_timing_advert(struct wmi_unified *wmi_handle, struct ocb_timing_advert_param *timing_advert); -QDF_STATUS wmi_unified_ocb_stop_timing_advert(void *wmi_hdl, +/** + * wmi_unified_ocb_stop_timing_advert() - stop sending the timing + * advertisement frames on a channel + * @wmi_handle: pointer to the wmi handle + * @timing_advert: pointer to the timing advertisement struct + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_ocb_stop_timing_advert(struct wmi_unified *wmi_handle, struct ocb_timing_advert_param *timing_advert); -QDF_STATUS wmi_unified_ocb_set_config(void *wmi_hdl, - struct ocb_config_param *config, uint32_t *ch_mhz); +/** + * wmi_unified_ocb_set_config() - send the OCB config to the FW + * @wmi_handle: pointer to the wmi handle + * @config: the OCB configuration + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failures + */ +QDF_STATUS wmi_unified_ocb_set_config(struct wmi_unified *wmi_handle, + struct ocb_config *config); -QDF_STATUS wmi_unified_ocb_get_tsf_timer(void *wmi_hdl, - uint8_t vdev_id); +/** + * wmi_unified_ocb_get_tsf_timer() - get ocb tsf timer val + * @wmi_handle: pointer to the wmi handle + * @req: request for tsf timer + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_ocb_get_tsf_timer(struct wmi_unified *wmi_handle, + struct ocb_get_tsf_timer_param *req); + +/** + * wmi_unified_ocb_set_utc_time_cmd() - get ocb tsf timer val + * @wmi_handle: pointer to the wmi handle + * @vdev_id: vdev id + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_ocb_set_utc_time_cmd(struct wmi_unified *wmi_handle, + struct ocb_utc_param *utc); + +/** + * wmi_unified_dcc_get_stats_cmd() - get the DCC channel stats + * @wmi_handle: pointer to the wmi handle + * @get_stats_param: pointer to the dcc stats + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_dcc_get_stats_cmd(struct wmi_unified *wmi_handle, + struct ocb_dcc_get_stats_param *get_stats_param); + +/** + * wmi_unified_dcc_clear_stats() - command to clear the DCC stats + * @wmi_handle: pointer to the wmi handle + * @clear_stats_param: parameters to the command + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_dcc_clear_stats(struct wmi_unified *wmi_handle, + struct ocb_dcc_clear_stats_param *clear_stats_param); + +/** + * wmi_unified_dcc_update_ndl() - command to update the NDL data + * @wmi_handle: pointer to the wmi handle + * @update_ndl_param: pointer to the request parameters + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failures + */ +QDF_STATUS wmi_unified_dcc_update_ndl(struct wmi_unified *wmi_handle, + struct ocb_dcc_update_ndl_param *update_ndl_param); + +/** + * wmi_extract_ocb_set_channel_config_resp() - extract status from wmi event + * @wmi_handle: wmi handle + * @evt_buf: pointer to event buffer + * @status: status buffer + * + * Return: QDF_STATUS_SUCCESS on success + */ +QDF_STATUS +wmi_extract_ocb_set_channel_config_resp(struct wmi_unified *wmi_handle, + void *evt_buf, + uint32_t *status); + +/** + * wmi_extract_ocb_tsf_timer() - extract tsf timer from wmi event + * @wmi_handle: wmi handle + * @evt_buf: pointer to event buffer + * @resp: tsf timer + * + * Return: QDF_STATUS_SUCCESS on success + */ +QDF_STATUS wmi_extract_ocb_tsf_timer(struct wmi_unified *wmi_handle, + void *evt_buf, + struct ocb_get_tsf_timer_response *resp); + +/** + * wmi_extract_dcc_update_ndl_resp() - extract NDL update from wmi event + * @wmi_handle: wmi handle + * @evt_buf: pointer to event buffer + * @resp: ndl update status + * + * Return: QDF_STATUS_SUCCESS on success + */ +QDF_STATUS wmi_extract_dcc_update_ndl_resp(struct wmi_unified *wmi_handle, + void *evt_buf, struct ocb_dcc_update_ndl_response *resp); + +/** + * wmi_extract_dcc_stats() - extract DCC stats from wmi event + * @wmi_handle: wmi handle + * @evt_buf: pointer to event buffer + * @resp: DCC stats + * + * Since length of the response is variable, response buffer will be allocated. + * The caller must free the response buffer. + * + * Return: QDF_STATUS_SUCCESS on success + */ +QDF_STATUS wmi_extract_dcc_stats(struct wmi_unified *wmi_handle, + void *evt_buf, + struct ocb_dcc_get_stats_response **response); +#endif QDF_STATUS wmi_unified_lro_config_cmd(void *wmi_hdl, struct wmi_lro_config_cmd_t *wmi_lro_cmd); @@ -896,18 +1019,6 @@ QDF_STATUS wmi_unified_process_fw_mem_dump_cmd(void *wmi_hdl, QDF_STATUS wmi_unified_process_set_ie_info_cmd(void *wmi_hdl, struct vdev_ie_info_param *ie_info); -QDF_STATUS wmi_unified_ocb_set_utc_time_cmd(void *wmi_hdl, - struct ocb_utc_param *utc); - -QDF_STATUS wmi_unified_dcc_get_stats_cmd(void *wmi_hdl, - struct dcc_get_stats_param *get_stats_param); - -QDF_STATUS wmi_unified_dcc_clear_stats(void *wmi_hdl, - uint32_t vdev_id, uint32_t dcc_stats_bitmap); - -QDF_STATUS wmi_unified_dcc_update_ndl(void *wmi_hdl, - struct dcc_update_ndl_param *update_ndl_param); - QDF_STATUS wmi_unified_save_fw_version_cmd(void *wmi_hdl, void *evt_buf); diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index abd4d5f2d2..9853b554fb 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -1566,144 +1566,9 @@ struct sta_uapsd_trig_params { }; #endif -/** - * struct ocb_utc_param - * @vdev_id: session id - * @utc_time: number of nanoseconds from Jan 1st 1958 - * @time_error: the error in the UTC time. All 1's for unknown - */ -struct ocb_utc_param { - uint32_t vdev_id; - uint8_t utc_time[WMI_SIZE_UTC_TIME]; - uint8_t time_error[WMI_SIZE_UTC_TIME_ERROR]; -}; - -/** - * struct ocb_timing_advert_param - * @vdev_id: session id - * @chan_freq: frequency on which to advertise - * @repeat_rate: the number of times it will send TA in 5 seconds - * @timestamp_offset: offset of the timestamp field in the TA frame - * @time_value_offset: offset of the time_value field in the TA frame - * @template_length: size in bytes of the TA frame - * @template_value: the TA frame - */ -struct ocb_timing_advert_param { - uint32_t vdev_id; - uint32_t chan_freq; - uint32_t repeat_rate; - uint32_t timestamp_offset; - uint32_t time_value_offset; - uint32_t template_length; - uint8_t *template_value; -}; - -/** - * struct dcc_get_stats_param - * @vdev_id: session id - * @channel_count: number of dcc channels - * @request_array_len: size in bytes of the request array - * @request_array: the request array - */ -struct dcc_get_stats_param { - uint32_t vdev_id; - uint32_t channel_count; - uint32_t request_array_len; - void *request_array; -}; - -/** - * struct dcc_update_ndl_param - * @vdev_id: session id - * @channel_count: number of channels to be updated - * @dcc_ndl_chan_list_len: size in bytes of the ndl_chan array - * @dcc_ndl_chan_list: the ndl_chan array - * @dcc_ndl_active_state_list_len: size in bytes of the active_state array - * @dcc_ndl_active_state_list: the active state array - */ -struct dcc_update_ndl_param { - uint32_t vdev_id; - uint32_t channel_count; - uint32_t dcc_ndl_chan_list_len; - void *dcc_ndl_chan_list; - uint32_t dcc_ndl_active_state_list_len; - void *dcc_ndl_active_state_list; -}; - -/** - * struct ocb_config_sched - * @chan_freq: frequency of the channel - * @total_duration: duration of the schedule - * @guard_interval: guard interval on the start of the schedule - */ -struct ocb_config_sched { - uint32_t chan_freq; - uint32_t total_duration; - uint32_t guard_interval; -}; - -/** - * OCB structures - */ - -#define WMI_NUM_AC (4) -#define WMI_OCB_CHANNEL_MAX (5) +#define WMI_NUM_AC (4) #define WMI_MAX_NUM_AC 4 -struct wmi_ocb_qos_params { - uint8_t aifsn; - uint8_t cwmin; - uint8_t cwmax; -}; -/** - * struct ocb_config_channel - * @chan_freq: frequency of the channel - * @bandwidth: bandwidth of the channel, either 10 or 20 MHz - * @mac_address: MAC address assigned to this channel - * @qos_params: QoS parameters - * @max_pwr: maximum transmit power of the channel (dBm) - * @min_pwr: minimum transmit power of the channel (dBm) - * @reg_pwr: maximum transmit power specified by the regulatory domain (dBm) - * @antenna_max: maximum antenna gain specified by the regulatory domain (dB) - */ -struct ocb_config_channel { - uint32_t chan_freq; - uint32_t bandwidth; - struct qdf_mac_addr mac_address; - struct wmi_ocb_qos_params qos_params[WMI_MAX_NUM_AC]; - uint32_t max_pwr; - uint32_t min_pwr; - uint8_t reg_pwr; - uint8_t antenna_max; - uint16_t flags; -}; -/** - * struct ocb_config_param - * @session_id: session id - * @channel_count: number of channels - * @schedule_size: size of the channel schedule - * @flags: reserved - * @channels: array of OCB channels - * @schedule: array of OCB schedule elements - * @dcc_ndl_chan_list_len: size of the ndl_chan array - * @dcc_ndl_chan_list: array of dcc channel info - * @dcc_ndl_active_state_list_len: size of the active state array - * @dcc_ndl_active_state_list: array of active states - * @adapter: the OCB adapter - * @dcc_stats_callback: callback for the response event - */ -struct ocb_config_param { - uint8_t session_id; - uint32_t channel_count; - uint32_t schedule_size; - uint32_t flags; - struct ocb_config_channel *channels; - struct ocb_config_sched *schedule; - uint32_t dcc_ndl_chan_list_len; - void *dcc_ndl_chan_list; - uint32_t dcc_ndl_active_state_list_len; - void *dcc_ndl_active_state_list; -}; enum wmi_peer_rate_report_cond_phy_type { WMI_PEER_RATE_REPORT_COND_11B = 0, diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index cb363cac91..b62a5d1b65 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -359,6 +359,7 @@ QDF_STATUS (*send_set_mimops_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_set_sta_uapsd_auto_trig_cmd)(wmi_unified_t wmi_handle, struct sta_uapsd_trig_params *param); +#ifdef WLAN_FEATURE_DSRC QDF_STATUS (*send_ocb_set_utc_time_cmd)(wmi_unified_t wmi_handle, struct ocb_utc_param *utc); @@ -372,17 +373,28 @@ QDF_STATUS (*send_ocb_stop_timing_advert_cmd)(wmi_unified_t wmi_handle, struct ocb_timing_advert_param *timing_advert); QDF_STATUS (*send_dcc_get_stats_cmd)(wmi_unified_t wmi_handle, - struct dcc_get_stats_param *get_stats_param); + struct ocb_dcc_get_stats_param *get_stats_param); QDF_STATUS (*send_dcc_clear_stats_cmd)(wmi_unified_t wmi_handle, uint32_t vdev_id, uint32_t dcc_stats_bitmap); QDF_STATUS (*send_dcc_update_ndl_cmd)(wmi_unified_t wmi_handle, - struct dcc_update_ndl_param *update_ndl_param); + struct ocb_dcc_update_ndl_param *update_ndl_param); QDF_STATUS (*send_ocb_set_config_cmd)(wmi_unified_t wmi_handle, - struct ocb_config_param *config, uint32_t *ch_mhz); - + struct ocb_config *config); +QDF_STATUS (*extract_ocb_chan_config_resp)(wmi_unified_t wmi_hdl, + void *evt_buf, + uint32_t *status); +QDF_STATUS (*extract_ocb_tsf_timer)(wmi_unified_t wmi_hdl, + void *evt_buf, + struct ocb_get_tsf_timer_response *resp); +QDF_STATUS (*extract_dcc_update_ndl_resp)(wmi_unified_t wmi_hdl, + void *evt_buf, struct ocb_dcc_update_ndl_response *resp); +QDF_STATUS (*extract_dcc_stats)(wmi_unified_t wmi_hdl, + void *evt_buf, + struct ocb_dcc_get_stats_response **response); +#endif QDF_STATUS (*send_lro_config_cmd)(wmi_unified_t wmi_handle, struct wmi_lro_config_cmd_t *wmi_lro_cmd); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index aef3650f4d..16176acd49 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -1095,160 +1095,136 @@ wmi_unified_set_sta_uapsd_auto_trig_cmd(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } -/** - * wmi_unified_ocb_start_timing_advert() - start sending the timing advertisement - * frames on a channel - * @wmi_handle: pointer to the wmi handle - * @timing_advert: pointer to the timing advertisement struct - * - * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure - */ -QDF_STATUS wmi_unified_ocb_start_timing_advert(void *wmi_hdl, +#ifdef WLAN_FEATURE_DSRC +QDF_STATUS wmi_unified_ocb_start_timing_advert(struct wmi_unified *wmi_hdl, struct ocb_timing_advert_param *timing_advert) { - wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; - - if (wmi_handle->ops->send_ocb_start_timing_advert_cmd) - return wmi_handle->ops->send_ocb_start_timing_advert_cmd(wmi_handle, - timing_advert); + if (wmi_hdl->ops->send_ocb_start_timing_advert_cmd) + return wmi_hdl->ops->send_ocb_start_timing_advert_cmd(wmi_hdl, + timing_advert); return QDF_STATUS_E_FAILURE; } -/** - * wmi_unified_ocb_stop_timing_advert() - stop sending the timing advertisement - * frames on a channel - * @wmi_handle: pointer to the wmi handle - * @timing_advert: pointer to the timing advertisement struct - * - * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure - */ -QDF_STATUS wmi_unified_ocb_stop_timing_advert(void *wmi_hdl, +QDF_STATUS wmi_unified_ocb_stop_timing_advert(struct wmi_unified *wmi_hdl, struct ocb_timing_advert_param *timing_advert) { - wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; - - if (wmi_handle->ops->send_ocb_stop_timing_advert_cmd) - return wmi_handle->ops->send_ocb_stop_timing_advert_cmd(wmi_handle, - timing_advert); + if (wmi_hdl->ops->send_ocb_stop_timing_advert_cmd) + return wmi_hdl->ops->send_ocb_stop_timing_advert_cmd(wmi_hdl, + timing_advert); return QDF_STATUS_E_FAILURE; } -/** - * wmi_unified_ocb_set_utc_time_cmd() - get ocb tsf timer val - * @wmi_handle: pointer to the wmi handle - * @vdev_id: vdev id - * - * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure - */ -QDF_STATUS wmi_unified_ocb_set_utc_time_cmd(void *wmi_hdl, - struct ocb_utc_param *utc) +QDF_STATUS wmi_unified_ocb_set_utc_time_cmd(struct wmi_unified *wmi_hdl, + struct ocb_utc_param *utc) { - wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; - - if (wmi_handle->ops->send_ocb_set_utc_time_cmd) - return wmi_handle->ops->send_ocb_set_utc_time_cmd(wmi_handle, - utc); + if (wmi_hdl->ops->send_ocb_set_utc_time_cmd) + return wmi_hdl->ops->send_ocb_set_utc_time_cmd(wmi_hdl, utc); return QDF_STATUS_E_FAILURE; } -/** - * wmi_unified_ocb_get_tsf_timer() - get ocb tsf timer val - * @wmi_handle: pointer to the wmi handle - * @vdev_id: vdev id - * - * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure - */ -QDF_STATUS wmi_unified_ocb_get_tsf_timer(void *wmi_hdl, - uint8_t vdev_id) +QDF_STATUS wmi_unified_ocb_get_tsf_timer(struct wmi_unified *wmi_hdl, + struct ocb_get_tsf_timer_param *req) { - wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; - - if (wmi_handle->ops->send_ocb_get_tsf_timer_cmd) - return wmi_handle->ops->send_ocb_get_tsf_timer_cmd(wmi_handle, - vdev_id); + if (wmi_hdl->ops->send_ocb_get_tsf_timer_cmd) + return wmi_hdl->ops->send_ocb_get_tsf_timer_cmd(wmi_hdl, + req->vdev_id); return QDF_STATUS_E_FAILURE; } -/** - * wmi_unified_dcc_get_stats_cmd() - get the DCC channel stats - * @wmi_handle: pointer to the wmi handle - * @get_stats_param: pointer to the dcc stats - * - * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure - */ -QDF_STATUS wmi_unified_dcc_get_stats_cmd(void *wmi_hdl, - struct dcc_get_stats_param *get_stats_param) +QDF_STATUS wmi_unified_dcc_get_stats_cmd(struct wmi_unified *wmi_hdl, + struct ocb_dcc_get_stats_param *get_stats_param) { - wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; - - if (wmi_handle->ops->send_dcc_get_stats_cmd) - return wmi_handle->ops->send_dcc_get_stats_cmd(wmi_handle, - get_stats_param); + if (wmi_hdl->ops->send_dcc_get_stats_cmd) + return wmi_hdl->ops->send_dcc_get_stats_cmd(wmi_hdl, + get_stats_param); return QDF_STATUS_E_FAILURE; } -/** - * wmi_unified_dcc_clear_stats() - command to clear the DCC stats - * @wmi_handle: pointer to the wmi handle - * @clear_stats_param: parameters to the command - * - * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure - */ -QDF_STATUS wmi_unified_dcc_clear_stats(void *wmi_hdl, - uint32_t vdev_id, uint32_t dcc_stats_bitmap) +QDF_STATUS wmi_unified_dcc_clear_stats(struct wmi_unified *wmi_hdl, + struct ocb_dcc_clear_stats_param *clear_stats_param) { - wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; - - if (wmi_handle->ops->send_dcc_clear_stats_cmd) - return wmi_handle->ops->send_dcc_clear_stats_cmd(wmi_handle, - vdev_id, dcc_stats_bitmap); + if (wmi_hdl->ops->send_dcc_clear_stats_cmd) + return wmi_hdl->ops->send_dcc_clear_stats_cmd(wmi_hdl, + clear_stats_param->vdev_id, + clear_stats_param->dcc_stats_bitmap); return QDF_STATUS_E_FAILURE; } -/** - * wmi_unified_dcc_update_ndl() - command to update the NDL data - * @wmi_handle: pointer to the wmi handle - * @update_ndl_param: pointer to the request parameters - * - * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failures - */ -QDF_STATUS wmi_unified_dcc_update_ndl(void *wmi_hdl, - struct dcc_update_ndl_param *update_ndl_param) +QDF_STATUS wmi_unified_dcc_update_ndl(struct wmi_unified *wmi_hdl, + struct ocb_dcc_update_ndl_param *update_ndl_param) { - wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; - - if (wmi_handle->ops->send_dcc_update_ndl_cmd) - return wmi_handle->ops->send_dcc_update_ndl_cmd(wmi_handle, + if (wmi_hdl->ops->send_dcc_update_ndl_cmd) + return wmi_hdl->ops->send_dcc_update_ndl_cmd(wmi_hdl, update_ndl_param); return QDF_STATUS_E_FAILURE; } -/** - * wmi_unified_ocb_set_config() - send the OCB config to the FW - * @wmi_handle: pointer to the wmi handle - * @config: the OCB configuration - * - * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failures - */ -QDF_STATUS wmi_unified_ocb_set_config(void *wmi_hdl, - struct ocb_config_param *config, uint32_t *ch_mhz) +QDF_STATUS wmi_unified_ocb_set_config(struct wmi_unified *wmi_hdl, + struct ocb_config *config) { - wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; - - if (wmi_handle->ops->send_ocb_set_config_cmd) - return wmi_handle->ops->send_ocb_set_config_cmd(wmi_handle, - config, ch_mhz); + if (wmi_hdl->ops->send_ocb_set_config_cmd) + return wmi_hdl->ops->send_ocb_set_config_cmd(wmi_hdl, + config); return QDF_STATUS_E_FAILURE; } +QDF_STATUS +wmi_extract_ocb_set_channel_config_resp(struct wmi_unified *wmi_hdl, + void *evt_buf, + uint32_t *status) +{ + if (wmi_hdl->ops->extract_ocb_chan_config_resp) + return wmi_hdl->ops->extract_ocb_chan_config_resp(wmi_hdl, + evt_buf, + status); + + return QDF_STATUS_E_FAILURE; +} + +QDF_STATUS wmi_extract_ocb_tsf_timer(struct wmi_unified *wmi_hdl, + void *evt_buf, + struct ocb_get_tsf_timer_response *resp) +{ + if (wmi_hdl->ops->extract_ocb_tsf_timer) + return wmi_hdl->ops->extract_ocb_tsf_timer(wmi_hdl, + evt_buf, + resp); + + return QDF_STATUS_E_FAILURE; +} + +QDF_STATUS wmi_extract_dcc_update_ndl_resp(struct wmi_unified *wmi_hdl, + void *evt_buf, struct ocb_dcc_update_ndl_response *resp) +{ + if (wmi_hdl->ops->extract_dcc_update_ndl_resp) + return wmi_hdl->ops->extract_dcc_update_ndl_resp(wmi_hdl, + evt_buf, + resp); + + return QDF_STATUS_E_FAILURE; +} + +QDF_STATUS wmi_extract_dcc_stats(struct wmi_unified *wmi_hdl, + void *evt_buf, + struct ocb_dcc_get_stats_response **resp) +{ + if (wmi_hdl->ops->extract_dcc_stats) + return wmi_hdl->ops->extract_dcc_stats(wmi_hdl, + evt_buf, + resp); + + return QDF_STATUS_E_FAILURE; +} +#endif + /** * wmi_unified_set_enable_disable_mcc_adaptive_scheduler_cmd() - control mcc scheduler * @wmi_handle: wmi handle diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 095cd7502b..d16e77f0af 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -3706,6 +3706,7 @@ static QDF_STATUS send_set_sta_uapsd_auto_trig_cmd_tlv(wmi_unified_t wmi_handle, return ret; } +#ifdef WLAN_FEATURE_DSRC /** * send_ocb_set_utc_time_cmd() - send the UTC time to the firmware * @wmi_handle: pointer to the wmi handle @@ -3910,7 +3911,7 @@ static QDF_STATUS send_ocb_get_tsf_timer_cmd_tlv(wmi_unified_t wmi_handle, * Return: 0 on succes */ static QDF_STATUS send_dcc_get_stats_cmd_tlv(wmi_unified_t wmi_handle, - struct dcc_get_stats_param *get_stats_param) + struct ocb_dcc_get_stats_param *get_stats_param) { QDF_STATUS ret; wmi_dcc_get_stats_cmd_fixed_param *cmd; @@ -4034,7 +4035,7 @@ static QDF_STATUS send_dcc_clear_stats_cmd_tlv(wmi_unified_t wmi_handle, * Return: 0 on success */ static QDF_STATUS send_dcc_update_ndl_cmd_tlv(wmi_unified_t wmi_handle, - struct dcc_update_ndl_param *update_ndl_param) + struct ocb_dcc_update_ndl_param *update_ndl_param) { QDF_STATUS qdf_status; wmi_dcc_update_ndl_cmd_fixed_param *cmd; @@ -4139,7 +4140,7 @@ static QDF_STATUS send_dcc_update_ndl_cmd_tlv(wmi_unified_t wmi_handle, * Return: 0 on success */ static QDF_STATUS send_ocb_set_config_cmd_tlv(wmi_unified_t wmi_handle, - struct ocb_config_param *config, uint32_t *ch_mhz) + struct ocb_config *config) { QDF_STATUS ret; wmi_ocb_set_config_cmd_fixed_param *cmd; @@ -4207,7 +4208,7 @@ static QDF_STATUS send_ocb_set_config_cmd_tlv(wmi_unified_t wmi_handle, WMITLV_SET_HDR(&cmd->tlv_header, WMITLV_TAG_STRUC_wmi_ocb_set_config_cmd_fixed_param, WMITLV_GET_STRUCT_TLVLEN(wmi_ocb_set_config_cmd_fixed_param)); - cmd->vdev_id = config->session_id; + cmd->vdev_id = config->vdev_id; cmd->channel_count = config->channel_count; cmd->schedule_size = config->schedule_size; cmd->flags = config->flags; @@ -4227,7 +4228,7 @@ static QDF_STATUS send_ocb_set_config_cmd_tlv(wmi_unified_t wmi_handle, chan->band_center_freq2 = 0; chan->info = 0; - WMI_SET_CHANNEL_MODE(chan, ch_mhz[i]); + WMI_SET_CHANNEL_MODE(chan, config->channels[i].ch_mode); WMI_SET_CHANNEL_MAX_POWER(chan, config->channels[i].max_pwr); WMI_SET_CHANNEL_MIN_POWER(chan, config->channels[i].min_pwr); WMI_SET_CHANNEL_MAX_TX_POWER(chan, config->channels[i].max_pwr); @@ -4338,6 +4339,123 @@ static QDF_STATUS send_ocb_set_config_cmd_tlv(wmi_unified_t wmi_handle, return ret; } +/** + * extract_ocb_channel_config_resp_tlv() - extract ocb channel config resp + * @wmi_handle: wmi handle + * @evt_buf: wmi event buffer + * @status: status buffer + * + * Return: QDF_STATUS_SUCCESS on success + */ +static QDF_STATUS extract_ocb_channel_config_resp_tlv(wmi_unified_t wmi_handle, + void *evt_buf, + uint32_t *status) +{ + WMI_OCB_SET_CONFIG_RESP_EVENTID_param_tlvs *param_tlvs; + wmi_ocb_set_config_resp_event_fixed_param *fix_param; + + param_tlvs = evt_buf; + fix_param = param_tlvs->fixed_param; + + *status = fix_param->status; + return QDF_STATUS_SUCCESS; +} + +/** + * extract_ocb_tsf_timer_tlv() - extract TSF timer from event buffer + * @wmi_handle: wmi handle + * @evt_buf: wmi event buffer + * @resp: response buffer + * + * Return: QDF_STATUS_SUCCESS on success + */ +static QDF_STATUS extract_ocb_tsf_timer_tlv(wmi_unified_t wmi_handle, + void *evt_buf, struct ocb_get_tsf_timer_response *resp) +{ + WMI_OCB_GET_TSF_TIMER_RESP_EVENTID_param_tlvs *param_tlvs; + wmi_ocb_get_tsf_timer_resp_event_fixed_param *fix_param; + + param_tlvs = evt_buf; + fix_param = param_tlvs->fixed_param; + resp->vdev_id = fix_param->vdev_id; + resp->timer_high = fix_param->tsf_timer_high; + resp->timer_low = fix_param->tsf_timer_low; + + return QDF_STATUS_SUCCESS; +} + +/** + * extract_ocb_ndl_resp_tlv() - extract TSF timer from event buffer + * @wmi_handle: wmi handle + * @evt_buf: wmi event buffer + * @resp: response buffer + * + * Return: QDF_STATUS_SUCCESS on success + */ +static QDF_STATUS extract_ocb_ndl_resp_tlv(wmi_unified_t wmi_handle, + void *evt_buf, struct ocb_dcc_update_ndl_response *resp) +{ + WMI_DCC_UPDATE_NDL_RESP_EVENTID_param_tlvs *param_tlvs; + wmi_dcc_update_ndl_resp_event_fixed_param *fix_param; + + param_tlvs = evt_buf; + fix_param = param_tlvs->fixed_param; + resp->vdev_id = fix_param->vdev_id; + resp->status = fix_param->status; + return QDF_STATUS_SUCCESS; +} + +/** + * extract_ocb_dcc_stats_tlv() - extract DCC stats from event buffer + * @wmi_handle: wmi handle + * @evt_buf: wmi event buffer + * @resp: response buffer + * + * Since length of stats is variable, buffer for DCC stats will be allocated + * in this function. The caller must free the buffer. + * + * Return: QDF_STATUS_SUCCESS on success + */ +static QDF_STATUS extract_ocb_dcc_stats_tlv(wmi_unified_t wmi_handle, + void *evt_buf, struct ocb_dcc_get_stats_response **resp) +{ + struct ocb_dcc_get_stats_response *response; + WMI_DCC_GET_STATS_RESP_EVENTID_param_tlvs *param_tlvs; + wmi_dcc_get_stats_resp_event_fixed_param *fix_param; + + param_tlvs = (WMI_DCC_GET_STATS_RESP_EVENTID_param_tlvs *)evt_buf; + fix_param = param_tlvs->fixed_param; + + /* Allocate and populate the response */ + if (fix_param->num_channels > ((WMI_SVC_MSG_MAX_SIZE - + sizeof(*fix_param)) / sizeof(wmi_dcc_ndl_stats_per_channel))) { + WMI_LOGE("%s: too many channels:%d", __func__, + fix_param->num_channels); + QDF_ASSERT(0); + *resp = NULL; + return QDF_STATUS_E_INVAL; + } + response = qdf_mem_malloc(sizeof(*response) + fix_param->num_channels * + sizeof(wmi_dcc_ndl_stats_per_channel)); + *resp = response; + if (!response) + return QDF_STATUS_E_NOMEM; + + response->vdev_id = fix_param->vdev_id; + response->num_channels = fix_param->num_channels; + response->channel_stats_array_len = + fix_param->num_channels * + sizeof(wmi_dcc_ndl_stats_per_channel); + response->channel_stats_array = ((uint8_t *)response) + + sizeof(*response); + qdf_mem_copy(response->channel_stats_array, + param_tlvs->stats_per_channel_list, + response->channel_stats_array_len); + + return QDF_STATUS_SUCCESS; +} +#endif + /** * send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv() -enable/disable mcc scheduler * @wmi_handle: wmi handle @@ -21576,6 +21694,7 @@ struct wmi_ops tlv_ops = { #endif .send_set_smps_params_cmd = send_set_smps_params_cmd_tlv, .send_set_mimops_cmd = send_set_mimops_cmd_tlv, +#ifdef WLAN_FEATURE_DSRC .send_ocb_set_utc_time_cmd = send_ocb_set_utc_time_cmd_tlv, .send_ocb_get_tsf_timer_cmd = send_ocb_get_tsf_timer_cmd_tlv, .send_dcc_clear_stats_cmd = send_dcc_clear_stats_cmd_tlv, @@ -21585,6 +21704,11 @@ struct wmi_ops tlv_ops = { .send_ocb_stop_timing_advert_cmd = send_ocb_stop_timing_advert_cmd_tlv, .send_ocb_start_timing_advert_cmd = send_ocb_start_timing_advert_cmd_tlv, + .extract_ocb_chan_config_resp = extract_ocb_channel_config_resp_tlv, + .extract_ocb_tsf_timer = extract_ocb_tsf_timer_tlv, + .extract_dcc_update_ndl_resp = extract_ocb_ndl_resp_tlv, + .extract_dcc_stats = extract_ocb_dcc_stats_tlv, +#endif .send_set_enable_disable_mcc_adaptive_scheduler_cmd = send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv, .send_set_mcc_channel_time_latency_cmd =