Commit graph

84 commits

Author SHA1 Message Date
Roshan Pius
7a41d9d59f wifi: Reset internal callback pointers on failure
If these are not reset, any subsequent calls will not be processed
because the callback pointers are set.

Bug: 33379596
Test: Compiles
Change-Id: Ia44385fc185b7cf262366af7b0e0e62c32a0d9a0
2016-12-08 17:58:50 -08:00
Roshan Pius
d476754bc0 wifi: Add support for RSSI monitoring
Bug: 31991459
Test: Compiles
Change-Id: I8794cea12a0d1c727bd0e37123152c8da11eeabf
2016-12-08 17:58:50 -08:00
Roshan Pius
e3f72ff344 wifi: Add method implementations in IWifiRttController
Hookup the legacy HAL functions to the corresponding HIDL methods in
WifiRttController and perform the necessary struct conversions.

Bug: 31991232
Test: Compiles
Change-Id: I7bd8bd7e7af2230699c079f1ad8e0a8b1e496026
2016-12-08 17:58:50 -08:00
Roshan Pius
970f031170 wifi: Add method implementations in IWifiStaIface
Hookup the legacy HAL functions to the corresponding HIDL methods in
WifiStaIface and perform the necessary struct conversions.

Bug: 31991459
Test: Compiles
Change-Id: I8c0b9be2e375dd7147408e41a88de3f1c6f98d08
2016-12-08 17:58:50 -08:00
Roshan Pius
e2d0ab52ea wifi: Add logger method implementations in IWifiChip
Hookup the legacy HAL functions to the corresponding HIDL methods in
WifiChip and perform the necessary struct conversions.

Bug: 32221997
Test: Compiles
Change-Id: I2b0cfd6484c7599e96e9edfcef18ac3148e28307
2016-12-08 17:58:50 -08:00
Roshan Pius
881d1f7823 wifi: Gscan struct conversion changes
Rename |Scan| to |Gscan| because that is the naming we've been using in
WifiLegacyHal.
Also group all the gscan related sturct conversion methods.

Bug: 31991459
Test: Compiles
Change-Id: Ie64bcc032a0058b5b20d0bb701020cdf7bf08890
2016-12-08 17:58:50 -08:00
Roshan Pius
f72df2e186 wifi: Add some more missing struct conversions
Add the remaining struct conversions and the feature set to HIDL
capabilities conversions. The legacy feature set is distributed based on
where the functionality is exposed to IWifiChip & IWifiStaIface HIDL
interfaces.

Bug: 31991459
Bug: 32221997
Test: Compiles
Change-Id: Ifdeac1bd7325b7a0581ec225b025ef0f6980c512
2016-12-08 17:58:50 -08:00
Roshan Pius
824e475cd1 wifi: Remove unused methods in IWifiRttController
These are currently unused in the legacy HAL function table and there
isn't any need for these to be migrated over to HIDL.

Bug: 31991232
Test: Compiles
Change-Id: I50611d1fd5a6ac276e7911ca1920c3d5ee2d5ba6
2016-12-08 17:58:50 -08:00
Roshan Pius
3fae9c82a0 wifi: Add RTT structure conversion methods
While there,
Hide |convertLegacyIeBlobToHidl| from hidl_struct_util.h. There is no
need for any of the HIDL objects to directly use this. They will be used
internally in |convertLegacyScanResultToHidl|.

Bug: 31991232
Test: Compiles
Change-Id: I5702906ea84e3c77fece7be5f9d48ff3ae418c41
2016-12-08 17:58:50 -08:00
Roshan Pius
32d0ca967a wifi: Convert packet fate structures from legacy to HIDL
While there fixed a couple of nits,
1. Correct a typo in one of the packet fate structs in the .hal file.
2. Renamed the scan data flag and added a helper function to convert the
legacy flag to it's equivalent and loop through it.

Bug: 32221997
Test: Compiles
Change-Id: I414a7731054e6400d22d4e6deae9495b48dce461
2016-12-08 17:58:50 -08:00
Roshan Pius
f5f51fd039 wifi: Begin NAN iface methods implementation
Start implementation of the NAN iface HIDL methods by plumbing the HIDL
stubs to the corresponding legacy HAL methods. The incoming HIDL struct
needs to be converted to legacy for the HIDL methods. The legacy HAL
structs needs to be converted to HIDL for callbacks.

This CL only has a couple of methods and some structure conversion.
etan@ will take over the rest.

Bug: 31991076
Test: Compiles
Change-Id: Ide348f4c3318822226bb7de93d091107c7465cd3
2016-12-08 17:58:50 -08:00
Roshan Pius
52947fbc7e wifi: Implement chip mode combinations
This is pretty hardcoded for now. We expose 2 chip modes:
1. STA mode: 1 STA and 1 P2P or NAN iface.
2. AP mode: 1 AP iface.

Implement the chip mode configuration related HIDL methods in
WifiChip and integrate WifiModeController. These is some change in the
order of calls invoked within the implementation to accomodate the
firmware reload:
a. Since the legacy HAL needs to reinitialized after
firmware reload, we can no longer do this in IWifi.start().
So, we'll defer this to IWifiChip.configureChip() now.
b. Refactor IWifi.startInternal() and IWifi.stopInternal() to pull
out the actual implementation into a separate helper functions and
let it invoke the required callbacks.

Bug: 31997422
Bug: 32018162
Test: Compiles
Change-Id: I461687d7ee92398bc47321e1baca609db65c7991
2016-12-07 15:42:08 -08:00
Roshan Pius
97334114c6 wifi: Split out initialize and start in WifiLegacyHal
We need to separate these because we need to invoke start() after every
firmware mode change (chip reconfigure).

While there,
1. Make InterfaceTool a member of the class.
2. Make the stop() symmetric with start(). i.e interface is set
down on stop immediately instead of waiting for the thread to stop.

Bug: 31997422
Test: Compiles
Change-Id: I202afcc70571188dc076a841249761bc97fcf817
2016-12-07 15:38:24 -08:00
Roshan Pius
a26a6e0807 wifi: Add firmware mode controller
This module will make the necessary calls to reconfigure the
driver/firmware in the required state.
The module assumes that the sysfs paths needed to be accessed has been
chowned to "wifi" at bootup in the device's .rc file.

Bug: 32018162
Test: Compiles
Change-Id: I827c5eb6b5b4a3810e912d4164dbc8ff0ef4d30c
2016-12-07 15:35:14 -08:00
Yifan Hong
e19e582bd5 Update makefiles for hidlizing IBase.
A new dependency android.hidl.base@1.0 is added for
all projects.

Also updated Android.mk for NFC hal (for java constants)

Test: mma

Change-Id: Ia70d0eb0d74de06475a339698386d383d491a43a
2016-12-03 01:08:59 -08:00
Roshan Pius
786c00d72e Merge "wifi: Don't include legacy hal header in wifi_status_util" 2016-12-02 20:29:01 +00:00
Treehugger Robot
3ff50102ed Merge "wifi: Add utility for struct conversions" 2016-12-02 18:21:45 +00:00
Roshan Pius
a4854ff317 wifi: Don't include legacy hal header in wifi_status_util
This was missed from the cleanup when we moved the libhardware_legacy
header inside the legacy_hal:: namespace.

Bug: 33274910
Test: Compiles
Change-Id: I233f5478733427c739d30bf41f20f120a4c4199a
2016-12-02 08:32:14 -08:00
Roshan Pius
e65edb1b73 wifi: Add utility for struct conversions
Add a new utility file (hidl_struct_util) which would contain helper
functions to convert legacy HAL structures to HIDL structures and vice
versa.
Added utility functions to convert:
1. Background scan params from HIDL to legacy.
2. Scan Result from legacy to HIDL.
3. Cached Scan results from legacy to HIDL.
4. Link layer stats from legacy to HIDL.

Bug: 31991459
Test: Compiles
Change-Id: I48a49b43d425f8cc3059241c4bd652b2346f2381
2016-12-02 08:31:33 -08:00
Treehugger Robot
832f1a7978 Merge "Always specify underlying enum type." 2016-12-01 17:15:54 +00:00
Steven Moreland
fd46bce1a9 Wifi: don't require C++11.
C++14 has been officially supported in the build system for a while now.
(see b/32019064).

Test: pass
Change-Id: I328b0bcf9e5c32e209e4efc1ac5b96afdb542a5a
2016-11-30 15:45:17 -08:00
Steven Moreland
73600f7955 Always specify underlying enum type.
Bug: 33197891
Test: compiles
Change-Id: I3d4822ea9a665708302d3bd1460425fddf1dcda9
2016-11-29 14:12:34 -08:00
Roshan Pius
2301209a9a wifi: Add NAN API wrappers in WifiLegacyHal
NAN API's are inherently asynchronous. So, add a function for registering
the various callbacks and add wrappers for all other NAN API's.

Bug: 31991076
Test: Compiles
Change-Id: I304a5d9d41b684f0778e0ace3601380153068e12
2016-11-28 15:31:19 -08:00
Roshan Pius
d8e915ab99 wifi: Add RTT API wrappers in WifiLegacyHal
These are just wrapper methods over the legacy RTT related HAL API's.
Note: Some of the RTT related API's have been intentionally left off
because they're no longer used.

Bug: 31991232
Test: Compiles
Change-Id: Ied19d9ec1d4347ead0c40ab3683a1a0bae704f90
2016-11-28 15:31:19 -08:00
Roshan Pius
8714a3e103 wifi: Add logger/debug API wrappers in WifiLegacyHal
Legacy HAL wrappers for the following debug functions:
1. Wake reason stats
2. Packet fate
3. Supported feature set
4. Ring buffer.

Bug: 32221997
Test: Compiles
Change-Id: Ie6c03aeefb0b6e711419cfa5451cddbeb3069cd0
2016-11-28 15:31:08 -08:00
Treehugger Robot
2fe5762cae Merge "Update makefiles for logging." 2016-11-24 16:41:20 +00:00
Steven Moreland
3e3a0998e0 Update makefiles for logging.
Bug: 32943424
Test: hidl_test
Change-Id: I86dc81935912861073497c07696378895a25f9ee
2016-11-21 16:19:57 -08:00
Roshan Pius
7cece41299 wifi: Add link layer stats API wrappers in WifiLegacyHal
Adds wrappers over the legacy HAL API for the following:
1. enable/disable link layer stats collection.
2. fetch link layer stats.

Note: Link layer stats structure is quite ugly. The wrapper stucture
declared here (LinkLayerStats) tries to separate out the pointer
elements and ignore the unnecessary variable size elements from them.

Bug: 31991459
Test: Compiles
Change-Id: I7c4188115786542866c7be56cf9f116b3f78e6a3
2016-11-21 10:57:45 -08:00
Roshan Pius
76ff302d57 wifi: Add gscan API wrappers in WifiLegacyHal
The legacy gscan API's were designed to be used in the following
sequence:
a) Start the scan using |wifi_start_gscan|.
b) Scan Events are indicated to the caller via the provided
|on_scan_event| callback.
c) When one of the result events are received, the caller is expected
to retrieve the cached results via |wifi_get_cached_gscan_results|.
There are some extra knobs here to determine if the results need to be
flushed after fetch or not.
d) Any scan failures are also notified via the provided
|on_scan_event| callback.
e) Full scan results are delivered one by one via the provided
|on_full_scan_result| callback.

In our use case step (b) above is always followed by step (c), so these
2 steps have been merged together in the HIDL interface:
a) Start the scan using |IWifiStaIface.startBackgroundScan|.
b) Scan results are now directly delivered via
|IWifiStaIfaceEventCallback.onBackgroundScanResults| callback.
c) Any scan failures will be delivered via
|IWifiStaIfaceEventCallback.onBackgroundScanFailure| callback.
d) Full scan results are delivered one by one via
|IWifiStaIfaceEventCallback.onBackgroundFullScanResult| callback.

Bug: 31991459
Test: Compiles
Change-Id: I0870eae095a667eec1d8de75fe1cc04a1b5a0bd3
2016-11-21 10:57:45 -08:00
Yifan Hong
63544eacb6 Split libhidl into base and transport.
Bug: 32756130

Test: mma
Change-Id: Id21cf23abe2910f26bb7895511862443b93dc112
2016-11-18 09:52:57 -08:00
Roshan Pius
0a47c187b9 wifi: Add APF/feature-set wrappers in WifiLegacyHal
Add wrappers for retrieving the feature set supported by the device &
APF functionality.

Bug: 31991459
Test: Compiles
Change-Id: I34b8896a21e34f688374750faefd589eca2a4de1
2016-11-17 08:09:10 -08:00
Roshan Pius
6cedc97e95 wifi: Move legacy hal types to a new namespace (2/2)
Changes in HIDL interface obejcts to use the new namespace for legacy
HAL.

Bug: 32242225
Test: Compiles
Change-Id: I7d0e9cee8656bd779a24d9eaede415317dceaf9b
2016-11-16 14:57:08 -08:00
Roshan Pius
955542e9a2 wifi: Move legacy hal types to a new namespace (1/2)
To prevent typename conflicts between the types in
"hardware_legacy/wifi_hal.h" and the HIDL interface,
Move all the legacy HAL types under a separate namespace (legacy_hal).

This is especially needed for Nan data types. Some of the typenames are
exactly the same in the legacy HAL header file and the HIDL interface.

Related changes,
Remove the use of |HalTool| class. This causes compilation failures
because it tries to include wifi_hal.h as well (but, that is now wrapped
inside a namespace).

Bug: 32242225
Test: Compiles
Change-Id: I937877798b81aea280d1797833745ae97fb02dc9
2016-11-16 14:57:07 -08:00
Roshan Pius
511cc493e3 wifi: Changes to WifiLegacy Hal
Changes in the CL:
a. Removed the usage of wifi_status_util in WifiLegacyHal. The
|legacyErrorToString| log will be done in the HIDL object. This is to
remove any reference of |WifiStatus|
b. Moved the cleanup of function pointers to a separate helper function
|invalidate|.
c. Moved static constants out of WifiLegacyHal class.

Bug: 32505551
Test: Compiles
Change-Id: I9dc3900c40cf30de2c0a4376d4de2b08076e2b5f
2016-11-16 14:57:07 -08:00
Roshan Pius
23f9f30344 wifi: Remove passthrough mode
Wifi HAL is not going to support HIDL passthrough mode. So, remove the
target definition.

Bug: 32376894
Test: Compiles
Change-Id: I43740541f576746826d75c6ac48a11bb2a619227
2016-11-16 14:57:07 -08:00
Roshan Pius
0c92d446a2 wifi: Stub implementation of WifiNanIface methods
Bug: 31991076
Test: Compiles
Change-Id: Ia3723a14af20176c08e6e466e8b55bb32c8f9d41
2016-11-16 14:57:07 -08:00
Roshan Pius
7913f5e49d wifi: Stub implementation of WifiRttController methods
Bug: 31991232
Test: Compiles
Change-Id: I90f803ae19746ef844280cd8df96987e350f8a3f
2016-11-16 14:57:07 -08:00
Roshan Pius
a04ba3fcb8 wifi: Stub implementation of WifiStaIface methods
Bug: 32221997
Bug: 31991459
Test: Compiles
Change-Id: Iefc68958befc549fd9100b29f84cb6e6d73efe95
2016-11-16 14:57:07 -08:00
Roshan Pius
7d08d7a16d wifi: Stub implementation of WifiChip methods
Bug: 32221997
Test: Compiles
Change-Id: I627a05ce17d8b0e87101f395c3b3d6c10d3c440c
2016-11-16 14:57:07 -08:00
Roshan Pius
907d4a234d wifi: Use hidl_return_util functions in Iface/Rtt
Modify the WifiIface & WifiRttController methods to the use the new helper
functions.

Bug: 32337072
Test: Compiles
Change-Id: I8ce5450f3012ea3ad699db3c780c0bf985492aad
2016-11-16 14:57:07 -08:00
Roshan Pius
3c86852a2e wifi: Use hidl_return_util functions in WifiChip
Modify the WifiChip methods to the use the new helper functions.

Also,
1. Modify the WifiLegacyHal.requestDriverMemoryDump &
WifiLegacyHal.requestDriverMemoryDump to return a vector of |uint8_t|
instead of |char| to avoid unnecessary typecasting in the HIDL methods.
2. Remove |createHidlVecOfIfaceNames| helper function as most of the
necessary conversion should be handled by hidl_vec/hidl_string
constructors.

Bug: 32337072
Test: Compiles

Change-Id: Ic0b7aa2a5a078e53d5bc5bef18995a3cc0f548a1
2016-11-16 14:57:07 -08:00
Roshan Pius
5647665827 wifi: Helper functions for invoking hidl cont callbacks
The helper functions are used to invoke an internal method which
implements the functionality and then invoke the HIDL callback
with the return values.

HIDL's auto-generated code uses on-stack callbacks to return
non-primitive/multiple values from HIDL methods. This is unwieldy and
the implementation of the method's functionality gets mixed up with the
semantics of handling these callbacks. This tries to hide the semantics
of HIDL auto-generated code from the functionality.

Converted all IWifi methods to use these new helper functions.

Bug: 32337072
Test: Compiles
Change-Id: I57cbafcc2ecb52ec5055f4bd80bc064bd438b850
2016-11-16 14:57:07 -08:00
Roshan Pius
734fea0d98 wifi: Make methods deliver status synchronously (3/3)
Make all the |IWifiIface|/|IWifiRttController| HIDL interface
methods return a synchronous status code. Change from using the event
callbacks to the synchronous callbacks for delivering status.

While there,
Use the default std::string to hidl_string constructor in status
callbacks.

Bug: 32056230
Bug: 32061909
Test: Compiles
Change-Id: Ifa06a11afb085bfd6684f7b997fb730d192018ea
2016-11-16 14:57:07 -08:00
Roshan Pius
5c05546fc9 wifi: Make methods deliver status synchronously (2/3)
Make all the |IWifiChip| HIDL interface methods return a synchronous
status code. Change from using the event callbacks to the synchronous
callbacks for delivering status.

While there,
1. Use std::tie to retrive values out of the legacy HAL functions returning
a pair.
2. Use the std::vector to hidl_vec constructor for returning vector of
ifnames.

Bug: 32056230
Bug: 32061909
Test: Compiles
Change-Id: Iac27521be17cd9852df04ad7d412e09160a08d33
2016-11-16 14:57:07 -08:00
Roshan Pius
503582ed94 wifi: Make methods deliver status synchronously (1/3)
Make the following |IWifi| HIDL interface methods return a synchronous
status code:
a) start()
b) stop()
The other methods in this interface do not have a failure case and hence
not returning a status code.

This changes the nature of event callbacks registered for each
interface. Previously, every operation's status was sent to all the
registered event callbacks. Now, only the caller is notified of the
operation's status via the passed synchronous callbacks. The event
callbacks are now used to broadcast only important state changes/events.

Bug: 32056230
Bug: 32061909
Test: Compiles
Change-Id: I95dc3fa139ac3ac7500d81e9e0dbc4f4de04e127
2016-11-16 14:57:02 -08:00
Roshan Pius
1922482a5c wifi: Rename failure_reason_util to wifi_status_util
The HIDL interface now returns a |WifiStatus| instance to indicate the
status of any operation. This is replacing the existing asynchronous
delivery of success or failure (using |FailureReason| instance).

Rename the existing util class to |wifi_status_util| and add a couple of
methods to create a |WifiStatus| instance with empty description.

Bug: 32056230
Test: Compiles
Change-Id: I8488f7cd7d6ad6bd7a0c3c82a7ef83299d877d45
2016-11-16 11:05:16 -08:00
Roshan Pius
02caa1b821 wifi(interface): Add status for all methods
Add missing status returns for a few HIDL methods. This is to keep the
interface consistent.

Bug: 32146455
Test: update_makefile.sh
Change-Id: Ia66fe4d00e884e5ce1e1906db77bb5ffdaebffdd
2016-11-16 11:05:16 -08:00
Roshan Pius
e0724f98b0 wifi(interface): Add wifi host debug wake up reason stats
These stats are used to determine if the device is being woken up
frequently by the wlan chipset. The stats structure describe all the
various resons for which the host was woken up by the wlan chipset
(firmware).

Bug: 32221997
Test: ./hardware/interfaces/update-makefiles.sh
Change-Id: Id52915348fef0283affcd834c6f1db5055e54ace
2016-11-16 11:05:16 -08:00
Roshan Pius
fe9ad36cb2 wifi(interface): Add wifi debug packet fate related interface
The packet fate debug mechanism is used to track the state of all the
packets transmitted/received during the association process.

Also,
Add the various debug capabilities in the respective interfaces.
All ring buffer, driver/firmware dump, etc related capabilities are in
IWifiChip object.
The packet fate capability is exposed in IWifiStaIface object.

Bug: 32221997
Test: ./hardware/interfaces/update-makefiles.sh
Change-Id: Ic6bf49d682b70a1cdcd18c69fc25a544921bd548
2016-11-16 11:05:16 -08:00
Roshan Pius
e3a02b07b6 wifi(interface): Add wifi debug ring buffer related interface
The debug ring buffers is a purely debug mechanism to let the driver
report debug info like connection events, power events, etc to the
framework.
The framework used to previously dump out the raw byte stream in
the bugreport and the vendors had some tools to parse out the data.
This is now being changed to provide the framework with the
internal ring buffer structs to ease parsing this data in framework
itself. This will eventually be used in the new wifilogd daemon.

Bug: 32221997
Test: ./hardware/interfaces/update-makefiles.sh
Change-Id: I2c90662cfa9d07ae6fc72198a286338dbaacbfc2
2016-11-16 11:05:16 -08:00