qcacmn: Add target_if/wmi implementation of get congestion stats

Add changes to support get congestion stats(arp stats) from
within cp_stats component.

Change-Id: Ic3b2f020c0169c9113c1b40738f782cbb3b8f6c5
CRs-Fixed: 2222781
This commit is contained in:
Naveen Rawat 2018-04-13 16:38:36 -07:00 • committed by nshrivas
commit 0e634fab65
6 changed files with 113 additions and 0 deletions

View file

@ -54,6 +54,8 @@ static void target_if_cp_stats_free_stats_event(struct stats_event *ev)
ev->pdev_stats = NULL;
qdf_mem_free(ev->peer_stats);
ev->peer_stats = NULL;
qdf_mem_free(ev->cca_stats);
ev->cca_stats = NULL;
}
static QDF_STATUS target_if_cp_stats_extract_pdev_stats(
@ -130,6 +132,33 @@ static QDF_STATUS target_if_cp_stats_extract_peer_stats(
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS target_if_cp_stats_extract_cca_stats(
struct wmi_unified *wmi_hdl,
wmi_host_stats_event *stats_param,
struct stats_event *ev, uint8_t *data)
{
QDF_STATUS status;
struct wmi_host_congestion_stats stats = {0};
status = wmi_extract_cca_stats(wmi_hdl, data, &stats);
if (QDF_IS_STATUS_ERROR(status)) {
cp_stats_debug("no congestion stats");
return QDF_STATUS_SUCCESS;
}
ev->cca_stats = qdf_mem_malloc(sizeof(*ev->cca_stats));
if (!ev->cca_stats) {
cp_stats_err("malloc failed");
return QDF_STATUS_E_NOMEM;
}
ev->cca_stats->vdev_id = stats.vdev_id;
ev->cca_stats->congestion = stats.congestion;
return QDF_STATUS_SUCCESS;
}
static QDF_STATUS target_if_cp_stats_extract_event(struct wmi_unified *wmi_hdl,
struct stats_event *ev,
uint8_t *data)
@ -156,6 +185,11 @@ static QDF_STATUS target_if_cp_stats_extract_event(struct wmi_unified *wmi_hdl,
if (QDF_IS_STATUS_ERROR(status))
return status;
status = target_if_cp_stats_extract_cca_stats(wmi_hdl, &stats_param,
ev, data);
if (QDF_IS_STATUS_ERROR(status))
return status;
return QDF_STATUS_SUCCESS;
}