From 74a66aaba34b65d8303461316096a60f188b1ae7 Mon Sep 17 00:00:00 2001 From: Zhang Qian Date: Fri, 5 Jan 2018 16:50:53 +0800 Subject: [PATCH] qcacmn: Add wmi APIs to extract OCB events data Add APIs to extract data from wmi event buffer for tlv interface. CRs-Fixed: 2177557 Change-Id: I538c0a9ed4a1d8a4bd8845ab337b16370737ce44 --- wmi_unified_api.h | 153 ++++++++++++++++++++++++++++++++++++++------ wmi_unified_param.h | 137 +-------------------------------------- wmi_unified_priv.h | 20 ++++-- 3 files changed, 149 insertions(+), 161 deletions(-) diff --git a/wmi_unified_api.h b/wmi_unified_api.h index 58f421ccbf..29fa51f738 100644 --- a/wmi_unified_api.h +++ b/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_unified_param.h b/wmi_unified_param.h index abd4d5f2d2..9853b554fb 100644 --- a/wmi_unified_param.h +++ b/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_unified_priv.h b/wmi_unified_priv.h index cb363cac91..b62a5d1b65 100644 --- a/wmi_unified_priv.h +++ b/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);