Commit graph

94 commits

Author SHA1 Message Date
George Burgess IV
2c0a47db87 wifi: fix a use of an uninitialized value
This `if` is executed once, so using `legacy_status` from a prior
execution is nonsensical.

Caught by the static analyzer:
> hardware/interfaces/wifi/1.5/default/wifi_chip.cpp:1053:39: warning:
1st function call argument is an uninitialized value
[clang-analyzer-core.CallAndMessage]

Bug: 173999527
Test: atest -c VtsHalWifiApV1_5TargetTest
Merged-In: Ib81f1496be53e453d9c99ede129a77bdaf860de7
Change-Id: Ib81f1496be53e453d9c99ede129a77bdaf860de7
2021-01-27 11:48:40 +00:00
Ye Jiao
c6b5f89b08 Notify scan-only mode to driver for power saving
If Wi-Fi driver knows it's in scan-only mode, it can save more power
than connect mode.

This change adds setScanMode in IWifiStaIface to allow Wi-Fi framework
to notify scan-only mode change to Wi-Fi driver.

Bug: 177811719
Test: atest VtsHalWifiV1_5TargetTest

Change-Id: I1dfbc24a0a3272c1341223aff36656be4a6fd21b
2021-01-22 23:05:30 +00:00
Quang Luong
ddf9401aa9 Merge "Fix 1.5::WifiBand inheritance" 2021-01-19 17:01:08 +00:00
lesl
90e6565e1e wifi: Add VTS for wifi hal and hostapd hal.
Tested on S5 and O6.
Found VTS gets failure on wlan1
b/177389456 to track for O6
b/177483254 to track for S5

But both of O6 and S5 will get pass because it uses wlan0.

Bug: 162686273
Bug: 173999527
Test: atest -c VtsHalWifiHostapdV1_3TargetTest
Test: atest -c VtsHalWifiApV1_5TargetTest
Change-Id: Idbaa7fb2f95abc954fda8daf8670e4a57b453030
2021-01-15 12:16:39 +08:00
Kumar Anand
38b1d5cb58 Merge "Wifi: Chip level API to set the country code" 2021-01-13 20:40:12 +00:00
Kumar Anand
da62c38e58 Wifi: Chip level API to set the country code
Country code is global setting across the Wifi chip
and not really Wifi interface (STA or AP) specific.
Framework should have the ability to set the country
code on a chip level without requiring supplicant
instance to be running. As long as there is at least
one active interface to communicate to kernel driver,
country code can be set and driver should apply the
setting globally.

Bug: 149936939
Test: VTS - VtsHalWifiV1_5TargetTest
Change-Id: I1be5dae34b216a6152d09605d055872d5345507c
2021-01-12 18:12:53 -08:00
Kai Shi
0b6341c67a Add dtim config optimization HAL API
Test: compilation and halutil test
Bug: 170678227
Change-Id: I4f7535a70e53bd55f02b70867d071c440ad1529f
2021-01-11 20:25:17 -08:00
Quang Luong
3000a60c2a Fix 1.5::WifiBand inheritance
1.5::WifiBand should inherit from 1.4::WifiBand.

Bug: 15365100
Test: build
Change-Id: Ic22cbed19fee274bbaadf282b0a492857bd3dcc5
2021-01-10 19:20:12 -08:00
lesl
f012b65dc0 wifi: fix incorrect active wlan iface in bridged mode
The hal use first active wlan iface to get chip info.
It should should return active wlan instance in bridged mode.

Bug: 162686273
Test: Manual test.
1. Wifi Off (SAA off), make sure bridged AP is first wlan iface
2. Enable bridged mode

Change-Id: Id5a3d5ab53c6ed34d5633be22ad56070f5f0d0e2
2021-01-08 20:58:39 +00:00
TreeHugger Robot
be136613f4 Merge "wifi: Fix removeIfaceInstanceFromBridgedApIfaceInternal" 2021-01-07 04:57:28 +00:00
lesl
819e37237a wifi: Fix removeIfaceInstanceFromBridgedApIfaceInternal
Fix the incorrect empty check.

Bug: 162686273
Test: Manual Test, shutdown instance works normally

Change-Id: I44c5c4adcc7a964e25b5fa5e291bb9b9f4932655
2021-01-07 09:49:21 +08:00
Peter Collingbourne
78471d9a24 Instead of including wifi_hal.h in the legacy_hal namespace, import the types.
Including the header inside a namespace leads to ODR violations,
which are normally benign but can cause problems if we want to use
something like CFI in the wifi HAL.

Change-Id: I80cc854632da7e18e5c208ba9210de44b31abbdb
2021-01-05 12:16:33 -08:00
TreeHugger Robot
254b3632a9 Merge "Add voip optimization HAL API" 2020-12-22 01:29:34 +00:00
Kai Shi
2ca7a11810 Add voip optimization HAL API
Test: compilation and halutil test
Bug: 166311728
Change-Id: I3173e733abe158e1b009ed8378d1963ca3b8b8e8
2020-12-17 14:15:12 -08:00
TreeHugger Robot
e898720840 Merge changes from topic "fixCoexRestrictions"
* changes:
  Add VTS test for IWifiChip::setCoexUnsafeChannels
  [WifiCoex] Add enum for wifi coex restrictions
2020-12-17 00:16:11 +00:00
Quang Luong
26cd156744 Add VTS test for IWifiChip::setCoexUnsafeChannels
Bug: 153651001
Test: atest VtsHalWifiV1_5TargetTest
Change-Id: Iaffbff3cf68b00572674ca423587387ef6569302
2020-12-16 05:05:57 +00:00
Quang Luong
ab70a83b05 [WifiCoex] Add enum for wifi coex restrictions
Add custom enum for wifi coex restrictions since IfaceType is not
suitable for use as a bitmask flag since it does not represent bit
positions.

Bug: 153651001
Test: build
Change-Id: I15575ea12784a778a3b358eea1b05b75319aa95b
2020-12-15 09:43:36 -08:00
lesl
5a46c958e2 wifi: Fix bridged interface property and allociation
1. The concurrent property name over the limitation.
Rename the property name.

2. When allocate bridged iface name, it needs to increase the idx to
avoid two ifaces use the same name.

Bug: 162686273
Test: atest -c VtsHalWifiApV1_0TargetTest
Test: atest -c VtsHalWifiApV1_4TargetTest
Test: atest -c VtsHalWifiApV1_5TargetTest
Change-Id: I388cdd812bd0448c03ad5ae982547629c1e5eff9
2020-12-14 17:17:44 +08:00
Quang Luong
94bcce5ec2 [WifiCoex] Add WifiChip HIDL APIs for coex
Add HIDL APIs to convey a list of unsafe Wifi channels to the driver for
coex channel avoidance.

Bug: 153651001
Test: build
Change-Id: I8b14f0e2d8855c1f1e363d612617256d8e928f30
2020-12-08 00:31:11 +00:00
Les Lee
334057470d Merge "wifi: Add AP interface idx mechanism & predefine interface support." 2020-12-04 06:43:34 +00:00
Colin Cross
b0a9ef07bb resolve merge conflicts of 9e1ee9bb30 to master
Test: I solemnly swear I tested this conflict resolution.
Bug: None
Change-Id: Iad05fce7dfa8832ed7c62326a908ab52b05268e0
2020-12-03 14:35:26 -08:00
lesl
261818bfaf wifi: Add AP interface idx mechanism & predefine interface support.
SAP Interface idx mechanism.
STA+STA support, AP+AP will use wlan2 & wlan3, single AP use wlan2
STA+STA doesn't support, AP+AP use wlan1 & wlan 2, single AP use
wlan 1
STA+AP doesn't support, AP + AP will take wlan0 & wlan 1 but single AP
use wlan0 (Ideally it should not happen)

Add predefine interface support for bridged AP interface.
(property: ro.vendor.sap.concurrent.interface)

PS: Rename: getApIfaceName to getPredefinedApIfaceName since it
duplicates public HAL API: getApIfaceName

AP+AP Part 4 includes:
1. Support API to indicate Bridged AP supported or not
2. SAP Interface idx mechanism.

Bug: 162686273
Bug: 173999527
Test: atest -c VtsHalWifiApV1_0TargetTest
Test: atest -c VtsHalWifiApV1_4TargetTest
Test: atest -c VtsHalWifiApV1_5TargetTest
Change-Id: I115e294ac2be201cfa3a58cfa0a8a98b481b29de
2020-12-03 15:17:45 +08:00
Les Lee
9135ee103e Merge "wifi: Add resetFactoryMac support (AP+AP Part 3)" 2020-12-03 03:09:38 +00:00
TreeHugger Robot
d4f4cb8a82 Merge "wifi: ignore SIGPIPE when dumping stats to dumpstate" 2020-12-02 04:51:43 +00:00
lesl
420c4fc3a7 wifi: Add resetFactoryMac support (AP+AP Part 3)
Support HAL API:resetToFactoryMacAddress to reset the MAC
to factory MAC on each instances in IWifiApIface.

AP+AP Part 3 includes:
1. Support resetToFactoryMac in IWifiApIface.Hal.
2. Vts support for non bridged API.
3. Framework support resetToFactoryMac in bridged Ap.

Test: atest -c VtsHalWifiApV1_5TargetTest
Test: atest -c VtsHalWifiApV1_4TargetTest
Test: atest -c VtsHalWifiApV1_0TargetTest
Bug: 162686273
Change-Id: Ic7f2c0d6f1d8bf46fabfbc874d5f2b74068e43cc
2020-12-02 10:00:15 +08:00
lesl
75915c3134 wifi: ignore SIGPIPE when dumping stats to dumpstate
If dumpstate closes the reading end of the pipe (likely due to timeout)
and wifi vendor hal attempts to write to the fd it received from
dumpstate, it will receive sig 13 (SIGPIPE), and is then killed.
We should protect wifi vendor hal from the abnormally behaved clients.

Sync patch from ag/12321138. Reference from b/172972545 &
b/161336019#comment29

Bug: 161336019
Bug: 172972545
Test: Manuel Test, Wifi works normally
Change-Id: Ie7de040ac4320f83500c18e74e3c58d63b4df1b7
2020-11-30 19:09:31 +08:00
lesl
94d2824a66 wifi: Add AP bridge operations support (AP+AP Part 2)
The bridge interface name will take "ap_br_" + ap interface name.
ex: The ap interface name is "wlan1".
The bridge interface name will be "ap_br_wlan1"
When OEM customize the ap interface name via property
"ro.vendor.wifi.sap.interface".

It will only apply on single AP mode.
i.e.
"ro.vendor.wifi.sap.interface" = "sap0"
Single AP mode: ap interface name = "sap0"
Dual AP mode:
bridge interface name = "ap_br_sap0"
first ap instance name:  get from "getSupportedIfaceName" + idx
ex: sap0
second ap instance name: get from "getSupportedIfaceName" + idx + 1
ex: sap1

PS: The VtsHalWifiApV1_5TargetTest will be added in another CL which
will update another SAP related HAL:IWifiApIface.hal.

AP+AP Part 2 includes:
1. Support bridge in libwifi_system_iface
2. WifiHal API
a. createBridgedApIface (Support create bridge mode AP)
b. removeIfaceInstanceFromBridgedApIface (Support remove one of the instance in bridge)
3. Framework:
Create bridge AP when multi-bands configured.

Bug: 162686273
Test: Manual Test (SAP enable normally)
Test: atest -c VtsHalWifiApV1_0TargetTest
Test: atest -c VtsHalWifiApV1_4TargetTest
Change-Id: I8be510778e9772bcf1539e4915384949cbe13127
2020-11-23 18:57:22 +08:00
lesl
c92aa85a6e wiif: Add AP bridge operations support (AP+AP Part 2)
AP+AP Part 2 includes:
1. Support bridge in libwifi_system_iface
2. WifiHal
a. createApIface_1_5 (Support create bridge mode AP)
b. removeApIface_1_5 (Support remove one of the instance in bridge)
3. Framework:
Create bridge AP when multi-bands configured.

Bug: 162686273
Test: Manual Test (SAP enable normally)
Change-Id: I518417add566ce4780a7e2e83af14460e6e8a217
2020-11-17 14:12:01 +08:00
Roshan Pius
2272ff8942 wifi(hal): Use debug property to select one of preset HAL iface combination
This will be useful for testing/debugging STA + STA & AP + AP feature.

Note: I originally planned to read the entire iface combination from the
property (i.e would be much more flexible), but that is way too complex
and error prone. So, instead pre-define some combinations that we would
want to switch between and use the property as an index.

Bug: 173044646
Test: Manual:
i) adb shell "/vendor/bin/sh -c '/vendor/bin/setprop
persist.vendor.debug.wifi.hal.preset_interface_combination_idx 0'"
ii) adb reboot
iii) Ensure that AP + AP was enabled.

Change-Id: Iea63835c39fce78307a056a5ed94efcbd35cdfb6
2020-11-12 19:06:12 -08:00
Roshan Pius
e9d1e7d384 wifi: Add STA + STA HIDL API's
Add the HIDL API's + shim + VTS tests.

Bug: 170305665
Test: atest VtsHalWifiV1_3TargetTest VtsHalWifiV1_5TargetTest
Change-Id: I26ada11aebfe8082bfda251cf7e6990e0aa08a06
2020-11-06 11:54:51 -08:00
Nate Jiang
3ec6781c35 [AWARE] Add support for instant communication mode
Bug: 160725208
Test: atest WifiNanIfaceTest,VtsHalWifiNanV1_0TargetTest, VtsHalWifiNanV1_2TargetTest, VtsHalWifiNanV1_4TargetTest, VtsHalWifiNanV1_5TargetTest

Change-Id: I66c8532dcd50d5702edbcd89005b9e7373659594
2020-10-15 17:15:46 -07:00
Jimmy Chen
5cbf6276f5 Wifi: support 60GHz (Wigig) band
Update WifiBand enum with new bands to support 60GHz band:
BAND_60GHZ - 60GHz band
BAND_24GHZ_5GHZ_6GHZ_60GHZ -
  2.4 GHz + 5 GHz (no DFS) + 6GHz + 60GHz
BAND_24GHZ_5GHZ_WITH_DFS_6GHZ_60GHZ -
  2.4 GHz + 5 GHz with DFS + 6GHz + 60GHz

Bug: 147495506
Test: atest VtsHalWifiV1_0TargetTest VtsHalWifiNanV1_0TargetTest VtsHalWifiApV1_0TargetTest \
            VtsHalWifiV1_1TargetTest \
            VtsHalWifiV1_2TargetTest VtsHalWifiNanV1_2TargetTest \
            VtsHalWifiV1_3TargetTest \
            VtsHalWifiApV1_4TargetTest VtsHalWifiNanV1_4TargetTest VtsHalWifiRttV1_4TargetTest
Change-Id: I7c7cc514b88b999cc33e9573ac65910c0c53417a
2020-09-02 10:56:56 +08:00
Jimmy Chen
1bdf1a79f4 Wifi: add new chip capability WIGIG
Add a new chip capability WIGIG, for chips that
can operate on the 60GHz band. This capability is
mapped to the vendor HAL feature WIFI_FEATURE_INFRA_60G.

Bug: 147522435
Test: atest VtsHalWifiV1_0TargetTest VtsHalWifiNanV1_0TargetTest VtsHalWifiApV1_0TargetTest \
            VtsHalWifiV1_1TargetTest \
            VtsHalWifiV1_2TargetTest VtsHalWifiNanV1_2TargetTest \
            VtsHalWifiV1_3TargetTest \
            VtsHalWifiApV1_4TargetTest VtsHalWifiNanV1_4TargetTest VtsHalWifiRttV1_4TargetTest
Change-Id: I37b1121c62acadb621dca5e38671c78817f592e1
2020-09-02 10:56:56 +08:00
TreeHugger Robot
30f8aa988b Merge "Make wifi hidl interfaces available to the platform" 2020-08-29 19:22:48 +00:00
Colin Cross
81dec9cfc4 Make wifi hidl interfaces available to the platform
The wifi hidl interfaces need apex_available: ["com.android.wifi"]
because the generated java interfaces are needed by the
com.android.wifi apex, but that causes the C interfaces to not
be available to the platform.  The unavailability was hidden
by b/154888298.  Explicitly mark them with "//apex_available:platform".

Bug: 154888298
Test: m checkbuild
Change-Id: I8959ec1454cce6817802bcc1785a34ba56adc99c
2020-08-28 15:05:59 -07:00
Nate Jiang
adce22ea9d resolve merge conflicts of 0bb061f863 to master
Change-Id: I0b13f3fc6edcfb2d5982ec13728753906f158c30
2020-08-27 20:46:32 +00:00
Oscar Shu
7f5630a638 Merge "Attach timestamp to ringbuffer generated files" 2020-08-18 20:03:18 +00:00
Paul Chen
70edf3aa19 Merge "resolve merge conflicts of c9b0df94dd to master" 2020-08-18 04:57:10 +00:00
xshu
f392fb4688 Attach timestamp to ringbuffer generated files
The file last modified time expressed in seconds from epoch is
attached to only the archived version of the file that is passed
to dumpstate.
Files stored on the device will still have no timestamp in their name.

Bug: 159808285
Test: manual verification
adb root
adb shell lshal debug android.hardware.wifi@1.5::IWifi >> archive.cpio
cpio -iv < archive.cpio
Verify that a timestamp is attached to the filename at the end:
connectivity_events_rbhOVjYpDdNY-1597364258

Change-Id: Iee0c2b37fc1d27cb979ec9125461416cd2d02549
2020-08-13 17:39:37 -07:00
Paul Chen
c15cc159d1 resolve merge conflicts of c9b0df94dd to master
Change-Id: Ifa847c55bafb9f268df08f009688398670a800f7
2020-08-12 05:51:22 +00:00
Jimmy Chen
2dddd79e16 Wifi: support multiple WIFI chips
The WIFI HAL API has support for multiple WIFI chips
(IWifiChip instances) however the implementation
is hard-coded to support only a single WIFI chip.
This change reworks the implementation so multiple
WIFI chips will be supported.
Support for multiple chips is based on the concept
that each chip is represented by its own vendor HAL
library.
The implementation will look for descriptor
files for vendor HAL libraries under
/vendor/etc/wifi/vendor_hals. It will parse
descriptors, dynamically load vendor HAL libraries
and create WifiLegacyHal and WifiChip objects for
each loaded vendor HAL library.
One of the descriptors should be marked with "primary"
flag. The implementation will create the first WifiChip
object for this library. Typically it is the one
providing the best WIFI functionality, which was
previously used as the only WIFI chip.
Additional support is added inside WifiChip and
WifiLegacyHal for getting available chip modes
and concurrency combinations from the vendor HAL
if available, and allowing the chip to override
network interface name when creating interfaces.
The mechanism for getting chip capabilities is
improved to allow getting chip-global capabilities,
which are independent of any created interfaces.
For example, if the framework needs to start
a SoftAP on the 60GHz band, it needs to find a
chip which supports this band, but before creating
any interface on the chip. The new mechanism allows
this.

Bug: 146922967
Test: atest VtsHalWifiV1_0TargetTest VtsHalWifiNanV1_0TargetTest VtsHalWifiApV1_0TargetTest \
            VtsHalWifiV1_1TargetTest \
            VtsHalWifiV1_2TargetTest VtsHalWifiNanV1_2TargetTest \
            VtsHalWifiV1_3TargetTest \
            VtsHalWifiApV1_4TargetTest VtsHalWifiNanV1_4TargetTest VtsHalWifiRttV1_4TargetTest
Change-Id: Ibdff93ea56aff186d4b5361ac77f6f448a0dfd45
2020-08-11 14:58:07 +08:00
Jimmy Chen
7a82ad8c6a Wifi: fix bug during WIFI HAL stop
In WifiChip::invalidateAndRemoveDependencies, the
iterator was not implemented correctly as it was
deleting objects while iterating. This could cause
the entire WIFI HAL to be restarted when disabling
WIFI.

Bug: 146922967
Test: atest VtsHalWifiV1_0TargetTest VtsHalWifiNanV1_0TargetTest VtsHalWifiApV1_0TargetTest \
            VtsHalWifiV1_1TargetTest \
            VtsHalWifiV1_2TargetTest VtsHalWifiNanV1_2TargetTest \
            VtsHalWifiV1_3TargetTest \
            VtsHalWifiApV1_4TargetTest VtsHalWifiNanV1_4TargetTest VtsHalWifiRttV1_4TargetTest
Change-Id: Id86f1a662684467d3b86a79b271144ac3055d0a0
2020-08-11 14:18:59 +08:00
xshu
0a0fe51a6a Ringbuffer stops logging after wifi toggle
Forces ringbuffer updates before writing zipped files to bugreport.
Also properly resets the ringbuffer callback when it's deregistered.

Bug: 161307741
Test: make vts -j64 && vts-tradefed run commandAndExit vts --module VtsHalWifiV1_0Target
Test: manual verification with triggering a bugreport
Test: manual verification with wifi toggles
Change-Id: I74deffda917054e20cfcf4f0dd90d778626c89d3
2020-07-23 19:24:35 -07:00
Jimmy Chen
d460df3f3b wifi: upgrade wifi interface to 1.5
Only a root interface is added and update relevant code.

Bug: 160834354
Test: atest VtsHalWifiV1_0TargetTest VtsHalWifiNanV1_0TargetTest VtsHalWifiApV1_0TargetTest \
            VtsHalWifiV1_1TargetTest \
            VtsHalWifiV1_2TargetTest VtsHalWifiNanV1_2TargetTest \
            VtsHalWifiV1_3TargetTest \
            VtsHalWifiApV1_4TargetTest VtsHalWifiNanV1_4TargetTest VtsHalWifiRttV1_4TargetTest
Change-Id: Ifdffa3a6996eca1d3c4b499258896cdfe5eb9c87
2020-07-22 13:20:39 +08:00