Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp140358lqp; Thu, 4 Apr 2024 09:01:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUL3RmMUueG5jXnrm+cJpTaBOY6kX1w6rTVuVv6wjnDrSLEzv6JRPNb4jv627XKJGWRtvix7izLWGpeVibB1fismde6By6arANjbr2WGQ== X-Google-Smtp-Source: AGHT+IGa1w0lJsV0iBgh5a/ymdMHh5qf0J/jRWmCYyvCHvYZSTUsMhnGRwyRcSMQcbti/G/JZBGD X-Received: by 2002:a17:90a:ce82:b0:2a2:c2f3:ce37 with SMTP id g2-20020a17090ace8200b002a2c2f3ce37mr2546516pju.24.1712246512341; Thu, 04 Apr 2024 09:01:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712246512; cv=pass; d=google.com; s=arc-20160816; b=ivzqndIP9NBuZJ4NPMgUA/3Y65GeFrqCoIon+0TT1aaaSnGCB1jjSaiduSGlZUK6e7 Tiu8YlKMExkNa9P/+8SsDibpOqDAZIyk013/al6jEfjP4HvJWZN9p9ObgPj2sGP/nORH b/IBKa0vy9NrEql40XL8MyXKtZ7SKo1fc3vNSd88ebyWB08GQdFLyDcAietlSNHY/BVS s45+CtgKL+LZbuzsYaahmbJZzT1XG/uVY9O31WjAJvN9zJl8WR5Uf5qTQfogZ18SOpTy /Ho5MMJGzDkWpwZZa8BdxxerU3VJvzNnrxo42ljuEtPOfiOCmKBXghpcvEPLtFtg+qSJ famw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MfoG59Ii3GnXIympG3Q0TE5v8Q+0lb0NrDw41syBAIM=; fh=B5gvjxB31ljWn9/oP8q8GGKyJ7/RnV7iry/PFi28Ayg=; b=M/bhgN0ibO38BoMKmn0bU3RPRRAjYcPoKZzogg8mtyt7KnIVIhcuzlmCJcH6LKExy1 NFkuOIgCeD+fgWMroPkdz+a2qjVwH11ZhUuyMM3j+9thrj3eoSr0OTUgcITssOjzARWI baR84bdCaeAoEI9jCiRdobXqwG+OUeqZC6y7raJzkCHVdBKmom+6cW8q2sglY7Y4wSRq ILQ1ED6ORQW6L8237plUgD7AB35QahTRZkYqbeLU4EoSKFjD+fVMumPiHIRc3LHPe/Am cU/QxxQt6cfhCochbxoHwl/QH3gCZbzM5Q6HU+Dl3GHPGlDgOOuTFe7Lan07HCwENbdv NSIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g802UKen; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-131759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id nu7-20020a17090b1b0700b002a03ef63b5dsi2029231pjb.150.2024.04.04.09.01.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 09:01:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g802UKen; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-131759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0109228668B for ; Thu, 4 Apr 2024 15:49:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 311E312D768; Thu, 4 Apr 2024 15:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="g802UKen" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80085132C1B; Thu, 4 Apr 2024 15:46:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712245569; cv=none; b=vCswNntLr9MCAj9pJC0JdUp9+kLJxTwx2i4HdtszMXNsPqmaS6LCxa9Cw/h+t5DnI+4HlNWjPfA3v/3QAttNbyemtReKq2tbomFKArti4YQT3QHiG+FOEFMGgnES4wVD/bhWdXVkyIkvYCVTYM3MiMwryeQnHcWj+LKxwz/eDfg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712245569; c=relaxed/simple; bh=h2xX5viKcqXvvZA3Hz2In9WNHWkHFwMdaq3Z6SIdJfY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l3D6XE5Zi/HxgWQoECUk2vri0GxRJH1HJ1rEjMASeu08AmJkLrieZWCA0kbn6vaExkFzH7I44nbvFaxVhhBkL6QV2xlxJe9850dAHo//qmQZf93VrOYK2j4m50DAv9ItTcNleW+Qyz8H+tkqKRhUmO5Gqq49ot81Mth8hB/03aQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=g802UKen; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712245568; x=1743781568; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=h2xX5viKcqXvvZA3Hz2In9WNHWkHFwMdaq3Z6SIdJfY=; b=g802UKenTYy7sPQiAeXSjyMonJp1sPuS6Zu45xujKveOL+OmgkluvDTH F7SqHNhWQSeiQqwkUhzwHMLMfUZ33oD/LF0oYISXpLz70i8DE4DdYz/By iOf3OBn8EFqrthh/PQa6huvf3moJL2Do8Jiet0E6jJ9D3tRo5GAb1NlFY ICwr4qHfafVR5m8fwW6y4o6VT5dtQ7m5tZLI3Qp+44aQsq1Xh5Mky/Dml G+3zcrzucV9ZlHJO1grHlZxdI1IoDN5J9FLybH62Di1bJ0Hc89q263JnN o3m9S3iy2cVQCW4tk3cHpLefFA8wFBhn5yQJUOtcnKyLEKjg//De0OGR8 A==; X-CSE-ConnectionGUID: NTIAd0NSQTOjCzX0Bgjnjw== X-CSE-MsgGUID: 08bdWsQmSsC1r01ZbVoaAw== X-IronPort-AV: E=McAfee;i="6600,9927,11034"; a="11312205" X-IronPort-AV: E=Sophos;i="6.07,179,1708416000"; d="scan'208";a="11312205" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2024 08:46:07 -0700 X-CSE-ConnectionGUID: wt3vYwmsS5qJdmZ4xoLx5g== X-CSE-MsgGUID: ewCrjZoNT9yCK/IOl1Mu1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,179,1708416000"; d="scan'208";a="23288081" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa005.fm.intel.com with ESMTP; 04 Apr 2024 08:46:03 -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 , 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 v9 5/9] page_pool: constify some read-only function arguments Date: Thu, 4 Apr 2024 17:43:58 +0200 Message-ID: <20240404154402.3581254-6-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404154402.3581254-1-aleksander.lobakin@intel.com> References: <20240404154402.3581254-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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; -- 2.44.0