瀏覽代碼

qcacmn: Add helper APIs to check scan radio capabilities

A new BDF option is added for scan radio boards to disable/enable DFS
detection. This flag is advertised to host via scan radio capabilities
TLV in ext2 service ready event. If customer sets the BDF so that DFS
need to be disabled, host skips the CAC timer and ignores the Radar
detection event. This change adds the following APIs.

1) Check given radio is a scan radio
2) DFS needs to be enabled/disabled for scan radio

CRs-Fixed: 2746779
Change-Id: Iabd34261aaa1067c7bbb76677aebcc8a3f89de43
Edayilliam Jayadev 4 年之前
父節點
當前提交
fa65000c6b
共有 2 個文件被更改,包括 168 次插入0 次删除
  1. 30 0
      target_if/core/inc/target_if.h
  2. 138 0
      target_if/core/src/target_if_main.c

+ 30 - 0
target_if/core/inc/target_if.h

@@ -2404,4 +2404,34 @@ static inline uint32_t target_psoc_get_chan_width_switch_num_peers(
 
 	return psoc_info->info.service_ext2_param.chwidth_num_peer_caps;
 }
+
+/**
+ * target_if_is_scan_radio_supported() - API to check scan radio
+ * support for the given radio
+ * @pdev: pointer to pdev
+ * @is_scan_radio_supported: pointer to scan radio support flag
+ *
+ * API to check scan radio support for the given radio
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+target_pdev_is_scan_radio_supported(struct wlan_objmgr_pdev *pdev,
+				    bool *is_scan_radio_supported);
+
+/**
+ * target_pdev_scan_radio_is_dfs_enabled() - API to check
+ * whether DFS needs to be enabled/disabled for scan radio.
+ * @pdev:  pointer to pdev
+ * @is_dfs_en: Pointer to DFS enable flag
+ *
+ * API to check whether DFS needs to be enabled/disabled for
+ * scan radio. This API should be used only for a scan radio
+ * pdev.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+target_pdev_scan_radio_is_dfs_enabled(struct wlan_objmgr_pdev *pdev,
+				      bool *is_dfs_en);
 #endif

+ 138 - 0
target_if/core/src/target_if_main.c

@@ -679,3 +679,141 @@ bool target_is_tgt_type_qcn9000(uint32_t target_type)
 {
 	return target_type == TARGET_TYPE_QCN9000;
 }
+
+QDF_STATUS
+target_pdev_is_scan_radio_supported(struct wlan_objmgr_pdev *pdev,
+				    bool *is_scan_radio_supported)
+{
+	struct wlan_objmgr_psoc *psoc;
+	struct wlan_psoc_host_scan_radio_caps *scan_radio_caps;
+	uint8_t cap_idx;
+	uint32_t num_scan_radio_caps;
+	int32_t phy_id;
+	struct target_psoc_info *tgt_psoc_info;
+	struct target_pdev_info *tgt_pdev;
+
+	if (!is_scan_radio_supported) {
+		target_if_err("input argument is null");
+		return QDF_STATUS_E_INVAL;
+	}
+	*is_scan_radio_supported = false;
+
+	if (!pdev) {
+		target_if_err("pdev is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc) {
+		target_if_err("psoc is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc);
+	if (!tgt_psoc_info) {
+		target_if_err("target_psoc_info is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	num_scan_radio_caps =
+		target_psoc_get_num_scan_radio_caps(tgt_psoc_info);
+	if (!num_scan_radio_caps)
+		return QDF_STATUS_SUCCESS;
+
+	scan_radio_caps = target_psoc_get_scan_radio_caps(tgt_psoc_info);
+	if (!scan_radio_caps) {
+		target_if_err("scan radio capabilities is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	tgt_pdev = (struct target_pdev_info *)wlan_pdev_get_tgt_if_handle(pdev);
+	if (!tgt_pdev) {
+		target_if_err("target_pdev_info is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	phy_id = target_pdev_get_phy_idx(tgt_pdev);
+	if (phy_id < 0) {
+		target_if_err("phy_id is invalid");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	for (cap_idx = 0; cap_idx < num_scan_radio_caps; cap_idx++)
+		if (scan_radio_caps[cap_idx].phy_id == phy_id)
+			*is_scan_radio_supported =
+				scan_radio_caps[cap_idx].scan_radio_supported;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+target_pdev_scan_radio_is_dfs_enabled(struct wlan_objmgr_pdev *pdev,
+				      bool *is_dfs_en)
+{
+	struct wlan_objmgr_psoc *psoc;
+	struct wlan_psoc_host_scan_radio_caps *scan_radio_caps;
+	uint8_t cap_idx;
+	uint32_t num_scan_radio_caps, pdev_id;
+	int32_t phy_id;
+	struct target_psoc_info *tgt_psoc_info;
+	struct target_pdev_info *tgt_pdev;
+
+	if (!is_dfs_en) {
+		target_if_err("input argument is null");
+		return QDF_STATUS_E_INVAL;
+	}
+	*is_dfs_en = true;
+
+	if (!pdev) {
+		target_if_err("pdev is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc) {
+		target_if_err("psoc is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc);
+	if (!tgt_psoc_info) {
+		target_if_err("target_psoc_info is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	num_scan_radio_caps =
+		target_psoc_get_num_scan_radio_caps(tgt_psoc_info);
+	if (!num_scan_radio_caps) {
+		target_if_err("scan radio not supported for psoc");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	scan_radio_caps = target_psoc_get_scan_radio_caps(tgt_psoc_info);
+	if (!scan_radio_caps) {
+		target_if_err("scan radio capabilities is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	tgt_pdev = (struct target_pdev_info *)wlan_pdev_get_tgt_if_handle(pdev);
+	if (!tgt_pdev) {
+		target_if_err("target_pdev_info is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+	phy_id = target_pdev_get_phy_idx(tgt_pdev);
+	if (phy_id < 0) {
+		target_if_err("phy_id is invalid");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	for (cap_idx = 0; cap_idx < num_scan_radio_caps; cap_idx++)
+		if (scan_radio_caps[cap_idx].phy_id == phy_id) {
+			*is_dfs_en = scan_radio_caps[cap_idx].dfs_en;
+			return QDF_STATUS_SUCCESS;
+		}
+
+	target_if_err("No scan radio cap found in pdev %d", pdev_id);
+
+	return QDF_STATUS_E_INVAL;
+}