Add a new AIDL API to set Multi-Link Operation mode

Bug: 268235139
Test: m android.hardware.wifi-update-api
Change-Id: Iff3baf64cb6c999eca4e1bfa4af5a41cfb5e4876
This commit is contained in:
maheshkkv
2023-02-13 12:33:26 -08:00
parent 7c27e36771
commit a8aba17891
7 changed files with 81 additions and 0 deletions

View File

@@ -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 {
@@ -163,4 +164,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,
}
}

View File

@@ -1115,4 +1115,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);
}

View File

@@ -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

View File

@@ -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<WifiRadioCombinationMatrix, ndk::ScopedAStatus>
getSupportedRadioCombinationsMatrixInternal();
std::pair<WifiChipCapabilities, ndk::ScopedAStatus> getWifiChipCapabilitiesInternal();
ndk::ScopedAStatus setMloModeInternal(const ChipMloMode in_mode);
void setWeakPtr(std::weak_ptr<WifiChip> ptr);
int32_t chip_id_;

View File

@@ -1869,6 +1869,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();

View File

@@ -312,6 +312,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;
@@ -770,6 +771,7 @@ class WifiLegacyHal {
const CachedScanResultsCallbackHandlers& handler);
std::pair<wifi_error, wifi_chip_capabilities> getWifiChipCapabilities();
wifi_error enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag);
wifi_error setMloMode(wifi_mlo_mode mode);
private:
// Retrieve interface handles for all the available interfaces.

View File

@@ -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;
}