Эх сурвалжийг харах

qcacmn: Add vdev mlme API to get/set dfs cac duration

For MCC, dfs cac duration is saved in vdev mlme object. Add API to
get/set dfs cac duration from/to vdev mlme object.

Change-Id: Iafcf382f884fe453bd4cc4c733f44f43ab00df69
CRs-Fixed: 3103634
Bing Sun 3 жил өмнө
parent
commit
385e355013

+ 19 - 2
umac/mlme/vdev_mgr/core/src/vdev_mgr_ops.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -40,6 +40,7 @@
 #ifdef WLAN_FEATURE_11BE_MLO
 #include <wlan_mlo_mgr_ap.h>
 #endif
+#include <wlan_vdev_mgr_utils_api.h>
 
 #ifdef QCA_VDEV_STATS_HW_OFFLOAD_SUPPORT
 /**
@@ -324,6 +325,22 @@ vdev_mgr_start_param_update_mlo(struct vdev_mlme_obj *mlme_obj,
 }
 #endif
 
+#ifdef MOBILE_DFS_SUPPORT
+static void
+vdev_mgr_start_param_update_cac_ms(struct wlan_objmgr_vdev *vdev,
+				   struct vdev_start_params *param)
+{
+	param->cac_duration_ms =
+			wlan_util_vdev_mgr_get_cac_timeout_for_vdev(vdev);
+}
+#else
+static void
+vdev_mgr_start_param_update_cac_ms(struct wlan_objmgr_vdev *vdev,
+				   struct vdev_start_params *param)
+{
+}
+#endif
+
 static QDF_STATUS vdev_mgr_start_param_update(
 					struct vdev_mlme_obj *mlme_obj,
 					struct vdev_start_params *param)
@@ -437,7 +454,7 @@ static QDF_STATUS vdev_mgr_start_param_update(
 
 	if (mlme_obj->mgmt.generic.type == WLAN_VDEV_MLME_TYPE_AP) {
 		param->hidden_ssid = mlme_obj->mgmt.ap.hidden_ssid;
-		param->cac_duration_ms = mlme_obj->mgmt.ap.cac_duration_ms;
+		vdev_mgr_start_param_update_cac_ms(vdev, param);
 	}
 	wlan_vdev_mlme_get_ssid(vdev, param->ssid.ssid, &param->ssid.length);
 

+ 23 - 1
umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mgr_utils_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -146,4 +146,26 @@ QDF_STATUS wlan_util_vdev_mgr_compute_max_channel_switch_time(
  */
 uint32_t wlan_utils_get_vdev_remaining_channel_switch_time(
 		struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wlan_util_vdev_mgr_get_cac_timeout_for_vdev() - Get the CAC timeout value for
+ * a given vdev.
+ * @vdev: Pointer to vdev object.
+ *
+ * Return: CAC timeout value
+ */
+int wlan_util_vdev_mgr_get_cac_timeout_for_vdev(struct wlan_objmgr_vdev *vdev);
+
+#ifdef MOBILE_DFS_SUPPORT
+/**
+ * wlan_util_vdev_mgr_set_cac_timeout_for_vdev() - set the CAC timeout value for
+ * a given vdev.
+ * @vdev: Pointer to vdev object.
+ * @new_chan_cac_ms: cac duration of new channel
+ *
+ * Return: void
+ */
+void wlan_util_vdev_mgr_set_cac_timeout_for_vdev(struct wlan_objmgr_vdev *vdev,
+						 uint32_t new_chan_cac_ms);
+#endif /* MOBILE_DFS_SUPPORT */
 #endif /* __WLAN_VDEV_MGR_UTILS_API_H__ */

+ 35 - 23
umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mgr_utils_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -680,20 +680,13 @@ void wlan_util_vdev_get_param(struct wlan_objmgr_vdev *vdev,
 
 qdf_export_symbol(wlan_util_vdev_get_param);
 
-/**
- * wlan_util_vdev_mgr_get_cac_timeout_for_vdev() - Get the CAC timeout value for
- * a given vdev.
- * @vdev: Pointer to vdev object.
- *
- * Return: CAC timeout value
- */
 #ifndef MOBILE_DFS_SUPPORT
-static int wlan_util_vdev_mgr_get_cac_timeout_for_vdev(
-		struct wlan_objmgr_vdev *vdev)
+int wlan_util_vdev_mgr_get_cac_timeout_for_vdev(struct wlan_objmgr_vdev *vdev)
 {
 	struct wlan_channel *des_chan = NULL;
 	struct wlan_channel *bss_chan = NULL;
 	bool continue_current_cac = 0;
+	int dfs_cac_timeout = 0;
 
 	des_chan = wlan_vdev_mlme_get_des_chan(vdev);
 	if (!des_chan)
@@ -707,16 +700,38 @@ static int wlan_util_vdev_mgr_get_cac_timeout_for_vdev(
 				       bss_chan, &continue_current_cac))
 		return 0;
 
-	return dfs_mlme_get_cac_timeout_for_freq(wlan_vdev_get_pdev(vdev),
-						 des_chan->ch_freq,
-						 des_chan->ch_cfreq2,
-						 des_chan->ch_flags);
+	dfs_cac_timeout = dfs_mlme_get_cac_timeout_for_freq(
+				wlan_vdev_get_pdev(vdev), des_chan->ch_freq,
+				des_chan->ch_cfreq2, des_chan->ch_flags);
+	/* Seconds to milliseconds */
+	return SECONDS_TO_MS(dfs_cac_timeout);
 }
 #else
-static int wlan_util_vdev_mgr_get_cac_timeout_for_vdev(
-		struct wlan_objmgr_vdev *vdev)
+int wlan_util_vdev_mgr_get_cac_timeout_for_vdev(struct wlan_objmgr_vdev *vdev)
 {
-	return 0;
+	struct vdev_mlme_obj *vdev_mlme;
+
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!vdev_mlme) {
+		mlme_err("vdev_mlme is null");
+		return 0;
+	}
+
+	return vdev_mlme->mgmt.ap.cac_duration_ms;
+}
+
+void wlan_util_vdev_mgr_set_cac_timeout_for_vdev(struct wlan_objmgr_vdev *vdev,
+						 uint32_t new_chan_cac_ms)
+{
+	struct vdev_mlme_obj *vdev_mlme;
+
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!vdev_mlme) {
+		mlme_err("vdev_mlme is null");
+		return;
+	}
+
+	vdev_mlme->mgmt.ap.cac_duration_ms = new_chan_cac_ms;
 }
 #endif /* MOBILE_DFS_SUPPORT */
 
@@ -751,7 +766,6 @@ QDF_STATUS wlan_util_vdev_mgr_get_csa_channel_switch_time(
 QDF_STATUS wlan_util_vdev_mgr_compute_max_channel_switch_time(
 		struct wlan_objmgr_vdev *vdev, uint32_t *max_chan_switch_time)
 {
-	int dfs_cac_timeout = 0;
 	QDF_STATUS status;
 
 	status = wlan_util_vdev_mgr_get_csa_channel_switch_time(
@@ -761,11 +775,9 @@ QDF_STATUS wlan_util_vdev_mgr_compute_max_channel_switch_time(
 		return status;
 	}
 
-	/* Get the CAC time */
-	dfs_cac_timeout = wlan_util_vdev_mgr_get_cac_timeout_for_vdev(vdev);
-
-	/* Seconds to milliseconds */
-	*max_chan_switch_time += SECONDS_TO_MS(dfs_cac_timeout);
+	/* Plus the CAC time */
+	*max_chan_switch_time +=
+			wlan_util_vdev_mgr_get_cac_timeout_for_vdev(vdev);
 
 	return QDF_STATUS_SUCCESS;
 }