diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index e8c3c13ca2..b27b06ff52 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -82,6 +82,7 @@ interface IWifiChip { void stopLoggingToDebugRingBuffer(); void triggerSubsystemRestart(); void enableStaChannelForPeerNetwork(in android.hardware.wifi.IWifiChip.ChannelCategoryMask channelCategoryEnableFlag); + void setMloMode(in android.hardware.wifi.IWifiChip.ChipMloMode mode); const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF; @Backing(type="int") @VintfStability enum ChipCapabilityMask { @@ -164,4 +165,11 @@ interface IWifiChip { INDOOR_CHANNEL = (1 << 0) /* 1 */, DFS_CHANNEL = (1 << 1) /* 2 */, } + @Backing(type="int") @VintfStability + enum ChipMloMode { + DEFAULT = 0, + LOW_LATENCY = 1, + HIGH_THROUGHPUT = 2, + LOW_POWER = 3, + } } diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index a297994a71..de2449e8e2 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -1119,4 +1119,40 @@ interface IWifiChip { * |WifiStatusCode.FAILURE_UNKNOWN| */ void enableStaChannelForPeerNetwork(in ChannelCategoryMask channelCategoryEnableFlag); + + /** + * Multi-Link Operation modes. + */ + @VintfStability + @Backing(type="int") + enum ChipMloMode { + /** + * Default mode for Multi-Link Operation. + */ + DEFAULT = 0, + /** + * Low latency mode for Multi-link operation. + */ + LOW_LATENCY = 1, + /** + * High throughput mode for Multi-link operation. + */ + HIGH_THROUGHPUT = 2, + /** + * Low power mode for Multi-link operation. + */ + LOW_POWER = 3, + } + + /** + * Set mode for Multi-Link Operation. Various modes are defined by the enum |ChipMloMode|. + * + * @param mode MLO mode as defined by the enum |ChipMloMode| + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_UNKNOWN| + * + */ + void setMloMode(in ChipMloMode mode); } diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 41912b5d66..b4c2ccdbb9 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -26,6 +26,7 @@ #include "aidl_return_util.h" #include "aidl_struct_util.h" +#include "wifi_legacy_hal.h" #include "wifi_status_util.h" #define P2P_MGMT_DEVICE_PREFIX "p2p-dev-" @@ -699,6 +700,11 @@ ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetwork( in_channelCategoryEnableFlag); } +ndk::ScopedAStatus WifiChip::setMloMode(const ChipMloMode in_mode) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setMloModeInternal, in_mode); +} + void WifiChip::invalidateAndRemoveAllIfaces() { invalidateAndClearBridgedApAll(); invalidateAndClearAll(ap_ifaces_); @@ -1956,6 +1962,28 @@ bool WifiChip::findUsingNameFromBridgedApInstances(const std::string& name) { return false; } +ndk::ScopedAStatus WifiChip::setMloModeInternal(const WifiChip::ChipMloMode in_mode) { + legacy_hal::wifi_mlo_mode mode; + switch (in_mode) { + case WifiChip::ChipMloMode::DEFAULT: + mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_DEFAULT; + break; + case WifiChip::ChipMloMode::LOW_LATENCY: + mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_LOW_LATENCY; + break; + case WifiChip::ChipMloMode::HIGH_THROUGHPUT: + mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_HIGH_THROUGHPUT; + break; + case WifiChip::ChipMloMode::LOW_POWER: + mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_LOW_POWER; + break; + default: + PLOG(ERROR) << "Error: invalid mode: " << toString(in_mode); + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + return createWifiStatusFromLegacyError(legacy_hal_.lock()->setMloMode(mode)); +} + } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index b552c3324e..ff4ee9ce90 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -150,6 +150,7 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus enableStaChannelForPeerNetwork( ChannelCategoryMask in_channelCategoryEnableFlag) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + ndk::ScopedAStatus setMloMode(const ChipMloMode in_mode) override; private: void invalidateAndRemoveAllIfaces(); @@ -260,6 +261,7 @@ class WifiChip : public BnWifiChip { std::pair getSupportedRadioCombinationsMatrixInternal(); std::pair getWifiChipCapabilitiesInternal(); + ndk::ScopedAStatus setMloModeInternal(const ChipMloMode in_mode); void setWeakPtr(std::weak_ptr ptr); int32_t chip_id_; diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index e3a34a93da..dbf5a68967 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1881,6 +1881,10 @@ wifi_error WifiLegacyHal::enableStaChannelForPeerNetwork(uint32_t channelCategor channelCategoryEnableFlag); } +wifi_error WifiLegacyHal::setMloMode(wifi_mlo_mode mode) { + return global_func_table_.wifi_set_mlo_mode(global_handle_, mode); +} + void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index f076ce6b6a..1d59b17b8a 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -318,6 +318,7 @@ using ::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED; using ::WIFI_LOGGER_PACKET_FATE_SUPPORTED; using ::WIFI_LOGGER_POWER_EVENT_SUPPORTED; using ::WIFI_LOGGER_WAKE_LOCK_SUPPORTED; +using ::wifi_mlo_mode; using ::WIFI_MOTION_EXPECTED; using ::WIFI_MOTION_NOT_EXPECTED; using ::wifi_motion_pattern; @@ -777,6 +778,7 @@ class WifiLegacyHal { const CachedScanResultsCallbackHandlers& handler); std::pair getWifiChipCapabilities(); wifi_error enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag); + wifi_error setMloMode(wifi_mlo_mode mode); private: // Retrieve interface handles for all the available interfaces. diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 42743dffbb..77d1cb5edc 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -177,6 +177,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_nan_suspend_request); populateStubFor(&hal_fn->wifi_nan_resume_request); populateStubFor(&hal_fn->wifi_set_scan_mode); + populateStubFor(&hal_fn->wifi_set_mlo_mode); return true; }