From 37cd1d31acc0dbb5d4f6f60997436344ac3663c8 Mon Sep 17 00:00:00 2001 From: "Alan Z. Chen" Date: Tue, 14 Nov 2023 14:41:15 -0800 Subject: [PATCH] qcacmn: Add changes to compile on LTS 6.5 kernel Add necessary changes for deprecated kernel APIs and other changes in kernel code in order to compile on LTS 6.5 kernel. Change-Id: I7c51b1d435090877d488f6433357ed1ed7c265b4 CRs-Fixed: 3663875 --- qdf/inc/qdf_nbuf.h | 25 +------------------------ qdf/inc/qdf_talloc.h | 4 ++-- qdf/linux/src/i_qdf_talloc.h | 4 ++-- qdf/linux/src/qdf_nbuf.c | 33 +-------------------------------- qdf/src/qdf_talloc.c | 6 +++--- 5 files changed, 9 insertions(+), 63 deletions(-) diff --git a/qdf/inc/qdf_nbuf.h b/qdf/inc/qdf_nbuf.h index 4a678f8016..d415b979d3 100644 --- a/qdf/inc/qdf_nbuf.h +++ b/qdf/inc/qdf_nbuf.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -5373,18 +5373,6 @@ void qdf_nbuf_add_rx_frag_debug(qdf_frag_t buf, qdf_nbuf_t nbuf, unsigned int truesize, bool take_frag_ref, const char *func, uint32_t line); -#define qdf_nbuf_ref_frag(f) \ - qdf_nbuf_ref_frag_debug(f, __func__, __LINE__) - -/** - * qdf_nbuf_ref_frag_debug() - get frag reference - * @buf: Frag pointer needs to be taken reference. - * @func: Caller function name - * @line: Caller function line no. - * - * Return: none - */ -void qdf_nbuf_ref_frag_debug(qdf_frag_t buf, const char *func, uint32_t line); /** * qdf_net_buf_debug_acquire_frag() - Add frag nodes to frag debug tracker @@ -5485,17 +5473,6 @@ static inline void qdf_nbuf_add_rx_frag(qdf_frag_t buf, qdf_nbuf_t nbuf, frag_len, truesize, take_frag_ref); } -/** - * qdf_nbuf_ref_frag() - get frag reference - * @buf: Frag pointer needs to be taken reference. - * - * Return: void - */ -static inline void qdf_nbuf_ref_frag(qdf_frag_t buf) -{ - __qdf_nbuf_ref_frag(buf); -} - static inline void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf, const char *func, uint32_t line) diff --git a/qdf/inc/qdf_talloc.h b/qdf/inc/qdf_talloc.h index 10486c25f0..ff7c4a0484 100644 --- a/qdf/inc/qdf_talloc.h +++ b/qdf/inc/qdf_talloc.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2018 The Linux Foundation. All rights reserved. - * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -158,7 +158,7 @@ static inline void *__qdf_talloc_fl(const void *parent, const size_t size, static inline void __qdf_tfree_fl(void *ptr, const char *func, const uint16_t line) { - __free(ptr); + __k_free(ptr); } static inline void diff --git a/qdf/linux/src/i_qdf_talloc.h b/qdf/linux/src/i_qdf_talloc.h index 6aa00f645b..1e00193644 100644 --- a/qdf/linux/src/i_qdf_talloc.h +++ b/qdf/linux/src/i_qdf_talloc.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -39,7 +39,7 @@ #define __zalloc_auto(size) \ kzalloc(size, __can_sleep() ? GFP_KERNEL : GFP_ATOMIC) -#define __free(ptr) kfree(ptr) +#define __k_free(ptr) kfree(ptr) #define __qdf_alloc_size(ptr) ksize(ptr) diff --git a/qdf/linux/src/qdf_nbuf.c b/qdf/linux/src/qdf_nbuf.c index c62b0ae762..0f63f980cc 100644 --- a/qdf/linux/src/qdf_nbuf.c +++ b/qdf/linux/src/qdf_nbuf.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -5941,24 +5941,6 @@ void __qdf_nbuf_add_rx_frag(__qdf_frag_t buf, __qdf_nbuf_t nbuf, qdf_export_symbol(__qdf_nbuf_add_rx_frag); -void __qdf_nbuf_ref_frag(__qdf_frag_t buf) -{ - struct page *page; - skb_frag_t frag = {0}; - - page = virt_to_head_page(buf); - __skb_frag_set_page(&frag, page); - - /* - * since __skb_frag_ref() just use page to increase ref - * we just decode page alone - */ - qdf_frag_count_inc(QDF_NBUF_FRAG_DEBUG_COUNT_ONE); - __skb_frag_ref(&frag); -} - -qdf_export_symbol(__qdf_nbuf_ref_frag); - #ifdef NBUF_FRAG_MEMORY_DEBUG QDF_STATUS qdf_nbuf_move_frag_page_offset_debug(qdf_nbuf_t nbuf, uint8_t idx, @@ -6018,19 +6000,6 @@ void qdf_nbuf_add_rx_frag_debug(qdf_frag_t buf, qdf_nbuf_t nbuf, qdf_export_symbol(qdf_nbuf_add_rx_frag_debug); -void qdf_nbuf_ref_frag_debug(qdf_frag_t buf, const char *func, uint32_t line) -{ - __qdf_nbuf_ref_frag(buf); - - if (qdf_likely(is_initial_mem_debug_disabled)) - return; - - /* Update frag refcount in frag debug tracking table */ - qdf_frag_debug_refcount_inc(buf, func, line); -} - -qdf_export_symbol(qdf_nbuf_ref_frag_debug); - void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf, const char *func, uint32_t line) { diff --git a/qdf/src/qdf_talloc.c b/qdf/src/qdf_talloc.c index 4bbafb1e4d..bffa6dc972 100644 --- a/qdf/src/qdf_talloc.c +++ b/qdf/src/qdf_talloc.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2018, 2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -90,7 +90,7 @@ static void __qdf_free(const void *ptr) { qdf_mem_kmalloc_dec(__qdf_alloc_size(ptr)); - __free(ptr); + __k_free(ptr); } static qdf_ht_declare(__qdf_talloc_meta_ht, QDF_TALLOC_HT_BITS); @@ -129,7 +129,7 @@ static void qdf_talloc_parent_meta_free(struct qdf_talloc_parent_meta *pmeta) { qdf_ht_remove(&pmeta->entry); qdf_list_destroy(&pmeta->children); - __free(pmeta); + __k_free(pmeta); } static struct qdf_talloc_parent_meta *