Browse Source

qcacld-3.0: Add INI support to disable STA roaming

Use INI "sta_disable_roam" to disable roaming on STA interface if
connection on other interfaces ex. p2p, ndp comes up. Each bit of
the INI "sta_disable_roam" represents an interface.
ex. LFR3_STA_ROAM_DISABLE_BY_P2P BIT(0)
    LFR3_STA_ROAM_DISABLE_BY_NAN BIT(1)

As INI "sta_disable_roam" is generic for all the interfaces, cleanup
for INI "p2p_disable_roam" done.

Change-Id: Icd05a97c640ca07978d9960a33de036ed6fe38df
CRs-Fixed: 2637555
Abhishek Ambure 5 years ago
parent
commit
48b790c62d

+ 3 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -1322,6 +1322,7 @@ struct policy_mgr_sme_cbacks {
  * progress
  * @wlan_hdd_set_sap_csa_reason: Set the sap csa reason in cases like NAN.
  * @hdd_get_ap_6ghz_capable: get ap vdev 6ghz capable info from hdd ap adapter.
+ * @wlan_hdd_indicate_active_ndp_cnt: indicate active ndp cnt to hdd
  */
 struct policy_mgr_hdd_cbacks {
 	void (*sap_restart_chan_switch_cb)(struct wlan_objmgr_psoc *psoc,
@@ -1342,6 +1343,8 @@ struct policy_mgr_hdd_cbacks {
 					    uint8_t vdev_id, uint8_t reason);
 	uint32_t (*hdd_get_ap_6ghz_capable)(struct wlan_objmgr_psoc *psoc,
 					    uint8_t vdev_id);
+	void (*wlan_hdd_indicate_active_ndp_cnt)(struct wlan_objmgr_psoc *psoc,
+						 uint8_t vdev_id, uint8_t cnt);
 };
 
 

+ 14 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -1645,12 +1645,19 @@ void policy_mgr_incr_active_session(struct wlan_objmgr_psoc *psoc,
 	case QDF_SAP_MODE:
 	case QDF_IBSS_MODE:
 	case QDF_NAN_DISC_MODE:
+	case QDF_NDI_MODE:
 		pm_ctx->no_of_active_sessions[mode]++;
 		break;
 	default:
 		break;
 	}
 
+	if (mode == QDF_NDI_MODE &&
+	    pm_ctx->hdd_cbacks.wlan_hdd_indicate_active_ndp_cnt)
+		pm_ctx->hdd_cbacks.wlan_hdd_indicate_active_ndp_cnt(
+				psoc, session_id,
+				pm_ctx->no_of_active_sessions[mode]);
+
 	if (mode != QDF_NAN_DISC_MODE && pm_ctx->dp_cbacks.hdd_v2_flow_pool_map)
 		pm_ctx->dp_cbacks.hdd_v2_flow_pool_map(session_id);
 	if (mode == QDF_SAP_MODE)
@@ -1736,6 +1743,7 @@ QDF_STATUS policy_mgr_decr_active_session(struct wlan_objmgr_psoc *psoc,
 	case QDF_SAP_MODE:
 	case QDF_IBSS_MODE:
 	case QDF_NAN_DISC_MODE:
+	case QDF_NDI_MODE:
 		if (pm_ctx->no_of_active_sessions[mode])
 			pm_ctx->no_of_active_sessions[mode]--;
 		break;
@@ -1747,6 +1755,12 @@ QDF_STATUS policy_mgr_decr_active_session(struct wlan_objmgr_psoc *psoc,
 	    pm_ctx->dp_cbacks.hdd_v2_flow_pool_unmap)
 		pm_ctx->dp_cbacks.hdd_v2_flow_pool_unmap(session_id);
 
+	if (mode == QDF_NDI_MODE &&
+	    pm_ctx->hdd_cbacks.wlan_hdd_indicate_active_ndp_cnt)
+		pm_ctx->hdd_cbacks.wlan_hdd_indicate_active_ndp_cnt(
+				psoc, session_id,
+				pm_ctx->no_of_active_sessions[mode]);
+
 	policy_mgr_debug("No.# of active sessions for mode %d = %d",
 		mode, pm_ctx->no_of_active_sessions[mode]);
 

+ 2 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c

@@ -667,6 +667,8 @@ QDF_STATUS policy_mgr_register_hdd_cb(struct wlan_objmgr_psoc *psoc,
 		hdd_cbacks->hdd_is_cac_in_progress;
 	pm_ctx->hdd_cbacks.hdd_get_ap_6ghz_capable =
 		hdd_cbacks->hdd_get_ap_6ghz_capable;
+	pm_ctx->hdd_cbacks.wlan_hdd_indicate_active_ndp_cnt =
+		hdd_cbacks->wlan_hdd_indicate_active_ndp_cnt;
 
 	return QDF_STATUS_SUCCESS;
 }

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

@@ -1480,6 +1480,7 @@ static void mlme_init_roam_offload_cfg(struct wlan_objmgr_psoc *psoc,
 	lfr->roam_trigger_bitmap =
 		cfg_get(psoc, CFG_ROAM_TRIGGER_BITMAP);
 	lfr->idle_roam_band = cfg_get(psoc, CFG_LFR_IDLE_ROAM_BAND);
+	lfr->sta_roam_disable = cfg_get(psoc, CFG_STA_DISABLE_ROAM);
 	mlme_init_sae_single_pmk_cfg(psoc, lfr);
 }
 

+ 32 - 0
components/mlme/dispatcher/inc/cfg_mlme_lfr.h

@@ -2381,6 +2381,37 @@
 			CFG_VALUE_OR_DEFAULT, \
 			"Bitmap of roaming triggers")
 
+/*
+ * <ini>
+ * sta_disable_roam - Disable Roam on sta interface
+ * @Min: 0 - Roam Enabled on sta interface
+ * @Max: 0xffffffff - Roam Disabled on sta interface irrespective
+ * of other interface connections
+ * @Default: 0x00
+ *
+ * Disable roaming on STA iface to avoid audio glitches on p2p and ndp if
+ * those are in connected state. Each bit for "sta_disable_roam" INI represents
+ * an interface for which sta roaming can be disabled.
+ *
+ * LFR3_STA_ROAM_DISABLE_BY_P2P BIT(0)
+ * LFR3_STA_ROAM_DISABLE_BY_NAN BIT(1)
+ *
+ * Related: None.
+ *
+ * Supported Feature: ROAM
+ *
+ * Usage: Internal
+ *
+ * </ini>
+ */
+#define CFG_STA_DISABLE_ROAM CFG_INI_INT( \
+		"sta_disable_roam", \
+		0, \
+		0xffffffff, \
+		0x00, \
+		CFG_VALUE_OR_DEFAULT, \
+		"disable roam on STA iface if one of the iface mentioned in default is in connected state")
+
 #define ROAM_OFFLOAD_ALL \
 	CFG(CFG_LFR3_ROAMING_OFFLOAD) \
 	CFG(CFG_LFR_ENABLE_DISCONNECT_ROAM) \
@@ -2391,6 +2422,7 @@
 	CFG(CFG_LFR_IDLE_ROAM_MIN_RSSI) \
 	CFG(CFG_LFR_IDLE_ROAM_BAND) \
 	CFG(CFG_ROAM_TRIGGER_BITMAP) \
+	CFG(CFG_STA_DISABLE_ROAM) \
 
 #else
 #define ROAM_OFFLOAD_ALL

+ 7 - 0
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -280,6 +280,7 @@ enum mlme_ts_info_ack_policy {
  * @RSO_CHANNEL_SWITCH: disable roaming due to STA channel switch
  * @RSO_CONNECT_START: disable roaming temporarily due to connect
  * @RSO_SAP_CHANNEL_CHANGE: disable roaming due to SAP channel change
+ * @RSO_NDP_CON_ON_NDI: disable roaming due to NDP connection on NDI
  */
 enum roam_control_requestor {
 	RSO_INVALID_REQUESTOR,
@@ -287,6 +288,7 @@ enum roam_control_requestor {
 	RSO_CHANNEL_SWITCH     = BIT(1),
 	RSO_CONNECT_START      = BIT(2),
 	RSO_SAP_CHANNEL_CHANGE = BIT(3),
+	RSO_NDP_CON_ON_NDI     = BIT(4),
 };
 
 /**
@@ -1424,6 +1426,9 @@ struct bss_load_trigger {
 #define AKM_SAE              3
 #define AKM_OWE              4
 
+#define LFR3_STA_ROAM_DISABLE_BY_P2P BIT(0)
+#define LFR3_STA_ROAM_DISABLE_BY_NAN BIT(1)
+
 /*
  * @mawc_roam_enabled:              Enable/Disable MAWC during roaming
  * @enable_fast_roam_in_concurrency:Enable LFR roaming on STA during concurrency
@@ -1441,6 +1446,7 @@ struct bss_load_trigger {
  * @enable_roam_reason_vsie:        Enable/disable incluison of roam reason
  * vsie in Re(assoc) frame
  * @roam_trigger_bitmap:            Bitmap of roaming triggers.
+ * @sta_roam_disable                STA roaming disabled by interfaces
  * @early_stop_scan_enable:         Set early stop scan
  * @enable_5g_band_pref:            Enable preference for 5G from INI
  * @ese_enabled:                    Enable ESE feature
@@ -1545,6 +1551,7 @@ struct wlan_mlme_lfr_cfg {
 	int32_t idle_roam_min_rssi;
 	bool enable_roam_reason_vsie;
 	uint32_t roam_trigger_bitmap;
+	uint32_t sta_roam_disable;
 #endif
 	bool early_stop_scan_enable;
 	bool enable_5g_band_pref;

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

@@ -1026,6 +1026,17 @@ QDF_STATUS
 ucfg_mlme_is_override_ht20_40_24g(struct wlan_objmgr_psoc *psoc, bool *val);
 
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
+/**
+ * ucfg_mlme_get_roam_disable_config() - Get sta roam disable value
+ * @psoc: pointer to psoc object
+ * @val:  Pointer to bitmap of interfaces for those sta roaming is disabled
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_get_roam_disable_config(struct wlan_objmgr_psoc *psoc,
+				  uint32_t *val);
+
 /**
  * ucfg_mlme_get_roaming_offload() - Get roaming offload setting
  * @psoc: pointer to psoc object
@@ -1061,6 +1072,13 @@ ucfg_mlme_get_roaming_triggers(struct wlan_objmgr_psoc *psoc)
 	return wlan_mlme_get_roaming_triggers(psoc);
 }
 #else
+static inline QDF_STATUS
+ucfg_mlme_get_roam_disable_config(struct wlan_objmgr_psoc *psoc,
+				  uint32_t *val)
+{
+	return QDF_STATUS_E_FAILURE;
+}
+
 static inline QDF_STATUS
 ucfg_mlme_get_roaming_offload(struct wlan_objmgr_psoc *psoc,
 			      bool *val)

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

@@ -752,6 +752,23 @@ ucfg_mlme_is_override_ht20_40_24g(struct wlan_objmgr_psoc *psoc, bool *val)
 }
 
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
+QDF_STATUS
+ucfg_mlme_get_roam_disable_config(struct wlan_objmgr_psoc *psoc,
+				  uint32_t *val)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+	if (!mlme_obj) {
+		*val = cfg_default(CFG_STA_DISABLE_ROAM);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = mlme_obj->cfg.lfr.sta_roam_disable;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS
 ucfg_mlme_get_roaming_offload(struct wlan_objmgr_psoc *psoc,
 			      bool *val)

+ 14 - 0
components/nan/dispatcher/inc/cfg_nan_api.h

@@ -83,7 +83,21 @@ QDF_STATUS cfg_nan_get_ndp_keepalive_period(struct wlan_objmgr_psoc *psoc,
  */
 bool cfg_nan_get_support_mp0_discovery(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * cfg_nan_is_roam_config_disabled() - get value of nan config roam disable
+ * discovery
+ * @psoc: pointer to psoc object
+ *
+ * Return: true on sta roam disable by nan else false
+ */
+bool cfg_nan_is_roam_config_disabled(struct wlan_objmgr_psoc *psoc);
 #else
+static inline
+bool cfg_nan_is_roam_config_disabled(struct wlan_objmgr_psoc *psoc)
+{
+	return false;
+}
+
 static inline bool cfg_nan_get_enable(struct wlan_objmgr_psoc *psoc)
 {
 	return false;

+ 11 - 0
components/nan/dispatcher/src/cfg_nan.c

@@ -23,6 +23,7 @@
 #include "wlan_objmgr_psoc_obj.h"
 #include "cfg_nan_api.h"
 #include "../../core/src/nan_main_i.h"
+#include "wlan_mlme_ucfg_api.h"
 
 static inline struct nan_psoc_priv_obj
 		 *cfg_nan_get_priv_obj(struct wlan_objmgr_psoc *psoc)
@@ -107,3 +108,13 @@ bool cfg_nan_get_support_mp0_discovery(struct wlan_objmgr_psoc *psoc)
 	return nan_obj->cfg_param.support_mp0_discovery;
 }
 
+bool cfg_nan_is_roam_config_disabled(struct wlan_objmgr_psoc *psoc)
+{
+	uint32_t sta_roam_disable;
+
+	if (ucfg_mlme_get_roam_disable_config(psoc, &sta_roam_disable) ==
+	    QDF_STATUS_SUCCESS)
+		return sta_roam_disable & LFR3_STA_ROAM_DISABLE_BY_NAN;
+
+	return false;
+}

+ 0 - 2
components/p2p/core/src/wlan_p2p_main.c

@@ -552,8 +552,6 @@ static QDF_STATUS p2p_object_init_params(
 			cfg_get(psoc, CFG_GO_LINK_MONITOR_PERIOD);
 	p2p_soc_obj->param.p2p_device_addr_admin =
 			cfg_get(psoc, CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED);
-	p2p_soc_obj->param.p2p_disable_roam =
-			cfg_get(psoc, CFG_P2P_DISABLE_ROAM);
 	return QDF_STATUS_SUCCESS;
 }
 

+ 0 - 3
components/p2p/core/src/wlan_p2p_main.h

@@ -198,14 +198,11 @@ enum p2p_connection_status {
  * @p2p_device_addr_admin:          enable/disable to derive the P2P
  *                                  MAC address from the primary MAC address
  * @skip_dfs_channel_p2p_search:    skip DFS Channel in case of P2P Search
- * @p2p_disable_roam:               Disable Roam on sta interface during P2P
- *                                  connection
  */
 struct p2p_param {
 	uint32_t go_keepalive_period;
 	uint32_t go_link_monitor_period;
 	bool p2p_device_addr_admin;
-	bool p2p_disable_roam;
 };
 
 /**

+ 1 - 24
components/p2p/dispatcher/inc/wlan_p2p_cfg.h

@@ -98,32 +98,9 @@
 	1, \
 	"derive the P2P MAC address from the primary MAC address")
 
-/*
- * <ini>
- * p2p_disable_roam - Disable Roam on sta interface during P2P connection
- * @Min: 0 - Roam Enabled on sta interface during P2P connection
- * @Max: 1 - Roam Disabled on sta interface during P2P connection
- * @Default: 0
- *
- * Disable roaming on STA iface to avoid audio glitches on p2p if its connected
- *
- * Related: None.
- *
- * Supported Feature: Disable Roam during P2P
- *
- * Usage: Internal
- *
- * </ini>
- */
-#define CFG_P2P_DISABLE_ROAM CFG_INI_BOOL( \
-		"p2p_disable_roam", \
-		0, \
-		"disable roam on STA iface if p2p is connected")
-
 #define CFG_P2P_ALL \
 	CFG(CFG_GO_KEEP_ALIVE_PERIOD) \
 	CFG(CFG_GO_LINK_MONITOR_PERIOD) \
-	CFG(CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED) \
-	CFG(CFG_P2P_DISABLE_ROAM)
+	CFG(CFG_P2P_DEVICE_ADDRESS_ADMINISTRATED)
 
 #endif

+ 6 - 7
components/p2p/dispatcher/src/wlan_p2p_cfg.c

@@ -24,6 +24,7 @@
 #include "wlan_p2p_public_struct.h"
 #include "wlan_p2p_cfg_api.h"
 #include "../../core/src/wlan_p2p_main.h"
+#include "wlan_mlme_ucfg_api.h"
 
 static inline struct p2p_soc_priv_obj *
 wlan_psoc_get_p2p_object(struct wlan_objmgr_psoc *psoc)
@@ -88,13 +89,11 @@ cfg_p2p_get_device_addr_admin(struct wlan_objmgr_psoc *psoc,
 
 bool cfg_p2p_is_roam_config_disabled(struct wlan_objmgr_psoc *psoc)
 {
-	struct p2p_soc_priv_obj *p2p_soc_obj;
+	uint32_t sta_roam_disable = 0;
 
-	p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
-	if (!p2p_soc_obj) {
-		p2p_err("p2p psoc null");
-		return false;
-	}
+	if (ucfg_mlme_get_roam_disable_config(psoc, &sta_roam_disable) ==
+	    QDF_STATUS_SUCCESS)
+		return sta_roam_disable & LFR3_STA_ROAM_DISABLE_BY_P2P;
 
-	return p2p_soc_obj->param.p2p_disable_roam;
+	return false;
 }

+ 15 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -2713,11 +2713,25 @@ bool hdd_is_5g_supported(struct hdd_context *hdd_ctx);
  *
  * Return:  true if 2GHz channels are supported
  */
-
 bool hdd_is_2g_supported(struct hdd_context *hdd_ctx);
 
 int wlan_hdd_scan_abort(struct hdd_adapter *adapter);
 
+/**
+ * hdd_indicate_active_ndp_cnt() - Callback to indicate active ndp count to hdd
+ * if ndp connection is on NDI established
+ * @psoc: pointer to psoc object
+ * @vdev_id: vdev id
+ * @cnt: number of active ndp sessions
+ *
+ * This HDD callback registerd with policy manager to indicates number of active
+ * ndp sessions to hdd.
+ *
+ * Return:  none
+ */
+void hdd_indicate_active_ndp_cnt(struct wlan_objmgr_psoc *psoc,
+				 uint8_t vdev_id, uint8_t cnt);
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
 {

+ 17 - 0
core/hdd/src/wlan_hdd_main.c

@@ -1541,6 +1541,21 @@ static int hdd_update_tdls_config(struct hdd_context *hdd_ctx)
 }
 #endif
 
+void hdd_indicate_active_ndp_cnt(struct wlan_objmgr_psoc *psoc,
+				 uint8_t vdev_id, uint8_t cnt)
+{
+	struct hdd_adapter *adapter = NULL;
+
+	adapter = wlan_hdd_get_adapter_from_vdev(psoc, vdev_id);
+	if (adapter && cfg_nan_is_roam_config_disabled(psoc)) {
+		hdd_debug("vdev_id:%d ndp active sessions %d", vdev_id, cnt);
+		if (!cnt)
+			wlan_hdd_enable_roaming(adapter, RSO_NDP_CON_ON_NDI);
+		else
+			wlan_hdd_disable_roaming(adapter, RSO_NDP_CON_ON_NDI);
+	}
+}
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 static void hdd_update_roam_offload(struct hdd_context *hdd_ctx,
 				    struct wma_tgt_services *cfg)
@@ -3183,6 +3198,8 @@ static void hdd_register_policy_manager_callback(
 	hdd_cbacks.wlan_hdd_set_sap_csa_reason =
 				wlan_hdd_set_sap_csa_reason;
 	hdd_cbacks.hdd_get_ap_6ghz_capable = hdd_get_ap_6ghz_capable;
+	hdd_cbacks.wlan_hdd_indicate_active_ndp_cnt =
+				hdd_indicate_active_ndp_cnt;
 
 	if (QDF_STATUS_SUCCESS !=
 	    policy_mgr_register_hdd_cb(psoc, &hdd_cbacks)) {