Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2892635pxb; Tue, 24 Aug 2021 10:01:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJxw5q+RKREec6s2HdGXV0aEETFqV78ClpbtzF/VjP1bFH8eAypImA6ka19tzjohugTvvI X-Received: by 2002:a05:6e02:503:: with SMTP id d3mr27836744ils.107.1629824478164; Tue, 24 Aug 2021 10:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824478; cv=none; d=google.com; s=arc-20160816; b=OSfTar8Vq0JcFg/SeGMGA35RdehY8bSaWgk1kq8BJJnMcaLMfUfjadPZJPRRNox3Xw LkWEaUl8NwQWsMcR+ML6PzHzSnSzMp46dhqSIskas49703m29HlW4Dofkq3H85ZeZFL8 PtKXdMZB+1wFAA7vnwt8AwzsjEYUlnt8SAKkMEVPcRPbXDSGL8NzfnBqh/f4ZyMyjaGz /FCs8p8Y4LmlzJj0kCDMiD0EIY/TQSDuWCaMqMwQ9MdOY0Ed8TMMB/6fmSVm7H79B55l T3lBu962MStK4NYZlj4hXfBvQ64jqwUeQLBzdprojNeurAdcZIhkC+oXpr0843dneJ7B naPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sdaBKAAoGftMmwLFOCkFSymKfzPn2Q7gyeuZEUZIwVI=; b=nUzZRGGMZFVR84TQxchn25dl271X91epymgvswx56q/1QgJg3u3m/0QxZVUHkYpGKA 4czBcdiKTAaWKx73Gzb/V6ljiaqB97ymi3MlSiw243azKj8QnHjAfvTyK52SHS73n2c3 FaMlNUY+NIVPQHtYXpx3XkKKbeL3MrEe1I2Etwtr4Pe2/Fv+2SJFehHJ2LW+mUPqxvwK zlhhKw+fiha9vwClA1+dmTquHpUvxRocPei3BZ/8PCmdY47FlqbsnVuCpeeReJk/lxMP SKm1UKQWSH8I9ZmzcBZrsS9LP0Bz0KBsOsWoxj1o2It0f/FTcIwgPWm57dI/5siUrNsD 1qRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mta0HEpL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x9si17621988jaf.48.2021.08.24.10.01.05; Tue, 24 Aug 2021 10:01:18 -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=@kernel.org header.s=k20201202 header.b=Mta0HEpL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238724AbhHXRAu (ORCPT + 99 others); Tue, 24 Aug 2021 13:00:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:39686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234252AbhHXQ6F (ORCPT ); Tue, 24 Aug 2021 12:58:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABE8A61504; Tue, 24 Aug 2021 16:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824228; bh=RkXnqijvKR5BY4Yrsv1z5Q5g4l+VUYGH43gN6ccit2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mta0HEpLNFhYR2YDRVbkcpFMdSyWoHojOblcD8ZHVASQ3eai38e5k+AgBqQEloUdA fWYAEMy89gE3g48QIVbNzzxwKRJE/eLe+9bMFh/fIocVZKrTHkTO1bxDvgrSlM83Rp lnILogLLF6NhPsmxOJV6toLL40fXzHybutrvY2MvKZhqn6L5N41cHLUEBGK8UuNVXa nNeLI++dmGy81pPB6KkgSVXt5hQtH8UB0vLeD46UyFjwv1ZsLJbf/7Td7Nc3p2LE2+ iRwnBXO8bdRDmLkk47ZQlUgq3KiPtSRAIlHJ5R+pNEos2QMNDTaMQ/V3qDUMLD2iAG Hm4XYIPYCCV+A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jason Wang , "Michael S . Tsirkin" , Ivan , "David S . Miller" , Sasha Levin Subject: [PATCH 5.13 061/127] virtio-net: use NETIF_F_GRO_HW instead of NETIF_F_LRO Date: Tue, 24 Aug 2021 12:55:01 -0400 Message-Id: <20210824165607.709387-62-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165607.709387-1-sashal@kernel.org> References: <20210824165607.709387-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.13-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.13.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.13.13-rc1 X-KernelTest-Deadline: 2021-08-26T16:55+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Wang [ Upstream commit dbcf24d153884439dad30484a0e3f02350692e4c ] Commit a02e8964eaf92 ("virtio-net: ethtool configurable LRO") maps LRO to virtio guest offloading features and allows the administrator to enable and disable those features via ethtool. This leads to several issues: - For a device that doesn't support control guest offloads, the "LRO" can't be disabled triggering WARN in dev_disable_lro() when turning off LRO or when enabling forwarding bridging etc. - For a device that supports control guest offloads, the guest offloads are disabled in cases of bridging, forwarding etc slowing down the traffic. Fix this by using NETIF_F_GRO_HW instead. Though the spec does not guarantee packets to be re-segmented as the original ones, we can add that to the spec, possibly with a flag for devices to differentiate between GRO and LRO. Further, we never advertised LRO historically before a02e8964eaf92 ("virtio-net: ethtool configurable LRO") and so bridged/forwarded configs effectively always relied on virtio receive offloads behaving like GRO - thus even if this breaks any configs it is at least not a regression. Fixes: a02e8964eaf92 ("virtio-net: ethtool configurable LRO") Acked-by: Michael S. Tsirkin Reported-by: Ivan Tested-by: Ivan Signed-off-by: Jason Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/virtio_net.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 6af227964413..d397dc6b0ebf 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -63,7 +63,7 @@ static const unsigned long guest_offloads[] = { VIRTIO_NET_F_GUEST_CSUM }; -#define GUEST_OFFLOAD_LRO_MASK ((1ULL << VIRTIO_NET_F_GUEST_TSO4) | \ +#define GUEST_OFFLOAD_GRO_HW_MASK ((1ULL << VIRTIO_NET_F_GUEST_TSO4) | \ (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \ (1ULL << VIRTIO_NET_F_GUEST_ECN) | \ (1ULL << VIRTIO_NET_F_GUEST_UFO)) @@ -2490,7 +2490,7 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO) || virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM))) { - NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing LRO/CSUM, disable LRO/CSUM first"); + NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing GRO_HW/CSUM, disable GRO_HW/CSUM first"); return -EOPNOTSUPP; } @@ -2621,15 +2621,15 @@ static int virtnet_set_features(struct net_device *dev, u64 offloads; int err; - if ((dev->features ^ features) & NETIF_F_LRO) { + if ((dev->features ^ features) & NETIF_F_GRO_HW) { if (vi->xdp_enabled) return -EBUSY; - if (features & NETIF_F_LRO) + if (features & NETIF_F_GRO_HW) offloads = vi->guest_offloads_capable; else offloads = vi->guest_offloads_capable & - ~GUEST_OFFLOAD_LRO_MASK; + ~GUEST_OFFLOAD_GRO_HW_MASK; err = virtnet_set_guest_offloads(vi, offloads); if (err) @@ -3109,9 +3109,9 @@ static int virtnet_probe(struct virtio_device *vdev) dev->features |= NETIF_F_RXCSUM; if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6)) - dev->features |= NETIF_F_LRO; + dev->features |= NETIF_F_GRO_HW; if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) - dev->hw_features |= NETIF_F_LRO; + dev->hw_features |= NETIF_F_GRO_HW; dev->vlan_features = dev->features; -- 2.30.2