qcacmn: Make ce-debug lock per HIF
Make ce-debug buffer lock per HIF instead of global. Rectify the #if conditional macros. Change-Id: I0063014ed2fd9c7716386877dcbefec40e9fa2d9
This commit is contained in:

committed by
nshrivas

parent
39a9222d27
commit
7eddeddb17
@@ -946,11 +946,6 @@ void *hif_get_dev_ba(struct hif_opaque_softc *hif_handle);
|
||||
void hif_set_initial_wakeup_cb(struct hif_opaque_softc *hif_ctx,
|
||||
void (*callback)(void *),
|
||||
void *priv);
|
||||
#ifndef CONFIG_WIN
|
||||
#ifndef HIF_CE_DEBUG_DATA_BUF
|
||||
#define HIF_CE_DEBUG_DATA_BUF 0
|
||||
#endif
|
||||
#endif
|
||||
/*
|
||||
* Note: For MCL, #if defined (HIF_CONFIG_SLUB_DEBUG_ON) needs to be checked
|
||||
* for defined here
|
||||
@@ -964,7 +959,7 @@ ssize_t hif_ce_en_desc_hist(struct hif_softc *scn,
|
||||
const char *buf, size_t size);
|
||||
ssize_t hif_disp_ce_enable_desc_data_hist(struct hif_softc *scn, char *buf);
|
||||
ssize_t hif_dump_desc_event(struct hif_softc *scn, char *buf);
|
||||
#endif /* Note: for MCL, #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || HIF_CE_DEBUG_DATA_BUF */
|
||||
#endif/*#if defined(HIF_CONFIG_SLUB_DEBUG_ON)||defined(HIF_CE_DEBUG_DATA_BUF)*/
|
||||
|
||||
/**
|
||||
* hif_set_ce_service_max_yield_time() - sets CE service max yield time
|
||||
|
@@ -540,17 +540,17 @@ struct hif_ce_desc_event {
|
||||
uint64_t time;
|
||||
union ce_desc descriptor;
|
||||
void *memory;
|
||||
#if HIF_CE_DEBUG_DATA_BUF
|
||||
#ifdef HIF_CE_DEBUG_DATA_BUF
|
||||
uint8_t *data;
|
||||
ssize_t actual_data_len;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if HIF_CE_DEBUG_DATA_BUF
|
||||
#ifdef HIF_CE_DEBUG_DATA_BUF
|
||||
QDF_STATUS alloc_mem_ce_debug_hist_data(struct hif_softc *scn, uint32_t ce_id);
|
||||
void free_mem_ce_debug_hist_data(struct hif_softc *scn, uint32_t ce_id);
|
||||
#endif /*HIF_CE_DEBUG_DATA_BUF*/
|
||||
#endif /* #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || HIF_CE_DEBUG_DATA_BUF */
|
||||
#endif/*#if defined(HIF_CONFIG_SLUB_DEBUG_ON)||defined(HIF_CE_DEBUG_DATA_BUF)*/
|
||||
|
||||
#ifdef HIF_CONFIG_SLUB_DEBUG_ON
|
||||
/**
|
||||
|
@@ -1215,7 +1215,7 @@ static void ce_oom_recovery(void *context)
|
||||
hif_post_recv_buffers_for_pipe(pipe_info);
|
||||
}
|
||||
|
||||
#if HIF_CE_DEBUG_DATA_BUF
|
||||
#ifdef HIF_CE_DEBUG_DATA_BUF
|
||||
/**
|
||||
* alloc_mem_ce_debug_hist_data() - Allocate mem for the data pointed by
|
||||
* the CE descriptors.
|
||||
@@ -1313,7 +1313,7 @@ static void free_mem_ce_debug_history(struct hif_softc *scn, unsigned int ce_id)
|
||||
ce_hist->hist_ev[ce_id] = NULL;
|
||||
}
|
||||
|
||||
#elif HIF_CE_DEBUG_DATA_BUF /* WIN */
|
||||
#elif defined(HIF_CE_DEBUG_DATA_BUF) /* WIN */
|
||||
|
||||
static QDF_STATUS
|
||||
alloc_mem_ce_debug_history(struct hif_softc *scn, unsigned int CE_id)
|
||||
@@ -1360,7 +1360,7 @@ static inline void
|
||||
free_mem_ce_debug_history(struct hif_softc *scn, unsigned int CE_id) { }
|
||||
#endif
|
||||
|
||||
#if defined(HIF_CONFIG_SLUB_DEBUG_ON) || HIF_CE_DEBUG_DATA_BUF
|
||||
#if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
|
||||
/**
|
||||
* reset_ce_debug_history() - reset the index and ce id used for dumping the
|
||||
* CE records on the console using sysfs.
|
||||
@@ -1377,9 +1377,9 @@ static inline void reset_ce_debug_history(struct hif_softc *scn)
|
||||
ce_hist->hist_index = 0;
|
||||
ce_hist->hist_id = 0;
|
||||
}
|
||||
#else /* defined(HIF_CONFIG_SLUB_DEBUG_ON) || HIF_CE_DEBUG_DATA_BUF */
|
||||
#else /* defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF) */
|
||||
static inline void reset_ce_debug_history(struct hif_softc *scn) { }
|
||||
#endif /* defined(HIF_CONFIG_SLUB_DEBUG_ON) || HIF_CE_DEBUG_DATA_BUF */
|
||||
#endif /*defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF) */
|
||||
|
||||
void ce_enable_polling(void *cestate)
|
||||
{
|
||||
|
@@ -90,7 +90,6 @@ void hif_ce_war_enable(void)
|
||||
#define CE_DEBUG_PRINT_BUF_SIZE(x) (((x) * 3) - 1)
|
||||
#define CE_DEBUG_DATA_PER_ROW 16
|
||||
|
||||
qdf_mutex_t ce_dbg_datamem_lock[CE_COUNT_MAX];
|
||||
static const char *ce_event_type_to_str(enum hif_ce_event_type type);
|
||||
|
||||
/**
|
||||
@@ -117,7 +116,7 @@ static int get_next_record_index(qdf_atomic_t *table_index, int array_size)
|
||||
return record_index;
|
||||
}
|
||||
|
||||
#if HIF_CE_DEBUG_DATA_BUF
|
||||
#ifdef HIF_CE_DEBUG_DATA_BUF
|
||||
/**
|
||||
* hif_ce_desc_data_record() - Record data pointed by the CE descriptor
|
||||
* @event: structure detailing a ce event
|
||||
@@ -198,7 +197,7 @@ void hif_record_ce_desc_event(struct hif_softc *scn, int ce_id,
|
||||
event->memory = memory;
|
||||
event->index = index;
|
||||
|
||||
#if HIF_CE_DEBUG_DATA_BUF
|
||||
#ifdef HIF_CE_DEBUG_DATA_BUF
|
||||
if (ce_hist->data_enable[ce_id])
|
||||
hif_ce_desc_data_record(event, len);
|
||||
#endif
|
||||
@@ -216,7 +215,7 @@ void ce_init_ce_desc_event_log(struct hif_softc *scn, int ce_id, int size)
|
||||
{
|
||||
struct ce_desc_hist *ce_hist = &scn->hif_ce_desc_hist;
|
||||
qdf_atomic_init(&ce_hist->history_index[ce_id]);
|
||||
qdf_mutex_create(&ce_dbg_datamem_lock[ce_id]);
|
||||
qdf_mutex_create(&ce_hist->ce_dbg_datamem_lock[ce_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,10 +225,12 @@ void ce_init_ce_desc_event_log(struct hif_softc *scn, int ce_id, int size)
|
||||
*/
|
||||
inline void ce_deinit_ce_desc_event_log(struct hif_softc *scn, int ce_id)
|
||||
{
|
||||
qdf_mutex_destroy(&ce_dbg_datamem_lock[ce_id]);
|
||||
struct ce_desc_hist *ce_hist = &scn->hif_ce_desc_hist;
|
||||
|
||||
qdf_mutex_destroy(&ce_hist->ce_dbg_datamem_lock[ce_id]);
|
||||
}
|
||||
|
||||
#else /* Note: For MCL, (HIF_CONFIG_SLUB_DEBUG_ON) || HIF_CE_DEBUG_DATA_BUF */
|
||||
#else /* (HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF) */
|
||||
void hif_record_ce_desc_event(struct hif_softc *scn,
|
||||
int ce_id, enum hif_ce_event_type type,
|
||||
union ce_desc *descriptor, void *memory,
|
||||
@@ -246,7 +247,7 @@ inline void ce_init_ce_desc_event_log(struct hif_softc *scn, int ce_id,
|
||||
void ce_deinit_ce_desc_event_log(struct hif_softc *scn, int ce_id)
|
||||
{
|
||||
}
|
||||
#endif /* Note: for MCL, HIF_CONFIG_SLUB_DEBUG_ON || HIF_CE_DEBUG_DATA_BUF */
|
||||
#endif /*defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF) */
|
||||
|
||||
#ifdef NAPI_YIELD_BUDGET_BASED
|
||||
bool hif_ce_service_should_yield(struct hif_softc *scn,
|
||||
@@ -1457,7 +1458,7 @@ void ce_ipa_get_resource(struct CE_handle *ce,
|
||||
}
|
||||
#endif /* IPA_OFFLOAD */
|
||||
|
||||
#if HIF_CE_DEBUG_DATA_BUF
|
||||
#ifdef HIF_CE_DEBUG_DATA_BUF
|
||||
/**
|
||||
* hif_dump_desc_data_buf() - record ce descriptor events
|
||||
* @buf: buffer to copy to
|
||||
@@ -1607,7 +1608,7 @@ ssize_t hif_dump_desc_event(struct hif_softc *scn, char *buf)
|
||||
secs, usecs, ce_hist->hist_id,
|
||||
ce_event_type_to_str(event->type),
|
||||
event->index, event->memory);
|
||||
#if HIF_CE_DEBUG_DATA_BUF
|
||||
#ifdef HIF_CE_DEBUG_DATA_BUF
|
||||
len += snprintf(buf + len, PAGE_SIZE - len, ", Data len=%d",
|
||||
event->actual_data_len);
|
||||
#endif
|
||||
@@ -1620,7 +1621,7 @@ ssize_t hif_dump_desc_event(struct hif_softc *scn, char *buf)
|
||||
len += CE_DEBUG_PRINT_BUF_SIZE(sizeof(union ce_desc));
|
||||
len += snprintf(buf + len, PAGE_SIZE - len, "\n");
|
||||
|
||||
#if HIF_CE_DEBUG_DATA_BUF
|
||||
#ifdef HIF_CE_DEBUG_DATA_BUF
|
||||
if (ce_hist->data_enable[ce_hist->hist_id])
|
||||
len = hif_dump_desc_data_buf(buf, len, event->data,
|
||||
(event->actual_data_len <
|
||||
@@ -1673,9 +1674,9 @@ ssize_t hif_input_desc_trace_buf_index(struct hif_softc *scn,
|
||||
return size;
|
||||
}
|
||||
|
||||
#endif /*For MCL, HIF_CONFIG_SLUB_DEBUG_ON || HIF_CE_DEBUG_DATA_BUF */
|
||||
#endif /*defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF) */
|
||||
|
||||
#if HIF_CE_DEBUG_DATA_BUF
|
||||
#ifdef HIF_CE_DEBUG_DATA_BUF
|
||||
/*
|
||||
* hif_ce_en_desc_hist() -
|
||||
* API to enable recording the CE desc history
|
||||
@@ -1722,7 +1723,7 @@ ssize_t hif_ce_en_desc_hist(struct hif_softc *scn, const char *buf, size_t size)
|
||||
if (!ce_hist->hist_ev[ce_id])
|
||||
return -EINVAL;
|
||||
|
||||
qdf_mutex_acquire(&ce_dbg_datamem_lock[ce_id]);
|
||||
qdf_mutex_acquire(&ce_hist->ce_dbg_datamem_lock[ce_id]);
|
||||
if (cfg == 1) {
|
||||
if (ce_hist->data_enable[ce_id] == 1) {
|
||||
qdf_print("\nAlready Enabled");
|
||||
@@ -1742,7 +1743,7 @@ ssize_t hif_ce_en_desc_hist(struct hif_softc *scn, const char *buf, size_t size)
|
||||
free_mem_ce_debug_hist_data(scn, ce_id);
|
||||
}
|
||||
}
|
||||
qdf_mutex_release(&ce_dbg_datamem_lock[ce_id]);
|
||||
qdf_mutex_release(&ce_hist->ce_dbg_datamem_lock[ce_id]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@@ -130,11 +130,12 @@ struct ce_desc_hist {
|
||||
qdf_atomic_t history_index[CE_COUNT_MAX];
|
||||
uint32_t enable[CE_COUNT_MAX];
|
||||
uint32_t data_enable[CE_COUNT_MAX];
|
||||
qdf_mutex_t ce_dbg_datamem_lock[CE_COUNT_MAX];
|
||||
uint32_t hist_index;
|
||||
uint32_t hist_id;
|
||||
void *hist_ev[CE_COUNT_MAX];
|
||||
};
|
||||
#endif /* #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || HIF_CE_DEBUG_DATA_BUF */
|
||||
#endif /*defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)*/
|
||||
|
||||
struct hif_softc {
|
||||
struct hif_opaque_softc osc;
|
||||
@@ -202,7 +203,8 @@ struct hif_softc {
|
||||
*/
|
||||
#if defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)
|
||||
struct ce_desc_hist hif_ce_desc_hist;
|
||||
#endif /* #if defined(HIF_CONFIG_SLUB_DEBUG_ON) || HIF_CE_DEBUG_DATA_BUF */
|
||||
#endif /*defined(HIF_CONFIG_SLUB_DEBUG_ON) || defined(HIF_CE_DEBUG_DATA_BUF)*/
|
||||
|
||||
#ifdef IPA_OFFLOAD
|
||||
qdf_shared_mem_t *ipa_ce_ring;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user