Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1796097pxp; Mon, 7 Mar 2022 02:32:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhEv8qr33EwiO8sAGAo9DU727As6MwaUxKRL2X3c0gSkxMaApqcWBquliJHvUofThZWmgr X-Received: by 2002:a17:90b:4b4a:b0:1bf:83d:6805 with SMTP id mi10-20020a17090b4b4a00b001bf083d6805mr24909390pjb.174.1646649137533; Mon, 07 Mar 2022 02:32:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646649137; cv=none; d=google.com; s=arc-20160816; b=pJuf5+9zB+EV9UozrbZYP2zJvaACMFqfxNfw1OMqU98n7w7XhGgJ00CHgaaM7/w4pq 3PIhA77W7fPN7cuDW3h3YIHzmMT5SD02C22lDnP8SKYIwe6J9muiGXMLijlgUYNcpePv yPGwssCOFzX9RWPc/47FKMveIdgDLedxbiUkwZbocqCgMN2ELBhu3f04mFpJu8P0NUXI R74TOMCodRWpJ6+u1BfgBIlwPE5jIQyjcbAzoM79LmcTOZHcT4A+SqTetQI/vhvYX9Ms FiTSV8264DHiZqtYr5NJR1ZC0hjPNEp5MQLhgCAKtNhvxtQpZl65IMqzKwd9neHYWutZ PDLw== 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=KEN6ZrtQEK7gqpKaKcqadR6ZoDpUViSsUdtPe79IYtY=; b=dQGvr0a/5qlBicEmLCP8QAQjLrS5cd87usCEEgw/gX/vwwFkCr+hzzxJOLW/XmpCk5 4X8rNweGCBygj0U/yQWWTknVVTiGa+h8P1f8f/k9aEKGF/MXaoZHaXYr7Jh/ttdbXYXl aCwXJN2/6xLJZ8imkuleZxdwOSAF96gHljXR3U8j78fv42cr49XkfcGzRvqb+fykN5TA +tPsFdPkjO2GwbJHRV7A0k72IgLaycvavZ+cGr2UJdsVFnIFegePSQP7I13MPK7+RrQA 103bLEyoqnw43Xxg/mqui3f8+qMq9qVa1aOaBP6JhO5pKFYuu+LXziZ7KbXMZ2Yw91cn 7cxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u+s4YIz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a656a07000000b00378ac5ba948si14756547pgu.81.2022.03.07.02.31.55; Mon, 07 Mar 2022 02:32:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u+s4YIz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239902AbiCGKDu (ORCPT + 99 others); Mon, 7 Mar 2022 05:03:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241133AbiCGJlz (ORCPT ); Mon, 7 Mar 2022 04:41:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 854C42BD5; Mon, 7 Mar 2022 01:40:32 -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 261D4B810B2; Mon, 7 Mar 2022 09:40:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FC60C340E9; Mon, 7 Mar 2022 09:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646646030; bh=7aK5WAf+nonAj2USSSeA70CH5uGtCo/IGBvok/zj0bo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u+s4YIz55NtLeLgjTy7g1R1DFd+xb0N9+g46nzF8I7vb/6o0IyFYig2qrDteJY2sz kh6Qr1Xucm+T123k7Q/30OUnT/R1PGNbdJpupZtWGuvgeioymSvjUg3mau57mWX6RT H+uSKVBI/QKuEch84QnH34UXyypVQX1tz32KB2m8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raed Salem , Maor Dickman , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 111/262] net/mlx5e: IPsec: Fix crypto offload for non TCP/UDP encapsulated traffic Date: Mon, 7 Mar 2022 10:17:35 +0100 Message-Id: <20220307091705.604989043@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091702.378509770@linuxfoundation.org> References: <20220307091702.378509770@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=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Raed Salem [ Upstream commit 5352859b3bfa0ca188b2f1d2c1436fddc781e3b6 ] IPsec crypto offload always set the ethernet segment checksum flags with the inner L4 header checksum flag enabled for encapsulated IPsec offloaded packet regardless of the encapsulated L4 header type, and even if it doesn't exists in the first place, this breaks non TCP/UDP traffic as such. Set the inner L4 checksum flag only when the encapsulated L4 header protocol is TCP/UDP using software parser swp_inner_l4_offset field as indication. Fixes: 5cfb540ef27b ("net/mlx5e: Set IPsec WAs only in IP's non checksum partial case.") Signed-off-by: Raed Salem Reviewed-by: Maor Dickman Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- .../ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h index b98db50c3418d..428881e0adcbe 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h @@ -131,14 +131,17 @@ static inline bool mlx5e_ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg) { - struct xfrm_offload *xo = xfrm_offload(skb); + u8 inner_ipproto; if (!mlx5e_ipsec_eseg_meta(eseg)) return false; eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM; - if (xo->inner_ipproto) { - eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM | MLX5_ETH_WQE_L3_INNER_CSUM; + inner_ipproto = xfrm_offload(skb)->inner_ipproto; + if (inner_ipproto) { + eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM; + if (inner_ipproto == IPPROTO_TCP || inner_ipproto == IPPROTO_UDP) + eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM; } else if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM; sq->stats->csum_partial_inner++; -- 2.34.1