blob: 209190a75961af762978cd23a2707e5a4deb5d61 [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 /**
239 * Retrieve list of usable Wifi channels for the specified band &
240 * operational modes.
241 *
242 * The list of usable Wifi channels in a given band depends on factors
243 * like current country code, operational mode (e.g. STA, SAP, CLI, GO,
244 * TDLS, NAN) and any hard restrictons due to DFS, LTE Coex and
245 * MCC(multi channel-concurrency).
246 *
247 * @param band |WifiBand| for which list of usable channels is requested.
248 * @param ifaceModeMask Bitmask of the modes represented by |WifiIfaceMode|
249 * Bitmask respresents all the modes that the caller is interested
250 * in (e.g. STA, SAP, CLI, GO, TDLS, NAN).
251 * Note: Bitmask does not represent concurrency matrix.
252 * @return status WifiStatus of the operation.
253 * Possible status codes:
254 * |WifiStatusCode.SUCCESS|,
255 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
256 * |WifiStatusCode.ERROR_INVALID_ARGS|,
257 * |WifiStatusCode.FAILURE_UNKNOWN|
258 * @return channels List of channels represented by |WifiUsableChannel|
259 * Each entry represents a channel frequency, bandwidth and
260 * bitmask of operational modes (e.g. STA, SAP, CLI, GO, TDLS, NAN)
261 * allowed on that channel.
262 * Note: Bitmask does not represent concurrency matrix.
263 */
264 getUsableChannels(WifiBand band, bitfield<WifiIfaceMode> ifaceModeMask)
265 generates (WifiStatus status, vec<WifiUsableChannel> channels);
Jimmy Chen1bdf1a72019-12-23 17:53:40 +0200266};