From b3a3073ae7e7fe9062b6168f5e2e4485e4ed6949 Mon Sep 17 00:00:00 2001 From: Manishekar Chandrasekaran Date: Thu, 21 Apr 2016 19:16:32 +0530 Subject: [PATCH] qcacmn: Replace WMI_SOC_SET_PCL_CMDID with WMI_PDEV_SET_PCL_CMDID Replace the obsolete WMI command WMI_SOC_SET_PCL_CMDID with WMI_PDEV_SET_PCL_CMDID. WMI_PDEV_SET_PCL_CMDID carries the weightage for all the channels (preferred and non-preferred) in the same order and length as that of the command WMI_SCAN_CHAN_LIST_CMDID. This is in contrast to the command WMI_SOC_SET_PCL_CMDID which carries only the preferred channel list. Change-Id: I040f4307491d3242d2e9409dbbe8005c4b307bf5 CRs-Fixed: 989502 --- wmi/inc/wmi_unified_api.h | 4 +-- wmi/inc/wmi_unified_param.h | 25 +++++++++++++++++++ wmi/inc/wmi_unified_priv.h | 4 +-- wmi/inc/wmi_unified_tlv.h | 4 +-- wmi/src/wmi_unified_api.c | 10 ++++---- wmi/src/wmi_unified_tlv.c | 49 +++++++++++++++++++++++-------------- 6 files changed, 66 insertions(+), 30 deletions(-) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index c703be50407d..db5d24994a11 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -705,8 +705,8 @@ QDF_STATUS wmi_unified_enable_specific_fw_logs_cmd(void *wmi_hdl, QDF_STATUS wmi_unified_flush_logs_to_fw_cmd(void *wmi_hdl); -QDF_STATUS wmi_unified_soc_set_pcl_cmd(void *wmi_hdl, - struct wmi_pcl_list *msg); +QDF_STATUS wmi_unified_pdev_set_pcl_cmd(void *wmi_hdl, + struct wmi_pcl_chan_weights *msg); QDF_STATUS wmi_unified_soc_set_hw_mode_cmd(void *wmi_hdl, uint32_t hw_mode_index); diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 48d98757a724..f26aeb73a43d 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -91,6 +91,8 @@ #define WMI_NLO_FREQ_THRESH 1000 /* in MHz */ #include "qdf_atomic.h" +#define MAX_NUM_CHAN 128 + /** * struct vdev_create_params - vdev create cmd parameter * @if_id: interface id @@ -2293,13 +2295,36 @@ struct wmi_wifi_start_log { /** * struct wmi_pcl_list - Format of PCL * @pcl_list: List of preferred channels + * @weight_list: Weights of the PCL * @pcl_len: Number of channels in the PCL */ struct wmi_pcl_list { uint8_t pcl_list[128]; + uint8_t weight_list[128]; uint32_t pcl_len; }; +/** + * struct wmi_pcl_chan_weights - Params to get the valid weighed list + * @pcl_list: Preferred channel list already sorted in the order of preference + * @pcl_len: Length of the PCL + * @saved_chan_list: Valid channel list updated as part of + * WMA_UPDATE_CHAN_LIST_REQ + * @saved_num_chan: Length of the valid channel list + * @weighed_valid_list: Weights of the valid channel list. This will have one + * to one mapping with valid_chan_list. FW expects channel order and size to be + * as per the list provided in WMI_SCAN_CHAN_LIST_CMDID. + * @weight_list: Weights assigned by policy manager + */ +struct wmi_pcl_chan_weights { + uint8_t pcl_list[MAX_NUM_CHAN]; + uint32_t pcl_len; + uint8_t saved_chan_list[MAX_NUM_CHAN]; + uint32_t saved_num_chan; + uint8_t weighed_valid_list[MAX_NUM_CHAN]; + uint8_t weight_list[MAX_NUM_CHAN]; +}; + /** * struct wmi_hw_mode_params - HW mode params * @mac0_tx_ss: MAC0 Tx spatial stream diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 2a25b63c20e3..267b68785cb8 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -530,8 +530,8 @@ QDF_STATUS (*send_enable_specific_fw_logs_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_flush_logs_to_fw_cmd)(wmi_unified_t wmi_handle); -QDF_STATUS (*send_soc_set_pcl_cmd)(wmi_unified_t wmi_handle, - struct wmi_pcl_list *msg); +QDF_STATUS (*send_pdev_set_pcl_cmd)(wmi_unified_t wmi_handle, + struct wmi_pcl_chan_weights *msg); QDF_STATUS (*send_soc_set_hw_mode_cmd)(wmi_unified_t wmi_handle, uint32_t hw_mode_index); diff --git a/wmi/inc/wmi_unified_tlv.h b/wmi/inc/wmi_unified_tlv.h index f9dbed04602e..e5ad2ffdea41 100644 --- a/wmi/inc/wmi_unified_tlv.h +++ b/wmi/inc/wmi_unified_tlv.h @@ -492,8 +492,8 @@ QDF_STATUS send_enable_specific_fw_logs_cmd_tlv(wmi_unified_t wmi_handle, QDF_STATUS send_flush_logs_to_fw_cmd_tlv(wmi_unified_t wmi_handle); -QDF_STATUS send_soc_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, - struct wmi_pcl_list *msg); +QDF_STATUS send_pdev_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, + struct wmi_pcl_chan_weights *msg); QDF_STATUS send_soc_set_hw_mode_cmd_tlv(wmi_unified_t wmi_handle, uint32_t hw_mode_index); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 78c01876b19f..331d4054c4ad 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -2892,7 +2892,7 @@ QDF_STATUS wmi_unified_flush_logs_to_fw_cmd(void *wmi_hdl) } /** - * wmi_unified_soc_set_pcl_cmd() - Send WMI_SOC_SET_PCL_CMDID to FW + * wmi_unified_pdev_set_pcl_cmd() - Send WMI_SOC_SET_PCL_CMDID to FW * @wmi_hdl: wmi handle * @msg: PCL structure containing the PCL and the number of channels * @@ -2905,13 +2905,13 @@ QDF_STATUS wmi_unified_flush_logs_to_fw_cmd(void *wmi_hdl) * * Return: Success if the cmd is sent successfully to the firmware */ -QDF_STATUS wmi_unified_soc_set_pcl_cmd(void *wmi_hdl, - struct wmi_pcl_list *msg) +QDF_STATUS wmi_unified_pdev_set_pcl_cmd(void *wmi_hdl, + struct wmi_pcl_chan_weights *msg) { wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; - if (wmi_handle->ops->send_soc_set_pcl_cmd) - return wmi_handle->ops->send_soc_set_pcl_cmd(wmi_handle, msg); + if (wmi_handle->ops->send_pdev_set_pcl_cmd) + return wmi_handle->ops->send_pdev_set_pcl_cmd(wmi_handle, msg); return QDF_STATUS_E_FAILURE; } diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 00f13becfb33..9194e883bf52 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -9238,29 +9238,37 @@ QDF_STATUS send_flush_logs_to_fw_cmd_tlv(wmi_unified_t wmi_handle) } /** - * send_soc_set_pcl_cmd_tlv() - Send WMI_SOC_SET_PCL_CMDID to FW + * send_pdev_set_pcl_cmd_tlv() - Send WMI_SOC_SET_PCL_CMDID to FW * @wmi_handle: wmi handle * @msg: PCL structure containing the PCL and the number of channels * - * WMI_SOC_SET_PCL_CMDID provides a Preferred Channel List (PCL) to the WLAN + * WMI_PDEV_SET_PCL_CMDID provides a Preferred Channel List (PCL) to the WLAN * firmware. The DBS Manager is the consumer of this information in the WLAN * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs * to migrate to a new channel without host driver involvement. An example of * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will * manage the channel selection without firmware involvement. * + * WMI_PDEV_SET_PCL_CMDID will carry only the weight list and not the actual + * channel list. The weights corresponds to the channels sent in + * WMI_SCAN_CHAN_LIST_CMDID. The channels from PCL would be having a higher + * weightage compared to the non PCL channels. + * * Return: Success if the cmd is sent successfully to the firmware */ -QDF_STATUS send_soc_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, - struct wmi_pcl_list *msg) +QDF_STATUS send_pdev_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, + struct wmi_pcl_chan_weights *msg) { - wmi_soc_set_pcl_cmd_fixed_param *cmd; + wmi_pdev_set_pcl_cmd_fixed_param *cmd; wmi_buf_t buf; uint8_t *buf_ptr; uint32_t *cmd_args, i, len; + uint32_t chan_len; + + chan_len = msg->saved_num_chan; len = sizeof(*cmd) + - WMI_TLV_HDR_SIZE + (msg->pcl_len * sizeof(uint32_t)); + WMI_TLV_HDR_SIZE + (chan_len * sizeof(uint32_t)); buf = wmi_buf_alloc(wmi_handle, len); if (!buf) { @@ -9268,25 +9276,28 @@ QDF_STATUS send_soc_set_pcl_cmd_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_E_NOMEM; } - cmd = (wmi_soc_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); + cmd = (wmi_pdev_set_pcl_cmd_fixed_param *) wmi_buf_data(buf); buf_ptr = (uint8_t *) cmd; WMITLV_SET_HDR(&cmd->tlv_header, - WMITLV_TAG_STRUC_wmi_soc_set_pcl_cmd_fixed_param, - WMITLV_GET_STRUCT_TLVLEN(wmi_soc_set_pcl_cmd_fixed_param)); - cmd->num_chan = msg->pcl_len; - WMI_LOGI("%s: PCL len:%d", __func__, cmd->num_chan); + WMITLV_TAG_STRUC_wmi_pdev_set_pcl_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN(wmi_pdev_set_pcl_cmd_fixed_param)); - buf_ptr += sizeof(wmi_soc_set_pcl_cmd_fixed_param); + cmd->pdev_id = WMI_PDEV_ID_SOC; + cmd->num_chan = chan_len; + WMA_LOGI("%s: Total chan (PCL) len:%d", __func__, cmd->num_chan); + + buf_ptr += sizeof(wmi_pdev_set_pcl_cmd_fixed_param); WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32, - (msg->pcl_len * sizeof(uint32_t))); + (chan_len * sizeof(uint32_t))); cmd_args = (uint32_t *) (buf_ptr + WMI_TLV_HDR_SIZE); - for (i = 0; i < msg->pcl_len ; i++) { - cmd_args[i] = msg->pcl_list[i]; - WMI_LOGI("%s: PCL chan:%d", __func__, cmd_args[i]); + for (i = 0; i < chan_len ; i++) { + cmd_args[i] = msg->weighed_valid_list[i]; + WMA_LOGI("%s: chan:%d weight:%d", __func__, + msg->saved_chan_list[i], cmd_args[i]); } if (wmi_unified_cmd_send(wmi_handle, buf, len, - WMI_SOC_SET_PCL_CMDID)) { - WMI_LOGE("%s: Failed to send WMI_SOC_SET_PCL_CMDID", __func__); + WMI_PDEV_SET_PCL_CMDID)) { + WMI_LOGE("%s: Failed to send WMI_PDEV_SET_PCL_CMDID", __func__); qdf_nbuf_free(buf); return QDF_STATUS_E_FAILURE; } @@ -10471,7 +10482,7 @@ struct wmi_ops tlv_ops = { .send_enable_specific_fw_logs_cmd = send_enable_specific_fw_logs_cmd_tlv, .send_flush_logs_to_fw_cmd = send_flush_logs_to_fw_cmd_tlv, - .send_soc_set_pcl_cmd = send_soc_set_pcl_cmd_tlv, + .send_pdev_set_pcl_cmd = send_pdev_set_pcl_cmd_tlv, .send_soc_set_hw_mode_cmd = send_soc_set_hw_mode_cmd_tlv, .send_soc_set_dual_mac_config_cmd = send_soc_set_dual_mac_config_cmd_tlv,