浏览代码

qcacld-3.0: Add Reassoc req handling code for connection manager

Add Reassoc req handling code for connection manager.

Change-Id: I2735642df3132738993e801acdb6c9dcba1ac80f
CRs-Fixed: 2939872
Utkarsh Bhatnagar 3 年之前
父节点
当前提交
cd22a0f327

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

@@ -322,6 +322,7 @@ struct ft_context {
  * @fils_con_info: Pointer to fils connection info from connect req
  * @cckm_ie: cck IE
  * @cckm_ie_len: cckm_ie len
+ * @ese_tspec_info: ese tspec info
  */
 struct mlme_connect_info {
 	uint8_t timing_meas_cap;
@@ -341,6 +342,9 @@ struct mlme_connect_info {
 #ifdef FEATURE_WLAN_ESE
 	uint8_t cckm_ie[DOT11F_IE_RSN_MAX_LEN];
 	uint8_t cckm_ie_len;
+#ifdef WLAN_FEATURE_HOST_ROAM
+	tESETspecInfo ese_tspec_info;
+#endif
 #endif
 };
 

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

@@ -1820,5 +1820,6 @@ static struct mlme_ext_ops ext_ops = {
 	.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,
 	.mlme_cm_ext_vdev_down_req_cb = cm_send_vdev_down_req,
+	.mlme_cm_ext_reassoc_req_cb = cm_handle_reassoc_req,
 #endif
 };

+ 102 - 0
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.c

@@ -4243,6 +4243,72 @@ bool cm_is_auth_type_11r(struct wlan_mlme_psoc_ext_obj *mlme_obj,
 	return false;
 }
 
+#ifdef FEATURE_WLAN_ESE
+static bool cm_is_open_mode(struct wlan_objmgr_vdev *vdev)
+{
+	int32_t ucast_cipher;
+
+	ucast_cipher = wlan_crypto_get_param(vdev,
+					     WLAN_CRYPTO_PARAM_UCAST_CIPHER);
+	if (!ucast_cipher ||
+	    ((QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_NONE) ==
+	      ucast_cipher)))
+		return true;
+
+	return false;
+}
+
+bool
+cm_ese_open_present(struct wlan_objmgr_vdev *vdev,
+		    struct wlan_mlme_psoc_ext_obj *mlme_obj,
+		    bool ese_version_present)
+{
+	if (cm_is_open_mode(vdev) && ese_version_present &&
+	    mlme_obj->cfg.lfr.ese_enabled)
+		return true;
+
+	return false;
+}
+
+bool
+cm_is_ese_connection(struct wlan_objmgr_vdev *vdev, bool ese_version_present)
+{
+	int32_t akm;
+	int32_t auth_mode;
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		mlme_err("psoc not found");
+		return false;
+	}
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+	if (!mlme_obj)
+		return false;
+
+	if (!mlme_obj->cfg.lfr.ese_enabled)
+		return false;
+
+	akm = wlan_crypto_get_param(vdev,
+				    WLAN_CRYPTO_PARAM_KEY_MGMT);
+
+	auth_mode = wlan_crypto_get_param(vdev,
+					  WLAN_CRYPTO_PARAM_AUTH_MODE);
+
+	if (QDF_HAS_PARAM(akm, WLAN_CRYPTO_KEY_MGMT_CCKM))
+		return true;
+
+	/* A profile can not be both ESE and 11R. But an 802.11R AP
+	 * may be advertising support for ESE as well. So if we are
+	 * associating Open or explicitly ESE then we will get ESE.
+	 * If we are associating explicitly 11R only then we will get
+	 * 11R.
+	 */
+	return cm_ese_open_present(vdev, mlme_obj, ese_version_present);
+}
+#endif
+
 static void cm_roam_start_init(struct wlan_objmgr_psoc *psoc,
 			       struct wlan_objmgr_pdev *pdev,
 			       struct wlan_objmgr_vdev *vdev)
@@ -4324,6 +4390,42 @@ void cm_roam_start_init_on_connect(struct wlan_objmgr_pdev *pdev,
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
 }
 
+void cm_update_session_assoc_ie(struct wlan_objmgr_psoc *psoc,
+				uint8_t vdev_id,
+				struct element_info *assoc_ie)
+{
+	struct rso_config *rso_cfg;
+	struct wlan_objmgr_vdev *vdev;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_CM_ID);
+	if (!vdev) {
+		mlme_err("vdev object is NULL for vdev %d", vdev_id);
+		return;
+	}
+	rso_cfg = wlan_cm_get_rso_config(vdev);
+	if (!rso_cfg)
+		goto rel_vdev_ref;
+
+	if (rso_cfg->assoc_ie.ptr) {
+		qdf_mem_free(rso_cfg->assoc_ie.ptr);
+		rso_cfg->assoc_ie.ptr = NULL;
+		rso_cfg->assoc_ie.len = 0;
+	}
+	if (!assoc_ie->len) {
+		sme_debug("Assoc IE len 0");
+		goto rel_vdev_ref;
+	}
+	rso_cfg->assoc_ie.ptr = qdf_mem_malloc(assoc_ie->len);
+	if (!rso_cfg->assoc_ie.ptr)
+		goto rel_vdev_ref;
+
+	rso_cfg->assoc_ie.len = assoc_ie->len;
+	qdf_mem_copy(rso_cfg->assoc_ie.ptr, assoc_ie->ptr, assoc_ie->len);
+rel_vdev_ref:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
+}
+
 #ifdef FEATURE_CM_ENABLE
 QDF_STATUS cm_start_roam_invoke(struct wlan_objmgr_psoc *psoc,
 				struct wlan_objmgr_vdev *vdev,

+ 0 - 10
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.h

@@ -201,16 +201,6 @@ QDF_STATUS
 cm_roam_send_disable_config(struct wlan_objmgr_psoc *psoc,
 			    uint8_t vdev_id, uint8_t cfg);
 
-/**
- * cm_roam_start_init_on_connect() - init roaming
- * @pdev: pdev pointer
- * @vdev_id: vdev_id
- *
- * Return: void
- */
-void cm_roam_start_init_on_connect(struct wlan_objmgr_pdev *pdev,
-				   uint8_t vdev_id);
-
 #if defined(WLAN_SAE_SINGLE_PMK) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
 void
 cm_store_sae_single_pmk_to_global_cache(struct wlan_objmgr_psoc *psoc,

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

@@ -304,11 +304,12 @@ 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
+ * cm_csr_handle_join_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
+ * @reassoc: if reassoc
  *
  * This API is to update legacy struct and should be removed once
  * CSR is cleaned up fully. No new params should be added to CSR, use
@@ -316,10 +317,10 @@ QDF_STATUS cm_connect_start_ind(struct wlan_objmgr_vdev *vdev,
  *
  * 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);
+QDF_STATUS cm_csr_handle_join_req(struct wlan_objmgr_vdev *vdev,
+				  struct wlan_cm_vdev_connect_req *req,
+				  struct cm_vdev_join_req *join_req,
+				  bool reassoc);
 
 /**
  * cm_handle_connect_req() - Connection manager ext connect request to start
@@ -524,6 +525,41 @@ void cm_free_join_req(struct cm_vdev_join_req *join_req);
  */
 QDF_STATUS cm_process_join_req(struct scheduler_msg *msg);
 
+#ifdef WLAN_FEATURE_HOST_ROAM
+/**
+ * cm_process_reassoc_req() - Process vdev reassoc req
+ * @msg: scheduler message
+ *
+ * Process reassoc request in LIM and copy all reassoc req params.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS cm_process_reassoc_req(struct scheduler_msg *msg);
+
+/**
+ * cm_handle_reassoc_req() - Connection manager ext reassoc request to start
+ * vdev and peer assoc state machine
+ * @vdev: VDEV object
+ * @req: Vdev reassoc request
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+cm_handle_reassoc_req(struct wlan_objmgr_vdev *vdev,
+		      struct wlan_cm_vdev_reassoc_req *req);
+#else
+static inline QDF_STATUS cm_process_reassoc_req(struct scheduler_msg *msg)
+{
+	return QDF_STATUS_SUCCESS;
+}
+static inline QDF_STATUS
+cm_handle_reassoc_req(struct wlan_objmgr_vdev *vdev,
+		      struct wlan_cm_vdev_reassoc_req *req)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * cm_process_peer_create() - Process bss peer create req
  * @msg: scheduler message

+ 130 - 35
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_connect.c

@@ -255,6 +255,40 @@ end:
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
 }
 
+int8_t cm_get_rssi_by_bssid(struct wlan_objmgr_pdev *pdev,
+			    struct qdf_mac_addr *bssid)
+{
+	struct scan_filter *scan_filter;
+	int8_t rssi = 0;
+	qdf_list_t *list = NULL;
+	struct scan_cache_node *first_node = NULL;
+
+	scan_filter = qdf_mem_malloc(sizeof(*scan_filter));
+	if (!scan_filter)
+		return rssi;
+
+	scan_filter->num_of_bssid = 1;
+	qdf_mem_copy(scan_filter->bssid_list[0].bytes,
+		     bssid, sizeof(struct qdf_mac_addr));
+	scan_filter->ignore_auth_enc_type = true;
+	list = wlan_scan_get_result(pdev, scan_filter);
+	qdf_mem_free(scan_filter);
+
+	if (!list || (list && !qdf_list_size(list))) {
+		mlme_debug("scan list empty");
+		goto error;
+	}
+
+	qdf_list_peek_front(list, (qdf_list_node_t **) &first_node);
+	if (first_node && first_node->entry)
+		rssi = first_node->entry->rssi_raw;
+error:
+	if (list)
+		wlan_scan_purge_results(list);
+
+	return rssi;
+}
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
 static const char *cm_diag_get_ch_width_str(uint8_t ch_width)
 {
@@ -607,40 +641,6 @@ static void cm_diag_get_auth_type(uint8_t *auth_type,
 	*auth_type = AUTH_OPEN;
 }
 
-int8_t cm_get_rssi_by_bssid(struct wlan_objmgr_pdev *pdev,
-			    struct qdf_mac_addr *bssid)
-{
-	struct scan_filter *scan_filter;
-	int8_t rssi = 0;
-	qdf_list_t *list = NULL;
-	struct scan_cache_node *first_node = NULL;
-
-	scan_filter = qdf_mem_malloc(sizeof(*scan_filter));
-	if (!scan_filter)
-		return rssi;
-
-	scan_filter->num_of_bssid = 1;
-	qdf_mem_copy(scan_filter->bssid_list[0].bytes,
-		     bssid, sizeof(struct qdf_mac_addr));
-	scan_filter->ignore_auth_enc_type = true;
-	list = wlan_scan_get_result(pdev, scan_filter);
-	qdf_mem_free(scan_filter);
-
-	if (!list || (list && !qdf_list_size(list))) {
-		mlme_debug("scan list empty");
-		goto error;
-	}
-
-	qdf_list_peek_front(list, (qdf_list_node_t **) &first_node);
-	if (first_node && first_node->entry)
-		rssi = first_node->entry->rssi_raw;
-error:
-	if (list)
-		wlan_scan_purge_results(list);
-
-	return rssi;
-}
-
 static void
 cm_connect_success_diag(struct wlan_mlme_psoc_ext_obj *mlme_obj,
 			struct host_event_wlan_connection_stats *stats)
@@ -1169,7 +1169,7 @@ cm_handle_connect_req(struct wlan_objmgr_vdev *vdev,
 
 	cm_update_hlp_data_from_assoc_ie(vdev, req);
 
-	status = cm_csr_handle_connect_req(vdev, req, join_req);
+	status = cm_csr_handle_join_req(vdev, req, join_req, false);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		mlme_err(CM_PREFIX_FMT "fail to fill params from legacy",
 			 CM_PREFIX_REF(req->vdev_id, req->cm_id));
@@ -1206,6 +1206,101 @@ cm_handle_connect_req(struct wlan_objmgr_vdev *vdev,
 	return status;
 }
 
+#ifdef WLAN_FEATURE_HOST_ROAM
+QDF_STATUS
+cm_handle_reassoc_req(struct wlan_objmgr_vdev *vdev,
+		      struct wlan_cm_vdev_reassoc_req *req)
+{
+	struct cm_vdev_join_req *join_req;
+	struct scheduler_msg msg;
+	QDF_STATUS status;
+	struct wlan_objmgr_pdev *pdev;
+	struct wlan_objmgr_psoc *psoc;
+	struct rso_config *rso_cfg;
+
+	if (!vdev || !req)
+		return QDF_STATUS_E_FAILURE;
+
+	pdev = wlan_vdev_get_pdev(vdev);
+	if (!pdev) {
+		mlme_err(CM_PREFIX_FMT "pdev not found",
+			 CM_PREFIX_REF(req->vdev_id, req->cm_id));
+		return QDF_STATUS_E_INVAL;
+	}
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc) {
+		mlme_err(CM_PREFIX_FMT "psoc not found",
+			 CM_PREFIX_REF(req->vdev_id, req->cm_id));
+		return QDF_STATUS_E_INVAL;
+	}
+
+	rso_cfg = wlan_cm_get_rso_config(vdev);
+	if (!rso_cfg)
+		return QDF_STATUS_E_NOSUPPORT;
+
+	qdf_mem_zero(&msg, sizeof(msg));
+	join_req = qdf_mem_malloc(sizeof(*join_req));
+	if (!join_req)
+		return QDF_STATUS_E_NOMEM;
+
+	wlan_cm_set_disable_hi_rssi(pdev, req->vdev_id, true);
+	mlme_debug(CM_PREFIX_FMT "Disabling HI_RSSI, AP freq=%d, rssi=%d",
+		   CM_PREFIX_REF(req->vdev_id, req->cm_id),
+		   req->bss->entry->channel.chan_freq,
+		   req->bss->entry->rssi_raw);
+
+	if (rso_cfg->assoc_ie.ptr) {
+		join_req->assoc_ie.ptr = qdf_mem_malloc(rso_cfg->assoc_ie.len);
+		if (!join_req->assoc_ie.ptr)
+			return QDF_STATUS_E_NOMEM;
+		qdf_mem_copy(join_req->assoc_ie.ptr, rso_cfg->assoc_ie.ptr,
+			     rso_cfg->assoc_ie.len);
+		join_req->assoc_ie.len = rso_cfg->assoc_ie.len;
+	}
+
+	join_req->entry = util_scan_copy_cache_entry(req->bss->entry);
+	if (!join_req->entry) {
+		mlme_err(CM_PREFIX_FMT "Failed to copy scan entry",
+			 CM_PREFIX_REF(req->vdev_id, req->cm_id));
+		cm_free_join_req(join_req);
+		return QDF_STATUS_E_NOMEM;
+	}
+	join_req->vdev_id = req->vdev_id;
+	join_req->cm_id = req->cm_id;
+
+	status = cm_csr_handle_join_req(vdev, NULL, join_req, true);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mlme_err(CM_PREFIX_FMT "fail to fill params from legacy",
+			 CM_PREFIX_REF(req->vdev_id, req->cm_id));
+		cm_free_join_req(join_req);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	wlan_rec_conn_info(req->vdev_id, DEBUG_CONN_CONNECTING,
+			   req->bss->entry->bssid.bytes,
+			   req->bss->entry->neg_sec_info.key_mgmt,
+			   req->bss->entry->channel.chan_freq);
+
+	msg.bodyptr = join_req;
+	msg.type = CM_REASSOC_REQ;
+	msg.flush_callback = cm_flush_join_req;
+
+	status = scheduler_post_message(QDF_MODULE_ID_MLME,
+					QDF_MODULE_ID_PE,
+					QDF_MODULE_ID_PE, &msg);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mlme_err(CM_PREFIX_FMT "msg post fail",
+			 CM_PREFIX_REF(req->vdev_id, req->cm_id));
+		cm_free_join_req(join_req);
+	}
+
+	if (wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE)
+		wlan_register_txrx_packetdump(OL_TXRX_PDEV_ID);
+
+	return status;
+}
+#endif
+
 QDF_STATUS
 cm_send_bss_peer_create_req(struct wlan_objmgr_vdev *vdev,
 			    struct qdf_mac_addr *peer_mac)

+ 26 - 0
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h

@@ -599,6 +599,28 @@ bool wlan_cm_is_auth_type_11r(struct wlan_mlme_psoc_ext_obj *mlme_obj,
 	return cm_is_auth_type_11r(mlme_obj, vdev, mdie_present);
 }
 
+#ifdef FEATURE_WLAN_ESE
+bool
+cm_ese_open_present(struct wlan_objmgr_vdev *vdev,
+		    struct wlan_mlme_psoc_ext_obj *mlme_obj,
+		    bool ese_version_present);
+bool
+cm_is_ese_connection(struct wlan_objmgr_vdev *vdev, bool ese_version_present);
+#else
+static inline bool
+cm_ese_open_present(struct wlan_objmgr_vdev *vdev,
+		    struct wlan_mlme_psoc_ext_obj *mlme_obj,
+		    bool ese_version_present)
+{
+	return false;
+}
+static inline bool
+cm_is_ese_connection(struct wlan_objmgr_vdev *vdev, bool ese_version_present)
+{
+	return false;
+}
+#endif
+
 /**
  * cm_roam_start_init_on_connect() - init roaming
  * @pdev: pdev pointer
@@ -608,6 +630,10 @@ bool wlan_cm_is_auth_type_11r(struct wlan_mlme_psoc_ext_obj *mlme_obj,
  */
 void cm_roam_start_init_on_connect(struct wlan_objmgr_pdev *pdev,
 				   uint8_t vdev_id);
+
+void cm_update_session_assoc_ie(struct wlan_objmgr_psoc *psoc,
+				uint8_t vdev_id,
+				struct element_info *assoc_ie);
 #ifdef FEATURE_CM_ENABLE
 /**
  * wlan_cm_roam_invoke() - Validate and send Roam invoke req to CM

+ 16 - 0
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_ucfg_api.h

@@ -97,6 +97,22 @@ ucfg_cm_rso_set_roam_trigger(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id,
 	return wlan_cm_rso_set_roam_trigger(pdev, vdev_id, trigger);
 }
 
+/**
+ * ucfg_cm_update_session_assoc_ie() - Send assoc ie
+ * @psoc: Pointer to psoc
+ * @vdev_id: vdev id
+ * @assoc_ie: assoc ir to update.
+ *
+ * Return: QDF_STATUS
+ */
+static inline void
+ucfg_cm_update_session_assoc_ie(struct wlan_objmgr_psoc *psoc,
+				uint8_t vdev_id,
+				struct element_info *assoc_ie)
+{
+	cm_update_session_assoc_ie(psoc, vdev_id, assoc_ie);
+}
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 static inline QDF_STATUS
 ucfg_cm_update_roam_scan_scheme_bitmap(struct wlan_objmgr_psoc *psoc,

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

@@ -24059,8 +24059,8 @@ __wlan_hdd_cfg80211_update_connect_params(struct wiphy *wiphy,
 		 * umac. RSO command will pick up the assoc
 		 * IEs to be sent to firmware from the umac.
 		 */
-		sme_update_session_assoc_ie(mac_handle, adapter->vdev_id,
-					    &assoc_ie);
+		ucfg_cm_update_session_assoc_ie(hdd_ctx->psoc, adapter->vdev_id,
+						&assoc_ie);
 	}
 
 	if ((changed & UPDATE_FILS_ERP_INFO) ||

+ 9 - 14
core/mac/inc/sir_api.h

@@ -1029,32 +1029,27 @@ typedef struct sEsePEContext {
 
 #endif /* FEATURE_WLAN_ESE */
 
-/* / Definition for join request */
-/* / ---> MAC */
+/* Warning Do not add any new param in this struct */
 struct join_req {
-	uint16_t messageType;   /* eWNI_SME_JOIN_REQ */
-	uint16_t length;
+#ifndef FEATURE_CM_ENABLE
 	uint8_t vdev_id;
-	tSirMacSSid ssId;
-	tSirRSNie rsnIE;        /* RSN IE to be sent in */
-	tSirAddie addIEScan;    /* Additional IE to be sent in */
-	/* (unicast) Probe Request at the time of join */
-
-	tSirAddie addIEAssoc;   /* Additional IE to be sent in */
 	/* (Re) Association Request */
-#ifndef FEATURE_CM_ENABLE
+	uint16_t length;
+	tSirMacSSid ssId;
 	tAniEdType UCEncryptionType;
 	enum ani_akm_type akm;
 	bool wps_registration;
 	bool isOSENConnection;
 	bool force_24ghz_in_ht20;
-#endif
-
 #ifdef FEATURE_WLAN_ESE
 	tESETspecInfo eseTspecInfo;
 #endif
-	struct supported_channels supportedChannels;
 	bool force_rsne_override;
+#endif /* FEATURE_CM_ENABLE */
+	tSirRSNie rsnIE;
+	tSirAddie addIEScan;
+	tSirAddie addIEAssoc;
+	/* Warning:::::::::::: Do not add any new param in this struct */
 	/* Pls make this as last variable in struct */
 	struct bss_description bssDescription;
 	/*

+ 2 - 1
core/mac/inc/wni_api.h

@@ -249,7 +249,8 @@ enum eWniMsgTypes {
 	CM_BSS_PEER_CREATE_REQ = SIR_SME_MSG_TYPES_BEGIN + 171,
 	CM_CONNECT_REQ = SIR_SME_MSG_TYPES_BEGIN + 172,
 	CM_DISCONNECT_REQ = SIR_SME_MSG_TYPES_BEGIN + 173,
-	eWNI_SME_MSG_TYPES_END = SIR_SME_MSG_TYPES_BEGIN + 174
+	CM_REASSOC_REQ = SIR_SME_MSG_TYPES_BEGIN + 174,
+	eWNI_SME_MSG_TYPES_END = SIR_SME_MSG_TYPES_BEGIN + 175
 };
 
 typedef struct sAniCfgTxRateCtrs {

+ 2 - 0
core/mac/src/include/parser_api.h

@@ -942,9 +942,11 @@ void populate_dot11_tsrsie(struct mac_context *mac,
 			struct ese_tsrs_ie *pOld,
 			tDot11fIEESETrafStrmRateSet *pDot11f,
 			uint8_t rate_length);
+#ifdef WLAN_FEATURE_HOST_ROAM
 void populate_dot11f_re_assoc_tspec(struct mac_context *mac,
 				tDot11fReAssocRequest *pReassoc,
 				struct pe_session *pe_session);
+#endif
 QDF_STATUS
 sir_beacon_ie_ese_bcn_report(struct mac_context *mac,
 		uint8_t *pPayload, const uint32_t payloadLength,

+ 3 - 0
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -2104,6 +2104,9 @@ static void lim_process_messages(struct mac_context *mac_ctx,
 	case CM_CONNECT_REQ:
 		cm_process_join_req(msg);
 		break;
+	case CM_REASSOC_REQ:
+		cm_process_reassoc_req(msg);
+		break;
 	case CM_DISCONNECT_REQ:
 		cm_process_disconnect_req(msg);
 		break;

+ 425 - 101
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -1186,6 +1186,7 @@ static QDF_STATUS lim_send_join_req(struct pe_session *session,
 					     mlm_join_req);
 }
 
+#ifdef WLAN_FEATURE_HOST_ROAM
 /**
  * lim_send_reassoc_req() - send vdev start request for reassoc
  *@session: pe session
@@ -1212,6 +1213,35 @@ static QDF_STATUS lim_send_reassoc_req(struct pe_session *session,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * lim_send_ft_reassoc_req() - send vdev start request for ft_reassoc
+ *@session: pe session
+ *@mlm_join_req: join req
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS lim_send_ft_reassoc_req(struct pe_session *session,
+					  tLimMlmReassocReq *reassoc_req)
+{
+	QDF_STATUS status;
+
+	status = mlme_set_assoc_type(session->vdev, VDEV_FT_REASSOC);
+	if (QDF_IS_STATUS_ERROR(status))
+		return status;
+
+	if (wlan_vdev_mlme_get_state(session->vdev) == WLAN_VDEV_S_UP) {
+		pe_err("ft_reassoc req in unexpected vdev SM state:%d",
+		       wlan_vdev_mlme_get_state(session->vdev));
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return wlan_vdev_mlme_sm_deliver_evt(session->vdev,
+					     WLAN_VDEV_SM_EV_START,
+					     sizeof(*reassoc_req),
+					     reassoc_req);
+}
+#endif
+
 static void lim_join_req_update_ht_vht_caps(struct mac_context *mac,
 					    struct pe_session *session,
 					    struct bss_description *bss_desc,
@@ -1299,34 +1329,6 @@ static void lim_join_req_update_ht_vht_caps(struct mac_context *mac,
 		 ht_caps.caps, vht_config.caps);
 }
 
-/**
- * lim_send_ft_reassoc_req() - send vdev start request for ft_reassoc
- *@session: pe session
- *@mlm_join_req: join req
- *
- * Return: QDF_STATUS
- */
-static QDF_STATUS lim_send_ft_reassoc_req(struct pe_session *session,
-					  tLimMlmReassocReq *reassoc_req)
-{
-	QDF_STATUS status;
-
-	status = mlme_set_assoc_type(session->vdev, VDEV_FT_REASSOC);
-	if (QDF_IS_STATUS_ERROR(status))
-		return status;
-
-	if (wlan_vdev_mlme_get_state(session->vdev) == WLAN_VDEV_S_UP) {
-		pe_err("ft_reassoc req in unexpected vdev SM state:%d",
-		       wlan_vdev_mlme_get_state(session->vdev));
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	return wlan_vdev_mlme_sm_deliver_evt(session->vdev,
-					     WLAN_VDEV_SM_EV_START,
-					     sizeof(*reassoc_req),
-					     reassoc_req);
-}
-
 bool
 lim_get_vdev_rmf_capable(struct mac_context *mac, struct pe_session *session)
 {
@@ -2517,38 +2519,6 @@ static inline void lim_update_sae_config(struct mac_context *mac,
 { }
 #endif
 
-#ifdef FEATURE_WLAN_ESE
-static bool lim_is_open_mode(struct wlan_objmgr_vdev *vdev)
-{
-	int32_t ucast_cipher;
-
-	ucast_cipher = wlan_crypto_get_param(vdev,
-					     WLAN_CRYPTO_PARAM_UCAST_CIPHER);
-	if (!ucast_cipher ||
-	    ((QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_NONE) ==
-	      ucast_cipher)))
-		return true;
-
-	return false;
-}
-
-static bool
-lim_ese_open_present(struct pe_session *session, bool ese_version_present)
-{
-	if (lim_is_open_mode(session->vdev) && ese_version_present &&
-	    session->mac_ctx->mlme_cfg->lfr.ese_enabled)
-		return true;
-
-	return false;
-}
-#else
-static bool
-lim_ese_open_present(struct pe_session *session, bool ese_version_present)
-{
-	return false;
-}
-#endif
-
 static void
 lim_fill_11r_params(struct mac_context *mac_ctx, struct pe_session *session,
 		    bool ese_version_present)
@@ -2560,44 +2530,16 @@ lim_fill_11r_params(struct mac_context *mac_ctx, struct pe_session *session,
 		return;
 	if (wlan_cm_is_auth_type_11r(mlme_obj, session->vdev,
 	    session->lim_join_req->bssDescription.mdiePresent) &&
-	    !lim_ese_open_present(session, ese_version_present))
+	    !cm_ese_open_present(session->vdev, mlme_obj, ese_version_present))
 		session->is11Rconnection = true;
 }
 
 #ifdef FEATURE_WLAN_ESE
-static bool
-lim_is_ese_profile(struct mac_context *mac_ctx, struct pe_session *session,
-		   bool ese_version_present)
-{
-	int32_t akm;
-	int32_t auth_mode;
-
-	akm = wlan_crypto_get_param(session->vdev,
-				    WLAN_CRYPTO_PARAM_KEY_MGMT);
-
-	auth_mode = wlan_crypto_get_param(session->vdev,
-					  WLAN_CRYPTO_PARAM_AUTH_MODE);
-
-	if (!mac_ctx->mlme_cfg->lfr.ese_enabled)
-		return false;
-
-	if (QDF_HAS_PARAM(akm, WLAN_CRYPTO_KEY_MGMT_CCKM))
-		return true;
-
-	/* A profile can not be both ESE and 11R. But an 802.11R AP
-	 * may be advertising support for ESE as well. So if we are
-	 * associating Open or explicitly ESE then we will get ESE.
-	 * If we are associating explicitly 11R only then we will get
-	 * 11R.
-	 */
-	return lim_ese_open_present(session, ese_version_present);
-}
-
 static void
 lim_fill_ese_params(struct mac_context *mac_ctx, struct pe_session *session,
 		    bool ese_version_present)
 {
-	if (lim_is_ese_profile(mac_ctx, session, ese_version_present))
+	if (cm_is_ese_connection(session->vdev, ese_version_present))
 		session->isESEconnection = true;
 
 	wlan_cm_set_ese_assoc(mac_ctx->pdev, session->vdev_id,
@@ -2807,11 +2749,6 @@ lim_fill_pe_session(struct mac_context *mac_ctx, struct pe_session *session,
 
 	qdf_mem_free(ie_struct);
 
-	wlan_add_supported_5Ghz_channels(mac_ctx->psoc, mac_ctx->pdev,
-			session->lim_join_req->supportedChannels.channelList,
-			&session->lim_join_req->supportedChannels.numChnl,
-			false);
-
 	/* Copying of bssId is already done, while creating session */
 	sir_copy_mac_addr(session->self_mac_addr,
 			  wlan_vdev_mlme_get_macaddr(session->vdev));
@@ -3394,8 +3331,7 @@ lim_fill_rsn_ie(struct mac_context *mac_ctx, struct pe_session *session,
 			      WLAN_ELEMID_RSN, ONE_BYTE,
 			      NULL, 0, rsn_ie, DOT11F_IE_RSN_MAX_LEN);
 
-	if (session->lim_join_req->force_rsne_override &&
-	    QDF_IS_STATUS_SUCCESS(status)) {
+	if (req->force_rsne_override && QDF_IS_STATUS_SUCCESS(status)) {
 		rsn_ie_len = rsn_ie[1];
 		if (rsn_ie_len < DOT11F_IE_RSN_MIN_LEN ||
 		    rsn_ie_len > DOT11F_IE_RSN_MAX_LEN) {
@@ -3624,6 +3560,9 @@ lim_fill_session_params(struct mac_context *mac_ctx,
 				   req->assoc_ie.ptr, req->assoc_ie.len);
 	qdf_mem_copy(pe_join_req->addIEAssoc.addIEdata,
 		     req->assoc_ie.ptr, req->assoc_ie.len);
+	/* update assoc ie to cm */
+	cm_update_session_assoc_ie(mac_ctx->psoc, session->vdev_id,
+				   &req->assoc_ie);
 	pe_join_req->addIEAssoc.length = req->assoc_ie.len;
 	qdf_mem_copy(pe_join_req->addIEScan.addIEdata,
 		     req->scan_ie.ptr, req->scan_ie.len);
@@ -3902,6 +3841,391 @@ QDF_STATUS cm_process_peer_create(struct scheduler_msg *msg)
 
 	return status;
 }
+
+#ifdef WLAN_FEATURE_HOST_ROAM
+static void lim_handle_reassoc_req(struct cm_vdev_join_req *req)
+{
+	struct mac_context *mac_ctx;
+	struct pe_session *session_entry;
+	uint8_t session_id;
+	uint8_t vdev_id;
+	uint32_t ie_len;
+	uint32_t bss_len;
+	struct join_req *reassoc_req = NULL;
+	uint16_t caps;
+	uint32_t val;
+	tLimMlmReassocReq *mlm_reassoc_req;
+	tSirResultCodes ret_code = eSIR_SME_SUCCESS;
+	int8_t local_pwr_constraint = 0, reg_max = 0;
+	uint32_t tele_bcn_en = 0;
+	QDF_STATUS status;
+	tDot11fBeaconIEs *ie_struct;
+	ePhyChanBondState cb_mode;
+	tSirMacCapabilityInfo *ap_cap_info;
+	struct bss_description *bss_desc;
+	uint8_t wmm_mode, value;
+	bool is_pwr_constraint;
+	int32_t ucast_cipher;
+	int32_t auth_mode;
+	int32_t akm;
+
+	if (!req)
+		return;
+
+	mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
+	if (!mac_ctx)
+		return;
+
+	vdev_id = req->vdev_id;
+	session_entry = pe_find_session_by_bssid(mac_ctx,
+						 req->entry->bssid.bytes,
+						 &session_id);
+	if (!session_entry) {
+		pe_err("Session does not exist for: "QDF_MAC_ADDR_FMT,
+			QDF_MAC_ADDR_REF(req->entry->bssid.bytes));
+		ret_code = eSIR_SME_INVALID_PARAMETERS;
+		session_entry = pe_find_session_by_vdev_id(mac_ctx, vdev_id);
+		if (session_entry)
+			lim_handle_sme_join_result(mac_ctx,
+					eSIR_SME_INVALID_PARAMETERS,
+					STATUS_UNSPECIFIED_FAILURE,
+					session_entry);
+		goto end;
+	}
+	session_entry->cm_id = req->cm_id;
+	ie_len = util_scan_entry_ie_len(req->entry);
+	bss_len = (uint16_t)(offsetof(struct bss_description,
+			     ieFields[0]) + ie_len);
+
+	reassoc_req = qdf_mem_malloc(sizeof(*session_entry->lim_join_req) +
+				     bss_len);
+	if (!reassoc_req) {
+		ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
+		goto end;
+	}
+	lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_REASSOC_REQ_EVENT,
+			      session_entry, QDF_STATUS_SUCCESS,
+			      QDF_STATUS_SUCCESS);
+
+	pe_debug("Beacon/probe frame received:");
+	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+			   util_scan_entry_frame_ptr(req->entry),
+			   util_scan_entry_frame_len(req->entry));
+
+	bss_desc = &reassoc_req->bssDescription;
+	status = wlan_fill_bss_desc_from_scan_entry(mac_ctx, bss_desc,
+						    req->entry);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
+		goto end;
+	}
+	/* Store the reassoc handle in the session Table */
+	session_entry->lim_join_req = reassoc_req;
+	session_entry->pLimReAssocReq = reassoc_req;
+
+	status = wlan_get_parsed_bss_description_ies(mac_ctx, bss_desc,
+						     &ie_struct);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		pe_err("IE parsing failed vdev id %d",
+		       session_entry->vdev_id);
+		session_entry->lim_join_req = NULL;
+		ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
+		goto end;
+	}
+	pe_debug("Assoc IE len: %d", req->assoc_ie.len);
+	if (req->assoc_ie.len)
+		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+				   req->assoc_ie.ptr, req->assoc_ie.len);
+	if (lim_is_rsn_profile(session_entry))
+		lim_fill_rsn_ie(mac_ctx, session_entry, req);
+	else if (lim_is_wpa_profile(session_entry))
+		lim_fill_wpa_ie(mac_ctx, session_entry, req);
+	else if (lim_is_wapi_profile(session_entry))
+		lim_fill_wapi_ie(mac_ctx, session_entry, req);
+
+	pe_debug("After stripping Assoc IE len: %d", req->assoc_ie.len);
+	if (req->assoc_ie.len)
+		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+				   req->assoc_ie.ptr, req->assoc_ie.len);
+	qdf_mem_copy(reassoc_req->addIEAssoc.addIEdata,
+		     req->assoc_ie.ptr, req->assoc_ie.len);
+	reassoc_req->addIEAssoc.length = req->assoc_ie.len;
+	/* update assoc ie to cm */
+	cm_update_session_assoc_ie(mac_ctx->psoc, vdev_id, &req->assoc_ie);
+	ucast_cipher = wlan_crypto_get_param(session_entry->vdev,
+					     WLAN_CRYPTO_PARAM_UCAST_CIPHER);
+	auth_mode = wlan_crypto_get_param(session_entry->vdev,
+					  WLAN_CRYPTO_PARAM_AUTH_MODE);
+	akm = wlan_crypto_get_param(session_entry->vdev,
+				    WLAN_CRYPTO_PARAM_KEY_MGMT);
+	ap_cap_info = (tSirMacCapabilityInfo *)&req->entry->cap_info.value;
+
+	lim_set_privacy(mac_ctx, ucast_cipher, auth_mode, akm,
+			ap_cap_info->privacy);
+
+	if (session_entry->vhtCapability) {
+		if (session_entry->opmode == QDF_STA_MODE) {
+			session_entry->vht_config.su_beam_formee =
+			    mac_ctx->mlme_cfg->vht_caps.vht_cap_info.su_bformee;
+		} else {
+			session_entry->vht_config.su_beam_formee = 0;
+		}
+		session_entry->enableVhtpAid =
+			mac_ctx->mlme_cfg->vht_caps.vht_cap_info.enable_paid;
+		session_entry->enableVhtGid =
+			mac_ctx->mlme_cfg->vht_caps.vht_cap_info.enable_gid;
+		pe_debug("vht su bformer [%d]", session_entry->vht_config.su_beam_former);
+	}
+
+	if (session_entry->nss == 1)
+		session_entry->supported_nss_1x1 = true;
+
+	lim_check_oui_and_update_session(mac_ctx, session_entry, ie_struct);
+
+	session_entry->lim_reassoc_chan_freq = req->entry->channel.chan_freq;
+	cb_mode = wlan_get_cb_mode(mac_ctx,
+				  session_entry->lim_reassoc_chan_freq,
+				  ie_struct);
+	session_entry->reAssocHtSupportedChannelWidthSet = cb_mode ? 1 : 0;
+	session_entry->reAssocHtRecommendedTxWidthSet =
+		session_entry->reAssocHtSupportedChannelWidthSet;
+	session_entry->reAssocHtSecondaryChannelOffset = cb_mode;
+
+	mac_ctx->mlme_cfg->power.local_power_constraint =
+		wlan_get_11h_power_constraint(mac_ctx,
+					      &ie_struct->PowerConstraints);
+	if (session_entry->dot11mode == MLME_DOT11_MODE_11B)
+		mac_ctx->mlme_cfg->feature_flags.enable_short_slot_time_11g = 0;
+	else
+		mac_ctx->mlme_cfg->feature_flags.enable_short_slot_time_11g =
+			mac_ctx->mlme_cfg->ht_caps.short_slot_time_enabled;
+	session_entry->enable_session_twt_support =
+					lim_enable_twt(mac_ctx, ie_struct);
+
+	qdf_mem_free(ie_struct);
+	pe_debug("vhtCapability: %d su_beam_formee: %d su_tx_bformer %d",
+		session_entry->vhtCapability,
+		session_entry->vht_config.su_beam_formee,
+		session_entry->vht_config.su_beam_former);
+
+	session_entry->enableHtSmps = mac_ctx->mlme_cfg->ht_caps.enable_smps;
+	session_entry->htSmpsvalue = mac_ctx->mlme_cfg->ht_caps.smps;
+	session_entry->send_smps_action =
+		mac_ctx->roam.configParam.send_smps_action;
+	pe_debug("enableHtSmps: %d htSmps: %d send action: %d supported nss 1x1: %d",
+		session_entry->enableHtSmps,
+		session_entry->htSmpsvalue,
+		session_entry->send_smps_action,
+		session_entry->supported_nss_1x1);
+	session_entry->lim_join_req = NULL;
+
+	/* Reassociate request is expected in link established state only. */
+	if (session_entry->limSmeState != eLIM_SME_LINK_EST_STATE) {
+		if (session_entry->limSmeState == eLIM_SME_WT_REASSOC_STATE) {
+			/*
+			 * May be from 11r FT pre-auth. So lets check it
+			 * before we bail out
+			 */
+			pe_debug("Session in reassoc state is %d",
+				 session_entry->peSessionId);
+
+			/* Make sure its our preauth bssid */
+			if (qdf_mem_cmp(req->entry->bssid.bytes,
+					session_entry->limReAssocbssId,
+					QDF_MAC_ADDR_SIZE)) {
+				pe_err("Requested BSSID: "QDF_MAC_ADDR_FMT " but bssId in reassoc state" QDF_MAC_ADDR_FMT,
+				       QDF_MAC_ADDR_REF(req->entry->bssid.bytes),
+				       QDF_MAC_ADDR_REF(session_entry->limReAssocbssId));
+				ret_code = eSIR_SME_INVALID_PARAMETERS;
+				goto end;
+			}
+
+			session_entry->vdev_id = vdev_id;
+			mlm_reassoc_req =
+				qdf_mem_malloc(sizeof(*mlm_reassoc_req));
+			if (!mlm_reassoc_req) {
+				ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
+				goto end;
+			}
+
+			/* Update PE sessionId */
+			mlm_reassoc_req->sessionId = session_entry->peSessionId;
+			status = lim_send_ft_reassoc_req(session_entry,
+							 mlm_reassoc_req);
+			if (QDF_IS_STATUS_ERROR(status)) {
+				qdf_mem_free(mlm_reassoc_req);
+				ret_code = eSIR_SME_REFUSED;
+				goto end;
+			}
+			return;
+		}
+		/*
+		 * Should not have received eWNI_SME_REASSOC_REQ
+		 */
+		pe_err("received unexpected SME_REASSOC_REQ in state %X",
+			session_entry->limSmeState);
+		lim_print_sme_state(mac_ctx, LOGE, session_entry->limSmeState);
+
+		ret_code = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+		goto end;
+	}
+
+	qdf_mem_copy(session_entry->limReAssocbssId, req->entry->bssid.bytes,
+		     sizeof(tSirMacAddr));
+
+	session_entry->limReassocBssCaps = req->entry->cap_info.value;
+	reg_max = wlan_reg_get_channel_reg_power_for_freq(
+		mac_ctx->pdev, session_entry->curr_op_freq);
+	local_pwr_constraint = reg_max;
+
+	lim_extract_ap_capability(mac_ctx, (uint8_t *)bss_desc->ieFields,
+				  lim_get_ielen_from_bss_description(bss_desc),
+				  &session_entry->limReassocBssQosCaps,
+				  &session_entry->gLimCurrentBssUapsd,
+				  &local_pwr_constraint, session_entry,
+				  &is_pwr_constraint);
+	if (is_pwr_constraint)
+		local_pwr_constraint = reg_max - local_pwr_constraint;
+
+	session_entry->maxTxPower = QDF_MIN(reg_max, (local_pwr_constraint));
+	session_entry->max_11h_pwr =
+		QDF_MIN(lim_get_cfg_max_tx_power(mac_ctx,
+						 bss_desc->chan_freq),
+			MAX_TX_PWR_CAP);
+	session_entry->min_11h_pwr = MIN_TX_PWR_CAP;
+	if (!session_entry->max_11h_pwr)
+		session_entry->max_11h_pwr = MAX_TX_PWR_CAP;
+
+	if (session_entry->max_11h_pwr > session_entry->maxTxPower)
+		session_entry->max_11h_pwr = session_entry->maxTxPower;
+
+	pe_info("Reg max = %d, local pwr constraint = %d, max tx = %d",
+		reg_max, local_pwr_constraint, session_entry->maxTxPower);
+	/* Copy the SSID from session entry to local variable */
+	session_entry->limReassocSSID.length = req->entry->ssid.length;
+	qdf_mem_copy(session_entry->limReassocSSID.ssId,
+		     req->entry->ssid.ssid,
+		     session_entry->limReassocSSID.length);
+
+	if (!session_entry->enable_session_twt_support) {
+		status = wlan_mlme_get_wmm_mode(mac_ctx->psoc, &wmm_mode);
+		if (!QDF_IS_STATUS_SUCCESS(status)) {
+			pe_err("Get wmm_mode failed");
+			ret_code = eSIR_SME_INVALID_PARAMETERS;
+			goto end;
+		} else if (wmm_mode == 2) {
+			/*QoS not enabled in cfg file */
+			session_entry->gUapsdPerAcBitmask = 0;
+		} else {
+			/*QoS enabled, update uapsd mask from cfg file */
+			status = wlan_mlme_get_wmm_uapsd_mask(mac_ctx->psoc,
+							      &value);
+			if (QDF_IS_STATUS_ERROR(status)) {
+				pe_err("Get uapsd_mask failed");
+				ret_code = eSIR_SME_INVALID_PARAMETERS;
+				goto end;
+			} else
+				session_entry->gUapsdPerAcBitmask = value;
+		}
+	}
+
+	if (session_entry->gLimCurrentBssUapsd)
+		pe_debug("UAPSD flag for all AC - 0x%2x",
+			session_entry->gUapsdPerAcBitmask);
+
+	mlm_reassoc_req = qdf_mem_malloc(sizeof(tLimMlmReassocReq));
+	if (!mlm_reassoc_req) {
+		ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
+		goto end;
+	}
+
+	qdf_mem_copy(mlm_reassoc_req->peerMacAddr,
+		     session_entry->limReAssocbssId, sizeof(tSirMacAddr));
+
+	if (lim_get_capability_info(mac_ctx, &caps, session_entry) !=
+	    QDF_STATUS_SUCCESS)
+		pe_err("could not retrieve Capabilities value");
+
+	lim_update_caps_info_for_bss(mac_ctx, &caps,
+				     req->entry->cap_info.value);
+	pe_debug("Capabilities info Reassoc: 0x%X", caps);
+
+	mlm_reassoc_req->capabilityInfo = caps;
+
+	/* Update PE session_id */
+	mlm_reassoc_req->sessionId = session_id;
+
+	/*
+	 * If telescopic beaconing is enabled, set listen interval to
+	 * CFG_TELE_BCN_MAX_LI
+	 */
+
+	tele_bcn_en = mac_ctx->mlme_cfg->sap_cfg.tele_bcn_wakeup_en;
+
+	if (tele_bcn_en)
+		val = mac_ctx->mlme_cfg->sap_cfg.tele_bcn_max_li;
+	else
+		val = mac_ctx->mlme_cfg->sap_cfg.listen_interval;
+
+	mlm_reassoc_req->listenInterval = (uint16_t) val;
+	if (mac_ctx->mlme_cfg->gen.enabled_11h &&
+	    ap_cap_info->spectrumMgt && bss_desc->nwType == eSIR_11A_NW_TYPE)
+		session_entry->spectrumMgtEnabled = true;
+
+	/* Enable the spectrum management if this is a DFS channel */
+	if (session_entry->country_info_present &&
+	    lim_isconnected_on_dfs_freq(
+		mac_ctx, session_entry->curr_op_freq))
+		session_entry->spectrumMgtEnabled = true;
+
+	session_entry->limPrevSmeState = session_entry->limSmeState;
+	session_entry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
+
+	MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, session_entry->peSessionId,
+			 session_entry->limSmeState));
+
+	status = lim_send_reassoc_req(session_entry, mlm_reassoc_req);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		qdf_mem_free(mlm_reassoc_req);
+		ret_code = eSIR_SME_REFUSED;
+		goto end;
+	}
+
+	return;
+end:
+	if (reassoc_req) {
+		qdf_mem_free(reassoc_req);
+		if (session_entry)
+			session_entry->pLimReAssocReq = NULL;
+	}
+
+	/*
+	 * Send Reassoc failure response to host
+	 * (note session_entry may be NULL, but that's OK)
+	 */
+	lim_send_sme_join_reassoc_rsp(mac_ctx, eWNI_SME_REASSOC_RSP,
+				      ret_code, STATUS_UNSPECIFIED_FAILURE,
+				      session_entry, vdev_id);
+}
+
+QDF_STATUS cm_process_reassoc_req(struct scheduler_msg *msg)
+{
+	struct cm_vdev_join_req *req;
+
+	if (!msg || !msg->bodyptr) {
+		mlme_err("msg or msg->bodyptr is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	req = msg->bodyptr;
+
+	lim_handle_reassoc_req(req);
+
+	cm_free_join_req(req);
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 #else
 
 /**
@@ -4558,6 +4882,7 @@ void lim_calculate_tpc(struct mac_context *mac,
 		 num_pwr_levels, is_psd_power, reg_max, ap_power_type_6g);
 }
 
+#ifndef FEATURE_CM_ENABLE
 /**
  * __lim_process_sme_reassoc_req() - process reassoc req
  *
@@ -4604,7 +4929,6 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx,
 	}
 	qdf_mem_copy(reassoc_req, in_req, in_req->length);
 
-#ifndef FEATURE_CM_ENABLE
 	if (!lim_is_sme_join_req_valid(mac_ctx, reassoc_req)) {
 		/*
 		 * Received invalid eWNI_SME_REASSOC_REQ
@@ -4614,7 +4938,7 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx,
 		ret_code = eSIR_SME_INVALID_PARAMETERS;
 		goto end;
 	}
-#endif
+
 	session_entry = pe_find_session_by_bssid(mac_ctx,
 			reassoc_req->bssDescription.bssId,
 			&session_id);
@@ -4918,6 +5242,7 @@ end:
 				      ret_code, STATUS_UNSPECIFIED_FAILURE,
 				      session_entry, vdev_id);
 }
+#endif
 
 bool send_disassoc_frame = 1;
 /**
@@ -7462,11 +7787,10 @@ bool lim_process_sme_req_messages(struct mac_context *mac,
 	case eWNI_SME_JOIN_REQ:
 		__lim_process_sme_join_req(mac, msg_buf);
 		break;
-#endif
 	case eWNI_SME_REASSOC_REQ:
 		__lim_process_sme_reassoc_req(mac, msg_buf);
 		break;
-
+#endif
 	case eWNI_SME_DISASSOC_REQ:
 		lim_process_sme_disassoc_req(mac, pMsg);
 		break;

+ 6 - 2
core/mac/src/pe/lim/lim_send_frames_host_roam.c

@@ -266,8 +266,12 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(struct mac_context *mac_ctx,
 			else
 				rate = TSRS_11B_RATE_5_5MBPS;
 
-			if (pe_session->pLimReAssocReq->eseTspecInfo.
-			    numTspecs) {
+#ifdef FEATURE_CM_ENABLE
+			if (mlme_priv->connect_info.ese_tspec_info.numTspecs)
+#else
+			if (pe_session->pLimReAssocReq->eseTspecInfo.numTspecs)
+#endif
+			{
 				struct ese_tsrs_ie tsrs_ie;
 
 				tsrs_ie.tsid = 0;

+ 21 - 12
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -1894,18 +1894,15 @@ populate_dot11f_supp_channels(struct mac_context *mac,
 {
 	uint8_t i;
 	uint8_t *p;
+	struct supported_channels supportedChannels;
+
+	wlan_add_supported_5Ghz_channels(mac->psoc, mac->pdev,
+					 supportedChannels.channelList,
+					 &supportedChannels.numChnl,
+					 false);
+	p = supportedChannels.channelList;
+	pDot11f->num_bands = supportedChannels.numChnl;
 
-	if (nAssocType == LIM_REASSOC) {
-		p = (uint8_t *) pe_session->pLimReAssocReq->
-		    supportedChannels.channelList;
-		pDot11f->num_bands =
-			pe_session->pLimReAssocReq->supportedChannels.numChnl;
-	} else {
-		p = (uint8_t *)pe_session->lim_join_req->supportedChannels.
-		    channelList;
-		pDot11f->num_bands =
-			pe_session->lim_join_req->supportedChannels.numChnl;
-	}
 	for (i = 0U; i < pDot11f->num_bands; ++i, ++p) {
 		pDot11f->bands[i][0] = *p;
 		pDot11f->bands[i][1] = 1;
@@ -2145,15 +2142,27 @@ void populate_dot11f_wmm_caps(tDot11fIEWMMCaps *pCaps)
 } /* End PopulateDot11fWmmCaps. */
 
 #ifdef FEATURE_WLAN_ESE
+#ifdef WLAN_FEATURE_HOST_ROAM
 void populate_dot11f_re_assoc_tspec(struct mac_context *mac,
 				    tDot11fReAssocRequest *pReassoc,
 				    struct pe_session *pe_session)
 {
 	uint8_t numTspecs = 0, idx;
 	tTspecInfo *pTspec = NULL;
+#ifdef FEATURE_CM_ENABLE
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(pe_session->vdev);
+	if (!mlme_priv)
+		return;
+
+	numTspecs = mlme_priv->connect_info.ese_tspec_info.numTspecs;
+	pTspec = &mlme_priv->connect_info.ese_tspec_info.tspec[0];
+#else
 
 	numTspecs = pe_session->pLimReAssocReq->eseTspecInfo.numTspecs;
 	pTspec = &pe_session->pLimReAssocReq->eseTspecInfo.tspec[0];
+#endif
 	pReassoc->num_WMMTSPEC = numTspecs;
 	if (numTspecs) {
 		for (idx = 0; idx < numTspecs; idx++) {
@@ -2164,7 +2173,7 @@ void populate_dot11f_re_assoc_tspec(struct mac_context *mac,
 		}
 	}
 }
-
+#endif
 void ese_populate_wmm_tspec(struct mac_tspec_ie *source,
 			    ese_wmm_tspec_ie *dest)
 {

+ 0 - 15
core/sme/inc/sme_api.h

@@ -2850,21 +2850,6 @@ void sme_clear_sae_single_pmk_info(struct wlan_objmgr_psoc *psoc,
 void sme_send_hlp_ie_info(mac_handle_t mac_handle, uint8_t vdev_id,
 			  uint32_t if_addr);
 
-/**
- * sme_update_session_assoc_ie() - Updates the assoc IEs to csr_roam_session
- * @mac_handle: Opaque handle to the global MAC context
- * @vdev_id: vdev id
- * @assoc_ie: assoc ie
- *
- * This API is used to copy the assoc IE sent from user space to
- * csr_roam_session
- *
- * Return: None
- */
-void sme_update_session_assoc_ie(mac_handle_t mac_handle,
-				 uint8_t vdev_id,
-				 struct element_info *assoc_ie);
-
 /**
  * sme_send_rso_connect_params() - Updates the assoc IEs to csr_roam_session
  * @mac_handle: Opaque handle to the global MAC context

+ 0 - 37
core/sme/src/common/sme_api.c

@@ -5963,43 +5963,6 @@ QDF_STATUS sme_update_roam_rssi_diff(mac_handle_t mac_handle, uint8_t vdev_id,
 					  ROAM_RSSI_DIFF, &src_config);
 }
 
-void sme_update_session_assoc_ie(mac_handle_t mac_handle,
-				 uint8_t vdev_id,
-				 struct element_info *assoc_ie)
-{
-	struct mac_context *mac = MAC_CONTEXT(mac_handle);
-	struct rso_config *rso_cfg;
-	struct wlan_objmgr_vdev *vdev;
-
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac->psoc, vdev_id,
-						    WLAN_MLME_CM_ID);
-	if (!vdev) {
-		mlme_err("vdev object is NULL for vdev %d", vdev_id);
-		return;
-	}
-	rso_cfg = wlan_cm_get_rso_config(vdev);
-	if (!rso_cfg)
-		goto rel_vdev_ref;
-
-	if (rso_cfg->assoc_ie.ptr) {
-		qdf_mem_free(rso_cfg->assoc_ie.ptr);
-		rso_cfg->assoc_ie.ptr = NULL;
-		rso_cfg->assoc_ie.len = 0;
-	}
-	if (!assoc_ie->len) {
-		sme_debug("Assoc IE len 0");
-		goto rel_vdev_ref;
-	}
-	rso_cfg->assoc_ie.ptr = qdf_mem_malloc(assoc_ie->len);
-	if (!rso_cfg->assoc_ie.ptr)
-		goto rel_vdev_ref;
-
-	rso_cfg->assoc_ie.len = assoc_ie->len;
-	qdf_mem_copy(rso_cfg->assoc_ie.ptr, assoc_ie->ptr, assoc_ie->len);
-rel_vdev_ref:
-	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
-}
-
 QDF_STATUS sme_send_rso_connect_params(mac_handle_t mac_handle,
 				       uint8_t vdev_id,
 				       struct csr_roam_profile *src_profile)

+ 62 - 15
core/sme/src/csr/csr_api_roam.c

@@ -12283,9 +12283,36 @@ QDF_STATUS csr_cm_update_fils_info(struct wlan_objmgr_vdev *vdev,
 }
 #endif
 
-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)
+#if defined(WLAN_FEATURE_HOST_ROAM) && defined(FEATURE_WLAN_ESE)
+static void csr_update_tspec_info(struct mac_context *mac_ctx,
+				  struct wlan_objmgr_vdev *vdev,
+				  tDot11fBeaconIEs *ie_struct)
+{
+	struct mlme_legacy_priv *mlme_priv;
+	tESETspecInfo *ese_tspec;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv)
+		return;
+	if (!cm_is_ese_connection(vdev, ie_struct->ESEVersion.present))
+		return;
+
+	ese_tspec = &mlme_priv->connect_info.ese_tspec_info;
+	qdf_mem_zero(ese_tspec, sizeof(tESETspecInfo));
+	ese_tspec->numTspecs = sme_qos_ese_retrieve_tspec_info(mac_ctx,
+					wlan_vdev_get_id(vdev),
+					ese_tspec->tspec);
+}
+#else
+static inline void csr_update_tspec_info(struct mac_context *mac_ctx,
+					 struct wlan_objmgr_vdev *vdev,
+					 tDot11fBeaconIEs *ie_struct) {}
+#endif
+
+QDF_STATUS cm_csr_handle_join_req(struct wlan_objmgr_vdev *vdev,
+				  struct wlan_cm_vdev_connect_req *req,
+				  struct cm_vdev_join_req *join_req,
+				  bool reassoc)
 {
 	struct mac_context *mac_ctx;
 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
@@ -12325,12 +12352,20 @@ QDF_STATUS cm_csr_handle_connect_req(struct wlan_objmgr_vdev *vdev,
 		qdf_mem_free(bss_desc);
 		return QDF_STATUS_E_FAILURE;
 	}
-	status = csr_cm_update_fils_info(vdev, bss_desc, req);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		sme_err("failed to update fils info vdev id %d", vdev_id);
-		qdf_mem_free(ie_struct);
-		qdf_mem_free(bss_desc);
-		return QDF_STATUS_E_FAILURE;
+
+	if (reassoc) {
+		csr_update_tspec_info(mac_ctx, vdev, ie_struct);
+	} else {
+		status = csr_cm_update_fils_info(vdev, bss_desc, req);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			sme_err("failed to update fils info vdev id %d",
+				vdev_id);
+			qdf_mem_free(ie_struct);
+			qdf_mem_free(bss_desc);
+			return QDF_STATUS_E_FAILURE;
+		}
+		sme_qos_csr_event_ind(mac_ctx, vdev_id,
+				      SME_QOS_CSR_JOIN_REQ, NULL);
 	}
 
 	csr_set_qos_to_cfg(mac_ctx, vdev_id,
@@ -12447,6 +12482,23 @@ static inline void csr_qos_send_assoc_ind(struct mac_context *mac_ctx,
 			      assoc_info);
 }
 
+#ifdef WLAN_FEATURE_ROAM_OFFLOAD
+static void
+csr_qso_disconnect_complete_ind(struct mac_context *mac_ctx,
+				struct wlan_cm_connect_resp *connect_rsp)
+{
+	if (IS_ROAM_REASON_DISCONNECTION(
+		connect_rsp->roaming_info->roam_reason))
+		sme_qos_csr_event_ind(mac_ctx, connect_rsp->vdev_id,
+				      SME_QOS_CSR_DISCONNECT_ROAM_COMPLETE,
+				      NULL);
+}
+#else
+static inline void
+csr_qso_disconnect_complete_ind(struct mac_context *mac_ctx,
+				struct wlan_cm_connect_resp *connect_rsp) {}
+#endif
+
 static void
 csr_qos_send_reassoc_ind(struct mac_context *mac_ctx,
 			 uint8_t vdev_id,
@@ -12462,11 +12514,7 @@ csr_qos_send_reassoc_ind(struct mac_context *mac_ctx,
 	sme_qos_csr_event_ind(mac_ctx, vdev_id, SME_QOS_CSR_REASSOC_COMPLETE,
 			      assoc_info);
 
-	if (IS_ROAM_REASON_DISCONNECTION(
-		connect_rsp->roaming_info->roam_reason))
-		sme_qos_csr_event_ind(mac_ctx, vdev_id,
-				      SME_QOS_CSR_DISCONNECT_ROAM_COMPLETE,
-				      NULL);
+	csr_qso_disconnect_complete_ind(mac_ctx, connect_rsp);
 }
 #else
 static inline void csr_qos_send_disconnect_ind(struct mac_context *mac_ctx,
@@ -13076,7 +13124,6 @@ QDF_STATUS csr_send_join_req_msg(struct mac_context *mac, uint32_t sessionId,
 		if (!QDF_IS_STATUS_SUCCESS(status))
 			break;
 
-		csr_join_req->messageType = messageType;
 		csr_join_req->length = msgLen;
 		csr_join_req->vdev_id = (uint8_t) sessionId;
 		if (pIes->SSID.present &&