Browse Source

qcacmn: Add legacy pointer in connection manager context

Add legacy pointer in connection manager context to use for RSO
and other connection manager legacy operations.

Change-Id: If3fdfc7d830fb15f6c2ef56cdd0b7b3dde7f5f36
CRs-Fixed: 2845981
gaurank kathpalia 4 years ago
parent
commit
5431b5345c

+ 11 - 2
umac/mlme/connection_mgr/core/src/wlan_cm_main.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015, 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015, 2020-2021, The Linux Foundation. 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
@@ -79,12 +79,20 @@ QDF_STATUS wlan_cm_init(struct vdev_mlme_obj *vdev_mlme)
 	if (!vdev_mlme->cnx_mgr_ctx)
 		return QDF_STATUS_E_NOMEM;
 
+	status = mlme_cm_ext_hdl_create(vdev_mlme->cnx_mgr_ctx);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		qdf_mem_free(vdev_mlme->cnx_mgr_ctx);
+		vdev_mlme->cnx_mgr_ctx = NULL;
+		return status;
+	}
+
 	vdev_mlme->cnx_mgr_ctx->vdev = vdev;
 	status = cm_sm_create(vdev_mlme->cnx_mgr_ctx);
 	if (QDF_IS_STATUS_ERROR(status)) {
+		mlme_cm_ext_hdl_destroy(vdev_mlme->cnx_mgr_ctx);
 		qdf_mem_free(vdev_mlme->cnx_mgr_ctx);
 		vdev_mlme->cnx_mgr_ctx = NULL;
-		return QDF_STATUS_E_NOMEM;
+		return status;
 	}
 	vdev_mlme->cnx_mgr_ctx->max_connect_attempts =
 					CM_MAX_CONNECT_ATTEMPTS;
@@ -120,6 +128,7 @@ QDF_STATUS wlan_cm_deinit(struct vdev_mlme_obj *vdev_mlme)
 	cm_req_lock_destroy(vdev_mlme->cnx_mgr_ctx);
 	qdf_list_destroy(&vdev_mlme->cnx_mgr_ctx->req_list);
 	cm_sm_destroy(vdev_mlme->cnx_mgr_ctx);
+	mlme_cm_ext_hdl_destroy(vdev_mlme->cnx_mgr_ctx);
 	qdf_mem_free(vdev_mlme->cnx_mgr_ctx);
 	vdev_mlme->cnx_mgr_ctx = NULL;
 

+ 3 - 1
umac/mlme/connection_mgr/core/src/wlan_cm_main.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015, 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015, 2020-2021, The Linux Foundation. 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
@@ -181,6 +181,7 @@ struct connect_ies {
  * @connect_timeout: Connect timeout value in milliseconds
  * @scan_requester_id: scan requester id.
  * @disconnect_complete: disconnect completion wait event
+ * @ext_cm_ptr: connection manager ext pointer
  */
 struct cnx_mgr {
 	struct wlan_objmgr_vdev *vdev;
@@ -201,6 +202,7 @@ struct cnx_mgr {
 	uint32_t connect_timeout;
 	wlan_scan_requester scan_requester_id;
 	qdf_event_t disconnect_complete;
+	cm_ext_t *ext_cm_ptr;
 };
 
 /**

+ 12 - 0
umac/mlme/connection_mgr/core/src/wlan_cm_main_api.h

@@ -480,6 +480,18 @@ struct cnx_mgr *cm_get_cm_ctx_fl(struct wlan_objmgr_vdev *vdev,
 #define cm_get_cm_ctx(vdev) \
 	cm_get_cm_ctx_fl(vdev, __func__, __LINE__)
 
+cm_ext_t *cm_get_ext_hdl_fl(struct wlan_objmgr_vdev *vdev,
+			    const char *func, uint32_t line);
+
+/**
+ * cm_get_ext_hdl() - Get connection manager ext context from vdev
+ * @vdev: vdev object pointer
+ *
+ * Return: pointer to connection manager ext context
+ */
+#define cm_get_ext_hdl(vdev) \
+	cm_get_ext_hdl_fl(vdev, __func__, __LINE__)
+
 /**
  * cm_reset_active_cm_id() - Reset active cm_id from cm context, if its same as
  * passed cm_id

+ 16 - 0
umac/mlme/connection_mgr/core/src/wlan_cm_util.c

@@ -65,6 +65,22 @@ struct cnx_mgr *cm_get_cm_ctx_fl(struct wlan_objmgr_vdev *vdev,
 	return cm_ctx;
 }
 
+cm_ext_t *cm_get_ext_hdl_fl(struct wlan_objmgr_vdev *vdev,
+			    const char *func, uint32_t line)
+{
+	struct cnx_mgr *cm_ctx;
+	cm_ext_t *ext_ctx = NULL;
+
+	cm_ctx = cm_get_cm_ctx_fl(vdev, func, line);
+	if (cm_ctx)
+		ext_ctx = cm_ctx->ext_cm_ptr;
+
+	if (!ext_ctx)
+		mlme_nofl_err("%s:%u: vdev %d cm ext ctx is NULL", func, line,
+			      wlan_vdev_get_id(vdev));
+	return ext_ctx;
+}
+
 void cm_reset_active_cm_id(struct wlan_objmgr_vdev *vdev, wlan_cm_id cm_id)
 {
 	struct cnx_mgr *cm_ctx;

+ 23 - 1
umac/mlme/include/wlan_mlme_cmn.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2021 The Linux Foundation. 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
@@ -98,6 +98,8 @@ struct mlme_cm_ops {
  *                                          required by serialization
  * @mlme_multi_vdev_restart_resp:           callback to process multivdev
  *                                          restart response
+ * @mlme_cm_ext_hdl_create_cb:              callback to create ext cm context
+ * @mlme_cm_ext_hdl_destroy_cb:             callback to destroy ext cm context
  * @mlme_cm_ext_connect_start_ind_cb:       callback to indicate connect start
  * @mlme_cm_ext_bss_select_ind_cb:          callback to indicate candidate
  *                                          select for connect
@@ -146,6 +148,8 @@ struct mlme_ext_ops {
 				struct wlan_objmgr_psoc *psoc,
 				struct multi_vdev_restart_resp *resp);
 #ifdef FEATURE_CM_ENABLE
+	QDF_STATUS (*mlme_cm_ext_hdl_create_cb)(struct cnx_mgr *cm_ctx);
+	QDF_STATUS (*mlme_cm_ext_hdl_destroy_cb)(struct cnx_mgr *cm_ctx);
 	QDF_STATUS (*mlme_cm_ext_connect_start_ind_cb)(
 				struct wlan_objmgr_vdev *vdev,
 				struct wlan_cm_connect_req *req);
@@ -373,6 +377,24 @@ QDF_STATUS mlme_vdev_ops_ext_hdl_delete_rsp(struct wlan_objmgr_psoc *psoc,
 					    struct vdev_delete_response *rsp);
 
 #ifdef FEATURE_CM_ENABLE
+/**
+ * mlme_cm_ext_hdl_create() - Connection manager callback to create ext
+ * context
+ * @cm_ctx: common cm context object
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS mlme_cm_ext_hdl_create(struct cnx_mgr *cm_ctx);
+
+/**
+ * mlme_cm_ext_hdl_destroy() - Connection manager callback to destroy ext
+ * context
+ * @cm_ctx: common cm context object
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS mlme_cm_ext_hdl_destroy(struct cnx_mgr *cm_ctx);
+
 /**
  * mlme_cm_connect_start_ind() - Connection manager ext Connect start indication
  * @vdev: VDEV object

+ 21 - 1
umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2021 The Linux Foundation. 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
@@ -247,6 +247,26 @@ QDF_STATUS mlme_vdev_ops_ext_hdl_multivdev_restart_resp(
 }
 
 #ifdef FEATURE_CM_ENABLE
+QDF_STATUS mlme_cm_ext_hdl_create(struct cnx_mgr *cm_ctx)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if (glbl_ops && glbl_ops->mlme_cm_ext_hdl_create_cb)
+		ret = glbl_ops->mlme_cm_ext_hdl_create_cb(cm_ctx);
+
+	return ret;
+}
+
+QDF_STATUS mlme_cm_ext_hdl_destroy(struct cnx_mgr *cm_ctx)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if (glbl_ops && glbl_ops->mlme_cm_ext_hdl_destroy_cb)
+		ret = glbl_ops->mlme_cm_ext_hdl_destroy_cb(cm_ctx);
+
+	return ret;
+}
+
 QDF_STATUS mlme_cm_connect_start_ind(struct wlan_objmgr_vdev *vdev,
 				     struct wlan_cm_connect_req *req)
 {