Kaynağa Gözat

qcacmn: Modify state machine for 160/80p80 MHz gen3 spectral

A state machine checks if spectral reports are
in order for gen3 spectral 160/80p80. Currently,
this state machine has four states.
Modify this state machine to have only two states and
change associated APIs accordingly.

Change-Id: I754758fdf0529394c63fe371f54db79d52459999
CRs-Fixed: 2945161
Jhalak Naik 4 yıl önce
ebeveyn
işleme
f3008debc9

+ 14 - 0
target_if/spectral/target_if_spectral.h

@@ -134,6 +134,17 @@
 #define MAX_NUM_DEST_DETECTOR_INFO    (3)
 #define MAX_DETECTORS_PER_PDEV        (3)
 
+#ifdef OPTIMIZED_SAMP_MESSAGE
+/**
+ * enum spectral_160mhz_report_delivery_state - 160 MHz state machine states
+ * @SPECTRAL_REPORT_WAIT_PRIMARY80:   Wait for primary80 report
+ * @SPECTRAL_REPORT_WAIT_SECONDARY80: Wait for secondory 80 report
+ */
+enum spectral_160mhz_report_delivery_state {
+	SPECTRAL_REPORT_WAIT_PRIMARY80,
+	SPECTRAL_REPORT_WAIT_SECONDARY80,
+};
+#else
 /**
  * enum spectral_160mhz_report_delivery_state - 160 MHz state machine states
  * @SPECTRAL_REPORT_WAIT_PRIMARY80:   Wait for primary80 report
@@ -147,6 +158,7 @@ enum spectral_160mhz_report_delivery_state {
 	SPECTRAL_REPORT_WAIT_SECONDARY80,
 	SPECTRAL_REPORT_RX_SECONDARY80,
 };
+#endif /* OPTIMIZED_SAMP_MESSAGE */
 
 /**
  * enum spectral_detector_id - Spectral detector id
@@ -2011,6 +2023,7 @@ bool is_primaryseg_expected(struct target_if_spectral *spectral,
 	  SPECTRAL_REPORT_WAIT_PRIMARY80));
 }
 
+#ifndef OPTIMIZED_SAMP_MESSAGE
 /**
  * is_primaryseg_rx_inprog() - Is primary 80 report processing is in progress
  * @spectral: Pointer to Spectral
@@ -2054,6 +2067,7 @@ bool is_secondaryseg_rx_inprog(struct target_if_spectral *spectral,
 	    spectral->state_160mhz_delivery[smode] ==
 	    SPECTRAL_REPORT_RX_SECONDARY80))));
 }
+#endif
 
 /**
  * target_if_160mhz_delivery_state_change() - State transition for 160Mhz

+ 49 - 0
target_if/spectral/target_if_spectral_phyerr.c

@@ -1555,6 +1555,54 @@ target_if_dump_fft_report_gen3(struct target_if_spectral *spectral,
 }
 #endif
 
+#ifdef OPTIMIZED_SAMP_MESSAGE
+QDF_STATUS
+target_if_160mhz_delivery_state_change(struct target_if_spectral *spectral,
+				       enum spectral_scan_mode smode,
+				       uint8_t detector_id) {
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
+
+	if (smode >= SPECTRAL_SCAN_MODE_MAX) {
+		spectral_err_rl("Invalid Spectral mode %d", smode);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!is_ch_width_160_or_80p80(spectral->report_info[smode].sscan_bw)) {
+		spectral_err_rl("Scan BW %d is not 160/80p80 for mode %d",
+				spectral->report_info[smode].sscan_bw, smode);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	switch (spectral->state_160mhz_delivery[smode]) {
+	case SPECTRAL_REPORT_WAIT_PRIMARY80:
+		if (detector_id == SPECTRAL_DETECTOR_ID_0)
+			spectral->state_160mhz_delivery[smode] =
+				SPECTRAL_REPORT_WAIT_SECONDARY80;
+		else {
+			status = QDF_STATUS_E_FAILURE;
+			spectral->diag_stats.spectral_vhtseg1id_mismatch++;
+		}
+		break;
+
+	case SPECTRAL_REPORT_WAIT_SECONDARY80:
+		if (detector_id == SPECTRAL_DETECTOR_ID_1)
+			spectral->state_160mhz_delivery[smode] =
+				SPECTRAL_REPORT_WAIT_PRIMARY80;
+		else {
+			spectral->state_160mhz_delivery[smode] =
+				SPECTRAL_REPORT_WAIT_PRIMARY80;
+			status = QDF_STATUS_E_FAILURE;
+			spectral->diag_stats.spectral_vhtseg2id_mismatch++;
+		}
+		break;
+
+	default:
+		break;
+	}
+
+	return status;
+}
+#else
 QDF_STATUS
 target_if_160mhz_delivery_state_change(struct target_if_spectral *spectral,
 				       enum spectral_scan_mode smode,
@@ -1612,6 +1660,7 @@ target_if_160mhz_delivery_state_change(struct target_if_spectral *spectral,
 
 	return status;
 }
+#endif /* OPTIMIZED_SAMP_MESSAGE */
 
 #ifdef DIRECT_BUF_RX_ENABLE
 /**