From cddf6fe9857328770e1622b005e5053f98b671c7 Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Sirasanagandla Date: Tue, 22 Nov 2016 21:28:54 +0530 Subject: [PATCH] qcacmn: Add support to query RCPI info RCPI is measure of received RF power in the selected channel for a received frame and is measured at the antenna connector and shall be measured over an entire frame. It is a monotonically increasing, logarithmic function of received power level. Wlan firmware computes RCPI. Add host support to query firmware for RCPI information of peer mac address in sta, p2p client, softap and p2p go modes. Change-Id: I27fe45e993bd9b157fe33ca08a56330c1c950d16 CRs-Fixed: 1093187 --- wmi_unified_api.h | 22 ++++++++++++++++++++++ wmi_unified_param.h | 43 +++++++++++++++++++++++++++++++++++++++++++ wmi_unified_priv.h | 7 +++++++ 3 files changed, 72 insertions(+) diff --git a/wmi_unified_api.h b/wmi_unified_api.h index 1cfba660f8..3101b32101 100644 --- a/wmi_unified_api.h +++ b/wmi_unified_api.h @@ -1551,6 +1551,28 @@ QDF_STATUS wmi_unified_roam_send_hlp_cmd(void *wmi_hdl, struct hlp_params *req_buf); #endif +/** + * wmi_unified_send_request_get_rcpi_cmd() - command to request rcpi value + * @wmi_hdl: wma handle + * @get_rcpi_param: rcpi params + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_send_request_get_rcpi_cmd(void *wmi_hdl, + struct rcpi_req *get_rcpi_param); + +/** + * wmi_extract_rcpi_response_event - api to extract RCPI event params + * @wmi_handle: wma handle + * @evt_buf: pointer to event buffer + * @res: pointer to hold rcpi response from firmware + * + * Return: QDF_STATUS_SUCCESS for successful event parse + * else QDF_STATUS_E_INVAL or QDF_STATUS_E_FAILURE + */ +QDF_STATUS wmi_extract_rcpi_response_event(void *wmi_hdl, void *evt_buf, + struct rcpi_res *res); + #ifdef WMI_INTERFACE_EVENT_LOGGING void wmi_print_cmd_log(wmi_unified_t wmi, uint32_t count, qdf_abstract_print *print, void *print_priv); diff --git a/wmi_unified_param.h b/wmi_unified_param.h index 5ebb1bd4af..0f23b8b99f 100644 --- a/wmi_unified_param.h +++ b/wmi_unified_param.h @@ -5405,6 +5405,7 @@ typedef enum { wmi_11d_new_country_event_id, wmi_get_arp_stats_req_id, wmi_service_available_event_id, + wmi_update_rcpi_event_id, wmi_events_max, } wmi_conv_event_id; @@ -7555,6 +7556,48 @@ typedef struct { uint32_t usr_list[GID_OVERLOAD_GROUP_COUNT]; } wmi_host_peer_gid_userpos_list_event; +/** + * enum rcpi_measurement_type - for identifying type of rcpi measurement + * @RCPI_MEASUREMENT_TYPE_AVG_MGMT: avg rcpi of mgmt frames + * @RCPI_MEASUREMENT_TYPE_AVG_DATA: avg rcpi of data frames + * @RCPI_MEASUREMENT_TYPE_LAST_MGMT: rcpi of last mgmt frame + * @RCPI_MEASUREMENT_TYPE_LAST_DATA: rcpi of last data frame + * @RCPI_MEASUREMENT_TYPE_INVALID: invalid rcpi measurement type + */ +enum rcpi_measurement_type { + RCPI_MEASUREMENT_TYPE_AVG_MGMT = 0x1, + RCPI_MEASUREMENT_TYPE_AVG_DATA = 0x2, + RCPI_MEASUREMENT_TYPE_LAST_MGMT = 0x3, + RCPI_MEASUREMENT_TYPE_LAST_DATA = 0x4, + RCPI_MEASUREMENT_TYPE_INVALID = 0x5, +}; + +/** + * struct rcpi_req - RCPI req parameter + * @vdev_id: virtual device id + * @measurement_type: type of rcpi from enum wmi_rcpi_measurement_type + * @mac_addr: peer mac addr for which measurement is required + */ +struct rcpi_req { + uint32_t vdev_id; + enum rcpi_measurement_type measurement_type; + uint8_t mac_addr[IEEE80211_ADDR_LEN]; +}; + +/** + * struct rcpi_res - RCPI response parameter + * @vdev_id: virtual device id + * @measurement_type: type of rcpi from enum wmi_rcpi_measurement_type + * @mac_addr: peer mac addr for which measurement is required + * @rcpi_value: value of RCPI computed by firmware + */ +struct rcpi_res { + uint32_t vdev_id; + enum rcpi_measurement_type measurement_type; + uint8_t mac_addr[IEEE80211_ADDR_LEN]; + int32_t rcpi_value; +}; + #define WMI_HOST_BOARD_MCN_STRING_MAX_SIZE 19 #define WMI_HOST_BOARD_MCN_STRING_BUF_SIZE \ (WMI_HOST_BOARD_MCN_STRING_MAX_SIZE+1) /* null-terminator */ diff --git a/wmi_unified_priv.h b/wmi_unified_priv.h index 64d569a025..d4007e80d0 100644 --- a/wmi_unified_priv.h +++ b/wmi_unified_priv.h @@ -1368,6 +1368,13 @@ QDF_STATUS (*extract_chainmask_tables)(wmi_unified_t wmi_handle, uint8_t *evt_buf, struct wlan_psoc_host_chainmask_table *chainmask_table); +QDF_STATUS (*send_get_rcpi_cmd)(wmi_unified_t wmi_handle, + struct rcpi_req *get_rcpi_param); + +QDF_STATUS (*extract_rcpi_response_event)(wmi_unified_t wmi_handle, + void *evt_buf, + struct rcpi_res *res); + #ifdef DFS_COMPONENT_ENABLE QDF_STATUS (*extract_dfs_cac_complete_event)(wmi_unified_t wmi_handle, uint8_t *evt_buf,