Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4163259pxj; Tue, 11 May 2021 22:26:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJD8rBthKjOCCe0toVBUu3M+TcaBxN1WjS8Iv0+7Js115eeYGZQvuBxk0rR3j8RpU3ei1A X-Received: by 2002:aa7:dbc9:: with SMTP id v9mr40651445edt.183.1620797164194; Tue, 11 May 2021 22:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620797164; cv=none; d=google.com; s=arc-20160816; b=ZZLXTp0HGbSyKI8QL7o0OTk1otQtvc9qXvScaZvaEV1f96cmnoJciDpex+pq6843jg sOzscBmETgCqIMsVrR8Pai1Zaa4FMNj4FszKxfUko4Bi+gaeQSvg4PE7v7Z/P8r8QeOj HMWYNv3asD+lmkrXIU9OHQqccGRweBIRvsDnD/rYZI+TQ+tzJFLXE43mz6ra69EAXR1d wp0v2d03b39i+epr1P23+vDW15B5jCJ6A3a646T2wqztWijbWeQQYgG/7rs0szpHeqg8 ABqRS2vyYNtd95GNOdDKPQtZ5nSXUrb/RgjROAyeFwyRLVfdUdb3gVdCfKPnHbnqnwK4 qpqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ZeJYl1+SkmdxkoBaspquNgXaarFia8TUxupmsd/+gVY=; b=grVOQkoMWHiOK8wWVnVHSvvUOK/kBxcA2nogv1130afmT2YE6gca63dgPo9G6jS+h0 1ugeVESeRrxqHwO9o2FsVgAWEJgHCLojfqLON0EVxgLgx4T00K9k4ypZ8Y8w0t27YjlJ pWMzE8xYEnLE29ReO41XvXM+wzKngqjg/1a9rK6NIM4sOJ14iiggXE6RzDT2CQoNbI1W k4vifmmW7JQqVwqC6yAsQdUcF9j+vuW4nrGSEUt//miyKelRXFKSp7U3nBMqJqARAsRs gi5KvQ8pHq5N2JDEbRTEBceAr6+q57QB/hPU6yAF9nK0ZqfefctISTh/VcBZTKIdtmjS 8Yqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daynix-com.20150623.gappssmtp.com header.s=20150623 header.b=vSKokEZ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id se25si19331611ejb.310.2021.05.11.22.25.40; Tue, 11 May 2021 22:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@daynix-com.20150623.gappssmtp.com header.s=20150623 header.b=vSKokEZ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230035AbhELFZx (ORCPT + 99 others); Wed, 12 May 2021 01:25:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbhELFZx (ORCPT ); Wed, 12 May 2021 01:25:53 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFDC5C06174A for ; Tue, 11 May 2021 22:24:45 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id j75so21202574oih.10 for ; Tue, 11 May 2021 22:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZeJYl1+SkmdxkoBaspquNgXaarFia8TUxupmsd/+gVY=; b=vSKokEZ0qBlDZ8rMW/UFs7iLnVRflh5NB5KSfw8/+oz5/uYilhkmom4C8op6R/S4RM lwnZILjuXTKGDZo7DRUwEGneUq97o1WR49Z43p/oa9a++jbckLL0v4idWzPmq+V+75Bk jjPrdFqAEBzi7QnKjSbfSJZOu53czSSZTsBB7FE7a8aNfxS6ULsyQ00E2wrwewSR2Wke Lh5KFpd0Es3mwmYaHvNXWZMfjEOrHHNTrLTVxkqOjsTVRZ/SJbdegn2Xls6mYbF8otDJ yv+z35Ly+KybVA9UMM/B+RSk8IzUXoipGLkIH1T+MlZpH6gQAx+qYb8qQA29pk8bJzFZ rbQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZeJYl1+SkmdxkoBaspquNgXaarFia8TUxupmsd/+gVY=; b=rVB2FwwTgxw9pHMRQO34gjQdHMSsZwLf/3y/mU/AvQD0ugydgpqQaGnoDYP0OqXy+J Hz+v2Hyq0Rm5YlVZyZo09j60qCikFW/Z2FxqBMnw5EkVvnXfKOrZrR45fkti36oHMz9d Bvhgt+fW0NxeUNtD/vxPBzP4sMWJ3NvYZy4xq2JTh0UoWDtdVR4T3PSK3L7WXap0TanT r/G7kDj2MrfSJ6xpugdaaFvOZU59QVl+iCfGDSoUore9TfORDzJR7BKtOZ0uiEzIbIDt Y0ztjMksi5/EpGfHAp3+Y9zFiX+zsFpIk4piheSz1fqGHJACAMbUVcgfkjynMyYMVIl0 fixQ== X-Gm-Message-State: AOAM533vS+SdCFHc9GZC5JiUVlEiHaXj7lvIl27ACFHJi+fTYGM5uBTV v19NSwATm5np0OjKijCAx5//ZL8iVZsn2pmxxXCKIA== X-Received: by 2002:aca:ad06:: with SMTP id w6mr6316750oie.54.1620797085238; Tue, 11 May 2021 22:24:45 -0700 (PDT) MIME-Version: 1.0 References: <20210511044253.469034-1-yuri.benditovich@daynix.com> <20210511044253.469034-5-yuri.benditovich@daynix.com> <89759261-3a72-df6c-7a81-b7a48abfad44@redhat.com> In-Reply-To: <89759261-3a72-df6c-7a81-b7a48abfad44@redhat.com> From: Yuri Benditovich Date: Wed, 12 May 2021 08:24:33 +0300 Message-ID: Subject: Re: [PATCH 4/4] tun: indicate support for USO feature To: Jason Wang Cc: "David S. Miller" , Jakub Kicinski , "Michael S . Tsirkin" , Network Development , LKML , virtualization , Yan Vugenfirer Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021 at 4:33 AM Jason Wang wrote: > > > =E5=9C=A8 2021/5/11 =E4=B8=8B=E5=8D=884:33, Yuri Benditovich =E5=86=99=E9= =81=93: > > On Tue, May 11, 2021 at 9:50 AM Jason Wang wrote: > >> > >> =E5=9C=A8 2021/5/11 =E4=B8=8B=E5=8D=8812:42, Yuri Benditovich =E5=86= =99=E9=81=93: > >>> Signed-off-by: Yuri Benditovich > >>> --- > >>> drivers/net/tun.c | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/net/tun.c b/drivers/net/tun.c > >>> index 84f832806313..a35054f9d941 100644 > >>> --- a/drivers/net/tun.c > >>> +++ b/drivers/net/tun.c > >>> @@ -2812,7 +2812,7 @@ static int set_offload(struct tun_struct *tun, = unsigned long arg) > >>> arg &=3D ~(TUN_F_TSO4|TUN_F_TSO6); > >>> } > >>> > >>> - arg &=3D ~TUN_F_UFO; > >>> + arg &=3D ~(TUN_F_UFO|TUN_F_USO); > >> > >> It looks to me kernel doesn't use "USO", so TUN_F_UDP_GSO_L4 is a bett= er > >> name for this > > No problem, I can change it in v2 > > > > and I guess we should toggle NETIF_F_UDP_GSO_l4 here? > > > > No, we do not, because this indicates only the fact that the guest can > > send large UDP packets and have them splitted to UDP segments. > > > Actually the reverse. The set_offload() controls the tuntap TX path > (guest RX path). The set_offloads does 2 things: 1. At the initialization time qemu probes set_offload(something) to check which features are supported by TAP/TUN. 2. Later it configures the guest RX path according to guest's needs/capabil= ities Typical initialization sequence is (in case the QEMU supports USO feature): TAP/TUN set offload 11 (probe for UFO support) TAP/TUN set offload 21 (probe for USO support) TAP/TUN set offload 0 ... TAP/TUN set offload 7 (configuration of offloads according to GUEST feature= s) This series of patches is for VIRTIO_NET_F_HOST_USO only, virtio-net features like VIRTIO_NET_F_GUEST_USO_(4/6/whatever) are not defined in the spec yet. > > When VIRTIO_NET_F_GUEST_XXX was not negotiated, the corresponding netdev > features needs to be disabled. When host tries to send those packets to > guest, it needs to do software segmentation. > > See virtio_net_apply_guest_offloads(). > > There's currently no way (or not need) to prevent tuntap from receiving > GSO packets. > > Thanks > > > > > >> And how about macvtap? > > We will check how to do that for macvtap. We will send a separate > > patch for macvtap or ask for advice. > > > >> Thanks > >> > >> > >>> } > >>> > >>> /* This gives the user a way to test for new features in futur= e by >