Jelajahi Sumber

qcacld-3.0: Add 11be BW 320 in GETSTAINFO

Implement changes to support 11be mode
and bandwidth 320 required for EHT.
Change-Id: I0b5e82e4d5fa0c2f1c8c8921d2b13a111582184c
CRs-Fixed: 3554106
Aasir Rasheed 1 tahun lalu
induk
melakukan
3086b00b54

+ 3 - 1
core/hdd/inc/wlan_hdd_assoc.h

@@ -65,6 +65,7 @@ enum peer_status {
  * struct hdd_conn_flag - connection flags
  * @ht_present: ht element present or not
  * @vht_present: vht element present or not
+ * @eht_present: eht element present or not
  * @hs20_present: hs20 element present or not
  * @ht_op_present: ht operation present or not
  * @vht_op_present: vht operation present or not
@@ -73,10 +74,11 @@ enum peer_status {
 struct hdd_conn_flag {
 	uint8_t ht_present:1;
 	uint8_t vht_present:1;
+	uint8_t eht_present:1;
 	uint8_t hs20_present:1;
 	uint8_t ht_op_present:1;
 	uint8_t vht_op_present:1;
-	uint8_t reserved:3;
+	uint8_t reserved:2;
 };
 
 /*defines for tx_BF_cap_info */

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

@@ -132,6 +132,8 @@
 #define HDD_80211_MODE_AC 1
 /* Defines the BIT position of 11ax support mode field of stainfo */
 #define HDD_80211_MODE_AX 2
+/* Defines the BIT position of 11be support mode field of stainfo */
+#define HDD_80211_MODE_BE 4
 
 #define HDD_MAX_CUSTOM_START_EVENT_SIZE 64
 
@@ -1517,6 +1519,8 @@ static void hdd_fill_station_info(struct hdd_adapter *adapter,
 					event->ht_caps.present))
 		is_dot11_mode_abgn = false;
 
+	stainfo->support_mode |=
+				(event->eht_caps_present << HDD_80211_MODE_BE);
 	stainfo->support_mode |= is_dot11_mode_abgn << HDD_80211_MODE_ABGN;
 	/* Initialize DHCP info */
 	stainfo->dhcp_phase = DHCP_PHASE_ACK;

+ 19 - 4
core/hdd/src/wlan_hdd_station_info.c

@@ -139,6 +139,8 @@
 	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_BEACON_IES
 #define ASSOC_REQ_IES \
 	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_ASSOC_REQ_IES
+#define REMOTE_CH_WIDTH_V2\
+	QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_REMOTE_CH_WIDTH_V2
 
 /*
  * MSB of rx_mc_bc_cnt indicates whether FW supports rx_mc_bc_cnt
@@ -147,6 +149,11 @@
  */
 #define HDD_STATION_INFO_RX_MC_BC_COUNT (1 << 31)
 
+/*
+ * Use this macro to check channel bandwidth 160MHZ
+ */
+#define MAX_CHANNEL_BW_160 160
+
 const struct nla_policy
 hdd_get_station_policy[STATION_MAX + 1] = {
 	[STATION_INFO] = {.type = NLA_FLAG},
@@ -1298,7 +1305,7 @@ fail:
  *
  * Returns: decoded channel band width.
  */
-static uint8_t hdd_decode_ch_width(tSirMacHTChannelWidth ch_width)
+static uint16_t hdd_decode_ch_width(tSirMacHTChannelWidth ch_width)
 {
 	switch (ch_width) {
 	case 0:
@@ -1310,6 +1317,8 @@ static uint8_t hdd_decode_ch_width(tSirMacHTChannelWidth ch_width)
 	case 3:
 	case 4:
 		return 160;
+	case 5:
+		return 320;
 	default:
 		hdd_debug("invalid enum: %d", ch_width);
 		return 20;
@@ -1335,6 +1344,8 @@ static int hdd_get_cached_station_remote(struct hdd_context *hdd_ctx,
 	struct sk_buff *skb = NULL;
 	uint32_t nl_buf_len = NLMSG_HDRLEN;
 	uint8_t channel_width;
+	uint16_t channel_width_v2;
+
 
 	stainfo = hdd_get_sta_info_by_mac(&adapter->cache_sta_info_list,
 					  mac_addr.bytes,
@@ -1381,11 +1392,16 @@ static int hdd_get_cached_station_remote(struct hdd_context *hdd_ctx,
 	}
 
 	/* upper layer expects decoded channel BW */
-	channel_width = hdd_decode_ch_width(stainfo->ch_width);
+	channel_width_v2 = hdd_decode_ch_width(stainfo->ch_width);
+	if (channel_width_v2 > MAX_CHANNEL_BW_160)
+		channel_width = MAX_CHANNEL_BW_160;
+	else
+		channel_width = channel_width_v2;
 
 	if (nla_put_u32(skb, REMOTE_SUPPORTED_MODE,
 			stainfo->support_mode) ||
-	    nla_put_u8(skb, REMOTE_CH_WIDTH, channel_width)) {
+	    nla_put_u8(skb, REMOTE_CH_WIDTH, channel_width) ||
+	    nla_put_u16(skb, REMOTE_CH_WIDTH_V2, channel_width_v2)) {
 		hdd_err("remote ch put fail");
 		goto fail;
 	}
@@ -1403,7 +1419,6 @@ static int hdd_get_cached_station_remote(struct hdd_context *hdd_ctx,
 		hdd_err("dot11 mode put fail");
 		goto fail;
 	}
-
 	if (!(stainfo->rx_mc_bc_cnt & HDD_STATION_INFO_RX_MC_BC_COUNT)) {
 		hdd_debug("rx mc bc count is not supported by FW");
 	} else if (nla_put_u32(skb, REMOTE_RX_BC_MC_COUNT,

+ 24 - 1
core/hdd/src/wlan_hdd_stats.c

@@ -5711,7 +5711,21 @@ static void hdd_fill_bw_mcs(struct rate_info *rate_info,
 			    uint8_t nss,
 			    uint8_t rate_info_flag)
 {
-	if (rate_info_flag == RATE_INFO_FLAGS_HE_MCS) {
+	if (rate_info_flag == RATE_INFO_FLAGS_EHT_MCS) {
+		rate_info->nss = nss;
+		rate_info->mcs = mcsidx;
+		rate_info->flags |= RATE_INFO_FLAGS_EHT_MCS;
+		if (rate_flags & TX_RATE_EHT320)
+			rate_info->bw = RATE_INFO_BW_320;
+		else if (rate_flags & TX_RATE_EHT160)
+			rate_info->bw = RATE_INFO_BW_160;
+		else if (rate_flags & TX_RATE_EHT80)
+			rate_info->bw = RATE_INFO_BW_80;
+		else if (rate_flags & TX_RATE_EHT40)
+			rate_info->bw = RATE_INFO_BW_40;
+		else if (rate_flags & TX_RATE_EHT20)
+			rate_info->bw = RATE_INFO_BW_20;
+	} else if (rate_info_flag == RATE_INFO_FLAGS_HE_MCS) {
 		rate_info->nss = nss;
 		rate_info->mcs = mcsidx;
 		rate_info->flags |= RATE_INFO_FLAGS_HE_MCS;
@@ -5814,6 +5828,15 @@ static void hdd_fill_sinfo_rate_info(struct station_info *sinfo,
 		rate_info->legacy = rate;
 	} else {
 		/* must be MCS */
+		if (rate_flags &
+				(TX_RATE_EHT320 |
+				 TX_RATE_EHT160 |
+				 TX_RATE_EHT80 |
+				 TX_RATE_EHT40 |
+				 TX_RATE_EHT20)) {
+			hdd_fill_bw_mcs(rate_info, rate_flags, mcsidx, nss,
+					RATE_INFO_FLAGS_EHT_MCS);
+		}
 		if (rate_flags &
 				(TX_RATE_HE160 |
 				 TX_RATE_HE80 |

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

@@ -1081,6 +1081,7 @@ struct assoc_ind {
 	tDot11fIEHTCaps HTCaps;
 	tDot11fIEVHTCaps VHTCaps;
 	bool he_caps_present;
+	bool eht_caps_present;
 	tSirMacCapabilityInfo capability_info;
 	bool is_sae_authenticated;
 	const uint8_t *owe_ie;

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

@@ -1567,7 +1567,6 @@ static bool lim_update_sta_ds(struct mac_context *mac_ctx, tSirMacAddr sa,
 		session->parsedAssocReq[sta_ds->assocId] = assoc_req;
 		*assoc_req_copied = true;
 	}
-
 	if (!assoc_req->wmeInfoPresent) {
 		sta_ds->mlmStaContext.htCapability = 0;
 		sta_ds->mlmStaContext.vhtCapability = 0;
@@ -3358,6 +3357,7 @@ bool lim_fill_lim_assoc_ind_params(
 		 assoc_ind->chan_info.info,
 		 assoc_ind->chan_info.band_center_freq1);
 	assoc_ind->he_caps_present = assoc_req->he_cap.present;
+	assoc_ind->eht_caps_present = assoc_req->eht_cap.present;
 	assoc_ind->is_sae_authenticated =
 				assoc_req->is_sae_authenticated;
 	/* updates HE bandwidth in assoc indication */

+ 1 - 0
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -828,6 +828,7 @@ lim_fill_sme_assoc_ind_params(
 		sme_assoc_ind->VHTCaps = assoc_ind->vht_caps;
 	sme_assoc_ind->capability_info = assoc_ind->capabilityInfo;
 	sme_assoc_ind->he_caps_present = assoc_ind->he_caps_present;
+	sme_assoc_ind->eht_caps_present = assoc_ind->eht_caps_present;
 	sme_assoc_ind->is_sae_authenticated = assoc_ind->is_sae_authenticated;
 }
 

+ 36 - 2
core/mac/src/pe/lim/lim_send_sme_rsp_messages.c

@@ -169,6 +169,37 @@ lim_get_he_rate_info_flag(tpDphHashNode sta_ds)
 }
 #endif
 
+#ifdef WLAN_FEATURE_11BE
+/**
+ * lim_get_eht_rate_info_flag() - Get eht tx rate info flag
+ * @sta_ds: Pointer to station ds structure
+ *
+ * This function is called to get the eht tx rate info.
+ *
+ * Return: Returns eht tx rate flag
+ */
+static enum tx_rate_info
+lim_get_eht_rate_info_flag(tpDphHashNode sta_ds)
+{
+	if (sta_ds->eht_config.support_320mhz_6ghz)
+		return  TX_RATE_EHT320;
+	else if (sta_ds->ch_width == CH_WIDTH_160MHZ)
+		return  TX_RATE_EHT160;
+	else if (sta_ds->ch_width == CH_WIDTH_80MHZ)
+		return TX_RATE_EHT80;
+	else if (sta_ds->ch_width == CH_WIDTH_40MHZ)
+		return TX_RATE_EHT40;
+	else
+		return TX_RATE_EHT20;
+}
+#else
+static enum tx_rate_info
+lim_get_eht_rate_info_flag(tpDphHashNode sta_ds)
+{
+	return TX_RATE_LEGACY;
+}
+#endif
+
 /**
  * lim_get_max_rate_flags() - Get rate flags
  * @mac_ctx: Pointer to global MAC structure
@@ -189,12 +220,15 @@ uint32_t lim_get_max_rate_flags(struct mac_context *mac_ctx, tpDphHashNode sta_d
 		return rate_flags;
 	}
 
-	if (!sta_ds->mlmStaContext.htCapability &&
+	if (!lim_is_sta_eht_capable(sta_ds) &&
+	    !sta_ds->mlmStaContext.htCapability &&
 	    !sta_ds->mlmStaContext.vhtCapability &&
 	    !lim_is_sta_he_capable(sta_ds)) {
 		rate_flags |= TX_RATE_LEGACY;
 	} else {
-		if (lim_is_sta_he_capable(sta_ds)) {
+		if (lim_is_sta_eht_capable(sta_ds)) {
+			rate_flags |= lim_get_eht_rate_info_flag(sta_ds);
+		} else if (lim_is_sta_he_capable(sta_ds)) {
 			rate_flags |= lim_get_he_rate_info_flag(sta_ds);
 		} else if (sta_ds->mlmStaContext.vhtCapability) {
 			if (WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ ==

+ 1 - 0
core/mac/src/pe/lim/lim_types.h

@@ -260,6 +260,7 @@ typedef struct sLimMlmAssocInd {
 	tDot11fIEHTCaps ht_caps;
 	tDot11fIEVHTCaps vht_caps;
 	bool he_caps_present;
+	bool eht_caps_present;
 	bool is_sae_authenticated;
 #ifdef WLAN_FEATURE_11BE_MLO
 	tSirMacAddr peer_mld_addr;

+ 1 - 0
core/sap/inc/sap_api.h

@@ -293,6 +293,7 @@ typedef struct sap_StationAssocReassocCompleteEvent_s {
 	uint8_t supported_band;
 	tDot11fIEHTCaps ht_caps;
 	tDot11fIEVHTCaps vht_caps;
+	bool eht_caps_present;
 	tSirMacCapabilityInfo capability_info;
 	bool he_caps_present;
 	struct qdf_mac_addr sta_mld;

+ 2 - 0
core/sap/src/sap_fsm.c

@@ -2611,6 +2611,8 @@ QDF_STATUS sap_signal_hdd_event(struct sap_context *sap_ctx,
 			reassoc_complete->vht_caps = csr_roaminfo->vht_caps;
 		reassoc_complete->he_caps_present =
 						csr_roaminfo->he_caps_present;
+		reassoc_complete->eht_caps_present =
+						csr_roaminfo->eht_caps_present;
 		reassoc_complete->capability_info =
 						csr_roaminfo->capability_info;
 

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

@@ -566,6 +566,7 @@ struct csr_roam_info {
 	tDot11fIEHTCaps ht_caps;
 	tDot11fIEVHTCaps vht_caps;
 	bool he_caps_present;
+	bool eht_caps_present;
 	bool ampdu;
 	bool sgi_enable;
 	bool tx_stbc;
@@ -640,6 +641,7 @@ typedef struct sSirSmeAssocIndToUpperLayerCnf {
 	tDot11fIEVHTCaps vht_caps;
 	tSirMacCapabilityInfo capability_info;
 	bool he_caps_present;
+	bool eht_caps_present;
 #ifdef WLAN_FEATURE_11BE_MLO
 	tSirMacAddr peer_mld_addr;
 #endif

+ 4 - 2
core/sme/src/csr/csr_api_roam.c

@@ -3307,7 +3307,8 @@ void csr_roam_joined_state_msg_processor(struct mac_context *mac, void *msg_buf)
 					pUpperLayerAssocCnf->capability_info;
 		roam_info->he_caps_present =
 					pUpperLayerAssocCnf->he_caps_present;
-
+		roam_info->eht_caps_present =
+			pUpperLayerAssocCnf->eht_caps_present;
 		if (opmode == QDF_SAP_MODE || opmode == QDF_P2P_GO_MODE) {
 			if (pUpperLayerAssocCnf->ies_len > 0) {
 				roam_info->assocReqLength =
@@ -3891,6 +3892,7 @@ csr_send_assoc_ind_to_upper_layer_cnf_msg(struct mac_context *mac,
 		cnf->vht_caps = ind->VHTCaps;
 	cnf->capability_info = ind->capability_info;
 	cnf->he_caps_present = ind->he_caps_present;
+	cnf->eht_caps_present = ind->eht_caps_present;
 	if (ind->assocReqPtr) {
 		if (ind->assocReqLength < MAX_ASSOC_REQ_IE_LEN) {
 			cnf->ies = qdf_mem_malloc(ind->assocReqLength);
@@ -4015,7 +4017,7 @@ csr_roam_chk_lnk_assoc_ind(struct mac_context *mac_ctx, tSirSmeRsp *msg_ptr)
 			     sizeof(tDot11fIEVHTCaps));
 	roam_info->capability_info = pAssocInd->capability_info;
 	roam_info->he_caps_present = pAssocInd->he_caps_present;
-
+	roam_info->eht_caps_present = pAssocInd->eht_caps_present;
 	if (opmode == QDF_SAP_MODE || opmode == QDF_P2P_GO_MODE) {
 		if (wlan_is_open_wep_cipher(mac_ctx->pdev, sessionId)) {
 			csr_issue_set_context_req_helper(mac_ctx, sessionId,