浏览代码

qcacmn: Add API to check whether MLO CSA allowed

SCC links in same MLD is not allowed, add API to check whether MLO CSA
allowed

CRs-Fixed: 3722991
Change-Id: I1eab54995e2b12715b66c58d6c6e31c14de6c994
Jianmin Zhu 1 年之前
父节点
当前提交
c753fff381
共有 2 个文件被更改,包括 54 次插入3 次删除
  1. 12 2
      umac/mlo_mgr/inc/wlan_mlo_mgr_cmn.h
  2. 42 1
      umac/mlo_mgr/src/wlan_mlo_mgr_cmn.c

+ 12 - 2
umac/mlo_mgr/inc/wlan_mlo_mgr_cmn.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. 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 above
@@ -637,7 +637,6 @@ mlo_get_link_state_register_resp_cb(struct wlan_objmgr_vdev *vdev,
  */
 QDF_STATUS ml_post_get_link_state_msg(struct wlan_objmgr_vdev *vdev);
 
-#endif
 #endif
 #ifdef WLAN_FEATURE_11BE
 /**
@@ -696,3 +695,14 @@ QDF_STATUS wlan_mlo_set_ptqm_migration(struct wlan_objmgr_vdev *vdev,
 				       uint32_t link_id,
 				       bool force_mig);
 #endif
+
+/*
+ * wlan_mlo_is_csa_allow() - API to check if CSA allowed for MLO vdev
+ * @vdev: vdev object
+ * @csa_freq: CSA target freq
+ *
+ * Return: true if CSA allowed
+ */
+bool
+wlan_mlo_is_csa_allow(struct wlan_objmgr_vdev *vdev, uint16_t csa_freq);
+#endif

+ 42 - 1
umac/mlo_mgr/src/wlan_mlo_mgr_cmn.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. 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 above
@@ -28,6 +28,7 @@
 #include <target_if_mlo_mgr.h>
 #include <cdp_txrx_cmn.h>
 #include <wlan_cfg.h>
+#include "wlan_utility.h"
 
 void mlo_get_link_information(struct qdf_mac_addr *mld_addr,
 			      struct mlo_link_info *info)
@@ -977,3 +978,43 @@ QDF_STATUS ml_post_get_link_state_msg(struct wlan_objmgr_vdev *vdev)
 	return qdf_status;
 }
 
+bool
+wlan_mlo_is_csa_allow(struct wlan_objmgr_vdev *vdev, uint16_t csa_freq)
+{
+	struct wlan_channel *chan;
+	struct wlan_objmgr_vdev *ml_vdev_list[WLAN_UMAC_MLO_MAX_VDEVS] = {0};
+	uint16_t ml_vdev_cnt = 0;
+	struct wlan_objmgr_vdev *t_vdev;
+	int i;
+	bool is_allow = true;
+
+	if (!vdev) {
+		mlo_err("vdev is NULL");
+		return false;
+	}
+
+	if (!wlan_vdev_mlme_is_mlo_vdev(vdev))
+		return true;
+
+	mlo_get_ml_vdev_list(vdev, &ml_vdev_cnt, ml_vdev_list);
+	for (i = 0; i < ml_vdev_cnt; i++) {
+		t_vdev = ml_vdev_list[i];
+		if (t_vdev == vdev)
+			goto next;
+		chan = wlan_vdev_get_active_channel(t_vdev);
+		if (!chan)
+			goto next;
+
+		if (csa_freq == chan->ch_freq) {
+			mlo_err("vdev %d will SCC with vdev %d on freq %d",
+				wlan_vdev_get_id(vdev),
+				wlan_vdev_get_id(t_vdev), csa_freq);
+			is_allow = false;
+		}
+next:
+		mlo_release_vdev_ref(t_vdev);
+	}
+
+	return is_allow;
+}
+