From patchwork Thu Apr 18 11:36:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 13634539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2DF6C4345F for ; Thu, 18 Apr 2024 11:37:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 756CB6B00A4; Thu, 18 Apr 2024 07:37:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 705BE6B00A5; Thu, 18 Apr 2024 07:37:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55B916B00A6; Thu, 18 Apr 2024 07:37:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 345566B00A4 for ; Thu, 18 Apr 2024 07:37:00 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B72E9C1178 for ; Thu, 18 Apr 2024 11:36:59 +0000 (UTC) X-FDA: 82022450958.12.ACBC5D2 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by imf25.hostedemail.com (Postfix) with ESMTP id 94EF8A001C for ; Thu, 18 Apr 2024 11:36:57 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=hCUSfI2V; spf=pass (imf25.hostedemail.com: domain of aleksander.lobakin@intel.com designates 192.198.163.11 as permitted sender) smtp.mailfrom=aleksander.lobakin@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713440217; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MfoG59Ii3GnXIympG3Q0TE5v8Q+0lb0NrDw41syBAIM=; b=6fBq1bKujwcqVelB1KbLIsb1onlUK0Dg418xPXMyIjWVNt8SyFDGdlcFHZaP9EXGPhT2ZU BNSM+BI0CB0l20SWOetEUIZe5W8Pi8cbZKr2zRtHbcNwOz2fq6HOHvfQHDfZQimMHhfKPP FStgbA9CWVsMOTXdlL805YniGh20kbs= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=hCUSfI2V; spf=pass (imf25.hostedemail.com: domain of aleksander.lobakin@intel.com designates 192.198.163.11 as permitted sender) smtp.mailfrom=aleksander.lobakin@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713440217; a=rsa-sha256; cv=none; b=z3UVuOqHdc8I21cYLCRCHGrDZrT36eugSzIw0f/J/22NOCCSTs3hwHToKon5aEnmCjC2Dw HzV9nCWZyZ72BboJrof5o8YjQgi25sNem+a11BGXY7xccoE2+GpabH/F2pZ4XCq+Ju0Fpq JeByK1/qRTd1eSdGjHxCyvuFr/tSNr8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713440217; x=1744976217; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=h2xX5viKcqXvvZA3Hz2In9WNHWkHFwMdaq3Z6SIdJfY=; b=hCUSfI2V7UB08TXuq5B9Nm9aXLSImS9nV4KY8keT3LCdpjwNYfTLe8M/ 7rwXCmukA7Sda8LqpvUJNOirtCklDQO1aLWsovt093qfzcTAraN45QXZo bxNmqtSUxbH1zQkRcH5DuoYRcZWtlaQfdQRDnewKGZ8ACDTwgFtlP5z18 35vIr1DwA6hLR95rkJZlI86knJ/O0ft73Nbld63xk2/EcMCdMlqjg8jVD H41kO8d9DCEbFN8tCgyB8hF/A9rtWd5WnMmQm+1NbACoS0A5fjTq41DRR WsLZqIuOLChPqgO4NNLtG5NHJ5AsWqiO6ZMOenR3c2jEKXY9HDvSTiKLA g==; X-CSE-ConnectionGUID: m86PVJ9vTYW0ca5WAbsiKw== X-CSE-MsgGUID: CsOvj1JnTjyQkcGa+9GURA== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="19587779" X-IronPort-AV: E=Sophos;i="6.07,212,1708416000"; d="scan'208";a="19587779" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 04:36:57 -0700 X-CSE-ConnectionGUID: p6W5bC0aQhmsn14JYtA0WQ== X-CSE-MsgGUID: VXQ/b6QsQvqcKshkj46Mlg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,212,1708416000"; d="scan'208";a="27586114" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa004.fm.intel.com with ESMTP; 18 Apr 2024 04:36:53 -0700 From: Alexander Lobakin To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Lobakin , Alexander Duyck , Yunsheng Lin , Jesper Dangaard Brouer , Ilias Apalodimas , Christoph Lameter , Vlastimil Babka , Andrew Morton , Przemek Kitszel , nex.sw.ncis.osdt.itp.upstreaming@intel.com, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v10 05/10] page_pool: constify some read-only function arguments Date: Thu, 18 Apr 2024 13:36:11 +0200 Message-ID: <20240418113616.1108566-6-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240418113616.1108566-1-aleksander.lobakin@intel.com> References: <20240418113616.1108566-1-aleksander.lobakin@intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 94EF8A001C X-Stat-Signature: cm9gmwt3zi17uf1iyozng4rgdbf4w4of X-Rspam-User: X-Rspamd-Server: rspam07 X-HE-Tag: 1713440217-997232 X-HE-Meta: U2FsdGVkX1/MtNi8p12TEkr/UKoXsybo395BOHDO/rex850sJLvsWHZfmY+Dv9QuZEL6smUy95rkiMNlcabjD7awy231+GrY/77Ae7ucSmBu+WHNnUE15uCsv5Za8S6LzXBzW1QYWrpLE3WyuGRxGqzsCS6C1KBdm5Ts/nDPhzWYQqiOA+ewASGfM5KqX32AGAAAvPhNVnTUr3k2JHX7I1t9A2HjPkS4nxZmfE5l8duK0ueZog6PE9FEpcWQuX7/qeOVNHav2izTi7A2f97gIQnB/3rx6CPpMlzmofZHgpUjd8hxQ7UgalzkbLpUq+aXSini9QHfMAkRk7g7BSDS/GtJTTp+ZbW+gRl5t5O4Qtnc2wQZnRWp79T/wRbodoFIvLqAioZOFaRkYeKrbIOCtK4HqZVXFRbWNXGLSBGm7GD8qHth3s/Utcsh+vP33WOtNxXJLz0Q8OFAyGjj+QSgByMskyaB9FM0aMH95u1L9l82zGsKCowlVvJ7Hw3NOebqCsYdtOhfufssgurzqTzly7B9WupbiuvcQ1PRZzTNbK5dMgCPe85aWViiiN7pC42wrmGkncWTV/gS25XE6ZokIKRGtRHXKE51EJMPObmDhlz5dM3tvLLC9kka42VISeerHvTWa+0NS2aySYx8NZK7tiV1xnDHHPqzxFbzL5zj0hmLcV9QXbwESlhZMJb9Qz3YbvwzfJXO0nH9NczKup6duJdZ8sYOu+vJmXa8228IN53sVbK9J3B+7NSOzyXWSF+10yzvWu9TvE8mWPrsTYtVxhCfT5sGFBZWwdQasn7lfaaicqGmHPqorioWS6Gu/L+cicJCCdpNBt3PEeM1MnWGmFrGhjp+J9BSYR7+Lx5osJQcVoI/YE2nEjpu2HV02ULx5a9XlCop+HEAZa/fzp1boq7kVeygcqxwSTm7GqzqXoI6M8KnfpEZWy7HKU1Lsi2XR0IWg5M10Yd1akWGkfE PGflQB2n Z2fQ3InoyQipQge/zgZurzzfpc6hdSyTyXB78x1d5yHkIgZtiZxvRUrS86orh53rWEtjw8sMmQmE5+1aaPJQOic0DI3WsKHHFh8qexpQFgciWHb0SlrjJ/m1oWccniW1W25seqSlMY2BZu3Hoj6+g+j41928cuBUX2FibXuCbtB0iRlTjBjTd0PIXt4EbDgoe3rocIGxSAZW+ErSj7cOBqdaJRsarC6k5l27Y/u54qUdcYYm3kUbFa4bQv76UQtzk+py+qp54K7mfhPc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: There are several functions taking pointers to data they don't modify. This includes statistics fetching, page and page_pool parameters, etc. Constify the pointers, so that call sites will be able to pass const pointers as well. No functional changes, no visible changes in functions sizes. Reviewed-by: Ilias Apalodimas Signed-off-by: Alexander Lobakin --- include/net/page_pool/types.h | 4 ++-- include/net/page_pool/helpers.h | 10 +++++----- net/core/page_pool.c | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h index 5e43a08d3231..a6ebed002216 100644 --- a/include/net/page_pool/types.h +++ b/include/net/page_pool/types.h @@ -213,7 +213,7 @@ struct xdp_mem_info; #ifdef CONFIG_PAGE_POOL void page_pool_destroy(struct page_pool *pool); void page_pool_use_xdp_mem(struct page_pool *pool, void (*disconnect)(void *), - struct xdp_mem_info *mem); + const struct xdp_mem_info *mem); void page_pool_put_page_bulk(struct page_pool *pool, void **data, int count); #else @@ -223,7 +223,7 @@ static inline void page_pool_destroy(struct page_pool *pool) static inline void page_pool_use_xdp_mem(struct page_pool *pool, void (*disconnect)(void *), - struct xdp_mem_info *mem) + const struct xdp_mem_info *mem) { } diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h index 1d397c1a0043..c7bb06750e85 100644 --- a/include/net/page_pool/helpers.h +++ b/include/net/page_pool/helpers.h @@ -58,7 +58,7 @@ /* Deprecated driver-facing API, use netlink instead */ int page_pool_ethtool_stats_get_count(void); u8 *page_pool_ethtool_stats_get_strings(u8 *data); -u64 *page_pool_ethtool_stats_get(u64 *data, void *stats); +u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats); bool page_pool_get_stats(const struct page_pool *pool, struct page_pool_stats *stats); @@ -73,7 +73,7 @@ static inline u8 *page_pool_ethtool_stats_get_strings(u8 *data) return data; } -static inline u64 *page_pool_ethtool_stats_get(u64 *data, void *stats) +static inline u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats) { return data; } @@ -204,8 +204,8 @@ static inline void *page_pool_dev_alloc_va(struct page_pool *pool, * Get the stored dma direction. A driver might decide to store this locally * and avoid the extra cache line from page_pool to determine the direction. */ -static -inline enum dma_data_direction page_pool_get_dma_dir(struct page_pool *pool) +static inline enum dma_data_direction +page_pool_get_dma_dir(const struct page_pool *pool) { return pool->p.dma_dir; } @@ -370,7 +370,7 @@ static inline void page_pool_free_va(struct page_pool *pool, void *va, * Fetch the DMA address of the page. The page pool to which the page belongs * must had been created with PP_FLAG_DMA_MAP. */ -static inline dma_addr_t page_pool_get_dma_addr(struct page *page) +static inline dma_addr_t page_pool_get_dma_addr(const struct page *page) { dma_addr_t ret = page->dma_addr; diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 4c175091fc0a..273c24429bce 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -123,9 +123,9 @@ int page_pool_ethtool_stats_get_count(void) } EXPORT_SYMBOL(page_pool_ethtool_stats_get_count); -u64 *page_pool_ethtool_stats_get(u64 *data, void *stats) +u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats) { - struct page_pool_stats *pool_stats = stats; + const struct page_pool_stats *pool_stats = stats; *data++ = pool_stats->alloc_stats.fast; *data++ = pool_stats->alloc_stats.slow; @@ -383,8 +383,8 @@ static struct page *__page_pool_get_cached(struct page_pool *pool) return page; } -static void page_pool_dma_sync_for_device(struct page_pool *pool, - struct page *page, +static void page_pool_dma_sync_for_device(const struct page_pool *pool, + const struct page *page, unsigned int dma_sync_size) { dma_addr_t dma_addr = page_pool_get_dma_addr(page); @@ -987,7 +987,7 @@ static void page_pool_release_retry(struct work_struct *wq) } void page_pool_use_xdp_mem(struct page_pool *pool, void (*disconnect)(void *), - struct xdp_mem_info *mem) + const struct xdp_mem_info *mem) { refcount_inc(&pool->user_cnt); pool->disconnect = disconnect;