Kaynağa Gözat

qcacld-3.0: Allow local power constraint to be zero

Currently when calculate TPC command, assume local power constraint
is non-zero, but constraint is possible to be zero like AP can restore
local power constraint to zero after change to a non-zero value.

Add a local flag to check whether STA need follow AP's local power
constraint and calculate/update TPC command accordingly. In case if
AP configure invalid absolute constraint power to 0, add check and
don't follow this wrong configure.

Function lim_extract_ap_capability() may not update
localPowerConstraint if both power constraint IE and ESE TX power IE
not present, to avoid access uninitialized localPowerConstraint,
initialize it to zero and we have check when use it in
lim_calculate_tpc().

Change-Id: Ib4600574aefee7f4bcff84c06891dcc15f5d265a
CRs-Fixed: 3676758
Will Huang 1 yıl önce
ebeveyn
işleme
d48e5d4417

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

@@ -529,7 +529,7 @@ static QDF_STATUS lim_fill_session_power_info(
 				struct pe_session *pe_session)
 {
 	uint8_t currentBssUapsd;
-	int8_t localPowerConstraint;
+	int8_t localPowerConstraint = 0;
 	int8_t regMax = 0;
 	bool is_pwr_constraint = false;
 	struct vdev_mlme_obj *mlme_obj;

+ 15 - 11
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -3222,7 +3222,7 @@ lim_fill_pe_session(struct mac_context *mac_ctx, struct pe_session *session,
 	ePhyChanBondState cb_mode;
 	const uint8_t *vendor_ie;
 	uint16_t ie_len;
-	int8_t local_power_constraint;
+	int8_t local_power_constraint = 0;
 	struct vdev_mlme_obj *mlme_obj;
 	bool is_pwr_constraint = false;
 	tSirMacCapabilityInfo *ap_cap_info;
@@ -6294,19 +6294,23 @@ void lim_calculate_tpc(struct mac_context *mac,
 
 		/* max tx power calculation */
 		max_tx_power = mlme_obj->reg_tpc_obj.reg_max[i];
-		/* If AP local power constraint is present */
-		if (mlme_obj->reg_tpc_obj.ap_constraint_power) {
-			local_constraint =
-				mlme_obj->reg_tpc_obj.ap_constraint_power;
-			pe_debug("local constraint: %d power constraint absolute %d",
-				 local_constraint,
-				 mlme_obj->reg_tpc_obj.is_power_constraint_abs);
-			if (mlme_obj->reg_tpc_obj.is_power_constraint_abs)
+
+		local_constraint = mlme_obj->reg_tpc_obj.ap_constraint_power;
+		pe_debug("local constraint: %d power constraint absolute %d",
+			 local_constraint,
+			 mlme_obj->reg_tpc_obj.is_power_constraint_abs);
+		if (mlme_obj->reg_tpc_obj.is_power_constraint_abs) {
+			if (!local_constraint) {
+				pe_debug("ignore abs ap constraint power 0!");
+				max_tx_power = reg_max;
+			} else {
 				max_tx_power = QDF_MIN(reg_max,
 						       local_constraint);
-			else
-				max_tx_power = reg_max - local_constraint;
+			}
+		} else {
+			max_tx_power = reg_max - local_constraint;
 		}
+
 		/* If TPE is present */
 		if (is_tpe_present && !skip_tpe) {
 			if (!is_psd_power && mlme_obj->reg_tpc_obj.eirp_power)

+ 6 - 5
core/mac/src/pe/sch/sch_beacon_process.c

@@ -602,6 +602,7 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
 	struct vdev_mlme_obj *mlme_obj;
 	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 	bool ap_constraint_change = false, tpe_change = false;
+	bool allow_tpc = false;
 	int8_t regMax = 0, maxTxPower = 0;
 	QDF_STATUS status;
 	bool skip_tpe = false, is_sap_go_switched_ch;
@@ -714,10 +715,11 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
 				bcn->localPowerConstraint.localPowerConstraints;
 				is_power_constraint_abs = false;
 			}
+			allow_tpc = true;
 		}
 
-		if (local_constraint !=
-				mlme_obj->reg_tpc_obj.ap_constraint_power) {
+		if (allow_tpc && local_constraint !=
+		    mlme_obj->reg_tpc_obj.ap_constraint_power) {
 			mlme_obj->reg_tpc_obj.ap_constraint_power =
 							local_constraint;
 			mlme_obj->reg_tpc_obj.is_power_constraint_abs =
@@ -725,15 +727,14 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
 			ap_constraint_change = true;
 		}
 
-		if ((ap_constraint_change && local_constraint) ||
-		    (tpe_change && !skip_tpe)) {
+		if (ap_constraint_change || (tpe_change && !skip_tpe)) {
 			lim_calculate_tpc(mac_ctx, session);
 
 			if (tx_ops->set_tpc_power)
 				tx_ops->set_tpc_power(mac_ctx->psoc,
 						      session->vdev_id,
 						      &mlme_obj->reg_tpc_obj);
-			}
+		}
 	} else if (!session->sta_follows_sap_power) {
 		/* Obtain the Max Tx power for the current regulatory  */
 		regMax = wlan_reg_get_channel_reg_power_for_freq(