Jelajahi Sumber

qcacld-3.0: Refactor connect complete code

Refactor connect complete code and move common code
for connection manager and legacy path to a common function
to remove the duplication of the code.

Change-Id: I25e39635005efd9ad19174e9f26d009946912cdb
CRs-Fixed: 2842413
Ashish Kumar Dhanotiya 4 tahun lalu
induk
melakukan
ee71cc8bd4

+ 0 - 2
Kbuild

@@ -423,9 +423,7 @@ ifeq ($(CONFIG_WLAN_ENABLE_GPIO_WAKEUP),y)
 HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_gpio_wakeup.o
 endif
 
-ifeq ($(CONFIG_CM_ENABLE), y)
 HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_cm_connect.o
-endif
 HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_cm_disconnect.o
 
 

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

@@ -212,6 +212,17 @@ struct mscs_req_info {
 };
 #endif
 
+/**
+ * struct mlme_connect_info - mlme connect information
+ * @timing_meas_cap: Timing meas cap
+ * @oem_channel_info: oem channel info
+ */
+
+struct mlme_connect_info {
+	uint8_t timing_meas_cap;
+	struct oem_channel_info chan_info;
+};
+
 /**
  * struct mlme_legacy_priv - VDEV MLME legacy priv object
  * @chan_switch_in_progress: flag to indicate that channel switch is in progress
@@ -275,6 +286,7 @@ struct mlme_legacy_priv {
 	tDot11fIEhe_cap he_config;
 	uint32_t he_sta_obsspd;
 #endif
+	struct mlme_connect_info connect_info;
 };
 
 /**

+ 50 - 2
core/hdd/inc/wlan_hdd_assoc.h

@@ -126,7 +126,6 @@ struct hdd_conn_flag {
  * @peer_macaddr:Peer Mac Address of the IBSS Stations
  * @auth_type: Auth Type
  * @uc_encrypt_type: Unicast Encryption Type
- * @mc_encrypt_type: Multicast Encryption Type
  * @is_authenticated: Remembers authenticated state
  * @dot11mode: dot11mode
  * @proxy_arp_service: proxy arp service
@@ -161,7 +160,6 @@ struct hdd_connection_info {
 	struct qdf_mac_addr peer_macaddr[MAX_PEERS];
 	enum csr_akm_type auth_type;
 	eCsrEncryptionType uc_encrypt_type;
-	eCsrEncryptionType mc_encrypt_type;
 	uint8_t is_authenticated;
 	uint32_t dot11mode;
 	uint8_t proxy_arp_service;
@@ -535,4 +533,54 @@ void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter);
  */
 int hdd_remove_beacon_filter(struct hdd_adapter *adapter);
 
+/**
+ * hdd_copy_ht_operation()- copy HT operation element to
+ * hdd station context.
+ * @hdd_sta_ctx: pointer to hdd station context
+ * @ht_ops: pointer to ht operation
+ *
+ * Return: None
+ */
+void hdd_copy_ht_operation(struct hdd_station_ctx *hdd_sta_ctx,
+			   tDot11fIEHTInfo *ht_ops);
+
+/**
+ * hdd_copy_vht_operation()- copy VHT operations element to
+ * hdd station context.
+ * @hdd_sta_ctx: pointer to hdd station context
+ * @vht_ops: pointer to vht operation
+ *
+ * Return: None
+ */
+void hdd_copy_vht_operation(struct hdd_station_ctx *hdd_sta_ctx,
+			    tDot11fIEVHTOperation *vht_ops);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) && \
+     defined(WLAN_FEATURE_11AX)
+/**
+ * hdd_copy_he_operation()- copy HE operations element to
+ * hdd station context.
+ * @hdd_sta_ctx: pointer to hdd station context
+ * @he_operation: pointer to he operation
+ *
+ * Return: None
+ */
+void hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
+			   tDot11fIEhe_op *he_operation);
+#else
+static inline void hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
+					 tDot11fIEhe_op *he_operation)
+{
+}
+#endif
+
+/**
+ * hdd_is_roam_sync_in_progress()- Check if roam offloaded
+ * @hdd_ctx: Pointer to hdd context
+ * @vdev_id: Vdev id
+ *
+ * Return: roam sync status if roaming offloaded else false
+ */
+bool hdd_is_roam_sync_in_progress(struct hdd_context *hdd_ctx, uint8_t vdev_id);
+
 #endif

+ 70 - 127
core/hdd/src/wlan_hdd_assoc.c

@@ -837,47 +837,38 @@ void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap,
 /* stbc_param */
 #define HT_STBC_PARAM_MCS 0x007f
 
-/**
- * hdd_copy_ht_operation()- copy HT operation element from roam info to
- *  hdd station context.
- * @hdd_sta_ctx: pointer to hdd station context
- * @roam_info: pointer to roam info
- *
- * Return: None
- */
-static void hdd_copy_ht_operation(struct hdd_station_ctx *hdd_sta_ctx,
-					    struct csr_roam_info *roam_info)
+void hdd_copy_ht_operation(struct hdd_station_ctx *hdd_sta_ctx,
+			   tDot11fIEHTInfo *ht_ops)
 {
-	tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation;
 	struct ieee80211_ht_operation *hdd_ht_ops =
 		&hdd_sta_ctx->conn_info.ht_operation;
 	uint32_t i, temp_ht_ops;
 
 	qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation));
 
-	hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel;
+	hdd_ht_ops->primary_chan = ht_ops->primaryChannel;
 
 	/* HT_PARAMS */
-	temp_ht_ops = roam_ht_ops->secondaryChannelOffset &
+	temp_ht_ops = ht_ops->secondaryChannelOffset &
 		IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
 	if (temp_ht_ops)
 		hdd_ht_ops->ht_param |= temp_ht_ops;
 	else
 		hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE;
-	if (roam_ht_ops->recommendedTxWidthSet)
+	if (ht_ops->recommendedTxWidthSet)
 		hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY;
-	if (roam_ht_ops->rifsMode)
+	if (ht_ops->rifsMode)
 		hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE;
-	if (roam_ht_ops->controlledAccessOnly)
+	if (ht_ops->controlledAccessOnly)
 		hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY;
-	temp_ht_ops = roam_ht_ops->serviceIntervalGranularity &
+	temp_ht_ops = ht_ops->serviceIntervalGranularity &
 		(HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT);
 	if (temp_ht_ops)
 		hdd_ht_ops->ht_param |= temp_ht_ops <<
 			HT_PARAM_SERVICE_INT_GRAN_SHIFT;
 
 	/* operation mode */
-	temp_ht_ops = roam_ht_ops->opMode &
+	temp_ht_ops = ht_ops->opMode &
 			IEEE80211_HT_OP_MODE_PROTECTION;
 	switch (temp_ht_ops) {
 	case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER:
@@ -897,41 +888,41 @@ static void hdd_copy_ht_operation(struct hdd_station_ctx *hdd_sta_ctx,
 		hdd_ht_ops->operation_mode |=
 			IEEE80211_HT_OP_MODE_PROTECTION_NONE;
 	}
-	if (roam_ht_ops->nonGFDevicesPresent)
+	if (ht_ops->nonGFDevicesPresent)
 		hdd_ht_ops->operation_mode |=
 			IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT;
-	if (roam_ht_ops->transmitBurstLimit)
+	if (ht_ops->transmitBurstLimit)
 		hdd_ht_ops->operation_mode |=
 			HT_OP_MODE_TX_BURST_LIMIT;
-	if (roam_ht_ops->obssNonHTStaPresent)
+	if (ht_ops->obssNonHTStaPresent)
 		hdd_ht_ops->operation_mode |=
 			IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT;
 
 	/* stbc_param */
-	temp_ht_ops = roam_ht_ops->basicSTBCMCS &
+	temp_ht_ops = ht_ops->basicSTBCMCS &
 			HT_STBC_PARAM_MCS;
 	if (temp_ht_ops)
 		hdd_ht_ops->stbc_param |= temp_ht_ops;
-	if (roam_ht_ops->dualCTSProtection)
+	if (ht_ops->dualCTSProtection)
 		hdd_ht_ops->stbc_param |=
 			IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT;
-	if (roam_ht_ops->secondaryBeacon)
+	if (ht_ops->secondaryBeacon)
 		hdd_ht_ops->stbc_param |=
 			IEEE80211_HT_STBC_PARAM_STBC_BEACON;
-	if (roam_ht_ops->lsigTXOPProtectionFullSupport)
+	if (ht_ops->lsigTXOPProtectionFullSupport)
 		hdd_ht_ops->stbc_param |=
 			IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT;
-	if (roam_ht_ops->pcoActive)
+	if (ht_ops->pcoActive)
 		hdd_ht_ops->stbc_param |=
 			IEEE80211_HT_STBC_PARAM_PCO_ACTIVE;
-	if (roam_ht_ops->pcoPhase)
+	if (ht_ops->pcoPhase)
 		hdd_ht_ops->stbc_param |=
 			IEEE80211_HT_STBC_PARAM_PCO_PHASE;
 
 	/* basic MCs set */
 	for (i = 0; i < 16; ++i)
 		hdd_ht_ops->basic_set[i] =
-			roam_ht_ops->basicMCSSet[i];
+			ht_ops->basicMCSSet[i];
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
@@ -950,47 +941,37 @@ static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops,
 }
 #endif /* KERNEL_VERSION(4, 12, 0) */
 
-/**
- * hdd_copy_vht_operation()- copy VHT operations element from roam info to
- *  hdd station context.
- * @hdd_sta_ctx: pointer to hdd station context
- * @roam_info: pointer to roam info
- *
- * Return: None
- */
-static void hdd_copy_vht_operation(struct hdd_station_ctx *hdd_sta_ctx,
-					      struct csr_roam_info *roam_info)
+void hdd_copy_vht_operation(struct hdd_station_ctx *hdd_sta_ctx,
+			    tDot11fIEVHTOperation *vht_ops)
 {
-	tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation;
 	struct ieee80211_vht_operation *hdd_vht_ops =
 		&hdd_sta_ctx->conn_info.vht_operation;
 
 	qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation));
 
-	hdd_vht_ops->chan_width = roam_vht_ops->chanWidth;
-	hdd_copy_vht_center_freq(hdd_vht_ops, roam_vht_ops);
-	hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet;
+	hdd_vht_ops->chan_width = vht_ops->chanWidth;
+	hdd_copy_vht_center_freq(hdd_vht_ops, vht_ops);
+	hdd_vht_ops->basic_mcs_set = vht_ops->basicMCSSet;
 }
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) && \
      defined(WLAN_FEATURE_11AX)
-static void hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
-				  struct csr_roam_info *roam_info)
+void hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
+			   tDot11fIEhe_op *he_operation)
 {
-	tDot11fIEhe_op *roam_he_operation = &roam_info->he_operation;
 	struct ieee80211_he_operation *hdd_he_operation;
 	uint32_t he_oper_params = 0;
 	uint32_t len = 0, filled = 0;
 	uint8_t he_oper_6g_params = 0;
 	uint32_t he_oper_len;
 
-	if (!roam_he_operation->present)
+	if (!he_operation->present)
 		return;
-	if (roam_he_operation->vht_oper_present)
+	if (he_operation->vht_oper_present)
 		len += 3;
-	if (roam_he_operation->co_located_bss)
+	if (he_operation->co_located_bss)
 		len += 1;
-	if (roam_he_operation->oper_info_6g_present)
+	if (he_operation->oper_info_6g_present)
 		len += 5;
 
 	he_oper_len = sizeof(struct ieee80211_he_operation) + len;
@@ -1000,67 +981,67 @@ static void hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
 		return;
 
 	/* Fill he_oper_params */
-	he_oper_params |= roam_he_operation->default_pe <<
+	he_oper_params |= he_operation->default_pe <<
 					HE_OPERATION_DFLT_PE_DURATION_POS;
-	he_oper_params |= roam_he_operation->twt_required <<
+	he_oper_params |= he_operation->twt_required <<
 					HE_OPERATION_TWT_REQUIRED_POS;
-	he_oper_params |= roam_he_operation->txop_rts_threshold <<
+	he_oper_params |= he_operation->txop_rts_threshold <<
 					HE_OPERATION_RTS_THRESHOLD_POS;
-	he_oper_params |= roam_he_operation->vht_oper_present <<
+	he_oper_params |= he_operation->vht_oper_present <<
 					HE_OPERATION_VHT_OPER_POS;
-	he_oper_params |= roam_he_operation->co_located_bss <<
+	he_oper_params |= he_operation->co_located_bss <<
 					HE_OPERATION_CO_LOCATED_BSS_POS;
-	he_oper_params |= roam_he_operation->er_su_disable <<
+	he_oper_params |= he_operation->er_su_disable <<
 					HE_OPERATION_ER_SU_DISABLE_POS;
-	he_oper_params |= roam_he_operation->oper_info_6g_present <<
+	he_oper_params |= he_operation->oper_info_6g_present <<
 					HE_OPERATION_OPER_INFO_6G_POS;
-	he_oper_params |= roam_he_operation->reserved2 <<
+	he_oper_params |= he_operation->reserved2 <<
 					HE_OPERATION_RESERVED_POS;
-	he_oper_params |= roam_he_operation->bss_color <<
+	he_oper_params |= he_operation->bss_color <<
 					HE_OPERATION_BSS_COLOR_POS;
-	he_oper_params |= roam_he_operation->partial_bss_col <<
+	he_oper_params |= he_operation->partial_bss_col <<
 					HE_OPERATION_PARTIAL_BSS_COLOR_POS;
-	he_oper_params |= roam_he_operation->bss_col_disabled <<
+	he_oper_params |= he_operation->bss_col_disabled <<
 					HE_OPERATION_BSS_COL_DISABLED_POS;
 
 	hdd_he_operation->he_oper_params = he_oper_params;
 
 	/* Fill he_mcs_nss set */
 	qdf_mem_copy(&hdd_he_operation->he_mcs_nss_set,
-		     roam_he_operation->basic_mcs_nss,
+		     he_operation->basic_mcs_nss,
 		     sizeof(hdd_he_operation->he_mcs_nss_set));
 
 	/* Fill he_params_optional fields */
 
-	if (roam_he_operation->vht_oper_present) {
+	if (he_operation->vht_oper_present) {
 		hdd_he_operation->optional[filled++] =
-			roam_he_operation->vht_oper.info.chan_width;
+			he_operation->vht_oper.info.chan_width;
 		hdd_he_operation->optional[filled++] =
-			roam_he_operation->vht_oper.info.center_freq_seg0;
+			he_operation->vht_oper.info.center_freq_seg0;
 		hdd_he_operation->optional[filled++] =
-			roam_he_operation->vht_oper.info.center_freq_seg1;
+			he_operation->vht_oper.info.center_freq_seg1;
 	}
-	if (roam_he_operation->co_located_bss)
+	if (he_operation->co_located_bss)
 		hdd_he_operation->optional[filled++] =
-				roam_he_operation->maxbssid_ind.info.data;
+				he_operation->maxbssid_ind.info.data;
 
-	if (roam_he_operation->oper_info_6g_present) {
+	if (he_operation->oper_info_6g_present) {
 		hdd_he_operation->optional[filled++] =
-			roam_he_operation->oper_info_6g.info.primary_ch;
+			he_operation->oper_info_6g.info.primary_ch;
 		he_oper_6g_params |=
-			roam_he_operation->oper_info_6g.info.ch_width << 0;
+			he_operation->oper_info_6g.info.ch_width << 0;
 		he_oper_6g_params |=
-			roam_he_operation->oper_info_6g.info.dup_bcon << 2;
+			he_operation->oper_info_6g.info.dup_bcon << 2;
 		he_oper_6g_params |=
-			roam_he_operation->oper_info_6g.info.reserved << 3;
+			he_operation->oper_info_6g.info.reserved << 3;
 
 		hdd_he_operation->optional[filled++] = he_oper_6g_params;
 		hdd_he_operation->optional[filled++] =
-			roam_he_operation->oper_info_6g.info.center_freq_seg0;
+			he_operation->oper_info_6g.info.center_freq_seg0;
 		hdd_he_operation->optional[filled++] =
-			roam_he_operation->oper_info_6g.info.center_freq_seg1;
+			he_operation->oper_info_6g.info.center_freq_seg1;
 		hdd_he_operation->optional[filled] =
-				roam_he_operation->oper_info_6g.info.min_rate;
+				he_operation->oper_info_6g.info.min_rate;
 	}
 
 	if (hdd_sta_ctx->cache_conn_info.he_operation) {
@@ -1072,22 +1053,20 @@ static void hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
 
 	hdd_sta_ctx->cache_conn_info.he_operation = hdd_he_operation;
 }
+
+static void __hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
+				    struct csr_roam_info *roam_info)
+{
+	hdd_copy_he_operation(hdd_sta_ctx, &roam_info->he_operation);
+}
 #else
-static inline void hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
-					 struct csr_roam_info *roam_info)
+static inline void __hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
+					   struct csr_roam_info *roam_info)
 {
 }
 #endif
 
-/**
- * hdd_is_roam_sync_in_progress()- Check if roam offloaded
- * @hdd_ctx: Pointer to hdd context
- * @vdev_id: Vdev id
- *
- * Return: roam sync status if roaming offloaded else false
- */
-static bool hdd_is_roam_sync_in_progress(struct hdd_context *hdd_ctx,
-					 uint8_t vdev_id)
+bool hdd_is_roam_sync_in_progress(struct hdd_context *hdd_ctx, uint8_t vdev_id)
 {
 	return MLME_IS_ROAM_SYNCH_IN_PROGRESS(hdd_ctx->psoc, vdev_id);
 }
@@ -1134,13 +1113,13 @@ static void hdd_save_bss_info(struct hdd_adapter *adapter,
 	}
 	if (roam_info->ht_operation.present) {
 		hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true;
-		hdd_copy_ht_operation(hdd_sta_ctx, roam_info);
+		hdd_copy_ht_operation(hdd_sta_ctx, &roam_info->ht_operation);
 	} else {
 		hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false;
 	}
 	if (roam_info->vht_operation.present) {
 		hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true;
-		hdd_copy_vht_operation(hdd_sta_ctx, roam_info);
+		hdd_copy_vht_operation(hdd_sta_ctx, &roam_info->vht_operation);
 	} else {
 		hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false;
 	}
@@ -1152,7 +1131,7 @@ static void hdd_save_bss_info(struct hdd_adapter *adapter,
 	qdf_mem_copy(&hdd_sta_ctx->cache_conn_info, &hdd_sta_ctx->conn_info,
 		     sizeof(hdd_sta_ctx->cache_conn_info));
 
-	hdd_copy_he_operation(hdd_sta_ctx, roam_info);
+	__hdd_copy_he_operation(hdd_sta_ctx, roam_info);
 }
 
 /**
@@ -1197,7 +1176,6 @@ hdd_conn_save_connect_info(struct hdd_adapter *adapter,
 			/* Get Multicast Encryption Type */
 			encrypt_type =
 			    roam_info->u.pConnectedProfile->mcEncryptionType;
-			sta_ctx->conn_info.mc_encrypt_type = encrypt_type;
 			/* Get Unicast Encryption Type */
 			encrypt_type =
 				roam_info->u.pConnectedProfile->EncryptionType;
@@ -1540,7 +1518,6 @@ hdd_send_update_beacon_ies_event(struct hdd_adapter *adapter,
 static void hdd_send_association_event(struct net_device *dev,
 				       struct csr_roam_info *roam_info)
 {
-	int ret;
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
@@ -1578,8 +1555,6 @@ static void hdd_send_association_event(struct net_device *dev,
 		memcpy(wrqu.ap_addr.sa_data, roam_info->bss_desc->bssId,
 		       sizeof(roam_info->bss_desc->bssId));
 
-		ucfg_p2p_status_connect(adapter->vdev);
-
 		hdd_nofl_info("%s(vdevid-%d): " QDF_MAC_ADDR_FMT
 			      " connected to "
 			      QDF_MAC_ADDR_FMT, dev->name, adapter->vdev_id,
@@ -1624,12 +1599,6 @@ static void hdd_send_association_event(struct net_device *dev,
 		chan_info.reg_info_2 =
 			roam_info->chan_info.reg_info_2;
 
-		ret = hdd_objmgr_set_peer_mlme_state(adapter->vdev,
-						     WLAN_ASSOC_STATE);
-		if (ret)
-			hdd_err("Peer object "QDF_MAC_ADDR_FMT" fail to set associated state",
-				QDF_MAC_ADDR_REF(peer_macaddr.bytes));
-
 		/* send peer status indication to oem app */
 		hdd_send_peer_status_ind_to_app(&peer_macaddr,
 						ePeerConnected,
@@ -1645,16 +1614,7 @@ static void hdd_send_association_event(struct net_device *dev,
 				       adapter->vdev);
 #endif
 
-		hdd_add_latency_critical_client(
-			adapter,
-			hdd_convert_cfgdot11mode_to_80211mode(
-				sta_ctx->conn_info.dot11mode));
-		/* start timer in sta/p2p_cli */
-		hdd_bus_bw_compute_prev_txrx_stats(adapter);
-		hdd_bus_bw_compute_timer_start(hdd_ctx);
-
-		if (ucfg_pkt_capture_get_pktcap_mode(hdd_ctx->psoc))
-			ucfg_pkt_capture_record_channel(adapter->vdev);
+		hdd_cm_handle_assoc_event(adapter->vdev, peer_macaddr.bytes);
 	} else {                /* Not Associated */
 		hdd_nofl_info("%s(vdevid-%d): disconnected", dev->name,
 			      adapter->vdev_id);
@@ -1694,7 +1654,6 @@ void hdd_conn_remove_connect_info(struct hdd_station_ctx *sta_ctx)
 
 	/* Clear all security settings */
 	sta_ctx->conn_info.auth_type = eCSR_AUTH_TYPE_OPEN_SYSTEM;
-	sta_ctx->conn_info.mc_encrypt_type = eCSR_ENCRYPT_TYPE_NONE;
 	sta_ctx->conn_info.uc_encrypt_type = eCSR_ENCRYPT_TYPE_NONE;
 
 	sta_ctx->conn_info.proxy_arp_service = 0;
@@ -2721,7 +2680,6 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 	struct net_device *dev = adapter->dev;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-	int8_t snr = 0;
 	QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE;
 	uint8_t *reqRsnIe;
 	uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len;
@@ -2748,22 +2706,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	hdd_get_rssi_snr_by_bssid(adapter, sta_ctx->conn_info.bssid.bytes,
-				  &adapter->rssi, &snr);
-
-	/* If RSSi is reported as positive then it is invalid */
-	if (adapter->rssi > 0) {
-		hdd_debug_rl("RSSI invalid %d", adapter->rssi);
-		adapter->rssi = 0;
-	}
-
-	hdd_debug("snr: %d, rssi: %d", snr, adapter->rssi);
-
-	sta_ctx->conn_info.signal = adapter->rssi;
-	sta_ctx->conn_info.noise =
-		sta_ctx->conn_info.signal - snr;
-	sta_ctx->cache_conn_info.signal = sta_ctx->conn_info.signal;
-	sta_ctx->cache_conn_info.noise = sta_ctx->conn_info.noise;
+	hdd_cm_update_rssi_snr_by_bssid(adapter);
 
 	hdd_save_connect_status(adapter, roam_info);
 	/*

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

@@ -19622,7 +19622,6 @@ static int wlan_hdd_cfg80211_set_cipher(struct hdd_adapter *adapter,
 		roam_profile->EncryptionType.encryptionType[0] =
 			encryptionType;
 	} else {
-		sta_ctx->conn_info.mc_encrypt_type = encryptionType;
 		roam_profile->mcEncryptionType.numEntries = 1;
 		roam_profile->mcEncryptionType.encryptionType[0] =
 			encryptionType;
@@ -20471,7 +20470,6 @@ static void wlan_hdd_cfg80211_clear_privacy(struct hdd_adapter *adapter)
 
 	hdd_sta_ctx->conn_info.uc_encrypt_type = eCSR_ENCRYPT_TYPE_NONE;
 	hdd_sta_ctx->roam_profile.EncryptionType.numEntries = 0;
-	hdd_sta_ctx->conn_info.mc_encrypt_type = eCSR_ENCRYPT_TYPE_NONE;
 	hdd_sta_ctx->roam_profile.mcEncryptionType.numEntries = 0;
 
 	wlan_hdd_clear_wapi_privacy(adapter);

+ 19 - 0
core/hdd/src/wlan_hdd_cm_api.h

@@ -111,4 +111,23 @@ void __hdd_cm_disconnect_handler_pre_user_update(struct hdd_adapter *adapter);
  */
 void __hdd_cm_disconnect_handler_post_user_update(struct hdd_adapter *adapter);
 
+/**
+ * hdd_cm_update_rssi_snr_by_bssid() - update rsi and snr into adapter
+ * @adapter: Pointer to adapter
+ *
+ * Return: None
+ */
+void hdd_cm_update_rssi_snr_by_bssid(struct hdd_adapter *adapter);
+
+/**
+ *  hdd_cm_handle_assoc_event() - Send disassociation indication to oem
+ * app
+ * @vdev: Pointer to adapter
+ * @peer_mac: Pointer to peer mac address
+ *
+ * Return: None
+ */
+void hdd_cm_handle_assoc_event(struct wlan_objmgr_vdev *vdev,
+			       uint8_t *peer_mac);
+
 #endif

+ 288 - 31
core/hdd/src/wlan_hdd_cm_connect.c

@@ -36,7 +36,87 @@
 #include <wlan_hdd_ipa.h>
 #include <wlan_ipa_ucfg_api.h>
 #include <wlan_hdd_ftm_time_sync.h>
+#include "wlan_crypto_global_api.h"
+#include "wlan_vdev_mgr_ucfg_api.h"
+#include "wlan_hdd_bootup_marker.h"
 
+void hdd_cm_update_rssi_snr_by_bssid(struct hdd_adapter *adapter)
+{
+	struct hdd_station_ctx *sta_ctx;
+	int8_t snr = 0;
+
+	if (!adapter) {
+		hdd_err("adapter is NULL");
+		return;
+	}
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	if (!sta_ctx) {
+		hdd_err("sta_ctx is NULL");
+		return;
+	}
+
+	hdd_get_rssi_snr_by_bssid(adapter, sta_ctx->conn_info.bssid.bytes,
+				  &adapter->rssi, &snr);
+
+	/* If RSSi is reported as positive then it is invalid */
+	if (adapter->rssi > 0) {
+		hdd_debug_rl("RSSI invalid %d", adapter->rssi);
+		adapter->rssi = 0;
+	}
+
+	hdd_debug("snr: %d, rssi: %d", snr, adapter->rssi);
+
+	sta_ctx->conn_info.signal = adapter->rssi;
+	sta_ctx->conn_info.noise =
+		sta_ctx->conn_info.signal - snr;
+	sta_ctx->cache_conn_info.signal = sta_ctx->conn_info.signal;
+	sta_ctx->cache_conn_info.noise = sta_ctx->conn_info.noise;
+}
+
+void hdd_cm_handle_assoc_event(struct wlan_objmgr_vdev *vdev, uint8_t *peer_mac)
+{
+	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	struct hdd_adapter *adapter;
+	struct hdd_station_ctx *sta_ctx;
+	int ret;
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is NULL");
+		return;
+	}
+
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, wlan_vdev_get_id(vdev));
+	if (!adapter) {
+		hdd_err("adapter is NULL");
+		return;
+	}
+
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	if (!sta_ctx) {
+		hdd_err("sta_ctx is NULL");
+		return;
+	}
+
+	ucfg_p2p_status_connect(adapter->vdev);
+
+	ret = hdd_objmgr_set_peer_mlme_state(adapter->vdev,
+					     WLAN_ASSOC_STATE);
+	if (ret)
+		hdd_err("Peer object " QDF_MAC_ADDR_FMT " fail to set associated state",
+			QDF_MAC_ADDR_REF(peer_mac));
+	hdd_add_latency_critical_client(
+			adapter,
+			hdd_convert_cfgdot11mode_to_80211mode(
+				sta_ctx->conn_info.dot11mode));
+
+	hdd_bus_bw_compute_prev_txrx_stats(adapter);
+	hdd_bus_bw_compute_timer_start(hdd_ctx);
+
+	if (ucfg_pkt_capture_get_pktcap_mode(hdd_ctx->psoc))
+		ucfg_pkt_capture_record_channel(adapter->vdev);
+}
+
+#ifdef FEATURE_CM_ENABLE
 static void hdd_update_scan_ie_for_connect(struct hdd_adapter *adapter,
 					   struct osif_connect_params *params)
 {
@@ -145,9 +225,22 @@ static void
 hdd_cm_connect_failure_pre_user_update(struct wlan_objmgr_vdev *vdev,
 				       struct wlan_cm_connect_resp *rsp)
 {
-	/*
-	 * Check if failure of scan for sssid is handled in osif or not
-	 */
+	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	struct hdd_adapter *adapter;
+
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is NULL");
+		return;
+	}
+
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, wlan_vdev_get_id(vdev));
+	if (!adapter) {
+		hdd_err("adapter is NULL");
+		return;
+	}
+
+	hdd_cm_update_rssi_snr_by_bssid(adapter);
+
 	hdd_debug("Invoking packetdump deregistration API");
 	wlan_deregister_txrx_packetdump(OL_TXRX_PDEV_ID);
 }
@@ -187,45 +280,215 @@ static void hdd_cm_connect_failure(struct wlan_objmgr_vdev *vdev,
 	}
 }
 
+static void hdd_cm_save_bss_info(struct hdd_adapter *adapter,
+				 struct wlan_cm_connect_resp *rsp)
+{
+	struct hdd_context *hdd_ctx;
+	struct hdd_station_ctx *hdd_sta_ctx;
+	QDF_STATUS status;
+	mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter);
+	struct sDot11fAssocResponse *assoc_resp;
+
+	if (!adapter) {
+		hdd_err("Adapter is NULL");
+		return;
+	}
+
+	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is NULL");
+		return;
+	}
+
+	hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	if (!hdd_sta_ctx) {
+		hdd_err("hdd_sta_ctx is NULL");
+		return;
+	}
+
+	assoc_resp = qdf_mem_malloc(sizeof(struct sDot11fAssocResponse));
+	if (!assoc_resp)
+		return;
+
+	qdf_mem_zero(&hdd_sta_ctx->conn_info.hs20vendor_ie,
+		     sizeof(hdd_sta_ctx->conn_info.hs20vendor_ie));
+	sme_get_hs20vendor_ie(mac_handle, rsp->connect_ies.bcn_probe_rsp.ptr,
+			      rsp->connect_ies.bcn_probe_rsp.len,
+			      &hdd_sta_ctx->conn_info.hs20vendor_ie);
+
+	status = sme_unpack_assoc_rsp(mac_handle,
+				      rsp->connect_ies.assoc_req.ptr,
+				      rsp->connect_ies.assoc_req.len,
+				      assoc_resp);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("could not parse assoc response");
+		qdf_mem_free(assoc_resp);
+		return;
+	}
+
+	if (assoc_resp->VHTCaps.present) {
+		hdd_sta_ctx->conn_info.conn_flag.vht_present = true;
+		hdd_copy_vht_caps(&hdd_sta_ctx->conn_info.vht_caps,
+				  &assoc_resp->VHTCaps);
+	} else {
+		hdd_sta_ctx->conn_info.conn_flag.vht_present = false;
+	}
+	if (assoc_resp->HTCaps.present) {
+		hdd_sta_ctx->conn_info.conn_flag.ht_present = true;
+		hdd_copy_ht_caps(&hdd_sta_ctx->conn_info.ht_caps,
+				 &assoc_resp->HTCaps);
+	} else {
+		hdd_sta_ctx->conn_info.conn_flag.ht_present = false;
+	}
+	if (hdd_is_roam_sync_in_progress(hdd_ctx, adapter->vdev_id))
+		hdd_sta_ctx->conn_info.roam_count++;
+
+	if (assoc_resp->HTInfo.present) {
+		hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true;
+		hdd_copy_ht_operation(hdd_sta_ctx, &assoc_resp->HTInfo);
+	} else {
+		hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false;
+	}
+	if (assoc_resp->VHTOperation.present) {
+		hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true;
+		hdd_copy_vht_operation(hdd_sta_ctx, &assoc_resp->VHTOperation);
+	} else {
+		hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false;
+	}
+
+	/* Cleanup already existing he info */
+	hdd_cleanup_conn_info(adapter);
+
+	/* Cache last connection info */
+	qdf_mem_copy(&hdd_sta_ctx->cache_conn_info, &hdd_sta_ctx->conn_info,
+		     sizeof(hdd_sta_ctx->cache_conn_info));
+
+	hdd_copy_he_operation(hdd_sta_ctx, &assoc_resp->he_op);
+	qdf_mem_free(assoc_resp);
+}
+
+static void hdd_cm_save_connect_info(struct hdd_adapter *adapter,
+				     struct wlan_cm_connect_resp *rsp)
+{
+	struct hdd_station_ctx *sta_ctx;
+	struct wlan_crypto_params *crypto_params;
+	struct wlan_channel *des_chan;
+	struct wlan_objmgr_vdev *vdev;
+
+	if (!adapter) {
+		hdd_err("adapter is NULL");
+		return;
+	}
+
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	if (!sta_ctx) {
+		hdd_err("sta_ctx is NULL");
+		return;
+	}
+
+	qdf_copy_macaddr(&sta_ctx->conn_info.bssid, &rsp->bssid);
+
+	crypto_params = wlan_crypto_vdev_get_crypto_params(adapter->vdev);
+
+	sme_fill_enc_type(&sta_ctx->conn_info.uc_encrypt_type,
+			  crypto_params->ucastcipherset);
+
+	sme_fill_auth_type(&sta_ctx->conn_info.auth_type,
+			   crypto_params->authmodeset,
+			   crypto_params->key_mgmt,
+			   crypto_params->ucastcipherset);
+
+	des_chan = wlan_vdev_mlme_get_des_chan(adapter->vdev);
+
+	sta_ctx->conn_info.chan_freq = rsp->freq;
+
+	/* Save the ssid for the connection */
+	qdf_mem_copy(&sta_ctx->conn_info.ssid.SSID.ssId,
+		     &rsp->ssid.ssid,
+		     rsp->ssid.length);
+	qdf_mem_copy(&sta_ctx->conn_info.last_ssid.SSID.ssId,
+		     &rsp->ssid.ssid,
+		     rsp->ssid.length);
+	sta_ctx->conn_info.ssid.SSID.length = rsp->ssid.length;
+	sta_ctx->conn_info.last_ssid.SSID.length = rsp->ssid.length;
+
+	sta_ctx->conn_info.dot11mode =
+				sme_phy_mode_to_dot11mode(des_chan->ch_phymode);
+
+	sta_ctx->conn_info.ch_width = des_chan->ch_width;
+
+	vdev = hdd_objmgr_get_vdev(adapter);
+	if (vdev) {
+		sta_ctx->conn_info.nss = wlan_vdev_mlme_get_nss(vdev);
+		ucfg_wlan_vdev_mgr_get_param(vdev, WLAN_MLME_CFG_RATE_FLAGS,
+					     &sta_ctx->conn_info.rate_flags);
+		hdd_objmgr_put_vdev(vdev);
+	}
+
+	hdd_cm_save_bss_info(adapter, rsp);
+	/*
+	 *  proxy arp service, notify WMM
+	 * hdd_wmm_connect(adapter, roam_info, bss_type);
+	 */
+}
+
 static void
 hdd_cm_connect_success_pre_user_update(struct wlan_objmgr_vdev *vdev,
 				       struct wlan_cm_connect_resp *rsp)
 {
-	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
-	struct hdd_adapter *adapter = hdd_get_adapter_by_vdev(hdd_ctx,
-						wlan_vdev_get_id(vdev));
+	struct hdd_context *hdd_ctx;
+	struct hdd_adapter *adapter;
+	struct vdev_mlme_obj *vdev_mlme;
 	unsigned long rc;
-	int ret;
+
+	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	if (!hdd_ctx) {
+		hdd_err("hdd_ctx is NULL");
+		return;
+	}
+
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, wlan_vdev_get_id(vdev));
+	if (!adapter) {
+		hdd_err("adapter is NULL");
+		return;
+	}
+
+	hdd_cm_update_rssi_snr_by_bssid(adapter);
+
+	hdd_cm_save_connect_info(adapter, rsp);
+
+	if (hdd_add_beacon_filter(adapter) != 0)
+		hdd_err("add beacon fileter failed");
 
 	/*
-	 * check API hdd_conn_save_connect_info, hdd_add_beacon_filter
 	 * 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);
-	/* move ucfg_p2p_status_connect to cm */
-
-	ret = hdd_objmgr_set_peer_mlme_state(adapter->vdev,
-					     WLAN_ASSOC_STATE);
-	if (ret)
-		hdd_err("Peer object "QDF_MAC_ADDR_FMT" fail to set associated state",
-			QDF_MAC_ADDR_REF(rsp->bssid.bytes));
 
+	hdd_cm_handle_assoc_event(vdev, rsp->bssid.bytes);
 	/*
 	 * check update hdd_send_update_beacon_ies_event,
-	 * hdd_send_ft_assoc_response, hdd_send_peer_status_ind_to_app
-	 * Update tdls module about connection event,
-	 * hdd_add_latency_critical_client
+	 * hdd_send_ft_assoc_response,
 	 */
-	hdd_bus_bw_compute_prev_txrx_stats(adapter);
-	hdd_bus_bw_compute_timer_start(hdd_ctx);
 
-	if (ucfg_pkt_capture_get_pktcap_mode(hdd_ctx->psoc))
-		ucfg_pkt_capture_record_channel(adapter->vdev);
+	/* send peer status indication to oem app */
+	vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(vdev,
+							  WLAN_UMAC_COMP_MLME);
+	if (vdev_mlme) {
+		hdd_send_peer_status_ind_to_app(
+			&rsp->bssid,
+			ePeerConnected,
+			vdev_mlme->ext_vdev_ptr->connect_info.timing_meas_cap,
+			adapter->vdev_id,
+			&vdev_mlme->ext_vdev_ptr->connect_info.chan_info,
+			adapter->device_mode);
+	}
 
 	hdd_ipa_set_tx_flow_info();
+	hdd_place_marker(adapter, "ASSOCIATION COMPLETE", NULL);
 
 	if (policy_mgr_is_mcc_in_24G(hdd_ctx->psoc)) {
 		if (hdd_ctx->miracast_value)
@@ -252,17 +515,12 @@ hdd_cm_connect_success_pre_user_update(struct wlan_objmgr_vdev *vdev,
 	rc = wait_for_completion_timeout(
 				&adapter->linkup_event_var,
 				 msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT));
-	if (!rc)
-		hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT");
-
 	/*
 	 * Disable Linkup Event Servicing - no more service
 	 * required from the net device notifier call.
 	 */
 	adapter->is_link_up_service_needed = false;
 
-	/*check cdp_hl_fc_set_td_limit */
-
 	if (ucfg_ipa_is_enabled())
 		ucfg_ipa_wlan_evt(hdd_ctx->pdev, adapter->dev,
 				  adapter->device_mode,
@@ -277,10 +535,7 @@ hdd_cm_connect_success_pre_user_update(struct wlan_objmgr_vdev *vdev,
 		QDF_TRACE_DEFAULT_PDEV_ID,
 		QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC));
 
-	/*
-	 * check for update bss db, hdd_roam_register_sta,
-	 * hdd_objmgr_set_peer_mlme_auth_state
-	 */
+	 /* hdd_objmgr_set_peer_mlme_auth_state */
 }
 
 static void
@@ -345,3 +600,5 @@ QDF_STATUS hdd_cm_connect_complete(struct wlan_objmgr_vdev *vdev,
 
 	return QDF_STATUS_SUCCESS;
 }
+#endif
+

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

@@ -1280,5 +1280,20 @@ wlan_fill_bss_desc_from_scan_entry(struct mac_context *mac_ctx,
 uint16_t
 wlan_get_ielen_from_bss_description(struct bss_description *bss_desc);
 
+/**
+ * dot11f_parse_assoc_response() - API to parse Assoc IE buffer to struct
+ * @mac_ctx: MAC context
+ * @p_buf: Pointer to the assoc IE buffer
+ * @n_buf: length of the @p_buf
+ * @p_frm: Struct to populate the IE buffer after parsing
+ * @append_ie: Boolean to indicate whether to reset @p_frm or not. If @append_ie
+ *             is true, @p_frm struct is not reset to zeros.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS dot11f_parse_assoc_response(struct mac_context *mac_ctx,
+				       uint8_t *p_buf, uint32_t n_buf,
+				       tDot11fAssocResponse *p_frm,
+				       bool append_ie);
 
 #endif /* __PARSE_H__ */

+ 16 - 0
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -2739,6 +2739,8 @@ bool lim_fill_lim_assoc_ind_params(
 	const uint8_t *wpsie = NULL;
 	uint8_t maxidx, i;
 	bool wme_enable;
+	struct wlan_objmgr_vdev *vdev;
+	struct vdev_mlme_obj *mlme_obj;
 
 	if (!session_entry->parsedAssocReq) {
 		pe_err(" Parsed Assoc req is NULL");
@@ -2951,6 +2953,20 @@ bool lim_fill_lim_assoc_ind_params(
 	if (wlan_reg_is_6ghz_chan_freq(session_entry->curr_op_freq))
 		assoc_ind->ch_width =
 			lim_convert_channel_width_enum(sta_ds->ch_width);
+
+	vdev = session_entry->vdev;
+	if (!vdev)
+		return true;
+
+	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!mlme_obj)
+		pe_err("vdev component object is NULL");
+	else
+		qdf_mem_copy(
+			&mlme_obj->ext_vdev_ptr->connect_info.chan_info,
+			&assoc_ind->chan_info,
+			sizeof(mlme_obj->ext_vdev_ptr->connect_info.chan_info));
+
 	return true;
 }
 

+ 13 - 0
core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c

@@ -429,6 +429,8 @@ static void lim_update_stads_ext_cap(struct mac_context *mac_ctx,
 	tpDphHashNode sta_ds)
 {
 	struct s_ext_cap *ext_cap;
+	struct wlan_objmgr_vdev *vdev;
+	struct vdev_mlme_obj *mlme_obj;
 
 	if (!assoc_rsp->ExtCap.present) {
 		sta_ds->timingMeasCap = 0;
@@ -442,6 +444,17 @@ static void lim_update_stads_ext_cap(struct mac_context *mac_ctx,
 
 	ext_cap = (struct s_ext_cap *)assoc_rsp->ExtCap.bytes;
 	lim_set_stads_rtt_cap(sta_ds, ext_cap, mac_ctx);
+
+	vdev = session_entry->vdev;
+	if (vdev) {
+		mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
+		if (!mlme_obj)
+			pe_err("vdev component object is NULL");
+		else
+			mlme_obj->ext_vdev_ptr->connect_info.timing_meas_cap =
+							sta_ds->timingMeasCap;
+	}
+
 #ifdef FEATURE_WLAN_TDLS
 	session_entry->tdls_prohibited = ext_cap->tdls_prohibited;
 	session_entry->tdls_chan_swit_prohibited =

+ 4 - 15
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -2881,21 +2881,10 @@ sir_convert_assoc_req_frame2_struct(struct mac_context *mac,
 
 } /* End sir_convert_assoc_req_frame2_struct. */
 
-/**
- * dot11f_parse_assoc_response() - API to parse Assoc IE buffer to struct
- * @mac_ctx: MAC context
- * @p_buf: Pointer to the assoc IE buffer
- * @n_buf: length of the @p_buf
- * @p_frm: Struct to populate the IE buffer after parsing
- * @append_ie: Boolean to indicate whether to reset @p_frm or not. If @append_ie
- *             is true, @p_frm struct is not reset to zeros.
- *
- * Return: QDF_STATUS
- */
-static QDF_STATUS dot11f_parse_assoc_response(struct mac_context *mac_ctx,
-						 uint8_t *p_buf, uint32_t n_buf,
-						 tDot11fAssocResponse *p_frm,
-						 bool append_ie)
+QDF_STATUS dot11f_parse_assoc_response(struct mac_context *mac_ctx,
+				       uint8_t *p_buf, uint32_t n_buf,
+				       tDot11fAssocResponse *p_frm,
+				       bool append_ie)
 {
 	uint32_t status;
 

+ 31 - 0
core/sme/inc/csr_api.h

@@ -1460,4 +1460,35 @@ eCsrPhyMode csr_convert_from_reg_phy_mode(enum reg_phymode phymode);
  * Return: None
  */
 void csr_update_beacon(struct mac_context *mac);
+
+/**
+ * csr_fill_enc_type() - converts crypto cipher set to csr specific cipher type
+ * @cipher_type: output csr cipher type
+ * @ cipherset:input cipher set
+ *
+ * Return: None
+ */
+void csr_fill_enc_type(eCsrEncryptionType *cipher_type, uint32_t cipherset);
+
+/**
+ * csr_fill_auth_type() - auth mode set to csr specific auth type
+ * @auth_type: output csr auth type
+ * @ authmodeset: authmode set
+ * @akm: akm
+ * @ucastcipherset: ucastcipherset
+ *
+ * Return: None
+ */
+void csr_fill_auth_type(enum csr_akm_type *auth_type,
+			uint32_t authmodeset, uint32_t akm,
+			uint32_t ucastcipherset);
+
+/**
+ * csr_phy_mode_to_dot11mode() - converts phy mode to dot11 mode
+ * @phy_mode: wlan phy mode
+ *
+ * Return: csr_cfgdot11mode
+ */
+enum csr_cfgdot11mode csr_phy_mode_to_dot11mode(enum wlan_phymode phy_mode);
+
 #endif

+ 1 - 0
core/sme/inc/csr_internal.h

@@ -92,6 +92,7 @@ enum csr_cfgdot11mode {
 	eCSR_CFG_DOT11_MODE_AUTO,
 	eCSR_CFG_DOT11_MODE_11AX,
 	eCSR_CFG_DOT11_MODE_11AX_ONLY,
+	eCSR_CFG_DOT11_MODE_MAX,
 };
 
 enum csr_scan_reason {

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

@@ -2996,6 +2996,32 @@ uint32_t sme_unpack_rsn_ie(mac_handle_t mac_handle, uint8_t *buf,
 			   uint8_t buf_len, tDot11fIERSN *rsn_ie,
 			   bool append_ie);
 
+/**
+ * sme_unpack_assoc_rsp() - wrapper to unpack assoc response
+ * @mac_handle: handle returned by mac_open
+ * @frame: assoc response buffer pointer
+ * @frame_len: assoc response buffer length
+ * @assoc_resp: output assoc response structure
+ *
+ * Return: parse status
+ */
+QDF_STATUS sme_unpack_assoc_rsp(mac_handle_t mac_handle,
+				uint8_t *frame, uint32_t frame_len,
+				struct sDot11fAssocResponse *assoc_resp);
+
+/**
+ * sme_get_hs20vendor_ie() - wrapper to unpack beacon/probe response
+ * @mac_handle: handle returned by mac_open
+ * @frame: beacon/probe response response buffer pointer
+ * @frame_len: beacone probe/ response buffer length
+ * @hs20vendor_ie: output hs20vendor_ie structure
+ *
+ * Return: None
+ */
+void sme_get_hs20vendor_ie(mac_handle_t mac_handle, uint8_t *frame,
+			   uint32_t frame_len,
+			   tDot11fIEhs20vendor_ie *hs20vendor_ie);
+
 /**
  * sme_add_qcn_ie: Adds QCN IE data to IE buffer
  * @mac_handle: handle returned by mac_open
@@ -4360,4 +4386,36 @@ sme_set_beacon_latency_event_cb(mac_handle_t mac_handle,
 }
 #endif
 
+/**
+ * sme_fill_enc_type() - converts crypto cipher set to csr specific cipher type
+ * @cipher_type: output csr cipher type
+ * @ cipherset:input cipher set
+ *
+ * Return: None
+ */
+
+void sme_fill_enc_type(eCsrEncryptionType *cipher_type,
+		       uint32_t cipherset);
+
+/**
+ * sme_fill_auth_type() - converts auth mode set to csr specific auth type
+ * @auth_type: output csr auth type
+ * @ authmodeset: authmode set
+ * @akm: akm
+ * @ucastcipherset: ucastcipherset
+ *
+ * Return: None
+ */
+void sme_fill_auth_type(enum csr_akm_type *auth_type,
+			uint32_t authmodeset, uint32_t akm,
+			uint32_t ucastcipherset);
+
+/**
+ * sme_phy_mode_to_dot11mode() - converts phy mode to dot11 mode
+ * @phy_mode: wlan phy mode
+ *
+ * Return: csr_cfgdot11mode
+ */
+enum csr_cfgdot11mode sme_phy_mode_to_dot11mode(enum wlan_phymode phy_mode);
+
 #endif /* #if !defined( __SME_API_H ) */

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

@@ -68,6 +68,7 @@
 #include "wlan_cm_roam_api.h"
 #include "wlan_cm_tgt_if_tx_api.h"
 #include "wlan_cm_api.h"
+#include "parser_api.h"
 
 static QDF_STATUS init_sme_cmd_list(struct mac_context *mac);
 
@@ -14849,6 +14850,35 @@ uint32_t sme_unpack_rsn_ie(mac_handle_t mac_handle, uint8_t *buf,
 	return dot11f_unpack_ie_rsn(mac_ctx, buf, buf_len, rsn_ie, append_ie);
 }
 
+QDF_STATUS sme_unpack_assoc_rsp(mac_handle_t mac_handle,
+				uint8_t *frame, uint32_t frame_len,
+				struct sDot11fAssocResponse *assoc_resp)
+{
+	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
+
+	return dot11f_parse_assoc_response(mac_ctx, frame, frame_len,
+					   assoc_resp, false);
+}
+
+void sme_get_hs20vendor_ie(mac_handle_t mac_handle, uint8_t *frame,
+			   uint32_t frame_len,
+			   struct sDot11fIEhs20vendor_ie *hs20vendor_ie)
+{
+	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
+	struct sSirProbeRespBeacon *beacon_probe_resp =
+		qdf_mem_malloc(sizeof(struct sSirProbeRespBeacon));
+
+	if (!beacon_probe_resp)
+		return;
+
+	sir_parse_beacon_ie(mac_ctx, beacon_probe_resp, frame, frame_len);
+
+	qdf_mem_copy(hs20vendor_ie, &beacon_probe_resp->hs20vendor_ie,
+		     sizeof(struct sDot11fIEhs20vendor_ie));
+
+	qdf_mem_free(beacon_probe_resp);
+}
+
 void sme_add_qcn_ie(mac_handle_t mac_handle, uint8_t *ie_data,
 		    uint16_t *ie_len)
 {
@@ -16433,3 +16463,23 @@ sme_set_beacon_latency_event_cb(mac_handle_t mac_handle,
 	return qdf_status;
 }
 #endif
+
+void sme_fill_enc_type(eCsrEncryptionType *cipher_type,
+		       uint32_t cipherset)
+{
+	csr_fill_enc_type(cipher_type, cipherset);
+}
+
+void sme_fill_auth_type(enum csr_akm_type *auth_type,
+			uint32_t authmodeset, uint32_t akm,
+			uint32_t ucastcipherset)
+{
+	csr_fill_auth_type(auth_type, authmodeset,
+			   akm, ucastcipherset);
+}
+
+enum csr_cfgdot11mode sme_phy_mode_to_dot11mode(enum wlan_phymode phy_mode)
+{
+	return csr_phy_mode_to_dot11mode(phy_mode);
+}
+

+ 4 - 5
core/sme/src/csr/csr_api_scan.c

@@ -1987,9 +1987,9 @@ static void csr_fill_wapi_auth_type(enum csr_akm_type *auth_type, uint32_t akm)
 		*auth_type = eCSR_AUTH_TYPE_NONE;
 }
 
-static void csr_fill_auth_type(enum csr_akm_type *auth_type,
-			       uint32_t authmodeset, uint32_t akm,
-			       uint32_t ucastcipherset)
+void csr_fill_auth_type(enum csr_akm_type *auth_type,
+			uint32_t authmodeset, uint32_t akm,
+			uint32_t ucastcipherset)
 {
 	if (!authmodeset) {
 		*auth_type = eCSR_AUTH_TYPE_OPEN_SYSTEM;
@@ -2040,8 +2040,7 @@ static void csr_fill_auth_type(enum csr_akm_type *auth_type,
 	*auth_type = eCSR_AUTH_TYPE_OPEN_SYSTEM;
 }
 
-static void csr_fill_enc_type(eCsrEncryptionType *cipher_type,
-			      uint32_t cipherset)
+void csr_fill_enc_type(eCsrEncryptionType *cipher_type, uint32_t cipherset)
 {
 	if (!cipherset) {
 		*cipher_type = eCSR_ENCRYPT_TYPE_NONE;

+ 47 - 0
core/sme/src/csr/csr_util.c

@@ -4060,3 +4060,50 @@ bool csr_is_mcc_channel(struct mac_context *mac_ctx, uint32_t chan_freq)
 	return false;
 }
 
+enum csr_cfgdot11mode csr_phy_mode_to_dot11mode(enum wlan_phymode phy_mode)
+{
+	switch (phy_mode) {
+	case WLAN_PHYMODE_AUTO:
+		return eCSR_CFG_DOT11_MODE_AUTO;
+	case WLAN_PHYMODE_11A:
+		return eCSR_CFG_DOT11_MODE_11A;
+	case WLAN_PHYMODE_11B:
+		return eCSR_CFG_DOT11_MODE_11B;
+	case WLAN_PHYMODE_11G:
+		return eCSR_CFG_DOT11_MODE_11G;
+	case WLAN_PHYMODE_11G_ONLY:
+		return eCSR_CFG_DOT11_MODE_11G_ONLY;
+	case WLAN_PHYMODE_11NA_HT20:
+	case WLAN_PHYMODE_11NG_HT20:
+	case WLAN_PHYMODE_11NA_HT40:
+	case WLAN_PHYMODE_11NG_HT40PLUS:
+	case WLAN_PHYMODE_11NG_HT40MINUS:
+	case WLAN_PHYMODE_11NG_HT40:
+		return eCSR_CFG_DOT11_MODE_11N;
+	case WLAN_PHYMODE_11AC_VHT20:
+	case WLAN_PHYMODE_11AC_VHT20_2G:
+	case WLAN_PHYMODE_11AC_VHT40:
+	case WLAN_PHYMODE_11AC_VHT40PLUS_2G:
+	case WLAN_PHYMODE_11AC_VHT40MINUS_2G:
+	case WLAN_PHYMODE_11AC_VHT40_2G:
+	case WLAN_PHYMODE_11AC_VHT80:
+	case WLAN_PHYMODE_11AC_VHT80_2G:
+	case WLAN_PHYMODE_11AC_VHT160:
+	case WLAN_PHYMODE_11AC_VHT80_80:
+		return eCSR_CFG_DOT11_MODE_11AC;
+	case WLAN_PHYMODE_11AXA_HE20:
+	case WLAN_PHYMODE_11AXG_HE20:
+	case WLAN_PHYMODE_11AXA_HE40:
+	case WLAN_PHYMODE_11AXG_HE40PLUS:
+	case WLAN_PHYMODE_11AXG_HE40MINUS:
+	case WLAN_PHYMODE_11AXG_HE40:
+	case WLAN_PHYMODE_11AXA_HE80:
+	case WLAN_PHYMODE_11AXG_HE80:
+	case WLAN_PHYMODE_11AXA_HE160:
+	case WLAN_PHYMODE_11AXA_HE80_80:
+		return eCSR_CFG_DOT11_MODE_11AX;
+	default:
+		sme_err("invalid phy mode %d", phy_mode);
+		return eCSR_CFG_DOT11_MODE_MAX;
+	}
+}