From 08b10f046d538366b30898a76424982679763f88 Mon Sep 17 00:00:00 2001 From: Pierre Vandwalle Date: Wed, 18 Mar 2015 13:36:18 -0700 Subject: fix to hal interface Change-Id: I32f3e22fd19e79669ab8b117acd51352d132dbc3 --- include/hardware_legacy/gscan.h | 28 +++++++++++++++------ include/hardware_legacy/wifi_logger.h | 47 +++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/include/hardware_legacy/gscan.h b/include/hardware_legacy/gscan.h index 3cc8050..af74346 100644 --- a/include/hardware_legacy/gscan.h +++ b/include/hardware_legacy/gscan.h @@ -22,6 +22,7 @@ const unsigned MAX_HOTLIST_APS = 128; const unsigned MAX_SIGNIFICANT_CHANGE_APS = 64; const unsigned MAX_PNO_SSID = 128; const unsigned MAX_HOTLIST_SSID = 8; +const unsigned MAX_BLACKLIST_BSSID = 16; wifi_error wifi_get_valid_channels(wifi_interface_handle handle, int band, int max_channels, wifi_channel *channels, int *num_channels); @@ -33,7 +34,8 @@ typedef struct { int max_rssi_sample_size; // number of RSSI samples used for averaging RSSI int max_scan_reporting_threshold; // max possible report_threshold as described // in wifi_scan_cmd_params - int max_hotlist_aps; // maximum number of entries for hotlist APs + int max_hotlist_bssids; // maximum number of entries for hotlist BSSIDs + int max_hotlist_ssids; // maximum number of entries for hotlist SSIDs int max_significant_wifi_change_aps; // maximum number of entries for // significant wifi change APs int max_bssid_history_entries; // number of BSSID/RSSI entries that device can hold @@ -172,7 +174,7 @@ typedef struct { typedef struct { int lost_ap_sample_size; - int num_ap; // number of hotlist APs + int num_bssid; // number of hotlist APs ap_threshold_param ap[MAX_HOTLIST_APS]; // hotlist APs } wifi_bssid_hotlist_params; @@ -200,8 +202,8 @@ typedef struct { typedef struct { int lost_ssid_sample_size; - int num_ap; // number of hotlist APs - ssid_threshold_param ssid[MAX_HOTLIST_APS]; // hotlist APs + int num_ssid; // number of hotlist SSIDs + ssid_threshold_param ssid[MAX_HOTLIST_SSID]; // hotlist SSIDs } wifi_ssid_hotlist_params; @@ -212,6 +214,18 @@ wifi_error wifi_set_ssid_hotlist(wifi_request_id id, wifi_interface_handle iface /* Clear the SSID Hotlist */ wifi_error wifi_reset_ssid_hotlist(wifi_request_id id, wifi_interface_handle iface); + +/* BSSID blacklist */ +typedef struct { + int num_bssid; // number of blacklisted BSSIDs + mac_addr bssids[MAX_BLACKLIST_BSSID]; // blacklisted BSSIDs +} wifi_bssid_params; + +/* Set the BSSID blacklist */ +wifi_error wifi_set_bssid_blacklist(wifi_request_id id, wifi_interface_handle iface, + wifi_bssid_params params); + + /* Significant wifi change */ typedef struct { mac_addr bssid; // BSSID @@ -234,7 +248,7 @@ typedef struct { int rssi_sample_size; // number of samples for averaging RSSI int lost_ap_sample_size; // number of samples to confirm AP loss int min_breaching; // number of APs breaching threshold - int num_ap; // max 64 + int num_bssid; // max 64 ap_threshold_param ap[MAX_SIGNIFICANT_CHANGE_APS]; } wifi_significant_change_params; @@ -377,7 +391,7 @@ typedef struct { // Hysteresis: ensuring the currently associated BSSID is favored // so as to prevent ping-pong situations - int lazy_roam_histeresys; // boost applied to current BSSID + int lazy_roam_hysteresis; // boost applied to current BSSID // Alert mode enable, i.e. configuring when firmware enters alert mode int alert_roam_rssi_trigger; // RSSI below which "Alert" roam is enabled @@ -395,7 +409,7 @@ wifi_error wifi_enable_lazy_roam(wifi_request_id id, wifi_interface_handle iface * Per BSSID preference */ typedef struct { - char bssid[6]; + mac_addr bssid; int rssi_modifier; // modifier applied to the RSSI of the BSSID for the purpose of comparing // it with other roam candidate } wifi_bssid_preference; diff --git a/include/hardware_legacy/wifi_logger.h b/include/hardware_legacy/wifi_logger.h index 48f18b9..ceb8401 100644 --- a/include/hardware_legacy/wifi_logger.h +++ b/include/hardware_legacy/wifi_logger.h @@ -36,13 +36,15 @@ extern "C" typedef int wifi_radio; typedef int wifi_ring_buffer_id; +#define PER_PACKET_ENTRY_FLAGS_DIRECTION_TX 1 // 0: TX, 1: RX +#define PER_PACKET_ENTRY_FLAGS_TX_SUCCESS 2 // whether packet was transmitted or received/decrypted successfully +#define PER_PACKET_ENTRY_FLAGS_80211_HEADER 4 // has full 802.11 header, else has 802.3 header +#define PER_PACKET_ENTRY_FLAGS_PROTECTED 8 // whether packet was encrypted + typedef struct { - u8 direction:1; // 0: TX, 1: RX - u8 success:1; // whether packet was transmitted or received/decrypted successfully - u8 has_80211_header:1; // has full 802.11 header, else has 802.3 header - u8 protected_packet:1; // whether packet was encrypted - u8 tid:4; // transmit or received tid - u8 MCS; // modulation and bandwidth + u8 flags; + u8 tid; // transmit or received tid + u16 MCS; // modulation and bandwidth u8 rssi; // TX: RSSI of ACK for that packet // RX: RSSI of packet u8 num_retries; // number of attempted retries @@ -60,7 +62,7 @@ typedef struct { u8 data[0]; // packet data. The length of packet data is determined by the entry_size field of // the wifi_ring_buffer_entry structure. It is expected that first bytes of the // packet, or packet headers only (up to TCP or RTP/UDP headers) will be copied into the ring -} wifi_ring_per_packet_status_entry; +} wifi_ring_per_packet_status_entry __attribute__((packed)); static char per_packet_status_ring_name[] = "wifi_per_packet_status"; // Ring buffer name for per-packet status ring @@ -134,7 +136,7 @@ typedef struct { u16 tag; u16 length; // length of value u8 value[0]; -} tlv_log; +} tlv_log __attribute__((packed)); typedef struct { u16 event; @@ -143,7 +145,7 @@ typedef struct { // parameter as transmit rate, num retries, num scan result found etc... // as well, event_data can include a vendor proprietary part which is // understood by the developer only. -} wifi_ring_buffer_driver_connectivity_event; +} wifi_ring_buffer_driver_connectivity_event __attribute__((packed)); // Ring buffer name for connectivity events ring static char connectivity_event_ring_name[] = "wifi_connectivity_events"; @@ -155,16 +157,15 @@ typedef struct { int status; // 0 taken, 1 released int reason; // reason why this wake lock is taken char name[0]; // null terminated -} wake_lock_event; +} wake_lock_event __attribute__((packed)); typedef struct { u16 event; tlv_log tlvs[0]; -} wifi_power_event; +} wifi_power_event __attribute__((packed)); static char power_event_ring_name[] = "wifi_power_events"; - /** * This structure represent a logger entry within a ring buffer. * Wifi driver are responsible to manage the ring buffer and write the debug @@ -180,23 +181,25 @@ static char power_event_ring_name[] = "wifi_power_events"; * data logged by drivers into their ring buffer, store the data into log files and include * the logs into android bugreports. */ + +#define RING_BUFFER_ENTRY_FLAGS_HAS_BINARY 1 // set for binary entries +#define RING_BUFFER_ENTRY_FLAGS_HAS_TIMESTAMP 2 // set if 64 bits timestamp is present + typedef struct { - u16 entry_size:13; - u16 binary:1; //set for binary entries - u16 has_timestamp:1; //set if 64 bits timestamp is present - u16 reserved:1; + u16 entry_size; + u8 flags; u8 type; // Per ring specific - u8 resvd; u64 timestamp; //present if has_timestamp bit is set. union { u8 data[0]; wifi_ring_buffer_driver_connectivity_event connectivity_event; wifi_ring_per_packet_status_entry packet_status; + wifi_power_event power_event; }; -} wifi_ring_buffer_entry; +} wifi_ring_buffer_entry __attribute__((packed)); #define WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES 0x00000001 // set if binary entries are present -#define WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRI 0x00000002 // set if ascii entries are present +#define WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES 0x00000002 // set if ascii entries are present /* ring buffer params */ /** @@ -268,15 +271,15 @@ wifi_error wifi_get_ring_buffers_status(wifi_request_id id, /* api to collect a firmware memory dump for a given iface */ wifi_error wifi_get_firmware_memory_dump(wifi_request_id id, - wifi_interface_handle iface, char * buffer, int buffer_size); + wifi_interface_handle iface, char ** buffer, int *buffer_size); /* api to collect a firmware version string */ wifi_error wifi_get_firmware_version(wifi_request_id id, - wifi_interface_handle iface, char * buffer, int buffer_size); + wifi_interface_handle iface, char *buffer, int buffer_size); /* api to collect a driver version string */ wifi_error wifi_get_driver_version(wifi_request_id id, - wifi_interface_handle iface, char * buffer, int buffer_size); + wifi_interface_handle iface, char *buffer, int buffer_size); /* api to collect driver records */ -- cgit v1.1