qcacmn: Add wmi support to extract telemetry stats from FW
Add wmi support to extract telemetry stats from FW. Change-Id: I050b22b594145739adcf7ddf8e6fc85866a27625 CRs-Fixed: 3376698
This commit is contained in:

committed by
Madan Koyyalamudi

parent
b590809644
commit
c56d208844
@@ -123,6 +123,56 @@ struct bmiss_infra_cp_stats_event {
|
|||||||
struct consecutive_bmiss_stats cons_bmiss_stats;
|
struct consecutive_bmiss_stats cons_bmiss_stats;
|
||||||
};
|
};
|
||||||
#endif /* CONFIG_WLAN_BMISS */
|
#endif /* CONFIG_WLAN_BMISS */
|
||||||
|
|
||||||
|
#ifdef WLAN_TELEMETRY_STATS_SUPPORT
|
||||||
|
/**
|
||||||
|
* struct ctrl_path_pmlo_telemetry_stats_struct - pmlo telemetry
|
||||||
|
* stats struct
|
||||||
|
* @pdev_id: pdev_id for identifying the PHY
|
||||||
|
* @dl_inbss_airtime_ac_be: ac_be airtime in dl inbss
|
||||||
|
* @dl_inbss_airtime_ac_bk: ac_bk airtime in dl inbss
|
||||||
|
* @dl_inbss_airtime_ac_vi: ac_vi airtime in dl inbss
|
||||||
|
* @dl_inbss_airtime_ac_vo: ac_vo airtime in dl inbss
|
||||||
|
* @ul_inbss_airtime_ac_be: ac_be airtime in ul inbss
|
||||||
|
* @ul_inbss_airtime_ac_bk: ac_bk airtime in ul inbss
|
||||||
|
* @ul_inbss_airtime_ac_vi: ac_vi airtime in ul inbss
|
||||||
|
* @ul_inbss_airtime_ac_vo: ac_vo airtime in ul inbss
|
||||||
|
* @estimated_air_time_ac_be: ac_be estimated air time
|
||||||
|
* @estimated_air_time_ac_bk: ac_bk estimated air time
|
||||||
|
* @estimated_air_time_ac_vi: ac_vi estimated air time
|
||||||
|
* @estimated_air_time_ac_vo: ac_vo estimated air time
|
||||||
|
* @avg_chan_lat_per_ac: array for Average channel latency per AC,
|
||||||
|
* units in micro seconds.
|
||||||
|
* @link_obss_airtime: Percentage of OBSS used air time per link,
|
||||||
|
* units in percentage.
|
||||||
|
* @link_idle_airtime: Idle/free airtime per link, units in percentage.
|
||||||
|
* @ul_inbss_airtime_non_ac: ul inBSS airtime occupied by non-AC traffic,
|
||||||
|
* units in percentage.
|
||||||
|
* @dl_inbss_airtime_non_ac: dl inBSS airtime occupied by non-AC traffic,
|
||||||
|
* units in percentage.
|
||||||
|
*/
|
||||||
|
struct ctrl_path_pmlo_telemetry_stats_struct {
|
||||||
|
uint32_t pdev_id;
|
||||||
|
uint32_t dl_inbss_airtime_ac_be : 8,
|
||||||
|
dl_inbss_airtime_ac_bk : 8,
|
||||||
|
dl_inbss_airtime_ac_vi : 8,
|
||||||
|
dl_inbss_airtime_ac_vo : 8;
|
||||||
|
uint32_t ul_inbss_airtime_ac_be : 8,
|
||||||
|
ul_inbss_airtime_ac_bk : 8,
|
||||||
|
ul_inbss_airtime_ac_vi : 8,
|
||||||
|
ul_inbss_airtime_ac_vo : 8;
|
||||||
|
uint32_t estimated_air_time_ac_be : 8,
|
||||||
|
estimated_air_time_ac_bk : 8,
|
||||||
|
estimated_air_time_ac_vi : 8,
|
||||||
|
estimated_air_time_ac_vo : 8;
|
||||||
|
uint32_t avg_chan_lat_per_ac[WIFI_AC_MAX];
|
||||||
|
uint32_t link_obss_airtime : 8,
|
||||||
|
link_idle_airtime : 8,
|
||||||
|
ul_inbss_airtime_non_ac : 8,
|
||||||
|
dl_inbss_airtime_non_ac : 8;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct infra_cp_stats_event - Event structure to store stats
|
* struct infra_cp_stats_event - Event structure to store stats
|
||||||
* @action: action for which this response was received
|
* @action: action for which this response was received
|
||||||
@@ -132,6 +182,8 @@ struct bmiss_infra_cp_stats_event {
|
|||||||
* @num_twt_infra_cp_stats: number of twt_infra_cp_stats buffers
|
* @num_twt_infra_cp_stats: number of twt_infra_cp_stats buffers
|
||||||
* available
|
* available
|
||||||
* @twt_infra_cp_stats: pointer to TWT session statistics structures
|
* @twt_infra_cp_stats: pointer to TWT session statistics structures
|
||||||
|
* @ctrl_path_pmlo_telemetry_stats_struct - pointer to pmlo
|
||||||
|
* telemetry stats struct
|
||||||
*
|
*
|
||||||
* This structure is used to store the statistics information
|
* This structure is used to store the statistics information
|
||||||
* extracted from firmware event(wmi_pdev_cp_fwstats_eventid)
|
* extracted from firmware event(wmi_pdev_cp_fwstats_eventid)
|
||||||
@@ -146,6 +198,9 @@ struct infra_cp_stats_event {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_WLAN_BMISS
|
#ifdef CONFIG_WLAN_BMISS
|
||||||
struct bmiss_infra_cp_stats_event *bmiss_infra_cp_stats;
|
struct bmiss_infra_cp_stats_event *bmiss_infra_cp_stats;
|
||||||
|
#endif
|
||||||
|
#ifdef WLAN_TELEMETRY_STATS_SUPPORT
|
||||||
|
struct ctrl_path_pmlo_telemetry_stats_struct *telemetry_stats;
|
||||||
#endif
|
#endif
|
||||||
/* Extend with other required infra_cp_stats structs */
|
/* Extend with other required infra_cp_stats structs */
|
||||||
};
|
};
|
||||||
|
@@ -58,7 +58,16 @@ wmi_unified_extract_infra_cp_stats(wmi_unified_t wmi_handle,
|
|||||||
void *evt_buf, uint32_t evt_buf_len,
|
void *evt_buf, uint32_t evt_buf_len,
|
||||||
struct infra_cp_stats_event *params);
|
struct infra_cp_stats_event *params);
|
||||||
|
|
||||||
QDF_STATUS wmi_stats_handler(void *buff, int32_t len,
|
/**
|
||||||
|
* wmi_stats_handler() - parse the wmi event and fill the stats values
|
||||||
|
* @wmi_handle: wmi handle
|
||||||
|
* @buff: Buffer containing wmi event
|
||||||
|
* @len: length of event buffer
|
||||||
|
* @params: buffer to hold parameters extracted from response event
|
||||||
|
*
|
||||||
|
* Return: QDF_STATUS_SUCCESS on success, else other qdf error values
|
||||||
|
*/
|
||||||
|
QDF_STATUS wmi_stats_handler(wmi_unified_t wmi_handle, void *buff, int32_t len,
|
||||||
struct infra_cp_stats_event *params);
|
struct infra_cp_stats_event *params);
|
||||||
|
|
||||||
QDF_STATUS
|
QDF_STATUS
|
||||||
|
@@ -230,15 +230,96 @@ void wmi_bmiss_extract_stats_struct(void *tag_buf,
|
|||||||
|
|
||||||
#endif/* CONFIG_WLAN_BMISS */
|
#endif/* CONFIG_WLAN_BMISS */
|
||||||
|
|
||||||
|
#ifdef WLAN_TELEMETRY_STATS_SUPPORT
|
||||||
|
static void
|
||||||
|
wmi_extract_ctrl_path_pmlo_stats_tlv(wmi_unified_t wmi_handle, void *tag_buf,
|
||||||
|
struct ctrl_path_pmlo_telemetry_stats_struct *param)
|
||||||
|
{
|
||||||
|
int idx = 0;
|
||||||
|
wmi_ctrl_path_pmlo_stats_struct *wmi_stats_buf = tag_buf;
|
||||||
|
|
||||||
|
param->pdev_id =
|
||||||
|
wmi_handle->ops->convert_target_pdev_id_to_host(wmi_handle,
|
||||||
|
wmi_stats_buf->pdev_id);
|
||||||
|
param->dl_inbss_airtime_ac_be =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_BE(wmi_stats_buf->dl_inbss_airtime_per_ac);
|
||||||
|
param->dl_inbss_airtime_ac_bk =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_BK(wmi_stats_buf->dl_inbss_airtime_per_ac);
|
||||||
|
param->dl_inbss_airtime_ac_vi =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_VI(wmi_stats_buf->dl_inbss_airtime_per_ac);
|
||||||
|
param->dl_inbss_airtime_ac_vo =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_VO(wmi_stats_buf->dl_inbss_airtime_per_ac);
|
||||||
|
param->ul_inbss_airtime_ac_be =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_BE(wmi_stats_buf->ul_inbss_airtime_per_ac);
|
||||||
|
param->ul_inbss_airtime_ac_bk =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_BK(wmi_stats_buf->ul_inbss_airtime_per_ac);
|
||||||
|
param->ul_inbss_airtime_ac_vi =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_VI(wmi_stats_buf->ul_inbss_airtime_per_ac);
|
||||||
|
param->ul_inbss_airtime_ac_vo =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_VO(wmi_stats_buf->ul_inbss_airtime_per_ac);
|
||||||
|
param->estimated_air_time_ac_be =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_BE(wmi_stats_buf->estimated_air_time_per_ac);
|
||||||
|
param->estimated_air_time_ac_bk =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_BK(wmi_stats_buf->estimated_air_time_per_ac);
|
||||||
|
param->estimated_air_time_ac_vi =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_VI(wmi_stats_buf->estimated_air_time_per_ac);
|
||||||
|
param->estimated_air_time_ac_vo =
|
||||||
|
WMI_PMLO_UL_DL_INBSS_AT_GET_VO(wmi_stats_buf->estimated_air_time_per_ac);
|
||||||
|
param->link_obss_airtime =
|
||||||
|
WMI_PMLO_LINK_OBSS_AT_GET(wmi_stats_buf->ul_dl_obss_free_aa_word32);
|
||||||
|
param->link_idle_airtime =
|
||||||
|
WMI_PMLO_LINK_AA_GET(wmi_stats_buf->ul_dl_obss_free_aa_word32);
|
||||||
|
param->ul_inbss_airtime_non_ac =
|
||||||
|
WMI_PMLO_UL_AIRTIME_NON_AC_GET(wmi_stats_buf->ul_dl_obss_free_aa_word32);
|
||||||
|
param->dl_inbss_airtime_non_ac =
|
||||||
|
WMI_PMLO_DL_AIRTIME_NON_AC_GET(wmi_stats_buf->ul_dl_obss_free_aa_word32);
|
||||||
|
for (idx = 0; idx < WMI_AC_MAX; idx++) {
|
||||||
|
param->avg_chan_lat_per_ac[idx] =
|
||||||
|
wmi_stats_buf->avg_chan_lat_per_ac[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
wmi_debug("pdev_id = %u", wmi_stats_buf->pdev_id);
|
||||||
|
wmi_debug("dl_inbss_airtime_per_ac = %u, ul_inbss_airtime_per_ac = %u, estimated_air_time_per_ac = %u, ul_dl_obss_free_aa_word32 = %u",
|
||||||
|
wmi_stats_buf->dl_inbss_airtime_per_ac,
|
||||||
|
wmi_stats_buf->ul_inbss_airtime_per_ac,
|
||||||
|
wmi_stats_buf->estimated_air_time_per_ac,
|
||||||
|
wmi_stats_buf->ul_dl_obss_free_aa_word32);
|
||||||
|
|
||||||
|
for (idx = 0; idx < WMI_AC_MAX; idx++) {
|
||||||
|
wmi_debug("avg_chan_lat_per_ac_sample-%u: avg_chan_lat_per_ac=%u",
|
||||||
|
idx,
|
||||||
|
wmi_stats_buf->avg_chan_lat_per_ac[idx]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void wmi_pmlo_extract_stats_struct(wmi_unified_t wmi_handle,
|
||||||
|
void *tag_buf,
|
||||||
|
struct infra_cp_stats_event *params)
|
||||||
|
{
|
||||||
|
struct ctrl_path_pmlo_telemetry_stats_struct *pmlo_params;
|
||||||
|
|
||||||
|
pmlo_params = params->telemetry_stats;
|
||||||
|
wmi_debug("PMLO TELEMETRY stats struct found");
|
||||||
|
wmi_extract_ctrl_path_pmlo_stats_tlv(wmi_handle, tag_buf, pmlo_params);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static void wmi_pmlo_extract_stats_struct(wmi_unified_t wmi_handle,
|
||||||
|
void *tag_buf,
|
||||||
|
struct infra_cp_stats_event *params)
|
||||||
|
{ }
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wmi_stats_extract_tag_struct: function to extract tag structs
|
* wmi_stats_extract_tag_struct: function to extract tag structs
|
||||||
|
* @wmi_handle: wmi handle
|
||||||
* @tag_type: tag type that is to be printed
|
* @tag_type: tag type that is to be printed
|
||||||
* @tag_buf: pointer to the tag structure
|
* @tag_buf: pointer to the tag structure
|
||||||
* @params: buffer to hold parameters extracted from response event
|
* @params: buffer to hold parameters extracted from response event
|
||||||
*
|
*
|
||||||
* Return: None
|
* Return: None
|
||||||
*/
|
*/
|
||||||
static void wmi_stats_extract_tag_struct(uint32_t tag_type, void *tag_buf,
|
static void wmi_stats_extract_tag_struct(wmi_unified_t wmi_handle,
|
||||||
|
uint32_t tag_type, void *tag_buf,
|
||||||
struct infra_cp_stats_event *params)
|
struct infra_cp_stats_event *params)
|
||||||
{
|
{
|
||||||
wmi_debug("tag_type %d", tag_type);
|
wmi_debug("tag_type %d", tag_type);
|
||||||
@@ -258,20 +339,16 @@ static void wmi_stats_extract_tag_struct(uint32_t tag_type, void *tag_buf,
|
|||||||
wmi_bmiss_extract_stats_struct(tag_buf, params);
|
wmi_bmiss_extract_stats_struct(tag_buf, params);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WMITLV_TAG_STRUC_wmi_ctrl_path_pmlo_stats_struct:
|
||||||
|
wmi_pmlo_extract_stats_struct(wmi_handle, tag_buf, params);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
QDF_STATUS wmi_stats_handler(wmi_unified_t wmi_handle, void *buff, int32_t len,
|
||||||
* wmi_stats_handler: parse the wmi event and fill the stats values
|
|
||||||
* @buff: Buffer containing wmi event
|
|
||||||
* @len: length of event buffer
|
|
||||||
* @params: buffer to hold parameters extracted from response event
|
|
||||||
*
|
|
||||||
* Return: QDF_STATUS_SUCCESS on success, else other qdf error values
|
|
||||||
*/
|
|
||||||
QDF_STATUS wmi_stats_handler(void *buff, int32_t len,
|
|
||||||
struct infra_cp_stats_event *params)
|
struct infra_cp_stats_event *params)
|
||||||
{
|
{
|
||||||
WMI_CTRL_PATH_STATS_EVENTID_param_tlvs *param_buf;
|
WMI_CTRL_PATH_STATS_EVENTID_param_tlvs *param_buf;
|
||||||
@@ -325,7 +402,7 @@ QDF_STATUS wmi_stats_handler(void *buff, int32_t len,
|
|||||||
tag_start_ptr = buf_ptr + WMI_TLV_HDR_SIZE;
|
tag_start_ptr = buf_ptr + WMI_TLV_HDR_SIZE;
|
||||||
curr_tlv_tag = WMITLV_GET_TLVTAG(
|
curr_tlv_tag = WMITLV_GET_TLVTAG(
|
||||||
WMITLV_GET_HDR(tag_start_ptr));
|
WMITLV_GET_HDR(tag_start_ptr));
|
||||||
wmi_stats_extract_tag_struct(curr_tlv_tag,
|
wmi_stats_extract_tag_struct(wmi_handle, curr_tlv_tag,
|
||||||
(void *)tag_start_ptr,
|
(void *)tag_start_ptr,
|
||||||
params);
|
params);
|
||||||
/* Move to next tag */
|
/* Move to next tag */
|
||||||
@@ -354,7 +431,7 @@ extract_infra_cp_stats_tlv(wmi_unified_t wmi_handle, void *evt_buf,
|
|||||||
uint32_t evt_buf_len,
|
uint32_t evt_buf_len,
|
||||||
struct infra_cp_stats_event *params)
|
struct infra_cp_stats_event *params)
|
||||||
{
|
{
|
||||||
wmi_stats_handler(evt_buf, evt_buf_len, params);
|
wmi_stats_handler(wmi_handle, evt_buf, evt_buf_len, params);
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +485,7 @@ prepare_infra_cp_stats_buf(wmi_unified_t wmi_handle,
|
|||||||
index = get_infra_cp_stats_id(stats_req->stats_id);
|
index = get_infra_cp_stats_id(stats_req->stats_id);
|
||||||
cmd_fixed_param->stats_id_mask = (1 << index);
|
cmd_fixed_param->stats_id_mask = (1 << index);
|
||||||
|
|
||||||
cmd_fixed_param->request_id = stats_req->action;
|
cmd_fixed_param->request_id = stats_req->request_id;
|
||||||
cmd_fixed_param->action = get_infra_cp_stats_action(stats_req->action);
|
cmd_fixed_param->action = get_infra_cp_stats_action(stats_req->action);
|
||||||
cmd_fixed_param->stat_periodicity = stats_req->stat_periodicity;
|
cmd_fixed_param->stat_periodicity = stats_req->stat_periodicity;
|
||||||
|
|
||||||
@@ -512,6 +589,14 @@ send_infra_cp_stats_request_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QCA_WIFI_EMULATION
|
#ifdef QCA_WIFI_EMULATION
|
||||||
|
/**
|
||||||
|
* send_stats_request_cmd_tlv() - WMI request stats function
|
||||||
|
* @wmi_handle: handle to WMI.
|
||||||
|
* @macaddr: MAC address
|
||||||
|
* @param: pointer to hold stats request parameter
|
||||||
|
*
|
||||||
|
* Return: QDF_STATUS on success, else failure.
|
||||||
|
*/
|
||||||
static QDF_STATUS
|
static QDF_STATUS
|
||||||
send_stats_request_cmd_tlv(wmi_unified_t wmi_handle,
|
send_stats_request_cmd_tlv(wmi_unified_t wmi_handle,
|
||||||
uint8_t macaddr[QDF_MAC_ADDR_SIZE],
|
uint8_t macaddr[QDF_MAC_ADDR_SIZE],
|
||||||
@@ -520,14 +605,6 @@ send_stats_request_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/**
|
|
||||||
* send_stats_request_cmd_tlv() - WMI request stats function
|
|
||||||
* @wmi_handle: handle to WMI.
|
|
||||||
* @macaddr: MAC address
|
|
||||||
* @param: pointer to hold stats request parameter
|
|
||||||
*
|
|
||||||
* Return: 0 on success and -ve on failure.
|
|
||||||
*/
|
|
||||||
static QDF_STATUS
|
static QDF_STATUS
|
||||||
send_stats_request_cmd_tlv(wmi_unified_t wmi_handle,
|
send_stats_request_cmd_tlv(wmi_unified_t wmi_handle,
|
||||||
uint8_t macaddr[QDF_MAC_ADDR_SIZE],
|
uint8_t macaddr[QDF_MAC_ADDR_SIZE],
|
||||||
|
@@ -20440,7 +20440,7 @@ struct wmi_ops tlv_ops = {
|
|||||||
#ifdef FEATURE_MEC_OFFLOAD
|
#ifdef FEATURE_MEC_OFFLOAD
|
||||||
.send_pdev_set_mec_timer_cmd = send_pdev_set_mec_timer_cmd_tlv,
|
.send_pdev_set_mec_timer_cmd = send_pdev_set_mec_timer_cmd_tlv,
|
||||||
#endif
|
#endif
|
||||||
#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
|
#if defined(WLAN_SUPPORT_INFRA_CTRL_PATH_STATS) || defined(WLAN_TELEMETRY_STATS_SUPPORT)
|
||||||
.extract_infra_cp_stats = extract_infra_cp_stats_tlv,
|
.extract_infra_cp_stats = extract_infra_cp_stats_tlv,
|
||||||
#endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
|
#endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */
|
||||||
.extract_cp_stats_more_pending =
|
.extract_cp_stats_more_pending =
|
||||||
|
Reference in New Issue
Block a user