Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5971739pxb; Mon, 14 Feb 2022 12:02:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyF7/1bKtNk3f7psnuHMjtRW2vHVgaygnPyb14Bq8arHpoTD0vV5d8qxEJLEYq6RF5nDYNV X-Received: by 2002:a17:90a:348f:: with SMTP id p15mr275876pjb.173.1644868946698; Mon, 14 Feb 2022 12:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644868946; cv=none; d=google.com; s=arc-20160816; b=M9U4Uw2NF1JcrkgEbJJtWdMhObSDxt69YOT8GMS6OJmG2hPpNdo7a4K/Fs/opW9N2P Hn8/ZyqjjdaCRaMfkaO/VpVYdSpF168CFwuLm2Bh7n/99VWCOs7VSQnENggChQf5xkx8 g7El5JpinqhDyz20Qzptlb+l+w0kwk3b9ROYdm5DDQL0YX+AwVFsegKHZXKpM3T3RwXP 0mj3O6V2BxEa4XJ291GUcFvXP5lnAXSE5LJnM9I3ZDqEPcv0ywauMRSzPkHlTvKJO7Gn Y9ks5hFacYkAjUOfikExxvZwzyacozAszmnqW8SXOqMTGxCObASf7IaMvwK4jQKiyHoi sCdg== 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=Y4mqFun6jtwoBHIKHeBj2zKEheVqUccB70Ktpw6qH+8=; b=E72dKwx2jTsd8c4xApdreqou8HSHJ4VRhH9BfMrp90azTYpO5KatMMKugrPPI33KI8 SlftG1MvDfBqrNVUtNlaNxUAd8iCjxWELw3o7/VvgpxGLYszpruG4SQqsG3mYQA0lNBN Ya08N8jitqdxvP3TQRfNOJITCd1jqJf16RtcLtDp9NK/av2zAsEfMFiKtwejp5YrM8n/ 86awcuQ6Jn4+zisU0fX2AKvJr4yzxQry/AWRxHdFiBZxjveacQtPr5FCpTANt/gyjNpt 7M4x/JiKkjODyLBGtHfES4xDqdAb0RLpj5QuCN5l/dpgup+j5dhZlY7DNcoRMIKTklcH 84Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JiH93W5A; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id lk13si5183869pjb.106.2022.02.14.12.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:02:26 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JiH93W5A; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9019910BBD5; Mon, 14 Feb 2022 11:41:52 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345228AbiBNJ4l (ORCPT + 99 others); Mon, 14 Feb 2022 04:56:41 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344132AbiBNJvc (ORCPT ); Mon, 14 Feb 2022 04:51:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A93D96581B; Mon, 14 Feb 2022 01:42:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38F21B80DC1; Mon, 14 Feb 2022 09:42:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AB32C340E9; Mon, 14 Feb 2022 09:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831749; bh=j4NjT9wPBSn60O5aF8wnGLros10t+vYrPu6cKZCp8Cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JiH93W5AhhIuowagpxJ4JhnC6qfYfpP7832Yzhuuu5Chmrtly16zzGigVuGzZ6MYU lphuGf6pzB1g+Qy4lMtab8qOF4rOn1mUc9Dmn4WJ0Job1KqippXxSqfuiKM1RvsgQ2 76ZUvGNmWT56ZxNB/WmlnvXtELJFiK9y6JWqh2KU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesse Brandeburg , Paul Menzel , Gurucharan G , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 084/116] ice: fix IPIP and SIT TSO offload Date: Mon, 14 Feb 2022 10:26:23 +0100 Message-Id: <20220214092501.668211968@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092458.668376521@linuxfoundation.org> References: <20220214092458.668376521@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jesse Brandeburg [ Upstream commit 46b699c50c0304cdbd725d7740073a7f9d5edb10 ] The driver was avoiding offload for IPIP (at least) frames due to parsing the inner header offsets incorrectly when trying to check lengths. This length check works for VXLAN frames but fails on IPIP frames because skb_transport_offset points to the inner header in IPIP frames, which meant the subtraction of transport_header from inner_network_header returns a negative value (-20). With the code before this patch, everything continued to work, but GSO was being used to segment, causing throughputs of 1.5Gb/s per thread. After this patch, throughput is more like 10Gb/s per thread for IPIP traffic. Fixes: e94d44786693 ("ice: Implement filter sync, NDO operations and bump version") Signed-off-by: Jesse Brandeburg Reviewed-by: Paul Menzel Tested-by: Gurucharan G Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h index c0ee0541e53fc..847e1ef8e1064 100644 --- a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +++ b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h @@ -507,6 +507,7 @@ struct ice_tx_ctx_desc { (0x3FFFFULL << ICE_TXD_CTX_QW1_TSO_LEN_S) #define ICE_TXD_CTX_QW1_MSS_S 50 +#define ICE_TXD_CTX_MIN_MSS 64 enum ice_tx_ctx_desc_cmd_bits { ICE_TX_CTX_DESC_TSO = 0x01, diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 4c7d1720113a0..fb4656902634c 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -6787,6 +6787,7 @@ ice_features_check(struct sk_buff *skb, struct net_device __always_unused *netdev, netdev_features_t features) { + bool gso = skb_is_gso(skb); size_t len; /* No point in doing any of this if neither checksum nor GSO are @@ -6799,24 +6800,32 @@ ice_features_check(struct sk_buff *skb, /* We cannot support GSO if the MSS is going to be less than * 64 bytes. If it is then we need to drop support for GSO. */ - if (skb_is_gso(skb) && (skb_shinfo(skb)->gso_size < 64)) + if (gso && (skb_shinfo(skb)->gso_size < ICE_TXD_CTX_MIN_MSS)) features &= ~NETIF_F_GSO_MASK; - len = skb_network_header(skb) - skb->data; + len = skb_network_offset(skb); if (len > ICE_TXD_MACLEN_MAX || len & 0x1) goto out_rm_features; - len = skb_transport_header(skb) - skb_network_header(skb); + len = skb_network_header_len(skb); if (len > ICE_TXD_IPLEN_MAX || len & 0x1) goto out_rm_features; if (skb->encapsulation) { - len = skb_inner_network_header(skb) - skb_transport_header(skb); - if (len > ICE_TXD_L4LEN_MAX || len & 0x1) - goto out_rm_features; + /* this must work for VXLAN frames AND IPIP/SIT frames, and in + * the case of IPIP frames, the transport header pointer is + * after the inner header! So check to make sure that this + * is a GRE or UDP_TUNNEL frame before doing that math. + */ + if (gso && (skb_shinfo(skb)->gso_type & + (SKB_GSO_GRE | SKB_GSO_UDP_TUNNEL))) { + len = skb_inner_network_header(skb) - + skb_transport_header(skb); + if (len > ICE_TXD_L4LEN_MAX || len & 0x1) + goto out_rm_features; + } - len = skb_inner_transport_header(skb) - - skb_inner_network_header(skb); + len = skb_inner_network_header_len(skb); if (len > ICE_TXD_IPLEN_MAX || len & 0x1) goto out_rm_features; } -- 2.34.1