Parcourir la source

qcacld-3.0: Update ap power type for 6G roaming case

Update the ap power type when STA moves in/out of 6G
during roaming in beacon process API. Add new API
wlan_reg_get_6g_power_type to return ap power type
and country code match.
Currently, after roaming, the lim join req is null and
the null check in TPC calculation API returns without
calculating the TPC power again. This change should
fix the issue and recalculate TPC power after roaming.

Change-Id: Ide50d1d516307dd5661ad31f2b48c85f08ed2891
CRs-Fixed: 2968407
Gururaj Pandurangi il y a 3 ans
Parent
commit
928955ae6c

+ 3 - 2
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -2310,7 +2310,8 @@ void lim_handle_add_bss_rsp(struct mac_context *mac_ctx,
 			}
 			tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
 
-			lim_calculate_tpc(mac_ctx, session_entry, false);
+			lim_calculate_tpc(mac_ctx, session_entry, false, 0,
+					  false);
 
 			if (tx_ops->set_tpc_power)
 				tx_ops->set_tpc_power(mac_ctx->psoc,
@@ -2793,7 +2794,7 @@ static void lim_process_switch_channel_join_req(
 			goto error;
 		}
 
-		lim_calculate_tpc(mac_ctx, session_entry, false);
+		lim_calculate_tpc(mac_ctx, session_entry, false, 0, false);
 
 		if (tx_ops->set_tpc_power)
 			tx_ops->set_tpc_power(mac_ctx->psoc,

+ 25 - 32
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -2638,6 +2638,8 @@ lim_fill_pe_session(struct mac_context *mac_ctx, struct pe_session *session,
 				&ps_global_info->ps_params[session->vdev_id];
 	uint32_t join_timeout;
 	uint8_t programmed_country[REG_ALPHA2_LEN + 1];
+	enum reg_6g_ap_type power_type_6g;
+	bool ctry_code_match;
 
 	/*
 	 * Update the capability here itself as this is used in
@@ -2714,29 +2716,17 @@ lim_fill_pe_session(struct mac_context *mac_ctx, struct pe_session *session,
 			pe_debug("Channel is 6G but country IE not present");
 		wlan_reg_read_current_country(mac_ctx->psoc,
 					      programmed_country);
-		if (qdf_mem_cmp(ie_struct->Country.country, programmed_country,
-				REG_ALPHA2_LEN)) {
-			pe_debug("Country IE:%c%c, STA country:%c%c",
-				  ie_struct->Country.country[0],
-				  ie_struct->Country.country[1],
-				  programmed_country[0],
-				  programmed_country[1]);
-			session->same_ctry_code = false;
-			if (wlan_reg_is_us(programmed_country)) {
-				pe_err("US VLP not in place yet, connection not allowed");
-				qdf_mem_free(ie_struct);
-				return QDF_STATUS_E_NOSUPPORT;
-			}
-			if (wlan_reg_is_etsi(programmed_country)) {
-				pe_debug("STA ctry:%c%c, doesn't match with AP ctry, switch to VLP",
-					  programmed_country[0],
-					  programmed_country[1]);
-				session->ap_power_type_6g =
-							REG_VERY_LOW_POWER_AP;
-			}
-		} else {
-			session->same_ctry_code = true;
+		status = wlan_reg_get_6g_power_type_for_ctry(
+					ie_struct->Country.country,
+					programmed_country, &power_type_6g,
+					&ctry_code_match);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			qdf_mem_free(ie_struct);
+			return QDF_STATUS_E_NOSUPPORT;
 		}
+		session->ap_power_type_6g = power_type_6g;
+		session->same_ctry_code = ctry_code_match;
+
 		lim_iterate_triplets(ie_struct->Country);
 
 		if (!ie_struct->num_transmit_power_env ||
@@ -4663,7 +4653,9 @@ uint8_t lim_get_max_tx_power(struct mac_context *mac,
 
 void lim_calculate_tpc(struct mac_context *mac,
 		       struct pe_session *session,
-		       bool is_pwr_constraint_absolute)
+		       bool is_pwr_constraint_absolute,
+		       uint8_t ap_pwr_type,
+		       bool ctry_code_match)
 {
 	bool is_psd_power = false;
 	bool is_tpe_present = false, is_6ghz_freq = false;
@@ -4678,11 +4670,6 @@ void lim_calculate_tpc(struct mac_context *mac,
 	uint8_t tpe_power;
 	bool skip_tpe = false;
 
-	if (LIM_IS_STA_ROLE(session) && !session->lim_join_req) {
-		pe_err("Join Request is NULL");
-		return;
-	}
-
 	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(session->vdev);
 	if (!mlme_obj) {
 		pe_err("vdev component object is NULL");
@@ -4708,11 +4695,17 @@ void lim_calculate_tpc(struct mac_context *mac,
 	} else {
 		is_6ghz_freq = true;
 		is_psd_power = wlan_reg_is_6g_psd_power(mac->pdev);
+		/* Power mode calculation for 6G*/
+		ap_power_type_6g = session->ap_power_type;
 		if (LIM_IS_STA_ROLE(session)) {
-			if (session->same_ctry_code)
-				ap_power_type_6g = session->ap_power_type;
-			else
-				ap_power_type_6g = session->ap_power_type_6g;
+			if (!session->lim_join_req) {
+				if (!ctry_code_match)
+					ap_power_type_6g = ap_pwr_type;
+			} else {
+				if (!session->same_ctry_code)
+					ap_power_type_6g =
+						session->ap_power_type_6g;
+			}
 		}
 	}
 

+ 5 - 1
core/mac/src/pe/lim/lim_utils.h

@@ -176,6 +176,8 @@ uint8_t lim_get_max_tx_power(struct mac_context *mac,
  * @session: PE Session Entry
  * @is_pwr_constraint_absolute: If local power constraint is an absolute
  * value or an offset value.
+ * @ap_pwr_type: Ap power type for 6G
+ * @ctry_code_match: check for country IE and sta programmed ctry match
  *
  * This function is used to get the maximum possible tx power from the list
  * of tx powers mentioned in @attr.
@@ -184,7 +186,9 @@ uint8_t lim_get_max_tx_power(struct mac_context *mac,
  */
 void lim_calculate_tpc(struct mac_context *mac,
 		       struct pe_session *session,
-		       bool is_pwr_constraint_absolute);
+		       bool is_pwr_constraint_absolute,
+		       uint8_t ap_pwr_type,
+		       bool ctry_code_match);
 
 /* AID pool management functions */
 void lim_init_peer_idxpool(struct mac_context *, struct pe_session *);

+ 1 - 1
core/mac/src/pe/rrm/rrm_api.c

@@ -270,7 +270,7 @@ rrm_process_link_measurement_request(struct mac_context *mac,
 		ap_pwr_constraint = mlme_obj->reg_tpc_obj.ap_constraint_power;
 		mlme_obj->reg_tpc_obj.ap_constraint_power =
 				pLinkReq->MaxTxPower.maxTxPower;
-		lim_calculate_tpc(mac, pe_session, true);
+		lim_calculate_tpc(mac, pe_session, true, 0, false);
 
 		LinkReport.txPower =
 			mlme_obj->reg_tpc_obj.chan_power_info[0].tx_power;

+ 20 - 2
core/mac/src/pe/sch/sch_beacon_process.c

@@ -713,6 +713,9 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
 	int8_t regMax = 0, maxTxPower = 0;
 	QDF_STATUS status;
 	bool skip_tpe = false;
+	uint8_t programmed_country[REG_ALPHA2_LEN + 1];
+	enum reg_6g_ap_type pwr_type_6g = REG_INDOOR_AP;
+	bool ctry_code_match = false;
 
 	qdf_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
 	beaconParams.paramChangeBitmap = 0;
@@ -744,8 +747,22 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
 		return;
 	}
 
-	if (!wlan_reg_is_6ghz_chan_freq(bcn->chan_freq))
+	if (!wlan_reg_is_6ghz_chan_freq(bcn->chan_freq)) {
 		skip_tpe = wlan_mlme_skip_tpe(mac_ctx->psoc);
+	} else {
+		if (!bcn->countryInfoParam.countryString[0]) {
+			pe_err("Channel is 6G but country IE not present");
+			return;
+		}
+		wlan_reg_read_current_country(mac_ctx->psoc,
+					      programmed_country);
+		status = wlan_reg_get_6g_power_type_for_ctry(
+					bcn->countryInfoParam.countryString,
+					programmed_country, &pwr_type_6g,
+					&ctry_code_match);
+		if (QDF_IS_STATUS_ERROR(status))
+			return;
+	}
 
 	if (wlan_reg_is_ext_tpc_supported(mac_ctx->psoc)) {
 		tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
@@ -773,7 +790,8 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
 
 		if ((ap_constraint_change && local_constraint) ||
 		    (tpe_change && !skip_tpe)) {
-			lim_calculate_tpc(mac_ctx, session, false);
+			lim_calculate_tpc(mac_ctx, session, false, pwr_type_6g,
+					  ctry_code_match);
 
 			if (tx_ops->set_tpc_power)
 				tx_ops->set_tpc_power(mac_ctx->psoc,