STA: Configure MSCS and SCS enable/disable only when needed

STAUT can receive the CAPI command to enable SCS and MSCS though the
expectation is to enable those features OOB. But SCSSupport and
MSCSSupport CAPI arguments fail if wpa_supplicant is compiled without
CONFIG_TESTING_OPTIONS=y.

To avoid the test case failures in DUT mode, set SCSSupport and
MSCSSupport options only if needed. Both of these features are enabled
at the beginning of every testcase in sta_reset_default and hence there
is no need of explicitly enabling them if they were not disabled earlier
in the testcase.

Also remove the unnecessary SET commands in sta_reset_default since
wpa_supplicant is clearing disable_scs_support and disable_mscs_support
on receiving the FLUSH command.

Signed-off-by: Shivani Baranwal <shivbara@codeaurora.org>
diff --git a/sta.c b/sta.c
index 2ae3310..121679a 100644
--- a/sta.c
+++ b/sta.c
@@ -5979,13 +5979,17 @@
 			return INVALID_SEND_STATUS;
 		}
 
-		len = snprintf(buf, sizeof(buf), "SET disable_scs_support %d",
-			       disable_scs);
-		if (len < 0 || len >= sizeof(buf) ||
-		    wpa_command(intf, buf) != 0) {
-			send_resp(dut, conn, SIGMA_ERROR,
-				  "ErrorCode,Failed to update SCS support");
-			return STATUS_SENT_ERROR;
+		if (disable_scs || dut->prev_disable_scs_support) {
+			len = snprintf(buf, sizeof(buf),
+				       "SET disable_scs_support %d",
+				       disable_scs);
+			if (len < 0 || len >= sizeof(buf) ||
+			    wpa_command(intf, buf) != 0) {
+				send_resp(dut, conn, SIGMA_ERROR,
+					  "ErrorCode,Failed to update SCS support");
+				return STATUS_SENT_ERROR;
+			}
+			dut->prev_disable_scs_support = disable_scs;
 		}
 	}
 
@@ -6004,13 +6008,17 @@
 			return INVALID_SEND_STATUS;
 		}
 
-		len = snprintf(buf, sizeof(buf), "SET disable_mscs_support %d",
-			       disable_mscs);
-		if (len < 0 || len >= sizeof(buf) ||
-		    wpa_command(intf, buf) != 0) {
-			send_resp(dut, conn, SIGMA_ERROR,
-				  "ErrorCode,Failed to update MSCS support");
-			return STATUS_SENT_ERROR;
+		if (disable_mscs || dut->prev_disable_mscs_support) {
+			len = snprintf(buf, sizeof(buf),
+				       "SET disable_mscs_support %d",
+				       disable_mscs);
+			if (len < 0 || len >= sizeof(buf) ||
+			    wpa_command(intf, buf) != 0) {
+				send_resp(dut, conn, SIGMA_ERROR,
+					  "ErrorCode,Failed to update MSCS support");
+				return STATUS_SENT_ERROR;
+			}
+			dut->prev_disable_mscs_support = disable_mscs;
 		}
 	}
 
@@ -8908,8 +8916,6 @@
 
 	if (dut->program == PROGRAM_QM) {
 		wpa_command(intf, "SET interworking 1");
-		wpa_command(intf, "SET disable_scs_support 0");
-		wpa_command(intf, "SET disable_mscs_support 0");
 		wpa_command(intf, "SET enable_dscp_policy_capa 1");
 		dut->qm_domain_name[0] = '\0';
 		dut->reject_dscp_policies = 0;
@@ -8967,6 +8973,8 @@
 	}
 
 	dut->saquery_oci_freq = 0;
+	dut->prev_disable_scs_support = 0;
+	dut->prev_disable_mscs_support = 0;
 
 	if (dut->program != PROGRAM_VHT)
 		return cmd_sta_p2p_reset(dut, conn, cmd);