From 19a023707204a4e30af07ef218e63d3e90f9de5c Mon Sep 17 00:00:00 2001 From: Jia Ding Date: Tue, 29 Nov 2022 22:24:36 +0800 Subject: [PATCH] qcacmn: Properly declare nbuf smmu map unmap With NBUF_MEMORY_DEBUG=n and IPA_OFFLOAD=y, below errors are seen. qdf/linux/src/qdf_nbuf.c:943:12: error: no previous prototype for function 'qdf_nbuf_smmu_map_debug' [-Werror,-Wmissing-prototypes] qdf/linux/src/qdf_nbuf.c:955:12: error: no previous prototype for function 'qdf_nbuf_smmu_unmap_debug' [-Werror,-Wmissing-prototypes] Currently above two APIs are only declared with NBUF_MEMORY_DEBUG=y. Checking their definitions, could see that they have two variants with NBUF_SMMU_MAP_UNMAP_DEBUG=y|n and they should only be valid with IPA_OFFLOAD=y since IPA API is referenced in them. Hence properly declare qdf_nbuf_smmu_map_debug() and qdf_nbuf_smmu_unmap_debug() so that they're only valid with IPA_OFFLOAD=y. With that, two variants are still kept. With NBUF_SMMU_MAP_UNMAP_DEBUG=y, smmu map and unmap operations are tracked. With NBUF_SMMU_MAP_UNMAP_DEBUG=n, no trackings are maintained. Change-Id: I83b08b1152d98b3efed3e52e564af0ebfbe5a7f7 CRs-Fixed: 3348594 --- qdf/inc/qdf_nbuf.h | 77 +++++++++++++++++++++------------------- qdf/linux/src/qdf_nbuf.c | 10 +++--- 2 files changed, 46 insertions(+), 41 deletions(-) diff --git a/qdf/inc/qdf_nbuf.h b/qdf/inc/qdf_nbuf.h index 0961a1ad34..7efb7ebc37 100644 --- a/qdf/inc/qdf_nbuf.h +++ b/qdf/inc/qdf_nbuf.h @@ -1981,6 +1981,45 @@ static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf) return __qdf_nbuf_next(buf); } +#ifdef IPA_OFFLOAD +/** + * qdf_nbuf_smmu_map_debug() - map smmu buffer + * @nbuf: network buffer + * @hdl: ipa handle + * @num_buffers: number of buffers + * @info: memory info + * @func: function name + * @line: line number + * + * Return: QDF_STATUS + */ +QDF_STATUS qdf_nbuf_smmu_map_debug(qdf_nbuf_t nbuf, + uint8_t hdl, + uint8_t num_buffers, + qdf_mem_info_t *info, + const char *func, + uint32_t line); + +/** + * qdf_nbuf_smmu_unmap_debug() - unmap smmu buffer + * @nbuf: network buffer + * @hdl: ipa handle + * @num_buffers: number of buffers + * @info: memory info + * @func: function name + * @line: line number + * + * Return: QDF_STATUS + */ +QDF_STATUS qdf_nbuf_smmu_unmap_debug(qdf_nbuf_t nbuf, + uint8_t hdl, + uint8_t num_buffers, + qdf_mem_info_t *info, + const char *func, + uint32_t line); + +#endif /* IPA_OFFLOAD */ + #ifdef NBUF_MEMORY_DEBUG #define QDF_NET_BUF_TRACK_MAX_SIZE (1024) @@ -2027,42 +2066,6 @@ void qdf_net_buf_debug_update_map_node(qdf_nbuf_t net_buf, const char *func_name, uint32_t line_num); -/** - * qdf_nbuf_smmu_map_debug() - map smmu buffer - * @nbuf: network buffer - * @hdl: ipa handle - * @num_buffers: number of buffers - * @info: memory info - * @func: function name - * @line: line number - * - * Return: QDF_STATUS - */ -QDF_STATUS qdf_nbuf_smmu_map_debug(qdf_nbuf_t nbuf, - uint8_t hdl, - uint8_t num_buffers, - qdf_mem_info_t *info, - const char *func, - uint32_t line); - -/** - * qdf_nbuf_smmu_unmap_debug() - unmap smmu buffer - * @nbuf: network buffer - * @hdl: ipa handle - * @num_buffers: number of buffers - * @info: memory info - * @func: function name - * @line: line number - * - * Return: QDF_STATUS - */ -QDF_STATUS qdf_nbuf_smmu_unmap_debug(qdf_nbuf_t nbuf, - uint8_t hdl, - uint8_t num_buffers, - qdf_mem_info_t *info, - const char *func, - uint32_t line); - #ifdef NBUF_SMMU_MAP_UNMAP_DEBUG /** * qdf_nbuf_map_check_for_smmu_leaks() - check for nbuf smmu map leaks @@ -2106,7 +2109,7 @@ void qdf_net_buf_debug_update_smmu_unmap_node(qdf_nbuf_t nbuf, unsigned long pa, const char *func, uint32_t line); -#endif +#endif /* NBUF_SMMU_MAP_UNMAP_DEBUG */ /** * qdf_net_buf_debug_update_unmap_node() - update nbuf in debug diff --git a/qdf/linux/src/qdf_nbuf.c b/qdf/linux/src/qdf_nbuf.c index e3424ef1ed..be34b0ba19 100644 --- a/qdf/linux/src/qdf_nbuf.c +++ b/qdf/linux/src/qdf_nbuf.c @@ -860,6 +860,7 @@ void qdf_nbuf_map_check_for_smmu_leaks(void) qdf_tracker_check_for_leaks(&qdf_nbuf_smmu_map_tracker); } +#ifdef IPA_OFFLOAD QDF_STATUS qdf_nbuf_smmu_map_debug(qdf_nbuf_t nbuf, uint8_t hdl, uint8_t num_buffers, @@ -906,6 +907,7 @@ QDF_STATUS qdf_nbuf_smmu_unmap_debug(qdf_nbuf_t nbuf, } qdf_export_symbol(qdf_nbuf_smmu_unmap_debug); +#endif /* IPA_OFFLOAD */ static void qdf_nbuf_panic_on_free_if_smmu_mapped(qdf_nbuf_t nbuf, const char *func, @@ -934,7 +936,7 @@ static inline void qdf_net_buf_update_smmu_params(QDF_NBUF_TRACK *p_node) p_node->smmu_map_iova_addr = 0; p_node->smmu_map_pa_addr = 0; } -#else +#else /* !NBUF_SMMU_MAP_UNMAP_DEBUG */ #ifdef NBUF_MEMORY_DEBUG static void qdf_nbuf_smmu_map_tracking_init(void) { @@ -953,7 +955,7 @@ static void qdf_nbuf_panic_on_free_if_smmu_mapped(qdf_nbuf_t nbuf, static inline void qdf_net_buf_update_smmu_params(QDF_NBUF_TRACK *p_node) { } -#endif +#endif /* NBUF_MEMORY_DEBUG */ #ifdef IPA_OFFLOAD QDF_STATUS qdf_nbuf_smmu_map_debug(qdf_nbuf_t nbuf, @@ -979,8 +981,8 @@ QDF_STATUS qdf_nbuf_smmu_unmap_debug(qdf_nbuf_t nbuf, } qdf_export_symbol(qdf_nbuf_smmu_unmap_debug); -#endif -#endif +#endif /* IPA_OFFLOAD */ +#endif /* NBUF_SMMU_MAP_UNMAP_DEBUG */ #ifdef NBUF_MAP_UNMAP_DEBUG #define qdf_nbuf_map_tracker_bits 11 /* 2048 buckets */