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

Saeed Mahameed
2025-01-16T21:55:58Z

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 --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++;
--
2.48.0