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

Commit fd809fcd authored by Ahmed ElArabawy's avatar Ahmed ElArabawy
Browse files

Wifi: Add 6GHz bands to WifiBand

This commit adds 6GHz band to WifiBand and update the impacted
structures and methods in Wifi HAL.
Note that Background scar related HAL API will not be using the
new band, and will continue with the legacy set of bands.

Bug: 139354972
Test: Manual
Test: VTS test
Test: Unit test: ./hardware/interfaces/wifi/1.4/default/tests/runtests.sh
Change-Id: I54662251034806338ad64d4622ade259ca260a79
parent 8cdfeb2c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ hidl_interface {
        "IWifi.hal",
        "IWifiApIface.hal",
        "IWifiChip.hal",
        "IWifiChipEventCallback.hal",
        "IWifiRttController.hal",
        "IWifiRttControllerEventCallback.hal",
        "IWifiStaIface.hal",
+17 −0
Original line number Diff line number Diff line
@@ -19,12 +19,29 @@ package android.hardware.wifi@1.4;
import @1.0::WifiStatus;
import @1.0::IWifiIface;
import @1.3::IWifiChip;
import IWifiChipEventCallback;
import IWifiRttController;

/**
 * Interface that represents a chip that must be configured as a single unit.
 */
interface IWifiChip extends @1.3::IWifiChip {
    /**
     * Requests notifications of significant events on this chip. Multiple calls
     * to this must register multiple callbacks each of which must receive all
     * events.
     *
     * @param callback An instance of the |IWifiChipEventCallback| HIDL interface
     *        object.
     * @return status WifiStatus of the operation.
     *         Possible status codes:
     *         |WifiStatusCode.SUCCESS|,
     *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
     *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
     */
    registerEventCallback_1_4(IWifiChipEventCallback callback)
        generates (WifiStatus status);

    /**
     * Create a RTTController instance.
     *
+65 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 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.4;

import @1.2::IWifiChipEventCallback;
import WifiBand;

/**
 * Wifi chip event callbacks.
 */
interface IWifiChipEventCallback extends @1.2::IWifiChipEventCallback {
    /**
     * Struct describing the state of each hardware radio chain (hardware MAC)
     * on the device.
     */
    struct RadioModeInfo {
        /**
         * Identifier for this radio chain. This is vendor dependent & used
         * only for debugging purposes.
         */
        uint32_t radioId;
        /**
         * List of bands on which this radio chain is operating.
         * Can be one of:
         * a) WifiBand.BAND_24GHZ => 2.4Ghz.
         * b) WifiBand.BAND_5GHZ => 5Ghz.
         * c) WifiBand.BAND_24GHZ_5GHZ = 2.4Ghz + 5Ghz (Radio is time sharing
         * across the 2 bands).
         * d) WifiBand.BAND_6GHZ => 6Ghz.
         * e) WifiBand.BAND_5GHZ_6GHZ => 5Ghz + 6Ghz (Radio is time sharing
         * across the 2 bands).
         * f) WifiBand.BAND_24GHZ_5GHZ_6GHZ => 2.4Ghz + 5Ghz + 6Ghz (Radio is
         * time sharing across the 3 bands).
         */
        WifiBand bandInfo;
        /** List of interfaces on this radio chain (hardware MAC). */
        vec<IfaceInfo> ifaceInfos;
    };

    /**
     * Asynchronous callback indicating a radio mode change.
     * Radio mode change could be a result of:
     * a) Bringing up concurrent interfaces (For ex: STA + AP).
     * b) Change in operating band of one of the concurrent interfaces (For ex:
     * STA connection moved from 2.4G to 5G)
     *
     * @param radioModeInfos List of RadioModeInfo structures for each
     * radio chain (hardware MAC) on the device.
     */
    oneway onRadioModeChange_1_4(vec<RadioModeInfo> radioModeInfos);
};
+22 −14
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ legacy_hal::wifi_latency_mode convertHidlLatencyModeToLegacy(

bool convertLegacyWifiMacInfoToHidl(
    const legacy_hal::WifiMacInfo& legacy_mac_info,
    V1_2::IWifiChipEventCallback::RadioModeInfo* hidl_radio_mode_info) {
    IWifiChipEventCallback::RadioModeInfo* hidl_radio_mode_info) {
    if (!hidl_radio_mode_info) {
        return false;
    }
@@ -325,7 +325,16 @@ bool convertLegacyWifiMacInfoToHidl(
    hidl_radio_mode_info->radioId = legacy_mac_info.wlan_mac_id;
    // Convert from bitmask of bands in the legacy HAL to enum value in
    // the HIDL interface.
    if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND &&
    if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND &&
        legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND &&
        legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) {
        hidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ_6GHZ;
    } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND &&
               legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) {
        hidl_radio_mode_info->bandInfo = WifiBand::BAND_5GHZ_6GHZ;
    } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND) {
        hidl_radio_mode_info->bandInfo = WifiBand::BAND_6GHZ;
    } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND &&
               legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) {
        hidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ;
    } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) {
@@ -348,15 +357,14 @@ bool convertLegacyWifiMacInfoToHidl(

bool convertLegacyWifiMacInfosToHidl(
    const std::vector<legacy_hal::WifiMacInfo>& legacy_mac_infos,
    std::vector<V1_2::IWifiChipEventCallback::RadioModeInfo>*
        hidl_radio_mode_infos) {
    std::vector<IWifiChipEventCallback::RadioModeInfo>* hidl_radio_mode_infos) {
    if (!hidl_radio_mode_infos) {
        return false;
    }
    *hidl_radio_mode_infos = {};

    for (const auto& legacy_mac_info : legacy_mac_infos) {
        V1_2::IWifiChipEventCallback::RadioModeInfo hidl_radio_mode_info;
        IWifiChipEventCallback::RadioModeInfo hidl_radio_mode_info;
        if (!convertLegacyWifiMacInfoToHidl(legacy_mac_info,
                                            &hidl_radio_mode_info)) {
            return false;
@@ -449,21 +457,21 @@ bool convertLegacyGscanCapabilitiesToHidl(
    return true;
}

legacy_hal::wifi_band convertHidlWifiBandToLegacy(WifiBand band) {
legacy_hal::wifi_band convertHidlWifiBandToLegacy(V1_0::WifiBand band) {
    switch (band) {
        case WifiBand::BAND_UNSPECIFIED:
        case V1_0::WifiBand::BAND_UNSPECIFIED:
            return legacy_hal::WIFI_BAND_UNSPECIFIED;
        case WifiBand::BAND_24GHZ:
        case V1_0::WifiBand::BAND_24GHZ:
            return legacy_hal::WIFI_BAND_BG;
        case WifiBand::BAND_5GHZ:
        case V1_0::WifiBand::BAND_5GHZ:
            return legacy_hal::WIFI_BAND_A;
        case WifiBand::BAND_5GHZ_DFS:
        case V1_0::WifiBand::BAND_5GHZ_DFS:
            return legacy_hal::WIFI_BAND_A_DFS;
        case WifiBand::BAND_5GHZ_WITH_DFS:
        case V1_0::WifiBand::BAND_5GHZ_WITH_DFS:
            return legacy_hal::WIFI_BAND_A_WITH_DFS;
        case WifiBand::BAND_24GHZ_5GHZ:
        case V1_0::WifiBand::BAND_24GHZ_5GHZ:
            return legacy_hal::WIFI_BAND_ABG;
        case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS:
        case V1_0::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS:
            return legacy_hal::WIFI_BAND_ABG_WITH_DFS;
    };
    CHECK(false);
+3 −4
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@

#include <android/hardware/wifi/1.0/IWifiChip.h>
#include <android/hardware/wifi/1.0/types.h>
#include <android/hardware/wifi/1.2/IWifiChipEventCallback.h>
#include <android/hardware/wifi/1.2/types.h>
#include <android/hardware/wifi/1.3/IWifiChip.h>
#include <android/hardware/wifi/1.3/types.h>
#include <android/hardware/wifi/1.4/IWifiChipEventCallback.h>
#include <android/hardware/wifi/1.4/IWifiStaIface.h>
#include <android/hardware/wifi/1.4/types.h>

@@ -65,8 +65,7 @@ legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy_1_2(
    V1_2::IWifiChip::TxPowerScenario hidl_scenario);
bool convertLegacyWifiMacInfosToHidl(
    const std::vector<legacy_hal::WifiMacInfo>& legacy_mac_infos,
    std::vector<V1_2::IWifiChipEventCallback::RadioModeInfo>*
        hidl_radio_mode_infos);
    std::vector<IWifiChipEventCallback::RadioModeInfo>* hidl_radio_mode_infos);

// STA iface conversion methods.
bool convertLegacyFeaturesToHidlStaCapabilities(
@@ -78,7 +77,7 @@ bool convertLegacyApfCapabilitiesToHidl(
bool convertLegacyGscanCapabilitiesToHidl(
    const legacy_hal::wifi_gscan_capabilities& legacy_caps,
    StaBackgroundScanCapabilities* hidl_caps);
legacy_hal::wifi_band convertHidlWifiBandToLegacy(WifiBand band);
legacy_hal::wifi_band convertHidlWifiBandToLegacy(V1_0::WifiBand band);
bool convertHidlGscanParamsToLegacy(
    const StaBackgroundScanParameters& hidl_scan_params,
    legacy_hal::wifi_scan_cmd_params* legacy_scan_params);
Loading