diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index 2490172778..c8ee2c6e2f 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -3244,6 +3244,11 @@ enum qca_wlan_vendor_attr_config { */ QCA_WLAN_VENDOR_ATTR_CONFIG_DISABLE_FILS = 54, + /* 16-bit unsigned value to configure the level of WLAN latency + * module. See enum qca_wlan_vendor_attr_config_latency_level. + */ + QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL = 55, + /* keep last */ QCA_WLAN_VENDOR_ATTR_CONFIG_AFTER_LAST, QCA_WLAN_VENDOR_ATTR_CONFIG_MAX = @@ -5216,6 +5221,42 @@ enum qca_wlan_vendor_attr_spectral_scan_status { QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_STATUS_AFTER_LAST - 1, }; +/** + * enum qca_wlan_vendor_attr_config_latency_level - Level for + * wlan latency module. + * + * There will be various of Wi-Fi functionality like scan/roaming/adaptive + * power saving which would causing data exchange out of service, this + * would be a big impact on latency. For latency sensitive applications over + * Wi-Fi are intolerant to such operations and thus would configure them + * to meet their respective needs. It is well understood by such applications + * that altering the default behavior would degrade the Wi-Fi functionality + * w.r.t the above pointed WLAN operations. + * + * @QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_NORMAL: + * Default WLAN operation level which throughput orientated. + * @QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_MODERATE: + * Use moderate level to improve latency by limit scan duration. + * @QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_LOW: + * Use low latency level to benifit application like concurrent + * downloading or video streaming via constraint scan/adaptive PS. + * @QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_ULTRALOW: + * Use ultra low latency level to benefit for gaming/voice + * application via constraint scan/roaming/adaptive PS. + */ +enum qca_wlan_vendor_attr_config_latency_level { + QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_NORMAL = 1, + QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_MODERATE = 2, + QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_LOW = 3, + QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_ULTRALOW = 4, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_MAX = + QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL_AFTER_LAST - 1, +}; + /** * qca_wlan_vendor_attr_spectral_scan_request_type: Attribute values for * QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE to the vendor subcmd diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 896821eccb..a378481b03 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -743,6 +743,16 @@ QDF_STATUS wmi_unified_wow_timer_pattern_cmd(void *wmi_hdl, uint8_t vdev_id, QDF_STATUS wmi_unified_nat_keepalive_en_cmd(void *wmi_hdl, uint8_t vdev_id); +/** + * wmi_unified_set_latency_config_cmd() + * @wmi_handle: wmi handle + * @param: WLM parameters + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_wlm_latency_level_cmd(void *wmi_hdl, + struct wlm_latency_level_param *param); + QDF_STATUS wmi_unified_csa_offload_enable(void *wmi_hdl, uint8_t vdev_id); #ifdef WLAN_FEATURE_CIF_CFR diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 0e06c65566..9c7b78a7b0 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -2910,6 +2910,45 @@ struct aggr_add_ts_param { uint8_t sessionId; }; + +/** + * struct wlm_latency_level_param - WLM parameters + * @wlm_latency_level: wlm latency level to set + * 0 - normal, 1 - moderate, 2 - low, 3 - ultralow + * @wlm_latency_flags: wlm latency flags to set + * |31 12| 11 | 10 |9 8|7 6|5 4|3 2| 1 | 0 | + * +------+------+------+------+------+------+------+-----+-----+ + * | RSVD | SSLP | CSLP | RSVD | Roam | RSVD | DWLT | DFS | SUP | + * +------+-------------+-------------+-------------------------+ + * | WAL | PS | Roam | Scan | + * + * bit 0: Avoid scan request from HLOS if setting + * bit 1: Skip DFS channel SCAN if setting + * bit 2-3: Define policy of dwell time/duration for each foreign channel + * (b2 b3) + * (0 0 ): Default scan dwell time + * (0 1 ): Reserve + * (1 0 ): Shrink off channel dwell time + * (1 1 ): Reserve + * bit 4-5: Reserve for scan + * bit 6-7: Define roaming policy + * (b6 b7) + * (0 0 ): Default roaming behavior, allow roaming in all scenarios + * (0 1 ): Disallow all roaming + * (1 0 ): Allow roaming when final bmissed + * (1 1 ): Reserve + * bit 8-9: Reserve for roaming + * bit 10: Disable css power collapse if setting + * bit 11: Disable sys sleep if setting + * bit 12-31: Reserve for future useage + * @vdev_id: vdev id + */ +struct wlm_latency_level_param { + uint16_t wlm_latency_level; + uint32_t wlm_latency_flags; + uint16_t vdev_id; +}; + #define WMI_MAX_FILTER_TEST_DATA_LEN 8 #define WMI_MAX_NUM_MULTICAST_ADDRESS 240 #define WMI_MAX_NUM_FILTERS 20 diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 0d60297bbf..732f9801f5 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -459,6 +459,8 @@ QDF_STATUS (*send_start_extscan_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_plm_stop_cmd)(wmi_unified_t wmi_handle, const struct plm_req_params *plm); +QDF_STATUS (*send_wlm_latency_level_cmd)(wmi_unified_t wmi_handle, + struct wlm_latency_level_param *param); QDF_STATUS (*send_plm_start_cmd)(wmi_unified_t wmi_handle, const struct plm_req_params *plm, diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 06a8aa9e3a..927747ce0a 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -2306,6 +2306,18 @@ QDF_STATUS wmi_unified_nat_keepalive_en_cmd(void *wmi_hdl, uint8_t vdev_id) return QDF_STATUS_E_FAILURE; } +QDF_STATUS wmi_unified_wlm_latency_level_cmd(void *wmi_hdl, + struct wlm_latency_level_param *param) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->send_wlm_latency_level_cmd) + return wmi_handle->ops->send_wlm_latency_level_cmd(wmi_handle, + param); + + return QDF_STATUS_E_FAILURE; +} + /** * wmi_unified_csa_offload_enable() - send CSA offload enable command * @wmi_hdl: wmi handle diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 450a2b1db7..d92fbdbf30 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -8641,6 +8641,39 @@ static QDF_STATUS send_fw_profiling_cmd_tlv(wmi_unified_t wmi_handle, return 0; } +static QDF_STATUS send_wlm_latency_level_cmd_tlv(wmi_unified_t wmi_handle, + struct wlm_latency_level_param *params) +{ + wmi_wlm_config_cmd_fixed_param *cmd; + wmi_buf_t buf; + uint32_t len = sizeof(*cmd); + static uint32_t ll[4] = {100, 60, 40, 20}; + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGP("%s: wmi_buf_alloc failed", __func__); + return QDF_STATUS_E_NOMEM; + } + cmd = (wmi_wlm_config_cmd_fixed_param *)wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_wlm_config_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_wlm_config_cmd_fixed_param)); + cmd->vdev_id = params->vdev_id; + cmd->latency_level = params->wlm_latency_level; + cmd->ul_latency = ll[params->wlm_latency_level]; + cmd->dl_latency = ll[params->wlm_latency_level]; + cmd->flags = params->wlm_latency_flags; + if (wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_WLM_CONFIG_CMDID)) { + WMI_LOGE("%s: Failed to send setting latency config command", + __func__); + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; + } + + return 0; +} /** * send_nat_keepalive_en_cmd_tlv() - enable NAT keepalive filter * @wmi_handle: wmi handle @@ -20189,6 +20222,7 @@ struct wmi_ops tlv_ops = { .send_fw_profiling_cmd = send_fw_profiling_cmd_tlv, .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, + .send_wlm_latency_level_cmd = send_wlm_latency_level_cmd_tlv, .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, #ifdef WLAN_FEATURE_CIF_CFR .send_oem_dma_cfg_cmd = send_oem_dma_cfg_cmd_tlv,