From 0d8ad29d86e336430622fd4e4639dca9b3ee472e Mon Sep 17 00:00:00 2001 From: Bapiraju Alla Date: Tue, 10 Nov 2020 14:41:27 +0530 Subject: [PATCH] qcacld-3.0: Add INI parameter to configure NAN in 6GHz Currently, there is no INI parameter to control NAN feature in 6GHz frequency band. Because of this, there is no provision to disable the NAN in 6GHz when there is no requirement. To address this, add INI parameter to configure NAN feature in 6GHz. Change-Id: I6b4faa8e8aa1a3df72539fed1d7ff3cc8287debd CRs-Fixed: 2817920 --- components/nan/core/inc/nan_public_structs.h | 2 ++ components/nan/core/src/nan_main_i.h | 2 ++ components/nan/dispatcher/inc/cfg_nan.h | 22 ++++++++++++++++++++ components/nan/dispatcher/inc/nan_ucfg_api.h | 15 +++++++++++++ components/nan/dispatcher/src/nan_ucfg_api.c | 13 ++++++++++++ os_if/nan/src/os_if_nan.c | 1 + 6 files changed, 55 insertions(+) diff --git a/components/nan/core/inc/nan_public_structs.h b/components/nan/core/inc/nan_public_structs.h index 33c9c34e1346..ce352cc23932 100644 --- a/components/nan/core/inc/nan_public_structs.h +++ b/components/nan/core/inc/nan_public_structs.h @@ -569,10 +569,12 @@ struct nan_disable_ind_msg { * @request_data_len: request data length * @request_data: request data * @rtt_cap: indicate if responder/initiator role is supported + * @disable_6g_nan: Disable NAN in 6Ghz */ struct nan_msg_params { uint16_t request_data_len; uint32_t rtt_cap; + bool disable_6g_nan; /* Variable length, do not add anything after this */ uint8_t request_data[]; }; diff --git a/components/nan/core/src/nan_main_i.h b/components/nan/core/src/nan_main_i.h index 478e3a663142..6b56621cd1a7 100644 --- a/components/nan/core/src/nan_main_i.h +++ b/components/nan/core/src/nan_main_i.h @@ -88,6 +88,7 @@ enum nan_disc_state { * @nan_feature_config: Bitmap to enable/disable a particular NAN feature * configuration in firmware. It's sent to firmware through * WMI_VDEV_PARAM_ENABLE_DISABLE_NAN_CONFIG_FEATURES + * @disable_6g_nan: Disable NAN in 6GHz frequency band */ struct nan_cfg_params { bool enable; @@ -100,6 +101,7 @@ struct nan_cfg_params { uint32_t max_ndp_sessions; uint32_t max_ndi; uint32_t nan_feature_config; + bool disable_6g_nan; }; /** diff --git a/components/nan/dispatcher/inc/cfg_nan.h b/components/nan/dispatcher/inc/cfg_nan.h index b88abcd7885b..2ac7241be3dc 100644 --- a/components/nan/dispatcher/inc/cfg_nan.h +++ b/components/nan/dispatcher/inc/cfg_nan.h @@ -271,8 +271,30 @@ CFG_VALUE_OR_DEFAULT, \ "Enable the specified NAN features in firmware") +/* + * + * disable_6g_nan - Disable NAN feature support in 6GHz + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * When set to 1 NAN feature will be disabled in 6GHz. + * + * Related: None + * + * Supported Feature: NAN + * + * Usage: External + * + * + */ +#define CFG_DISABLE_6G_NAN CFG_INI_BOOL("disable_6g_nan", \ + 0, \ + "Disable NAN Support in 6GHz") + #ifdef WLAN_FEATURE_NAN #define CFG_NAN_DISC CFG(CFG_NAN_ENABLE) \ + CFG(CFG_DISABLE_6G_NAN) \ CFG(CFG_NDP_KEEP_ALIVE_PERIOD) \ CFG(CFG_SUPPORT_MP0_DISCOVERY) #define CFG_NAN_DP CFG(CFG_NAN_DATAPATH_ENABLE) \ diff --git a/components/nan/dispatcher/inc/nan_ucfg_api.h b/components/nan/dispatcher/inc/nan_ucfg_api.h index bf876c840d7b..25075b300168 100644 --- a/components/nan/dispatcher/inc/nan_ucfg_api.h +++ b/components/nan/dispatcher/inc/nan_ucfg_api.h @@ -476,6 +476,16 @@ QDF_STATUS ucfg_nan_disable_ind_to_userspace(struct wlan_objmgr_psoc *psoc); * Return: True if NAN is allowed on the given frequency */ bool ucfg_is_nan_allowed_on_freq(struct wlan_objmgr_pdev *pdev, uint32_t freq); + +/** + * ucfg_get_disable_6g_nan() - Get NAN feature configuration for 6GHz + * @psoc: pointer to psoc object + * + * Return: Boolean flag indicating whether the NAN feature is disabled in + * 6GHz or not + */ +bool ucfg_get_disable_6g_nan(struct wlan_objmgr_psoc *psoc); + #else /* WLAN_FEATURE_NAN */ static inline @@ -595,5 +605,10 @@ bool ucfg_is_nan_allowed_on_freq(struct wlan_objmgr_pdev *pdev, uint32_t freq) { return false; } + +static inline bool ucfg_get_disable_6g_nan(struct wlan_objmgr_psoc *psoc) +{ + return true; +} #endif /* WLAN_FEATURE_NAN */ #endif /* _NAN_UCFG_API_H_ */ diff --git a/components/nan/dispatcher/src/nan_ucfg_api.c b/components/nan/dispatcher/src/nan_ucfg_api.c index dc7655f2218b..e1621b798b47 100644 --- a/components/nan/dispatcher/src/nan_ucfg_api.c +++ b/components/nan/dispatcher/src/nan_ucfg_api.c @@ -60,6 +60,7 @@ static void nan_cfg_init(struct wlan_objmgr_psoc *psoc, nan_obj->cfg_param.max_ndi = cfg_get(psoc, CFG_NDI_MAX_SUPPORT); nan_obj->cfg_param.nan_feature_config = cfg_get(psoc, CFG_NAN_FEATURE_CONFIG); + nan_obj->cfg_param.disable_6g_nan = cfg_get(psoc, CFG_DISABLE_6G_NAN); } /** @@ -94,6 +95,18 @@ static void nan_cfg_dp_init(struct wlan_objmgr_psoc *psoc, } #endif +bool ucfg_get_disable_6g_nan(struct wlan_objmgr_psoc *psoc) +{ + struct nan_psoc_priv_obj *nan_obj = nan_get_psoc_priv_obj(psoc); + + if (!nan_obj) { + nan_err("nan psoc priv object is NULL"); + return cfg_default(CFG_DISABLE_6G_NAN); + } + + return nan_obj->cfg_param.disable_6g_nan; +} + QDF_STATUS ucfg_nan_psoc_open(struct wlan_objmgr_psoc *psoc) { struct nan_psoc_priv_obj *nan_obj = nan_get_psoc_priv_obj(psoc); diff --git a/os_if/nan/src/os_if_nan.c b/os_if/nan/src/os_if_nan.c index 1924603e0d5c..49428797012a 100644 --- a/os_if/nan/src/os_if_nan.c +++ b/os_if/nan/src/os_if_nan.c @@ -2576,6 +2576,7 @@ static int os_if_process_nan_enable_req(struct wlan_objmgr_psoc *psoc, ucfg_mlme_get_fine_time_meas_cap(psoc, &fine_time_meas_cap); nan_req->params.rtt_cap = fine_time_meas_cap; + nan_req->params.disable_6g_nan = ucfg_get_disable_6g_nan(psoc); nla_memcpy(nan_req->params.request_data, tb[QCA_WLAN_VENDOR_ATTR_NAN_CMD_DATA], buf_len);