blob: e199850c1a763f5a29fa26115c9592501b8a5f61 [file] [log] [blame]
Jimmy Chen1bdf1a72019-12-23 17:53:40 +02001/*
2 * Copyright 2020 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
17package android.hardware.wifi@1.5;
18
19import @1.0::WifiStatus;
lesl420c4fc2020-11-23 19:33:04 +080020import @1.5::IWifiApIface;
Jimmy Chen1bdf1a72019-12-23 17:53:40 +020021import @1.0::IWifiIface;
22import @1.3::IWifiChip;
23import @1.4::IWifiChip;
24
25/**
26 * Interface that represents a chip that must be configured as a single unit.
27 */
28interface IWifiChip extends @1.4::IWifiChip {
29 /**
30 * Capabilities exposed by this chip.
31 */
32 enum ChipCapabilityMask : @1.3::IWifiChip.ChipCapabilityMask {
33 /**
34 * chip can operate in the 60GHz band(WiGig chip)
35 */
36 WIGIG = 1 << 14,
37 };
38
39 /**
Roshan Piuse9d1e7d2020-11-04 11:44:16 -080040 * When there are 2 or more simultaneous STA connections, this use case hint indicates what
41 * use-case is being enabled by the framework. This use case hint can be used by the firmware
42 * to modify various firmware configurations like:
43 * - Allowed BSSIDs the firmware can choose for the initial connection/roaming attempts.
44 * - Duty cycle to choose for the 2 STA connections if the radio is in MCC mode.
45 * - Whether roaming, APF and other offloads needs to be enabled or not.
46 * Note:
47 * - This will be invoked before an active wifi connection is established on the second
48 * interface.
49 * - This use-case hint is implicitly void when the second STA interface is brought down.
50 */
51 enum MultiStaUseCase : uint8_t {
52 /**
53 * Usage:
54 * - This will be sent down for make before break use-case.
55 * - Platform is trying to speculatively connect to a second network and evaluate it without
56 * disrupting the primary connection.
57 * Requirements for Firmware:
58 * - Do not reduce the number of tx/rx chains of primary connection.
59 * - If using MCC, should set the MCC duty cycle of the primary connection to be higher than
60 * the secondary connection (maybe 70/30 split).
61 * - Should pick the best BSSID for the secondary STA (disregard the chip mode) independent
62 * of the primary STA:
63 * - Don’t optimize for DBS vs MCC/SCC
64 * - Should not impact the primary connection’s bssid selection:
65 * - Don’t downgrade chains of the existing primary connection.
66 * - Don’t optimize for DBS vs MCC/SCC.
67 */
68 DUAL_STA_TRANSIENT_PREFER_PRIMARY = 0,
69 /**
70 * Usage:
71 * - This will be sent down for any app requested peer to peer connections.
72 * - In this case, both the connections needs to be allocated equal resources.
73 * - For the peer to peer use case, BSSID for the secondary connection will be chosen by the
74 * framework.
75 *
76 * Requirements for Firmware:
77 * - Can choose MCC or DBS mode depending on the MCC efficiency and HW capability.
78 * - If using MCC, set the MCC duty cycle of the primary connection to be equal to the
79 * secondary connection.
80 * - Prefer BSSID candidates which will help provide the best "overall" performance for both
81 * the connections.
82 */
83 DUAL_STA_NON_TRANSIENT_UNBIASED = 1,
84 };
85
86 /**
Jimmy Chen1bdf1a72019-12-23 17:53:40 +020087 * Get the capabilities supported by this chip.
88 *
89 * @return status WifiStatus of the operation.
90 * Possible status codes:
91 * |WifiStatusCode.SUCCESS|,
92 * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
93 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
94 * |WifiStatusCode.ERROR_UNKNOWN|
95 * @return capabilities Bitset of |ChipCapabilityMask| values.
96 */
97 getCapabilities_1_5()
98 generates (WifiStatus status, bitfield<ChipCapabilityMask> capabilities);
Roshan Piuse9d1e7d2020-11-04 11:44:16 -080099
100 /**
101 * Invoked to indicate that the provided iface is the primary STA iface when there are more
102 * than 1 STA iface concurrently active.
103 * Note: If the wifi firmware/chip cannot support multiple instances of any offload
104 * (like roaming, APF, rssi threshold, etc), the firmware should ensure that these
105 * offloads are at least enabled for the primary interface. If the new primary interface is
106 * already connected to a network, the firmware must switch all the offloads on
107 * this new interface without disconnecting.
108 *
109 * @param ifname Name of the STA iface.
110 * @return status WifiStatus of the operation.
111 * Possible status codes:
112 * |WifiStatusCode.SUCCESS|,
113 * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
114 * |WifiStatusCode.ERROR_INVALID_ARGS|
115 */
116 setMultiStaPrimaryConnection(string ifName) generates (WifiStatus status);
117
118 /**
119 * Invoked to indicate the STA + STA use-case that is active.
120 *
121 * Refer to documentation of |MultiStaUseCase| for details.
122 *
123 * @param useCase Use case that is active.
124 * @return status WifiStatus of the operation.
125 * Possible status codes:
126 * |WifiStatusCode.SUCCESS|,
127 * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
128 * |WifiStatusCode.ERROR_INVALID_ARGS|
129 */
130 setMultiStaUseCase(MultiStaUseCase useCase) generates (WifiStatus status);
lesl94d28242020-11-18 22:17:37 +0800131
lesl94d28242020-11-18 22:17:37 +0800132 /**
133 * Create bridged IWifiApIface.
134 *
135 * Depending on the mode the chip is configured in, the interface creation
136 * may fail (code: |ERROR_NOT_AVAILABLE|) if we've already reached the maximum
137 * allowed (specified in |ChipIfaceCombination|) number of ifaces of the AP
138 * type.
139 *
140 * @return status WifiStatus of the operation.
141 * Possible status codes:
142 * |WifiStatusCode.SUCCESS|,
143 * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
144 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
145 * |WifiStatusCode.ERROR_NOT_AVAILABLE|
146 * @return iface HIDL interface object representing the iface if
147 * successful, null otherwise.
148 */
149 createBridgedApIface() generates (WifiStatus status, IWifiApIface iface);
150
151 /**
152 * Removes one of the instance on the AP Iface with the provided ifaceName and
153 * ifaceInstanceName.
154 *
155 * Use the API: removeApIface with brIfaceName in the V1_0::WifiChip.hal to remove bridge Iface.
156 *
157 * @param brIfaceName Name of the bridged AP iface.
158 * @param ifaceInstanceName Name of the instance. The empty instance is
159 * invalid.
160 * @return status WifiStatus of the operation.
161 * Possible status codes:
162 * |WifiStatusCode.SUCCESS|,
163 * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
164 * |WifiStatusCode.ERROR_INVALID_ARGS|,
165 * |WifiStatusCode.ERROR_NOT_AVAILABLE|
166 */
167 removeIfaceInstanceFromBridgedApIface(string brIfaceName, string ifaceInstanceName)
168 generates (WifiStatus status);
Quang Luong94bcce52020-11-25 17:52:19 -0800169
170 /**
171 * Representation of a Wi-Fi channel for Wi-Fi coex channel avoidance.
172 */
173 struct CoexUnsafeChannel {
174 /* The band of the channel */
175 WifiBand band;
176 /* The channel number */
177 uint32_t channel;
178 /** The power cap will be a maximum power value in dbm that is allowed to be transmitted by
179 the chip on this channel. A value of PowerCapConstant.NO_POWER_CAP means no limitation
180 on transmitted power is needed by the chip for this channel.
181 */
182 int32_t powerCapDbm;
183 };
184
185 enum PowerCapConstant : int32_t {
186 NO_POWER_CAP = 0x7FFFFFFF,
187 };
188
Quang Luongab70a832020-12-14 13:01:32 -0800189 enum CoexRestriction : uint32_t {
190 WIFI_DIRECT = 1 << 0,
191 SOFTAP = 1 << 1,
192 WIFI_AWARE = 1 << 2
193 };
194
Quang Luong94bcce52020-11-25 17:52:19 -0800195 /**
196 * Invoked to indicate that the provided |CoexUnsafeChannels| should be avoided with the
197 * specified restrictions.
198 *
199 * Channel avoidance is a suggestion and should be done on a best-effort approach. If a provided
200 * channel is used, then the specified power cap should be applied.
201 *
Quang Luongab70a832020-12-14 13:01:32 -0800202 * In addition, hard restrictions on the Wifi modes may be indicated by |CoexRestriction| bits
203 * (WIFI_DIRECT, SOFTAP, WIFI_AWARE) in the |restrictions| bitfield. If a hard restriction is
204 * provided, then the channels should be completely avoided for the provided Wifi modes instead
205 * of by best-effort.
Quang Luong94bcce52020-11-25 17:52:19 -0800206 *
207 * @param unsafeChannels List of |CoexUnsafeChannels| to avoid.
Quang Luongab70a832020-12-14 13:01:32 -0800208 * @param restrictions Bitset of |CoexRestriction| values indicating Wifi interfaces to
209 * completely avoid.
Quang Luong94bcce52020-11-25 17:52:19 -0800210 * @return status WifiStatus of the operation.
211 * Possible status codes:
212 * |WifiStatusCode.SUCCESS|,
213 * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
214 * |WifiStatusCode.ERROR_INVALID_ARGS|,
215 */
216 setCoexUnsafeChannels(
Quang Luongab70a832020-12-14 13:01:32 -0800217 vec<CoexUnsafeChannel> unsafeChannels, bitfield<CoexRestriction> restrictions)
Quang Luong94bcce52020-11-25 17:52:19 -0800218 generates (WifiStatus status);
Kumar Anandda62c382020-11-18 17:17:47 -0800219
220 /**
221 * Set country code for this Wifi chip.
222 *
223 * Country code is global setting across the Wifi chip and not Wifi
224 * interface (STA or AP) specific. Legacy HAL API's for country code in
225 * @1.0::ISupplicantStaIface::setCountryCode &
226 * @1.0::IWifiApIface:setCountryCode are deprecated in favor of this
227 * chip level API.
228 *
229 * @param code 2 byte country code (as defined in ISO 3166) to set.
230 * @return status Status of the operation.
231 * Possible status codes:
232 * |WifiStatusCode.SUCCESS|,
233 * |WifiStatusCode.FAILURE_UNKNOWN|,
234 * |WifiStatusCode.FAILURE_IFACE_INVALID|
235 */
236 setCountryCode(int8_t[2] code) generates (WifiStatus status);
Kumar Anand2a630a32021-01-21 14:09:14 -0800237
238 /**
Kumar Anandaea86e02021-02-10 16:22:31 -0800239 * Usable Wifi channels filter masks.
240 */
241 enum UsableChannelFilter : uint32_t {
242 /**
243 * Filter Wifi channels that should be avoided due to extreme
244 * cellular coexistence restrictions. Some Wifi channels can have
245 * extreme interference from/to cellular due to short frequency
246 * seperation with neighboring cellular channels or when there
247 * is harmonic and intermodulation interference. Channels which
248 * only have some performance degradation (e.g. power back off is
249 * sufficient to deal with coexistence issue) can be included and
250 * should not be filtered out.
251 */
252 CELLULAR_COEXISTENCE = 1 << 0,
253 /**
254 * Filter based on concurrency state.
255 * Examples:
256 * - 5GHz SAP operation may be supported in standalone mode, but if
257 * there is STA connection on 5GHz DFS channel, none of the 5GHz
258 * channels are usable for SAP if device does not support DFS SAP mode.
259 * - P2P GO may not be supported on indoor channels in EU during
260 * standalone mode but if there is a STA connection on indoor channel,
261 * P2P GO may be supported by some vendors on the same STA channel.
262 */
263 CONCURRENCY = 1 << 1,
264 };
265
266 /**
Kumar Anand2a630a32021-01-21 14:09:14 -0800267 * Retrieve list of usable Wifi channels for the specified band &
268 * operational modes.
269 *
270 * The list of usable Wifi channels in a given band depends on factors
Kumar Anandaea86e02021-02-10 16:22:31 -0800271 * like current country code, operational mode (e.g. STA, SAP, WFD-CLI,
272 * WFD-GO, TDLS, NAN) and other restrictons due to DFS, cellular coexistence
273 * and conncurency state of the device.
Kumar Anand2a630a32021-01-21 14:09:14 -0800274 *
275 * @param band |WifiBand| for which list of usable channels is requested.
276 * @param ifaceModeMask Bitmask of the modes represented by |WifiIfaceMode|
277 * Bitmask respresents all the modes that the caller is interested
Kumar Anandaea86e02021-02-10 16:22:31 -0800278 * in (e.g. STA, SAP, CLI, GO, TDLS, NAN). E.g. If the caller is
279 * interested in knowing usable channels for P2P CLI, P2P GO & NAN,
280 * ifaceModeMask would be set to
281 * IFACE_MODE_P2P_CLIENT|IFACE_MODE_P2P_GO|IFACE_MODE_NAN.
282 * @param filterMask Bitmask of filters represented by
283 * |UsableChannelFilter|. Specifies whether driver should filter
284 * channels based on additional criteria. If no filter is specified
285 * driver should return usable channels purely based on regulatory
286 * constraints.
Kumar Anand2a630a32021-01-21 14:09:14 -0800287 * @return status WifiStatus of the operation.
288 * Possible status codes:
289 * |WifiStatusCode.SUCCESS|,
290 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
291 * |WifiStatusCode.ERROR_INVALID_ARGS|,
292 * |WifiStatusCode.FAILURE_UNKNOWN|
293 * @return channels List of channels represented by |WifiUsableChannel|
294 * Each entry represents a channel frequency, bandwidth and
Kumar Anandaea86e02021-02-10 16:22:31 -0800295 * bitmask of modes (e.g. STA, SAP, CLI, GO, TDLS, NAN) that are
296 * allowed on that channel. E.g. If only STA mode can be supported
297 * on an indoor channel, only the IFACE_MODE_STA bit would be set
298 * for that channel. If 5GHz SAP cannot be supported, then none of
299 * the 5GHz channels will have IFACE_MODE_SOFTAP bit set.
300 * Note: Bits do not represent concurrency state. Each bit only
301 * represents whether particular mode is allowed on that channel.
Kumar Anand2a630a32021-01-21 14:09:14 -0800302 */
Kumar Anandaea86e02021-02-10 16:22:31 -0800303 getUsableChannels(WifiBand band, bitfield<WifiIfaceMode> ifaceModeMask,
304 bitfield<UsableChannelFilter> filterMask)
Kumar Anand2a630a32021-01-21 14:09:14 -0800305 generates (WifiStatus status, vec<WifiUsableChannel> channels);
chenpaulc6f57032021-03-05 17:06:50 +0800306
307 /**
308 * Trigger subsystem restart
309 *
310 * If the framework detects a problem (e.g. connection failure),
311 * it must call this function to attempt recovery.
312 *
313 * When the wifi HAL receiveds triggerSubsystemRestart(), it must restart
314 * the wlan subsystem, especially the wlan firmware.
315 *
316 * Regarding the callback function for subsystem restart, refer to documentation of
317 * |IWifiEventCallback.onSubsystemRestart| for details.
318 *
319 * @return status WifiStatus of the operation.
320 * Possible status codes:
321 * |WifiStatusCode.SUCCESS|,
322 * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
323 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
324 * |WifiStatusCode.ERROR_UNKNOWN|
325 */
326 triggerSubsystemRestart() generates (WifiStatus status);
Jimmy Chen1bdf1a72019-12-23 17:53:40 +0200327};