Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4344075pxu; Mon, 12 Oct 2020 16:57:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn6QTynmPE0YWMgCJAOxHzEk94bDnomczSfaDcDzh5mbwox/S3maemYU8r7RbmTDfbKaKN X-Received: by 2002:a05:6402:2214:: with SMTP id cq20mr16833071edb.311.1602547063961; Mon, 12 Oct 2020 16:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602547063; cv=none; d=google.com; s=arc-20160816; b=fAy6xAzdEMsX17nU6JmNhBFqA6AaVizlMnE+GMGw9R6P985nQb5PehDuZ79f09C46Q 78IsCVV7bHzY9IiPi+QfGJE4Y7D4Sq0aBN+cUIw8AM1f6XS7ZC9WgKz7CGZnB0ecz5GY 2JudkiGmT/mHkjp83lobGYEgUIJ85dLkUfIMHgWgFB6Dhjesz8jha8QGEc7PE8m9L7+9 tbtbti4o6tKACn7widwa/kAJmNvjEncrs6h/iKm2edorGXvqaYhUDispn3RZzJ8d/JlB Qb1i0c6fUC/zLSpW7X3tkDTHsFEBOAm8OlAhAC7xXuokPv4GaBIggEmt5zkY4dyx6z4X 9EYA== 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=+jeW/MpQPjd4PTZV3DaVvZtBHC2K7DBwIUHJsMelz/Y=; b=j9vxq5x0n60sUMN9ufkYABdgYDRywoe2UTR1fwa414M5Z9DfJXxhgY0o+jswaOcwlB GTAH6ECS2WF4gWduNixPsPHLRnDObeSTTi7DUQxVXCMqYTZs2SsXoY86xNCAGFrwF5T6 4RT7YUbJSia6bPG46mluYAYaCqdIMtXPBm5D2mJNE4guJ73UtMNfmTIdcg9PIiGjb/pR cfJ+Us19LbeujoEKuvuL/EDqiL7rCzTF8wzRihSpCRIymrNYmFlj8RnEqgtM5paJU2cL SYEg6itPcquGBWw/HeCxUTFLduasDwkDyzsyCoqUJoqNjiZJbeJdwaCv6parWHQuoN9p JBgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j++l2Jil; 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=fail (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 rk19si13061532ejb.270.2020.10.12.16.57.21; Mon, 12 Oct 2020 16:57:43 -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=default header.b=j++l2Jil; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390552AbgJLN5Q (ORCPT + 99 others); Mon, 12 Oct 2020 09:57:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:48072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389359AbgJLNnk (ORCPT ); Mon, 12 Oct 2020 09:43:40 -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 A7A3322258; Mon, 12 Oct 2020 13:43:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510215; bh=3NAHrMyM+Dk+ImUqf2+TPLuwterFTTgSnbK/EVAPtVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j++l2JildNU5u5xpmSOUjgInGYVEihreOGy8cN5ZxGBoIs49QM8Ba2R8urbuJ9czz HmiOeeTKSeo+Vq6dN4Rm9RlTkOfRoh1HED2TOP6lO9c1rGsmsNeL3tD6NYM4q2791h 30n/XbkHQlrQA03GhikdRqLLYEz52aGpQUJYug84= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Moshe Shemesh , Tariq Toukan , Saeed Mahameed Subject: [PATCH 5.4 81/85] net/mlx5e: Fix drivers declaration to support GRE offload Date: Mon, 12 Oct 2020 15:27:44 +0200 Message-Id: <20201012132636.734315339@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132632.846779148@linuxfoundation.org> References: <20201012132632.846779148@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: Aya Levin commit 3d093bc2369003b4ce6c3522d9b383e47c40045d upstream. Declare GRE offload support with respect to the inner protocol. Add a list of supported inner protocols on which the driver can offload checksum and GSO. For other protocols, inform the stack to do the needed operations. There is no noticeable impact on GRE performance. Fixes: 2729984149e6 ("net/mlx5e: Support TSO and TX checksum offloads for GRE tunnels") Signed-off-by: Aya Levin Reviewed-by: Moshe Shemesh Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4328,6 +4328,21 @@ void mlx5e_del_vxlan_port(struct net_dev mlx5e_vxlan_queue_work(priv, be16_to_cpu(ti->port), 0); } +static bool mlx5e_gre_tunnel_inner_proto_offload_supported(struct mlx5_core_dev *mdev, + struct sk_buff *skb) +{ + switch (skb->inner_protocol) { + case htons(ETH_P_IP): + case htons(ETH_P_IPV6): + case htons(ETH_P_TEB): + return true; + case htons(ETH_P_MPLS_UC): + case htons(ETH_P_MPLS_MC): + return MLX5_CAP_ETH(mdev, tunnel_stateless_mpls_over_gre); + } + return false; +} + static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv, struct sk_buff *skb, netdev_features_t features) @@ -4350,7 +4365,9 @@ static netdev_features_t mlx5e_tunnel_fe switch (proto) { case IPPROTO_GRE: - return features; + if (mlx5e_gre_tunnel_inner_proto_offload_supported(priv->mdev, skb)) + return features; + break; case IPPROTO_IPIP: case IPPROTO_IPV6: if (mlx5e_tunnel_proto_supported(priv->mdev, IPPROTO_IPIP))