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
parent 7b90f6cdfe
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;
}

View File

@@ -2252,4 +2252,18 @@ QDF_STATUS wmi_unified_invoke_neighbor_report_cmd(void *wmi_hdl,
wmi_host_channel_width wmi_get_ch_width_from_phy_mode(void *wmi_hdl,
WMI_HOST_WLAN_PHY_MODE phymode);
#ifdef QCA_SUPPORT_CP_STATS
/**
* wmi_extract_cca_stats() - api to extract congestion stats from event buffer
* @wmi_handle: wma handle
* @evt_buf: event buffer
* @datalen: length of buffer
* @stats: buffer to populated after stats extraction
*
* Return: status of operation
*/
QDF_STATUS wmi_extract_cca_stats(wmi_unified_t wmi_handle, void *evt_buf,
struct wmi_host_congestion_stats *stats);
#endif /* QCA_SUPPORT_CP_STATS */
#endif /* _WMI_UNIFIED_API_H_ */

View File

@@ -8391,4 +8391,19 @@ struct wmi_obss_color_collision_info {
uint32_t obss_color_bitmap_bit0to31;
uint32_t obss_color_bitmap_bit32to63;
};
#ifdef QCA_SUPPORT_CP_STATS
/**
* struct wmi_host_congestion_stats - host definition of congestion stats
* @vdev_id: ID of the vdev to which this info belongs.
* @congestion: This field holds the congestion percentage =
* (busy_time/total_time)*100
* for the interval from when the vdev was started to the current time
* (or the time at which the vdev was stopped).
*/
struct wmi_host_congestion_stats {
uint32_t vdev_id;
uint32_t congestion;
};
#endif
#endif /* _WMI_UNIFIED_PARAM_H_ */

View File

@@ -1616,6 +1616,11 @@ QDF_STATUS (*extract_twt_resume_dialog_comp_event)(wmi_unified_t wmi_handle,
uint8_t *evt_buf,
struct wmi_twt_resume_dialog_complete_event_param *params);
#endif
#ifdef QCA_SUPPORT_CP_STATS
QDF_STATUS (*extract_cca_stats)(wmi_unified_t wmi_handle, void *evt_buf,
struct wmi_host_congestion_stats *stats);
#endif /* QCA_SUPPORT_CP_STATS */
};
/* Forward declartion for psoc*/

View File

@@ -7482,3 +7482,15 @@ wmi_host_channel_width wmi_get_ch_width_from_phy_mode(void *wmi_hdl,
else
return WMI_HOST_CHAN_WIDTH_20;
}
#ifdef QCA_SUPPORT_CP_STATS
QDF_STATUS wmi_extract_cca_stats(wmi_unified_t wmi_handle, void *evt_buf,
struct wmi_host_congestion_stats *stats)
{
if (wmi_handle->ops->extract_cca_stats)
return wmi_handle->ops->extract_cca_stats(wmi_handle, evt_buf,
stats);
return QDF_STATUS_E_FAILURE;
}
#endif /* QCA_SUPPORT_CP_STATS */

View File

@@ -17806,6 +17806,36 @@ static QDF_STATUS extract_ndp_end_ind_tlv(wmi_unified_t wmi_handle,
}
#endif
#ifdef QCA_SUPPORT_CP_STATS
/**
* extract_cca_stats_tlv - api to extract congestion stats from event buffer
* @wmi_handle: wma handle
* @evt_buf: event buffer
* @out_buff: buffer to populated after stats extraction
*
* Return: status of operation
*/
static QDF_STATUS extract_cca_stats_tlv(wmi_unified_t wmi_handle,
void *evt_buf, struct wmi_host_congestion_stats *out_buff)
{
WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf;
wmi_congestion_stats *congestion_stats;
param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *)evt_buf;
congestion_stats = param_buf->congestion_stats;
if (!congestion_stats) {
WMI_LOGD("%s: no cca stats in event buffer", __func__);
return QDF_STATUS_E_INVAL;
}
out_buff->vdev_id = congestion_stats->vdev_id;
out_buff->congestion = congestion_stats->congestion;
WMI_LOGD("%s: cca stats event processed", __func__);
return QDF_STATUS_SUCCESS;
}
#endif /* QCA_SUPPORT_CP_STATS */
/**
* save_service_bitmap_tlv() - save service bitmap
* @wmi_handle: wmi handle
@@ -22891,6 +22921,9 @@ struct wmi_ops tlv_ops = {
extract_obss_color_collision_info_tlv,
.extract_comb_phyerr = extract_comb_phyerr_tlv,
.extract_single_phyerr = extract_single_phyerr_tlv,
#ifdef QCA_SUPPORT_CP_STATS
.extract_cca_stats = extract_cca_stats_tlv,
#endif
};
/**