Browse Source

qcacld-3.0: Add ini support to prefer user coex unsafe freq list

Currently coex unsafe freq event is honored from firmware using
"wmi_wlan_freq_avoid_event_id".

As per requirement, add ini to don't honor coex unsafe freq
event from firmware and use the coex unsafe freq list from
vendor QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_EXT.

Change-Id: Ia3acbc133cab4865d8ad69992e893be91439f705
CRs-Fixed: 3114742
Balaji Pothunoori 3 năm trước cách đây
mục cha
commit
abc80f8a60

+ 16 - 1
components/mlme/core/src/wlan_mlme_main.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -2320,6 +2320,20 @@ static void mlme_init_acs_avoid_freq_list(struct wlan_objmgr_psoc *psoc,
 }
 #endif
 
+#ifdef FEATURE_WLAN_CH_AVOID_EXT
+static void mlme_init_unsafe_coex_cfg(struct wlan_objmgr_psoc *psoc,
+				      struct wlan_mlme_reg *reg)
+{
+	reg->coex_unsafe_chan_nb_user_prefer =
+		cfg_get(psoc, CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER);
+}
+#else
+static void mlme_init_unsafe_coex_cfg(struct wlan_objmgr_psoc *psoc,
+				      struct wlan_mlme_reg *reg)
+{
+}
+#endif
+
 static void mlme_init_reg_cfg(struct wlan_objmgr_psoc *psoc,
 			      struct wlan_mlme_reg *reg)
 {
@@ -2346,6 +2360,7 @@ static void mlme_init_reg_cfg(struct wlan_objmgr_psoc *psoc,
 		cfg_get(psoc, CFG_INDOOR_CHANNEL_SUPPORT_FOR_NAN);
 
 	mlme_init_acs_avoid_freq_list(psoc, reg);
+	mlme_init_unsafe_coex_cfg(psoc, reg);
 }
 
 static void

+ 27 - 0
components/mlme/dispatcher/inc/cfg_mlme_reg.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -333,7 +334,33 @@
 		1, \
 		"Retain NOL even if the regdomain changes")
 
+#ifdef FEATURE_WLAN_CH_AVOID_EXT
+/*
+ * <ini>
+ * coex_unsafe_chan_nb_user_prefer- Used to handle coex unsafe freq
+ * event
+ *
+ * @Min: 0 (Honor Firmware event)
+ * @Max: 1 (Don't honor Firmware event)
+ * Default: 0
+ *
+ * This ini is used to handle coex unsafe freq event
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER  CFG_INI_BOOL( \
+		"coex_unsafe_chan_nb_user_prefer", \
+		0, \
+		"Honor coex unsafe freq event from firmware")
+#define CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER_ALL \
+	CFG(CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER)
+#else
+#define CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER_ALL
+#endif
+
 #define CFG_REG_ALL \
+	CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER_ALL \
 	CFG(CFG_SELF_GEN_FRM_PWR) \
 	CFG(CFG_ENABLE_PENDING_CHAN_LIST_REQ) \
 	CFG(CFG_ENABLE_11D_IN_WORLD_MODE) \

+ 6 - 1
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -2449,6 +2449,8 @@ enum mlme_reg_srd_master_modes {
  * list command to FW till the current scan is complete.
  * @retain_nol_across_regdmn_update: Retain the NOL list across the regdomain.
  * @enable_nan_on_indoor_channels: Enable nan on Indoor channels
+ * @coex_unsafe_chan_nb_user_prefer: Honor coex unsafe freq event from firmware
+ * or not
  */
 struct wlan_mlme_reg {
 	uint32_t self_gen_frm_pwr;
@@ -2469,6 +2471,9 @@ struct wlan_mlme_reg {
 	bool enable_pending_chan_list_req;
 	bool retain_nol_across_regdmn_update;
 	bool enable_nan_on_indoor_channels;
+#ifdef FEATURE_WLAN_CH_AVOID_EXT
+	bool coex_unsafe_chan_nb_user_prefer;
+#endif
 };
 
 #define IOT_AGGR_INFO_MAX_NUM 32

+ 21 - 0
components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -4378,4 +4379,24 @@ ucfg_mlme_cfg_get_ht_smps(struct wlan_objmgr_psoc *psoc,
 {
 	return wlan_mlme_cfg_get_ht_smps(psoc, value);
 }
+
+#ifdef FEATURE_WLAN_CH_AVOID_EXT
+/**
+ * ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer() - get coex unsafe nb
+ * support
+ * @psoc:   pointer to psoc object
+ * @value:  pointer to the value which will be filled for the caller
+ *
+ * Return: coex_unsafe_chan_nb_user_prefer
+ */
+bool ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer(
+		struct wlan_objmgr_psoc *psoc);
+#else
+static inline
+bool ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer(
+		struct wlan_objmgr_psoc *psoc)
+{
+	return false;
+}
+#endif
 #endif /* _WLAN_MLME_UCFG_API_H_ */

+ 16 - 0
components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -1690,3 +1691,18 @@ bool ucfg_mlme_validate_scan_period(uint32_t roam_scan_period)
 
 	return is_valid;
 }
+
+#ifdef FEATURE_WLAN_CH_AVOID_EXT
+bool ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer(
+		struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+	if (!mlme_obj) {
+		mlme_legacy_err("Failed to get MLME Obj");
+		return cfg_default(CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER);
+	}
+	return mlme_obj->cfg.reg.coex_unsafe_chan_nb_user_prefer;
+}
+#endif

+ 29 - 1
core/hdd/src/wlan_hdd_regulatory.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -210,6 +210,33 @@ void hdd_reset_global_reg_params(void)
 	init_by_reg_core = false;
 }
 
+/**
+ * hdd_update_coex_unsafe_chan_nb_user_prefer() - update coex unsafe
+ * nb prefer framework
+ * @hdd_ctx: hdd context
+ * @config_vars: reg config
+ *
+ * Return: void
+ */
+#ifdef FEATURE_WLAN_CH_AVOID_EXT
+static inline
+void hdd_update_coex_unsafe_chan_nb_user_prefer(
+		struct hdd_context *hdd_ctx,
+		struct reg_config_vars *config_vars)
+{
+	config_vars->coex_unsafe_chan_nb_user_prefer =
+		ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer(
+		hdd_ctx->psoc);
+}
+#else
+static inline
+void hdd_update_coex_unsafe_chan_nb_user_prefer(
+		struct hdd_context *hdd_ctx,
+		struct reg_config_vars *config_vars)
+{
+}
+#endif
+
 static void reg_program_config_vars(struct hdd_context *hdd_ctx,
 				    struct reg_config_vars *config_vars)
 {
@@ -275,6 +302,7 @@ static void reg_program_config_vars(struct hdd_context *hdd_ctx,
 						    &enable_5dot9_ghz_chan);
 	config_vars->enable_5dot9_ghz_chan_in_master_mode =
 						enable_5dot9_ghz_chan;
+	hdd_update_coex_unsafe_chan_nb_user_prefer(hdd_ctx, config_vars);
 }
 
 /**