From 169fce61ef6ac6e95ec093b01368c0b29f9731cb Mon Sep 17 00:00:00 2001 From: Rakshith Suresh Patkar Date: Wed, 26 Sep 2018 15:43:03 +0530 Subject: [PATCH] qcacmn: Add QDF API to update debug node for nbuf In case of preallocation of nbufs, the debug nodes contain allocation information with respect to the allocator and not the user. For more accurate debug info, add new QDF API qdf_net_buf_debug_update_node to update the debug info when the nbuf is requested. Change-Id: Idfbcd15b6c561bbb57ba98a6b8376557ba909eec CRs-Fixed: 2322989 --- qdf/inc/qdf_nbuf.h | 13 +++++++++++++ qdf/linux/src/qdf_nbuf.c | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/qdf/inc/qdf_nbuf.h b/qdf/inc/qdf_nbuf.h index 79edcbc3ad..70d26be73f 100644 --- a/qdf/inc/qdf_nbuf.h +++ b/qdf/inc/qdf_nbuf.h @@ -1222,6 +1222,13 @@ void qdf_net_buf_debug_exit(void); void qdf_net_buf_debug_clean(void); void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size, uint8_t *file_name, uint32_t line_num); +/** + * qdf_net_buf_debug_update_node() - update nbuf in debug hash table + * + * Return: none + */ +void qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, uint8_t *file_name, + uint32_t line_num); void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf); /** @@ -1327,6 +1334,12 @@ static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf) { } +static inline void +qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, uint8_t *file_name, + uint32_t line_num) +{ +} + /* Nbuf allocation rouines */ #define qdf_nbuf_alloc(osdev, size, reserve, align, prio) \ diff --git a/qdf/linux/src/qdf_nbuf.c b/qdf/linux/src/qdf_nbuf.c index 701045b191..321fa259f4 100644 --- a/qdf/linux/src/qdf_nbuf.c +++ b/qdf/linux/src/qdf_nbuf.c @@ -2519,6 +2519,29 @@ void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size, } qdf_export_symbol(qdf_net_buf_debug_add_node); +void qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, uint8_t *file_name, + uint32_t line_num) +{ + uint32_t i; + unsigned long irq_flag; + QDF_NBUF_TRACK *p_node; + + i = qdf_net_buf_debug_hash(net_buf); + spin_lock_irqsave(&g_qdf_net_buf_track_lock[i], irq_flag); + + p_node = qdf_net_buf_debug_look_up(net_buf); + + if (p_node) { + qdf_str_lcopy(p_node->file_name, kbasename(file_name), + QDF_MEM_FILE_NAME_SIZE); + p_node->line_num = line_num; + } + + spin_unlock_irqrestore(&g_qdf_net_buf_track_lock[i], irq_flag); +} + +qdf_export_symbol(qdf_net_buf_debug_update_node); + /** * qdf_net_buf_debug_delete_node() - remove skb from debug hash table *