OSDN Git Service

adjust gscan and wifi_logger headers
[android-x86/hardware-libhardware_legacy.git] / include / hardware_legacy / wifi_logger.h
index 2880eb8..0f9ec0a 100644 (file)
@@ -36,13 +36,15 @@ extern "C"
 typedef int wifi_radio;\r
 typedef int wifi_ring_buffer_id;\r
 \r
+#define PER_PACKET_ENTRY_FLAGS_DIRECTION_TX 1 //  0: TX, 1: RX\r
+#define PER_PACKET_ENTRY_FLAGS_TX_SUCCESS 2 // whether packet was transmitted or received/decrypted successfully\r
+#define PER_PACKET_ENTRY_FLAGS_80211_HEADER 4 // has full 802.11 header, else has 802.3 header\r
+#define PER_PACKET_ENTRY_FLAGS_PROTECTED 8  // whether packet was encrypted\r
+\r
 typedef struct {\r
-    u8 direction:1; //  0: TX, 1: RX\r
-    u8 success:1; // whether packet was transmitted or received/decrypted successfully\r
-    u8 has_80211_header:1; // has full 802.11 header, else has 802.3 header\r
-    u8 protected_packet:1; // whether packet was encrypted\r
-    u8 tid:4; // transmit  or received tid\r
-    u8 MCS; // modulation and bandwidth\r
+    u8 flags;\r
+    u8 tid; // transmit or received tid\r
+    u16 MCS; // modulation and bandwidth\r
     u8 rssi; // TX: RSSI of ACK for that packet\r
              // RX: RSSI of packet\r
     u8 num_retries; // number of attempted retries\r
@@ -60,8 +62,9 @@ typedef struct {
     u8 data[0]; // packet data. The length of packet data is determined by the entry_size field of\r
                 // the wifi_ring_buffer_entry structure. It is expected that first bytes of the\r
                 // packet, or packet headers only (up to TCP or RTP/UDP headers) will be copied into the ring\r
-} wifi_ring_per_packet_status_entry;\r
+} __attribute__((packed)) wifi_ring_per_packet_status_entry;\r
 \r
+static char per_packet_status_ring_name[] = "wifi_per_packet_status"; // Ring buffer name for per-packet status ring\r
 \r
 // Below events refer to the wifi_connectivity_event ring and shall be supported\r
 \r
@@ -133,7 +136,7 @@ typedef struct {
     u16 tag;\r
     u16 length; // length of value\r
     u8 value[0];\r
-} tlv_log;\r
+} __attribute__((packed)) tlv_log;\r
 \r
 typedef struct {\r
     u16 event;\r
@@ -142,7 +145,7 @@ typedef struct {
                         // parameter as transmit rate, num retries, num scan result found etc...\r
                         // as well, event_data can include a vendor proprietary part which is\r
                         // understood by the developer only.\r
-} wifi_ring_buffer_driver_connectivity_event;\r
+} __attribute__((packed)) wifi_ring_buffer_driver_connectivity_event;\r
 \r
 // Ring buffer name for connectivity events ring\r
 static char connectivity_event_ring_name[] = "wifi_connectivity_events";\r
@@ -154,16 +157,15 @@ typedef struct {
     int status;   // 0 taken, 1 released\r
     int reason;   // reason why this wake lock is taken\r
     char name[0]; // null terminated\r
-} wake_lock_event;\r
+} __attribute__((packed)) wake_lock_event;\r
 \r
 typedef struct {\r
     u16 event;\r
     tlv_log tlvs[0];\r
-} wifi_power_event;\r
+} __attribute__((packed)) wifi_power_event;\r
 \r
 static char power_event_ring_name[] = "wifi_power_events";\r
 \r
-\r
 /**\r
  * This structure represent a logger entry within a ring buffer.\r
  * Wifi driver are responsible to manage the ring buffer and write the debug\r
@@ -179,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\r
  * the logs into android bugreports.\r
  */\r
+\r
+#define RING_BUFFER_ENTRY_FLAGS_HAS_BINARY 1 // set for binary entries\r
+#define RING_BUFFER_ENTRY_FLAGS_HAS_TIMESTAMP 2 // set if 64 bits timestamp is present\r
+\r
 typedef struct {\r
-    u16 entry_size:13;\r
-    u16 binary:1; //set for binary entries\r
-    u16 has_timestamp:1; //set if 64 bits timestamp is present\r
-    u16 reserved:1;\r
+    u16 entry_size;\r
+    u8 flags;\r
     u8 type; // Per ring specific\r
-    u8 resvd;\r
     u64 timestamp; //present if has_timestamp bit is set.\r
     union {\r
         u8 data[0];\r
         wifi_ring_buffer_driver_connectivity_event connectivity_event;\r
         wifi_ring_per_packet_status_entry packet_status;\r
+        wifi_power_event power_event;\r
         };\r
-} wifi_ring_buffer_entry;\r
+} __attribute__((packed)) wifi_ring_buffer_entry;\r
 \r
 #define WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES 0x00000001     // set if binary entries are present\r
-#define WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRI    0x00000002     // set if ascii entries are present\r
+#define WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES  0x00000002     // set if ascii entries are present\r
 \r
 /* ring buffer params */\r
 /**\r
@@ -208,11 +212,13 @@ typedef struct {
 typedef struct {\r
    u8 name[32];\r
    u32 flags;\r
-   u64 fd; // linux file descriptor for that buffer\r
+   wifi_ring_buffer_id ring_id; // unique integer representing the ring\r
    u32 ring_buffer_byte_size;   // total memory size allocated for the buffer\r
    u32 verbose_level; //\r
    u32 written_bytes; // number of bytes that was written to the buffer by driver, monotonously increasing integer\r
    u32 read_bytes;  // number of bytes that was read from the buffer by user land, monotonously increasing integer\r
+   u32 written_records;  // number of records that was written to the buffer by driver, monotonously increasing integer\r
+\r
 } wifi_ring_buffer_status;\r
 \r
 /**\r
@@ -265,15 +271,21 @@ wifi_error wifi_get_ring_buffers_status(wifi_request_id id,
 \r
 /* api to collect a firmware memory dump for a given iface */\r
 wifi_error wifi_get_firmware_memory_dump(wifi_request_id id,\r
-        wifi_interface_handle iface, char * buffer, int buffer_size);\r
+        wifi_interface_handle iface, char ** buffer, int *buffer_size);\r
 \r
 /* api to collect a firmware version string */\r
 wifi_error wifi_get_firmware_version(wifi_request_id id,\r
-        wifi_interface_handle iface, char * buffer, int buffer_size);\r
+        wifi_interface_handle iface, char *buffer, int buffer_size);\r
 \r
 /* api to collect a driver version string */\r
 wifi_error wifi_get_driver_version(wifi_request_id id,\r
-        wifi_interface_handle iface, char * buffer, int buffer_size);\r
+        wifi_interface_handle iface, char *buffer, int buffer_size);\r
+\r
+\r
+/* api to collect driver records */\r
+wifi_error wifi_get_ringdata(wifi_request_id id,\r
+        wifi_interface_handle iface, wifi_ring_buffer_id ring_id);\r
+\r
 \r
 /* Feature set */\r
 #define WIFI_LOGGER_MEMORY_DUMP_SUPPORTED 1\r