Commit c11a49d5 authored by Wenbo Li's avatar Wenbo Li Committed by Paolo Abeni
Browse files

virtio_net: Fix mismatched buf address when unmapping for small packets



Currently, the virtio-net driver will perform a pre-dma-mapping for
small or mergeable RX buffer. But for small packets, a mismatched address
without VIRTNET_RX_PAD and xdp_headroom is used for unmapping.

That will result in unsynchronized buffers when SWIOTLB is enabled, for
example, when running as a TDX guest.

This patch unifies the address passed to the virtio core as the address of
the virtnet header and fixes the mismatched buffer address.

Changes from v2: unify the buf that passed to the virtio core in small
and merge mode.
Changes from v1: Use ctx to get xdp_headroom.

Fixes: 295525e2 ("virtio_net: merge dma operations when filling mergeable buffers")
Signed-off-by: default avatarWenbo Li <liwenbo.martin@bytedance.com>
Signed-off-by: default avatarJiahui Cen <cenjiahui@bytedance.com>
Signed-off-by: default avatarYing Fang <fangying.tommy@bytedance.com>
Reviewed-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
Link: https://patch.msgid.link/20240919081351.51772-1-liwenbo.martin@bytedance.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 0cbfd45f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment