Jelajahi Sumber

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
Rajeev Kumar Sirasanagandla 8 tahun lalu
induk
melakukan
cddf6fe985
3 mengubah file dengan 72 tambahan dan 0 penghapusan
  1. 22 0
      wmi_unified_api.h
  2. 43 0
      wmi_unified_param.h
  3. 7 0
      wmi_unified_priv.h

+ 22 - 0
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);

+ 43 - 0
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 */

+ 7 - 0
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,