Browse Source

qcacmn: Add new wmi ops extract_inst_rssi_stats_resp

Add new wmi ops extract_inst_rssi_stats_resp to extract instantaneous
rssi stats resp.

Change-Id: Idce8a5fb0036145aa14682997ca5101666772c70
CRs-Fixed: 3058799
Li Feng 3 years ago
parent
commit
9cba107914

+ 15 - 0
wmi/inc/wmi_unified_cp_stats_api.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -154,4 +155,18 @@ QDF_STATUS
 wmi_extract_peer_extd_stats(wmi_unified_t wmi_handle, void *evt_buf,
 			    uint32_t index,
 			    wmi_host_peer_extd_stats *peer_extd_stats);
+
+#ifdef WLAN_FEATURE_SON
+/**
+ * wmi_extract_inst_rssi_stats_resp() - extract inst rssi stats from event
+ * @wmi_handle: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @inst_rssi_resp: pointer to hold inst rssi stats
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_extract_inst_rssi_stats_resp(wmi_unified_t wmi_handle, void *evt_buf,
+			struct wmi_host_inst_rssi_stats_resp *inst_rssi_resp);
+#endif
 #endif /* _WMI_UNIFIED_CP_STATS_API_H_ */

+ 14 - 0
wmi/inc/wmi_unified_param.h

@@ -8204,4 +8204,18 @@ struct set_mec_timer_params {
 	uint32_t mec_aging_timer_threshold;
 };
 #endif
+
+#ifdef WLAN_FEATURE_SON
+/**
+ * struct wmi_host_inst_rssi_stats_resp - inst rssi stats
+ * @inst_rssi: instantaneous rssi above the noise floor in dB unit
+ * @peer_macaddr: peer mac address
+ * @vdev_id: vdev_id
+ */
+struct wmi_host_inst_rssi_stats_resp {
+	uint32_t inst_rssi;
+	struct qdf_mac_addr peer_macaddr;
+	uint32_t vdev_id;
+};
+#endif
 #endif /* _WMI_UNIFIED_PARAM_H_ */

+ 7 - 0
wmi/inc/wmi_unified_priv.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -2754,6 +2755,12 @@ QDF_STATUS
 				    void *evt_buf,
 				    struct wmi_mlo_link_set_active_resp *resp);
 #endif
+
+#ifdef WLAN_FEATURE_SON
+QDF_STATUS
+(*extract_inst_rssi_stats_resp)(wmi_unified_t wmi_handle, void *evt_buf,
+			struct wmi_host_inst_rssi_stats_resp *inst_rssi_resp);
+#endif
 };
 
 /* Forward declartion for psoc*/

+ 14 - 0
wmi/src/wmi_unified_cp_stats_api.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -130,3 +131,16 @@ wmi_extract_peer_extd_stats(wmi_unified_t wmi_handle, void *evt_buf,
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+#ifdef WLAN_FEATURE_SON
+QDF_STATUS
+wmi_extract_inst_rssi_stats_resp(wmi_unified_t wmi_handle, void *evt_buf,
+			struct wmi_host_inst_rssi_stats_resp *inst_rssi_resp)
+{
+	if (wmi_handle->ops->extract_inst_rssi_stats_resp)
+		return wmi_handle->ops->extract_inst_rssi_stats_resp(
+				wmi_handle, evt_buf, inst_rssi_resp);
+
+	return QDF_STATUS_E_FAILURE;
+}
+#endif

+ 41 - 0
wmi/src/wmi_unified_cp_stats_tlv.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -927,6 +928,45 @@ static void wmi_infra_cp_stats_ops_attach_tlv(struct wmi_ops *ops)
 }
 #endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
 
+#ifdef WLAN_FEATURE_SON
+/**
+ * extract_inst_rssi_stats_resp_tlv() - extract inst rssi stats from event
+ * @wmi_handle: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @inst_rssi_resp: Pointer to hold inst rssi response
+ *
+ * @Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS
+extract_inst_rssi_stats_resp_tlv(wmi_unified_t wmi_handle, void *evt_buf,
+			struct wmi_host_inst_rssi_stats_resp *inst_rssi_resp)
+{
+	WMI_INST_RSSI_STATS_EVENTID_param_tlvs *param_buf;
+	wmi_inst_rssi_stats_resp_fixed_param *event;
+
+	param_buf = (WMI_INST_RSSI_STATS_EVENTID_param_tlvs *)evt_buf;
+	event = (wmi_inst_rssi_stats_resp_fixed_param *)param_buf->fixed_param;
+
+	inst_rssi_resp->inst_rssi = event->iRSSI;
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(inst_rssi_resp->peer_macaddr.bytes,
+				   &event->peer_macaddr);
+	inst_rssi_resp->vdev_id = event->vdev_id;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static void
+wmi_inst_rssi_stats_ops_attach_tlv(struct wmi_ops *ops)
+{
+	ops->extract_inst_rssi_stats_resp = extract_inst_rssi_stats_resp_tlv;
+}
+#else
+static void
+wmi_inst_rssi_stats_ops_attach_tlv(struct wmi_ops *ops)
+{
+}
+#endif
+
 void wmi_cp_stats_attach_tlv(wmi_unified_t wmi_handle)
 {
 	struct wmi_ops *ops = wmi_handle->ops;
@@ -943,6 +983,7 @@ void wmi_cp_stats_attach_tlv(wmi_unified_t wmi_handle)
 	ops->extract_peer_extd_stats = extract_peer_extd_stats_tlv;
 	wmi_infra_cp_stats_ops_attach_tlv(ops);
 	ops->extract_pmf_bcn_protect_stats = extract_pmf_bcn_protect_stats_tlv,
+	wmi_inst_rssi_stats_ops_attach_tlv(ops);
 
 	wmi_mc_cp_stats_attach_tlv(wmi_handle);
 }