Browse Source

qcacld-3.0: Update TPC command after SAP DCS happen

If SAP switch to 6 GHz channel with CSA, its channel tx power may
change like by AFC updating, so need update TPC command after CSA
complete.

Current 6 GHz channel power is got from regdb power limit, didn't
consider AFC event to update SP channel power and state. So need
to get channel power from secondary channel list which update by
AFC data.

Change-Id: I4517dd112fa6a97d5771b3d88a2587a7ae3cd4a5
CRs-Fixed: 3204221
Will Huang 2 năm trước cách đây
mục cha
commit
546b59df64

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

@@ -3185,6 +3185,9 @@ void lim_process_switch_channel_rsp(struct mac_context *mac,
 			ucfg_pkt_capture_record_channel(pe_session->vdev);
 		break;
 	case LIM_SWITCH_CHANNEL_SAP_DFS:
+		if (QDF_IS_STATUS_SUCCESS(status))
+			lim_set_tpc_power(mac, pe_session);
+
 		/* Note: This event code specific to SAP mode
 		 * When SAP session issues channel change as performing
 		 * DFS, we will come here. Other sessions, for e.g. P2P

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

@@ -5477,6 +5477,7 @@ void lim_calculate_tpc(struct mac_context *mac,
 	uint8_t i = 0;
 	int8_t max_tx_power;
 	uint16_t reg_max = 0, psd_power = 0;
+	uint16_t tx_power_within_bw = 0, psd_power_within_bw = 0;
 	uint16_t local_constraint, bw_val = 0;
 	uint32_t num_pwr_levels, ap_power_type_6g = 0;
 	qdf_freq_t oper_freq, start_freq = 0;
@@ -5598,13 +5599,29 @@ void lim_calculate_tpc(struct mac_context *mac,
 					 mlme_obj->reg_tpc_obj.frequency[i],
 					 is_psd_power, &reg_max, &psd_power);
 				} else {
-					wlan_reg_get_cur_6g_ap_pwr_type(
+					if (wlan_reg_decide_6ghz_power_within_bw_for_freq(
+							mac->pdev, oper_freq,
+							session->ch_width,
+							&is_psd_power,
+							&tx_power_within_bw,
+							&psd_power_within_bw,
+							&ap_power_type_6g) ==
+							QDF_STATUS_SUCCESS) {
+						pe_debug("get pwr attr from secondary list");
+						reg_max = tx_power_within_bw;
+						psd_power = psd_power_within_bw;
+					} else {
+						wlan_reg_get_cur_6g_ap_pwr_type(
 							mac->pdev,
 							&ap_power_type_6g);
-					wlan_reg_get_6g_chan_ap_power(
-					mac->pdev,
-					mlme_obj->reg_tpc_obj.frequency[i],
-					&is_psd_power, &reg_max, &psd_power);
+						wlan_reg_get_6g_chan_ap_power(
+							mac->pdev,
+							mlme_obj->reg_tpc_obj.
+							frequency[i],
+							&is_psd_power,
+							&reg_max,
+							&psd_power);
+					}
 				}
 			}
 		}
@@ -5654,17 +5671,23 @@ void lim_calculate_tpc(struct mac_context *mac,
 			max_tx_power = QDF_MIN(max_tx_power, tpe_power);
 			pe_debug("TPE: %d", tpe_power);
 		}
-		mlme_obj->reg_tpc_obj.chan_power_info[i].tx_power =
+
+		if (is_psd_power)
+			mlme_obj->reg_tpc_obj.chan_power_info[i].tx_power =
+						(uint8_t)psd_power;
+		else
+			mlme_obj->reg_tpc_obj.chan_power_info[i].tx_power =
 						(uint8_t)max_tx_power;
 
-		pe_debug("freq: %d reg power: %d, max_tx_power: %d",
+		pe_debug("freq: %d reg power: %d, max_tx_power(eirp/psd): %d",
 			 mlme_obj->reg_tpc_obj.frequency[i], reg_max,
-			 max_tx_power);
+			 mlme_obj->reg_tpc_obj.chan_power_info[i].tx_power);
 	}
 
 	mlme_obj->reg_tpc_obj.num_pwr_levels = num_pwr_levels;
 	mlme_obj->reg_tpc_obj.eirp_power = reg_max;
 	mlme_obj->reg_tpc_obj.power_type_6g = ap_power_type_6g;
+	mlme_obj->reg_tpc_obj.is_psd_power = is_psd_power;
 
 	pe_debug("num_pwr_levels: %d, is_psd_power: %d, total eirp_power: %d, ap_pwr_type: %d",
 		 num_pwr_levels, is_psd_power, reg_max, ap_power_type_6g);

+ 1 - 10
core/mac/src/pe/lim/lim_utils.c

@@ -10893,16 +10893,7 @@ uint8_t lim_get_vht_ch_width(tDot11fIEVHTCaps *vht_cap,
 	return ch_width;
 }
 
-/*
- * lim_set_tpc_power() - Function to compute and send TPC power level to the
- * FW based on the opmode of the pe_session
- *
- * @mac_ctx:    Pointer to Global MAC structure
- * @pe_session: Pointer to session
- *
- * Return: TPC status
- */
-static bool
+bool
 lim_set_tpc_power(struct mac_context *mac_ctx, struct pe_session *session)
 {
 	struct wlan_lmac_if_reg_tx_ops *tx_ops;

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

@@ -3109,6 +3109,18 @@ uint8_t lim_get_vht_ch_width(tDot11fIEVHTCaps *vht_cap,
 			     tDot11fIEVHTOperation *vht_op,
 			     tDot11fIEHTInfo *ht_info);
 
+/*
+ * lim_set_tpc_power() - Function to compute and send TPC power level to the
+ * FW based on the opmode of the pe_session
+ *
+ * @mac_ctx:    Pointer to Global MAC structure
+ * @pe_session: Pointer to session
+ *
+ * Return: TPC status
+ */
+bool
+lim_set_tpc_power(struct mac_context *mac_ctx, struct pe_session *session);
+
 /**
  * lim_update_tx_power() - Function to update the TX power for
  * the STA interface based on the SAP concurrency