فهرست منبع

qcacmn: Deinitialize t2lm context correctly

Deinitialize the t2lm context so that locks/timer will get
freed correctly.

Change-Id: I392f5c89f5c144413ed6144f499fadf054c547c5
CRs-Fixed: 3359134
Arun Kumar Khandavalli 2 سال پیش
والد
کامیت
c3fd408a86
3فایلهای تغییر یافته به همراه56 افزوده شده و 4 حذف شده
  1. 17 2
      umac/mlo_mgr/inc/wlan_mlo_t2lm.h
  2. 14 1
      umac/mlo_mgr/src/wlan_mlo_mgr_main.c
  3. 25 1
      umac/mlo_mgr/src/wlan_mlo_t2lm.c

+ 17 - 2
umac/mlo_mgr/inc/wlan_mlo_t2lm.h

@@ -1,5 +1,5 @@
 /*
- * 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 above
@@ -496,7 +496,7 @@ QDF_STATUS wlan_mlo_parse_bcn_prbresp_t2lm_ie(
 uint8_t *wlan_mlo_add_t2lm_info_ie(uint8_t *frm, struct wlan_t2lm_info *t2lm);
 
 /**
- * wlan_mlo_t2lm_timer_init() - API to add TID-to-link mapping IE
+ * wlan_mlo_t2lm_timer_init() - API to initialize t2lm timer
  * @vdev: Pointer to vdev
  *
  * Return: qdf status
@@ -504,6 +504,15 @@ uint8_t *wlan_mlo_add_t2lm_info_ie(uint8_t *frm, struct wlan_t2lm_info *t2lm);
 QDF_STATUS
 wlan_mlo_t2lm_timer_init(struct wlan_objmgr_vdev *vdev);
 
+/**
+ * wlan_mlo_t2lm_timer_deinit() - API to deinit t2lm timer
+ * @vdev: Pointer to vdev
+ *
+ * Return: qdf status
+ */
+QDF_STATUS
+wlan_mlo_t2lm_timer_deinit(struct wlan_objmgr_vdev *vdev);
+
 /**
  * wlan_mlo_t2lm_timer_start() - API to start T2LM timer
  * @vdev: Pointer to vdev
@@ -607,6 +616,12 @@ wlan_mlo_t2lm_timer_init(struct wlan_objmgr_vdev *vdev)
 	return QDF_STATUS_E_NOSUPPORT;
 }
 
+static inline QDF_STATUS
+wlan_mlo_t2lm_timer_deinit(struct wlan_objmgr_vdev *vdev)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
 static inline QDF_STATUS
 wlan_mlo_t2lm_timer_start(struct wlan_objmgr_vdev *vdev,
 			  uint32_t interval, uint8_t t2lm_ie_index)

+ 14 - 1
umac/mlo_mgr/src/wlan_mlo_mgr_main.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2021, 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 above
@@ -565,6 +565,18 @@ static QDF_STATUS mlo_dev_ctx_init(struct wlan_objmgr_vdev *vdev)
 	return status;
 }
 
+/**
+ * mlo_t2lm_ctx_deinit() - API to deinitialize the t2lm context with the default
+ * values.
+ * @vdev: Pointer to vdev structure
+ *
+ * Return: None
+ */
+static inline void mlo_t2lm_ctx_deinit(struct wlan_objmgr_vdev *vdev)
+{
+	wlan_mlo_t2lm_timer_deinit(vdev);
+}
+
 static QDF_STATUS mlo_dev_ctx_deinit(struct wlan_objmgr_vdev *vdev)
 {
 	struct wlan_mlo_dev_context *ml_dev;
@@ -640,6 +652,7 @@ static QDF_STATUS mlo_dev_ctx_deinit(struct wlan_objmgr_vdev *vdev)
 		else if (wlan_vdev_mlme_get_opmode(vdev) == QDF_SAP_MODE)
 			qdf_mem_free(ml_dev->ap_ctx);
 
+		mlo_t2lm_ctx_deinit(vdev);
 		tsf_recalculation_lock_destroy(ml_dev);
 		mlo_dev_lock_destroy(ml_dev);
 		qdf_mem_free(ml_dev);

+ 25 - 1
umac/mlo_mgr/src/wlan_mlo_t2lm.c

@@ -1,5 +1,5 @@
 /*
- * 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 above
@@ -804,6 +804,7 @@ wlan_mlo_t2lm_timer_init(struct wlan_objmgr_vdev *vdev)
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
+	t2lm_dev_lock_create(&vdev->mlo_dev_ctx->t2lm_ctx);
 	t2lm_dev_lock_acquire(&vdev->mlo_dev_ctx->t2lm_ctx);
 	qdf_timer_init(NULL, &t2lm_timer->t2lm_timer,
 		       wlan_mlo_t2lm_timer_expiry_handler,
@@ -1067,6 +1068,29 @@ QDF_STATUS wlan_mlo_dev_t2lm_notify_link_update(
 
 		handler(mldev, &t2lm_ctx->t2lm_ie[0].t2lm.ieee_link_map_tid[0]);
 	}
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+wlan_mlo_t2lm_timer_deinit(struct wlan_objmgr_vdev *vdev)
+{
+	struct wlan_t2lm_timer *t2lm_timer = NULL;
+
+	if (!vdev || !vdev->mlo_dev_ctx)
+		return QDF_STATUS_E_FAILURE;
+
+	t2lm_timer = &vdev->mlo_dev_ctx->t2lm_ctx.t2lm_timer;
+	if (!t2lm_timer) {
+		t2lm_err("t2lm timer ctx is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
 
+	t2lm_dev_lock_acquire(&vdev->mlo_dev_ctx->t2lm_ctx);
+	t2lm_timer->timer_started = false;
+	t2lm_timer->timer_interval = 0;
+	t2lm_timer->t2lm_ie_index = 0;
+	t2lm_dev_lock_release(&vdev->mlo_dev_ctx->t2lm_ctx);
+	qdf_timer_free(&t2lm_timer->t2lm_timer);
+	t2lm_dev_lock_destroy(&vdev->mlo_dev_ctx->t2lm_ctx);
 	return QDF_STATUS_SUCCESS;
 }