[PATCH net-next v1] page_pool: check for dma_sync_size earlier
From: Furong Xu
Date: Thu Oct 10 2024 - 07:40:49 EST
Setting dma_sync_size to 0 is not illegal, and several drivers already did.
We can save a couple of function calls if check for dma_sync_size earlier.
Signed-off-by: Furong Xu <0x1207@xxxxxxxxx>
---
net/core/page_pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index a813d30d2135..fac52ba3f7c4 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -454,7 +454,7 @@ page_pool_dma_sync_for_device(const struct page_pool *pool,
netmem_ref netmem,
u32 dma_sync_size)
{
- if (pool->dma_sync && dma_dev_need_sync(pool->p.dev))
+ if (dma_sync_size && pool->dma_sync && dma_dev_need_sync(pool->p.dev))
__page_pool_dma_sync_for_device(pool, netmem, dma_sync_size);
}
--
2.34.1