From cb1ee46e8471f28a1dac008d829e385532b3a638 Mon Sep 17 00:00:00 2001 From: "Padma, Santhosh Kumar" Date: Tue, 21 Mar 2017 19:09:35 +0530 Subject: [PATCH] qcacmn: Get CCA from firmware Requirement is to get CCA from frmware when connection fails due to assoc/auth/probe response timeout. These are common changes to get CCA from firmware. Change-Id: I062343ed065d7b0c38b9e3b24ecfa9851b9b1537 CRs-Fixed: 2031843 --- wmi_unified_api.c | 19 +++++++++++++++++++ wmi_unified_tlv.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/wmi_unified_api.c b/wmi_unified_api.c index c7e6ad1fbb..7a4c6e6602 100644 --- a/wmi_unified_api.c +++ b/wmi_unified_api.c @@ -2051,6 +2051,25 @@ QDF_STATUS wmi_unified_get_stats_cmd(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } +/** + * wmi_unified_congestion_request_cmd() - send request to fw to get CCA + * @wmi_hdl: wma handle + * @vdev_id: vdev id + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_congestion_request_cmd(void *wmi_hdl, + uint8_t vdev_id) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->send_congestion_cmd) + return wmi_handle->ops->send_congestion_cmd(wmi_handle, + vdev_id); + + return QDF_STATUS_E_FAILURE; +} + /** * wmi_unified_process_ll_stats_set_cmd() - link layer stats set request * @wmi_handle: wmi handle diff --git a/wmi_unified_tlv.c b/wmi_unified_tlv.c index 52fb46961d..0739ea37d9 100644 --- a/wmi_unified_tlv.c +++ b/wmi_unified_tlv.c @@ -7369,6 +7369,51 @@ static QDF_STATUS send_get_stats_cmd_tlv(wmi_unified_t wmi_handle, } +/** + * send_congestion_cmd_tlv() - send request to fw to get CCA + * @wmi_handle: wmi handle + * @vdev_id: vdev id + * + * Return: CDF status + */ +static QDF_STATUS send_congestion_cmd_tlv(wmi_unified_t wmi_handle, + A_UINT8 vdev_id) +{ + wmi_buf_t buf; + wmi_request_stats_cmd_fixed_param *cmd; + uint8_t len; + uint8_t *buf_ptr; + + len = sizeof(*cmd); + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); + return QDF_STATUS_E_FAILURE; + } + + buf_ptr = wmi_buf_data(buf); + cmd = (wmi_request_stats_cmd_fixed_param *)buf_ptr; + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_request_stats_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_request_stats_cmd_fixed_param)); + + cmd->stats_id = WMI_REQUEST_CONGESTION_STAT; + cmd->vdev_id = vdev_id; + WMI_LOGD("STATS REQ VDEV_ID:%d stats_id %d -->", + cmd->vdev_id, cmd->stats_id); + + if (wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_REQUEST_STATS_CMDID)) { + WMI_LOGE("%s: Failed to send WMI_REQUEST_STATS_CMDID", + __func__); + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + /** * send_snr_request_cmd_tlv() - send request to fw to get RSSI stats * @wmi_handle: wmi handle @@ -17254,6 +17299,7 @@ struct wmi_ops tlv_ops = { .send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv, .send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv, .send_get_stats_cmd = send_get_stats_cmd_tlv, + .send_congestion_cmd = send_congestion_cmd_tlv, .send_snr_request_cmd = send_snr_request_cmd_tlv, .send_snr_cmd = send_snr_cmd_tlv, .send_link_status_req_cmd = send_link_status_req_cmd_tlv,