Merge "Add HAL API for configuring MSCS in supplicant." into main
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
index 1f3aa48..917668e 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
@@ -101,5 +101,7 @@
   android.hardware.wifi.supplicant.SignalPollResult[] getSignalPollResults();
   android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] addQosPolicyRequestForScs(in android.hardware.wifi.supplicant.QosPolicyScsData[] qosPolicyData);
   android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds);
+  void configureMscs(in android.hardware.wifi.supplicant.MscsParams params);
+  void disableMscs();
   const int MAX_POLICIES_PER_QOS_SCS_REQUEST = 16;
 }
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MscsParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MscsParams.aidl
new file mode 100644
index 0000000..aeed408
--- /dev/null
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MscsParams.aidl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.wifi.supplicant;
+@VintfStability
+parcelable MscsParams {
+  byte upBitmap;
+  byte upLimit;
+  int streamTimeoutUs;
+  byte frameClassifierMask;
+  @Backing(type="int") @VintfStability
+  enum FrameClassifierFields {
+    IP_VERSION = (1 << 0) /* 1 */,
+    SRC_IP_ADDR = (1 << 1) /* 2 */,
+    DST_IP_ADDR = (1 << 2) /* 4 */,
+    SRC_PORT = (1 << 3) /* 8 */,
+    DST_PORT = (1 << 4) /* 16 */,
+    DSCP = (1 << 5) /* 32 */,
+    PROTOCOL_NEXT_HDR = (1 << 6) /* 64 */,
+    FLOW_LABEL = (1 << 7) /* 128 */,
+  }
+}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
index d7b4e62..fb1673e 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl
@@ -29,6 +29,7 @@
 import android.hardware.wifi.supplicant.IfaceType;
 import android.hardware.wifi.supplicant.KeyMgmtMask;
 import android.hardware.wifi.supplicant.MloLinksInfo;
+import android.hardware.wifi.supplicant.MscsParams;
 import android.hardware.wifi.supplicant.QosPolicyScsData;
 import android.hardware.wifi.supplicant.QosPolicyScsRequestStatus;
 import android.hardware.wifi.supplicant.QosPolicyStatus;
@@ -852,4 +853,28 @@
      *          being processed. Supplicant will only handle one request at a time.
      */
     QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds);
+
+    /**
+     * Enable Mirrored Stream Classification Service (MSCS) and configure using
+     * the provided configuration values.
+     *
+     * If MSCS has already been enabled/configured, this will overwrite the
+     * existing configuration.
+     *
+     * @param params |MscsParams| object containing the configuration.
+     * @throws ServiceSpecificException with one of the following values:
+     *         |SupplicantStatusCode.FAILURE_ARGS_INVALID| if the configuration is invalid.
+     *         |SupplicantStatusCode.FAILURE_UNKNOWN| if the configuration could not be set.
+     */
+    void configureMscs(in MscsParams params);
+
+    /**
+     * Disable Mirrored Stream Classification Service (MSCS).
+     *
+     * If MSCS is enabled/configured, this will send a remove request to the AP.
+     *
+     * @throws ServiceSpecificException with one of the following values:
+     *         |SupplicantStatusCode.FAILURE_UNKNOWN|
+     */
+    void disableMscs();
 }
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MscsParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MscsParams.aidl
new file mode 100644
index 0000000..b1731ac
--- /dev/null
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MscsParams.aidl
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.supplicant;
+
+/**
+ * Mirrored Stream Classification Service (MSCS) parameters.
+ * Refer to section 3.1 of the Wi-Fi QoS Management Specification v3.0.
+ */
+@VintfStability
+parcelable MscsParams {
+    /**
+     * Bitmap indicating which User Priorities should be classified using MSCS.
+     * The least significant bit corresponds to UP 0, and the most significant
+     * bit to UP 7. Setting a bit to 1 indicates that UP should be used.
+     */
+    byte upBitmap;
+
+    /**
+     * Maximum user priority that can be assigned using the MSCS service.
+     * Value must be between 0 and 7 (inclusive).
+     */
+    byte upLimit;
+
+    /**
+     * Stream timeout in μs. Must be equivalent to 60 sec or less.
+     */
+    int streamTimeoutUs;
+
+    /**
+     * Bitmask of available fields for a Type 4 TCLAS frame classifier.
+     * See Figures 9-309 and 9-310 in the IEEE Std 802.11-2020 Standard.
+     */
+    @VintfStability
+    @Backing(type="int")
+    enum FrameClassifierFields {
+        IP_VERSION = 1 << 0,
+        SRC_IP_ADDR = 1 << 1,
+        DST_IP_ADDR = 1 << 2,
+        SRC_PORT = 1 << 3,
+        DST_PORT = 1 << 4,
+        DSCP = 1 << 5,
+        /** Indicates Protocol if using IPv4, or Next Header if using IPv6. */
+        PROTOCOL_NEXT_HDR = 1 << 6,
+        /** Only applicable if using IPv6. */
+        FLOW_LABEL = 1 << 7,
+    }
+
+    /**
+     * Bitmask of |FrameClassifierFields| for a Type 4 TCLAS frame classifier.
+     */
+    byte frameClassifierMask;
+}