Add IfaceConcurrencyType and related methods for AP_BRIDGED concurrency
Add IfaceConcurrencyType to represent Iface implementations that
have different concurrency implications for the same IfaceType, such as
Bridged AP and Single AP for IWifiApIface. Add a new IWifiChip HAL API,
getAvailableModes_1_6 to return the new concurrency type combos.
Bug: 207055799
Test: 1.6/default/tests/runtests.sh
Change-Id: Iad20a3d95d54dd8b624db912fd3153c2a3372f45
diff --git a/wifi/1.6/default/wifi_feature_flags.cpp b/wifi/1.6/default/wifi_feature_flags.cpp
index 71319e1..e80a3cd 100644
--- a/wifi/1.6/default/wifi_feature_flags.cpp
+++ b/wifi/1.6/default/wifi_feature_flags.cpp
@@ -29,8 +29,8 @@
namespace feature_flags {
using V1_0::ChipModeId;
-using V1_0::IfaceType;
using V1_0::IWifiChip;
+using V1_6::IfaceConcurrencyType;
/* The chip may either have a single mode supporting any number of combinations,
* or a fixed dual-mode (so it involves firmware loading to switch between
@@ -42,9 +42,9 @@
* WIFI_HAL_INTERFACE_COMBINATIONS := {{{STA, AP}, 1}, {{P2P, NAN}, 1}},
* WIFI_HAL_INTERFACE_COMBINATIONS += {{{STA}, 1}, {{AP}, 2}}
* What means:
- * Interface combination 1: 1 STA or AP and 1 P2P or NAN concurrent iface
+ * Interface concurrency combination 1: 1 STA or AP and 1 P2P or NAN concurrent iface
* operations.
- * Interface combination 2: 1 STA and 2 AP concurrent iface operations.
+ * Interface concurrency combination 2: 1 STA and 2 AP concurrent iface operations.
*
* For backward compatibility, the following makefile flags can be used to
* generate combinations list:
@@ -53,20 +53,20 @@
* - WIFI_HIDL_FEATURE_AWARE
* However, they are ignored if WIFI_HAL_INTERFACE_COMBINATIONS was provided.
* With WIFI_HIDL_FEATURE_DUAL_INTERFACE flag set, there is a single mode with
- * two interface combinations:
- * Interface Combination 1: Will support 1 STA and 1 P2P or NAN (optional)
+ * two concurrency combinations:
+ * Interface Concurrency Combination 1: Will support 1 STA and 1 P2P or NAN (optional)
* concurrent iface operations.
- * Interface Combination 2: Will support 1 STA and 1 AP concurrent
+ * Interface Concurrency Combination 2: Will support 1 STA and 1 AP concurrent
* iface operations.
*
* The only dual-mode configuration supported is for alternating STA and AP
* mode, that may involve firmware reloading. In such case, there are 2 separate
- * modes of operation with 1 interface combination each:
+ * modes of operation with 1 concurrency combination each:
* Mode 1 (STA mode): Will support 1 STA and 1 P2P or NAN (optional)
* concurrent iface operations.
* Mode 2 (AP mode): Will support 1 AP iface operation.
*
- * If Aware is enabled, the iface combination will be modified to support either
+ * If Aware is enabled, the concurrency combination will be modified to support either
* P2P or NAN in place of just P2P.
*/
// clang-format off
@@ -117,79 +117,87 @@
* The main point here is to simplify the syntax required by
* WIFI_HAL_INTERFACE_COMBINATIONS.
*/
-struct ChipIfaceCombination : public hidl_vec<IWifiChip::ChipIfaceCombinationLimit> {
- ChipIfaceCombination(const std::initializer_list<IWifiChip::ChipIfaceCombinationLimit> list)
+struct ChipConcurrencyCombination
+ : public hidl_vec<V1_6::IWifiChip::ChipConcurrencyCombinationLimit> {
+ ChipConcurrencyCombination(
+ const std::initializer_list<V1_6::IWifiChip::ChipConcurrencyCombinationLimit> list)
: hidl_vec(list) {}
- operator IWifiChip::ChipIfaceCombination() const { return {*this}; }
+ operator V1_6::IWifiChip::ChipConcurrencyCombination() const { return {*this}; }
- static hidl_vec<IWifiChip::ChipIfaceCombination> make_vec(
- const std::initializer_list<ChipIfaceCombination> list) {
- return hidl_vec<IWifiChip::ChipIfaceCombination>( //
+ static hidl_vec<V1_6::IWifiChip::ChipConcurrencyCombination> make_vec(
+ const std::initializer_list<ChipConcurrencyCombination> list) {
+ return hidl_vec<V1_6::IWifiChip::ChipConcurrencyCombination>( //
std::begin(list), std::end(list));
}
};
-#define STA IfaceType::STA
-#define AP IfaceType::AP
-#define P2P IfaceType::P2P
-#define NAN IfaceType::NAN
-static const std::vector<IWifiChip::ChipMode> kChipModesPrimary{
- {kMainModeId, ChipIfaceCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS})},
+#define STA IfaceConcurrencyType::STA
+#define AP IfaceConcurrencyType::AP
+#define AP_BRIDGED IfaceConcurrencyType::AP_BRIDGED
+#define P2P IfaceConcurrencyType::P2P
+#define NAN IfaceConcurrencyType::NAN
+static const std::vector<V1_6::IWifiChip::ChipMode> kChipModesPrimary{
+ {kMainModeId, ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS})},
#ifdef WIFI_HAL_INTERFACE_COMBINATIONS_AP
{chip_mode_ids::kV1Ap,
- ChipIfaceCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_AP})},
+ ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_AP})},
#endif
};
-static const std::vector<IWifiChip::ChipMode> kChipModesSecondary{
+static const std::vector<V1_6::IWifiChip::ChipMode> kChipModesSecondary{
#ifdef WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP
{chip_mode_ids::kV3,
- ChipIfaceCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP})},
+ ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP})},
#endif
};
constexpr char kDebugPresetInterfaceCombinationIdxProperty[] =
"persist.vendor.debug.wifi.hal.preset_interface_combination_idx";
-// List of pre-defined interface combinations that can be enabled at runtime via
+// List of pre-defined concurrency combinations that can be enabled at runtime via
// setting the property: "kDebugPresetInterfaceCombinationIdxProperty" to the
// corresponding index value.
-static const std::vector<std::pair<std::string, std::vector<IWifiChip::ChipMode>>> kDebugChipModes{
- // Legacy combination - No STA/AP concurrencies.
- // 0 - (1 AP) or (1 STA + 1 of (P2P or NAN))
- {"No STA/AP Concurrency",
- {{kMainModeId,
- ChipIfaceCombination::make_vec({{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
+static const std::vector<std::pair<std::string, std::vector<V1_6::IWifiChip::ChipMode>>>
+ kDebugChipModes{// Legacy combination - No STA/AP concurrencies.
+ // 0 - (1 AP) or (1 STA + 1 of (P2P or NAN))
+ {"No STA/AP Concurrency",
+ {{kMainModeId, ChipConcurrencyCombination::make_vec(
+ {{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
- // STA + AP concurrency
- // 1 - (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN))
- {"STA + AP Concurrency",
- {{kMainModeId, ChipIfaceCombination::make_vec(
- {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
+ // STA + AP concurrency
+ // 1 - (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN))
+ {"STA + AP Concurrency",
+ {{kMainModeId,
+ ChipConcurrencyCombination::make_vec(
+ {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
- // STA + STA concurrency
- // 2 - (1 STA + 1 AP) or (2 STA + 1 of (P2P or NAN))
- {"Dual STA Concurrency",
- {{kMainModeId, ChipIfaceCombination::make_vec(
- {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}},
+ // STA + STA concurrency
+ // 2 - (1 STA + 1 AP) or (2 STA + 1 of (P2P or NAN))
+ {"Dual STA Concurrency",
+ {{kMainModeId,
+ ChipConcurrencyCombination::make_vec(
+ {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}},
- // AP + AP + STA concurrency
- // 3 - (1 STA + 2 AP) or (1 STA + 1 of (P2P or NAN))
- {"Dual AP Concurrency",
- {{kMainModeId, ChipIfaceCombination::make_vec(
- {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
+ // AP + AP + STA concurrency
+ // 3 - (1 STA + 2 AP) or (1 STA + 1 of (P2P or NAN))
+ {"Dual AP Concurrency",
+ {{kMainModeId,
+ ChipConcurrencyCombination::make_vec(
+ {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}},
- // STA + STA concurrency and AP + AP + STA concurrency
- // 4 - (1 STA + 2 AP) or (2 STA + 1 of (P2P or NAN))
- {"Dual STA & Dual AP Concurrency",
- {{kMainModeId, ChipIfaceCombination::make_vec(
- {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}},
+ // STA + STA concurrency and AP + AP + STA concurrency
+ // 4 - (1 STA + 2 AP) or (2 STA + 1 of (P2P or NAN))
+ {"Dual STA & Dual AP Concurrency",
+ {{kMainModeId,
+ ChipConcurrencyCombination::make_vec(
+ {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}},
- // STA + STA concurrency
- // 5 - (1 STA + 1 AP (bridged or single) | P2P | NAN), or (2 STA))
- {"Dual STA or STA plus single other interface",
- {{kMainModeId,
- ChipIfaceCombination::make_vec({{{{STA}, 1}, {{P2P, NAN, AP}, 1}}, {{{STA}, 2}}})}}}};
+ // STA + STA concurrency
+ // 5 - (1 STA + 1 AP (bridged or single) | P2P | NAN), or (2 STA))
+ {"Dual STA or STA plus single other interface",
+ {{kMainModeId, ChipConcurrencyCombination::make_vec(
+ {{{{STA}, 1}, {{P2P, NAN, AP, AP_BRIDGED}, 1}},
+ {{{STA}, 2}}})}}}};
#undef STA
#undef AP
@@ -206,13 +214,13 @@
WifiFeatureFlags::WifiFeatureFlags() {}
-std::vector<IWifiChip::ChipMode> WifiFeatureFlags::getChipModesForPrimary() {
+std::vector<V1_6::IWifiChip::ChipMode> WifiFeatureFlags::getChipModesForPrimary() {
std::array<char, PROPERTY_VALUE_MAX> buffer;
auto res = property_get(kDebugPresetInterfaceCombinationIdxProperty, buffer.data(), nullptr);
- // Debug propety not set, use the device preset interface combination.
+ // Debug property not set, use the device preset concurrency combination.
if (res <= 0) return kChipModesPrimary;
- // Debug propety set, use one of the debug preset interface combination.
+ // Debug property set, use one of the debug preset concurrency combination.
unsigned long idx = std::stoul(buffer.data());
if (idx >= kDebugChipModes.size()) {
LOG(ERROR) << "Invalid index set in property: "
@@ -220,14 +228,14 @@
return kChipModesPrimary;
}
std::string name;
- std::vector<IWifiChip::ChipMode> chip_modes;
+ std::vector<V1_6::IWifiChip::ChipMode> chip_modes;
std::tie(name, chip_modes) = kDebugChipModes[idx];
LOG(INFO) << "Using debug chip mode: <" << name
<< "> set via property: " << kDebugPresetInterfaceCombinationIdxProperty;
return chip_modes;
}
-std::vector<IWifiChip::ChipMode> WifiFeatureFlags::getChipModes(bool is_primary) {
+std::vector<V1_6::IWifiChip::ChipMode> WifiFeatureFlags::getChipModes(bool is_primary) {
return (is_primary) ? getChipModesForPrimary() : kChipModesSecondary;
}