Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51a14848 authored by Purushottam Kushwaha's avatar Purushottam Kushwaha Committed by LuK1337
Browse files

wifi: Allow STA + SAP Concurrency from wifi vendor hal service.

This commit adds a new feature flag wifiStaSapConcurrency, to enable
support of STA + SAP concurrency via wifi vendor hal. This also
enhances AP combination to include STA in list of allowed combination.

CRs-Fixed: 2075317
Change-Id: I8bcef59116fbe474e787a17f979f1d69d687669b
parent 64ff49b8
Loading
Loading
Loading
Loading
+18 −4
Original line number Original line Diff line number Diff line
@@ -411,8 +411,14 @@ WifiChip::getAvailableModesInternal() {
  // AP mode iface combinations.
  // AP mode iface combinations.
  const IWifiChip::ChipIfaceCombinationLimit ap_chip_iface_combination_limit = {
  const IWifiChip::ChipIfaceCombinationLimit ap_chip_iface_combination_limit = {
      {IfaceType::AP}, 1};
      {IfaceType::AP}, 1};
  const IWifiChip::ChipIfaceCombination ap_chip_iface_combination = {
  IWifiChip::ChipIfaceCombination ap_chip_iface_combination;
  if (WifiFeatureFlags::wifiStaSapConcurrency) {
    ap_chip_iface_combination = {
        {ap_chip_iface_combination_limit, sta_chip_iface_combination_limit_1}};
  } else {
    ap_chip_iface_combination = {
        {ap_chip_iface_combination_limit}};
        {ap_chip_iface_combination_limit}};
  }
  const IWifiChip::ChipMode ap_chip_mode = {kApChipModeId,
  const IWifiChip::ChipMode ap_chip_mode = {kApChipModeId,
                                            {ap_chip_iface_combination}};
                                            {ap_chip_iface_combination}};
  return {createWifiStatus(WifiStatusCode::SUCCESS),
  return {createWifiStatus(WifiStatusCode::SUCCESS),
@@ -653,7 +659,11 @@ WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) {
}
}


std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::createStaIfaceInternal() {
std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::createStaIfaceInternal() {
  if (current_mode_id_ != kStaChipModeId || sta_iface_.get()) {
  // Do no restrict with kStaChipModeId in case of wifiStaSapConcurrency feature.
  // In case of wifiStaSapConcurrency, both kStaChipModeId and kApChipModeId are
  // valid combinations to create STA interface.
  if ((!(WifiFeatureFlags::wifiStaSapConcurrency) &&
       current_mode_id_ != kStaChipModeId) || sta_iface_.get()) {
    return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
    return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
  }
  }
  std::string ifname = legacy_hal_.lock()->getStaIfaceName();
  std::string ifname = legacy_hal_.lock()->getStaIfaceName();
@@ -807,7 +817,11 @@ WifiStatus WifiChip::handleChipConfiguration(ChipModeId mode_id) {
  // Currently the underlying implementation has a deadlock issue.
  // Currently the underlying implementation has a deadlock issue.
  // We should return ERROR_NOT_SUPPORTED if chip is already configured in
  // We should return ERROR_NOT_SUPPORTED if chip is already configured in
  // a different mode.
  // a different mode.
  if (current_mode_id_ != kInvalidModeId) {

  // handleChipConfiguration assumes that initial mode is kInvalidModeId.
  // This limitation is not applicable for wifiStaSapConcurrency feature.
  if (!(WifiFeatureFlags::wifiStaSapConcurrency) &&
      current_mode_id_ != kInvalidModeId) {
    // TODO(b/37446050): Fix the deadlock.
    // TODO(b/37446050): Fix the deadlock.
    return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
    return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
  }
  }
+3 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,9 @@ class WifiFeatureFlags {
#else
#else
  static const bool wifiHidlFeatureAware = false;
  static const bool wifiHidlFeatureAware = false;
#endif // WIFI_HIDL_FEATURE_AWARE
#endif // WIFI_HIDL_FEATURE_AWARE

  // Feature flag to allow STA + SAP combination from wifi vendor hal service
  static const bool wifiStaSapConcurrency = true;
};
};


}  // namespace implementation
}  // namespace implementation
+7 −3
Original line number Original line Diff line number Diff line
@@ -334,13 +334,17 @@ wifi_error WifiLegacyHal::initialize() {
}
}


wifi_error WifiLegacyHal::start() {
wifi_error WifiLegacyHal::start() {
  // Ensure that we're starting in a good state.
  CHECK(global_func_table_.wifi_initialize && !global_handle_ &&
        !wlan_interface_handle_ && !awaiting_event_loop_termination_);
  if (is_started_) {
  if (is_started_) {
    LOG(DEBUG) << "Legacy HAL already started";
    LOG(DEBUG) << "Legacy HAL already started";
    return WIFI_SUCCESS;
    return WIFI_SUCCESS;
  }
  }
  // Ensure that we're starting in a good state.
  // In case of wifiStaSapConcurrency, if one of the interface is already active,
  // then below check will always fail, as this check assumes that wifiLegacyHal
  // is stopped before calling start. Since we don't need to start WifiLegacyHal
  // move this check here and return from is_started_ check.
  CHECK(global_func_table_.wifi_initialize && !global_handle_ &&
        !wlan_interface_handle_ && !awaiting_event_loop_termination_);
  LOG(DEBUG) << "Starting legacy HAL";
  LOG(DEBUG) << "Starting legacy HAL";
  if (!iface_tool_.SetWifiUpState(true)) {
  if (!iface_tool_.SetWifiUpState(true)) {
    LOG(ERROR) << "Failed to set WiFi interface up";
    LOG(ERROR) << "Failed to set WiFi interface up";