From patchwork Mon Oct 12 13:31:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 270278 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 E1690C43457 for ; Mon, 12 Oct 2020 13:53:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D5A52074F for ; Mon, 12 Oct 2020 13:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510815; bh=0CMrJjWFHQ/Vh6o6OlG25LLmyoGua1YSTFewTOGmhw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=h8s+iuwhy/X5uzn5jds62u1pJE1JM27nPNJxXQpYSA7N58/ipUnhOT7WQNjF8b9Mo SCj8dYJAeDEFIx8+XDQXrAHSqHpmFjXNG9jvxqMEqQqM1TuO92d45jmUBPTFWQOo7A KxO4ygbDgImzSLE27gvhNysQ4XcEFmFCfufPC9sY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389417AbgJLNxf (ORCPT ); Mon, 12 Oct 2020 09:53:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:53860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731398AbgJLNq4 (ORCPT ); Mon, 12 Oct 2020 09:46:56 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 23E2C20878; Mon, 12 Oct 2020 13:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510387; bh=0CMrJjWFHQ/Vh6o6OlG25LLmyoGua1YSTFewTOGmhw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aa3jmvD+mTuuvML/gdlgcVPc5G3VQPSMM1gWm5bQ1ob76/a9ADPDXaAdpCDYFnMK6 zD3Qht6XNK8ardllv46FGIZfByRJl+THSLAUvL1YkHifoIIz5ss4EeM8KmcBcAtGW6 0qsj29o5/OS21e3puNsZagh7oqnsxE4qcOcLPAEI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Michael S. Tsirkin" , Jason Wang , Willem de Bruijn , Tonghao Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.8 077/124] virtio-net: dont disable guest csum when disable LRO Date: Mon, 12 Oct 2020 15:31:21 +0200 Message-Id: <20201012133150.586204035@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012133146.834528783@linuxfoundation.org> References: <20201012133146.834528783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tonghao Zhang [ Upstream commit 1a03b8a35a957f9f38ecb8a97443b7380bbf6a8b ] Open vSwitch and Linux bridge will disable LRO of the interface when this interface added to them. Now when disable the LRO, the virtio-net csum is disable too. That drops the forwarding performance. Fixes: a02e8964eaf9 ("virtio-net: ethtool configurable LRO") Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Willem de Bruijn Signed-off-by: Tonghao Zhang Acked-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/virtio_net.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ba38765dc4905..c34927b1d806e 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -63,6 +63,11 @@ static const unsigned long guest_offloads[] = { VIRTIO_NET_F_GUEST_CSUM }; +#define GUEST_OFFLOAD_LRO_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)) + struct virtnet_stat_desc { char desc[ETH_GSTRING_LEN]; size_t offset; @@ -2547,7 +2552,8 @@ static int virtnet_set_features(struct net_device *dev, if (features & NETIF_F_LRO) offloads = vi->guest_offloads_capable; else - offloads = 0; + offloads = vi->guest_offloads_capable & + ~GUEST_OFFLOAD_LRO_MASK; err = virtnet_set_guest_offloads(vi, offloads); if (err)