Browse Source

qcacld-3.0: Prevent suspend when bss color change is in progress

Currently, on obss color collision detection driver sends bss color
change IE in beacon and updates the color switch count in IE in
every beacon until color switch count reaches 0.

If the wlan driver enters suspend during this updation of bss color
change IE in beacon, the bss color change is not completed until wlan
resumes. This will lead to delay in bss color change after bss color
collision is detected.

To fix this issue, acquire wakelock once obss color collision is
detected and release it once obss color change is completed. This fix
is similar to how CSA is handled currently in driver.

Change-Id: I9c3e7cfe16da116905121b044054c0987afbca09
CRs-Fixed: 3405919
Surabhi Vishnoi 2 years ago
parent
commit
6176b7062f

+ 7 - 0
components/mlme/core/inc/wlan_mlme_main.h

@@ -38,6 +38,8 @@
 #define JOIN_PROBE_REQ_TIMER_MS              200
 #define MAX_JOIN_PROBE_REQ                   5
 
+#define MAX_WAKELOCK_FOR_BSS_COLOR_CHANGE    2000
+
 /* If AP reported link delete timer less than such value,
  * host will do link removel directly without wait for the
  * timer timeout.
@@ -754,6 +756,9 @@ struct enhance_roam_info {
  * @country_ie_for_all_band: take all band channel info in country ie
  * @mlme_ap: SAP related vdev private configurations
  * @is_single_link_mlo_roam: Single link mlo roam flag
+ * @bss_color_change_wakelock: wakelock to complete bss color change
+ *				operation on bss color collision detection
+ * @bss_color_change_runtime_lock: runtime lock to complete bss color change
  */
 struct mlme_legacy_priv {
 	bool chan_switch_in_progress;
@@ -823,6 +828,8 @@ struct mlme_legacy_priv {
 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
 	bool is_single_link_mlo_roam;
 #endif
+	qdf_wake_lock_t bss_color_change_wakelock;
+	qdf_runtime_lock_t bss_color_change_runtime_lock;
 };
 
 /**

+ 10 - 0
components/mlme/core/src/wlan_mlme_vdev_mgr_interface.c

@@ -1377,6 +1377,10 @@ static void mlme_ext_handler_destroy(struct vdev_mlme_obj *vdev_mlme)
 {
 	if (!vdev_mlme || !vdev_mlme->ext_vdev_ptr)
 		return;
+	qdf_runtime_lock_deinit(
+		&vdev_mlme->ext_vdev_ptr->bss_color_change_runtime_lock);
+	qdf_wake_lock_destroy(
+		&vdev_mlme->ext_vdev_ptr->bss_color_change_wakelock);
 	mlme_free_self_disconnect_ies(vdev_mlme->vdev);
 	mlme_free_peer_disconnect_ies(vdev_mlme->vdev);
 	mlme_free_sae_auth_retry(vdev_mlme->vdev);
@@ -1410,6 +1414,12 @@ QDF_STATUS vdevmgr_mlme_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme)
 	mlme_init_wait_for_key_timer(vdev_mlme->vdev,
 				     &vdev_mlme->ext_vdev_ptr->wait_key_timer);
 
+	qdf_wake_lock_create(
+			&vdev_mlme->ext_vdev_ptr->bss_color_change_wakelock,
+			"bss_color_change_wakelock");
+	qdf_runtime_lock_init(
+		&vdev_mlme->ext_vdev_ptr->bss_color_change_runtime_lock);
+
 	sme_get_vdev_type_nss(wlan_vdev_mlme_get_opmode(vdev_mlme->vdev),
 			      &vdev_mlme->proto.generic.nss_2g,
 			      &vdev_mlme->proto.generic.nss_5g);

+ 5 - 0
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -71,6 +71,7 @@
 #include "wlan_twt_cfg_ext_api.h"
 #include <spatial_reuse_api.h>
 #include "wlan_psoc_mlme_api.h"
+#include "wma_he.h"
 #ifdef WLAN_FEATURE_11BE_MLO
 #include <wlan_mlo_mgr_peer.h>
 #endif
@@ -9739,6 +9740,10 @@ static void obss_color_collision_process_color_change(struct mac_context *mac_ct
 		pe_debug("New bss color = %d", bss_color_index_array[i]);
 		he_bss_color.vdev_id = obss_color_info->vdev_id;
 		he_bss_color.bss_color = bss_color_index_array[i];
+
+		/* Take the wakelock for 2 sec, release it after color change */
+		wma_prevent_suspend_on_obss_color_collision(session->vdev);
+
 		lim_process_set_he_bss_color(mac_ctx,
 					     (uint32_t *)&he_bss_color);
 	} else {

+ 3 - 1
core/mac/src/pe/lim/lim_send_sme_rsp_messages.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -55,6 +55,7 @@
 #include "wlan_tdls_tgt_api.h"
 #include "lim_process_fils.h"
 #include "wma.h"
+#include "wma_he.h"
 #include <../../core/src/wlan_cm_vdev_api.h>
 #include <wlan_mlo_mgr_sta.h>
 #include <spatial_reuse_api.h>
@@ -2479,6 +2480,7 @@ lim_handle_bss_color_change_ie(struct mac_context *mac_ctx,
 				OBSS_COLOR_COLLISION_DETECTION);
 		}
 		lim_send_bss_color_change_ie_update(mac_ctx, session);
+		wma_allow_suspend_after_obss_color_change(session->vdev);
 	}
 }
 

+ 27 - 1
core/wma/inc/wma_he.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -254,6 +254,23 @@ void wma_set_he_vdev_param(struct wma_txrx_node *intr,
 uint32_t wma_get_he_vdev_param(struct wma_txrx_node *intr,
 			       wmi_conv_vdev_param_id param_id);
 
+/**
+ * wma_prevent_suspend_on_obss_color_collision() - prevent suspend on obss color
+ *						collision
+ * @vdev: pointer to vdev object
+ *
+ * Return: none
+ */
+void wma_prevent_suspend_on_obss_color_collision(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wma_allow_suspend_after_obss_color_change() - allow suspend on obss color
+ *						change
+ * @vdev: pointer to vdev object
+ *
+ * Return: none
+ */
+void wma_allow_suspend_after_obss_color_change(struct wlan_objmgr_vdev *vdev);
 #else
 static inline void wma_print_he_cap(tDot11fIEhe_cap *he_cap)
 {
@@ -350,6 +367,15 @@ static inline uint32_t wma_get_he_vdev_param(struct wma_txrx_node *intr,
 	return 0;
 }
 
+static inline void wma_prevent_suspend_on_obss_color_collision(
+						struct wlan_objmgr_vdev *vdev)
+{
+}
+
+static inline void wma_allow_suspend_after_obss_color_change(
+						struct wlan_objmgr_vdev *vdev)
+{
+}
 #endif
 
 #endif /* __WMA_HE_H */

+ 28 - 1
core/wma/src/wma_he.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -1554,3 +1554,30 @@ QDF_STATUS wma_get_hemu_mode(uint32_t *hemumode, struct mac_context *mac)
 	 */
 	return QDF_STATUS_SUCCESS;
 }
+
+void wma_prevent_suspend_on_obss_color_collision(struct wlan_objmgr_vdev *vdev)
+{
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv)
+		return;
+
+	qdf_wake_lock_timeout_acquire(&mlme_priv->bss_color_change_wakelock,
+				      MAX_WAKELOCK_FOR_BSS_COLOR_CHANGE);
+	qdf_runtime_pm_prevent_suspend(
+			&mlme_priv->bss_color_change_runtime_lock);
+}
+
+void wma_allow_suspend_after_obss_color_change(struct wlan_objmgr_vdev *vdev)
+{
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv)
+		return;
+
+	qdf_runtime_pm_allow_suspend(
+			&mlme_priv->bss_color_change_runtime_lock);
+	qdf_wake_lock_release(&mlme_priv->bss_color_change_wakelock, 0);
+}