From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C77FC433E7 for ; Sat, 10 Oct 2020 02:10:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B2D42225D for ; Sat, 10 Oct 2020 02:10:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AGxCOJHz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730092AbgJJCIv (ORCPT ); Fri, 9 Oct 2020 22:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729873AbgJJB5j (ORCPT ); Fri, 9 Oct 2020 21:57:39 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08A61C0613CF for ; Fri, 9 Oct 2020 18:57:39 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id t21so11311829eds.6 for ; Fri, 09 Oct 2020 18:57:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ej9W/wdGVHkJe37GtEVPFUNkVAYebVIX+ppZawU5yrs=; b=AGxCOJHzE8qt9ydl/IFHP1pag6Xl2y0SE6klNIOxFzIPPOL9B1XBGnoEnNg+MdCh0G MHvMO+8NydjJjzZLvD1Sh+rjlc9BPaP8mJ2rdRUtBObCS89ZtnqW4zHe4prcYfHWfmGa 3e9j+lVcc+InthdxpylwAj5yHUEyGStkdSwYSYnXyzTNuMl6RZeXFB5orzWCvGGL/qmo 3B7gfcEoeP9R0MKPU1pZqtCneKTBbUifr8fKnkGWtkZq4QbBtDeudVSh5tgHIcPVygZa yPHQzFeiGbyg0LcYWG+E6dKX/CfjmK/meXzQXjiT1OIKIT5MVere9406dlZ5Irpq+w+w +4cA== 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; bh=Ej9W/wdGVHkJe37GtEVPFUNkVAYebVIX+ppZawU5yrs=; b=FRZxFNChyXC/Wjh2AuJGCbiz9mcMCss2p5bcxe52GH0V3tTIcnrFZ22kCwuK3optkS GSh0OtverTYK1nr4dKv7g3c3yX1KxqNrRINV4JSRD8aBgO+Pq4YiGIlP7YcGmEq2YGh5 z7zYAAmRVik/wWvbH98eEpd4b4lxazpPYRlRV3QRDTgKDq2wZHdFYgX6ea+CQT5XrTjl 9nVekx91areKNf6wd6jxX2LwgHUElG3qfWV7/pwTqfoEJw2iws2hZvSEKcUzRNhO9ZtZ YOPo6qQg8UMnqk4OnGIEuMfq9FYa2ldA8hSAursczuc8+3PVacXBgV1pAkHHpLhfcan0 3rBQ== X-Gm-Message-State: AOAM532l8xU7JeizdLxqOHPhRMuvQhyAEi9x+Vr26DV4IG2AcSqVHb3l k5AZ2Rnh2k3w1cU6VfEdEo9pIXw9tRHO2qZIhJE= X-Google-Smtp-Source: ABdhPJyJJ+UkVEE2d2vb9hs4seDQAQq4hn36I76NEv8nbeEGM+0qf7M+SunlzivmvT00lYbk0s/isHHe1DNP0bwbmf4= X-Received: by 2002:a05:6402:7c8:: with SMTP id u8mr2267491edy.153.1602295057527; Fri, 09 Oct 2020 18:57:37 -0700 (PDT) MIME-Version: 1.0 References: <20200930020300.62245-1-xiangxia.m.yue@gmail.com> In-Reply-To: From: Tonghao Zhang Date: Sat, 10 Oct 2020 09:53:45 +0800 Message-ID: Subject: Re: [PATCH net-next v2] virtio-net: ethtool configurable RXCSUM To: Willem de Bruijn Cc: Jason Wang , "Michael S. Tsirkin" , virtualization@lists.linux-foundation.org, Network Development Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Oct 9, 2020 at 9:49 PM Willem de Bruijn wrote: > > On Thu, Oct 8, 2020 at 9:19 PM Tonghao Zhang wrote: > > > > On Wed, Sep 30, 2020 at 6:05 PM Willem de Bruijn > > wrote: > > > > > > On Wed, Sep 30, 2020 at 4:05 AM wrote: > > > > > > > > From: Tonghao Zhang > > > > > > > > Allow user configuring RXCSUM separately with ethtool -K, > > > > reusing the existing virtnet_set_guest_offloads helper > > > > that configures RXCSUM for XDP. This is conditional on > > > > VIRTIO_NET_F_CTRL_GUEST_OFFLOADS. > > > > > > > > If Rx checksum is disabled, LRO should also be disabled. > > > > > > > > Cc: Michael S. Tsirkin > > > > Cc: Jason Wang > > > > Signed-off-by: Tonghao Zhang > > > > > > The first patch was merged into net. > > > > > > Please wait until that is merged into net-next, as this depends on the > > > other patch. > > > > > > > --- > > > > v2: > > > > * LRO depends the rx csum > > > > * remove the unnecessary check > > > > --- > > > > drivers/net/virtio_net.c | 49 ++++++++++++++++++++++++++++++---------- > > > > 1 file changed, 37 insertions(+), 12 deletions(-) > > > > > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > > > index 21b71148c532..5407a0106771 100644 > > > > --- a/drivers/net/virtio_net.c > > > > +++ b/drivers/net/virtio_net.c > > > > @@ -68,6 +68,8 @@ static const unsigned long guest_offloads[] = { > > > > (1ULL << VIRTIO_NET_F_GUEST_ECN) | \ > > > > (1ULL << VIRTIO_NET_F_GUEST_UFO)) > > > > > > > > +#define GUEST_OFFLOAD_CSUM_MASK (1ULL << VIRTIO_NET_F_GUEST_CSUM) > > > > + > > > > struct virtnet_stat_desc { > > > > char desc[ETH_GSTRING_LEN]; > > > > size_t offset; > > > > @@ -2522,29 +2524,49 @@ static int virtnet_get_phys_port_name(struct net_device *dev, char *buf, > > > > return 0; > > > > } > > > > > > > > +static netdev_features_t virtnet_fix_features(struct net_device *netdev, > > > > + netdev_features_t features) > > > > +{ > > > > + /* If Rx checksum is disabled, LRO should also be disabled. > > > > + * That is life. :) > > > > > > Please remove this second line. > > OK > > > > + */ > > > > + if (!(features & NETIF_F_RXCSUM)) > > > > + features &= ~NETIF_F_LRO; > > > > + > > > > + return features; > > > > +} > > > > + > > > > static int virtnet_set_features(struct net_device *dev, > > > > netdev_features_t features) > > > > { > > > > struct virtnet_info *vi = netdev_priv(dev); > > > > - u64 offloads; > > > > + u64 offloads = vi->guest_offloads & > > > > + vi->guest_offloads_capable; > > > > > > When can vi->guest_offloads have bits set outside the mask of > > > vi->guest_offloads_capable? > > In this case, we can use only vi->guest_offloads. and > > guest_offloads_capable will not be used any more. > > so should we remove guest_offloads_capable ? > > That bitmap stores the capabilities of the device as learned at > initial device probe. I don't see how it can be removed. Hi Willem guest_offloads_capable was introduced by a02e8964eaf9 ("virtio-net: ethtool configurable LRO") and used only for LRO. Now we don't use it anymore, right ? because this patch (virtio-net: ethtool configurable RXCSUM) doesn't use it. -- Best regards, Tonghao From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 677ABC433DF for ; Sat, 10 Oct 2020 01:57:43 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DAE872225B for ; Sat, 10 Oct 2020 01:57:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AGxCOJHz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAE872225B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 84C1220434; Sat, 10 Oct 2020 01:57:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B0gQq3NTnA-I; Sat, 10 Oct 2020 01:57:41 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 3ED1E2042B; Sat, 10 Oct 2020 01:57:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1DCF9C07FF; Sat, 10 Oct 2020 01:57:41 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7C02FC0051 for ; Sat, 10 Oct 2020 01:57:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 62D45878AC for ; Sat, 10 Oct 2020 01:57:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WmHtABeN9fSS for ; Sat, 10 Oct 2020 01:57:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by hemlock.osuosl.org (Postfix) with ESMTPS id 450BC878A5 for ; Sat, 10 Oct 2020 01:57:39 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id g4so11355333edk.0 for ; Fri, 09 Oct 2020 18:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ej9W/wdGVHkJe37GtEVPFUNkVAYebVIX+ppZawU5yrs=; b=AGxCOJHzE8qt9ydl/IFHP1pag6Xl2y0SE6klNIOxFzIPPOL9B1XBGnoEnNg+MdCh0G MHvMO+8NydjJjzZLvD1Sh+rjlc9BPaP8mJ2rdRUtBObCS89ZtnqW4zHe4prcYfHWfmGa 3e9j+lVcc+InthdxpylwAj5yHUEyGStkdSwYSYnXyzTNuMl6RZeXFB5orzWCvGGL/qmo 3B7gfcEoeP9R0MKPU1pZqtCneKTBbUifr8fKnkGWtkZq4QbBtDeudVSh5tgHIcPVygZa yPHQzFeiGbyg0LcYWG+E6dKX/CfjmK/meXzQXjiT1OIKIT5MVere9406dlZ5Irpq+w+w +4cA== 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; bh=Ej9W/wdGVHkJe37GtEVPFUNkVAYebVIX+ppZawU5yrs=; b=Di66WDf79U2K9HIBfTZ6WTj7PwF5XpjqCQduE/BPk0jt2gNubK0oewVxNw2iOjV6+R RUSk580XBvo5GZHau/hl0clFyAAvSM22VfzTjxXLITmgJJ8zgvWMI4/JKrtA5NdWCdzE F+XcdhOBdQ6S/oXToRf9yYPMt8O/9F/0SkZRkMdGpVgmJVQkSDSqmN+rugi1ykfQSNYN P+7ikAEGV5ezTMXcZhA3fkt9pMOtqL6qI/Ev4fs9n2ljGlkcy2QqN93k7kfAVr81Mybq NEerlA5gfEDen5yB7PKv5FJrS90N1XRgTWKsFjACjqjJ2eE4NhxjHlBPT2rHfW5jKfDe sLGQ== X-Gm-Message-State: AOAM530KX6YbXHNuSJAKnaVKiv++PAtGr6Vq8cmrScymOtKwfNcRX8YK 4KvSxX0OfTP+ZfvM5n9CA+KQJ5rjPUFGOD1MjdE= X-Google-Smtp-Source: ABdhPJyJJ+UkVEE2d2vb9hs4seDQAQq4hn36I76NEv8nbeEGM+0qf7M+SunlzivmvT00lYbk0s/isHHe1DNP0bwbmf4= X-Received: by 2002:a05:6402:7c8:: with SMTP id u8mr2267491edy.153.1602295057527; Fri, 09 Oct 2020 18:57:37 -0700 (PDT) MIME-Version: 1.0 References: <20200930020300.62245-1-xiangxia.m.yue@gmail.com> In-Reply-To: From: Tonghao Zhang Date: Sat, 10 Oct 2020 09:53:45 +0800 Message-ID: Subject: Re: [PATCH net-next v2] virtio-net: ethtool configurable RXCSUM To: Willem de Bruijn Cc: Network Development , virtualization@lists.linux-foundation.org, "Michael S. Tsirkin" X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Fri, Oct 9, 2020 at 9:49 PM Willem de Bruijn wrote: > > On Thu, Oct 8, 2020 at 9:19 PM Tonghao Zhang wrote: > > > > On Wed, Sep 30, 2020 at 6:05 PM Willem de Bruijn > > wrote: > > > > > > On Wed, Sep 30, 2020 at 4:05 AM wrote: > > > > > > > > From: Tonghao Zhang > > > > > > > > Allow user configuring RXCSUM separately with ethtool -K, > > > > reusing the existing virtnet_set_guest_offloads helper > > > > that configures RXCSUM for XDP. This is conditional on > > > > VIRTIO_NET_F_CTRL_GUEST_OFFLOADS. > > > > > > > > If Rx checksum is disabled, LRO should also be disabled. > > > > > > > > Cc: Michael S. Tsirkin > > > > Cc: Jason Wang > > > > Signed-off-by: Tonghao Zhang > > > > > > The first patch was merged into net. > > > > > > Please wait until that is merged into net-next, as this depends on the > > > other patch. > > > > > > > --- > > > > v2: > > > > * LRO depends the rx csum > > > > * remove the unnecessary check > > > > --- > > > > drivers/net/virtio_net.c | 49 ++++++++++++++++++++++++++++++---------- > > > > 1 file changed, 37 insertions(+), 12 deletions(-) > > > > > > > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > > > > index 21b71148c532..5407a0106771 100644 > > > > --- a/drivers/net/virtio_net.c > > > > +++ b/drivers/net/virtio_net.c > > > > @@ -68,6 +68,8 @@ static const unsigned long guest_offloads[] = { > > > > (1ULL << VIRTIO_NET_F_GUEST_ECN) | \ > > > > (1ULL << VIRTIO_NET_F_GUEST_UFO)) > > > > > > > > +#define GUEST_OFFLOAD_CSUM_MASK (1ULL << VIRTIO_NET_F_GUEST_CSUM) > > > > + > > > > struct virtnet_stat_desc { > > > > char desc[ETH_GSTRING_LEN]; > > > > size_t offset; > > > > @@ -2522,29 +2524,49 @@ static int virtnet_get_phys_port_name(struct net_device *dev, char *buf, > > > > return 0; > > > > } > > > > > > > > +static netdev_features_t virtnet_fix_features(struct net_device *netdev, > > > > + netdev_features_t features) > > > > +{ > > > > + /* If Rx checksum is disabled, LRO should also be disabled. > > > > + * That is life. :) > > > > > > Please remove this second line. > > OK > > > > + */ > > > > + if (!(features & NETIF_F_RXCSUM)) > > > > + features &= ~NETIF_F_LRO; > > > > + > > > > + return features; > > > > +} > > > > + > > > > static int virtnet_set_features(struct net_device *dev, > > > > netdev_features_t features) > > > > { > > > > struct virtnet_info *vi = netdev_priv(dev); > > > > - u64 offloads; > > > > + u64 offloads = vi->guest_offloads & > > > > + vi->guest_offloads_capable; > > > > > > When can vi->guest_offloads have bits set outside the mask of > > > vi->guest_offloads_capable? > > In this case, we can use only vi->guest_offloads. and > > guest_offloads_capable will not be used any more. > > so should we remove guest_offloads_capable ? > > That bitmap stores the capabilities of the device as learned at > initial device probe. I don't see how it can be removed. Hi Willem guest_offloads_capable was introduced by a02e8964eaf9 ("virtio-net: ethtool configurable LRO") and used only for LRO. Now we don't use it anymore, right ? because this patch (virtio-net: ethtool configurable RXCSUM) doesn't use it. -- Best regards, Tonghao _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization