qcacmn: Add wbm head/tail pointer stats to dp_txrx_stats
Add wbm head/tail pointer stats to dp_txrx_stats and ring usage percentage for all SRC and DST rings. Stats added to the following cmd: iwpriv wlan0 txrx_stats 26 0 CRs-Fixed: 2865996 Change-Id: I7d144d87c5f3485ec9ba85f50b036b69a64e53c6
This commit is contained in:
@@ -8375,6 +8375,8 @@ char *dp_srng_get_str_from_hal_ring_type(enum hal_ring_type ring_type)
|
|||||||
return "Rxdma_monitor_desc";
|
return "Rxdma_monitor_desc";
|
||||||
case RXDMA_MONITOR_STATUS:
|
case RXDMA_MONITOR_STATUS:
|
||||||
return "Rxdma_monitor_status";
|
return "Rxdma_monitor_status";
|
||||||
|
case WBM_IDLE_LINK:
|
||||||
|
return "WBM_hw_idle_link";
|
||||||
default:
|
default:
|
||||||
dp_err("Invalid ring type");
|
dp_err("Invalid ring type");
|
||||||
break;
|
break;
|
||||||
|
@@ -4998,23 +4998,30 @@ dp_print_ring_stat_from_hal(struct dp_soc *soc, struct dp_srng *srng,
|
|||||||
uint32_t headp;
|
uint32_t headp;
|
||||||
int32_t hw_headp = -1;
|
int32_t hw_headp = -1;
|
||||||
int32_t hw_tailp = -1;
|
int32_t hw_tailp = -1;
|
||||||
|
uint32_t ring_usage;
|
||||||
const char *ring_name;
|
const char *ring_name;
|
||||||
struct hal_soc *hal_soc;
|
struct hal_soc *hal_soc;
|
||||||
|
|
||||||
if (soc && srng && srng->hal_srng) {
|
if (soc && srng && srng->hal_srng) {
|
||||||
hal_soc = (struct hal_soc *)soc->hal_soc;
|
hal_soc = (struct hal_soc *)soc->hal_soc;
|
||||||
ring_name = dp_srng_get_str_from_hal_ring_type(ring_type);
|
ring_name = dp_srng_get_str_from_hal_ring_type(ring_type);
|
||||||
|
|
||||||
hal_get_sw_hptp(soc->hal_soc, srng->hal_srng, &tailp, &headp);
|
hal_get_sw_hptp(soc->hal_soc, srng->hal_srng, &tailp, &headp);
|
||||||
|
ring_usage = hal_get_ring_usage(srng->hal_srng,
|
||||||
|
ring_type, &headp, &tailp);
|
||||||
|
|
||||||
DP_PRINT_STATS("%s:SW:Head pointer = %d Tail Pointer = %d\n",
|
DP_PRINT_STATS("%s:SW: Head = %d Tail = %d Ring Usage = %u",
|
||||||
ring_name, headp, tailp);
|
ring_name, headp, tailp, ring_usage);
|
||||||
|
|
||||||
hal_get_hw_hptp(soc->hal_soc, srng->hal_srng, &hw_headp,
|
hal_get_hw_hptp(soc->hal_soc, srng->hal_srng, &hw_headp,
|
||||||
&hw_tailp, ring_type);
|
&hw_tailp, ring_type);
|
||||||
|
ring_usage = 0;
|
||||||
DP_PRINT_STATS("%s:HW:Head pointer = %d Tail Pointer = %d\n",
|
if (hw_headp >= 0 && tailp >= 0)
|
||||||
ring_name, hw_headp, hw_tailp);
|
ring_usage =
|
||||||
|
hal_get_ring_usage(
|
||||||
|
srng->hal_srng, ring_type,
|
||||||
|
&hw_headp, &hw_tailp);
|
||||||
|
DP_PRINT_STATS("%s:HW: Head = %d Tail = %d Ring Usage = %u",
|
||||||
|
ring_name, hw_headp, hw_tailp, ring_usage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5113,6 +5120,9 @@ dp_print_ring_stats(struct dp_pdev *pdev)
|
|||||||
RTPM_ID_DP_PRINT_RING_STATS))
|
RTPM_ID_DP_PRINT_RING_STATS))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
dp_print_ring_stat_from_hal(pdev->soc,
|
||||||
|
&pdev->soc->wbm_idle_link_ring,
|
||||||
|
WBM_IDLE_LINK);
|
||||||
dp_print_ring_stat_from_hal(pdev->soc,
|
dp_print_ring_stat_from_hal(pdev->soc,
|
||||||
&pdev->soc->reo_exception_ring,
|
&pdev->soc->reo_exception_ring,
|
||||||
REO_EXCEPTION);
|
REO_EXCEPTION);
|
||||||
|
@@ -2717,4 +2717,44 @@ void hal_flush_reg_write_work(hal_soc_handle_t hal_handle);
|
|||||||
static inline void hal_flush_reg_write_work(hal_soc_handle_t hal_handle) { }
|
static inline void hal_flush_reg_write_work(hal_soc_handle_t hal_handle) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hal_get_ring_usage - Calculate the ring usage percentage
|
||||||
|
* @hal_ring_hdl: Ring pointer
|
||||||
|
* @ring_type: Ring type
|
||||||
|
* @headp: pointer to head value
|
||||||
|
* @tailp: pointer to tail value
|
||||||
|
*
|
||||||
|
* Calculate the ring usage percentage for src and dest rings
|
||||||
|
*
|
||||||
|
* Return: Ring usage percentage
|
||||||
|
*/
|
||||||
|
static inline
|
||||||
|
uint32_t hal_get_ring_usage(
|
||||||
|
hal_ring_handle_t hal_ring_hdl,
|
||||||
|
enum hal_ring_type ring_type, uint32_t *headp, uint32_t *tailp)
|
||||||
|
{
|
||||||
|
struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
|
||||||
|
uint32_t num_avail, num_valid = 0;
|
||||||
|
uint32_t ring_usage;
|
||||||
|
|
||||||
|
if (srng->ring_dir == HAL_SRNG_SRC_RING) {
|
||||||
|
if (*tailp > *headp)
|
||||||
|
num_avail = ((*tailp - *headp) / srng->entry_size) - 1;
|
||||||
|
else
|
||||||
|
num_avail = ((srng->ring_size - *headp + *tailp) /
|
||||||
|
srng->entry_size) - 1;
|
||||||
|
if (ring_type == WBM_IDLE_LINK)
|
||||||
|
num_valid = num_avail;
|
||||||
|
else
|
||||||
|
num_valid = srng->num_entries - num_avail;
|
||||||
|
} else {
|
||||||
|
if (*headp >= *tailp)
|
||||||
|
num_valid = ((*headp - *tailp) / srng->entry_size);
|
||||||
|
else
|
||||||
|
num_valid = ((srng->ring_size - *tailp + *headp) /
|
||||||
|
srng->entry_size);
|
||||||
|
}
|
||||||
|
ring_usage = (100 * num_valid) / srng->num_entries;
|
||||||
|
return ring_usage;
|
||||||
|
}
|
||||||
#endif /* _HAL_APIH_ */
|
#endif /* _HAL_APIH_ */
|
||||||
|
Reference in New Issue
Block a user