From 6e13599d959ceb54be47b6da8e2da03de7592222 Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Mon, 24 Jan 2022 12:14:23 -0800 Subject: [PATCH] Wifi: Add HAL API and implementation for instant mode filter Bug: 203220137 Test: pass vts test Change-Id: I7f4d9d4390ad69bcfdb2419c2e172c4df2d6863b --- wifi/1.6/IWifiChip.hal | 13 +++++++++++++ wifi/1.6/default/hidl_struct_util.cpp | 3 +++ wifi/1.6/default/wifi_chip.cpp | 2 +- wifi/1.6/default/wifi_chip.h | 2 +- wifi/1.6/types.hal | 2 +- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/wifi/1.6/IWifiChip.hal b/wifi/1.6/IWifiChip.hal index b252a053e8..eaa2400466 100644 --- a/wifi/1.6/IWifiChip.hal +++ b/wifi/1.6/IWifiChip.hal @@ -27,6 +27,19 @@ import IWifiRttController; * Interface that represents a chip that must be configured as a single unit. */ interface IWifiChip extends @1.5::IWifiChip { + /** + * Usable Wifi channels filter masks. + */ + enum UsableChannelFilter : @1.5::IWifiChip.UsableChannelFilter { + /** + * Filter Wifi channels that are supported for NAN3.1 Instant communication mode. This + * filter should only be applied to NAN interface. + * - If 5G is supported default discovery channel 149/44 is considered, + * - If 5G is not supported then channel 6 has to be considered. + */ + NAN_INSTANT_MODE = 1 << 2, + }; + /** * Create a RTTController instance. * diff --git a/wifi/1.6/default/hidl_struct_util.cpp b/wifi/1.6/default/hidl_struct_util.cpp index eeea6ef3fb..76341ffd7e 100644 --- a/wifi/1.6/default/hidl_struct_util.cpp +++ b/wifi/1.6/default/hidl_struct_util.cpp @@ -433,6 +433,9 @@ uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask) { if (hidl_filter_mask & V1_5::IWifiChip::UsableChannelFilter::CONCURRENCY) { legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; } + if (hidl_filter_mask & V1_6::IWifiChip::UsableChannelFilter::NAN_INSTANT_MODE) { + legacy_filter_mask |= WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE; + } return legacy_filter_mask; } diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp index 11512f46e0..a1857246a7 100644 --- a/wifi/1.6/default/wifi_chip.cpp +++ b/wifi/1.6/default/wifi_chip.cpp @@ -715,7 +715,7 @@ Return WifiChip::createRttController_1_6(const sp& bound_iface Return WifiChip::getUsableChannels_1_6( WifiBand band, hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, + hidl_bitfield filterMask, getUsableChannels_1_6_cb _hidl_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::getUsableChannelsInternal_1_6, _hidl_cb, band, ifaceModeMask, diff --git a/wifi/1.6/default/wifi_chip.h b/wifi/1.6/default/wifi_chip.h index 73bdf3ada1..61ac03da83 100644 --- a/wifi/1.6/default/wifi_chip.h +++ b/wifi/1.6/default/wifi_chip.h @@ -151,7 +151,7 @@ class WifiChip : public V1_6::IWifiChip { Return setCountryCode(const hidl_array& code, setCountryCode_cb _hidl_cb) override; Return getUsableChannels(WifiBand band, hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, + hidl_bitfield filterMask, getUsableChannels_cb _hidl_cb) override; Return triggerSubsystemRestart(triggerSubsystemRestart_cb hidl_status_cb) override; Return createRttController_1_6(const sp& bound_iface, diff --git a/wifi/1.6/types.hal b/wifi/1.6/types.hal index 2a49d0888b..ef6965d4cf 100644 --- a/wifi/1.6/types.hal +++ b/wifi/1.6/types.hal @@ -764,7 +764,7 @@ struct NanDataPathSecurityConfig { /** * Security Context Identifier attribute contains PMKID shall be included in NDP setup and * response messages. Security Context Identifier, Identifies the Security Context. When - * security is enabled This field contains the 16 octet PMKID identifying the PMK used for + * security is enabled this field contains the 16 octet PMKID identifying the PMK used for * setting up the Secure Data Path. */ uint8_t[16] scid;