aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/page_pool.c
diff options
context:
space:
mode:
authorMina Almasry <[email protected]>2024-12-11 21:20:31 +0000
committerJakub Kicinski <[email protected]>2024-12-13 02:49:08 +0000
commit7dba339faae991a23c54f7b93a58798c58f8c16f (patch)
treee6cdfdf0c2deb471a5e640b5c652005b456aab79 /net/core/page_pool.c
parentpage_pool: Set `dma_sync` to false for devmem memory provider (diff)
downloadkernel-7dba339faae991a23c54f7b93a58798c58f8c16f.tar.gz
kernel-7dba339faae991a23c54f7b93a58798c58f8c16f.zip
page_pool: disable sync for cpu for dmabuf memory provider
dmabuf dma-addresses should not be dma_sync'd for CPU/device. Typically its the driver responsibility to dma_sync for CPU, but the driver should not dma_sync for CPU if the netmem is actually coming from a dmabuf memory provider. The page_pool already exposes a helper for dma_sync_for_cpu: page_pool_dma_sync_for_cpu. Upgrade this existing helper to handle netmem, and have it skip dma_sync if the memory is from a dmabuf memory provider. Drivers should migrate to using this helper when adding support for netmem. Also minimize the impact on the dma syncing performance for pages. Special case the dma-sync path for pages to not go through the overhead checks for dma-syncing and conversion to netmem. Cc: Alexander Lobakin <[email protected]> Cc: Jason Gunthorpe <[email protected]> Signed-off-by: Mina Almasry <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/core/page_pool.c')
-rw-r--r--net/core/page_pool.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 275a7fd209d7..e07ad7315955 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -201,6 +201,7 @@ static int page_pool_init(struct page_pool *pool,
memcpy(&pool->slow, &params->slow, sizeof(pool->slow));
pool->cpuid = cpuid;
+ pool->dma_sync_for_cpu = true;
/* Validate only known flags were used */
if (pool->slow.flags & ~PP_FLAG_ALL)