Преглед изворни кода

qca-wifi: Handle capture interval and capture duration for RCC

FW may limit the interval and duration during which HW may
use user provided values and attempt to capture.
These values range from 1 us to roughly 16.8 sec.
Max value is 0xFFFFFF which is 16.777215 sec.

Add check to make sure that capture duration cannot exceed
capture interval.

Change-Id: If6f75c737f8ac8cda527eee60f0e67d75e3b5420
Adwait Nayak пре 5 година
родитељ
комит
25eea0893c
1 измењених фајлова са 12 додато и 3 уклоњено
  1. 12 3
      umac/cfr/dispatcher/src/wlan_cfr_ucfg_api.c

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

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020 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
@@ -458,7 +458,11 @@ ucfg_cfr_set_capture_interval(struct wlan_objmgr_vdev *vdev,
 	if (status != QDF_STATUS_SUCCESS)
 		return status;
 
-	pcfr->rcc_param.capture_interval = params->cap_intvl;
+	if (pcfr->rcc_param.capture_duration > params->cap_intvl) {
+		cfr_err("Capture intval should be more than capture duration");
+		status = QDF_STATUS_E_INVAL;
+	} else
+		pcfr->rcc_param.capture_interval = params->cap_intvl;
 
 	wlan_objmgr_pdev_release_ref(pdev, WLAN_CFR_ID);
 
@@ -482,7 +486,12 @@ ucfg_cfr_set_capture_duration(struct wlan_objmgr_vdev *vdev,
 	if (status != QDF_STATUS_SUCCESS)
 		return status;
 
-	pcfr->rcc_param.capture_duration = params->cap_dur;
+	if (pcfr->rcc_param.capture_interval
+	    && (params->cap_dur > pcfr->rcc_param.capture_interval)) {
+		cfr_err("Capture duration is exceeding capture interval");
+		status = QDF_STATUS_E_INVAL;
+	} else
+		pcfr->rcc_param.capture_duration = params->cap_dur;
 
 	wlan_objmgr_pdev_release_ref(pdev, WLAN_CFR_ID);