qcacmn: Add support to copy buffers posted to CE SRC

Enable data field in hif_ce_desc_event structure
and copy the buffer posted to CE SRC ring. This is
done to validate the contents of the buffer.

Change-Id: I6745422f6c3a8ac013bb35032056f041d2216d89
CRs-Fixed: 2540707
This commit is contained in:
Venkata Sharath Chandra Manchala
2019-10-05 02:30:19 -07:00
committed by nshrivas
vanhempi 01b9b680fc
commit 34a2ef695d
4 muutettua tiedostoa jossa 34 lisäystä ja 8 poistoa

Näytä tiedosto

@@ -554,8 +554,8 @@ int hif_get_wake_ce_id(struct hif_softc *scn, uint8_t *ce_id);
* @descriptor: descriptor enqueued or dequeued
* @memory: virtual address that was used
* @index: location of the descriptor in the ce ring;
* @data: data pointed by descriptor
* @actual_data_len: length of the data
* @data: data pointed by descriptor
*/
struct hif_ce_desc_event {
int index;
@@ -570,8 +570,8 @@ struct hif_ce_desc_event {
#endif
void *memory;
#ifdef HIF_CE_DEBUG_DATA_BUF
uint8_t *data;
size_t actual_data_len;
uint8_t *data;
#endif /* HIF_CE_DEBUG_DATA_BUF */
#ifdef HIF_CONFIG_SLUB_DEBUG_ON
@@ -634,6 +634,16 @@ void hif_record_ce_srng_desc_event(struct hif_softc *scn, int ce_id,
* Return:
*/
void hif_ce_desc_data_record(struct hif_ce_desc_event *event, int len);
/**
* hif_clear_ce_desc_debug_data() - Clear the contents of hif_ce_desc_event
* upto data field before reusing it.
*
* @event: record every CE event
*
* Return: None
*/
void hif_clear_ce_desc_debug_data(struct hif_ce_desc_event *event);
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);
#else
@@ -650,6 +660,8 @@ static inline
void hif_ce_desc_data_record(struct hif_ce_desc_event *event, int len)
{
}
void hif_clear_ce_desc_debug_data(struct hif_ce_desc_event *event);
#endif /*HIF_CE_DEBUG_DATA_BUF*/
#ifdef HIF_CONFIG_SLUB_DEBUG_ON

Näytä tiedosto

@@ -1274,8 +1274,10 @@ QDF_STATUS alloc_mem_ce_debug_hist_data(struct hif_softc *scn, uint32_t ce_id)
event = &hist_ev[index];
event->data =
(uint8_t *)qdf_mem_malloc(CE_DEBUG_MAX_DATA_BUF_SIZE);
if (!event->data)
if (!event->data) {
hif_err_rl("ce debug data alloc failed");
return QDF_STATUS_E_NOMEM;
}
}
return QDF_STATUS_SUCCESS;
}
@@ -1307,6 +1309,7 @@ void free_mem_ce_debug_hist_data(struct hif_softc *scn, uint32_t ce_id)
event->data = NULL;
event = NULL;
}
}
#endif /* HIF_CE_DEBUG_DATA_BUF */
@@ -1350,11 +1353,11 @@ static void free_mem_ce_debug_history(struct hif_softc *scn, unsigned int ce_id)
struct ce_desc_hist *ce_hist = &scn->hif_ce_desc_hist;
ce_hist->enable[ce_id] = 0;
ce_hist->hist_ev[ce_id] = NULL;
if (ce_hist->data_enable[ce_id]) {
ce_hist->data_enable[ce_id] = false;
free_mem_ce_debug_hist_data(scn, ce_id);
}
ce_hist->hist_ev[ce_id] = NULL;
}
#else
static inline QDF_STATUS

Näytä tiedosto

@@ -111,7 +111,7 @@ void hif_ce_desc_data_record(struct hif_ce_desc_event *event, int len)
uint8_t *data = NULL;
if (!event->data) {
hif_err("No memory allocated");
hif_err_rl("No ce debug memory allocated");
return;
}
@@ -128,6 +128,17 @@ void hif_ce_desc_data_record(struct hif_ce_desc_event *event, int len)
event->actual_data_len = len;
}
}
void hif_clear_ce_desc_debug_data(struct hif_ce_desc_event *event)
{
qdf_mem_zero(event,
offsetof(struct hif_ce_desc_event, data));
}
#else
void hif_clear_ce_desc_debug_data(struct hif_ce_desc_event *event)
{
qdf_mem_zero(event, sizeof(struct hif_ce_desc_event));
}
#endif
#if defined(HIF_CONFIG_SLUB_DEBUG_ON) && defined(HIF_RECORD_RX_PADDR)
@@ -199,14 +210,14 @@ void hif_record_ce_desc_event(struct hif_softc *scn, int ce_id,
event = &hist_ev[record_index];
qdf_mem_zero(event, sizeof(struct hif_ce_desc_event));
hif_clear_ce_desc_debug_data(event);
event->type = type;
event->time = qdf_get_log_timestamp();
if (descriptor)
qdf_mem_copy(&event->descriptor, descriptor,
sizeof(union ce_desc));
sizeof(union ce_srng_desc));
event->memory = memory;
event->index = index;

Näytä tiedosto

@@ -108,7 +108,7 @@ void hif_record_ce_srng_desc_event(struct hif_softc *scn, int ce_id,
event = &hist_ev[record_index];
qdf_mem_zero(event, sizeof(struct hif_ce_desc_event));
hif_clear_ce_desc_debug_data(event);
event->type = type;
event->time = qdf_get_log_timestamp();