From f0d90c7f28c9b7bee84c8536395362984f1fcb96 Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Thu, 20 Jul 2017 09:45:01 -0700 Subject: [PATCH] qcacmn: Configure MAWC roaming parameters to firmware Get the MAWC based roaming parameters from CSR/WMA and pass them to firmware Change-Id: I78a287a39715dbabcceb2cb5c4270726ba265d61 CRs-Fixed: 2064837 --- wmi/inc/wmi_unified_api.h | 13 +++++++++ wmi/inc/wmi_unified_param.h | 18 ++++++++++++ wmi/inc/wmi_unified_priv.h | 3 ++ wmi/src/wmi_unified_api.c | 11 ++++++++ wmi/src/wmi_unified_tlv.c | 55 +++++++++++++++++++++++++++++++++++++ 5 files changed, 100 insertions(+) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index a2ac7018e5..9eef1d0466 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -614,6 +614,19 @@ QDF_STATUS wmi_unified_roam_scan_offload_mode_cmd(void *wmi_hdl, struct roam_offload_scan_params *roam_req); #endif +/** + * wmi_unified_roam_mawc_params_cmd() - configure roaming MAWC parameters + * @wmi_hdl: wmi handle + * @params: Parameters to be configured + * + * Pass the MAWC(Motion Aided wireless connectivity) related roaming + * parameters from the host to the target + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_roam_mawc_params_cmd(void *wmi_hdl, + struct wmi_mawc_roam_params *params); + QDF_STATUS wmi_unified_roam_scan_offload_rssi_thresh_cmd(void *wmi_hdl, struct roam_offload_scan_rssi_params *roam_req); diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 156776b9a4..eb8030c78c 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -7415,4 +7415,22 @@ struct wmi_limit_off_chan_param { bool skip_dfs_chans; }; +/** + * struct wmi_mawc_roam_params - Motion Aided wireless connectivity params + * @vdev_id: VDEV on which the parameters should be applied + * @enable: MAWC roaming feature enable/disable + * @traffic_load_threshold: Traffic threshold in kBps for MAWC roaming + * @best_ap_rssi_threshold: AP RSSI Threshold for MAWC roaming + * @rssi_stationary_high_adjust: High RSSI adjustment value to suppress scan + * @rssi_stationary_low_adjust: Low RSSI adjustment value to suppress scan + */ +struct wmi_mawc_roam_params { + uint8_t vdev_id; + bool enable; + uint32_t traffic_load_threshold; + uint32_t best_ap_rssi_threshold; + uint8_t rssi_stationary_high_adjust; + uint8_t rssi_stationary_low_adjust; +}; + #endif /* _WMI_UNIFIED_PARAM_H_ */ diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 8b95f74fb2..1c470e8bb4 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -410,6 +410,9 @@ QDF_STATUS (*send_reset_passpoint_network_list_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_roam_scan_offload_rssi_thresh_cmd)(wmi_unified_t wmi_handle, struct roam_offload_scan_rssi_params *roam_req); +QDF_STATUS (*send_roam_mawc_params_cmd)(wmi_unified_t wmi_handle, + struct wmi_mawc_roam_params *params); + QDF_STATUS (*send_roam_scan_filter_cmd)(wmi_unified_t wmi_handle, struct roam_scan_filter_params *roam_req); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 72232d2660..13121def13 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -1686,6 +1686,17 @@ QDF_STATUS wmi_unified_roam_scan_offload_rssi_thresh_cmd(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } +QDF_STATUS wmi_unified_roam_mawc_params_cmd( + void *wmi_hdl, struct wmi_mawc_roam_params *params) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->send_roam_mawc_params_cmd) + return wmi_handle->ops->send_roam_mawc_params_cmd( + wmi_handle, params); + + return QDF_STATUS_E_FAILURE; +} /** * wmi_unified_roam_scan_filter_cmd() - send roam scan whitelist, * blacklist and preferred list diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 56f952d94d..c842a4fa26 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -5807,6 +5807,60 @@ send_roam_scan_mode_cmd: return status; } +static QDF_STATUS send_roam_mawc_params_cmd_tlv(wmi_unified_t wmi_handle, + struct wmi_mawc_roam_params *params) +{ + wmi_buf_t buf = NULL; + QDF_STATUS status; + int len; + uint8_t *buf_ptr; + wmi_roam_configure_mawc_cmd_fixed_param *wmi_roam_mawc_params; + + len = sizeof(*wmi_roam_mawc_params); + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGE("%s : wmi_buf_alloc failed", __func__); + return QDF_STATUS_E_NOMEM; + } + + buf_ptr = (uint8_t *) wmi_buf_data(buf); + wmi_roam_mawc_params = + (wmi_roam_configure_mawc_cmd_fixed_param *) buf_ptr; + WMITLV_SET_HDR(&wmi_roam_mawc_params->tlv_header, + WMITLV_TAG_STRUC_wmi_roam_configure_mawc_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_roam_configure_mawc_cmd_fixed_param)); + wmi_roam_mawc_params->vdev_id = params->vdev_id; + if (params->enable) + wmi_roam_mawc_params->enable = 1; + else + wmi_roam_mawc_params->enable = 0; + wmi_roam_mawc_params->traffic_load_threshold = + params->traffic_load_threshold; + wmi_roam_mawc_params->best_ap_rssi_threshold = + params->best_ap_rssi_threshold; + wmi_roam_mawc_params->rssi_stationary_high_adjust = + params->rssi_stationary_high_adjust; + wmi_roam_mawc_params->rssi_stationary_low_adjust = + params->rssi_stationary_low_adjust; + + status = wmi_unified_cmd_send(wmi_handle, buf, + len, WMI_ROAM_CONFIGURE_MAWC_CMDID); + if (QDF_IS_STATUS_ERROR(status)) { + WMI_LOGE("WMI_ROAM_CONFIGURE_MAWC_CMDID failed, Error %d", + status); + wmi_buf_free(buf); + return status; + } + WMI_LOGD(FL("MAWC roam en=%d, vdev=%d, tr=%d, ap=%d, high=%d, low=%d"), + wmi_roam_mawc_params->enable, wmi_roam_mawc_params->vdev_id, + wmi_roam_mawc_params->traffic_load_threshold, + wmi_roam_mawc_params->best_ap_rssi_threshold, + wmi_roam_mawc_params->rssi_stationary_high_adjust, + wmi_roam_mawc_params->rssi_stationary_low_adjust); + + return QDF_STATUS_SUCCESS; +} /** * send_roam_scan_offload_rssi_thresh_cmd_tlv() - set scan offload @@ -18608,6 +18662,7 @@ struct wmi_ops tlv_ops = { send_set_passpoint_network_list_cmd_tlv, .send_roam_scan_offload_rssi_thresh_cmd = send_roam_scan_offload_rssi_thresh_cmd_tlv, + .send_roam_mawc_params_cmd = send_roam_mawc_params_cmd_tlv, .send_roam_scan_filter_cmd = send_roam_scan_filter_cmd_tlv, .send_set_epno_network_list_cmd =