summaryrefslogtreecommitdiff
path: root/wifi/1.6/default/wifi_chip.cpp
diff options
context:
space:
mode:
authorDeyao Ren <deyaoren@google.com>2022-05-03 23:29:35 +0000
committerDeyao Ren <deyaoren@google.com>2022-05-03 23:36:10 +0000
commita16302f8f397ec554555d2a73f586b642deeebae (patch)
treee137c79cf16aa9ed02fc111640804fd5eb82d6fb /wifi/1.6/default/wifi_chip.cpp
parentd395ddb7dc29657cdc059077081a9b9c120948ee (diff)
parent3315af9de816caaf85e983d51c56fb5b5c22ee06 (diff)
Merge TP1A.220422.001
Change-Id: Ic995758f9abfaf9d0ac14cfe1d182387f988e42c
Diffstat (limited to 'wifi/1.6/default/wifi_chip.cpp')
-rw-r--r--wifi/1.6/default/wifi_chip.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp
index 7f0e97df7f..f062409d4e 100644
--- a/wifi/1.6/default/wifi_chip.cpp
+++ b/wifi/1.6/default/wifi_chip.cpp
@@ -1003,14 +1003,14 @@ std::pair<WifiStatus, sp<V1_5::IWifiApIface>> WifiChip::createBridgedApIfaceInte
br_ifaces_ap_instances_[br_ifname] = ap_instances;
if (!iface_util_->createBridge(br_ifname)) {
LOG(ERROR) << "Failed createBridge - br_name=" << br_ifname.c_str();
- invalidateAndClearBridgedAp(br_ifname);
+ deleteApIface(br_ifname);
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
}
for (auto const& instance : ap_instances) {
// Bind ap instance interface to AP bridge
if (!iface_util_->addIfaceToBridge(br_ifname, instance)) {
LOG(ERROR) << "Failed add if to Bridge - if_name=" << instance.c_str();
- invalidateAndClearBridgedAp(br_ifname);
+ deleteApIface(br_ifname);
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
}
}
@@ -1044,8 +1044,7 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) {
// nan/rtt objects over AP iface. But, there is no harm to do it
// here and not make that assumption all over the place.
invalidateAndRemoveDependencies(ifname);
- // Clear the bridge interface and the iface instance.
- invalidateAndClearBridgedAp(ifname);
+ deleteApIface(ifname);
invalidateAndClear(ap_ifaces_, iface);
for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onIfaceRemoved(IfaceType::AP, ifname).isOk()) {
@@ -2005,21 +2004,28 @@ void WifiChip::invalidateAndClearBridgedApAll() {
br_ifaces_ap_instances_.clear();
}
-void WifiChip::invalidateAndClearBridgedAp(const std::string& br_name) {
- if (br_name.empty()) return;
- // delete managed interfaces
+void WifiChip::deleteApIface(const std::string& if_name) {
+ if (if_name.empty()) return;
+ // delete bridged interfaces if have
for (auto const& it : br_ifaces_ap_instances_) {
- if (it.first == br_name) {
+ if (it.first == if_name) {
for (auto const& iface : it.second) {
- iface_util_->removeIfaceFromBridge(br_name, iface);
+ iface_util_->removeIfaceFromBridge(if_name, iface);
legacy_hal_.lock()->deleteVirtualInterface(iface);
}
- iface_util_->deleteBridge(br_name);
- br_ifaces_ap_instances_.erase(br_name);
- break;
+ iface_util_->deleteBridge(if_name);
+ br_ifaces_ap_instances_.erase(if_name);
+ // ifname is bridged AP, return here.
+ return;
}
}
- return;
+
+ // No bridged AP case, delete AP iface
+ legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deleteVirtualInterface(if_name);
+ if (legacy_status != legacy_hal::WIFI_SUCCESS) {
+ LOG(ERROR) << "Failed to remove interface: " << if_name << " "
+ << legacyErrorToString(legacy_status);
+ }
}
bool WifiChip::findUsingNameFromBridgedApInstances(const std::string& name) {