qcacmn: Request and process Beacon stats from FW
Request and process Beacon frames from FW using WMI command and event.
WMI_HOST_REQUEST_BCN_STAT is for beacon stats request and event processing.
Change-Id: I99250384868d62089a0f7d2acf94dd6e29ef67b9
CRs-Fixed: 2139393
diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h
index bfb388a..dc83af3 100644
--- a/wmi/inc/wmi_unified_api.h
+++ b/wmi/inc/wmi_unified_api.h
@@ -1474,6 +1474,9 @@
QDF_STATUS wmi_extract_vdev_extd_stats(void *wmi_hdl, void *evt_buf,
uint32_t index, wmi_host_vdev_extd_stats *vdev_extd_stats);
+QDF_STATUS wmi_extract_bcn_stats(void *wmi_hdl, void *evt_buf,
+ uint32_t index, wmi_host_bcn_stats *vdev_bcn_stats);
+
QDF_STATUS wmi_unified_send_power_dbg_cmd(void *wmi_hdl,
struct wmi_power_dbg_params *param);
diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h
index 29761a8..616f79e 100644
--- a/wmi/inc/wmi_unified_param.h
+++ b/wmi/inc/wmi_unified_param.h
@@ -815,6 +815,7 @@
WMI_HOST_REQUEST_INST_STAT = 0x40,
WMI_HOST_REQUEST_PEER_EXTD_STAT = 0x80,
WMI_HOST_REQUEST_VDEV_EXTD_STAT = 0x100,
+ WMI_HOST_REQUEST_BCN_STAT = 0x800,
} wmi_host_stats_id;
typedef struct {
@@ -4885,7 +4886,8 @@
* @num_peer_stats: number of peer stats event structures 0 or max peers
* @num_bcnflt_stats: number of beacon filter stats
* @num_chan_stats: number of channel stats
- * @pdev_id: pdev_id
+ * @pdev_id: device id for the radio
+ * @num_bcn_stats: number of beacon stats
*/
typedef struct {
wmi_host_stats_id stats_id;
@@ -4896,6 +4898,7 @@
uint32_t num_bcnflt_stats;
uint32_t num_chan_stats;
uint32_t pdev_id;
+ uint32_t num_bcn_stats;
} wmi_host_stats_event;
/**
@@ -5197,6 +5200,18 @@
} wmi_host_vdev_stats;
/**
+ * struct wmi_host_vdev_stats - vdev stats structure
+ * @vdev_id: unique id identifying the VDEV, generated by the caller
+ * @tx_bcn_succ_cnt: Total number of beacon frame transmitted successfully
+ * @tx_bcn_outage_cnt: Total number of failed beacons
+ */
+typedef struct {
+ uint32_t vdev_id;
+ uint32_t tx_bcn_succ_cnt;
+ uint32_t tx_bcn_outage_cnt;
+} wmi_host_bcn_stats;
+
+/**
* struct wmi_host_vdev_extd_stats - VDEV extended stats
* @vdev_id: unique id identifying the VDEV, generated by the caller
* @ppdu_aggr_cnt: No of Aggrs Queued to HW
diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h
index 229c13a..b0f3d9e 100644
--- a/wmi/inc/wmi_unified_priv.h
+++ b/wmi/inc/wmi_unified_priv.h
@@ -1276,6 +1276,9 @@
QDF_STATUS (*extract_vdev_extd_stats)(wmi_unified_t wmi_handle, void *evt_buf,
uint32_t index, wmi_host_vdev_extd_stats *vdev_extd_stats);
+QDF_STATUS (*extract_bcn_stats)(wmi_unified_t wmi_handle, void *evt_buf,
+ uint32_t index, wmi_host_bcn_stats *bcn_stats);
+
QDF_STATUS (*send_power_dbg_cmd)(wmi_unified_t wmi_handle,
struct wmi_power_dbg_params *param);
diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c
index eab22b1..cff120f 100644
--- a/wmi/src/wmi_unified_api.c
+++ b/wmi/src/wmi_unified_api.c
@@ -6408,6 +6408,26 @@
}
/**
+ * wmi_extract_bcn_stats() - extract beacon stats from event
+ * @wmi_handle: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @index: Index into beacon stats
+ * @vdev_bcn_stats: Pointer to hold beacon stats
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_bcn_stats(void *wmi_hdl, void *evt_buf,
+ uint32_t index, wmi_host_bcn_stats *vdev_bcn_stats)
+{
+ wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+ if (wmi_handle->ops->extract_bcn_stats)
+ return wmi_handle->ops->extract_bcn_stats(wmi_handle,
+ evt_buf, index, vdev_bcn_stats);
+ return QDF_STATUS_E_FAILURE;
+}
+
+/**
* wmi_unified_send_adapt_dwelltime_params_cmd() - send wmi cmd of
* adaptive dwelltime configuration params
* @wma_handle: wma handler
diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c
index 4223fbc..b069596 100644
--- a/wmi/src/wmi_unified_tlv.c
+++ b/wmi/src/wmi_unified_tlv.c
@@ -17677,6 +17677,10 @@
stats_param->stats_id = WMI_HOST_REQUEST_VDEV_RATE_STAT;
break;
+ case WMI_REQUEST_BCN_STAT:
+ stats_param->stats_id |= WMI_HOST_REQUEST_BCN_STAT;
+ break;
+
default:
stats_param->stats_id = 0;
break;
@@ -17689,6 +17693,7 @@
stats_param->num_peer_stats = ev->num_peer_stats;
stats_param->num_bcnflt_stats = ev->num_bcnflt_stats;
stats_param->num_chan_stats = ev->num_chan_stats;
+ stats_param->num_bcn_stats = ev->num_bcn_stats;
stats_param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
ev->pdev_id);
@@ -17864,6 +17869,43 @@
}
/**
+ * extract_bcn_stats_tlv() - extract bcn stats from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param index: Index into vdev stats
+ * @param bcn_stats: Pointer to hold bcn stats
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_bcn_stats_tlv(wmi_unified_t wmi_handle,
+ void *evt_buf, uint32_t index, wmi_host_bcn_stats *bcn_stats)
+{
+ WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf;
+ wmi_stats_event_fixed_param *ev_param;
+ uint8_t *data;
+
+ param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) evt_buf;
+ ev_param = (wmi_stats_event_fixed_param *) param_buf->fixed_param;
+ data = (uint8_t *) param_buf->data;
+
+ if (index < ev_param->num_bcn_stats) {
+ wmi_bcn_stats *ev = (wmi_bcn_stats *) ((data) +
+ ((ev_param->num_pdev_stats) * sizeof(wmi_pdev_stats)) +
+ ((ev_param->num_vdev_stats) * sizeof(wmi_vdev_stats)) +
+ ((ev_param->num_peer_stats) * sizeof(wmi_peer_stats)) +
+ ((ev_param->num_chan_stats) * sizeof(wmi_chan_stats)) +
+ ((ev_param->num_mib_stats) * sizeof(wmi_mib_stats)) +
+ (index * sizeof(wmi_bcn_stats)));
+
+ bcn_stats->vdev_id = ev->vdev_id;
+ bcn_stats->tx_bcn_succ_cnt = ev->tx_bcn_succ_cnt;
+ bcn_stats->tx_bcn_outage_cnt = ev->tx_bcn_outage_cnt;
+ }
+
+ return QDF_STATUS_SUCCESS;
+}
+
+/**
* extract_peer_stats_tlv() - extract peer stats from event
* @wmi_handle: wmi handle
* @param evt_buf: pointer to event buffer
@@ -20071,6 +20113,7 @@
.extract_pdev_ext_stats = extract_pdev_ext_stats_tlv,
.extract_vdev_stats = extract_vdev_stats_tlv,
.extract_peer_stats = extract_peer_stats_tlv,
+ .extract_bcn_stats = extract_bcn_stats_tlv,
.extract_bcnflt_stats = extract_bcnflt_stats_tlv,
.extract_peer_extd_stats = extract_peer_extd_stats_tlv,
.extract_chan_stats = extract_chan_stats_tlv,