Ver código fonte

qcacld-3.0: Add ini for STA + Monitor mode

Add new ini "monitor_mode_concurrency" to support this feature
and introduce policy manager api's for concurrency checks.

Change-Id: I35ee1fece0a6f9ae8fe340b0598c4a3e20b17e82
CRs-Fixed: 2814523
Amruta Kulkarni 4 anos atrás
pai
commit
3d08c46bea

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

@@ -3650,4 +3650,22 @@ uint8_t policy_mgr_get_roam_enabled_sta_session_id(
 						struct wlan_objmgr_psoc *psoc,
 						uint8_t vdev_id);
 
+/**
+ * policy_mgr_is_sta_mon_concurrency() - check if MONITOR and STA concurrency
+ * is UP.
+ * @psoc: pointer to psoc object
+ *
+ * Return: True - if STA and monitor concurrency is there, else False
+ *
+ */
+bool policy_mgr_is_sta_mon_concurrency(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * policy_mgr_check_mon_concurrency() - Checks if monitor intf can be added.
+ * @psoc: pointer to psoc object
+ *
+ * Return: QDF_STATUS_SUCCESS if allowed, else send failure
+ *
+ */
+QDF_STATUS policy_mgr_check_mon_concurrency(struct wlan_objmgr_psoc *psoc);
 #endif /* __WLAN_POLICY_MGR_API_H */

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

@@ -4500,3 +4500,89 @@ uint8_t policy_mgr_get_roam_enabled_sta_session_id(
 
 	return WLAN_UMAC_VDEV_ID_MAX;
 }
+
+bool policy_mgr_is_sta_mon_concurrency(struct wlan_objmgr_psoc *psoc)
+{
+	uint32_t conc_mode;
+
+	if (wlan_mlme_is_sta_mon_conc_supported(psoc)) {
+		conc_mode = policy_mgr_get_concurrency_mode(psoc);
+		if (conc_mode & QDF_STA_MASK &&
+		    conc_mode & QDF_MONITOR_MASK) {
+			policy_mgr_err("STA + MON mode is UP");
+			return true;
+		}
+	}
+	return false;
+}
+
+QDF_STATUS policy_mgr_check_mon_concurrency(struct wlan_objmgr_psoc *psoc)
+{
+	uint8_t num_open_session = 0;
+
+	if (policy_mgr_mode_specific_num_open_sessions(
+				psoc,
+				QDF_MONITOR_MODE,
+				&num_open_session) != QDF_STATUS_SUCCESS)
+		return QDF_STATUS_E_INVAL;
+
+	if (num_open_session) {
+		policy_mgr_err("monitor mode already exists, only one is possible");
+		return QDF_STATUS_E_BUSY;
+	}
+
+	num_open_session = policy_mgr_mode_specific_connection_count(
+					psoc,
+					PM_SAP_MODE,
+					NULL);
+
+	if (num_open_session) {
+		policy_mgr_err("cannot add monitor mode, due to SAP concurrency");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	/* Ensure there is only one station interface */
+	if (policy_mgr_mode_specific_num_open_sessions(
+				psoc,
+				QDF_STA_MODE,
+				&num_open_session) != QDF_STATUS_SUCCESS)
+		return QDF_STATUS_E_INVAL;
+
+	if (num_open_session > 1) {
+		policy_mgr_err("cannot add monitor mode, due to %u sta interfaces",
+			       num_open_session);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	num_open_session = policy_mgr_mode_specific_connection_count(
+					psoc,
+					PM_P2P_CLIENT_MODE,
+					NULL);
+
+	if (num_open_session) {
+		policy_mgr_err("cannot add monitor mode, due to P2P CLIENT concurrency");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	num_open_session = policy_mgr_mode_specific_connection_count(
+					psoc,
+					PM_P2P_GO_MODE,
+					NULL);
+
+	if (num_open_session) {
+		policy_mgr_err("cannot add monitor mode, due to P2P GO concurrency");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	num_open_session = policy_mgr_mode_specific_connection_count(
+					psoc,
+					PM_NAN_DISC_MODE,
+					NULL);
+
+	if (num_open_session) {
+		policy_mgr_err("cannot add monitor mode, due to NAN concurrency");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}

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

@@ -410,6 +410,8 @@ static void mlme_init_generic_cfg(struct wlan_objmgr_psoc *psoc,
 		cfg_get(psoc, CFG_DFS_CHAN_AGEOUT_TIME);
 	gen->sae_connect_retries =
 		cfg_get(psoc, CFG_SAE_CONNECION_RETRIES);
+	gen->monitor_mode_concurrency =
+		cfg_get(psoc, CFG_MONITOR_MODE_CONCURRENCY);
 }
 
 static void mlme_init_edca_ani_cfg(struct wlan_mlme_edca_params *edca_params)

+ 41 - 1
components/mlme/dispatcher/inc/cfg_mlme_generic.h

@@ -31,6 +31,17 @@
 #define CFG_PMF_SA_QUERY_RETRY_INTERVAL_TYPE	CFG_UINT
 #endif /*WLAN_FEATURE_11W*/
 
+/**
+ * enum monitor_mode_concurrency - Monitor mode concurrency
+ * @MONITOR_MODE_CONC_NO_SUPPORT: No concurrency supported with monitor mode
+ * @MONITOR_MODE_CONC_STA_SCAN_MON: STA + monitor mode concurrency is supported
+ */
+enum monitor_mode_concurrency {
+	MONITOR_MODE_CONC_NO_SUPPORT,
+	MONITOR_MODE_CONC_STA_SCAN_MON,
+	MONITOR_MODE_CONC_AFTER_LAST,
+	MONITOR_MODE_CONC_MAX = MONITOR_MODE_CONC_AFTER_LAST - 1,
+};
 /*
  * pmfSaQueryMaxRetries - Control PMF SA query retries for SAP
  * @Min: 0
@@ -782,6 +793,34 @@
 	0, \
 	"WiFi Location Service(WLS) is 6Ghz capable or not")
 
+/*
+ * <ini>
+ *
+ * monitor_mode_conc - Monitor mode concurrency supported
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * Related: None
+ *
+ * Monitor mode concurrency supported
+ * 0 - No concurrency supported
+ * 1 - Allow STA scan + Monitor mode concurrency
+ *
+ * Supported Feature: General
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_MONITOR_MODE_CONCURRENCY CFG_INI_UINT( \
+	"monitor_mode_concurrency", \
+	MONITOR_MODE_CONC_NO_SUPPORT, \
+	MONITOR_MODE_CONC_MAX, \
+	MONITOR_MODE_CONC_NO_SUPPORT, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Monitor mode concurrency supported")
+
 #define CFG_GENERIC_ALL \
 	CFG(CFG_ENABLE_DEBUG_PACKET_LOG) \
 	CFG(CFG_PMF_SA_QUERY_MAX_RETRIES) \
@@ -814,5 +853,6 @@
 	CFG(CFG_ENABLE_RING_BUFFER) \
 	CFG(CFG_DFS_CHAN_AGEOUT_TIME) \
 	CFG(CFG_SAE_CONNECION_RETRIES) \
-	CFG(CFG_WLS_6GHZ_CAPABLE)
+	CFG(CFG_WLS_6GHZ_CAPABLE) \
+	CFG(CFG_MONITOR_MODE_CONCURRENCY)
 #endif /* __CFG_MLME_GENERIC_H */

+ 8 - 0
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -3029,4 +3029,12 @@ QDF_STATUS mlme_get_ext_opr_rate(struct wlan_objmgr_vdev *vdev, uint8_t *dst,
 QDF_STATUS mlme_set_ext_opr_rate(struct wlan_objmgr_vdev *vdev, uint8_t *src,
 				 qdf_size_t len);
 
+/**
+ * wlan_mlme_is_sta_mon_conc_supported() - Check if STA + Monitor mode
+ * concurrency is supported
+ * @psoc: pointer to psoc object
+ *
+ * Return: True if supported
+ */
+bool wlan_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc *psoc);
 #endif /* _WLAN_MLME_API_H_ */

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

@@ -28,6 +28,7 @@
 #include <wmi_unified_param.h>
 #include <sir_api.h>
 #include "wlan_cm_roam_public_struct.h"
+#include "cfg_mlme_generic.h"
 
 #define OWE_TRANSITION_OUI_TYPE "\x50\x6f\x9a\x1c"
 #define OWE_TRANSITION_OUI_SIZE 4
@@ -1275,6 +1276,7 @@ struct wlan_mlme_ratemask {
  * @dual_sta_roam_fw_support: Firmware support for dual sta roaming feature
  * @sae_connect_retries: sae connect retry bitmask
  * @wls_6ghz_capable: wifi location service(WLS) is 6ghz capable
+ * @monitor_mode_concurrency: Monitor mode concurrency supported
  */
 struct wlan_mlme_generic {
 	uint32_t band_capability;
@@ -1317,6 +1319,7 @@ struct wlan_mlme_generic {
 	bool dual_sta_roam_fw_support;
 	uint32_t sae_connect_retries;
 	bool wls_6ghz_capable;
+	enum monitor_mode_concurrency monitor_mode_concurrency;
 };
 
 /*

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

@@ -4176,4 +4176,18 @@ ucfg_mlme_set_roam_reason_vsie_status(struct wlan_objmgr_psoc *psoc,
 }
 
 #endif
+
+/**
+ * ucfg_mlme_is_sta_mon_conc_supported() - Check if STA + Monitor mode
+ * concurrency is supported
+ * @psoc: pointer to psoc object
+ *
+ * Return: True if supported, else false.
+ */
+static inline bool
+ucfg_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc *psoc)
+{
+	return wlan_mlme_is_sta_mon_conc_supported(psoc);
+}
+
 #endif /* _WLAN_MLME_UCFG_API_H_ */

+ 21 - 0
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -4670,3 +4670,24 @@ QDF_STATUS mlme_set_ext_opr_rate(struct wlan_objmgr_vdev *vdev, uint8_t *src,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+static enum monitor_mode_concurrency
+wlan_mlme_get_monitor_mode_concurrency(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+	if (!mlme_obj)
+		return cfg_default(CFG_MONITOR_MODE_CONCURRENCY);
+
+	return mlme_obj->cfg.gen.monitor_mode_concurrency;
+}
+
+bool wlan_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc *psoc)
+{
+	if (wlan_mlme_get_monitor_mode_concurrency(psoc) ==
+						MONITOR_MODE_CONC_STA_SCAN_MON)
+		return true;
+
+	return false;
+}

+ 3 - 0
components/nan/dispatcher/src/nan_ucfg_api.c

@@ -645,6 +645,9 @@ QDF_STATUS ucfg_nan_discovery_req(void *in_req, uint32_t req_type)
 				return QDF_STATUS_E_INVAL;
 			}
 
+			if (policy_mgr_is_sta_mon_concurrency(psoc))
+				return QDF_STATUS_E_INVAL;
+
 			/*
 			 * Take a psoc reference while it is being used by the
 			 * NAN requests.

+ 1 - 1
core/mac/src/pe/lim/lim_api.c

@@ -2864,7 +2864,7 @@ void lim_mon_deinit_session(struct mac_context *mac_ptr,
 {
 	struct pe_session *session;
 
-	session = pe_find_session_by_session_id(mac_ptr, msg->vdev_id);
+	session = pe_find_session_by_vdev_id(mac_ptr, msg->vdev_id);
 
 	if (session && session->bssType == eSIR_MONITOR_MODE)
 		pe_delete_session(mac_ptr, session);

+ 3 - 1
core/wma/src/wma_dev_if.c

@@ -489,7 +489,9 @@ static QDF_STATUS wma_handle_vdev_detach(tp_wma_handle wma_handle,
 		goto rel_ref;
 	}
 
-	if (cds_get_conparam() == QDF_GLOBAL_MONITOR_MODE)
+	if ((cds_get_conparam() == QDF_GLOBAL_MONITOR_MODE) ||
+	    (policy_mgr_is_sta_mon_concurrency(wma_handle->psoc) &&
+	    wlan_vdev_mlme_get_opmode(iface->vdev) == QDF_MONITOR_MODE))
 		wma_handle_monitor_mode_vdev_detach(wma_handle, vdev_id);
 
 rel_ref: