diff options
author | Srinivas Dasari <dasaris@codeaurora.org> | 2015-10-01 17:10:31 +0530 |
---|---|---|
committer | Srinivas Dasari <dasaris@codeaurora.org> | 2016-01-20 16:18:28 +0530 |
commit | 045a80359d42a8f4bc136b51e42c173d11344099 (patch) | |
tree | 2d5697ac21050cca99dfb93c0da84194bee55530 | |
parent | 36438f66a163df59550d1eb57b59febcd63d5ce9 (diff) |
WiFi-HAL: Add support for beacon_received connectivity event
Allow start logging for connectivity events and parse the
received beacon event. Write the parsed data to ring buffer.
Change-Id: I8b9e77c5533dd8d4876642e901a92808cc7e159d
-rw-r--r-- | qcwcn/wifi_hal/common.cpp | 8 | ||||
-rw-r--r-- | qcwcn/wifi_hal/common.h | 1 | ||||
-rw-r--r-- | qcwcn/wifi_hal/wifilogger.cpp | 91 | ||||
-rw-r--r-- | qcwcn/wifi_hal/wifilogger_diag.cpp | 48 | ||||
-rw-r--r-- | qcwcn/wifi_hal/wifilogger_event_defs.h | 2 |
5 files changed, 103 insertions, 47 deletions
diff --git a/qcwcn/wifi_hal/common.cpp b/qcwcn/wifi_hal/common.cpp index a8f5e30..877fe22 100644 --- a/qcwcn/wifi_hal/common.cpp +++ b/qcwcn/wifi_hal/common.cpp @@ -267,6 +267,14 @@ void hexdump(void *buf, u16 len) ALOGI("******HexDump End***********"); } +/* Firmware sends RSSI value without noise floor. + * Add noise floor to the same and return absolute values. + */ +u8 get_rssi(u8 rssi_wo_noise_floor) +{ + return abs((int)rssi_wo_noise_floor - 96); +} + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/qcwcn/wifi_hal/common.h b/qcwcn/wifi_hal/common.h index a9dad84..c7dbf6e 100644 --- a/qcwcn/wifi_hal/common.h +++ b/qcwcn/wifi_hal/common.h @@ -179,6 +179,7 @@ extern "C" { #endif /* __cplusplus */ void hexdump(void *bytes, u16 len); +u8 get_rssi(u8 rssi_wo_noise_floor); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/qcwcn/wifi_hal/wifilogger.cpp b/qcwcn/wifi_hal/wifilogger.cpp index 277d41c..b0919c4 100644 --- a/qcwcn/wifi_hal/wifilogger.cpp +++ b/qcwcn/wifi_hal/wifilogger.cpp @@ -91,63 +91,60 @@ wifi_error wifi_start_logging(wifi_interface_handle iface, return WIFI_ERROR_UNKNOWN; } - if ((ring_id == POWER_EVENTS_RB_ID) || - (ring_id == PKT_STATS_RB_ID)) { - wifiLoggerCommand = new WifiLoggerCommand( - wifiHandle, - requestId, - OUI_QCA, - QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START); - - if (wifiLoggerCommand == NULL) { - ALOGE("%s: Error WifiLoggerCommand NULL", __FUNCTION__); - return WIFI_ERROR_UNKNOWN; - } - /* Create the NL message. */ - ret = wifiLoggerCommand->create(); + wifiLoggerCommand = new WifiLoggerCommand( + wifiHandle, + requestId, + OUI_QCA, + QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START); - if (ret < 0) - goto cleanup; + if (wifiLoggerCommand == NULL) { + ALOGE("%s: Error WifiLoggerCommand NULL", __FUNCTION__); + return WIFI_ERROR_UNKNOWN; + } + /* Create the NL message. */ + ret = wifiLoggerCommand->create(); - /* Set the interface Id of the message. */ - ret = wifiLoggerCommand->set_iface_id(ifaceInfo->name); + if (ret < 0) + goto cleanup; - if (ret < 0) - goto cleanup; + /* Set the interface Id of the message. */ + ret = wifiLoggerCommand->set_iface_id(ifaceInfo->name); - /* Add the vendor specific attributes for the NL command. */ - nlData = wifiLoggerCommand->attr_start(NL80211_ATTR_VENDOR_DATA); + if (ret < 0) + goto cleanup; - if (!nlData) - goto cleanup; + /* Add the vendor specific attributes for the NL command. */ + nlData = wifiLoggerCommand->attr_start(NL80211_ATTR_VENDOR_DATA); - if (wifiLoggerCommand->put_u32( - QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID, ring_id)) - { - goto cleanup; - } - if (wifiLoggerCommand->put_u32( - QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL, - verbose_level)) - { - goto cleanup; - } - if (wifiLoggerCommand->put_u32( - QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS, - flags)) - { - goto cleanup; - } + if (!nlData) + goto cleanup; - wifiLoggerCommand->attr_end(nlData); + if (wifiLoggerCommand->put_u32( + QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID, ring_id)) + { + goto cleanup; + } + if (wifiLoggerCommand->put_u32( + QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL, + verbose_level)) + { + goto cleanup; + } + if (wifiLoggerCommand->put_u32( + QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS, + flags)) + { + goto cleanup; + } - /* Send the msg and wait for a response. */ - ret = wifiLoggerCommand->requestResponse(); - if (ret) { - ALOGE("%s: Error %d happened. ", __FUNCTION__, ret); - } + wifiLoggerCommand->attr_end(nlData); + /* Send the msg and wait for a response. */ + ret = wifiLoggerCommand->requestResponse(); + if (ret) { + ALOGE("%s: Error %d happened. ", __FUNCTION__, ret); } + ALOGV("%s: Logging Started for %s.", __FUNCTION__, buffer_name); rb_start_logging(&info->rb_infos[ring_id], verbose_level, flags, max_interval_sec, min_data_size); diff --git a/qcwcn/wifi_hal/wifilogger_diag.cpp b/qcwcn/wifi_hal/wifilogger_diag.cpp index 2a29116..a7317f3 100644 --- a/qcwcn/wifi_hal/wifilogger_diag.cpp +++ b/qcwcn/wifi_hal/wifilogger_diag.cpp @@ -791,6 +791,45 @@ wifi_error process_firmware_prints(hal_info *info, u8 *buf, u16 length) return WIFI_SUCCESS; } +static wifi_error process_beacon_received_event(hal_info *info, + u8* buf, int length) +{ + wifi_ring_buffer_driver_connectivity_event *pConnectEvent; + wifi_ring_buffer_entry *pRingBufferEntry; + tlv_log *pTlv; + int tot_len = sizeof(wifi_ring_buffer_driver_connectivity_event); + u8 out_buf[RING_BUF_ENTRY_SIZE]; + wlan_beacon_received_payload_type *pBeaconRcvd; + u32 rssi; + wifi_error status; + + pRingBufferEntry = (wifi_ring_buffer_entry *)&out_buf[0]; + memset(pRingBufferEntry, 0, RING_BUF_ENTRY_SIZE); + pConnectEvent = (wifi_ring_buffer_driver_connectivity_event *) + (pRingBufferEntry + 1); + + pBeaconRcvd = (wlan_beacon_received_payload_type *)buf; + + pConnectEvent->event = WIFI_EVENT_BEACON_RECEIVED; + pTlv = &pConnectEvent->tlvs[0]; + + pTlv = addLoggerTlv(WIFI_TAG_BSSID, sizeof(pBeaconRcvd->bssid), + (u8 *)pBeaconRcvd->bssid, pTlv); + tot_len += sizeof(tlv_log) + sizeof(pBeaconRcvd->bssid); + + rssi = get_rssi(pBeaconRcvd->beacon_rssi); + pTlv = addLoggerTlv(WIFI_TAG_RSSI, + sizeof(rssi), (u8 *)&rssi, pTlv); + tot_len += sizeof(tlv_log) + sizeof(pBeaconRcvd->beacon_rssi); + + status = update_connectivity_ring_buf(info, pRingBufferEntry, tot_len); + if (status != WIFI_SUCCESS) { + ALOGE("Failed to write addba event into ring buffer"); + } + + return status; +} + static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) { u16 count = 0, id, payloadlen; @@ -876,6 +915,15 @@ static wifi_error process_fw_diag_msg(hal_info *info, u8* buf, u16 length) return status; } break; + case EVENT_WLAN_BEACON_EVENT: + status = process_beacon_received_event(info, + diag_msg_hdr->payload, + payloadlen); + if (status != WIFI_SUCCESS) { + ALOGE("Failed to process beacon received event"); + return status; + } + break; default: return WIFI_SUCCESS; } diff --git a/qcwcn/wifi_hal/wifilogger_event_defs.h b/qcwcn/wifi_hal/wifilogger_event_defs.h index baf9bee..575f9ac 100644 --- a/qcwcn/wifi_hal/wifilogger_event_defs.h +++ b/qcwcn/wifi_hal/wifilogger_event_defs.h @@ -61,6 +61,7 @@ typedef enum { EVENT_WLAN_EAPOL = 0xA8D, /* 96 bytes payload */ EVENT_WLAN_EXTSCAN_FEATURE_STOP = 0xAA3, EVENT_WLAN_EXTSCAN_RESULTS_AVAILABLE = 0xAA4, + EVENT_WLAN_BEACON_EVENT = 0xAA6, EVENT_WLAN_LOG_COMPLETE = 0xAA7, EVENT_MAX_ID = 0x0FFF @@ -427,6 +428,7 @@ typedef struct { /* EVENT_WLAN_BEACON_RECEIVED */ typedef struct { + u8 bssid[6]; u32 beacon_rssi; } __attribute__((packed)) wlan_beacon_received_payload_type; /* End EVENT_WLAN_BEACON_RECEIVED */ |