From 33fae2710d1e253b942576d270160141e17cdff7 Mon Sep 17 00:00:00 2001 From: Paul Zhang Date: Mon, 23 Apr 2018 16:19:00 +0800 Subject: [PATCH] qcacld-3.0: Config number of TX sw retry per AC Video/audio wireless application needs to tune parameters per AC based. Config the number of TX sw retry per AC via driver INI configuration file. It helps to improve the video/audio performance in noisy environment. Change-Id: Icffb5174b265b6453021b0d0a8ad3e12b695847a CRs-Fixed: 2212954 --- core/hdd/inc/wlan_hdd_cfg.h | 100 ++++++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_cfg.c | 37 ++++++++++++ core/mac/inc/sir_api.h | 16 +++++ core/sme/inc/csr_api.h | 4 ++ core/sme/inc/csr_internal.h | 4 ++ core/sme/src/csr/csr_api_roam.c | 16 +++++ core/wma/inc/wma_api.h | 11 ++++ core/wma/inc/wma_if.h | 8 +++ core/wma/src/wma_dev_if.c | 18 ++++++ core/wma/src/wma_features.c | 76 ++++++++++++++++++++++++ 10 files changed, 290 insertions(+) diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 4e0a67abaf65..891a3f719abf 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -8952,6 +8952,102 @@ enum hdd_link_speed_rpt_type { #define CFG_RX_AGGREGATION_SIZE_MAX (64) #define CFG_RX_AGGREGATION_SIZE_DEFAULT (64) +/* + * + * gTxAggSwRetryBE - Configure Tx aggregation sw retry for BE + * @Min: 0 + * @Max: 64 + * @Default: 0 + * + * gTxAggSwRetryBE gives an option to configure Tx aggregation sw + * retry for BE. This can be useful in debugging throughput issues. + * + * Related: None + * + * Supported Feature: STA + * + * Usage: External + * + * + */ + +#define CFG_TX_AGGR_SW_RETRY_BE "gTxAggSwRetryBE" +#define CFG_TX_AGGR_SW_RETRY_BE_MIN (0) +#define CFG_TX_AGGR_SW_RETRY_BE_MAX (64) +#define CFG_TX_AGGR_SW_RETRY_BE_DEFAULT (0) + +/* + * + * gTxAggSwRetryBK - Configure Tx aggregation sw retry for BK + * @Min: 0 + * @Max: 64 + * @Default: 0 + * + * gTxAggSwRetryBK gives an option to configure Tx aggregation sw + * retry for BK. This can be useful in debugging throughput issues. + * + * Related: None + * + * Supported Feature: STA + * + * Usage: External + * + * + */ + +#define CFG_TX_AGGR_SW_RETRY_BK "gTxAggSwRetryBK" +#define CFG_TX_AGGR_SW_RETRY_BK_MIN (0) +#define CFG_TX_AGGR_SW_RETRY_BK_MAX (64) +#define CFG_TX_AGGR_SW_RETRY_BK_DEFAULT (0) + +/* + * + * gTxAggSwRetryVI - Configure Tx aggregation sw retry for VI + * @Min: 0 + * @Max: 64 + * @Default: 0 + * + * gTxAggSwRetryVI gives an option to configure Tx aggregation sw + * retry for VI. This can be useful in debugging throughput issues. + * + * Related: None + * + * Supported Feature: STA + * + * Usage: External + * + * + */ + +#define CFG_TX_AGGR_SW_RETRY_VI "gTxAggSwRetryVI" +#define CFG_TX_AGGR_SW_RETRY_VI_MIN (0) +#define CFG_TX_AGGR_SW_RETRY_VI_MAX (64) +#define CFG_TX_AGGR_SW_RETRY_VI_DEFAULT (0) + +/* + * + * gTxAggSwRetryVO - Configure Tx aggregation sw retry for VO + * @Min: 0 + * @Max: 64 + * @Default: 0 + * + * gTxAggSwRetryVO gives an option to configure Tx aggregation sw + * retry for VO. This can be useful in debugging throughput issues. + * + * Related: None + * + * Supported Feature: STA + * + * Usage: External + * + * + */ + +#define CFG_TX_AGGR_SW_RETRY_VO "gTxAggSwRetryVO" +#define CFG_TX_AGGR_SW_RETRY_VO_MIN (0) +#define CFG_TX_AGGR_SW_RETRY_VO_MAX (64) +#define CFG_TX_AGGR_SW_RETRY_VO_DEFAULT (0) + /* * fine timing measurement capability information * @@ -14795,6 +14891,10 @@ struct hdd_config { uint32_t tx_aggregation_size_vi; uint32_t tx_aggregation_size_vo; uint32_t rx_aggregation_size; + uint32_t tx_aggr_sw_retry_threshold_be; + uint32_t tx_aggr_sw_retry_threshold_bk; + uint32_t tx_aggr_sw_retry_threshold_vi; + uint32_t tx_aggr_sw_retry_threshold_vo; bool sta_prefer_80MHz_over_160MHz; uint8_t sap_max_inactivity_override; bool fw_timeout_crash; diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 21624ae500c3..2cb8c73ee267 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4283,6 +4283,35 @@ struct reg_table_entry g_registry_table[] = { CFG_RX_AGGREGATION_SIZE_DEFAULT, CFG_RX_AGGREGATION_SIZE_MIN, CFG_RX_AGGREGATION_SIZE_MAX), + + REG_VARIABLE(CFG_TX_AGGR_SW_RETRY_BE, WLAN_PARAM_Integer, + struct hdd_config, tx_aggr_sw_retry_threshold_be, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_TX_AGGR_SW_RETRY_BE_DEFAULT, + CFG_TX_AGGR_SW_RETRY_BE_MIN, + CFG_TX_AGGR_SW_RETRY_BE_MAX), + + REG_VARIABLE(CFG_TX_AGGR_SW_RETRY_BK, WLAN_PARAM_Integer, + struct hdd_config, tx_aggr_sw_retry_threshold_bk, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_TX_AGGR_SW_RETRY_BK_DEFAULT, + CFG_TX_AGGR_SW_RETRY_BK_MIN, + CFG_TX_AGGR_SW_RETRY_BK_MAX), + + REG_VARIABLE(CFG_TX_AGGR_SW_RETRY_VI, WLAN_PARAM_Integer, + struct hdd_config, tx_aggr_sw_retry_threshold_vi, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_TX_AGGR_SW_RETRY_VI_DEFAULT, + CFG_TX_AGGR_SW_RETRY_VI_MIN, + CFG_TX_AGGR_SW_RETRY_VI_MAX), + + REG_VARIABLE(CFG_TX_AGGR_SW_RETRY_VO, WLAN_PARAM_Integer, + struct hdd_config, tx_aggr_sw_retry_threshold_vo, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_TX_AGGR_SW_RETRY_VO_DEFAULT, + CFG_TX_AGGR_SW_RETRY_VO_MIN, + CFG_TX_AGGR_SW_RETRY_VO_MAX), + REG_VARIABLE(CFG_SAP_MAX_INACTIVITY_OVERRIDE_NAME, WLAN_PARAM_Integer, struct hdd_config, sap_max_inactivity_override, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -8923,6 +8952,14 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx) hdd_ctx->config->tx_aggregation_size_vo; smeConfig->csrConfig.rx_aggregation_size = hdd_ctx->config->rx_aggregation_size; + smeConfig->csrConfig.tx_aggr_sw_retry_threshold_be = + hdd_ctx->config->tx_aggr_sw_retry_threshold_be; + smeConfig->csrConfig.tx_aggr_sw_retry_threshold_bk = + hdd_ctx->config->tx_aggr_sw_retry_threshold_bk; + smeConfig->csrConfig.tx_aggr_sw_retry_threshold_vi = + hdd_ctx->config->tx_aggr_sw_retry_threshold_vi; + smeConfig->csrConfig.tx_aggr_sw_retry_threshold_vo = + hdd_ctx->config->tx_aggr_sw_retry_threshold_vo; smeConfig->csrConfig.enable_bcast_probe_rsp = hdd_ctx->config->enable_bcast_probe_rsp; smeConfig->csrConfig.is_fils_enabled = diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 7c1f3140bbfb..2e7b9cae5e61 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -6779,6 +6779,22 @@ struct sir_set_tx_rx_aggregation_size { uint32_t rx_aggregation_size; }; +/** + * struct sir_set_tx_aggr_sw_retry_threshold - set sw retry threshold + * @vdev_id: vdev id of the session + * @tx_aggr_sw_retry_threshold_be: sw retry threshold for BE + * @tx_aggr_sw_retry_threshold_bk: sw retry threshold for BK + * @tx_aggr_sw_retry_threshold_vi: sw retry threshold for VI + * @tx_aggr_sw_retry_threshold_vo: sw retry threshold for VO + */ +struct sir_set_tx_aggr_sw_retry_threshold { + uint8_t vdev_id; + uint32_t tx_aggr_sw_retry_threshold_be; + uint32_t tx_aggr_sw_retry_threshold_bk; + uint32_t tx_aggr_sw_retry_threshold_vi; + uint32_t tx_aggr_sw_retry_threshold_vo; +}; + /** * struct sir_p2p_lo_start - p2p listen offload start * @vdev_id: vdev identifier diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 05a73f84e05a..2c0a5a9ab577 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -1283,6 +1283,10 @@ typedef struct tagCsrConfigParam { uint32_t tx_aggregation_size_vi; uint32_t tx_aggregation_size_vo; uint32_t rx_aggregation_size; + uint32_t tx_aggr_sw_retry_threshold_be; + uint32_t tx_aggr_sw_retry_threshold_bk; + uint32_t tx_aggr_sw_retry_threshold_vi; + uint32_t tx_aggr_sw_retry_threshold_vo; struct wmi_per_roam_config per_roam_config; bool enable_bcast_probe_rsp; bool is_fils_enabled; diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index 09e0cd3f9332..ea9a541896a6 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -587,6 +587,10 @@ struct csr_config { uint32_t tx_aggregation_size_vi; uint32_t tx_aggregation_size_vo; uint32_t rx_aggregation_size; + uint32_t tx_aggr_sw_retry_threshold_be; + uint32_t tx_aggr_sw_retry_threshold_bk; + uint32_t tx_aggr_sw_retry_threshold_vi; + uint32_t tx_aggr_sw_retry_threshold_vo; struct wmi_per_roam_config per_roam_config; bool enable_bcast_probe_rsp; bool is_fils_enabled; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 568b3cc3375a..cf04acd657b4 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -3099,6 +3099,14 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, pParam->tx_aggregation_size_vo; pMac->roam.configParam.rx_aggregation_size = pParam->rx_aggregation_size; + pMac->roam.configParam.tx_aggr_sw_retry_threshold_be = + pParam->tx_aggr_sw_retry_threshold_be; + pMac->roam.configParam.tx_aggr_sw_retry_threshold_bk = + pParam->tx_aggr_sw_retry_threshold_bk; + pMac->roam.configParam.tx_aggr_sw_retry_threshold_vi = + pParam->tx_aggr_sw_retry_threshold_vi; + pMac->roam.configParam.tx_aggr_sw_retry_threshold_vo = + pParam->tx_aggr_sw_retry_threshold_vo; pMac->roam.configParam.enable_bcast_probe_rsp = pParam->enable_bcast_probe_rsp; pMac->roam.configParam.is_fils_enabled = @@ -16757,6 +16765,14 @@ QDF_STATUS csr_issue_add_sta_for_session_req(tpAniSirGlobal pMac, pMac->roam.configParam.pkt_err_disconn_th; add_sta_self_req->oce_feature_bitmap = pMac->roam.configParam.oce_feature_bitmap; + add_sta_self_req->tx_aggr_sw_retry_threshold_be = + pMac->roam.configParam.tx_aggr_sw_retry_threshold_be; + add_sta_self_req->tx_aggr_sw_retry_threshold_bk = + pMac->roam.configParam.tx_aggr_sw_retry_threshold_bk; + add_sta_self_req->tx_aggr_sw_retry_threshold_vi = + pMac->roam.configParam.tx_aggr_sw_retry_threshold_vi; + add_sta_self_req->tx_aggr_sw_retry_threshold_vo = + pMac->roam.configParam.tx_aggr_sw_retry_threshold_vo; msg.type = WMA_ADD_STA_SELF_REQ; msg.reserved = 0; msg.bodyptr = add_sta_self_req; diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h index a458b0737c23..d368c8d47923 100644 --- a/core/wma/inc/wma_api.h +++ b/core/wma/inc/wma_api.h @@ -262,6 +262,17 @@ QDF_STATUS wma_set_tx_rx_aggregation_size */ QDF_STATUS wma_set_tx_rx_aggregation_size_per_ac (struct sir_set_tx_rx_aggregation_size *tx_rx_aggregation_size); +/** + * wma_set_sw_retry_threshold() - set sw retry threshold per AC for tx + * @tx_rx_aggregation_size: value needs to set to firmware + * + * This function sends WMI command to set the sw retry threshold per AC + * for Tx. + * + * Return: QDF_STATUS. + */ +QDF_STATUS wma_set_sw_retry_threshold + (struct sir_set_tx_aggr_sw_retry_threshold *tx_rx_aggregation_size); /** * wma_get_sar_limit() - get SAR limits from the target * @handle: wma handle diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h index b5ff7ff0a31f..c86b2844a30c 100644 --- a/core/wma/inc/wma_if.h +++ b/core/wma/inc/wma_if.h @@ -1167,6 +1167,10 @@ typedef struct sMaxTxPowerPerBandParams { * @enable_bcast_probe_rsp: enable broadcast probe response * @fils_max_chan_guard_time: FILS max channel guard time * @pkt_err_disconn_th: packet drop threshold + * @tx_aggr_sw_retry_threshold_be: sw retry threashold for be + * @tx_aggr_sw_retry_threshold_bk: sw retry threashold for bk + * @tx_aggr_sw_retry_threshold_vi: sw retry threashold for vi + * @tx_aggr_sw_retry_threshold_vo: sw retry threashold for vo */ struct add_sta_self_params { tSirMacAddr self_mac_addr; @@ -1187,6 +1191,10 @@ struct add_sta_self_params { uint8_t fils_max_chan_guard_time; uint16_t pkt_err_disconn_th; uint8_t oce_feature_bitmap; + uint32_t tx_aggr_sw_retry_threshold_be; + uint32_t tx_aggr_sw_retry_threshold_bk; + uint32_t tx_aggr_sw_retry_threshold_vi; + uint32_t tx_aggr_sw_retry_threshold_vo; }; /** diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 8b9c9658e9ed..0a63e0220b47 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -2197,6 +2197,7 @@ struct cdp_vdev *wma_vdev_attach(tp_wma_handle wma_handle, struct vdev_create_params params = { 0 }; u_int8_t vdev_id; struct sir_set_tx_rx_aggregation_size tx_rx_aggregation_size; + struct sir_set_tx_aggr_sw_retry_threshold tx_aggr_sw_retry_threshold; void *soc = cds_get_context(QDF_MODULE_ID_SOC); WMA_LOGD("mac %pM, vdev_id %hu, type %d, sub_type %d, nss 2g %d, 5g %d", @@ -2306,6 +2307,17 @@ struct cdp_vdev *wma_vdev_attach(tp_wma_handle wma_handle, tx_rx_aggregation_size.tx_aggregation_size_vo = self_sta_req->tx_aggregation_size_vo; + tx_aggr_sw_retry_threshold.tx_aggr_sw_retry_threshold_be = + self_sta_req->tx_aggr_sw_retry_threshold_be; + tx_aggr_sw_retry_threshold.tx_aggr_sw_retry_threshold_bk = + self_sta_req->tx_aggr_sw_retry_threshold_bk; + tx_aggr_sw_retry_threshold.tx_aggr_sw_retry_threshold_vi = + self_sta_req->tx_aggr_sw_retry_threshold_vi; + tx_aggr_sw_retry_threshold.tx_aggr_sw_retry_threshold_vo = + self_sta_req->tx_aggr_sw_retry_threshold_vo; + tx_aggr_sw_retry_threshold.vdev_id = self_sta_req->session_id; + + switch (self_sta_req->type) { case WMI_VDEV_TYPE_STA: status = wma_set_tx_rx_aggregation_size_per_ac( @@ -2331,6 +2343,12 @@ struct cdp_vdev *wma_vdev_attach(tp_wma_handle wma_handle, wma_set_sta_sa_query_param(wma_handle, self_sta_req->session_id); } + + status = wma_set_sw_retry_threshold( + &tx_aggr_sw_retry_threshold); + if (status != QDF_STATUS_SUCCESS) + WMA_LOGE("failed to set retry threshold(err=%d)", + status); break; } diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 85d789d9ec3f..3bef9ab7d87f 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -4670,6 +4670,82 @@ QDF_STATUS wma_set_tx_rx_aggregation_size_per_ac( return QDF_STATUS_SUCCESS; } +QDF_STATUS wma_set_sw_retry_threshold( + struct sir_set_tx_aggr_sw_retry_threshold *tx_sw_retry_threshold) +{ + tp_wma_handle wma_handle; + wmi_vdev_set_custom_sw_retry_th_cmd_fixed_param *cmd; + int32_t len; + wmi_buf_t buf; + u_int8_t *buf_ptr; + int ret; + int queue_num; + uint32_t tx_aggr_retry[WMI_AC_MAX]; + + wma_handle = cds_get_context(QDF_MODULE_ID_WMA); + + if (!tx_sw_retry_threshold) { + WMA_LOGE("%s: invalid pointer", __func__); + return QDF_STATUS_E_INVAL; + } + + if (!wma_handle) { + WMA_LOGE("%s: WMA context is invald!", __func__); + return QDF_STATUS_E_INVAL; + } + + tx_aggr_retry[0] = + tx_sw_retry_threshold->tx_aggr_sw_retry_threshold_be; + tx_aggr_retry[1] = + tx_sw_retry_threshold->tx_aggr_sw_retry_threshold_bk; + tx_aggr_retry[2] = + tx_sw_retry_threshold->tx_aggr_sw_retry_threshold_vi; + tx_aggr_retry[3] = + tx_sw_retry_threshold->tx_aggr_sw_retry_threshold_vo; + + for (queue_num = 0; queue_num < WMI_AC_MAX; queue_num++) { + if (tx_aggr_retry[queue_num] == 0) + continue; + + len = sizeof(*cmd); + buf = wmi_buf_alloc(wma_handle->wmi_handle, len); + + if (!buf) { + WMA_LOGE("%s: Failed allocate wmi buffer", __func__); + return QDF_STATUS_E_NOMEM; + } + + buf_ptr = (u_int8_t *)wmi_buf_data(buf); + cmd = + (wmi_vdev_set_custom_sw_retry_th_cmd_fixed_param *)buf_ptr; + + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_vdev_set_custom_sw_retry_th_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + wmi_vdev_set_custom_sw_retry_th_cmd_fixed_param)); + + cmd->vdev_id = tx_sw_retry_threshold->vdev_id; + cmd->ac_type = queue_num; + cmd->sw_retry_type = WMI_VDEV_CUSTOM_SW_RETRY_TYPE_AGGR; + cmd->sw_retry_th = tx_aggr_retry[queue_num]; + + WMA_LOGD("queue: %d type: %d threshold: %d vdev: %d", + queue_num, cmd->sw_retry_type, + cmd->sw_retry_th, cmd->vdev_id); + + ret = wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len, + WMI_VDEV_SET_CUSTOM_SW_RETRY_TH_CMDID); + if (ret) { + WMA_LOGE("%s: Failed to send retry threshold command", + __func__); + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; + } + } + + return QDF_STATUS_SUCCESS; +} + /** * wma_p2p_lo_start() - P2P listen offload start * @params: p2p listen offload parameters