diff mbox series

[net-next,08/11] net/mlx5e: Handle iov backed netmems

Message ID 20250116215530.158886-9-saeed@kernel.org (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series [net-next,01/11] net: Kconfig NET_DEVMEM selects GENERIC_ALLOCATOR | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: andrew+netdev@lunn.ch
netdev/build_clang success Errors and warnings before: 1 this patch: 1
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 22 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Saeed Mahameed Jan. 16, 2025, 9:55 p.m. UTC
From: Saeed Mahameed <saeedm@nvidia.com>

Special page pools can allocate an iov backed netmem, such netmem pages
are unreachable by driver, for such cases don't attempt to access those
pages in the driver. The only affected path is
mlx5e_add_skb_frag()->skb_can_coalesce().

Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index b08c2ac10b67..2ac00962c7a3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -528,15 +528,18 @@  mlx5e_add_skb_frag(struct mlx5e_rq *rq, struct sk_buff *skb,
 		   unsigned int truesize)
 {
 	dma_addr_t addr = page_pool_get_dma_addr_netmem(frag_page->netmem);
-	struct page *page = netmem_to_page(frag_page->netmem);
 	u8 next_frag = skb_shinfo(skb)->nr_frags;
 
 	dma_sync_single_for_cpu(rq->pdev, addr + frag_offset, len,
 				rq->buff.map_dir);
 
-	if (skb_can_coalesce(skb, next_frag, page, frag_offset)) {
-		skb_coalesce_rx_frag(skb, next_frag - 1, len, truesize);
-		return;
+	if (!netmem_is_net_iov(frag_page->netmem)) {
+		struct page *page = netmem_to_page(frag_page->netmem);
+
+		if (skb_can_coalesce(skb, next_frag, page, frag_offset)) {
+			skb_coalesce_rx_frag(skb, next_frag - 1, len, truesize);
+			return;
+		}
 	}
 
 	frag_page->frags++;