Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9d1e7d3 authored by Roshan Pius's avatar Roshan Pius
Browse files

wifi: Add STA + STA HIDL API's

Add the HIDL API's + shim + VTS tests.

Bug: 170305665
Test: atest VtsHalWifiV1_3TargetTest VtsHalWifiV1_5TargetTest
Change-Id: I26ada11aebfe8082bfda251cf7e6990e0aa08a06
parent 1bb5ef0b
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include <android/hardware/wifi/1.3/IWifi.h>
#include <android/hardware/wifi/1.3/IWifiStaIface.h>
#include <android/hardware/wifi/1.5/IWifiStaIface.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
@@ -88,7 +89,6 @@ TEST_P(WifiStaIfaceHidlTest, GetLinkLayerStats_1_3) {
        // No-op if link layer stats is not supported.
        return;
    }

    // Enable link layer stats collection.
    EXPECT_EQ(WifiStatusCode::SUCCESS,
              HIDL_INVOKE(wifi_sta_iface_, enableLinkLayerStatsCollection, true)
@@ -96,8 +96,17 @@ TEST_P(WifiStaIfaceHidlTest, GetLinkLayerStats_1_3) {
    // Retrieve link layer stats.
    const auto& status_and_stats =
        HIDL_INVOKE(wifi_sta_iface_, getLinkLayerStats_1_3);
    sp<android::hardware::wifi::V1_5::IWifiStaIface> staIface1_5 =
        android::hardware::wifi::V1_5::IWifiStaIface::castFrom(wifi_sta_iface_);
    if (staIface1_5.get() == nullptr) {
        EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_stats.first.code);
        EXPECT_GT(status_and_stats.second.timeStampInMs, 0u);
    } else {
        // not supported on 1.5 HAL.
        EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED,
                  status_and_stats.first.code);
    }

    // Disable link layer stats collection.
    EXPECT_EQ(
        WifiStatusCode::SUCCESS,
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ hidl_interface {
        "IWifiChip.hal",
        "IWifiNanIface.hal",
        "IWifiNanIfaceEventCallback.hal",
        "IWifiStaIface.hal",
    ],
    interfaces: [
        "android.hardware.wifi@1.0",
+79 −0
Original line number Diff line number Diff line
@@ -35,6 +35,53 @@ interface IWifiChip extends @1.4::IWifiChip {
        WIGIG = 1 << 14,
    };

    /**
     * When there are 2 or more simultaneous STA connections, this use case hint indicates what
     * use-case is being enabled by the framework. This use case hint can be used by the firmware
     * to modify various firmware configurations like:
     *   - Allowed BSSIDs the firmware can choose for the initial connection/roaming attempts.
     *   - Duty cycle to choose for the 2 STA connections if the radio is in MCC mode.
     *   - Whether roaming, APF and other offloads needs to be enabled or not.
     * Note:
     *   - This will be invoked before an active wifi connection is established on the second
     *     interface.
     *   - This use-case hint is implicitly void when the second STA interface is brought down.
     */
    enum MultiStaUseCase : uint8_t {
        /**
         * Usage:
         * - This will be sent down for make before break use-case.
         * - Platform is trying to speculatively connect to a second network and evaluate it without
         *  disrupting the primary connection.
         * Requirements for Firmware:
         * - Do not reduce the number of tx/rx chains of primary connection.
         * - If using MCC, should set the MCC duty cycle of the primary connection to be higher than
         *  the secondary connection (maybe 70/30 split).
         * - Should pick the best BSSID for the secondary STA (disregard the chip mode) independent
         *   of the primary STA:
         *    - Don’t optimize for DBS vs MCC/SCC
         * - Should not impact the primary connection’s bssid selection:
         *    - Don’t downgrade chains of the existing primary connection.
         *    - Don’t optimize for DBS vs MCC/SCC.
         */
        DUAL_STA_TRANSIENT_PREFER_PRIMARY = 0,
        /**
         * Usage:
         * - This will be sent down for any app requested peer to peer connections.
         * - In this case, both the connections needs to be allocated equal resources.
         * - For the peer to peer use case, BSSID for the secondary connection will be chosen by the
         *   framework.
         *
         * Requirements for Firmware:
         * - Can choose MCC or DBS mode depending on the MCC efficiency and HW capability.
         * - If using MCC, set the MCC duty cycle of the primary connection to be equal to the
         *   secondary connection.
         * - Prefer BSSID candidates which will help provide the best "overall" performance for both
         *   the connections.
         */
        DUAL_STA_NON_TRANSIENT_UNBIASED = 1,
    };

    /**
     * Get the capabilities supported by this chip.
     *
@@ -48,4 +95,36 @@ interface IWifiChip extends @1.4::IWifiChip {
     */
    getCapabilities_1_5()
        generates (WifiStatus status, bitfield<ChipCapabilityMask> capabilities);

    /**
     * Invoked to indicate that the provided iface is the primary STA iface when there are more
     * than 1 STA iface concurrently active.
     * Note: If the wifi firmware/chip cannot support multiple instances of any offload
     * (like roaming, APF, rssi threshold, etc), the firmware should ensure that these
     * offloads are at least enabled for the primary interface. If the new primary interface is
     * already connected to a network, the firmware must switch all the offloads on
     * this new interface without disconnecting.
     *
     * @param ifname Name of the STA iface.
     * @return status WifiStatus of the operation.
     *         Possible status codes:
     *         |WifiStatusCode.SUCCESS|,
     *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
     *         |WifiStatusCode.ERROR_INVALID_ARGS|
     */
    setMultiStaPrimaryConnection(string ifName) generates (WifiStatus status);

    /**
     * Invoked to indicate the STA + STA use-case that is active.
     *
     * Refer to documentation of |MultiStaUseCase| for details.
     *
     * @param useCase Use case that is active.
     * @return status WifiStatus of the operation.
     *         Possible status codes:
     *         |WifiStatusCode.SUCCESS|,
     *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
     *         |WifiStatusCode.ERROR_INVALID_ARGS|
     */
    setMultiStaUseCase(MultiStaUseCase useCase) generates (WifiStatus status);
};
+4 −5
Original line number Diff line number Diff line
@@ -92,13 +92,12 @@ interface IWifiNanIface extends @1.4::IWifiNanIface {
     *         |WifiStatusCode.SUCCESS|,
     *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
     */
    registerEventCallback_1_5(IWifiNanIfaceEventCallback callback)
        generates (WifiStatus status);
    registerEventCallback_1_5(IWifiNanIfaceEventCallback callback) generates (WifiStatus status);

    /**
     * Get NAN capabilities. Asynchronous response is with
     * |IWifiNanIfaceEventCallback.notifyCapabilitiesResponse|.

     *
     * Note: supersedes the @1.0::IWifiNanIface.getCapabilitiesRequest() method which is deprecated
     * as of HAL version 1.5.
     *
+44 −0
Original line number Diff line number Diff line
/*
 * Copyright 2020 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@1.5;

import @1.0::WifiStatus;
import @1.3::IWifiStaIface;

/**
 * Interface used to represent a single STA iface.
 *
 * IWifiChip.createStaIface() must return a @1.5::IWifiStaIface when supported.
 */
interface IWifiStaIface extends @1.3::IWifiStaIface {
    /**
     * Retrieve the latest link layer stats.
     * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set or if
     * link layer stats collection hasn't been explicitly enabled.
     *
     * @return status WifiStatus of the operation.
     *     Possible status codes:
     *     |WifiStatusCode.SUCCESS|,
     *     |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
     *     |WifiStatusCode.ERROR_NOT_SUPPORTED|,
     *     |WifiStatusCode.ERROR_NOT_STARTED|,
     *     |WifiStatusCode.ERROR_NOT_AVAILABLE|,
     *     |WifiStatusCode.ERROR_UNKNOWN|
     * @return stats Instance of |LinkLayerStats|.
     */
    getLinkLayerStats_1_5() generates (WifiStatus status, StaLinkLayerStats stats);
};
Loading