diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index fd453bd976..adec2f7c90 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -438,6 +438,9 @@ QDF_STATUS wmi_unified_lro_config_cmd(void *wmi_hdl, QDF_STATUS wmi_unified_set_thermal_mgmt_cmd(void *wmi_hdl, struct thermal_cmd_params *thermal_info); +QDF_STATUS wmi_unified_peer_rate_report_cmd(void *wmi_hdl, + struct wmi_peer_rate_report_params *rate_report_params); + QDF_STATUS wmi_unified_set_mcc_channel_time_quota_cmd (void *wmi_hdl, uint32_t adapter_1_chan_freq, diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 7950e7c7ab..c294868a78 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -197,6 +197,7 @@ #define WMI_HOST_TPC_TX_NUM_CHAIN 4 #define WMI_HOST_RXG_CAL_CHAN_MAX 4 #define WMI_HOST_MAX_NUM_CHAINS 4 +#define WMI_MAX_NUM_OF_RATE_THRESH 4 #include "qdf_atomic.h" @@ -1339,6 +1340,67 @@ struct ocb_config_param { void *dcc_ndl_active_state_list; }; +enum wmi_peer_rate_report_cond_phy_type { + WMI_PEER_RATE_REPORT_COND_11B = 0, + WMI_PEER_RATE_REPORT_COND_11A_G, + WMI_PEER_RATE_REPORT_COND_11N, + WMI_PEER_RATE_REPORT_COND_11AC, + WMI_PEER_RATE_REPORT_COND_MAX_NUM +}; + +/** + * struct report_rate_delta - peer specific parameters + * @percent: percentage + * @delta_min: rate min delta + */ +struct report_rate_delta { + A_UINT32 percent; /* in unit of 12.5% */ + A_UINT32 delta_min; /* in unit of Mbps */ +}; + +/** + * struct report_rate_per_phy - per phy report parameters + * @cond_flags: condition flag val + * @delta: rate delta + * @report_rate_threshold: rate threshold + */ +struct report_rate_per_phy { + /* + * PEER_RATE_REPORT_COND_FLAG_DELTA, + * PEER_RATE_REPORT_COND_FLAG_THRESHOLD + * Any of these two conditions or both of + * them can be set. + */ + A_UINT32 cond_flags; + struct report_rate_delta delta; + /* + * In unit of Mbps. There are at most 4 thresholds + * If the threshold count is less than 4, set zero to + * the one following the last threshold + */ + A_UINT32 report_rate_threshold[WMI_MAX_NUM_OF_RATE_THRESH]; +}; + +/** + * struct peer_rate_report_params - peer rate report parameters + * @rate_report_enable: enable rate report param + * @backoff_time: backoff time + * @timer_period: timer + * @report_per_phy: report per phy type + */ +struct wmi_peer_rate_report_params { + A_UINT32 rate_report_enable; + A_UINT32 backoff_time; /* in unit of msecond */ + A_UINT32 timer_period; /* in unit of msecond */ + /* + *In the following field, the array index means the phy type, + * please see enum wmi_peer_rate_report_cond_phy_type for detail + */ + struct report_rate_per_phy report_per_phy[ + WMI_PEER_RATE_REPORT_COND_MAX_NUM]; + +}; + /** * struct t_thermal_cmd_params - thermal command parameters * @min_temp: minimum temprature diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index b9127029b8..a16bf9cced 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -314,6 +314,9 @@ QDF_STATUS (*send_lro_config_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_set_thermal_mgmt_cmd)(wmi_unified_t wmi_handle, struct thermal_cmd_params *thermal_info); +QDF_STATUS (*send_peer_rate_report_cmd)(wmi_unified_t wmi_handle, + struct wmi_peer_rate_report_params *rate_report_params); + QDF_STATUS (*send_set_mcc_channel_time_quota_cmd) (wmi_unified_t wmi_handle, uint32_t adapter_1_chan_freq, diff --git a/wmi/inc/wmi_unified_tlv.h b/wmi/inc/wmi_unified_tlv.h index 7d0cbdd033..b498cef62f 100644 --- a/wmi/inc/wmi_unified_tlv.h +++ b/wmi/inc/wmi_unified_tlv.h @@ -190,6 +190,9 @@ QDF_STATUS send_lro_config_cmd_tlv(wmi_unified_t wmi_handle, QDF_STATUS send_set_thermal_mgmt_cmd_tlv(wmi_unified_t wmi_handle, struct thermal_cmd_params *thermal_info); +QDF_STATUS send_peer_rate_report_cmd_tlv(wmi_unified_t wmi_handle, + struct wmi_peer_rate_report_params *rate_report_params); + QDF_STATUS send_set_mcc_channel_time_quota_cmd_tlv (wmi_unified_t wmi_handle, uint32_t adapter_1_chan_freq, diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 0eeaacd34e..375637bc59 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -1207,6 +1207,26 @@ QDF_STATUS wmi_unified_lro_config_cmd(void *wmi_hdl, } #ifndef WMI_NON_TLV_SUPPORT +/** + * wmi_unified_peer_rate_report_cmd() - process the peer rate report command + * @wmi_hdl: Pointer to wmi handle + * @rate_report_params: Pointer to peer rate report parameters + * + * + * Return: QDF_STATUS_SUCCESS for success otherwise failure + */ +QDF_STATUS wmi_unified_peer_rate_report_cmd(void *wmi_hdl, + struct wmi_peer_rate_report_params *rate_report_params) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->send_peer_rate_report_cmd) + return wmi_handle->ops->send_peer_rate_report_cmd(wmi_handle, + rate_report_params); + + return QDF_STATUS_E_FAILURE; +} + /** * wmi_unified_bcn_buf_ll_cmd() - prepare and send beacon buffer to fw for LL * @wmi_hdl: wmi handle diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 8dc7029599..b1e7cc6416 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -3022,6 +3022,71 @@ QDF_STATUS send_lro_config_cmd_tlv(wmi_unified_t wmi_handle, return status; } +/** + * send_peer_rate_report_cmd_tlv() - process the peer rate report command + * @wmi_handle: Pointer to wmi handle + * @rate_report_params: Pointer to peer rate report parameters + * + * + * Return: QDF_STATUS_SUCCESS for success otherwise failure + */ +QDF_STATUS send_peer_rate_report_cmd_tlv(wmi_unified_t wmi_handle, + struct wmi_peer_rate_report_params *rate_report_params) +{ + wmi_peer_set_rate_report_condition_fixed_param *cmd = NULL; + wmi_buf_t buf = NULL; + QDF_STATUS status = 0; + uint32_t len = 0; + uint32_t i, j; + + len = sizeof(*cmd); + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGE("Failed to alloc buf to peer_set_condition cmd\n"); + return QDF_STATUS_E_FAILURE; + } + + cmd = (wmi_peer_set_rate_report_condition_fixed_param *) + wmi_buf_data(buf); + + WMITLV_SET_HDR( + &cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_peer_set_rate_report_condition_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + wmi_peer_set_rate_report_condition_fixed_param)); + + cmd->enable_rate_report = rate_report_params->rate_report_enable; + cmd->report_backoff_time = rate_report_params->backoff_time; + cmd->report_timer_period = rate_report_params->timer_period; + for (i = 0; i < PEER_RATE_REPORT_COND_MAX_NUM; i++) { + cmd->cond_per_phy[i].val_cond_flags = + rate_report_params->report_per_phy[i].cond_flags; + cmd->cond_per_phy[i].rate_delta.min_delta = + rate_report_params->report_per_phy[i].delta.delta_min; + cmd->cond_per_phy[i].rate_delta.percentage = + rate_report_params->report_per_phy[i].delta.percent; + for (j = 0; j < MAX_NUM_OF_RATE_THRESH; j++) { + cmd->cond_per_phy[i].rate_threshold[j] = + rate_report_params->report_per_phy[i]. + report_rate_threshold[j]; + } + } + + WMI_LOGE("%s enable %d backoff_time %d period %d\n", __func__, + cmd->enable_rate_report, + cmd->report_backoff_time, cmd->report_timer_period); + + status = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_PEER_SET_RATE_REPORT_CONDITION_CMDID); + if (QDF_IS_STATUS_ERROR(status)) { + qdf_nbuf_free(buf); + WMI_LOGE("%s:Failed to send peer_set_report_cond command", + __func__); + } + return status; +} + /** * send_bcn_buf_ll_cmd_tlv() - prepare and send beacon buffer to fw for LL * @wmi_handle: wmi handle @@ -11599,6 +11664,7 @@ struct wmi_ops tlv_ops = { send_set_mcc_channel_time_quota_cmd_tlv, .send_set_thermal_mgmt_cmd = send_set_thermal_mgmt_cmd_tlv, .send_lro_config_cmd = send_lro_config_cmd_tlv, + .send_peer_rate_report_cmd = send_peer_rate_report_cmd_tlv, .send_bcn_buf_ll_cmd = send_bcn_buf_ll_cmd_tlv, .send_set_sta_sa_query_param_cmd = send_set_sta_sa_query_param_cmd_tlv, .send_set_sta_keep_alive_cmd = send_set_sta_keep_alive_cmd_tlv,