From 9582515724071886b1a38f734ff9ec2d91dc460a Mon Sep 17 00:00:00 2001 From: Pragaspathi Thilagaraj Date: Tue, 16 Apr 2019 02:28:24 +0530 Subject: [PATCH] qcacmn: Send idle roam trigger monitor command to firmware Send idle roam trigger monitor command to firmware based on the SET SUSPEND mode command received from the user space. The set suspend mode value sent will be used by firmware as one of the parameters in determining if the device is in idle state. When set suspend mode is 1, device is not in idle state else the device is considered idle if idle state data packet count, idle rssi, inactivity time criteria are met. Add changes to send the idle trigger monitor value over the wmi command WMI_IDLE_TRIGGER_MONITOR_CMDID. Change-Id: I34632814a1e653fa87cfbab90c72ee1622dfd63c CRs-Fixed: 2436222 --- wmi/inc/wmi_unified_api.h | 12 ++++++++++++ wmi/inc/wmi_unified_priv.h | 3 +++ wmi/src/wmi_unified_api.c | 10 ++++++++++ wmi/src/wmi_unified_tlv.c | 39 +++++++++++++++++++++++++++++++++++++- 4 files changed, 63 insertions(+), 1 deletion(-) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 44274ffc82..9f45500105 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -1808,6 +1808,17 @@ enum cdp_sec_type wlan_crypto_cipher_to_cdp_sec_type( QDF_STATUS wmi_unified_send_mws_coex_req_cmd(struct wmi_unified *wmi_handle, uint32_t vdev_id, uint32_t cmd_id); +/** + * wmi_unified_send_idle_trigger_monitor() - send idle trigger monitor command + * @wmi_handle: WMI handle + * @val: idle trigger monitor value - 1 for idle monitor on, 0 for idle monitor + * off + * + * Return: QDF_STATUS_SUCCESS if success, else returns proper error code. + */ +QDF_STATUS +wmi_unified_send_idle_trigger_monitor(wmi_unified_t wmi_handle, uint8_t val); + #ifdef WLAN_CFR_ENABLE /** * wmi_unified_send_peer_cfr_capture_cmd() - WMI function to start CFR capture @@ -1832,5 +1843,6 @@ wmi_unified_send_peer_cfr_capture_cmd(void *wmi_hdl, QDF_STATUS wmi_extract_cfr_peer_tx_event_param(void *wmi_hdl, void *evt_buf, wmi_cfr_peer_tx_event_param *peer_tx_event); + #endif /* WLAN_CFR_ENABLE */ #endif /* _WMI_UNIFIED_API_H_ */ diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 50487f53a4..3d7e14c7af 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -418,6 +418,9 @@ QDF_STATUS (*send_modem_power_state_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_set_sta_ps_mode_cmd)(wmi_unified_t wmi_handle, uint32_t vdev_id, uint8_t val); +QDF_STATUS (*send_idle_roam_monitor_cmd)(wmi_unified_t wmi_handle, + uint8_t val); + QDF_STATUS (*send_get_temperature_cmd)(wmi_unified_t wmi_handle); #ifdef CONVERGED_P2P_ENABLE diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 4cd4cfd61c..d646e06bca 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -952,6 +952,16 @@ QDF_STATUS wmi_unified_set_sta_ps_mode(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } +QDF_STATUS +wmi_unified_send_idle_trigger_monitor(wmi_unified_t wmi_handle, uint8_t val) +{ + if (wmi_handle->ops->send_idle_roam_monitor_cmd) + return wmi_handle->ops->send_idle_roam_monitor_cmd(wmi_handle, + val); + + return QDF_STATUS_E_FAILURE; +} + /** * wmi_set_mimops() - set MIMO powersave * @wmi_hdl: wmi handle diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 20e4cc1b41..2d2676b807 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -3167,7 +3167,43 @@ static QDF_STATUS send_set_sta_ps_mode_cmd_tlv(wmi_unified_t wmi_handle, wmi_buf_free(buf); return QDF_STATUS_E_FAILURE; } - return 0; + return QDF_STATUS_SUCCESS; +} + +/** + * send_idle_roam_monitor_cmd_tlv() - send idle monitor command to fw + * @wmi_handle: wmi handle + * @vdev_id: vdev id + * + * Return: QDF_STATUS_SUCCESS for success or error code. + */ +static QDF_STATUS send_idle_roam_monitor_cmd_tlv(wmi_unified_t wmi_handle, + uint8_t val) +{ + wmi_idle_trigger_monitor_cmd_fixed_param *cmd; + wmi_buf_t buf; + size_t len = sizeof(*cmd); + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) + return QDF_STATUS_E_NOMEM; + + cmd = (wmi_idle_trigger_monitor_cmd_fixed_param *)wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_idle_trigger_monitor_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN(wmi_idle_trigger_monitor_cmd_fixed_param)); + + cmd->idle_trigger_monitor = (val ? WMI_IDLE_TRIGGER_MONITOR_ON : + WMI_IDLE_TRIGGER_MONITOR_OFF); + + WMI_LOGD("val:%d", cmd->idle_trigger_monitor); + + if (wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_IDLE_TRIGGER_MONITOR_CMDID)) { + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; + } + return QDF_STATUS_SUCCESS; } /** @@ -11298,6 +11334,7 @@ struct wmi_ops tlv_ops = { .send_offchan_data_tx_cmd = send_offchan_data_tx_cmd_tlv, .send_modem_power_state_cmd = send_modem_power_state_cmd_tlv, .send_set_sta_ps_mode_cmd = send_set_sta_ps_mode_cmd_tlv, + .send_idle_roam_monitor_cmd = send_idle_roam_monitor_cmd_tlv, .send_set_sta_uapsd_auto_trig_cmd = send_set_sta_uapsd_auto_trig_cmd_tlv, .send_get_temperature_cmd = send_get_temperature_cmd_tlv,