Browse Source

qcacld-3.0: Check dynamic NS offload based on trigger

Currently a userspace request to enable NS offload dynamically
gets rejected if the offloads are in disabled state.

After this change, when a request to enable or disable of NS offloads
is received in the host and if the trigger type is to dynamically update
the NS offloads, then update the dynamic offload configuations and inform
the FW.

Change-Id: Ifb4a1d37b5f2e6c89d043b00f9cc0aaf426d870e
CRs-Fixed: 3237980
Vinod Kumar Pirla 2 years ago
parent
commit
6fad793761
1 changed files with 17 additions and 12 deletions
  1. 17 12
      components/pmo/core/src/wlan_pmo_ns.c

+ 17 - 12
components/pmo/core/src/wlan_pmo_ns.c

@@ -232,11 +232,6 @@ static QDF_STATUS pmo_core_ns_offload_sanity(struct wlan_objmgr_vdev *vdev)
 		return QDF_STATUS_E_INVAL;
 	}
 
-	if (!vdev_ctx->pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic) {
-		pmo_debug("ns offload dynamically disable");
-		return QDF_STATUS_E_INVAL;
-	}
-
 	if (!pmo_core_is_vdev_supports_offload(vdev)) {
 		pmo_debug("vdev in invalid opmode for ns offload %d",
 			pmo_get_vdev_opmode(vdev));
@@ -377,6 +372,7 @@ QDF_STATUS pmo_core_enable_ns_offload_in_fwr(struct wlan_objmgr_vdev *vdev,
 {
 	QDF_STATUS status;
 	struct pmo_vdev_priv_obj *vdev_ctx;
+	struct pmo_psoc_priv_obj *pmo_psoc_ctx;
 	uint8_t vdev_id;
 
 	if (!vdev) {
@@ -390,6 +386,7 @@ QDF_STATUS pmo_core_enable_ns_offload_in_fwr(struct wlan_objmgr_vdev *vdev,
 		goto out;
 
 	vdev_ctx = pmo_vdev_get_priv(vdev);
+	pmo_psoc_ctx = vdev_ctx->pmo_psoc_ctx;
 
 	status = pmo_core_ns_offload_sanity(vdev);
 	if (status != QDF_STATUS_SUCCESS)
@@ -397,15 +394,15 @@ QDF_STATUS pmo_core_enable_ns_offload_in_fwr(struct wlan_objmgr_vdev *vdev,
 
 	if (trigger == pmo_ns_offload_dynamic_update) {
 		/*
-		 * user disable ns offload using ioctl/vendor cmd dynamically.
+		 * user enable ns offload using ioctl/vendor cmd dynamically.
 		 */
-		vdev_ctx->pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic =
-			true;
+		pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic = true;
 		goto skip_ns_dynamic_check;
 	}
 
-	if (!vdev_ctx->pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic) {
+	if (!pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic) {
 		pmo_debug("ns offload dynamically disable");
+		status = QDF_STATUS_E_INVAL;
 		goto dec_ref;
 	}
 
@@ -436,6 +433,7 @@ QDF_STATUS pmo_core_disable_ns_offload_in_fwr(struct wlan_objmgr_vdev *vdev,
 	QDF_STATUS status;
 	uint8_t vdev_id;
 	struct pmo_vdev_priv_obj *vdev_ctx;
+	struct pmo_psoc_priv_obj *pmo_psoc_ctx;
 
 	pmo_enter();
 	if (!vdev) {
@@ -449,6 +447,7 @@ QDF_STATUS pmo_core_disable_ns_offload_in_fwr(struct wlan_objmgr_vdev *vdev,
 		goto out;
 
 	vdev_ctx = pmo_vdev_get_priv(vdev);
+	pmo_psoc_ctx = vdev_ctx->pmo_psoc_ctx;
 
 	status = pmo_core_ns_offload_sanity(vdev);
 	if (status != QDF_STATUS_SUCCESS)
@@ -458,13 +457,19 @@ QDF_STATUS pmo_core_disable_ns_offload_in_fwr(struct wlan_objmgr_vdev *vdev,
 		/*
 		 * user disable ns offload using ioctl/vendor cmd dynamically.
 		 */
-		vdev_ctx->pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic =
-			false;
+		if (!pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic) {
+			/* Already disabled, skip to end */
+			status = QDF_STATUS_SUCCESS;
+			goto dec_ref;
+		}
+
+		pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic = false;
 		goto skip_ns_dynamic_check;
 	}
 
-	if (!vdev_ctx->pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic) {
+	if (!pmo_psoc_ctx->psoc_cfg.ns_offload_enable_dynamic) {
 		pmo_debug("ns offload dynamically disable");
+		status = QDF_STATUS_E_INVAL;
 		goto dec_ref;
 	}