From 451c68c41a55ff1ccb66a5171b5904066adf42f0 Mon Sep 17 00:00:00 2001 From: sheenam monga Date: Wed, 11 Dec 2019 20:00:17 +0530 Subject: [PATCH] qcacld-3.0: Add ini support to configure MGMT retry limit Currently, default MGMT retry limit is 4 which means 4 transmissions are supported for any management frame. In noisy environment, Chances to get connection failure are higher with 4 retransmissions. Fix is to add INI support mgmt_retry_max to make CFG_MGMT_RETRY_MAX configurable. Default value for CFG_MGMT_RETRY_MAX is 15 to reduce the chances of connection failure in noisy environment. Change-Id: Id50cb68813fba517a8a1580a3d6662c73b0a381e CRs-Fixed: 2575385 --- components/mlme/core/src/wlan_mlme_main.c | 1 + .../mlme/dispatcher/inc/cfg_mlme_generic.h | 24 +++++++++++++++++++ .../mlme/dispatcher/inc/wlan_mlme_api.h | 12 ++++++++++ .../dispatcher/inc/wlan_mlme_public_struct.h | 2 ++ .../mlme/dispatcher/src/wlan_mlme_api.c | 17 +++++++++++++ core/hdd/src/wlan_hdd_cfg80211.c | 6 +++-- core/hdd/src/wlan_hdd_cfg80211.h | 1 - core/hdd/src/wlan_hdd_main.c | 9 +++++++ 8 files changed, 69 insertions(+), 3 deletions(-) diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index fa4bc1a4c0..f27d43acca 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -354,6 +354,7 @@ static void mlme_init_generic_cfg(struct wlan_objmgr_psoc *psoc, cfg_get(psoc, CFG_REMOVE_TIME_STAMP_SYNC_CMD); gen->disable_4way_hs_offload = cfg_get(psoc, CFG_DISABLE_4WAY_HS_OFFLOAD); + gen->mgmt_retry_max = cfg_get(psoc, CFG_MGMT_RETRY_MAX); } static void mlme_init_edca_ani_cfg(struct wlan_mlme_edca_params *edca_params) diff --git a/components/mlme/dispatcher/inc/cfg_mlme_generic.h b/components/mlme/dispatcher/inc/cfg_mlme_generic.h index 16f427fa5c..3f16ba695a 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_generic.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_generic.h @@ -617,6 +617,29 @@ 0, \ "Enable/disable 4 way handshake offload to firmware") +/* + * + * mgmt_retry_max - Maximum Retries for mgmt frames + * @Min: 0 + * @Max: 31 + * @Default: 15 + * + * This ini is used to set maximum retries for mgmt frames + * + * Supported Feature: STA/SAP + * + * Usage: External + * + * + */ +#define CFG_MGMT_RETRY_MAX CFG_INI_UINT( \ + "mgmt_retry_max", \ + 0, \ + 31, \ + 15, \ + CFG_VALUE_OR_DEFAULT, \ + "Max retries for mgmt frames") + #define CFG_GENERIC_ALL \ CFG(CFG_ENABLE_DEBUG_PACKET_LOG) \ CFG(CFG_PMF_SA_QUERY_MAX_RETRIES) \ @@ -644,5 +667,6 @@ CFG(CFG_ITO_REPEAT_COUNT) \ CFG(CFG_ENABLE_BEACON_RECEPTION_STATS) \ CFG(CFG_REMOVE_TIME_STAMP_SYNC_CMD) \ + CFG(CFG_MGMT_RETRY_MAX) \ #endif /* __CFG_MLME_GENERIC_H */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 8df140b209..d23244d5ca 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -2295,4 +2295,16 @@ char *mlme_get_roam_fail_reason_str(uint32_t result); * Return: Meaningful string from enum WMI_ROAM_TRIGGER_SUB_REASON_ID */ char *mlme_get_sub_reason_str(uint32_t sub_reason); + +/** + * wlan_mlme_get_mgmt_max_retry() - Get the + * max mgmt retry + * @psoc: pointer to psoc object + * @max_retry: output pointer to hold user config + * + * Return: QDF Status + */ +QDF_STATUS +wlan_mlme_get_mgmt_max_retry(struct wlan_objmgr_psoc *psoc, + uint8_t *max_retry); #endif /* _WLAN_MLME_API_H_ */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index 278574f667..1b704fa324 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -1120,6 +1120,7 @@ struct wlan_mlme_chainmask { * mode * @disable_4way_hs_offload: enable/disable 4 way handshake offload to firmware * @as_enabled: antenna sharing enabled or not (FW capability) + * @mgmt_retry_max: maximum retries for management frame */ struct wlan_mlme_generic { enum band_info band_capability; @@ -1151,6 +1152,7 @@ struct wlan_mlme_generic { bool data_stall_recovery_fw_support; bool disable_4way_hs_offload; bool as_enabled; + uint8_t mgmt_retry_max; }; /* diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 4ad779e27a..af725ae5c4 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -3645,3 +3645,20 @@ char *mlme_get_sub_reason_str(uint32_t sub_reason) return "NONE"; } } + +QDF_STATUS +wlan_mlme_get_mgmt_max_retry(struct wlan_objmgr_psoc *psoc, + uint8_t *max_retry) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + + if (!mlme_obj) { + *max_retry = cfg_default(CFG_MGMT_RETRY_MAX); + return QDF_STATUS_E_FAILURE; + } + + *max_retry = mlme_obj->cfg.gen.mgmt_retry_max; + return QDF_STATUS_SUCCESS; +} diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index a09fa117f7..8bd352aa4f 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -7087,10 +7087,12 @@ static int hdd_config_mgmt_retry(struct hdd_adapter *adapter, { uint8_t retry; int param_id; + uint8_t max_mgmt_retry; retry = nla_get_u8(attr); - retry = retry > CFG_MGMT_RETRY_MAX ? - CFG_MGMT_RETRY_MAX : retry; + max_mgmt_retry = (cfg_max(CFG_MGMT_RETRY_MAX)); + retry = retry > max_mgmt_retry ? + max_mgmt_retry : retry; param_id = WMI_PDEV_PARAM_MGMT_RETRY_LIMIT; return wma_cli_set_command(adapter->vdev_id, param_id, diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index bcae6eb7a9..e646eb450b 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -213,7 +213,6 @@ typedef enum { #define CFG_NON_AGG_RETRY_MAX (31) #define CFG_AGG_RETRY_MAX (31) -#define CFG_MGMT_RETRY_MAX (31) #define CFG_CTRL_RETRY_MAX (31) #define CFG_PROPAGATION_DELAY_MAX (63) #define CFG_PROPAGATION_DELAY_BASE (64) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 154f75e700..d2be899329 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -11353,6 +11353,7 @@ static int hdd_pre_enable_configure(struct hdd_context *hdd_ctx) { int ret; uint8_t val = 0; + uint8_t max_retry = 0; QDF_STATUS status; void *soc = cds_get_context(QDF_MODULE_ID_SOC); @@ -11395,6 +11396,14 @@ static int hdd_pre_enable_configure(struct hdd_context *hdd_ctx) goto out; } + wlan_mlme_get_mgmt_max_retry(hdd_ctx->psoc, &max_retry); + ret = sme_cli_set_command(0, WMI_PDEV_PARAM_MGMT_RETRY_LIMIT, max_retry, + PDEV_CMD); + if (0 != ret) { + hdd_err("WMI_PDEV_PARAM_MGMT_RETRY_LIMIT failed %d", ret); + goto out; + } + ret = hdd_set_smart_chainmask_enabled(hdd_ctx); if (ret) goto out;