فهرست منبع

qcacmn: Validate the periodicity based on target

Allow cfr period to be multiples of 1ms for targets like
qcn9000, qca6018, qca8074v2 and qca5018.

For other targets, restrict it to be multiples of 10ms.

CRs-Fixed: 2878062
Change-Id: I7f5638adf8ef39f7b8b681ae6693f5f032217e88
Shwetha G K 4 سال پیش
والد
کامیت
a48ce19f53

+ 10 - 1
umac/cfr/dispatcher/inc/wlan_cfr_tgt_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2021 The Linux Foundation. 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
@@ -74,6 +74,15 @@ int tgt_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
 int tgt_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
 			 struct wlan_objmgr_peer *peer);
 
+/**
+ * tgt_cfr_validate_period() - API to validate cfr period configured by user
+ * @psoc: pointer to the psoc object
+ * @period: period value to validate
+ *
+ * Return: success/failure of periodicity validation
+ */
+int tgt_cfr_validate_period(struct wlan_objmgr_psoc *psoc, u_int32_t period);
+
 /**
  * tgt_cfr_enable_cfr_timer() - API to enable cfr timer
  * @pdev: pointer to pdev_object

+ 0 - 3
umac/cfr/dispatcher/inc/wlan_cfr_ucfg_api.h

@@ -24,9 +24,6 @@
 #include <wlan_cfr_public_structs.h>
 #include <wlan_cfr_utils_api.h>
 
-#define MAX_CFR_PRD  (10 * 60 * 1000)   /* 10 minutes */
-#define CFR_MOD_PRD  2                  /* CFR period to be multiples of 2 ms */
-
 /**
  * ucfg_cfr_start_capture() - function to start cfr capture for connected client
  * @pdev: pointer to pdev object

+ 3 - 0
umac/cfr/dispatcher/inc/wlan_cfr_utils_api.h

@@ -57,6 +57,9 @@
 #define DEFAULT_SRNGID_CFR 0
 #endif
 
+#define MAX_CFR_PRD  (10 * 60 * 1000)   /* 10 minutes */
+#define CFR_MOD_PRD  10                 /* CFR period to be multiples of 10ms */
+
 enum cfrmetaversion {
 	CFR_META_VERSION_NONE,
 	CFR_META_VERSION_1,

+ 34 - 1
umac/cfr/dispatcher/src/wlan_cfr_tgt_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2021 The Linux Foundation. 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
@@ -104,6 +104,39 @@ int tgt_cfr_get_target_type(struct wlan_objmgr_psoc *psoc)
 	return target_type;
 }
 
+int tgt_cfr_validate_period(struct wlan_objmgr_psoc *psoc, u_int32_t period)
+{
+	uint32_t target_type = tgt_cfr_get_target_type(psoc);
+	int status = 0;
+
+	if (target_type == TARGET_TYPE_UNKNOWN) {
+		cfr_err("cfr period validation fail due to invalid target type");
+		return status;
+	}
+
+	/* Basic check is the period should be between 0 and MAX_CFR_PRD */
+	if ((period < 0) || (period > MAX_CFR_PRD)) {
+		cfr_err("Invalid period value: %d\n", period);
+		return status;
+	}
+
+	if (target_type == TARGET_TYPE_QCN9000 ||
+	    target_type == TARGET_TYPE_QCA6018 ||
+	    target_type == TARGET_TYPE_QCA8074V2 ||
+	    target_type == TARGET_TYPE_QCA5018) {
+		/* No additional check required for these targets */
+		status = 1;
+	} else {
+		if (!(period % CFR_MOD_PRD)) {
+			status = 1;
+		} else {
+			cfr_err("Invalid period value. Value must be mod of %d",
+				CFR_MOD_PRD);
+		}
+	}
+	return status;
+}
+
 QDF_STATUS tgt_cfr_init_pdev(struct wlan_objmgr_pdev *pdev)
 {
 	struct wlan_lmac_if_cfr_tx_ops *cfr_tx_ops = NULL;

+ 7 - 3
umac/cfr/dispatcher/src/wlan_cfr_ucfg_api.c

@@ -62,6 +62,7 @@ int ucfg_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
 	int status;
 	struct pdev_cfr *pa;
 	struct peer_cfr *pe;
+	struct wlan_objmgr_psoc *psoc;
 
 	pa = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR);
 	if (NULL == pa) {
@@ -81,12 +82,15 @@ int ucfg_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
 		return -EINVAL;
 	}
 
-	if ((params->period < 0) || (params->period > MAX_CFR_PRD) ||
-		(params->period % CFR_MOD_PRD)) {
-		cfr_err("Invalid period value: %d", params->period);
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc) {
+		cfr_err("psoc is null!");
 		return -EINVAL;
 	}
 
+	if (!(tgt_cfr_validate_period(psoc, params->period)))
+		return -EINVAL;
+
 	if (!(params->period) && (pa->cfr_timer_enable)) {
 		cfr_err("Single shot capture is not allowed during periodic capture");
 		return -EINVAL;