From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754818AbcLZCiZ (ORCPT ); Sun, 25 Dec 2016 21:38:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52448 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927AbcLZCiW (ORCPT ); Sun, 25 Dec 2016 21:38:22 -0500 Subject: Re: [PATCH net 7/9] virtio-net: forbid XDP when VIRTIO_NET_F_GUEST_UFO is support To: John Fastabend , mst@redhat.com, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1482503852-12438-1-git-send-email-jasowang@redhat.com> <1482503852-12438-8-git-send-email-jasowang@redhat.com> <585D4AAD.4030702@gmail.com> <585D4C5E.5050908@gmail.com> Cc: john.r.fastabend@intel.com From: Jason Wang Message-ID: <45623ce6-5e9b-f341-9c60-8cfa725cec01@redhat.com> Date: Mon, 26 Dec 2016 10:38:16 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <585D4C5E.5050908@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 26 Dec 2016 02:38:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016年12月24日 00:10, John Fastabend wrote: > On 16-12-23 08:02 AM, John Fastabend wrote: >> On 16-12-23 06:37 AM, Jason Wang wrote: >>> When VIRTIO_NET_F_GUEST_UFO is negotiated, host could still send UFO >>> packet that exceeds a single page which could not be handled >>> correctly by XDP. So this patch forbids setting XDP when GUEST_UFO is >>> supported. While at it, forbid XDP for ECN (which comes only from GRO) >>> too to prevent user from misconfiguration. >>> > Is sending packets greater than single page though normal in this case? Yes, when NETIF_F_UFO was enabled for tap, it won't segment UFO packet and will send it directly to guest. (This could be reproduced with UDP_STREAM between two guests or host to guest). Thanks > I don't have any need to support big packet mode other than MST asked > for it. And I wasn't seeing this in my tests. MTU is capped at 4k - hdr > when XDP is enabled. > > .John > >>> Cc: John Fastabend >>> Signed-off-by: Jason Wang >>> --- >>> drivers/net/virtio_net.c | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c >>> index 77ae358..c1f66d8 100644 >>> --- a/drivers/net/virtio_net.c >>> +++ b/drivers/net/virtio_net.c >>> @@ -1684,7 +1684,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog) >>> int i, err; >>> >>> if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || >>> - virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) { >>> + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) || >>> + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || >>> + virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO)) { >>> netdev_warn(dev, "can't set XDP while host is implementing LRO, disable LRO first\n"); >>> return -EOPNOTSUPP; >>> } >>> >> Acked-by: John Fastabend >>