summaryrefslogtreecommitdiff
path: root/wifi/1.5/default/wifi_iface_util.cpp
diff options
context:
space:
mode:
authorVeerendranath Jakkam <quic_vjakkam@quicinc.com>2021-10-08 03:05:31 +0530
committerSunil Ravi <sunilravi@google.com>2021-10-14 12:59:29 -0700
commitfce46f4642fda2d17d196f409dfa540690b17e34 (patch)
tree1f1a96deec33a621725244d6ad4ea21686ff72f8 /wifi/1.5/default/wifi_iface_util.cpp
parentf763d677c4658b2ba3993c7ab630ff99a7e32991 (diff)
wifi: Avoid doing iface reset when dynamic MAC update supported
Skip doing iface reset(down and up) to change MAC address if driver indicates support for WIFI_FEATURE_DYNAMIC_SET_MAC. Bug: 202424223 Test: atest VtsHalWifiV1_5TargetTest Test: Manual - Connect STA to AP and check random mac is set Change-Id: I86cf86e20893759a4e926571727943e4ee51d093
Diffstat (limited to 'wifi/1.5/default/wifi_iface_util.cpp')
-rw-r--r--wifi/1.5/default/wifi_iface_util.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/wifi/1.5/default/wifi_iface_util.cpp b/wifi/1.5/default/wifi_iface_util.cpp
index 7bf830b875..0977026698 100644
--- a/wifi/1.5/default/wifi_iface_util.cpp
+++ b/wifi/1.5/default/wifi_iface_util.cpp
@@ -56,14 +56,21 @@ std::array<uint8_t, 6> WifiIfaceUtil::getFactoryMacAddress(
bool WifiIfaceUtil::setMacAddress(const std::string& iface_name,
const std::array<uint8_t, 6>& mac) {
#ifndef WIFI_AVOID_IFACE_RESET_MAC_CHANGE
- if (!iface_tool_.lock()->SetUpState(iface_name.c_str(), false)) {
+ legacy_hal::wifi_error legacy_status;
+ uint64_t legacy_feature_set;
+ std::tie(legacy_status, legacy_feature_set) =
+ legacy_hal_.lock()->getSupportedFeatureSet(iface_name);
+
+ if (!(legacy_feature_set & WIFI_FEATURE_DYNAMIC_SET_MAC) &&
+ !iface_tool_.lock()->SetUpState(iface_name.c_str(), false)) {
LOG(ERROR) << "SetUpState(false) failed.";
return false;
}
#endif
bool success = iface_tool_.lock()->SetMacAddress(iface_name.c_str(), mac);
#ifndef WIFI_AVOID_IFACE_RESET_MAC_CHANGE
- if (!iface_tool_.lock()->SetUpState(iface_name.c_str(), true)) {
+ if (!(legacy_feature_set & WIFI_FEATURE_DYNAMIC_SET_MAC) &&
+ !iface_tool_.lock()->SetUpState(iface_name.c_str(), true)) {
LOG(ERROR) << "SetUpState(true) failed. Wait for driver ready.";
// Wait for driver ready and try to set iface UP again
if (legacy_hal_.lock()->waitForDriverReady() !=