qcacmn: Add debug for TSO seg double-free

Add TSO segment debug code, in a featurized way, so that
when disabled, it will tolerate redundant returns to the internal
pool and when enabled, it will check sanity on free, and record a
history of last 16 actions on the segment in the object.

Goes with the corresponding cld3 component counterpart.

Change-Id: Ifee2ceae940043031e4861d0e4f5d19a51262229
CRs-Fixed: 2036665
This commit is contained in:
Orhan K AKYILDIZ
2017-04-19 21:21:45 -07:00
committed by snandini
parent 21f852f52c
commit c59be52d47
3 changed files with 87 additions and 0 deletions

View File

@@ -476,6 +476,62 @@ void __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size,
char *str_format, ...);
#define QDF_SNPRINTF qdf_snprintf
#ifdef TSOSEG_DEBUG
static inline
int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg,
uint16_t caller)
{
int rc = -1;
if (tsoseg != NULL) {
tsoseg->dbg.cur++; tsoseg->dbg.cur &= 0x0f;
tsoseg->dbg.history[tsoseg->dbg.cur] = caller;
rc = tsoseg->dbg.cur;
}
return rc;
};
static inline void qdf_tso_seg_dbg_bug(char *msg)
{
qdf_print(msg);
QDF_BUG(0);
};
static inline void
qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner)
{
tsoseg->dbg.txdesc = owner;
};
static inline void
qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg)
{
memset(tsoseg, 0, offsetof(struct qdf_tso_seg_elem_t, dbg));
return;
};
#else
static inline
int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg,
uint16_t caller)
{
return 0;
};
static inline void qdf_tso_seg_dbg_bug(char *msg)
{
};
static inline void
qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner)
{
};
static inline int
qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg)
{
memset(tsoseg, 0, sizeof(struct qdf_tso_seg_elem_t));
return 0;
};
#endif /* TSOSEG_DEBUG */
#else
#define DPTRACE(x)