Browse Source

qcacmn: Get pdev for dfs if pdev id is not 0

MCL host only has one pdev with pdev id as 0. If pdev id indicated
from FW is bigger than 0, MCL will not get pdev. Get pdev with pdev
id 0 in this case.

Change-Id: Ie43fc2d78d31ebaa3f32076704d81439f1d46830
Bing Sun 3 năm trước cách đây
mục cha
commit
091c383271
1 tập tin đã thay đổi với 39 bổ sung2 xóa
  1. 39 2
      target_if/dfs/src/target_if_dfs_full_offload.c

+ 39 - 2
target_if/dfs/src/target_if_dfs_full_offload.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -184,6 +185,42 @@ free_vdevref:
 }
 #endif
 
+#ifdef MOBILE_DFS_SUPPORT
+/**
+ * target_if_dfs_get_pdev() -  retrieve pdev by id
+ * @psoc: PSOC object
+ * @id: pdev id
+ * @dbg_id: id of the caller
+ *
+ * Return: pdev pointer
+ *         NULL on FAILURE
+ */
+static struct wlan_objmgr_pdev *target_if_dfs_get_pdev(
+		struct wlan_objmgr_psoc *psoc, uint8_t id,
+		wlan_objmgr_ref_dbgid dbg_id)
+{
+	struct wlan_objmgr_pdev *pdev;
+
+	pdev = wlan_objmgr_get_pdev_by_id(psoc, id, dbg_id);
+	if (!pdev) {
+		pdev = wlan_objmgr_get_pdev_by_id(psoc, TGT_WMI_PDEV_ID_SOC,
+						  dbg_id);
+		if (!pdev)
+			target_if_err("pdev id %d null pdev",
+				      TGT_WMI_PDEV_ID_SOC);
+	}
+
+	return pdev;
+}
+#else
+static struct wlan_objmgr_pdev *target_if_dfs_get_pdev(
+		struct wlan_objmgr_psoc *psoc, uint8_t id,
+		wlan_objmgr_ref_dbgid dbg_id)
+{
+	return wlan_objmgr_get_pdev_by_id(psoc, id, dbg_id);
+}
+#endif
+
 /**
  * target_if_dfs_radar_detection_event_handler() - Indicate RADAR detection and
  * process RADAR detection.
@@ -233,9 +270,9 @@ static int target_if_dfs_radar_detection_event_handler(
 		return -EFAULT;
 	}
 
-	pdev = wlan_objmgr_get_pdev_by_id(psoc, radar.pdev_id, WLAN_DFS_ID);
+	pdev = target_if_dfs_get_pdev(psoc, radar.pdev_id, WLAN_DFS_ID);
 	if (!pdev) {
-		target_if_err("null pdev");
+		target_if_err("pdev id %d null pdev", radar.pdev_id);
 		return -EINVAL;
 	}