RE: [PATCH net] net: mana: Sync page pool RX frags for CPU
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: 2026-06-18 18:38:45
Also in:
linux-hyperv, linux-rdma, lkml, stable
-----Original Message-----
From: Dexuan Cui <decui@microsoft.com>
Sent: Wednesday, June 17, 2026 11:50 PM
To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
[off-list ref]; wei.liu@kernel.org; Dexuan Cui
[off-list ref]; Long Li [off-list ref];
andrew+netdev@lunn.ch; davem@davemloft.net; edumazet@google.com;
kuba@kernel.org; pabeni@redhat.com; Konstantin Taranov
[off-list ref]; horms@kernel.org; ernis@linux.microsoft.com;
dipayanroy@linux.microsoft.com; kees@kernel.org; jacob.e.keller@intel.com;
ssengar@linux.microsoft.com; linux-hyperv@vger.kernel.org;
netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
rdma@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH net] net: mana: Sync page pool RX frags for CPU
MANA allocates RX buffers from page pool fragments when frag_count is
greater than 1. In that case the buffers remain DMA mapped by page pool
and the RX completion path does not call dma_unmap_single(). As a result,
the implicit sync-for-CPU normally performed by dma_unmap_single() is
missing before the packet data is passed to the networking stack.
This breaks RX on configurations which require explicit DMA syncing, for
example when booted with swiotlb=force.
Fix this by recording the page pool page and DMA sync offset when the RX
buffer is allocated, and syncing the received packet range for CPU access
before handing the RX buffer to the stack.
Also validate the packet length reported in the RX CQE before using it as
a DMA sync length or passing it to skb processing. The CQE is supplied
by the device and should not be blindly trusted by Confidential VMs.
Fixes: 730ff06d3f5c ("net: mana: Use page pool fragments for RX buffers
instead of full pages to improve memory efficiency.")
Cc: stable@vger.kernel.org
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 61 +++++++++++++++----
include/net/mana/mana.h | 8 +++
2 files changed, 57 insertions(+), 12 deletions(-)Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>