Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba59ac27 authored by Jingxiang Ge's avatar Jingxiang Ge Committed by nshrivas
Browse files

qcacmn: Add dbgid for each runtime put/get

This is to enhance statics for runtime put/get, which is
to detect if there is mismatch for usage_count.

Change-Id: I24cddb9d10e4cb675c8375cbd0f589c7718bd680
CRs-Fixed: 2647972
parent 2e3b8200
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -4886,7 +4886,8 @@ dp_print_ring_stats(struct dp_pdev *pdev)
	int mac_id;
	int lmac_id;

	if (hif_pm_runtime_get_sync(pdev->soc->hif_handle))
	if (hif_pm_runtime_get_sync(pdev->soc->hif_handle,
				    RTPM_ID_DP_PRINT_RING_STATS))
		return;

	dp_print_ring_stat_from_hal(pdev->soc,
@@ -4957,7 +4958,8 @@ dp_print_ring_stats(struct dp_pdev *pdev)
					    [lmac_id],
					    RXDMA_DST);
	}
	hif_pm_runtime_put(pdev->soc->hif_handle);
	hif_pm_runtime_put(pdev->soc->hif_handle,
			   RTPM_ID_DP_PRINT_RING_STATS);
}

/**
+8 −4
Original line number Diff line number Diff line
@@ -1677,9 +1677,11 @@ dp_tx_send_msdu_single(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
	nbuf = NULL;

fail_return:
	if (hif_pm_runtime_get(soc->hif_handle) == 0) {
	if (hif_pm_runtime_get(soc->hif_handle,
			       RTPM_ID_DW_TX_HW_ENQUEUE) == 0) {
		hal_srng_access_end(soc->hal_soc, hal_ring_hdl);
		hif_pm_runtime_put(soc->hif_handle);
		hif_pm_runtime_put(soc->hif_handle,
				   RTPM_ID_DW_TX_HW_ENQUEUE);
	} else {
		hal_srng_access_end_reap(soc->hal_soc, hal_ring_hdl);
		hal_srng_set_event(hal_ring_hdl, HAL_SRNG_FLUSH_EVENT);
@@ -1853,9 +1855,11 @@ qdf_nbuf_t dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
	nbuf = NULL;

done:
	if (hif_pm_runtime_get(soc->hif_handle) == 0) {
	if (hif_pm_runtime_get(soc->hif_handle,
			       RTPM_ID_DW_TX_HW_ENQUEUE) == 0) {
		hal_srng_access_end(soc->hal_soc, hal_ring_hdl);
		hif_pm_runtime_put(soc->hif_handle);
		hif_pm_runtime_put(soc->hif_handle,
				   RTPM_ID_DW_TX_HW_ENQUEUE);
	} else {
		hal_srng_access_end_reap(soc->hal_soc, hal_ring_hdl);
		hal_srng_set_event(hal_ring_hdl, HAL_SRNG_FLUSH_EVENT);
+5 −2
Original line number Diff line number Diff line
@@ -415,7 +415,9 @@ dp_tx_desc_alloc(struct dp_soc *soc, uint8_t desc_pool_id)
			 * success of allocating one descriptor. It will be
			 * decremented after the packet has been sent.
			 */
			hif_pm_runtime_get_noresume(soc->hif_handle);
			hif_pm_runtime_get_noresume(
				soc->hif_handle,
				RTPM_ID_DP_TX_DESC_ALLOC_FREE);
		} else {
			pool->pkt_drop_no_desc++;
			qdf_spin_unlock_bh(&pool->flow_pool_lock);
@@ -482,7 +484,8 @@ dp_tx_desc_free(struct dp_soc *soc, struct dp_tx_desc_s *tx_desc,
	 * Decrement PM usage count if the packet has been sent. This
	 * should be tied with the success of freeing one descriptor.
	 */
	hif_pm_runtime_put(soc->hif_handle);
	hif_pm_runtime_put(soc->hif_handle,
			   RTPM_ID_DP_TX_DESC_ALLOC_FREE);
}

#endif /* QCA_AC_BASED_FLOW_CONTROL */
+13 −7
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -454,9 +454,11 @@ inline int hal_reo_cmd_queue_stats(hal_ring_handle_t hal_ring_hdl,
	HAL_DESC_SET_FIELD(reo_desc, REO_GET_QUEUE_STATS_2, CLEAR_STATS,
			      cmd->u.stats_params.clear);

	if (hif_pm_runtime_get(hal_soc->hif_handle) == 0) {
	if (hif_pm_runtime_get(hal_soc->hif_handle,
			       RTPM_ID_HAL_REO_CMD) == 0) {
		hal_srng_access_end(hal_soc_hdl, hal_ring_hdl);
		hif_pm_runtime_put(hal_soc->hif_handle);
		hif_pm_runtime_put(hal_soc->hif_handle,
				   RTPM_ID_HAL_REO_CMD);
	} else {
		hal_srng_access_end_reap(hal_soc_hdl, hal_ring_hdl);
		hal_srng_set_event(hal_ring_hdl, HAL_SRNG_FLUSH_EVENT);
@@ -590,9 +592,11 @@ inline int hal_reo_cmd_flush_cache(hal_ring_handle_t hal_ring_hdl,
	HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_2, FLUSH_ENTIRE_CACHE,
		cp->flush_all);

	if (hif_pm_runtime_get(hal_soc->hif_handle) == 0) {
	if (hif_pm_runtime_get(hal_soc->hif_handle,
			       RTPM_ID_HAL_REO_CMD) == 0) {
		hal_srng_access_end(hal_soc_hdl, hal_ring_hdl);
		hif_pm_runtime_put(hal_soc->hif_handle);
		hif_pm_runtime_put(hal_soc->hif_handle,
				   RTPM_ID_HAL_REO_CMD);
	} else {
		hal_srng_access_end_reap(hal_soc_hdl, hal_ring_hdl);
		hal_srng_set_event(hal_ring_hdl, HAL_SRNG_FLUSH_EVENT);
@@ -913,9 +917,11 @@ inline int hal_reo_cmd_update_rx_queue(hal_ring_handle_t hal_ring_hdl,
	HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_8,
		PN_127_96, p->pn_127_96);

	if (hif_pm_runtime_get(hal_soc->hif_handle) == 0) {
	if (hif_pm_runtime_get(hal_soc->hif_handle,
			       RTPM_ID_HAL_REO_CMD) == 0) {
		hal_srng_access_end(hal_soc_hdl, hal_ring_hdl);
		hif_pm_runtime_put(hal_soc->hif_handle);
		hif_pm_runtime_put(hal_soc->hif_handle,
				   RTPM_ID_HAL_REO_CMD);
	} else {
		hal_srng_access_end_reap(hal_soc_hdl, hal_ring_hdl);
		hal_srng_set_event(hal_ring_hdl, HAL_SRNG_FLUSH_EVENT);
+88 −12
Original line number Diff line number Diff line
@@ -864,16 +864,83 @@ void hif_enable_ce_latency_stats(struct hif_opaque_softc *hif_ctx,
#endif
void hif_display_stats(struct hif_opaque_softc *hif_ctx);
void hif_clear_stats(struct hif_opaque_softc *hif_ctx);

/**
 * enum wlan_rtpm_dbgid - runtime pm put/get debug id
 * @RTPM_ID_RESVERD:       Reserved
 * @RTPM_ID_WMI:           WMI sending msg, expect put happen at
 *                         tx completion from CE level directly.
 * @RTPM_ID_HTC:           pkt sending by HTT_DATA_MSG_SVC, expect
 *                         put from fw response or just in
 *                         htc_issue_packets
 * @RTPM_ID_QOS_NOTIFY:    pm qos notifer
 * @RTPM_ID_DP_TX_DESC_ALLOC_FREE:      tx desc alloc/free
 * @RTPM_ID_CE_SEND_FAST:  operation in ce_send_fast, not include
 *                         the pkt put happens outside this function
 * @RTPM_ID_SUSPEND_RESUME:     suspend/resume in hdd
 * @RTPM_ID_DW_TX_HW_ENQUEUE:   operation in functin dp_tx_hw_enqueue
 * @RTPM_ID_HAL_REO_CMD:        HAL_REO_CMD operation
 * @RTPM_ID_DP_PRINT_RING_STATS:  operation in dp_print_ring_stats
 */
/* New value added to the enum must also be reflected in function
 *  rtpm_string_from_dbgid()
 */
typedef enum {
	RTPM_ID_RESVERD   = 0,
	RTPM_ID_WMI       = 1,
	RTPM_ID_HTC       = 2,
	RTPM_ID_QOS_NOTIFY  = 3,
	RTPM_ID_DP_TX_DESC_ALLOC_FREE  = 4,
	RTPM_ID_CE_SEND_FAST       = 5,
	RTPM_ID_SUSPEND_RESUME     = 6,
	RTPM_ID_DW_TX_HW_ENQUEUE   = 7,
	RTPM_ID_HAL_REO_CMD        = 8,
	RTPM_ID_DP_PRINT_RING_STATS  = 9,

	RTPM_ID_MAX,
} wlan_rtpm_dbgid;

/**
 * rtpm_string_from_dbgid() - Convert dbgid to respective string
 * @id -  debug id
 *
 * Debug support function to convert  dbgid to string.
 * Please note to add new string in the array at index equal to
 * its enum value in wlan_rtpm_dbgid.
 */
static inline char *rtpm_string_from_dbgid(wlan_rtpm_dbgid id)
{
	static const char *strings[] = { "RTPM_ID_RESVERD",
					"RTPM_ID_WMI",
					"RTPM_ID_HTC",
					"RTPM_ID_QOS_NOTIFY",
					"RTPM_ID_DP_TX_DESC_ALLOC_FREE",
					"RTPM_ID_CE_SEND_FAST",
					"RTPM_ID_SUSPEND_RESUME",
					"RTPM_ID_DW_TX_HW_ENQUEUE",
					"RTPM_ID_HAL_REO_CMD",
					"RTPM_ID_DP_PRINT_RING_STATS",
					"RTPM_ID_MAX"};

	return (char *)strings[id];
}

#ifdef FEATURE_RUNTIME_PM
struct hif_pm_runtime_lock;
void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx,
			    wlan_rtpm_dbgid rtpm_dbgid);
int hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx,
				    wlan_rtpm_dbgid rtpm_dbgid);
int hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx);
void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_put_noidle(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx,
		       wlan_rtpm_dbgid rtpm_dbgid);
void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx,
				 wlan_rtpm_dbgid rtpm_dbgid);
int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx,
		       wlan_rtpm_dbgid rtpm_dbgid);
int hif_pm_runtime_put_noidle(struct hif_opaque_softc *hif_ctx,
			      wlan_rtpm_dbgid rtpm_dbgid);
void hif_pm_runtime_mark_last_busy(struct hif_opaque_softc *hif_ctx);
int hif_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name);
void hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
@@ -897,22 +964,31 @@ struct hif_pm_runtime_lock {
	const char *name;
};
static inline void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx) {}
static inline int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx)
static inline int
hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx,
			wlan_rtpm_dbgid rtpm_dbgid)
{ return 0; }
static inline int
hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx)
hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx,
				wlan_rtpm_dbgid rtpm_dbgid)
{ return 0; }
static inline int
hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx)
{ return 0; }
static inline void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx)
static inline void
hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx,
			    wlan_rtpm_dbgid rtpm_dbgid)
{}

static inline int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx)
static inline int
hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx, wlan_rtpm_dbgid rtpm_dbgid)
{ return 0; }
static inline int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx)
static inline int
hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx, wlan_rtpm_dbgid rtpm_dbgid)
{ return 0; }
static inline int hif_pm_runtime_put_noidle(struct hif_opaque_softc *hif_ctx)
static inline int
hif_pm_runtime_put_noidle(struct hif_opaque_softc *hif_ctx,
			  wlan_rtpm_dbgid rtpm_dbgid)
{ return 0; }
static inline void
hif_pm_runtime_mark_last_busy(struct hif_opaque_softc *hif_ctx) {};
Loading