Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef WIFI_CHIP_H_ |
| 18 | #define WIFI_CHIP_H_ |
| 19 | |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 20 | #include <list> |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 21 | #include <map> |
Veerendranath Jakkam | 25b3a6f | 2020-04-14 22:04:39 +0530 | [diff] [blame] | 22 | #include <mutex> |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 23 | |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 24 | #include <android-base/macros.h> |
Ahmed ElArabawy | eeb5338 | 2019-10-10 20:18:31 -0700 | [diff] [blame] | 25 | #include <android/hardware/wifi/1.4/IWifiRttController.h> |
Jimmy Chen | 1bdf1a7 | 2019-12-23 17:53:40 +0200 | [diff] [blame] | 26 | #include <android/hardware/wifi/1.5/IWifiChip.h> |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 27 | |
Roshan Pius | d37341f | 2017-01-31 13:13:28 -0800 | [diff] [blame] | 28 | #include "hidl_callback_util.h" |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 29 | #include "ringbuffer.h" |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 30 | #include "wifi_ap_iface.h" |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 31 | #include "wifi_feature_flags.h" |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 32 | #include "wifi_legacy_hal.h" |
Roshan Pius | 52947fb | 2016-11-18 11:38:07 -0800 | [diff] [blame] | 33 | #include "wifi_mode_controller.h" |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 34 | #include "wifi_nan_iface.h" |
| 35 | #include "wifi_p2p_iface.h" |
Roshan Pius | 5926828 | 2016-10-06 20:23:47 -0700 | [diff] [blame] | 36 | #include "wifi_rtt_controller.h" |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 37 | #include "wifi_sta_iface.h" |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 38 | |
| 39 | namespace android { |
| 40 | namespace hardware { |
| 41 | namespace wifi { |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 42 | namespace V1_5 { |
Roshan Pius | 79a9975 | 2016-10-04 13:03:58 -0700 | [diff] [blame] | 43 | namespace implementation { |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame] | 44 | using namespace android::hardware::wifi::V1_0; |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 45 | |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 46 | /** |
| 47 | * HIDL interface object used to control a Wifi HAL chip instance. |
| 48 | * Since there is only a single chip instance used today, there is no |
| 49 | * identifying handle information stored here. |
| 50 | */ |
Jimmy Chen | 1bdf1a7 | 2019-12-23 17:53:40 +0200 | [diff] [blame] | 51 | class WifiChip : public V1_5::IWifiChip { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 52 | public: |
Jimmy Chen | 2dddd79 | 2019-12-23 17:50:39 +0200 | [diff] [blame] | 53 | WifiChip(ChipId chip_id, bool is_primary, |
Ahmed ElArabawy | 2134bf7 | 2020-06-18 15:07:12 -0700 | [diff] [blame] | 54 | const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal, |
| 55 | const std::weak_ptr<mode_controller::WifiModeController> |
| 56 | mode_controller, |
| 57 | const std::weak_ptr<iface_util::WifiIfaceUtil> iface_util, |
| 58 | const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags, |
| 59 | const std::function<void(const std::string&)>& |
| 60 | subsystemCallbackHandler); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 61 | // HIDL does not provide a built-in mechanism to let the server invalidate |
| 62 | // a HIDL interface object after creation. If any client process holds onto |
| 63 | // a reference to the object in their context, any method calls on that |
| 64 | // reference will continue to be directed to the server. |
| 65 | // |
| 66 | // However Wifi HAL needs to control the lifetime of these objects. So, add |
| 67 | // a public |invalidate| method to |WifiChip| and it's child objects. This |
| 68 | // will be used to mark an object invalid when either: |
| 69 | // a) Wifi HAL is stopped, or |
| 70 | // b) Wifi Chip is reconfigured. |
| 71 | // |
| 72 | // All HIDL method implementations should check if the object is still |
| 73 | // marked valid before processing them. |
| 74 | void invalidate(); |
| 75 | bool isValid(); |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 76 | std::set<sp<V1_4::IWifiChipEventCallback>> getEventCallbacks(); |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 77 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 78 | // HIDL methods exposed. |
| 79 | Return<void> getId(getId_cb hidl_status_cb) override; |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 80 | // Deprecated support for this callback |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 81 | Return<void> registerEventCallback( |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 82 | const sp<V1_0::IWifiChipEventCallback>& event_callback, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 83 | registerEventCallback_cb hidl_status_cb) override; |
| 84 | Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override; |
| 85 | Return<void> getAvailableModes( |
| 86 | getAvailableModes_cb hidl_status_cb) override; |
| 87 | Return<void> configureChip(ChipModeId mode_id, |
| 88 | configureChip_cb hidl_status_cb) override; |
| 89 | Return<void> getMode(getMode_cb hidl_status_cb) override; |
| 90 | Return<void> requestChipDebugInfo( |
| 91 | requestChipDebugInfo_cb hidl_status_cb) override; |
| 92 | Return<void> requestDriverDebugDump( |
| 93 | requestDriverDebugDump_cb hidl_status_cb) override; |
| 94 | Return<void> requestFirmwareDebugDump( |
| 95 | requestFirmwareDebugDump_cb hidl_status_cb) override; |
| 96 | Return<void> createApIface(createApIface_cb hidl_status_cb) override; |
lesl | 94d2824 | 2020-11-18 22:17:37 +0800 | [diff] [blame] | 97 | Return<void> createBridgedApIface( |
| 98 | createBridgedApIface_cb hidl_status_cb) override; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 99 | Return<void> getApIfaceNames(getApIfaceNames_cb hidl_status_cb) override; |
| 100 | Return<void> getApIface(const hidl_string& ifname, |
| 101 | getApIface_cb hidl_status_cb) override; |
| 102 | Return<void> removeApIface(const hidl_string& ifname, |
| 103 | removeApIface_cb hidl_status_cb) override; |
lesl | 94d2824 | 2020-11-18 22:17:37 +0800 | [diff] [blame] | 104 | Return<void> removeIfaceInstanceFromBridgedApIface( |
| 105 | const hidl_string& brIfaceName, const hidl_string& ifaceInstanceName, |
| 106 | removeIfaceInstanceFromBridgedApIface_cb hidl_status_cb) override; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 107 | Return<void> createNanIface(createNanIface_cb hidl_status_cb) override; |
| 108 | Return<void> getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) override; |
| 109 | Return<void> getNanIface(const hidl_string& ifname, |
| 110 | getNanIface_cb hidl_status_cb) override; |
| 111 | Return<void> removeNanIface(const hidl_string& ifname, |
| 112 | removeNanIface_cb hidl_status_cb) override; |
| 113 | Return<void> createP2pIface(createP2pIface_cb hidl_status_cb) override; |
| 114 | Return<void> getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) override; |
| 115 | Return<void> getP2pIface(const hidl_string& ifname, |
| 116 | getP2pIface_cb hidl_status_cb) override; |
| 117 | Return<void> removeP2pIface(const hidl_string& ifname, |
| 118 | removeP2pIface_cb hidl_status_cb) override; |
| 119 | Return<void> createStaIface(createStaIface_cb hidl_status_cb) override; |
| 120 | Return<void> getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) override; |
| 121 | Return<void> getStaIface(const hidl_string& ifname, |
| 122 | getStaIface_cb hidl_status_cb) override; |
| 123 | Return<void> removeStaIface(const hidl_string& ifname, |
| 124 | removeStaIface_cb hidl_status_cb) override; |
| 125 | Return<void> createRttController( |
| 126 | const sp<IWifiIface>& bound_iface, |
| 127 | createRttController_cb hidl_status_cb) override; |
| 128 | Return<void> getDebugRingBuffersStatus( |
| 129 | getDebugRingBuffersStatus_cb hidl_status_cb) override; |
| 130 | Return<void> startLoggingToDebugRingBuffer( |
| 131 | const hidl_string& ring_name, |
| 132 | WifiDebugRingBufferVerboseLevel verbose_level, |
| 133 | uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes, |
| 134 | startLoggingToDebugRingBuffer_cb hidl_status_cb) override; |
| 135 | Return<void> forceDumpToDebugRingBuffer( |
| 136 | const hidl_string& ring_name, |
| 137 | forceDumpToDebugRingBuffer_cb hidl_status_cb) override; |
Roger Wang | b294c76 | 2018-11-02 15:34:39 +0800 | [diff] [blame] | 138 | Return<void> flushRingBufferToFile( |
| 139 | flushRingBufferToFile_cb hidl_status_cb) override; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 140 | Return<void> stopLoggingToDebugRingBuffer( |
| 141 | stopLoggingToDebugRingBuffer_cb hidl_status_cb) override; |
| 142 | Return<void> getDebugHostWakeReasonStats( |
| 143 | getDebugHostWakeReasonStats_cb hidl_status_cb) override; |
| 144 | Return<void> enableDebugErrorAlerts( |
| 145 | bool enable, enableDebugErrorAlerts_cb hidl_status_cb) override; |
| 146 | Return<void> selectTxPowerScenario( |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 147 | V1_1::IWifiChip::TxPowerScenario scenario, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 148 | selectTxPowerScenario_cb hidl_status_cb) override; |
| 149 | Return<void> resetTxPowerScenario( |
| 150 | resetTxPowerScenario_cb hidl_status_cb) override; |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 151 | Return<void> setLatencyMode(LatencyMode mode, |
| 152 | setLatencyMode_cb hidl_status_cb) override; |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 153 | Return<void> registerEventCallback_1_2( |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 154 | const sp<V1_2::IWifiChipEventCallback>& event_callback, |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 155 | registerEventCallback_1_2_cb hidl_status_cb) override; |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 156 | Return<void> selectTxPowerScenario_1_2( |
| 157 | TxPowerScenario scenario, |
| 158 | selectTxPowerScenario_cb hidl_status_cb) override; |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 159 | Return<void> getCapabilities_1_3( |
| 160 | getCapabilities_cb hidl_status_cb) override; |
Jimmy Chen | 1bdf1a7 | 2019-12-23 17:53:40 +0200 | [diff] [blame] | 161 | Return<void> getCapabilities_1_5( |
| 162 | getCapabilities_1_5_cb hidl_status_cb) override; |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 163 | Return<void> debug(const hidl_handle& handle, |
| 164 | const hidl_vec<hidl_string>& options) override; |
Ahmed ElArabawy | eeb5338 | 2019-10-10 20:18:31 -0700 | [diff] [blame] | 165 | Return<void> createRttController_1_4( |
| 166 | const sp<IWifiIface>& bound_iface, |
| 167 | createRttController_1_4_cb hidl_status_cb) override; |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 168 | Return<void> registerEventCallback_1_4( |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 169 | const sp<V1_4::IWifiChipEventCallback>& event_callback, |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 170 | registerEventCallback_1_4_cb hidl_status_cb) override; |
Roshan Pius | e9d1e7d | 2020-11-04 11:44:16 -0800 | [diff] [blame] | 171 | Return<void> setMultiStaPrimaryConnection( |
| 172 | const hidl_string& ifname, |
| 173 | setMultiStaPrimaryConnection_cb hidl_status_cb) override; |
| 174 | Return<void> setMultiStaUseCase( |
| 175 | MultiStaUseCase use_case, |
| 176 | setMultiStaUseCase_cb hidl_status_cb) override; |
Quang Luong | 94bcce5 | 2020-11-25 17:52:19 -0800 | [diff] [blame] | 177 | Return<void> setCoexUnsafeChannels( |
| 178 | const hidl_vec<CoexUnsafeChannel>& unsafe_channels, |
| 179 | hidl_bitfield<IfaceType> restrictions, |
| 180 | setCoexUnsafeChannels_cb hidl_status_cb) override; |
Kumar Anand | da62c38 | 2020-11-18 17:17:47 -0800 | [diff] [blame] | 181 | Return<void> setCountryCode(const hidl_array<int8_t, 2>& code, |
| 182 | setCountryCode_cb _hidl_cb) override; |
Kumar Anand | aea86e0 | 2021-02-10 16:22:31 -0800 | [diff] [blame] | 183 | Return<void> getUsableChannels( |
| 184 | WifiBand band, hidl_bitfield<WifiIfaceMode> ifaceModeMask, |
| 185 | hidl_bitfield<UsableChannelFilter> filterMask, |
| 186 | getUsableChannels_cb _hidl_cb) override; |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 187 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 188 | private: |
| 189 | void invalidateAndRemoveAllIfaces(); |
Roshan Pius | 8236850 | 2019-05-16 12:53:02 -0700 | [diff] [blame] | 190 | // When a STA iface is removed any dependent NAN-ifaces/RTT-controllers are |
| 191 | // invalidated & removed. |
| 192 | void invalidateAndRemoveDependencies(const std::string& removed_iface_name); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 193 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 194 | // Corresponding worker functions for the HIDL methods. |
| 195 | std::pair<WifiStatus, ChipId> getIdInternal(); |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 196 | // Deprecated support for this callback |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 197 | WifiStatus registerEventCallbackInternal( |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 198 | const sp<V1_0::IWifiChipEventCallback>& event_callback); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 199 | std::pair<WifiStatus, uint32_t> getCapabilitiesInternal(); |
| 200 | std::pair<WifiStatus, std::vector<ChipMode>> getAvailableModesInternal(); |
Roshan Pius | ba38d9c | 2017-12-08 07:32:08 -0800 | [diff] [blame] | 201 | WifiStatus configureChipInternal( |
| 202 | std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 203 | std::pair<WifiStatus, uint32_t> getModeInternal(); |
| 204 | std::pair<WifiStatus, IWifiChip::ChipDebugInfo> |
| 205 | requestChipDebugInfoInternal(); |
| 206 | std::pair<WifiStatus, std::vector<uint8_t>> |
| 207 | requestDriverDebugDumpInternal(); |
| 208 | std::pair<WifiStatus, std::vector<uint8_t>> |
| 209 | requestFirmwareDebugDumpInternal(); |
lesl | 94d2824 | 2020-11-18 22:17:37 +0800 | [diff] [blame] | 210 | sp<WifiApIface> newWifiApIface(std::string& ifname); |
| 211 | WifiStatus createVirtualApInterface(const std::string& apVirtIf); |
lesl | 420c4fc | 2020-11-23 19:33:04 +0800 | [diff] [blame] | 212 | std::pair<WifiStatus, sp<V1_5::IWifiApIface>> createApIfaceInternal(); |
| 213 | std::pair<WifiStatus, sp<V1_5::IWifiApIface>> |
| 214 | createBridgedApIfaceInternal(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 215 | std::pair<WifiStatus, std::vector<hidl_string>> getApIfaceNamesInternal(); |
lesl | 420c4fc | 2020-11-23 19:33:04 +0800 | [diff] [blame] | 216 | std::pair<WifiStatus, sp<V1_5::IWifiApIface>> getApIfaceInternal( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 217 | const std::string& ifname); |
| 218 | WifiStatus removeApIfaceInternal(const std::string& ifname); |
lesl | 94d2824 | 2020-11-18 22:17:37 +0800 | [diff] [blame] | 219 | WifiStatus removeIfaceInstanceFromBridgedApIfaceInternal( |
| 220 | const std::string& brIfaceName, const std::string& ifInstanceName); |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 221 | std::pair<WifiStatus, sp<V1_4::IWifiNanIface>> createNanIfaceInternal(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 222 | std::pair<WifiStatus, std::vector<hidl_string>> getNanIfaceNamesInternal(); |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 223 | std::pair<WifiStatus, sp<V1_4::IWifiNanIface>> getNanIfaceInternal( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 224 | const std::string& ifname); |
| 225 | WifiStatus removeNanIfaceInternal(const std::string& ifname); |
| 226 | std::pair<WifiStatus, sp<IWifiP2pIface>> createP2pIfaceInternal(); |
| 227 | std::pair<WifiStatus, std::vector<hidl_string>> getP2pIfaceNamesInternal(); |
| 228 | std::pair<WifiStatus, sp<IWifiP2pIface>> getP2pIfaceInternal( |
| 229 | const std::string& ifname); |
| 230 | WifiStatus removeP2pIfaceInternal(const std::string& ifname); |
Roshan Pius | e9d1e7d | 2020-11-04 11:44:16 -0800 | [diff] [blame] | 231 | std::pair<WifiStatus, sp<V1_5::IWifiStaIface>> createStaIfaceInternal(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 232 | std::pair<WifiStatus, std::vector<hidl_string>> getStaIfaceNamesInternal(); |
Roshan Pius | e9d1e7d | 2020-11-04 11:44:16 -0800 | [diff] [blame] | 233 | std::pair<WifiStatus, sp<V1_5::IWifiStaIface>> getStaIfaceInternal( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 234 | const std::string& ifname); |
| 235 | WifiStatus removeStaIfaceInternal(const std::string& ifname); |
Ahmed ElArabawy | eeb5338 | 2019-10-10 20:18:31 -0700 | [diff] [blame] | 236 | std::pair<WifiStatus, sp<V1_0::IWifiRttController>> |
| 237 | createRttControllerInternal(const sp<IWifiIface>& bound_iface); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 238 | std::pair<WifiStatus, std::vector<WifiDebugRingBufferStatus>> |
| 239 | getDebugRingBuffersStatusInternal(); |
| 240 | WifiStatus startLoggingToDebugRingBufferInternal( |
| 241 | const hidl_string& ring_name, |
| 242 | WifiDebugRingBufferVerboseLevel verbose_level, |
| 243 | uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes); |
| 244 | WifiStatus forceDumpToDebugRingBufferInternal(const hidl_string& ring_name); |
Roger Wang | b294c76 | 2018-11-02 15:34:39 +0800 | [diff] [blame] | 245 | WifiStatus flushRingBufferToFileInternal(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 246 | WifiStatus stopLoggingToDebugRingBufferInternal(); |
| 247 | std::pair<WifiStatus, WifiDebugHostWakeReasonStats> |
| 248 | getDebugHostWakeReasonStatsInternal(); |
| 249 | WifiStatus enableDebugErrorAlertsInternal(bool enable); |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 250 | WifiStatus selectTxPowerScenarioInternal( |
| 251 | V1_1::IWifiChip::TxPowerScenario scenario); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 252 | WifiStatus resetTxPowerScenarioInternal(); |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 253 | WifiStatus setLatencyModeInternal(LatencyMode mode); |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 254 | WifiStatus registerEventCallbackInternal_1_2( |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 255 | const sp<V1_2::IWifiChipEventCallback>& event_callback); |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 256 | WifiStatus selectTxPowerScenarioInternal_1_2(TxPowerScenario scenario); |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 257 | std::pair<WifiStatus, uint32_t> getCapabilitiesInternal_1_3(); |
Jimmy Chen | 1bdf1a7 | 2019-12-23 17:53:40 +0200 | [diff] [blame] | 258 | std::pair<WifiStatus, uint32_t> getCapabilitiesInternal_1_5(); |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 259 | std::pair<WifiStatus, sp<V1_4::IWifiRttController>> |
Ahmed ElArabawy | eeb5338 | 2019-10-10 20:18:31 -0700 | [diff] [blame] | 260 | createRttControllerInternal_1_4(const sp<IWifiIface>& bound_iface); |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 261 | WifiStatus registerEventCallbackInternal_1_4( |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 262 | const sp<V1_4::IWifiChipEventCallback>& event_callback); |
Roshan Pius | e9d1e7d | 2020-11-04 11:44:16 -0800 | [diff] [blame] | 263 | WifiStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname); |
| 264 | WifiStatus setMultiStaUseCaseInternal(MultiStaUseCase use_case); |
Quang Luong | 94bcce5 | 2020-11-25 17:52:19 -0800 | [diff] [blame] | 265 | WifiStatus setCoexUnsafeChannelsInternal( |
| 266 | std::vector<CoexUnsafeChannel> unsafe_channels, uint32_t restrictions); |
Kumar Anand | da62c38 | 2020-11-18 17:17:47 -0800 | [diff] [blame] | 267 | WifiStatus setCountryCodeInternal(const std::array<int8_t, 2>& code); |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 268 | std::pair<WifiStatus, std::vector<WifiUsableChannel>> |
Kumar Anand | aea86e0 | 2021-02-10 16:22:31 -0800 | [diff] [blame] | 269 | getUsableChannelsInternal(WifiBand band, uint32_t ifaceModeMask, |
| 270 | uint32_t filterMask); |
Roshan Pius | ba38d9c | 2017-12-08 07:32:08 -0800 | [diff] [blame] | 271 | WifiStatus handleChipConfiguration( |
| 272 | std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 273 | WifiStatus registerDebugRingBufferCallback(); |
Roshan Pius | 85c6441 | 2018-01-22 17:58:40 -0800 | [diff] [blame] | 274 | WifiStatus registerRadioModeChangeCallback(); |
Roshan Pius | 2c06a3f | 2016-12-15 17:51:40 -0800 | [diff] [blame] | 275 | |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 276 | std::vector<V1_4::IWifiChip::ChipIfaceCombination> |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 277 | getCurrentModeIfaceCombinations(); |
| 278 | std::map<IfaceType, size_t> getCurrentIfaceCombination(); |
| 279 | std::vector<std::map<IfaceType, size_t>> expandIfaceCombinations( |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 280 | const V1_4::IWifiChip::ChipIfaceCombination& combination); |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 281 | bool canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces( |
| 282 | const std::map<IfaceType, size_t>& expanded_combo, |
| 283 | IfaceType requested_type); |
| 284 | bool canCurrentModeSupportIfaceOfTypeWithCurrentIfaces( |
| 285 | IfaceType requested_type); |
| 286 | bool canExpandedIfaceComboSupportIfaceCombo( |
| 287 | const std::map<IfaceType, size_t>& expanded_combo, |
| 288 | const std::map<IfaceType, size_t>& req_combo); |
| 289 | bool canCurrentModeSupportIfaceCombo( |
| 290 | const std::map<IfaceType, size_t>& req_combo); |
| 291 | bool canCurrentModeSupportIfaceOfType(IfaceType requested_type); |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 292 | bool isValidModeId(ChipModeId mode_id); |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 293 | bool isStaApConcurrencyAllowedInCurrentMode(); |
lesl | 261818b | 2020-11-27 12:37:35 +0800 | [diff] [blame] | 294 | bool isDualStaConcurrencyAllowedInCurrentMode(); |
| 295 | uint32_t startIdxOfApIface(); |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 296 | std::string getFirstActiveWlanIfaceName(); |
Jimmy Chen | 2dddd79 | 2019-12-23 17:50:39 +0200 | [diff] [blame] | 297 | std::string allocateApOrStaIfaceName(IfaceType type, uint32_t start_idx); |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 298 | std::string allocateApIfaceName(); |
lesl | 261818b | 2020-11-27 12:37:35 +0800 | [diff] [blame] | 299 | std::vector<std::string> allocateBridgedApInstanceNames(); |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 300 | std::string allocateStaIfaceName(); |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 301 | bool writeRingbufferFilesInternal(); |
Jimmy Chen | 2dddd79 | 2019-12-23 17:50:39 +0200 | [diff] [blame] | 302 | std::string getWlanIfaceNameWithType(IfaceType type, unsigned idx); |
lesl | 94d2824 | 2020-11-18 22:17:37 +0800 | [diff] [blame] | 303 | void invalidateAndClearBridgedApAll(); |
| 304 | void invalidateAndClearBridgedAp(const std::string& br_name); |
| 305 | bool findUsingNameFromBridgedApInstances(const std::string& name); |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 306 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 307 | ChipId chip_id_; |
| 308 | std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_; |
| 309 | std::weak_ptr<mode_controller::WifiModeController> mode_controller_; |
Roshan Pius | 99dab38 | 2019-02-14 07:57:10 -0800 | [diff] [blame] | 310 | std::weak_ptr<iface_util::WifiIfaceUtil> iface_util_; |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 311 | std::vector<sp<WifiApIface>> ap_ifaces_; |
| 312 | std::vector<sp<WifiNanIface>> nan_ifaces_; |
| 313 | std::vector<sp<WifiP2pIface>> p2p_ifaces_; |
| 314 | std::vector<sp<WifiStaIface>> sta_ifaces_; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 315 | std::vector<sp<WifiRttController>> rtt_controllers_; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 316 | std::map<std::string, Ringbuffer> ringbuffer_map_; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 317 | bool is_valid_; |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 318 | // Members pertaining to chip configuration. |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 319 | uint32_t current_mode_id_; |
Veerendranath Jakkam | 25b3a6f | 2020-04-14 22:04:39 +0530 | [diff] [blame] | 320 | std::mutex lock_t; |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 321 | std::vector<V1_4::IWifiChip::ChipMode> modes_; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 322 | // The legacy ring buffer callback API has only a global callback |
| 323 | // registration mechanism. Use this to check if we have already |
| 324 | // registered a callback. |
| 325 | bool debug_ring_buffer_cb_registered_; |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 326 | hidl_callback_util::HidlCallbackHandler<V1_4::IWifiChipEventCallback> |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 327 | event_cb_handler_; |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 328 | |
Ahmed ElArabawy | 2134bf7 | 2020-06-18 15:07:12 -0700 | [diff] [blame] | 329 | const std::function<void(const std::string&)> subsystemCallbackHandler_; |
lesl | 94d2824 | 2020-11-18 22:17:37 +0800 | [diff] [blame] | 330 | std::map<std::string, std::vector<std::string>> br_ifaces_ap_instances_; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 331 | DISALLOW_COPY_AND_ASSIGN(WifiChip); |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 332 | }; |
| 333 | |
Roshan Pius | 79a9975 | 2016-10-04 13:03:58 -0700 | [diff] [blame] | 334 | } // namespace implementation |
Jimmy Chen | d460df3 | 2019-11-29 17:31:22 +0200 | [diff] [blame] | 335 | } // namespace V1_5 |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 336 | } // namespace wifi |
| 337 | } // namespace hardware |
| 338 | } // namespace android |
| 339 | |
| 340 | #endif // WIFI_CHIP_H_ |