Ver Fonte

qcacld-3.0: Fix channel load report invalid channel issue

As per the spec, the expectation is that in a given country
if the channel load is requested on a channel not present
in that country, STA should respond with incapable set in
the report.

Fix is to validate channel and op class present in channel
load request before processing channel load rrm request.

Change-Id: I6e282478cd41c9aca8f6c95c2dfde1466b678889
CRs-Fixed: 3603919
Abhinav Kumar há 1 ano atrás
pai
commit
258b190861
2 ficheiros alterados com 38 adições e 4 exclusões
  1. 32 1
      core/mac/src/pe/rrm/rrm_api.c
  2. 6 3
      core/sme/src/rrm/sme_rrm.c

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

@@ -2049,6 +2049,9 @@ rrm_process_channel_load_req(struct mac_context *mac,
 	uint8_t op_class, channel, reporting_condition;
 	uint16_t randomization_intv, meas_duration, max_meas_duration;
 	bool present;
+	uint8_t country[WNI_CFG_COUNTRY_CODE_LEN];
+	qdf_freq_t chan_freq;
+	bool is_freq_enabled;
 
 	present = chan_load_req->measurement_request.channel_load.rrm_reporting.present;
 	reporting_condition = chan_load_req->measurement_request.channel_load.rrm_reporting.reporting_condition;
@@ -2072,7 +2075,8 @@ rrm_process_channel_load_req(struct mac_context *mac,
 			meas_duration = max_meas_duration;
 		}
 	}
-	pe_debug("RX:[802.11 CH_LOAD] seq:%d Token:%d op_c:%d ch:%d meas_dur:%d, rand intv: %d, max_dur:%d",
+	pe_debug("RX:[802.11 CH_LOAD] vdev :%d, seq:%d Token:%d op_c:%d ch:%d meas_dur:%d, rand intv: %d, max_dur:%d",
+		 pe_session->vdev_id,
 		 mac->rrm.rrmPEContext.prev_rrm_report_seq_num,
 		 chan_load_req->measurement_token, op_class,
 		 channel, meas_duration, randomization_intv,
@@ -2080,6 +2084,33 @@ rrm_process_channel_load_req(struct mac_context *mac,
 	if (!meas_duration || meas_duration > RRM_SCAN_MAX_DWELL_TIME)
 		return eRRM_REFUSED;
 
+	if (!wlan_reg_is_6ghz_supported(mac->psoc) &&
+	    (wlan_reg_is_6ghz_op_class(mac->pdev, op_class))) {
+		pe_debug("RX: [802.11 CH_LOAD] Ch belongs to 6 ghz spectrum, abort");
+		return eRRM_INCAPABLE;
+	}
+
+	rrm_get_country_code_from_connected_profile(mac, pe_session->vdev_id,
+						    country);
+	chan_freq = wlan_reg_country_chan_opclass_to_freq(mac->pdev,
+							  country, channel,
+							  op_class, false);
+	if (!chan_freq) {
+		pe_debug("Invalid ch freq for country code %c%c 0x%x",
+			 country[0], country[1], country[2]);
+		return eRRM_INCAPABLE;
+	}
+
+	pe_debug("freq:%d, country code %c%c 0x%x", chan_freq, country[0],
+		 country[1], country[2]);
+
+	is_freq_enabled = wlan_reg_is_freq_enabled(mac->pdev, chan_freq,
+						   REG_CURRENT_PWR_MODE);
+	if (!is_freq_enabled) {
+		pe_debug("No channels populated with requested operation class and current country, Hence abort the rrm operation");
+		return eRRM_INCAPABLE;
+	}
+
 	/* Prepare the request to send to SME. */
 	load_ind = qdf_mem_malloc(sizeof(struct ch_load_ind));
 	if (!load_ind)

+ 6 - 3
core/sme/src/rrm/sme_rrm.c

@@ -1153,9 +1153,6 @@ sme_rrm_fill_freq_list_for_channel_load(struct mac_context *mac_ctx,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	sme_debug("opclass: %d, channel: %d freq:%d, country code %c%c 0x%x",
-		  sme_rrm_ctx->regClass, channel, scan_freq,
-		  country_code[0], country_code[1], country_code[2]);
 	if (wlan_reg_is_6ghz_op_class(mac_ctx->pdev, sme_rrm_ctx->regClass))
 		chan_space = wlan_reg_get_op_class_width
 			(mac_ctx->pdev, sme_rrm_ctx->regClass, true);
@@ -1163,6 +1160,12 @@ sme_rrm_fill_freq_list_for_channel_load(struct mac_context *mac_ctx,
 		chan_space = wlan_reg_dmn_get_chanwidth_from_opclass_auto(
 							country_code, channel,
 							sme_rrm_ctx->regClass);
+
+	sme_debug("opclass: %d, channel: %d freq:%d, country code %c%c 0x%x, chan_space:%d",
+		  sme_rrm_ctx->regClass, channel, scan_freq,
+		  country_code[0], country_code[1], country_code[2],
+		  chan_space);
+
 	switch (chan_space) {
 	case 320:
 		fallthrough;