Forráskód Böngészése

qcacld-3.0: Add lim APIs implementation to support 11be assoc

Currently, most of the EHT APIs are just defined. Add implementation
to handle association request and association response frames to
support 11be association.

Change-Id: Ic8d29d79b7e099ad81169bcfc22476e4223bd846
CRs-Fixed: 2908114
Bapiraju Alla 4 éve
szülő
commit
72752feac1

+ 2 - 0
core/mac/inc/sir_api.h

@@ -1113,7 +1113,9 @@ struct join_rsp {
 	struct fils_join_rsp_params *fils_join_rsp;
 #endif
 	uint8_t frames[1];
+#ifdef WLAN_FEATURE_11BE
 	tDot11fIEeht_op eht_operation;
+#endif
 };
 #endif
 

+ 3 - 0
core/mac/src/include/dph_global.h

@@ -78,6 +78,9 @@ struct parsed_ies {
 #ifdef WLAN_FEATURE_11AX
 	tDot11fIEhe_op he_operation;
 #endif
+#ifdef WLAN_FEATURE_11BE
+	tDot11fIEeht_op eht_operation;
+#endif
 };
 
 /* STA state node */

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

@@ -472,6 +472,7 @@ typedef struct sSirAssocRsp {
 	tDot11fIEhe_op he_op;
 	tDot11fIEhe_6ghz_band_cap he_6ghz_band_cap;
 	tDot11fIEeht_cap eht_cap;
+	tDot11fIEeht_op eht_op;
 	bool mu_edca_present;
 	tSirMacEdcaParamSetIE mu_edca;
 	tDot11fIEbss_max_idle_period bss_max_idle_period;

+ 47 - 1
core/mac/src/pe/lim/lim_assoc_utils.c

@@ -2129,6 +2129,20 @@ static void lim_add_tdls_sta_he_config(tpAddStaParams add_sta_params,
 #endif /* WLAN_FEATURE_11AX */
 #endif /* FEATURE_WLAN_TDLS */
 
+#ifdef WLAN_FEATURE_11BE
+static bool lim_is_add_sta_params_eht_capable(tpAddStaParams add_sta_params)
+{
+	return add_sta_params->eht_capable;
+}
+
+#else
+static bool lim_is_add_sta_params_eht_capable(tpAddStaParams add_sta_params)
+{
+	return false;
+}
+
+#endif
+
 /**
  * lim_add_sta()- called to add an STA context at hardware
  * @mac_ctx: pointer to global mac structure
@@ -2267,6 +2281,9 @@ lim_add_sta(struct mac_context *mac_ctx,
 	lim_update_sta_he_capable(mac_ctx, add_sta_params, sta_ds,
 				  session_entry);
 
+	lim_update_sta_eht_capable(mac_ctx, add_sta_params, sta_ds,
+				   session_entry);
+
 	add_sta_params->maxAmpduDensity = sta_ds->htAMpduDensity;
 	add_sta_params->maxAmpduSize = sta_ds->htMaxRxAMpduFactor;
 	add_sta_params->fShortGI20Mhz = sta_ds->htShortGI20Mhz;
@@ -2471,7 +2488,8 @@ lim_add_sta(struct mac_context *mac_ctx,
 	add_sta_params->nwType = session_entry->nwType;
 
 	if (!(add_sta_params->htCapable || add_sta_params->vhtCapable ||
-	    lim_is_add_sta_params_he_capable(add_sta_params))) {
+	    lim_is_add_sta_params_he_capable(add_sta_params) ||
+	    lim_is_add_sta_params_eht_capable(add_sta_params))) {
 		nw_type_11b = 1;
 		for (i = 0; i < SIR_NUM_11A_RATES; i++) {
 			if (sirIsArate(sta_ds->supportedRates.llaRates[i] &
@@ -3639,6 +3657,15 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp
 						sta);
 		}
 
+		if (lim_is_session_eht_capable(pe_session) &&
+		    (pAssocRsp->eht_cap.present ||
+		     pBeaconStruct->eht_cap.present)) {
+			lim_intersect_ap_eht_caps(pe_session,
+						  pAddBssParams,
+						  pBeaconStruct,
+						  pAssocRsp);
+		}
+
 		/*
 		 * in limExtractApCapability function intersection of FW
 		 * advertised channel width and AP advertised channel
@@ -3745,6 +3772,14 @@ QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp
 						&pAssocRsp->he_6ghz_band_cap,
 						&pAddBssParams->staContext);
 		}
+		if (lim_is_session_eht_capable(pe_session) &&
+		    (pAssocRsp->eht_cap.present ||
+		     pBeaconStruct->eht_cap.present)) {
+			lim_intersect_ap_eht_caps(pe_session,
+						  pAddBssParams,
+						  pBeaconStruct,
+						  pAssocRsp);
+		}
 	}
 	pAddBssParams->staContext.smesessionId =
 		pe_session->smeSessionId;
@@ -3953,6 +3988,12 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac,
 		lim_add_bss_he_cfg(pAddBssParams, pe_session);
 	}
 
+	if (lim_is_session_eht_capable(pe_session) &&
+	    pBeaconStruct->eht_cap.present) {
+		lim_update_bss_eht_capable(mac, pAddBssParams);
+		lim_add_bss_eht_cfg(pAddBssParams, pe_session);
+	}
+
 	/*
 	 * Populate the STA-related parameters here
 	 * Note that the STA here refers to the AP
@@ -4004,6 +4045,11 @@ QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac,
 			lim_intersect_ap_he_caps(pe_session, pAddBssParams,
 					      pBeaconStruct, NULL);
 
+		if (lim_is_session_eht_capable(pe_session) &&
+		    pBeaconStruct->eht_cap.present)
+			lim_intersect_ap_eht_caps(pe_session, pAddBssParams,
+						  pBeaconStruct, NULL);
+
 		if (pBeaconStruct->HTCaps.supportedChannelWidthSet &&
 		    chan_width_support) {
 			pAddBssParams->staContext.ch_width =

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

@@ -219,6 +219,12 @@ void lim_ft_prepare_add_bss_req(struct mac_context *mac,
 		lim_add_bss_he_cfg(pAddBssParams, ft_session);
 	}
 
+	if (lim_is_session_eht_capable(ft_session) &&
+	    pBeaconStruct->eht_cap.present) {
+		lim_update_bss_eht_capable(mac, pAddBssParams);
+		lim_add_bss_eht_cfg(pAddBssParams, ft_session);
+	}
+
 	pe_debug("SIR_HAL_ADD_BSS_REQ with frequency: %d",
 		bssDescription->chan_freq);
 
@@ -269,6 +275,12 @@ void lim_ft_prepare_add_bss_req(struct mac_context *mac,
 				lim_intersect_ap_he_caps(ft_session,
 					pAddBssParams, pBeaconStruct, NULL);
 
+			if (lim_is_session_eht_capable(ft_session) &&
+			    pBeaconStruct->eht_cap.present)
+				lim_intersect_ap_eht_caps(ft_session,
+							  pAddBssParams,
+							  pBeaconStruct, NULL);
+
 			if (pBeaconStruct->HTCaps.supportedChannelWidthSet &&
 			    chan_width_support) {
 				sta_ctx->ch_width = (uint8_t)
@@ -592,6 +604,10 @@ void lim_fill_ft_session(struct mac_context *mac,
 	    pBeaconStruct->he_cap.present)
 		lim_update_session_he_capable(mac, ft_session);
 
+	if (IS_DOT11_MODE_EHT(ft_session->dot11mode) &&
+	    pBeaconStruct->eht_cap.present)
+		lim_update_session_eht_capable(mac, ft_session);
+
 	/* Assign default configured nss value in the new session */
 	if (!wlan_reg_is_24ghz_ch_freq(ft_session->curr_op_freq))
 		ft_session->vdev_nss = mac->vdev_type_nss_5g.sta;

+ 46 - 1
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -589,6 +589,43 @@ static bool lim_check_11ax_basic_mcs(struct mac_context *mac_ctx,
 }
 #endif
 
+/**
+ * lim_chk_11be_only() - checks for non 11be STA
+ * @mac_ctx: pointer to Global MAC structure
+ * @hdr: pointer to the MAC head
+ * @session: pointer to pe session entry
+ * @assoc_req: pointer to ASSOC/REASSOC Request frame
+ * @sub_type: Assoc(=0) or Reassoc(=1) Requestframe
+ *
+ * Checks for non 11be STA
+ *
+ * Return: true if no error, false otherwise
+ */
+#ifdef WLAN_FEATURE_11BE
+static bool lim_chk_11be_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr,
+			      struct pe_session *session,
+			      tpSirAssocReq assoc_req, uint8_t sub_type)
+{
+	if (LIM_IS_AP_ROLE(session) &&
+	    (session->dot11mode == MLME_DOT11_MODE_11BE_ONLY) &&
+	    !assoc_req->eht_cap.present) {
+		lim_send_assoc_rsp_mgmt_frame(
+			mac_ctx, STATUS_CAPS_UNSUPPORTED,
+			1, hdr->sa, sub_type, 0, session, false);
+		pe_err("SOFTAP was in 11BE only mode, reject");
+		return false;
+	}
+	return true;
+}
+#else
+static bool lim_chk_11be_only(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr,
+			      struct pe_session *session,
+			      tpSirAssocReq assoc_req, uint8_t sub_type)
+{
+	return true;
+}
+#endif
+
 /**
  * lim_process_for_spectrum_mgmt() - process assoc req for spectrum mgmt
  * @mac_ctx: pointer to Global MAC structure
@@ -1542,6 +1579,7 @@ static bool lim_update_sta_ds(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr,
 	}
 
 	lim_update_stads_he_capable(sta_ds, assoc_req);
+	lim_update_stads_eht_capable(sta_ds, assoc_req);
 	sta_ds->qos.addtsPresent =
 		(assoc_req->addtsPresent == 0) ? false : true;
 	sta_ds->qos.addts = assoc_req->addtsReq;
@@ -1711,6 +1749,8 @@ static bool lim_update_sta_ds(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr,
 	}
 	lim_intersect_sta_he_caps(mac_ctx, assoc_req, session, sta_ds);
 
+	lim_intersect_sta_eht_caps(mac_ctx, assoc_req, session, sta_ds);
+
 	if (lim_populate_matching_rate_set(mac_ctx, sta_ds,
 			&(assoc_req->supportedRates),
 			&(assoc_req->extendedRates),
@@ -2462,6 +2502,10 @@ void lim_process_assoc_req_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_in
 					      sub_type))
 		goto error;
 
+	if (false == lim_chk_11be_only(mac_ctx, hdr, session, assoc_req,
+				       sub_type))
+		goto error;
+
 	/* Spectrum Management (11h) specific checks */
 	lim_process_for_spectrum_mgmt(mac_ctx, hdr, session,
 				assoc_req, sub_type, local_cap);
@@ -2470,7 +2514,8 @@ void lim_process_assoc_req_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_in
 		goto error;
 
 	if (false == lim_chk_is_11b_sta_supported(mac_ctx, hdr, session,
-				assoc_req, sub_type, phy_mode))
+						  assoc_req, sub_type,
+						  phy_mode))
 		goto error;
 
 	/*

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

@@ -191,6 +191,9 @@ void lim_update_assoc_sta_datas(struct mac_context *mac_ctx,
 	lim_update_stads_he_caps(mac_ctx, sta_ds, assoc_rsp,
 				 session_entry, beacon);
 
+	lim_update_stads_eht_caps(mac_ctx, sta_ds, assoc_rsp,
+				  session_entry, beacon);
+
 	if (lim_is_sta_he_capable(sta_ds))
 		he_cap = &assoc_rsp->he_cap;
 
@@ -542,6 +545,20 @@ static inline void lim_process_he_info(tpSirProbeRespBeacon beacon,
 }
 #endif
 
+#ifdef WLAN_FEATURE_11BE
+static void lim_process_eht_info(tpSirProbeRespBeacon beacon,
+				 tpDphHashNode sta_ds)
+{
+	if (beacon->eht_op.present)
+		sta_ds->parsed_ies.eht_operation = beacon->eht_op;
+}
+#else
+static inline void lim_process_eht_info(tpSirProbeRespBeacon beacon,
+					tpDphHashNode sta_ds)
+{
+}
+#endif
+
 #define MAX_RETRY_TIMER 1500
 static QDF_STATUS
 lim_handle_pmfcomeback_timer(struct pe_session *session_entry,
@@ -1143,6 +1160,8 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 
 	lim_process_he_info(beacon, sta_ds);
 
+	lim_process_eht_info(beacon, sta_ds);
+
 	if (mac_ctx->lim.gLimProtectionControl !=
 	    MLME_FORCE_POLICY_PROTECTION_DISABLE)
 		lim_decide_sta_protection_on_assoc(mac_ctx, beacon,

+ 31 - 1
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -848,6 +848,8 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu
 		if (IS_DOT11_MODE_EHT(session->dot11mode)) {
 			lim_update_session_eht_capable(mac_ctx, session);
 			lim_copy_bss_eht_cap(session);
+		} else {
+			lim_strip_eht_ies_from_add_ies(mac_ctx, session);
 		}
 
 		session->txLdpcIniFeatureEnabled =
@@ -7705,7 +7707,7 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx,
 	uint8_t session_id;      /* PE session_id */
 	int8_t max_tx_pwr;
 	uint32_t target_freq;
-	bool is_curr_ch_2g, is_new_ch_2g, update_he_cap;
+	bool is_curr_ch_2g, is_new_ch_2g, update_he_cap, update_eht_cap;
 
 	if (!msg_buf) {
 		pe_err("msg_buf is NULL");
@@ -7784,6 +7786,34 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx,
 		return;
 	}
 
+	if (IS_DOT11_MODE_EHT(ch_change_req->dot11mode) &&
+	    ((QDF_MONITOR_MODE == session_entry->opmode) ||
+	     lim_is_session_eht_capable(session_entry))) {
+		lim_update_session_eht_capable_chan_switch(
+				mac_ctx, session_entry, target_freq);
+		is_new_ch_2g = wlan_reg_is_24ghz_ch_freq(target_freq);
+		is_curr_ch_2g = wlan_reg_is_24ghz_ch_freq(
+					session_entry->curr_op_freq);
+		if ((is_new_ch_2g && !is_curr_ch_2g) ||
+		    (!is_new_ch_2g && is_curr_ch_2g))
+			update_eht_cap = true;
+		else
+			update_eht_cap = false;
+		if (!update_eht_cap) {
+			if ((session_entry->ch_width !=
+			     ch_change_req->ch_width) &&
+			    (session_entry->ch_width > CH_WIDTH_80MHZ ||
+			     ch_change_req->ch_width > CH_WIDTH_80MHZ))
+				update_eht_cap = true;
+		}
+		if (update_eht_cap) {
+			session_entry->curr_op_freq = target_freq;
+			session_entry->ch_width = ch_change_req->ch_width;
+			lim_copy_bss_eht_cap(session_entry);
+			lim_update_eht_bw_cap_mcs(session_entry, NULL);
+		}
+	}
+
 	/* Store the New Channel Params in session_entry */
 	session_entry->ch_width = ch_change_req->ch_width;
 	session_entry->ch_center_freq_seg0 =

+ 15 - 0
core/mac/src/pe/lim/lim_send_sme_rsp_messages.c

@@ -739,6 +739,20 @@ static inline void lim_add_he_info(struct parsed_ies *parsed_ies,
 }
 #endif
 
+#ifdef WLAN_FEATURE_11BE
+static void lim_add_eht_info(struct parsed_ies *parsed_ies,
+			     struct join_rsp *sme_join_rsp)
+{
+	if (parsed_ies->eht_operation.present)
+		sme_join_rsp->eht_operation = parsed_ies->eht_operation;
+}
+#else
+static inline void lim_add_eht_info(struct parsed_ies *parsed_ies,
+				    struct join_rsp *sme_join_rsp)
+{
+}
+#endif
+
 /**
  * lim_add_bss_info() - copy data from session entry to join rsp
  * @sta_ds: Station dph entry
@@ -762,6 +776,7 @@ static void lim_add_bss_info(tpDphHashNode sta_ds,
 	if (parsed_ies->vht_operation.present)
 		sme_join_rsp->vht_operation = parsed_ies->vht_operation;
 	lim_add_he_info(parsed_ies, sme_join_rsp);
+	lim_add_eht_info(parsed_ies, sme_join_rsp);
 }
 
 #ifdef WLAN_FEATURE_FILS_SK

+ 200 - 0
core/mac/src/pe/lim/lim_utils.c

@@ -5504,6 +5504,32 @@ static bool is_dot11mode_support_he_cap(enum csr_cfgdot11mode dot11mode)
 	return false;
 }
 
+#ifdef WLAN_FEATURE_11BE
+/**
+ * is_dot11mode_support_eht_cap() - Check dot11mode supports EHT capability
+ * @dot11mode: dot11mode
+ *
+ * This function checks whether dot11mode support EHT capability or not
+ *
+ * Return: True, if supports. False otherwise
+ */
+static bool is_dot11mode_support_eht_cap(enum csr_cfgdot11mode dot11mode)
+{
+	if ((dot11mode == eCSR_CFG_DOT11_MODE_AUTO) ||
+	    (dot11mode == eCSR_CFG_DOT11_MODE_11BE) ||
+	    (dot11mode == eCSR_CFG_DOT11_MODE_11BE_ONLY)) {
+		return true;
+	}
+
+	return false;
+}
+#else
+static bool is_dot11mode_support_eht_cap(enum csr_cfgdot11mode dot11mode)
+{
+	return false;
+}
+#endif
+
 /**
  * lim_send_ht_caps_ie() - gets HT capability and send to firmware via wma
  * @mac_ctx: global mac context
@@ -5688,6 +5714,11 @@ QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx,
 								vdev_id);
 	}
 
+	if (is_dot11mode_support_eht_cap(dot11_mode)) {
+		status_he = lim_send_eht_caps_ie(mac_ctx, session,
+						 device_mode, vdev_id);
+	}
+
 	if (QDF_IS_STATUS_SUCCESS(status_ht) &&
 	    QDF_IS_STATUS_SUCCESS(status_vht) &&
 	    QDF_IS_STATUS_SUCCESS(status_he))
@@ -7707,6 +7738,15 @@ QDF_STATUS lim_populate_eht_mcs_set(struct mac_context *mac_ctx,
 void lim_add_self_eht_cap(tpAddStaParams add_sta_params,
 			  struct pe_session *session)
 {
+	if (!session)
+		return;
+
+	add_sta_params->eht_capable = true;
+
+	qdf_mem_copy(&add_sta_params->eht_config, &session->eht_config,
+		     sizeof(add_sta_params->eht_config));
+	qdf_mem_copy(&add_sta_params->eht_op, &session->eht_op,
+		     sizeof(add_sta_params->eht_op));
 }
 
 /**
@@ -7748,6 +7788,13 @@ void lim_copy_bss_eht_cap(struct pe_session *session)
 
 void lim_copy_join_req_eht_cap(struct pe_session *session)
 {
+	struct mlme_legacy_priv *mlme_priv;
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(session->vdev);
+	if (!mlme_priv)
+		return;
+	qdf_mem_copy(&session->eht_config, &mlme_priv->eht_config,
+		     sizeof(session->eht_config));
 }
 
 void lim_add_eht_cap(struct mac_context *mac_ctx, struct pe_session *pe_session,
@@ -7760,10 +7807,32 @@ void lim_intersect_ap_eht_caps(struct pe_session *session,
 			       tSchBeaconStruct *beacon,
 			       tpSirAssocRsp assoc_rsp)
 {
+	tDot11fIEeht_cap *rcvd_eht;
+	tDot11fIEeht_cap *peer_eht = &add_bss->staContext.eht_config;
+
+	if (assoc_rsp && assoc_rsp->eht_cap.present)
+		rcvd_eht = &assoc_rsp->eht_cap;
+	else
+		rcvd_eht = &beacon->eht_cap;
+
+	lim_intersect_eht_caps(rcvd_eht, peer_eht, session);
+	add_bss->staContext.eht_capable = true;
 }
 
 void lim_add_bss_eht_cap(struct bss_params *add_bss, tpSirAssocRsp assoc_rsp)
 {
+	tDot11fIEeht_cap *eht_cap;
+	tDot11fIEeht_op *eht_op;
+
+	eht_cap = &assoc_rsp->eht_cap;
+	eht_op = &assoc_rsp->eht_op;
+	add_bss->eht_capable = eht_cap->present;
+	if (eht_cap)
+		qdf_mem_copy(&add_bss->staContext.eht_config,
+			     eht_cap, sizeof(*eht_cap));
+	if (eht_op)
+		qdf_mem_copy(&add_bss->staContext.eht_op,
+			     eht_op, sizeof(*eht_op));
 }
 
 void lim_intersect_sta_eht_caps(struct mac_context *mac_ctx,
@@ -7821,6 +7890,137 @@ void lim_decide_eht_op(struct mac_context *mac_ctx, uint32_t *mlme_eht_ops,
 
 	wma_update_vdev_eht_ops(mlme_eht_ops, &eht_ops);
 }
+
+void lim_update_stads_eht_capable(tpDphHashNode sta_ds, tpSirAssocReq assoc_req)
+{
+	sta_ds->mlmStaContext.eht_capable = assoc_req->eht_cap.present;
+}
+
+void lim_update_sta_eht_capable(struct mac_context *mac,
+				tpAddStaParams add_sta_params,
+				tpDphHashNode sta_ds,
+				struct pe_session *session_entry)
+{
+	if (LIM_IS_AP_ROLE(session_entry))
+		add_sta_params->eht_capable =
+			sta_ds->mlmStaContext.eht_capable &&
+					session_entry->eht_capable;
+	else
+		add_sta_params->eht_capable = session_entry->eht_capable;
+
+	pe_debug("eht_capable: %d", add_sta_params->eht_capable);
+}
+
+void lim_update_session_eht_capable_chan_switch(struct mac_context *mac,
+						struct pe_session *session,
+						uint32_t new_chan_freq)
+{
+	session->eht_capable = true;
+	session->he_capable = true;
+	/* TODO: Updat*/
+	if (wlan_reg_is_6ghz_chan_freq(session->curr_op_freq) &&
+	    !wlan_reg_is_6ghz_chan_freq(new_chan_freq)) {
+		session->htCapability = 1;
+		session->vhtCapability = 1;
+		session->he_6ghz_band = 0;
+	} else if (!wlan_reg_is_6ghz_chan_freq(session->curr_op_freq) &&
+		   wlan_reg_is_6ghz_chan_freq(new_chan_freq)) {
+		session->htCapability = 0;
+		session->vhtCapability = 0;
+		session->he_6ghz_band = 1;
+	}
+
+	/*
+	 * If new channel is 2.4gh set VHT as per the b24ghz_band INI
+	 * if new channel is 5Ghz set the vht, this will happen if we move from
+	 * 2.4Ghz to 5Ghz.
+	 */
+	if (wlan_reg_is_24ghz_ch_freq(new_chan_freq) &&
+	    !mac->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band)
+		session->vhtCapability = 0;
+	else if (wlan_reg_is_5ghz_ch_freq(new_chan_freq))
+		session->vhtCapability = 1;
+
+	pe_debug("eht_capable:%d he_capable:%d  ht:%d vht:%d 6ghz_band:%d new freq:%d vht in 2.4gh:%d",
+		 session->eht_capable, session->he_capable,
+		 session->htCapability, session->vhtCapability,
+		 session->he_6ghz_band, new_chan_freq,
+		 mac->mlme_cfg->vht_caps.vht_cap_info.b24ghz_band);
+}
+
+void lim_update_bss_eht_capable(struct mac_context *mac,
+				struct bss_params *add_bss)
+{
+	add_bss->eht_capable = true;
+	pe_debug("eht_capable: %d", add_bss->eht_capable);
+}
+
+void lim_log_eht_cap(struct mac_context *mac, tDot11fIEeht_cap *eht_cap)
+{
+	if (!eht_cap->present)
+		return;
+
+	pe_nofl_debug("EHT Capabilities:");
+	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+			   eht_cap, sizeof(tDot11fIEeht_cap));
+}
+
+void lim_log_eht_op(struct mac_context *mac, tDot11fIEeht_op *eht_ops,
+		    struct pe_session *session)
+{
+	if (!eht_ops->present)
+		return;
+
+	pe_nofl_debug("EHT operation element:");
+	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+			   eht_ops, sizeof(tDot11fIEeht_op));
+}
+
+void lim_set_eht_caps(struct mac_context *mac, struct pe_session *session,
+		      uint8_t *ie_start, uint32_t num_bytes)
+{
+	tDot11fIEeht_cap dot11_cap;
+
+	populate_dot11f_eht_caps(mac, session, &dot11_cap);
+	lim_log_eht_cap(mac, &dot11_cap);
+
+	/* TODO: Update */
+}
+
+QDF_STATUS lim_send_eht_caps_ie(struct mac_context *mac_ctx,
+				struct pe_session *session,
+				enum QDF_OPMODE device_mode,
+				uint8_t vdev_id)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+void lim_update_stads_eht_caps(struct mac_context *mac_ctx,
+			       tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp,
+			       struct pe_session *session_entry,
+			       tSchBeaconStruct *beacon)
+{
+	/* If EHT is not supported, do not fill sta_ds and return */
+	if (!IS_DOT11_MODE_EHT(session_entry->dot11mode))
+		return;
+
+	if (!assoc_rsp->eht_cap.present && beacon && beacon->eht_cap.present) {
+		/* Use beacon EHT caps if assoc resp doesn't have he caps */
+		pe_debug("eht_caps missing in assoc rsp");
+		qdf_mem_copy(&assoc_rsp->eht_cap, &beacon->eht_cap,
+			     sizeof(tDot11fIEeht_cap));
+	}
+
+	/* assoc resp and beacon doesn't have eht caps */
+	if (!assoc_rsp->eht_cap.present)
+		return;
+
+	sta_ds->mlmStaContext.eht_capable = assoc_rsp->eht_cap.present;
+
+	qdf_mem_copy(&sta_ds->eht_config, &assoc_rsp->eht_cap,
+		     sizeof(tDot11fIEeht_cap));
+}
+
 #endif
 
 #if defined(CONFIG_BAND_6GHZ) && defined(WLAN_FEATURE_11AX)

+ 176 - 0
core/mac/src/pe/lim/lim_utils.h

@@ -1730,6 +1730,124 @@ void lim_add_bss_eht_cfg(struct bss_params *add_bss,
 void lim_decide_eht_op(struct mac_context *mac_ctx, uint32_t *mlme_eht_ops,
 		       struct pe_session *session);
 
+/**
+ * lim_update_stads_eht_capable() - Update eht_capable in sta ds context
+ * @sta_ds: pointer to sta ds
+ * @assoc_req: pointer to assoc request
+ *
+ * Return: None
+ */
+void lim_update_stads_eht_capable(tpDphHashNode sta_ds,
+				  tpSirAssocReq assoc_req);
+
+/**
+ * lim_update_sta_eht_capable(): Update eht_capable in add sta params
+ * @mac: pointer to MAC context
+ * @add_sta_params: pointer to add sta params
+ * @sta_ds: pointer to dph hash table entry
+ * @session_entry: pointer to PE session
+ *
+ * Return: None
+ */
+void lim_update_sta_eht_capable(struct mac_context *mac,
+				tpAddStaParams add_sta_params,
+				tpDphHashNode sta_ds,
+				struct pe_session *session_entry);
+
+/**
+ * lim_update_session_eht_capable_chan_switch(): Update eht_capable in PE
+ *                                               session
+ * @mac: pointer to MAC context
+ * @session: pointer to PE session
+ * @new_chan_freq: new channel frequency Mhz
+ *
+ * Update session eht capable during AP channel switching
+ *
+ * Return: None
+ */
+void lim_update_session_eht_capable_chan_switch(struct mac_context *mac,
+						struct pe_session *session,
+						uint32_t new_chan_freq);
+
+/**
+ * lim_update_bss_eht_capable() - Update eht_capable in add BSS params
+ * @mac: pointer to MAC context
+ * @add_bss: pointer to add BSS params
+ *
+ * Return: None
+ */
+void lim_update_bss_eht_capable(struct mac_context *mac,
+				struct bss_params *add_bss);
+
+/**
+ * lim_log_eht_cap() - Print EHT capabilities
+ * @mac: pointer to MAC context
+ * @eht_cap: pointer to HE Capability
+ *
+ * Received EHT capabilities are converted into dot11f structure.
+ * This function will print all the EHT capabilities as stored
+ * in the dot11f structure.
+ *
+ * Return: None
+ */
+void lim_log_eht_cap(struct mac_context *mac, tDot11fIEeht_cap *eht_cap);
+
+/**
+ * lim_set_eht_caps() - update EHT caps to be sent to FW as part of scan IE
+ * @mac: pointer to MAC
+ * @session: pointer to PE session
+ * @ie_start: pointer to start of IE buffer
+ * @num_bytes: length of IE buffer
+ *
+ * Return: None
+ */
+void lim_set_eht_caps(struct mac_context *mac, struct pe_session *session,
+		      uint8_t *ie_start, uint32_t num_bytes);
+
+/**
+ * lim_send_eht_caps_ie() - gets EHT capability and send to firmware via wma
+ * @mac_ctx: global mac context
+ * @session: pe session. This can be NULL. In that case self cap will be sent
+ * @device_mode: VDEV op mode
+ * @vdev_id: vdev for which IE is targeted
+ *
+ * This function gets EHT capability and send to firmware via wma
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS lim_send_eht_caps_ie(struct mac_context *mac_ctx,
+				struct pe_session *session,
+				enum QDF_OPMODE device_mode,
+				uint8_t vdev_id);
+/**
+ * lim_log_eht_op() - Print EHT Operation
+ * @mac: pointer to MAC context
+ * @eht_op: pointer to EHT Operation
+ * @session: pointer to PE session
+ *
+ * Print EHT operation stored as dot11f structure
+ *
+ * Return: None
+ */
+void lim_log_eht_op(struct mac_context *mac, tDot11fIEeht_op *eht_ops,
+		    struct pe_session *session);
+
+/**
+ * lim_update_stads_eht_caps() - Copy EHT capability into STA DPH hash table
+ *                               entry
+ * @mac_ctx: pointer to mac context
+ * @sta_ds: pointer to sta dph hash table entry
+ * @assoc_rsp: pointer to assoc response
+ * @session_entry: pointer to PE session
+ * @beacon: pointer to beacon
+ *
+ * Return: None
+ */
+void lim_update_stads_eht_caps(struct mac_context *mac_ctx,
+			       tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp,
+			       struct pe_session *session_entry,
+			       tSchBeaconStruct *beacon);
+
 #else
 static inline bool lim_is_session_eht_capable(struct pe_session *session)
 {
@@ -1818,6 +1936,64 @@ lim_decide_eht_op(struct mac_context *mac_ctx, uint32_t *mlme_eht_ops,
 		  struct pe_session *session)
 {
 }
+
+static inline void
+lim_update_stads_eht_capable(tpDphHashNode sta_ds, tpSirAssocReq assoc_req)
+{
+}
+
+static inline void
+lim_update_sta_eht_capable(struct mac_context *mac,
+			   tpAddStaParams add_sta_params,
+			   tpDphHashNode sta_ds,
+			   struct pe_session *session_entry)
+{
+}
+
+static inline void
+lim_update_session_eht_capable_chan_switch(struct mac_context *mac,
+					   struct pe_session *session,
+					   uint32_t new_chan_freq)
+{
+}
+
+static inline void
+lim_update_bss_eht_capable(struct mac_context *mac,
+			   struct bss_params *add_bss)
+{
+}
+
+static inline void
+lim_log_eht_cap(struct mac_context *mac, tDot11fIEeht_cap *eht_cap)
+{
+}
+
+static inline void
+lim_set_eht_caps(struct mac_context *mac, struct pe_session *session,
+		 uint8_t *ie_start, uint32_t num_bytes)
+{
+}
+
+static inline QDF_STATUS
+lim_send_eht_caps_ie(struct mac_context *mac_ctx, struct pe_session *session,
+		     enum QDF_OPMODE device_mode, uint8_t vdev_id)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline void
+lim_log_eht_op(struct mac_context *mac, tDot11fIEeht_op *eht_ops,
+	       struct pe_session *session)
+{
+}
+
+static inline void
+lim_update_stads_eht_caps(struct mac_context *mac_ctx,
+			  tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp,
+			  struct pe_session *session_entry,
+			  tSchBeaconStruct *beacon)
+{
+}
 #endif /* WLAN_FEATURE_11BE */
 
 #if defined(CONFIG_BAND_6GHZ) && defined(WLAN_FEATURE_11AX)

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

@@ -3135,6 +3135,14 @@ sir_convert_assoc_req_frame2_struct(struct mac_context *mac,
 			     sizeof(tDot11fIEhe_6ghz_band_cap));
 		pe_debug("Received Assoc Req with HE Band Capability IE");
 	}
+	if (ar->eht_cap.present) {
+		qdf_mem_copy(&pAssocReq->eht_cap, &ar->eht_cap,
+			     sizeof(tDot11fIEeht_cap));
+		pe_debug("Received Assoc Req with EHT Capability IE");
+		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+				   &pAssocReq->eht_cap,
+				   sizeof(tDot11fIEeht_cap));
+	}
 	qdf_mem_free(ar);
 	return QDF_STATUS_SUCCESS;
 
@@ -3156,7 +3164,6 @@ QDF_STATUS dot11f_parse_assoc_response(struct mac_context *mac_ctx,
 				   p_buf, n_buf);
 		return QDF_STATUS_E_FAILURE;
 	}
-
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -3651,6 +3658,11 @@ sir_convert_assoc_resp_frame2_struct(struct mac_context *mac,
 				pAssocRsp->he_op.bss_col_disabled);
 	}
 
+	if (ar->eht_cap.present) {
+		qdf_mem_copy(&pAssocRsp->eht_cap, &ar->eht_cap,
+			     sizeof(tDot11fIEeht_cap));
+	}
+
 	if (ar->he_6ghz_band_cap.present) {
 		pe_debug("11AX: HE Band Capability IE present");
 		qdf_mem_copy(&pAssocRsp->he_6ghz_band_cap,
@@ -6616,6 +6628,8 @@ QDF_STATUS populate_dot11f_eht_operation(struct mac_context *mac_ctx,
 	qdf_mem_copy(eht_op, &session->eht_op, sizeof(*eht_op));
 
 	eht_op->present = 1;
+	lim_log_eht_op(mac_ctx, eht_op, session);
+
 	return QDF_STATUS_SUCCESS;
 }
 #endif /* WLAN_FEATURE_11BE */