Browse Source

qcacld-3.0: Don't create mon interface on lpc unsupported conditions

Do not create the monitor interface if local packet capture
unsupported conditions exists. like:
    a. ML connection exists;
    b. 2+ port concurrency exists.

CRs-Fixed: 3658842
Change-Id: I0dc17238d63a1d58264a00e8ad2b93bd74ecdbcc
Srinivas Girigowda 1 year ago
parent
commit
32f63dc370

+ 9 - 4
core/hdd/src/wlan_hdd_p2p.c

@@ -56,6 +56,7 @@
 #include "wlan_pre_cac_ucfg_api.h"
 #include "wlan_dp_ucfg_api.h"
 #include "wlan_psoc_mlme_ucfg_api.h"
+#include "os_if_dp_local_pkt_capture.h"
 
 /* Ms to Time Unit Micro Sec */
 #define MS_TO_TU_MUS(x)   ((x) * 1024)
@@ -686,6 +687,14 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
 	if (ret)
 		return ERR_PTR(ret);
 
+	status = hdd_nl_to_qdf_iface_type(type, &mode);
+	if (QDF_IS_STATUS_ERROR(status))
+		return ERR_PTR(qdf_status_to_os_return(status));
+
+	if (mode == QDF_MONITOR_MODE &&
+	    !os_if_lpc_mon_intf_creation_allowed(hdd_ctx->psoc))
+		return ERR_PTR(-EOPNOTSUPP);
+
 	wlan_hdd_lpc_handle_concurrency(hdd_ctx, true);
 
 	if (policy_mgr_is_sta_mon_concurrency(hdd_ctx->psoc) &&
@@ -699,10 +708,6 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
 		   TRACE_CODE_HDD_ADD_VIRTUAL_INTF,
 		   NO_SESSION, type);
 
-	status = hdd_nl_to_qdf_iface_type(type, &mode);
-	if (QDF_IS_STATUS_ERROR(status))
-		return ERR_PTR(qdf_status_to_os_return(status));
-
 	switch (mode) {
 	case QDF_SAP_MODE:
 	case QDF_P2P_GO_MODE:

+ 15 - 0
os_if/dp/inc/os_if_dp_local_pkt_capture.h

@@ -80,6 +80,15 @@ QDF_STATUS os_if_dp_local_pkt_capture_stop(struct wlan_objmgr_vdev *vdev);
 QDF_STATUS os_if_dp_get_lpc_state(struct wlan_objmgr_vdev *vdev,
 				  const void *data, int data_len);
 
+/**
+ * os_if_lpc_mon_intf_creation_allowed() - Check if local packet capture
+ * monitor interface creation is allowed or not
+ * @psoc: psoc object handle
+ *
+ * Return: true, If monitor interface creation is allowed
+ *         false, Otherwise
+ */
+bool os_if_lpc_mon_intf_creation_allowed(struct wlan_objmgr_psoc *psoc);
 #else
 static inline
 QDF_STATUS os_if_dp_set_lpc_configure(struct wlan_objmgr_vdev *vdev,
@@ -101,5 +110,11 @@ QDF_STATUS os_if_dp_get_lpc_state(struct wlan_objmgr_vdev *vdev,
 	return QDF_STATUS_SUCCESS;
 }
 
+static inline
+bool os_if_lpc_mon_intf_creation_allowed(struct wlan_objmgr_psoc *psoc)
+{
+	return true;
+}
+
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 #endif

+ 17 - 0
os_if/dp/src/os_if_dp_local_pkt_capture.c

@@ -97,6 +97,23 @@ bool os_if_local_pkt_capture_concurrency_allowed(struct wlan_objmgr_psoc *psoc)
 	return false;
 }
 
+bool os_if_lpc_mon_intf_creation_allowed(struct wlan_objmgr_psoc *psoc)
+{
+	if (ucfg_dp_is_local_pkt_capture_enabled(psoc)) {
+		if (policy_mgr_is_mlo_sta_present(psoc)) {
+			osif_err("MLO STA present, lpc interface creation not allowed");
+			return false;
+		}
+
+		if (!os_if_local_pkt_capture_concurrency_allowed(psoc)) {
+			osif_err("Concurrency check failed, lpc interface creation not allowed");
+			return false;
+		}
+	}
+
+	return true;
+}
+
 static QDF_STATUS os_if_start_capture_allowed(struct wlan_objmgr_vdev *vdev)
 {
 	enum QDF_OPMODE mode = wlan_vdev_mlme_get_opmode(vdev);