qcacmn: Add support for Rx refill ring history
Add support for Rx refill ring history, maintain records of refill info during RXDMA ring replenish. Change-Id: I034014eacfc510ec6f416fca601fa864326de9c2 CRs-Fixed: 2930005
This commit is contained in:

committed by
Madan Koyyalamudi

parent
4982427333
commit
3bc4b99247
@@ -4522,10 +4522,12 @@ static void dp_soc_rx_history_attach(struct dp_soc *soc)
|
||||
uint32_t rx_ring_hist_size;
|
||||
uint32_t rx_err_ring_hist_size;
|
||||
uint32_t rx_reinject_hist_size;
|
||||
uint32_t rx_refill_ring_hist_size;
|
||||
|
||||
rx_ring_hist_size = sizeof(*soc->rx_ring_history[0]);
|
||||
rx_err_ring_hist_size = sizeof(*soc->rx_err_ring_history);
|
||||
rx_reinject_hist_size = sizeof(*soc->rx_reinject_ring_history);
|
||||
rx_refill_ring_hist_size = sizeof(*soc->rx_refill_ring_history[0]);
|
||||
|
||||
for (i = 0; i < MAX_REO_DEST_RINGS; i++) {
|
||||
soc->rx_ring_history[i] = dp_context_alloc_mem(
|
||||
@@ -4540,6 +4542,16 @@ static void dp_soc_rx_history_attach(struct dp_soc *soc)
|
||||
qdf_atomic_init(&soc->rx_err_ring_history->index);
|
||||
|
||||
dp_soc_rx_reinject_ring_history_attach(soc);
|
||||
|
||||
for (i = 0; i < MAX_PDEV_CNT; i++) {
|
||||
soc->rx_refill_ring_history[i] = dp_context_alloc_mem(
|
||||
soc,
|
||||
DP_RX_REFILL_RING_HIST_TYPE,
|
||||
rx_refill_ring_hist_size);
|
||||
|
||||
if (soc->rx_refill_ring_history[i])
|
||||
qdf_atomic_init(&soc->rx_refill_ring_history[i]->index);
|
||||
}
|
||||
}
|
||||
|
||||
static void dp_soc_rx_history_detach(struct dp_soc *soc)
|
||||
@@ -4559,6 +4571,10 @@ static void dp_soc_rx_history_detach(struct dp_soc *soc)
|
||||
*/
|
||||
dp_context_free_mem(soc, DP_RX_REINJECT_RING_HIST_TYPE,
|
||||
soc->rx_reinject_ring_history);
|
||||
|
||||
for (i = 0; i < MAX_PDEV_CNT; i++)
|
||||
dp_context_free_mem(soc, DP_RX_REFILL_RING_HIST_TYPE,
|
||||
soc->rx_refill_ring_history[i]);
|
||||
}
|
||||
|
||||
#else
|
||||
|
@@ -197,6 +197,51 @@ dp_pdev_frag_alloc_and_map(struct dp_soc *dp_soc,
|
||||
}
|
||||
#endif /* DP_RX_MON_MEM_FRAG */
|
||||
|
||||
#ifdef WLAN_FEATURE_DP_RX_RING_HISTORY
|
||||
/**
|
||||
* dp_rx_refill_ring_record_entry() - Record an entry into refill_ring history
|
||||
* @soc: Datapath soc structure
|
||||
* @ring_num: Refill ring number
|
||||
* @num_req: number of buffers requested for refill
|
||||
* @num_refill: number of buffers refilled
|
||||
*
|
||||
* Returns: None
|
||||
*/
|
||||
static inline void
|
||||
dp_rx_refill_ring_record_entry(struct dp_soc *soc, uint8_t ring_num,
|
||||
hal_ring_handle_t hal_ring_hdl,
|
||||
uint32_t num_req, uint32_t num_refill)
|
||||
{
|
||||
struct dp_refill_info_record *record;
|
||||
uint32_t idx;
|
||||
uint32_t tp;
|
||||
uint32_t hp;
|
||||
|
||||
if (qdf_unlikely(!soc->rx_refill_ring_history[ring_num]))
|
||||
return;
|
||||
|
||||
idx = dp_history_get_next_index(&soc->rx_refill_ring_history[ring_num]->index,
|
||||
DP_RX_REFILL_HIST_MAX);
|
||||
|
||||
/* No NULL check needed for record since its an array */
|
||||
record = &soc->rx_refill_ring_history[ring_num]->entry[idx];
|
||||
|
||||
hal_get_sw_hptp(soc->hal_soc, hal_ring_hdl, &tp, &hp);
|
||||
record->timestamp = qdf_get_log_timestamp();
|
||||
record->num_req = num_req;
|
||||
record->num_refill = num_refill;
|
||||
record->hp = hp;
|
||||
record->tp = tp;
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
dp_rx_refill_ring_record_entry(struct dp_soc *soc, uint8_t ring_num,
|
||||
hal_ring_handle_t hal_ring_hdl,
|
||||
uint32_t num_req, uint32_t num_refill)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* dp_pdev_nbuf_alloc_and_map() - Allocate nbuf for desc buffer and map
|
||||
*
|
||||
@@ -415,6 +460,9 @@ QDF_STATUS __dp_rx_buffers_replenish(struct dp_soc *dp_soc, uint32_t mac_id,
|
||||
|
||||
dp_rx_refill_buff_pool_unlock(dp_soc);
|
||||
|
||||
dp_rx_refill_ring_record_entry(dp_soc, mac_id, rxdma_srng,
|
||||
num_req_buffers, count);
|
||||
|
||||
hal_srng_access_end(dp_soc->hal_soc, rxdma_srng);
|
||||
|
||||
dp_rx_schedule_refill_thread(dp_soc);
|
||||
@@ -3259,6 +3307,8 @@ dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
|
||||
desc_list = next;
|
||||
}
|
||||
|
||||
dp_rx_refill_ring_record_entry(dp_soc, mac_id, rxdma_srng,
|
||||
nr_nbuf, nr_nbuf);
|
||||
hal_srng_access_end(dp_soc->hal_soc, rxdma_srng);
|
||||
}
|
||||
|
||||
|
@@ -377,6 +377,7 @@ struct dp_rx_nbuf_frag_info {
|
||||
* @DP_RX_RING_HIST_TYPE: Datapath rx ring history
|
||||
* @DP_RX_ERR_RING_HIST_TYPE: Datapath rx error ring history
|
||||
* @DP_RX_REINJECT_RING_HIST_TYPE: Datapath reinject ring history
|
||||
* @DP_RX_REFILL_RING_HIST_TYPE: Datapath rx refill ring history
|
||||
*/
|
||||
enum dp_ctxt_type {
|
||||
DP_PDEV_TYPE,
|
||||
@@ -384,6 +385,7 @@ enum dp_ctxt_type {
|
||||
DP_RX_ERR_RING_HIST_TYPE,
|
||||
DP_RX_REINJECT_RING_HIST_TYPE,
|
||||
DP_FISA_RX_FT_TYPE,
|
||||
DP_RX_REFILL_RING_HIST_TYPE,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1157,6 +1159,7 @@ struct rx_refill_buff_pool {
|
||||
bool is_initialized;
|
||||
};
|
||||
|
||||
#ifdef WLAN_FEATURE_DP_RX_RING_HISTORY
|
||||
/*
|
||||
* The logic for get current index of these history is dependent on this
|
||||
* value being power of 2.
|
||||
@@ -1164,6 +1167,7 @@ struct rx_refill_buff_pool {
|
||||
#define DP_RX_HIST_MAX 2048
|
||||
#define DP_RX_ERR_HIST_MAX 2048
|
||||
#define DP_RX_REINJECT_HIST_MAX 1024
|
||||
#define DP_RX_REFILL_HIST_MAX 2048
|
||||
|
||||
QDF_COMPILE_TIME_ASSERT(rx_history_size,
|
||||
(DP_RX_HIST_MAX &
|
||||
@@ -1174,6 +1178,10 @@ QDF_COMPILE_TIME_ASSERT(rx_err_history_size,
|
||||
QDF_COMPILE_TIME_ASSERT(rx_reinject_history_size,
|
||||
(DP_RX_REINJECT_HIST_MAX &
|
||||
(DP_RX_REINJECT_HIST_MAX - 1)) == 0);
|
||||
QDF_COMPILE_TIME_ASSERT(rx_refill_history_size,
|
||||
(DP_RX_REFILL_HIST_MAX &
|
||||
(DP_RX_REFILL_HIST_MAX - 1)) == 0);
|
||||
|
||||
|
||||
/**
|
||||
* struct dp_buf_info_record - ring buffer info
|
||||
@@ -1185,6 +1193,22 @@ struct dp_buf_info_record {
|
||||
uint64_t timestamp;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dp_refill_info_record - ring refill buffer info
|
||||
* @hp: HP value after refill
|
||||
* @tp: cached tail value during refill
|
||||
* @num_req: number of buffers requested to refill
|
||||
* @num_refill: number of buffers refilled to ring
|
||||
* @timestamp: timestamp when this entry was recorded
|
||||
*/
|
||||
struct dp_refill_info_record {
|
||||
uint32_t hp;
|
||||
uint32_t tp;
|
||||
uint32_t num_req;
|
||||
uint32_t num_refill;
|
||||
uint64_t timestamp;
|
||||
};
|
||||
|
||||
/* struct dp_rx_history - rx ring hisotry
|
||||
* @index: Index where the last entry is written
|
||||
* @entry: history entries
|
||||
@@ -1212,6 +1236,17 @@ struct dp_rx_reinject_history {
|
||||
struct dp_buf_info_record entry[DP_RX_REINJECT_HIST_MAX];
|
||||
};
|
||||
|
||||
/* struct dp_rx_refill_history - rx buf refill hisotry
|
||||
* @index: Index where the last entry is written
|
||||
* @entry: history entries
|
||||
*/
|
||||
struct dp_rx_refill_history {
|
||||
qdf_atomic_t index;
|
||||
struct dp_refill_info_record entry[DP_RX_REFILL_HIST_MAX];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* structure to record recent operation related variable */
|
||||
struct dp_last_op_info {
|
||||
/* last link desc buf info through WBM release ring */
|
||||
@@ -1611,9 +1646,13 @@ struct dp_soc {
|
||||
unsigned idx_bits;
|
||||
TAILQ_HEAD(, dp_ast_entry) * bins;
|
||||
} ast_hash;
|
||||
|
||||
#ifdef WLAN_FEATURE_DP_RX_RING_HISTORY
|
||||
struct dp_rx_history *rx_ring_history[MAX_REO_DEST_RINGS];
|
||||
struct dp_rx_refill_history *rx_refill_ring_history[MAX_PDEV_CNT];
|
||||
struct dp_rx_err_history *rx_err_ring_history;
|
||||
struct dp_rx_reinject_history *rx_reinject_ring_history;
|
||||
#endif
|
||||
|
||||
qdf_spinlock_t ast_lock;
|
||||
/*Timer for AST entry ageout maintainance */
|
||||
|
Reference in New Issue
Block a user