]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled
authorFurong Xu <0x1207@gmail.com>
Thu, 19 Sep 2024 12:10:28 +0000 (20:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:42 +0000 (16:29 +0200)
commit3e8ac2743d487c34af79d20a7615190b4e59e29d
tree5c48e28db75e8acc5299e68be0abc59f849212df
parente9e3424d6d4b34d2c15071c71ec249a9f78ff341
net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled

[ Upstream commit b514c47ebf41a6536551ed28a05758036e6eca7c ]

Commit 5fabb01207a2 ("net: stmmac: Add initial XDP support") sets
PP_FLAG_DMA_SYNC_DEV flag for page_pool unconditionally,
page_pool_recycle_direct() will call page_pool_dma_sync_for_device()
on every page even the page is not going to be reused by XDP program.

When XDP is not enabled, the page which holds the received buffer
will be recycled once the buffer is copied into new SKB by
skb_copy_to_linear_data(), then the MAC core will never reuse this
page any longer. Always setting PP_FLAG_DMA_SYNC_DEV wastes CPU cycles
on unnecessary calling of page_pool_dma_sync_for_device().

After this patch, up to 9% noticeable performance improvement was observed
on certain platforms.

Fixes: 5fabb01207a2 ("net: stmmac: Add initial XDP support")
Signed-off-by: Furong Xu <0x1207@gmail.com>
Link: https://patch.msgid.link/20240919121028.1348023-1-0x1207@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c