Commit 484beac2 authored by Heng Qi's avatar Heng Qi Committed by David S. Miller
Browse files

virtio-net: disable the hole mechanism for xdp



XDP core assumes that the frame_size of xdp_buff and the length of
the frag are PAGE_SIZE. The hole may cause the processing of xdp to
fail, so we disable the hole mechanism when xdp is set.

Signed-off-by: default avatarHeng Qi <hengqi@linux.alibaba.com>
Reviewed-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5129bd8e
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -1426,7 +1426,10 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi,
		/* To avoid internal fragmentation, if there is very likely not
		/* To avoid internal fragmentation, if there is very likely not
		 * enough space for another buffer, add the remaining space to
		 * enough space for another buffer, add the remaining space to
		 * the current buffer.
		 * the current buffer.
		 * XDP core assumes that frame_size of xdp_buff and the length
		 * of the frag are PAGE_SIZE, so we disable the hole mechanism.
		 */
		 */
		if (!headroom)
			len += hole;
			len += hole;
		alloc_frag->offset += hole;
		alloc_frag->offset += hole;
	}
	}