Преглед на файлове

qcacld-3.0: Parse Spatial Reuse Parameter IE

Set vdev spatial reuse variables based on SRP IE received as:
1. Part of association response frame when STA is connecting
2. Part of Probe-Response / Beacon frame once the STA is connected

Change-Id: Ib4f889e94d4951293dfa5bc93d2dcba61e5c89ff
CRs-Fixed: 3306201
Rachit Kankane преди 2 години
родител
ревизия
b3596058c7

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

@@ -65,6 +65,9 @@ typedef struct sDphQosParams {
  * @ht_operation: HT operation IE
  * @vht_operation: VHT operation IE
  * @hs20vendor_ie: HS2.0 vendor IE
+ * @he_operation: HE operation IE
+ * @srp_ie: Spatial Reuse Parameter IE
+ * @eht_operation: EHT IE
  *
  * This structure holds the parsed IE of connected BSS
  * and this is not the intersection of BSS and STA
@@ -81,6 +84,9 @@ struct parsed_ies {
 #ifdef WLAN_FEATURE_11AX
 	tDot11fIEhe_op he_operation;
 #endif
+#ifdef WLAN_FEATURE_SR
+	tDot11fIEspatial_reuse srp_ie;
+#endif
 #ifdef WLAN_FEATURE_11BE
 	tDot11fIEeht_op eht_operation;
 #endif

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

@@ -295,6 +295,9 @@ typedef struct sSirProbeRespBeacon {
 	tDot11fIEqcn_ie qcn_ie;
 	tDot11fIEhe_cap he_cap;
 	tDot11fIEhe_op he_op;
+#ifdef WLAN_FEATURE_SR
+	tDot11fIEspatial_reuse srp_ie;
+#endif
 	tDot11fIEeht_cap eht_cap;
 	tDot11fIEeht_op eht_op;
 #ifdef WLAN_FEATURE_11AX_BSS_COLOR
@@ -488,6 +491,9 @@ typedef struct sSirAssocRsp {
 	tDot11fIEqcn_ie qcn_ie;
 	tDot11fIEhe_cap he_cap;
 	tDot11fIEhe_op he_op;
+#ifdef WLAN_FEATURE_SR
+	tDot11fIEspatial_reuse srp_ie;
+#endif
 	tDot11fIEhe_6ghz_band_cap he_6ghz_band_cap;
 	tDot11fIEeht_cap eht_cap;
 	tDot11fIEeht_op eht_op;

+ 20 - 0
core/mac/src/pe/include/lim_api.h

@@ -614,6 +614,26 @@ lim_check_for_ml_probe_req(struct pe_session *session)
 }
 #endif
 
+#ifdef WLAN_FEATURE_SR
+
+/**
+ * lim_update_vdev_sr_elements() - Update VDEV variable with
+ * parsed values received in SRP IE
+ * @session_entry: pe session
+ * @sta_ds: STA node
+ *
+ * Return void
+ */
+void lim_update_vdev_sr_elements(struct pe_session *session_entry,
+				 tpDphHashNode sta_ds);
+#else
+static inline void
+lim_update_vdev_sr_elements(struct pe_session *session_entry,
+			    tpDphHashNode sta_ds)
+{
+}
+#endif
+
 #if defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(WLAN_FEATURE_11BE_MLO)
 /**
  * lim_cm_roam_create_session() - Create pe session for legacy to MLO roaming

+ 22 - 0
core/mac/src/pe/lim/lim_api.c

@@ -3752,3 +3752,25 @@ end:
 	return status;
 }
 #endif
+
+#ifdef WLAN_FEATURE_SR
+void lim_update_vdev_sr_elements(struct pe_session *session_entry,
+				 tpDphHashNode sta_ds)
+{
+	uint8_t sr_ctrl;
+	uint8_t max_pd_offset;
+	tDot11fIEspatial_reuse *srp_ie = &sta_ds->parsed_ies.srp_ie;
+
+	sr_ctrl = srp_ie->sr_value15_allow << 4 |
+		  srp_ie->srg_info_present << 3 |
+		  srp_ie->non_srg_offset_present << 2 |
+		  srp_ie->non_srg_pd_sr_disallow << 1 |
+		  srp_ie->psr_disallow;
+	max_pd_offset = srp_ie->non_srg_offset.info.non_srg_pd_max_offset;
+	pe_debug("Spatial Reuse Control field: %x Non-SRG Max PD Offset: %x",
+		 sr_ctrl, max_pd_offset);
+
+	wlan_vdev_mlme_set_sr_ctrl(session_entry->vdev, sr_ctrl);
+	wlan_vdev_mlme_set_pd_offset(session_entry->vdev, max_pd_offset);
+}
+#endif

+ 41 - 0
core/mac/src/pe/lim/lim_assoc_utils.c

@@ -2252,6 +2252,34 @@ lim_update_peer_twt_caps(tpAddStaParams add_sta_params,
 {}
 #endif
 
+#ifdef WLAN_FEATURE_SR
+/**
+ * lim_update_srp_ie() - Updates SRP IE to STA node
+ * @bp_rsp: pointer to probe response / beacon frame
+ * @sta_ds: STA Node
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS lim_update_srp_ie(tSirProbeRespBeacon *bp_rsp,
+				    tpDphHashNode sta_ds)
+{
+	QDF_STATUS status = QDF_STATUS_E_NOSUPPORT;
+
+	if (bp_rsp->srp_ie.present) {
+		sta_ds->parsed_ies.srp_ie = bp_rsp->srp_ie;
+		status = QDF_STATUS_SUCCESS;
+	}
+
+	return status;
+}
+#else
+static QDF_STATUS lim_update_srp_ie(tSirProbeRespBeacon *bp_rsp,
+				    tpDphHashNode sta_ds)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * lim_add_sta()- called to add an STA context at hardware
  * @mac_ctx: pointer to global mac structure
@@ -3153,11 +3181,13 @@ lim_check_and_announce_join_success(struct mac_context *mac_ctx,
 {
 	tSirMacSSid current_ssid;
 	tLimMlmJoinCnf mlm_join_cnf;
+	tpDphHashNode sta_ds = NULL;
 	uint32_t val;
 	uint32_t *noa_duration_from_beacon = NULL;
 	uint32_t *noa2_duration_from_beacon = NULL;
 	uint32_t noa;
 	uint32_t total_num_noa_desc = 0;
+	uint16_t aid;
 	bool check_assoc_disallowed;
 
 	qdf_mem_copy(current_ssid.ssId,
@@ -3317,6 +3347,17 @@ lim_check_and_announce_join_success(struct mac_context *mac_ctx,
 				&beacon_probe_rsp->hs20vendor_ie.hs_id,
 				sizeof(beacon_probe_rsp->hs20vendor_ie.hs_id));
 	}
+
+	sta_ds =  dph_lookup_hash_entry(mac_ctx, session_entry->self_mac_addr,
+					&aid,
+					&session_entry->dph.dphHashTable);
+
+	if (QDF_IS_STATUS_SUCCESS(lim_update_srp_ie(beacon_probe_rsp,
+						    sta_ds))) {
+		/* update the SR parameters */
+		lim_update_vdev_sr_elements(session_entry, sta_ds);
+		/* TODO: Need to send SRP IE update event to userspace */
+	}
 }
 
 /**

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

@@ -573,6 +573,26 @@ static inline void lim_process_he_info(tpSirProbeRespBeacon beacon,
 }
 #endif
 
+#ifdef WLAN_FEATURE_SR
+static QDF_STATUS lim_process_srp_ie(tpSirAssocRsp ar, tpDphHashNode sta_ds)
+{
+	QDF_STATUS status = QDF_STATUS_E_NOSUPPORT;
+
+	if (ar->srp_ie.present) {
+		sta_ds->parsed_ies.srp_ie = ar->srp_ie;
+		status = QDF_STATUS_SUCCESS;
+	}
+
+	return status;
+}
+#else
+static inline QDF_STATUS
+lim_process_srp_ie(tpSirAssocRsp ar, tpDphHashNode sta_ds)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 #ifdef WLAN_FEATURE_11BE
 static void lim_process_eht_info(tpSirProbeRespBeacon beacon,
 				 tpDphHashNode sta_ds)
@@ -1483,6 +1503,8 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 		sta_ds->parsed_ies.vht_operation = beacon->VHTOperation;
 
 	lim_process_he_info(beacon, sta_ds);
+	if (lim_process_srp_ie(assoc_rsp, sta_ds) == QDF_STATUS_SUCCESS)
+		lim_update_vdev_sr_elements(session_entry, sta_ds);
 
 	lim_process_eht_info(beacon, sta_ds);
 

+ 16 - 0
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -3700,6 +3700,20 @@ sir_convert_assoc_resp_frame2_mlo_struct(struct mac_context *mac,
 	return QDF_STATUS_SUCCESS;
 }
 #endif
+#ifdef WLAN_FEATURE_SR
+static void sir_convert_assoc_resp_frame2_sr(tpSirAssocRsp pAssocRsp,
+					     tDot11fAssocResponse *ar)
+{
+	if (ar->spatial_reuse.present)
+		qdf_mem_copy(&pAssocRsp->srp_ie, &ar->spatial_reuse,
+			     sizeof(tDot11fIEspatial_reuse));
+}
+#else
+static inline void sir_convert_assoc_resp_frame2_sr(tpSirAssocRsp pAssocRsp,
+						    tDot11fAssocResponse *ar)
+{
+}
+#endif
 
 QDF_STATUS
 sir_convert_assoc_resp_frame2_struct(struct mac_context *mac,
@@ -3966,6 +3980,8 @@ sir_convert_assoc_resp_frame2_struct(struct mac_context *mac,
 		qdf_mem_copy(&pAssocRsp->he_op, &ar->he_op,
 			     sizeof(tDot11fIEhe_op));
 
+	sir_convert_assoc_resp_frame2_sr(pAssocRsp, ar);
+
 	if (ar->he_6ghz_band_cap.present)
 		qdf_mem_copy(&pAssocRsp->he_6ghz_band_cap,
 			     &ar->he_6ghz_band_cap,