Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp687098pxv; Thu, 22 Jul 2021 09:44:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6u7UWIb4kKVryDdTGtKfKvqo20VrZANjt2PwcAWmj7ngqtdNHioc2YDSjFNm9bTF4Hryd X-Received: by 2002:a92:c0cc:: with SMTP id t12mr478451ilf.47.1626972243760; Thu, 22 Jul 2021 09:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626972243; cv=none; d=google.com; s=arc-20160816; b=aFgYaN9uwZSJLTOy7xo/Bf6i2ZKF0q/FUbiXj20vJdMbtIhSa7zBf2IFMSh5uSnPn+ TBGngYrqwdMEXO+Ob+LlzWOY0px1tBPWG9haKUHy/lAgp2V6k3acAmeE7N1B+iUdUF8s eakEmzKy3nTVemCCOJo/4cxlx2blTIXepk5QIrQNj7PE8sOZiNJugDXMiphRRsA0gZY5 kS9dzPpdTL1lfGqwEA5kRcuRuxVZeUWuIKxA2u+iPKi1HWllCm96bCGtXvw/cXPxJS7l bZ/Wdv0YcpQq7Z51LEtjDX9otIxcrE1z2fXl6zO28Cblt3Jp6yNz9IuAwIi6w/kT1VQA AkVQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ddWSvMCx7t9D7wn5SXs5OUOmK+Bg+2wTZ4y5eYKTJ5w=; b=mW8VfKQNrnJ2IWDEuF1Qvv8NjhqejQh6mlN5AAIhFPhZs8HMqZY+k4QXRfBsT/lP/v yFm94KK5l90qRJ3Zix4/q57Uq40hwT5+fqdKL//XIPoriqBe3JXhPdlcTyEZsVj8GxRa aNpqhXLv0r9PNjxEg2T1JajNks3WViMSAyMjrORZ+fAQDpq87AazPO2c6S6lN/Fwi/OX sQuvtLXEAYJfgaQApAgL90MfMQYZXU6DET2YKwo7yx+qw/lq9LD0g1MjOtRfn1zw33TB B+y3J0o+OorihqaJ6jruwi5035hX6bAlzFafK87PgB/0n3ARWmgOHqrZGaTgpSybx35S Si9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ogFIJ5Z6; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i16si18183807jam.109.2021.07.22.09.43.48; Thu, 22 Jul 2021 09:44:03 -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=@linuxfoundation.org header.s=korg header.b=ogFIJ5Z6; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbhGVQCa (ORCPT + 99 others); Thu, 22 Jul 2021 12:02:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:35214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233401AbhGVP66 (ORCPT ); Thu, 22 Jul 2021 11:58:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 767AC61353; Thu, 22 Jul 2021 16:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626971971; bh=HLNRvvBjnuN0Hz1wec5vFYjOiLsBF/h0EvcK+c+6Wi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogFIJ5Z6jywxibLAI6+xKAVDt+SJq0oT/X+v205Ipux25jBO+KgG5n9eaNrSDK7La XzC4CGk+WSnSrmIJZhFaNSZYZ1ucVxtua3ZYWUKULE7PclUapzTIGqr4s+7m4wn+P/ UhA4cIO3E7L7cdEywP0TyN3LVT2dvjB8C94rie0s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronak Doshi , Guolin Yang , "David S. Miller" Subject: [PATCH 5.10 097/125] vmxnet3: fix cksum offload issues for tunnels with non-default udp ports Date: Thu, 22 Jul 2021 18:31:28 +0200 Message-Id: <20210722155627.922823708@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210722155624.672583740@linuxfoundation.org> References: <20210722155624.672583740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ronak Doshi commit b22580233d473dbf7bbfa4f6549c09e2c80e9e64 upstream. Commit dacce2be3312 ("vmxnet3: add geneve and vxlan tunnel offload support") added support for encapsulation offload. However, the inner offload capability is to be restricted to UDP tunnels with default Vxlan and Geneve ports. This patch fixes the issue for tunnels with non-default ports using features check capability and filtering appropriate features for such tunnels. Fixes: dacce2be3312 ("vmxnet3: add geneve and vxlan tunnel offload support") Signed-off-by: Ronak Doshi Acked-by: Guolin Yang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/vmxnet3/vmxnet3_ethtool.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c @@ -1,7 +1,7 @@ /* * Linux driver for VMware's vmxnet3 ethernet NIC. * - * Copyright (C) 2008-2020, VMware, Inc. All Rights Reserved. + * Copyright (C) 2008-2021, VMware, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -26,6 +26,10 @@ #include "vmxnet3_int.h" +#include +#include + +#define VXLAN_UDP_PORT 8472 struct vmxnet3_stat_desc { char desc[ETH_GSTRING_LEN]; @@ -277,6 +281,8 @@ netdev_features_t vmxnet3_features_check if (VMXNET3_VERSION_GE_4(adapter) && skb->encapsulation && skb->ip_summed == CHECKSUM_PARTIAL) { u8 l4_proto = 0; + u16 port; + struct udphdr *udph; switch (vlan_get_protocol(skb)) { case htons(ETH_P_IP): @@ -289,8 +295,20 @@ netdev_features_t vmxnet3_features_check return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); } - if (l4_proto != IPPROTO_UDP) + switch (l4_proto) { + case IPPROTO_UDP: + udph = udp_hdr(skb); + port = be16_to_cpu(udph->dest); + /* Check if offloaded port is supported */ + if (port != GENEVE_UDP_PORT && + port != IANA_VXLAN_UDP_PORT && + port != VXLAN_UDP_PORT) { + return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + } + break; + default: return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); + } } return features; }