Преглед изворни кода

qcacld-3.0: Add cnx mgr logic for connect and disconnect ext ind

Add connection manager logic to handle p2p/tdls/policy mgr logics
on connect/disconnect start and complete ext indication. And
add the call to csr to update the legacy structs.

Change-Id: I218a1d193dd62ad041e84078bd2509b82ec11363
CRs-Fixed: 2846663
gaurank kathpalia пре 4 година
родитељ
комит
f8a769a7b6

+ 6 - 1
components/mlme/core/inc/wlan_mlme_main.h

@@ -216,11 +216,16 @@ struct mscs_req_info {
  * struct mlme_connect_info - mlme connect information
  * @timing_meas_cap: Timing meas cap
  * @oem_channel_info: oem channel info
+ * @tdls_chan_swit_prohibited: if tdls chan switch is prohobited by AP
+ * @tdls_prohibited: if tdls is prohobited by AP
  */
-
 struct mlme_connect_info {
 	uint8_t timing_meas_cap;
 	struct oem_channel_info chan_info;
+#ifdef FEATURE_WLAN_TDLS
+	bool tdls_chan_swit_prohibited;
+	bool tdls_prohibited;
+#endif
 };
 
 /**

+ 60 - 0
components/mlme/core/inc/wlan_mlme_vdev_mgr_interface.h

@@ -161,6 +161,66 @@ QDF_STATUS mlme_set_bigtk_support(struct wlan_objmgr_vdev *vdev, bool val);
 
 bool mlme_get_bigtk_support(struct wlan_objmgr_vdev *vdev);
 
+#ifdef FEATURE_WLAN_TDLS
+/**
+ * mlme_set_tdls_chan_switch_prohibited() - set tdls chan switch prohibited
+ * @vdev: vdev pointer
+ * @val: value to be set
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+mlme_set_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev *vdev, bool val);
+
+/**
+ * mlme_get_tdls_chan_switch_prohibited() - get tdls chan switch prohibited
+ * @vdev: vdev pointer
+ *
+ * Return: bool
+ */
+bool mlme_get_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * mlme_set_tdls_prohibited() - set tdls prohibited
+ * @vdev: vdev pointer
+ * @val: value to be set
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+mlme_set_tdls_prohibited(struct wlan_objmgr_vdev *vdev, bool val);
+
+/**
+ * mlme_get_tdls_prohibited() - get tdls prohibited
+ * @vdev: vdev pointer
+ *
+ * Return: bool
+ */
+bool mlme_get_tdls_prohibited(struct wlan_objmgr_vdev *vdev);
+#else
+static inline QDF_STATUS
+mlme_set_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev *vdev, bool val)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+bool mlme_get_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev *vdev)
+{
+	return false;
+}
+
+static inline QDF_STATUS
+mlme_set_tdls_prohibited(struct wlan_objmgr_vdev *vdev, bool val)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline bool mlme_get_tdls_prohibited(struct wlan_objmgr_vdev *vdev)
+{
+	return false;
+}
+#endif
 /**
  * mlme_set_roam_reason_better_ap() - set roam reason better AP
  * @vdev: vdev pointer

+ 61 - 1
components/mlme/core/src/wlan_mlme_vdev_mgr_interface.c

@@ -690,6 +690,64 @@ bool mlme_get_bigtk_support(struct wlan_objmgr_vdev *vdev)
 	return mlme_priv->bigtk_vdev_support;
 }
 
+QDF_STATUS
+mlme_set_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev *vdev, bool val)
+{
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	mlme_priv->connect_info.tdls_chan_swit_prohibited = val;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+bool mlme_get_tdls_chan_switch_prohibited(struct wlan_objmgr_vdev *vdev)
+{
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
+		return false;
+	}
+
+	return mlme_priv->connect_info.tdls_chan_swit_prohibited;
+}
+
+QDF_STATUS
+mlme_set_tdls_prohibited(struct wlan_objmgr_vdev *vdev, bool val)
+{
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	mlme_priv->connect_info.tdls_prohibited = val;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+bool mlme_get_tdls_prohibited(struct wlan_objmgr_vdev *vdev)
+{
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		mlme_legacy_err("vdev legacy private object is NULL");
+		return false;
+	}
+
+	return mlme_priv->connect_info.tdls_prohibited;
+}
+
 QDF_STATUS
 mlme_set_roam_reason_better_ap(struct wlan_objmgr_vdev *vdev, bool val)
 {
@@ -1676,9 +1734,11 @@ static struct mlme_ext_ops ext_ops = {
 	.mlme_vdev_ext_hdl_post_create = vdevmgr_mlme_ext_post_hdl_create,
 	.mlme_vdev_ext_delete_rsp = vdevmgr_vdev_delete_rsp_handle,
 #ifdef FEATURE_CM_ENABLE
+	.mlme_cm_ext_connect_start_ind_cb = cm_connect_start_ind,
 	.mlme_cm_ext_connect_req_cb = cm_handle_connect_req,
 	.mlme_cm_ext_bss_peer_create_req_cb = cm_send_bss_peer_create_req,
-	.mlme_cm_ext_connect_complete_ind_cb = cm_handle_connect_complete,
+	.mlme_cm_ext_connect_complete_ind_cb = cm_connect_complete_ind,
+	.mlme_cm_ext_disconnect_start_ind_cb = cm_disconnect_start_ind,
 	.mlme_cm_ext_disconnect_req_cb = cm_handle_disconnect_req,
 	.mlme_cm_ext_bss_peer_delete_req_cb = cm_send_bss_peer_delete_req,
 	.mlme_cm_ext_disconnect_complete_ind_cb = cm_disconnect_complete_ind,

+ 23 - 1
components/p2p/dispatcher/inc/wlan_p2p_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020 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
@@ -24,6 +24,7 @@
 #define _WLAN_P2P_API_H_
 
 #include <qdf_types.h>
+#include <wlan_objmgr_vdev_obj.h>
 
 /**
  * wlan_p2p_check_oui_and_force_1x1() - Function to get P2P client device
@@ -38,4 +39,25 @@
  * Return: True if OUI is present, else false.
  */
 bool wlan_p2p_check_oui_and_force_1x1(uint8_t *assoc_ie, uint32_t ie_len);
+
+/**
+ * wlan_p2p_cleanup_roc_by_vdev() - Cleanup roc request by vdev
+ * @vdev: pointer to vdev object
+ *
+ * This function call P2P API to cleanup roc request by vdev
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success
+ */
+QDF_STATUS wlan_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wlan_p2p_status_connect() - Update P2P connection status
+ * @vdev: vdev context
+ *
+ * Updates P2P connection status by up layer when connecting.
+ *
+ * Return: QDF_STATUS_SUCCESS - in case of success
+ */
+QDF_STATUS wlan_p2p_status_connect(struct wlan_objmgr_vdev *vdev);
+
 #endif

+ 40 - 1
components/p2p/dispatcher/src/wlan_p2p_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020 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
@@ -24,6 +24,7 @@
 #include <wlan_objmgr_psoc_obj.h>
 #include "wlan_p2p_public_struct.h"
 #include "../../core/src/wlan_p2p_main.h"
+#include "../../core/src/wlan_p2p_roc.h"
 
 bool wlan_p2p_check_oui_and_force_1x1(uint8_t *assoc_ie, uint32_t assoc_ie_len)
 {
@@ -32,3 +33,41 @@ bool wlan_p2p_check_oui_and_force_1x1(uint8_t *assoc_ie, uint32_t assoc_ie_len)
 
 	return p2p_check_oui_and_force_1x1(assoc_ie, assoc_ie_len);
 }
+
+QDF_STATUS wlan_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev)
+{
+	struct p2p_soc_priv_obj *p2p_soc_obj;
+	struct wlan_objmgr_psoc *psoc;
+
+	p2p_debug("vdev:%pK", vdev);
+
+	if (!vdev) {
+		p2p_debug("null vdev");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		p2p_err("null psoc");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
+			WLAN_UMAC_COMP_P2P);
+	if (!p2p_soc_obj) {
+		p2p_err("p2p soc context is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return p2p_cleanup_roc_sync(p2p_soc_obj, vdev);
+}
+
+QDF_STATUS wlan_p2p_status_connect(struct wlan_objmgr_vdev *vdev)
+{
+	if (!vdev) {
+		p2p_err("vdev is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	return p2p_status_connect(vdev);
+}

+ 3 - 30
components/p2p/dispatcher/src/wlan_p2p_ucfg_api.c

@@ -26,6 +26,7 @@
 #include <scheduler_api.h>
 #include "wlan_p2p_public_struct.h"
 #include "wlan_p2p_ucfg_api.h"
+#include "wlan_p2p_api.h"
 #include "../../core/src/wlan_p2p_main.h"
 #include "../../core/src/wlan_p2p_roc.h"
 #include "../../core/src/wlan_p2p_off_chan_tx.h"
@@ -226,30 +227,7 @@ QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc,
 
 QDF_STATUS ucfg_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev)
 {
-	struct p2p_soc_priv_obj *p2p_soc_obj;
-	struct wlan_objmgr_psoc *psoc;
-
-	p2p_debug("vdev:%pK", vdev);
-
-	if (!vdev) {
-		p2p_debug("null vdev");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	psoc = wlan_vdev_get_psoc(vdev);
-	if (!psoc) {
-		p2p_err("null psoc");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
-			WLAN_UMAC_COMP_P2P);
-	if (!p2p_soc_obj) {
-		p2p_err("p2p soc context is NULL");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	return p2p_cleanup_roc_sync(p2p_soc_obj, vdev);
+	return wlan_p2p_cleanup_roc_by_vdev(vdev);
 }
 
 QDF_STATUS ucfg_p2p_cleanup_roc_by_psoc(struct wlan_objmgr_psoc *psoc)
@@ -607,12 +585,7 @@ QDF_STATUS ucfg_p2p_status_scan(struct wlan_objmgr_vdev *vdev)
 
 QDF_STATUS ucfg_p2p_status_connect(struct wlan_objmgr_vdev *vdev)
 {
-	if (!vdev) {
-		p2p_err("vdev is NULL");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	return p2p_status_connect(vdev);
+	return wlan_p2p_status_connect(vdev);
 }
 
 QDF_STATUS ucfg_p2p_status_disconnect(struct wlan_objmgr_vdev *vdev)

+ 56 - 0
components/tdls/dispatcher/inc/wlan_tdls_api.h

@@ -24,6 +24,7 @@
 #include "wlan_objmgr_pdev_obj.h"
 #include "wlan_objmgr_vdev_obj.h"
 
+#ifdef FEATURE_WLAN_TDLS
 /**
  * wlan_tdls_teardown_links() - notify TDLS module to teardown all TDLS links
  * @psoc: psoc object
@@ -39,4 +40,59 @@ QDF_STATUS wlan_tdls_teardown_links(struct wlan_objmgr_psoc *psoc);
  * Return: None
  */
 void wlan_tdls_teardown_links_sync(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * wlan_tdls_notify_sta_disconnect() - notify sta disconnect
+ * @vdev_id: pointer to soc object
+ * @lfr_roam: indicate, whether disconnect due to lfr roam
+ * @bool user_disconnect: disconnect from user space
+ * @vdev: vdev object manager
+ *
+ * Notify sta disconnect event to TDLS component
+ *
+ * Return: QDF_STATUS
+ */
+void wlan_tdls_notify_sta_disconnect(uint8_t vdev_id,
+				     bool lfr_roam, bool user_disconnect,
+				     struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wlan_tdls_notify_sta_connect() - notify sta connect to TDLS
+ * @vdev_id: pointer to soc object
+ * @tdls_chan_swit_prohibited: indicates channel switch capability
+ * @tdls_prohibited: indicates tdls allowed or not
+ * @vdev: vdev object manager
+ *
+ * Notify sta connect event to TDLS component
+ *
+ * Return: None
+ */
+void
+wlan_tdls_notify_sta_connect(uint8_t vdev_id,
+			     bool tdls_chan_swit_prohibited,
+			     bool tdls_prohibited,
+			     struct wlan_objmgr_vdev *vdev);
+
+#else
+static inline QDF_STATUS wlan_tdls_teardown_links(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline void wlan_tdls_teardown_links_sync(struct wlan_objmgr_psoc *psoc)
+{}
+
+static inline
+void wlan_tdls_notify_sta_disconnect(uint8_t vdev_id,
+				     bool lfr_roam, bool user_disconnect,
+				     struct wlan_objmgr_vdev *vdev)
+{}
+
+static inline void
+wlan_tdls_notify_sta_connect(uint8_t vdev_id,
+			     bool tdls_chan_swit_prohibited,
+			     bool tdls_prohibited,
+			     struct wlan_objmgr_vdev *vdev) {}
+
+#endif
 #endif

+ 36 - 9
components/tdls/dispatcher/inc/wlan_tdls_ucfg_api.h

@@ -176,22 +176,35 @@ void ucfg_tdls_teardown_links_sync(struct wlan_objmgr_psoc *psoc);
 QDF_STATUS ucfg_tdls_notify_reset_adapter(struct wlan_objmgr_vdev *vdev);
 
 /**
- * ucfg_tdls_notify_sta_connect() - notify sta connect
- * @notify_info: sta notification info
+ * ucfg_tdls_notify_sta_connect() - notify sta connect to TDLS
+ * @vdev_id: pointer to soc object
+ * @tdls_chan_swit_prohibited: indicates channel switch capability
+ * @tdls_prohibited: indicates tdls allowed or not
+ * @vdev: vdev object manager
  *
- * Return: QDF_STATUS
+ * Notify sta connect event to TDLS component
+ *
+ * Return: None
  */
-QDF_STATUS ucfg_tdls_notify_sta_connect(
-			struct tdls_sta_notify_params *notify_info);
+void ucfg_tdls_notify_sta_connect(uint8_t vdev_id,
+				  bool tdls_chan_swit_prohibited,
+				  bool tdls_prohibited,
+				  struct wlan_objmgr_vdev *vdev);
 
 /**
  * ucfg_tdls_notify_sta_disconnect() - notify sta disconnect
- * @notify_info: sta notification info
+ * @vdev_id: pointer to soc object
+ * @lfr_roam: indicate, whether disconnect due to lfr roam
+ * @bool user_disconnect: disconnect from user space
+ * @vdev: vdev object manager
  *
- * Return: QDF_STATUS
+ * Notify sta disconnect event to TDLS component
+ *
+ * Return: None
  */
-QDF_STATUS ucfg_tdls_notify_sta_disconnect(
-			struct tdls_sta_notify_params *notify_info);
+void ucfg_tdls_notify_sta_disconnect(uint8_t vdev_id,
+				     bool lfr_roam, bool user_disconnect,
+				     struct wlan_objmgr_vdev *vdev);
 
 /**
  * ucfg_tdls_set_operating_mode() - set operating mode
@@ -375,6 +388,20 @@ void ucfg_tdls_notify_connect_failure(struct wlan_objmgr_psoc *psoc)
 {
 }
 
+static inline
+void ucfg_tdls_notify_sta_connect(uint8_t vdev_id,
+				  bool tdls_chan_swit_prohibited,
+				  bool tdls_prohibited,
+				  struct wlan_objmgr_vdev *vdev)
+{
+}
+
+static inline
+void ucfg_tdls_notify_sta_disconnect(uint8_t vdev_id,
+				     bool lfr_roam, bool user_disconnect,
+				     struct wlan_objmgr_vdev *vdev)
+{}
+
 static inline
 struct wlan_objmgr_vdev *ucfg_get_tdls_vdev(struct wlan_objmgr_psoc *psoc,
 					    wlan_objmgr_ref_dbgid dbg_id)

+ 142 - 0
components/tdls/dispatcher/src/wlan_tdls_api.c

@@ -109,3 +109,145 @@ release_ref:
 	wlan_objmgr_vdev_release_ref(vdev,
 				     WLAN_TDLS_NB_ID);
 }
+
+static QDF_STATUS tdls_notify_flush_cb(struct scheduler_msg *msg)
+{
+	struct tdls_sta_notify_params *notify = msg->bodyptr;
+	struct wlan_objmgr_vdev *vdev = notify->vdev;
+
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_TDLS_NB_ID);
+	qdf_mem_free(notify);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS
+tdls_notify_disconnect(struct tdls_sta_notify_params *notify_info)
+{
+	struct scheduler_msg msg = {0, };
+	struct tdls_sta_notify_params *notify;
+	QDF_STATUS status;
+
+	if (!notify_info || !notify_info->vdev) {
+		tdls_err("notify_info %pK", notify_info);
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	tdls_debug("Enter ");
+
+	notify = qdf_mem_malloc(sizeof(*notify));
+	if (!notify) {
+		wlan_objmgr_vdev_release_ref(notify_info->vdev, WLAN_TDLS_NB_ID);
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	*notify = *notify_info;
+
+	msg.bodyptr = notify;
+	msg.callback = tdls_process_cmd;
+	msg.type = TDLS_NOTIFY_STA_DISCONNECTION;
+	msg.flush_callback = tdls_notify_flush_cb;
+	status = scheduler_post_message(QDF_MODULE_ID_HDD,
+					QDF_MODULE_ID_TDLS,
+					QDF_MODULE_ID_TARGET_IF, &msg);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		wlan_objmgr_vdev_release_ref(notify->vdev, WLAN_TDLS_NB_ID);
+		qdf_mem_free(notify);
+	}
+
+	tdls_debug("Exit ");
+
+	return QDF_STATUS_SUCCESS;
+}
+
+void wlan_tdls_notify_sta_disconnect(uint8_t vdev_id,
+				     bool lfr_roam, bool user_disconnect,
+				     struct wlan_objmgr_vdev *vdev)
+{
+	struct tdls_sta_notify_params notify_info = {0};
+	QDF_STATUS status;
+
+	if (!vdev) {
+		tdls_err("vdev is NULL");
+		return;
+	}
+
+	status = wlan_objmgr_vdev_try_get_ref(vdev, WLAN_TDLS_NB_ID);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		tdls_err("can't get vdev");
+		return;
+	}
+
+	notify_info.session_id = vdev_id;
+	notify_info.lfr_roam = lfr_roam;
+	notify_info.tdls_chan_swit_prohibited = false;
+	notify_info.tdls_prohibited = false;
+	notify_info.vdev = vdev;
+	notify_info.user_disconnect = user_disconnect;
+	tdls_notify_disconnect(&notify_info);
+}
+
+static QDF_STATUS
+tdls_notify_connect(struct tdls_sta_notify_params *notify_info)
+{
+	struct scheduler_msg msg = {0, };
+	struct tdls_sta_notify_params *notify;
+	QDF_STATUS status;
+
+	if (!notify_info || !notify_info->vdev) {
+		tdls_err("notify_info %pK", notify_info);
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+	tdls_debug("Enter ");
+
+	notify = qdf_mem_malloc(sizeof(*notify));
+	if (!notify) {
+		wlan_objmgr_vdev_release_ref(notify_info->vdev,
+					     WLAN_TDLS_NB_ID);
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	*notify = *notify_info;
+
+	msg.bodyptr = notify;
+	msg.callback = tdls_process_cmd;
+	msg.type = TDLS_NOTIFY_STA_CONNECTION;
+	msg.flush_callback = tdls_notify_flush_cb;
+	status = scheduler_post_message(QDF_MODULE_ID_HDD,
+					QDF_MODULE_ID_TDLS,
+					QDF_MODULE_ID_TARGET_IF, &msg);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		wlan_objmgr_vdev_release_ref(notify->vdev, WLAN_TDLS_NB_ID);
+		qdf_mem_free(notify);
+	}
+
+	tdls_debug("Exit ");
+	return status;
+}
+
+void
+wlan_tdls_notify_sta_connect(uint8_t session_id,
+			     bool tdls_chan_swit_prohibited,
+			     bool tdls_prohibited,
+			     struct wlan_objmgr_vdev *vdev)
+{
+	struct tdls_sta_notify_params notify_info = {0};
+	QDF_STATUS status;
+
+	if (!vdev) {
+		tdls_err("vdev is NULL");
+		return;
+	}
+	status = wlan_objmgr_vdev_try_get_ref(vdev, WLAN_TDLS_NB_ID);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		tdls_err("can't get vdev");
+		return;
+	}
+
+	notify_info.session_id = session_id;
+	notify_info.vdev = vdev;
+	notify_info.tdls_chan_swit_prohibited = tdls_chan_swit_prohibited;
+	notify_info.tdls_prohibited = tdls_prohibited;
+	tdls_notify_connect(&notify_info);
+}
+

+ 11 - 75
components/tdls/dispatcher/src/wlan_tdls_ucfg_api.c

@@ -491,10 +491,6 @@ static QDF_STATUS ucfg_tdls_post_msg_flush_cb(struct scheduler_msg *msg)
 	case TDLS_NOTIFY_RESET_ADAPTERS:
 		ptr = NULL;
 		break;
-	case TDLS_NOTIFY_STA_CONNECTION:
-	case TDLS_NOTIFY_STA_DISCONNECTION:
-		vdev = ((struct tdls_sta_notify_params *)ptr)->vdev;
-		break;
 	case TDLS_CMD_SET_TDLS_MODE:
 		vdev = ((struct tdls_set_mode_params *)ptr)->vdev;
 		break;
@@ -856,81 +852,21 @@ QDF_STATUS ucfg_tdls_notify_reset_adapter(struct wlan_objmgr_vdev *vdev)
 	return status;
 }
 
-QDF_STATUS ucfg_tdls_notify_sta_connect(
-	struct tdls_sta_notify_params *notify_info)
+void ucfg_tdls_notify_sta_connect(uint8_t vdev_id,
+				  bool tdls_chan_swit_prohibited,
+				  bool tdls_prohibited,
+				  struct wlan_objmgr_vdev *vdev)
 {
-	struct scheduler_msg msg = {0, };
-	struct tdls_sta_notify_params *notify;
-	QDF_STATUS status;
-
-	if (!notify_info || !notify_info->vdev) {
-		tdls_err("notify_info %pK", notify_info);
-		return QDF_STATUS_E_NULL_VALUE;
-	}
-	tdls_debug("Enter ");
-
-	notify = qdf_mem_malloc(sizeof(*notify));
-	if (!notify) {
-		wlan_objmgr_vdev_release_ref(notify_info->vdev,
-					     WLAN_TDLS_NB_ID);
-		return QDF_STATUS_E_NULL_VALUE;
-	}
-
-	*notify = *notify_info;
-
-	msg.bodyptr = notify;
-	msg.callback = tdls_process_cmd;
-	msg.type = TDLS_NOTIFY_STA_CONNECTION;
-	msg.flush_callback = ucfg_tdls_post_msg_flush_cb;
-	status = scheduler_post_message(QDF_MODULE_ID_HDD,
-					QDF_MODULE_ID_TDLS,
-					QDF_MODULE_ID_TARGET_IF, &msg);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		wlan_objmgr_vdev_release_ref(notify->vdev, WLAN_TDLS_NB_ID);
-		qdf_mem_free(notify);
-	}
-
-	tdls_debug("Exit ");
-	return status;
+	wlan_tdls_notify_sta_connect(vdev_id, tdls_chan_swit_prohibited,
+				     tdls_prohibited, vdev);
 }
 
-QDF_STATUS ucfg_tdls_notify_sta_disconnect(
-			struct tdls_sta_notify_params *notify_info)
+void ucfg_tdls_notify_sta_disconnect(uint8_t vdev_id,
+				     bool lfr_roam, bool user_disconnect,
+				     struct wlan_objmgr_vdev *vdev)
 {
-	struct scheduler_msg msg = {0, };
-	struct tdls_sta_notify_params *notify;
-	QDF_STATUS status;
-
-	if (!notify_info || !notify_info->vdev) {
-		tdls_err("notify_info %pK", notify_info);
-		return QDF_STATUS_E_NULL_VALUE;
-	}
-
-	tdls_debug("Enter ");
-
-	notify = qdf_mem_malloc(sizeof(*notify));
-	if (!notify) {
-		wlan_objmgr_vdev_release_ref(notify_info->vdev, WLAN_TDLS_NB_ID);
-		return QDF_STATUS_E_NULL_VALUE;
-	}
-
-	*notify = *notify_info;
-
-	msg.bodyptr = notify;
-	msg.callback = tdls_process_cmd;
-	msg.type = TDLS_NOTIFY_STA_DISCONNECTION;
-	msg.flush_callback = ucfg_tdls_post_msg_flush_cb;
-	status = scheduler_post_message(QDF_MODULE_ID_HDD,
-					QDF_MODULE_ID_TDLS,
-					QDF_MODULE_ID_TARGET_IF, &msg);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		wlan_objmgr_vdev_release_ref(notify->vdev, WLAN_TDLS_NB_ID);
-		qdf_mem_free(notify);
-	}
-
-	tdls_debug("Exit ");
-
-	return QDF_STATUS_SUCCESS;
+	wlan_tdls_notify_sta_disconnect(vdev_id, lfr_roam, user_disconnect,
+					vdev);
 }
 
 QDF_STATUS ucfg_tdls_set_operating_mode(

+ 78 - 5
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_api.h

@@ -94,6 +94,31 @@ struct cm_peer_create_req {
 	struct qdf_mac_addr peer_mac;
 };
 
+/**
+ * cm_connect_start_ind() - Connection manager ext connect start indication
+ * vdev and peer assoc state machine
+ * @vdev: VDEV object
+ * @req: connect request
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS cm_connect_start_ind(struct wlan_objmgr_vdev *vdev,
+				struct wlan_cm_connect_req *req);
+
+/**
+ * cm_csr_handle_connect_req() - Connection manager cb to csr to fill csr
+ * session and update join req from legacy structures
+ * @vdev: VDEV object
+ * @req: Vdev connect request
+ * @join_req: join req to be sent to LIM
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+cm_csr_handle_connect_req(struct wlan_objmgr_vdev *vdev,
+			  struct wlan_cm_vdev_connect_req *req,
+			  struct cm_vdev_join_req *join_req);
+
 /**
  * cm_handle_connect_req() - Connection manager ext connect request to start
  * vdev and peer assoc state machine
@@ -119,7 +144,7 @@ cm_send_bss_peer_create_req(struct wlan_objmgr_vdev *vdev,
 			    struct qdf_mac_addr *peer_mac);
 
 /**
- * cm_handle_connect_complete() - Connection manager ext connect complete
+ * cm_connect_complete_ind() - Connection manager ext connect complete
  * indication
  * @vdev: VDEV object
  * @rsp: Connection manager connect response
@@ -127,8 +152,32 @@ cm_send_bss_peer_create_req(struct wlan_objmgr_vdev *vdev,
  * Return: QDF_STATUS
  */
 QDF_STATUS
-cm_handle_connect_complete(struct wlan_objmgr_vdev *vdev,
-			   struct wlan_cm_connect_resp *rsp);
+cm_connect_complete_ind(struct wlan_objmgr_vdev *vdev,
+			struct wlan_cm_connect_resp *rsp);
+
+/**
+ * cm_csr_connect_done_ind() - Connection manager call to csr to update
+ * legacy structures on connect complete
+ * @vdev: VDEV object
+ * @rsp: Connection manager connect response
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+cm_csr_connect_done_ind(struct wlan_objmgr_vdev *vdev,
+			struct wlan_cm_connect_resp *rsp);
+
+/**
+ * cm_disconnect_start_ind() - Connection manager ext disconnect start
+ * indication
+ * vdev and peer assoc state machine
+ * @vdev: VDEV object
+ * @req: disconnect request
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS cm_disconnect_start_ind(struct wlan_objmgr_vdev *vdev,
+				   struct wlan_cm_disconnect_req *req);
 
 /**
  * cm_handle_disconnect_req() - Connection manager ext disconnect
@@ -142,6 +191,18 @@ QDF_STATUS
 cm_handle_disconnect_req(struct wlan_objmgr_vdev *vdev,
 			 struct wlan_cm_vdev_discon_req *req);
 
+/**
+ * cm_csr_handle_diconnect_req() - Connection manager cb to csr to update legacy
+ * structures on disconnect
+ * @vdev: VDEV object
+ * @req: vdev disconnect request
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+cm_csr_handle_diconnect_req(struct wlan_objmgr_vdev *vdev,
+			    struct wlan_cm_vdev_discon_req *req);
+
 /**
  * cm_send_bss_peer_delete_req() - Connection manager ext bss peer delete
  * request
@@ -164,6 +225,18 @@ QDF_STATUS
 cm_disconnect_complete_ind(struct wlan_objmgr_vdev *vdev,
 			   struct wlan_cm_discon_rsp *rsp);
 
+/**
+ * cm_csr_diconnect_done_ind() - Connection manager call to csr to update
+ * legacy structures on disconnect complete
+ * @vdev: VDEV object
+ * @rsp: Connection manager disconnect response
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+cm_csr_diconnect_done_ind(struct wlan_objmgr_vdev *vdev,
+			  struct wlan_cm_discon_rsp *rsp);
+
 /**
  * cm_send_vdev_down_req() - Connection manager ext req to send vdev down
  * to FW
@@ -227,14 +300,14 @@ QDF_STATUS cm_disconnect(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
 			 struct qdf_mac_addr *bssid);
 
 /**
- * cm_disconnect_indication() - Process vdev discon ind and send to CM
+ * cm_send_sb_disconnect_req() - Process vdev discon ind from sb and send to CM
  * @msg: scheduler message
  *
  * Process disconnect indication and send it to CM SM.
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS cm_disconnect_indication(struct scheduler_msg *msg);
+QDF_STATUS cm_send_sb_disconnect_req(struct scheduler_msg *msg);
 
 /**
  * wlan_cm_send_connect_rsp() - Process vdev join rsp and send to CM

+ 64 - 2
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_connect.c

@@ -23,6 +23,33 @@
 #include "wlan_scan_utils_api.h"
 #include "wlan_mlme_dbg.h"
 #include "wlan_cm_api.h"
+#include "wlan_policy_mgr_api.h"
+#include "wlan_p2p_api.h"
+#include "wlan_tdls_api.h"
+#include "wlan_mlme_vdev_mgr_interface.h"
+
+QDF_STATUS cm_connect_start_ind(struct wlan_objmgr_vdev *vdev,
+				struct wlan_cm_connect_req *req)
+{
+	struct wlan_objmgr_psoc *psoc;
+
+	if (!vdev || !req) {
+		mlme_err("vdev or req is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		mlme_err("vdev_id: %d psoc not found", req->vdev_id);
+		return QDF_STATUS_E_INVAL;
+	}
+	if (policy_mgr_is_sta_mon_concurrency(psoc))
+		return QDF_STATUS_E_NOSUPPORT;
+
+	/* Fill orig RSN caps in connect config to sent in RSO */
+
+	return QDF_STATUS_SUCCESS;
+}
 
 void cm_free_join_req(struct cm_vdev_join_req *join_req)
 {
@@ -138,6 +165,14 @@ cm_handle_connect_req(struct wlan_objmgr_vdev *vdev,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	status = cm_csr_handle_connect_req(vdev, req, join_req);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mlme_err("vdev_id: %d cm_id 0x%x : fail to fill params from legacy",
+			 req->vdev_id, req->cm_id);
+		cm_free_join_req(join_req);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	msg.bodyptr = join_req;
 	msg.callback = cm_process_join_req;
 	msg.flush_callback = cm_flush_join_req;
@@ -185,9 +220,36 @@ cm_send_bss_peer_create_req(struct wlan_objmgr_vdev *vdev,
 }
 
 QDF_STATUS
-cm_handle_connect_complete(struct wlan_objmgr_vdev *vdev,
-			   struct wlan_cm_connect_resp *rsp)
+cm_connect_complete_ind(struct wlan_objmgr_vdev *vdev,
+			struct wlan_cm_connect_resp *rsp)
 {
+	uint8_t vdev_id;
+	struct wlan_objmgr_psoc *psoc;
+	enum QDF_OPMODE op_mode;
+
+	if (!vdev || !rsp) {
+		mlme_err("vdev or rsp is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	vdev_id = wlan_vdev_get_id(vdev);
+	op_mode = wlan_vdev_mlme_get_opmode(vdev);
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		mlme_err("vdev_id: %d psoc not found", vdev_id);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	cm_csr_connect_done_ind(vdev, rsp);
+	/* start wait for key timer */
+
+	if (QDF_IS_STATUS_SUCCESS(rsp->connect_status))
+		policy_mgr_incr_active_session(psoc, op_mode, vdev_id);
+	wlan_tdls_notify_sta_connect(vdev_id,
+				     mlme_get_tdls_chan_switch_prohibited(vdev),
+				     mlme_get_tdls_prohibited(vdev), vdev);
+	wlan_p2p_status_connect(vdev);
+
 	return QDF_STATUS_SUCCESS;
 }
 

+ 58 - 1
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_disconnect.c

@@ -22,6 +22,40 @@
 #include "wlan_cm_vdev_api.h"
 #include "wlan_mlme_main.h"
 #include "wlan_cm_api.h"
+#include "wlan_p2p_api.h"
+#include "wlan_tdls_api.h"
+#include <wlan_policy_mgr_api.h>
+#include <wlan_objmgr_psoc_obj.h>
+#include <wlan_objmgr_pdev_obj.h>
+#include <wlan_objmgr_vdev_obj.h>
+#include <wlan_cm_roam_api.h>
+
+QDF_STATUS cm_disconnect_start_ind(struct wlan_objmgr_vdev *vdev,
+				   struct wlan_cm_disconnect_req *req)
+{
+	struct wlan_objmgr_pdev *pdev;
+	bool user_disconnect;
+
+	if (!vdev || !req) {
+		mlme_err("vdev or req is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	pdev = wlan_vdev_get_pdev(vdev);
+	if (!pdev) {
+		mlme_err("vdev_id: %d pdev not found", req->vdev_id);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	user_disconnect = req->source == CM_OSIF_CONNECT ? true : false;
+	wlan_p2p_cleanup_roc_by_vdev(vdev);
+	wlan_tdls_notify_sta_disconnect(req->vdev_id, false, user_disconnect,
+					vdev);
+	wlan_cm_abort_rso(pdev, req->vdev_id);
+	/* stop wait for key timer */
+
+	return QDF_STATUS_SUCCESS;
+}
 
 QDF_STATUS
 cm_handle_disconnect_req(struct wlan_objmgr_vdev *vdev,
@@ -41,6 +75,8 @@ cm_handle_disconnect_req(struct wlan_objmgr_vdev *vdev,
 	if (!discon_req)
 		return QDF_STATUS_E_NOMEM;
 
+	cm_csr_handle_diconnect_req(vdev, req);
+
 	qdf_mem_copy(discon_req, req, sizeof(*req));
 	msg.bodyptr = discon_req;
 	msg.callback = cm_process_disconnect_req;
@@ -58,6 +94,27 @@ QDF_STATUS
 cm_disconnect_complete_ind(struct wlan_objmgr_vdev *vdev,
 			   struct wlan_cm_discon_rsp *rsp)
 {
+	uint8_t vdev_id;
+	struct wlan_objmgr_psoc *psoc;
+	enum QDF_OPMODE op_mode;
+
+	if (!vdev || !rsp) {
+		mlme_err("vdev or rsp is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+	cm_csr_diconnect_done_ind(vdev, rsp);
+
+	vdev_id = wlan_vdev_get_id(vdev);
+	op_mode = wlan_vdev_mlme_get_opmode(vdev);
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		mlme_err("vdev_id: %d psoc not found", vdev_id);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	wlan_tdls_notify_sta_disconnect(vdev_id, false, false, vdev);
+	policy_mgr_decr_session_set_pcl(psoc, op_mode, vdev_id);
+
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -97,7 +154,7 @@ QDF_STATUS cm_disconnect(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
 	return status;
 }
 
-QDF_STATUS cm_disconnect_indication(struct scheduler_msg *msg)
+QDF_STATUS cm_send_sb_disconnect_req(struct scheduler_msg *msg)
 {
 	struct cm_vdev_discon_ind *ind;
 	QDF_STATUS status;

+ 11 - 6
core/hdd/src/wlan_hdd_assoc.c

@@ -1548,8 +1548,8 @@ static void hdd_send_association_event(struct net_device *dev,
 
 	/* Update tdls module about the disconnection event */
 	if (MLME_IS_ROAM_SYNCH_IN_PROGRESS(hdd_ctx->psoc, adapter->vdev_id))
-		hdd_notify_sta_disconnect(adapter->vdev_id, true, false,
-					  adapter->vdev);
+		ucfg_tdls_notify_sta_disconnect(adapter->vdev_id, true, false,
+						adapter->vdev);
 
 	if (eConnectionState_Associated == sta_ctx->conn_info.conn_state) {
 		struct oem_channel_info chan_info = {0};
@@ -1622,13 +1622,15 @@ static void hdd_send_association_event(struct net_device *dev,
 
 #ifdef FEATURE_WLAN_TDLS
 		/* Update tdls module about connection event */
-		hdd_notify_sta_connect(adapter->vdev_id,
-				       roam_info->tdls_chan_swit_prohibited,
-				       roam_info->tdls_prohibited,
-				       adapter->vdev);
+		ucfg_tdls_notify_sta_connect(adapter->vdev_id,
+					     roam_info->tdls_chan_swit_prohibited,
+					     roam_info->tdls_prohibited,
+					     adapter->vdev);
 #endif
 
 		hdd_cm_handle_assoc_event(adapter->vdev, peer_macaddr.bytes);
+		ucfg_p2p_status_connect(adapter->vdev);
+
 	} else {                /* Not Associated */
 		hdd_nofl_info("%s(vdevid-%d): disconnected", dev->name,
 			      adapter->vdev_id);
@@ -1636,6 +1638,9 @@ static void hdd_send_association_event(struct net_device *dev,
 		policy_mgr_decr_session_set_pcl(hdd_ctx->psoc,
 				adapter->device_mode, adapter->vdev_id);
 		hdd_handle_disassociation_event(adapter, &peer_macaddr);
+		/* Update tdls module about the disconnection event */
+		ucfg_tdls_notify_sta_disconnect(adapter->vdev_id, false, false,
+						adapter->vdev);
 	}
 	hdd_ipa_set_tx_flow_info();
 

+ 2 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -21229,8 +21229,8 @@ static int __wlan_hdd_cfg80211_disconnect(struct wiphy *wiphy,
 
 		wlan_hdd_cleanup_remain_on_channel_ctx(adapter);
 		/* First clean up the tdls peers if any */
-		hdd_notify_sta_disconnect(adapter->vdev_id,
-					  false, true, vdev);
+		ucfg_tdls_notify_sta_disconnect(adapter->vdev_id,
+						false, true, vdev);
 		hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_ID);
 
 		hdd_nofl_info("%s(vdevid-%d): Received Disconnect reason:%d %s",

+ 0 - 4
core/hdd/src/wlan_hdd_cm_connect.c

@@ -97,8 +97,6 @@ void hdd_cm_handle_assoc_event(struct wlan_objmgr_vdev *vdev, uint8_t *peer_mac)
 		return;
 	}
 
-	ucfg_p2p_status_connect(adapter->vdev);
-
 	ret = hdd_objmgr_set_peer_mlme_state(adapter->vdev,
 					     WLAN_ASSOC_STATE);
 	if (ret)
@@ -464,8 +462,6 @@ hdd_cm_connect_success_pre_user_update(struct wlan_objmgr_vdev *vdev,
 	 * FEATURE_WLAN_WAPI, hdd_send_association_event,
 	 */
 
-	policy_mgr_incr_active_session(hdd_ctx->psoc,
-				adapter->device_mode, adapter->vdev_id);
 	hdd_green_ap_start_state_mc(hdd_ctx, adapter->device_mode, true);
 
 	hdd_cm_handle_assoc_event(vdev, rsp->bssid.bytes);

+ 0 - 3
core/hdd/src/wlan_hdd_cm_disconnect.c

@@ -64,9 +64,6 @@ void hdd_handle_disassociation_event(struct hdd_adapter *adapter,
 						adapter->device_mode);
 
 	hdd_lpass_notify_disconnect(adapter);
-	/* Update tdls module about the disconnection event */
-	hdd_notify_sta_disconnect(adapter->vdev_id, false, false,
-				  adapter->vdev);
 
 	hdd_del_latency_critical_client(
 		adapter,

+ 0 - 2
core/mac/src/pe/include/lim_session.h

@@ -390,8 +390,6 @@ struct pe_session {
 	  * AP network
 	  */
 	uint32_t peerAIDBitmap[2];
-	bool tdls_prohibited;
-	bool tdls_chan_swit_prohibited;
 	bool tdls_send_set_state_disable;
 #endif
 	bool fWaitForProbeRsp;

+ 7 - 5
core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c

@@ -435,8 +435,9 @@ static void lim_update_stads_ext_cap(struct mac_context *mac_ctx,
 	if (!assoc_rsp->ExtCap.present) {
 		sta_ds->timingMeasCap = 0;
 #ifdef FEATURE_WLAN_TDLS
-		session_entry->tdls_prohibited = false;
-		session_entry->tdls_chan_swit_prohibited = false;
+		mlme_set_tdls_prohibited(session_entry->vdev, false);
+		mlme_set_tdls_chan_switch_prohibited(session_entry->vdev,
+						     false);
 #endif
 		pe_debug("ExtCap not present");
 		return;
@@ -456,9 +457,10 @@ static void lim_update_stads_ext_cap(struct mac_context *mac_ctx,
 	}
 
 #ifdef FEATURE_WLAN_TDLS
-	session_entry->tdls_prohibited = ext_cap->tdls_prohibited;
-	session_entry->tdls_chan_swit_prohibited =
-		ext_cap->tdls_chan_swit_prohibited;
+	mlme_set_tdls_prohibited(session_entry->vdev, ext_cap->tdls_prohibited);
+	mlme_set_tdls_chan_switch_prohibited(session_entry->vdev,
+					    ext_cap->tdls_chan_swit_prohibited);
+		;
 	pe_debug("ExtCap: tdls_prohibited: %d tdls_chan_swit_prohibited: %d",
 		ext_cap->tdls_prohibited,
 		ext_cap->tdls_chan_swit_prohibited);

+ 9 - 9
core/mac/src/pe/lim/lim_process_tdls.c

@@ -339,7 +339,7 @@ static void populate_dot11f_tdls_ext_capability(struct mac_context *mac,
 	 * IE in assoc/re-assoc response.
 	 */
 	if ((1 == mac->lim.gLimTDLSOffChannelEnabled) &&
-	    (!pe_session->tdls_chan_swit_prohibited)) {
+	    (!mlme_get_tdls_chan_switch_prohibited(pe_session->vdev))) {
 		p_ext_cap->tdls_channel_switching = 1;
 		p_ext_cap->tdls_chan_swit_prohibited = 0;
 	} else {
@@ -855,7 +855,7 @@ static QDF_STATUS lim_send_tdls_dis_rsp_frame(struct mac_context *mac,
 	 * IE in assoc/re-assoc response.
 	 */
 	if ((1 == mac->lim.gLimTDLSOffChannelEnabled) &&
-	    (!pe_session->tdls_chan_swit_prohibited)) {
+	    (!mlme_get_tdls_chan_switch_prohibited(pe_session->vdev))) {
 		populate_dot11f_tdls_offchannel_params(mac, pe_session,
 						       &tdlsDisRsp.SuppChannels,
 						       &tdlsDisRsp.
@@ -867,7 +867,7 @@ static QDF_STATUS lim_send_tdls_dis_rsp_frame(struct mac_context *mac,
 	} else {
 		pe_debug("TDLS offchan not enabled, or channel switch prohibited by AP, gLimTDLSOffChannelEnabled: %d tdls_chan_swit_prohibited: %d",
 			mac->lim.gLimTDLSOffChannelEnabled,
-			pe_session->tdls_chan_swit_prohibited);
+			mlme_get_tdls_chan_switch_prohibited(pe_session->vdev));
 	}
 	/*
 	 * now we pack it.  First, how much space are we going to need?
@@ -1081,9 +1081,9 @@ void lim_set_tdls_flags(struct roam_offload_synch_ind *roam_sync_ind_ptr,
 		   struct pe_session *ft_session_ptr)
 {
 	roam_sync_ind_ptr->join_rsp->tdls_prohibited =
-		ft_session_ptr->tdls_prohibited;
+		mlme_get_tdls_prohibited(ft_session_ptr->vdev);
 	roam_sync_ind_ptr->join_rsp->tdls_chan_swit_prohibited =
-		ft_session_ptr->tdls_chan_swit_prohibited;
+		mlme_get_tdls_chan_switch_prohibited(ft_session_ptr->vdev);
 }
 
 /*
@@ -1224,7 +1224,7 @@ QDF_STATUS lim_send_tdls_link_setup_req_frame(struct mac_context *mac,
 	 * IE in assoc/re-assoc response.
 	 */
 	if ((1 == mac->lim.gLimTDLSOffChannelEnabled) &&
-	    (!pe_session->tdls_chan_swit_prohibited)) {
+	    (!mlme_get_tdls_chan_switch_prohibited(pe_session->vdev))) {
 		populate_dot11f_tdls_offchannel_params(mac, pe_session,
 						     &tdlsSetupReq.SuppChannels,
 						     &tdlsSetupReq.
@@ -1236,7 +1236,7 @@ QDF_STATUS lim_send_tdls_link_setup_req_frame(struct mac_context *mac,
 	} else {
 		pe_debug("TDLS offchan not enabled, or channel switch prohibited by AP, gLimTDLSOffChannelEnabled: %d tdls_chan_swit_prohibited: %d",
 			mac->lim.gLimTDLSOffChannelEnabled,
-			pe_session->tdls_chan_swit_prohibited);
+			mlme_get_tdls_chan_switch_prohibited(pe_session->vdev));
 	}
 	/*
 	 * now we pack it.  First, how much space are we going to need?
@@ -1677,7 +1677,7 @@ static QDF_STATUS lim_send_tdls_setup_rsp_frame(struct mac_context *mac,
 	 * IE in assoc/re-assoc response.
 	 */
 	if ((1 == mac->lim.gLimTDLSOffChannelEnabled) &&
-	    (!pe_session->tdls_chan_swit_prohibited)) {
+	    (!mlme_get_tdls_chan_switch_prohibited(pe_session->vdev))) {
 		populate_dot11f_tdls_offchannel_params(mac, pe_session,
 						    &tdlsSetupRsp.SuppChannels,
 						    &tdlsSetupRsp.
@@ -1689,7 +1689,7 @@ static QDF_STATUS lim_send_tdls_setup_rsp_frame(struct mac_context *mac,
 	} else {
 		pe_debug("TDLS offchan not enabled, or channel switch prohibited by AP, gLimTDLSOffChannelEnabled: %d tdls_chan_swit_prohibited: %d",
 			mac->lim.gLimTDLSOffChannelEnabled,
-			pe_session->tdls_chan_swit_prohibited);
+			mlme_get_tdls_chan_switch_prohibited(pe_session->vdev));
 	}
 	tdlsSetupRsp.Status.status = setupStatus;
 	/*

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

@@ -459,9 +459,11 @@ void lim_send_sme_join_reassoc_rsp(struct mac_context *mac_ctx,
 					sta_ds->timingMeasCap;
 #ifdef FEATURE_WLAN_TDLS
 				sme_join_rsp->tdls_prohibited =
-					session_entry->tdls_prohibited;
+					mlme_get_tdls_prohibited(
+							session_entry->vdev);
 				sme_join_rsp->tdls_chan_swit_prohibited =
-				   session_entry->tdls_chan_swit_prohibited;
+					mlme_get_tdls_chan_switch_prohibited(
+							session_entry->vdev);
 #endif
 				sme_join_rsp->nss = sta_ds->nss;
 				sme_join_rsp->max_rate_flags =
@@ -679,7 +681,7 @@ static void lim_send_sta_disconnect_ind(struct mac_context *mac,
 			ind->disconnect_param.source = CM_SB_DISCONNECT;
 	}
 	ind_msg.bodyptr = ind;
-	ind_msg.callback = cm_disconnect_indication;
+	ind_msg.callback = cm_send_sb_disconnect_req;
 	ind_msg.type = msg->type;
 	qdf_mem_free(msg->bodyptr);
 

+ 2 - 3
core/mac/src/pe/lim/lim_session.c

@@ -611,8 +611,6 @@ struct pe_session *pe_create_session(struct mac_context *mac,
 #ifdef FEATURE_WLAN_TDLS
 	qdf_mem_zero(session_ptr->peerAIDBitmap,
 		    sizeof(session_ptr->peerAIDBitmap));
-	session_ptr->tdls_prohibited = false;
-	session_ptr->tdls_chan_swit_prohibited = false;
 #endif
 	lim_update_tdls_set_state_for_fw(session_ptr, true);
 	session_ptr->fWaitForProbeRsp = 0;
@@ -649,7 +647,8 @@ struct pe_session *pe_create_session(struct mac_context *mac,
 	session_ptr->vdev_id = vdev_id;
 	session_ptr->mac_ctx = mac;
 	session_ptr->opmode = wlan_vdev_mlme_get_opmode(vdev);
-
+	mlme_set_tdls_chan_switch_prohibited(vdev, false);
+	mlme_set_tdls_prohibited(vdev, false);
 	pe_debug("Create PE session: %d opmode %d vdev_id %d  BSSID: "QDF_MAC_ADDR_FMT" Max No of STA: %d",
 		 *sessionId, session_ptr->opmode, vdev_id,
 		 QDF_MAC_ADDR_REF(bssid), numSta);

+ 69 - 0
core/sme/src/csr/csr_api_roam.c

@@ -14428,6 +14428,75 @@ static void csr_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq)
 		csr_populate_basic_rates(b_rates, true, true);
 }
 
+#ifdef FEATURE_CM_ENABLE
+QDF_STATUS cm_csr_handle_connect_req(struct wlan_objmgr_vdev *vdev,
+				     struct wlan_cm_vdev_connect_req *req,
+				     struct cm_vdev_join_req *join_req)
+{
+	struct mac_context *mac_ctx;
+	uint8_t vdev_id = wlan_vdev_get_id(vdev);
+
+	mac_ctx = cds_get_context(QDF_MODULE_ID_SME);
+	if (!mac_ctx)
+		return QDF_STATUS_E_INVAL;
+
+	/* Fill join_req from legacy */
+	csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_JOINING, vdev_id);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+cm_csr_connect_done_ind(struct wlan_objmgr_vdev *vdev,
+			struct wlan_cm_connect_resp *rsp)
+{
+	struct mac_context *mac_ctx;
+	uint8_t vdev_id = wlan_vdev_get_id(vdev);
+
+	mac_ctx = cds_get_context(QDF_MODULE_ID_SME);
+	if (!mac_ctx)
+		return QDF_STATUS_E_INVAL;
+
+	/* Fill legacy structures from resp */
+	csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_JOINED, vdev_id);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS cm_csr_handle_diconnect_req(struct wlan_objmgr_vdev *vdev,
+				       struct wlan_cm_vdev_discon_req *req)
+{
+	struct mac_context *mac_ctx;
+	uint8_t vdev_id = wlan_vdev_get_id(vdev);
+
+	mac_ctx = cds_get_context(QDF_MODULE_ID_SME);
+	if (!mac_ctx)
+		return QDF_STATUS_E_INVAL;
+
+	/* Fill join_req from legacy */
+	csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_JOINING, vdev_id);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+cm_csr_diconnect_done_ind(struct wlan_objmgr_vdev *vdev,
+			  struct wlan_cm_discon_rsp *rsp)
+{
+	struct mac_context *mac_ctx;
+	uint8_t vdev_id = wlan_vdev_get_id(vdev);
+
+	mac_ctx = cds_get_context(QDF_MODULE_ID_SME);
+	if (!mac_ctx)
+		return QDF_STATUS_E_INVAL;
+
+	/* Fill legacy structures from resp */
+	csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_IDLE, vdev_id);
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * The communication between HDD and LIM is thru mailbox (MB).
  * Both sides will access the data structure "struct join_req".

+ 0 - 56
os_if/tdls/inc/wlan_cfg80211_tdls.h

@@ -226,39 +226,6 @@ void wlan_cfg80211_tdls_rx_callback(void *user_data,
  */
 void hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev *vdev);
 
-/**
- * hdd_notify_sta_connect() - notify sta connect to TDLS
- * @session_id: pointer to soc object
- * @tdls_chan_swit_prohibited: indicates channel switch capability
- * @tdls_prohibited: indicates tdls allowed or not
- * @vdev: vdev object manager
- *
- * Notify sta connect event to TDLS component
- *
- * Return: None
- */
-void
-hdd_notify_sta_connect(uint8_t session_id,
-		       bool tdls_chan_swit_prohibited,
-		       bool tdls_prohibited,
-		       struct wlan_objmgr_vdev *vdev);
-
-/**
- * hdd_notify_sta_disconnect() - notify sta disconnect to TDLS
- * @session_id: pointer to soc object
- * @lfr_roam: indicate, whether disconnect due to lfr roam
- * @bool user_disconnect: disconnect from user space
- * @vdev: vdev object manager
- *
- * Notify sta disconnect event to TDLS component
- *
- * Return: None
- */
-void hdd_notify_sta_disconnect(uint8_t session_id,
-			       bool lfr_roam,
-			       bool user_disconnect,
-			       struct wlan_objmgr_vdev *vdev);
-
 #else /* FEATURE_WLAN_TDLS */
 static inline
 QDF_STATUS wlan_cfg80211_tdls_osif_priv_init(struct wlan_objmgr_vdev *vdev)
@@ -276,34 +243,11 @@ hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev *vdev)
 {
 }
 
-static inline void
-hdd_notify_sta_connect(uint8_t session_id,
-		       bool tdls_chan_swit_prohibited,
-		       bool tdls_prohibited,
-		       struct wlan_objmgr_vdev *vdev)
-{
-}
-
-static inline
-void hdd_notify_sta_disconnect(uint8_t session_id,
-			       bool lfr_roam,
-			       bool user_disconnect,
-			       struct wlan_objmgr_vdev *vdev)
-{
-
-}
-
 static inline
 int wlan_cfg80211_tdls_configure_mode(struct wlan_objmgr_vdev *vdev,
 						uint32_t trigger_mode)
 {
 	return 0;
 }
-
-static inline
-void hdd_notify_teardown_tdls_links(struct wlan_objmgr_psoc *psoc)
-{
-
-}
 #endif /* FEATURE_WLAN_TDLS */
 #endif /* _WLAN_CFG80211_TDLS_H_ */

+ 0 - 54
os_if/tdls/src/wlan_cfg80211_tdls.c

@@ -103,60 +103,6 @@ void hdd_notify_tdls_reset_adapter(struct wlan_objmgr_vdev *vdev)
 	ucfg_tdls_notify_reset_adapter(vdev);
 }
 
-void
-hdd_notify_sta_connect(uint8_t session_id,
-		       bool tdls_chan_swit_prohibited,
-		       bool tdls_prohibited,
-		       struct wlan_objmgr_vdev *vdev)
-{
-	struct tdls_sta_notify_params notify_info = {0};
-	QDF_STATUS status;
-
-	if (!vdev) {
-		osif_err("vdev is NULL");
-		return;
-	}
-	status = wlan_objmgr_vdev_try_get_ref(vdev, WLAN_TDLS_NB_ID);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_err("can't get vdev");
-		return;
-	}
-
-	notify_info.session_id = session_id;
-	notify_info.vdev = vdev;
-	notify_info.tdls_chan_swit_prohibited = tdls_chan_swit_prohibited;
-	notify_info.tdls_prohibited = tdls_prohibited;
-	ucfg_tdls_notify_sta_connect(&notify_info);
-}
-
-void hdd_notify_sta_disconnect(uint8_t session_id,
-			       bool lfr_roam,
-			       bool user_disconnect,
-			       struct wlan_objmgr_vdev *vdev)
-{
-	struct tdls_sta_notify_params notify_info = {0};
-	QDF_STATUS status;
-
-	if (!vdev) {
-		osif_err("vdev is NULL");
-		return;
-	}
-
-	status = wlan_objmgr_vdev_try_get_ref(vdev, WLAN_TDLS_NB_ID);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_err("can't get vdev");
-		return;
-	}
-
-	notify_info.session_id = session_id;
-	notify_info.lfr_roam = lfr_roam;
-	notify_info.tdls_chan_swit_prohibited = false;
-	notify_info.tdls_prohibited = false;
-	notify_info.vdev = vdev;
-	notify_info.user_disconnect = user_disconnect;
-	ucfg_tdls_notify_sta_disconnect(&notify_info);
-}
-
 int wlan_cfg80211_tdls_add_peer(struct wlan_objmgr_vdev *vdev,
 				const uint8_t *mac)
 {