From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380145; b=XYJtPcFhinkw/fHvw8inUnHXh2emwJ2V4icjpuyLJgmSbH90kAB+w9BHbYbmacRnfX1U a1NkBcVtj/KQClwDm9kLLMFjCIRsApX2eQ4mmRy6MYJVF90akPEXw8VdREWXFNV4rsP7B IEc70oN2PpYlc+xyY+E4sNk0bfXhLsiEBmajdExAZxV0Ehn0o+LbYgVXCM3m/9SasJQHm fNMJq8Vqv/6tXlWD39lwEux3h2O+2WZPiYbYGqlqlG8kYE39JrmvkXp/BIleeomYibv9z 4HujUlHXSZMkbdgRWrwhl5gTKl2qyjApQUW3LyAa4m5Lh3wgPXd1OQvSlqtXjzkV5ig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380145; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=UV6asSo2HCkif2PTIkpz5n5Q+ilM8aS3/KHKY07I9y4=; b=av+KBvEbEE7L6O+04DnTe85XbNrYCGNyrh7XJO3I3AM8kX/wOvpVsvAXPF6YkOQ9BbFy PsAWWWwBH94h1mZL3loRQLCn/q6SKsHlZEKgjOLLcZZckw0+MR4W1PFdmf7u1eK7aCSqt xU19WN8CUpK65iux5+EsRo22JBMvysHDfYoeDXrXy0qAstWiJ7I48FILCeL7Dw/UHtSCD ZjpCCb52psponjEZZLjb43RskuxHwnXtUjeFpBrL1GrgBPYjJsyMAI8g+yANeZJkXjDea I0CQ1afS/xPRRImyQxQsPzmYOlf4/wvQZakeXQALJsD6rez9rZA7bWkGft0ftG429Iw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rXXl9HeT; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97794606A32C; Fri, 4 Dec 2026 10:29:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rXXl9HeT Received: by smtp.kernel.org (Postfix) with ESMTPSA id 157C81F000C2; Fri, 4 Dec 2026 10:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380145; bh=UV6asSo2HCkif2PTIkpz5n5Q+ilM8aS3/KHKY07I9y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rXXl9HeTZURN77mpq/x1hdFpBhY1LuERSuogsBIm9rXEslxAMU3PJy0nXjUFq19KG 9HjnR8eKNO8LPOabhHLlmO0AGCxqJXOulyhFgSAOVJRNTuCmzO5Ext6miZt1Hs7bfj uP+z7G8lzCUr7kVTBdJvs+Si/Y7x29qdwRP9jr2Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tariq Toukan , Gal Pressman , Cosmin Ratiu , Jakub Kicinski , Sasha Levin Subject: [PATCH 7.3 147/742] net/mlx5e: SHAMPO: Do not merge packets with different kTLS RX state Date: Fri, 4 Dec 2026 19:00:11 +0900 Message-ID: <20261204100639.025587910@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tariq Toukan [ Upstream commit e421df3c838692c0c3503768ec3c9183f6df77aa ] HW-GRO (SHAMPO) sessions are not terminated by HW when the kTLS RX offload indication in the CQE changes. The driver applies the offload metadata of the first packet in the session only, so ciphertext and plaintext can end up in the same skb under a single skb->decrypted indication, and resync requests carried by non-first packets are lost. Do not merge a CQE whose decryption state differs from skb->decrypted, which the first packet of the session sets. Never merge a CQE that carries a resync request or a TLS error, so that each of them starts a session and is handled. The failure was reproduced on ConnectX-7 with HW GRO and kTLS RX offload on and 0.3% loss added by netem on the sender's egress: TlsDecryptError increased and the receiving sockets failed with EBADMSG. With this patch, TlsDecryptError stays 0. Fixes: 92552d3abd32 ("net/mlx5e: HW_GRO cqe handler implementation") Signed-off-by: Tariq Toukan Reviewed-by: Gal Pressman Reviewed-by: Cosmin Ratiu Link: https://patch.msgid.link/20261118144042.1916204-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- .../mellanox/mlx5/core/en_accel/en_accel.h | 5 +++-- .../mellanox/mlx5/core/en_accel/ktls_txrx.h | 21 +++++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/en_rx.c | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h index 5a340f1435e6b..554c225f73767 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h @@ -219,9 +219,10 @@ static inline void mlx5e_accel_tx_finish(struct mlx5e_txqsq *sq, } static inline bool -mlx5e_accel_shampo_can_merge(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) +mlx5e_accel_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe) { - return mlx5e_psp_shampo_can_merge(rq->hw_gro_data->skb, cqe); + return mlx5e_psp_shampo_can_merge(skb, cqe) && + mlx5e_ktls_shampo_can_merge(skb, cqe); } static inline int mlx5e_accel_init_rx(struct mlx5e_priv *priv) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h index 93bd383a23d8c..20e5dc6a718e1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_txrx.h @@ -60,6 +60,21 @@ mlx5e_ktls_handle_tx_wqe(struct mlx5_wqe_ctrl_seg *cseg, { cseg->tis_tir_num = cpu_to_be32(state->tls_tisn << 8); } + +/* The first CQE of a HW-GRO session sets skb->decrypted. A resync request or + * a TLS error is handled on the first CQE only, so it starts a new session. + */ +static inline bool +mlx5e_ktls_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe) +{ + u8 tls_offload = get_cqe_tls_offload(cqe); + + if (unlikely(tls_offload > CQE_TLS_OFFLOAD_DECRYPTED)) + return false; + + return (tls_offload == CQE_TLS_OFFLOAD_DECRYPTED) == + skb_is_decrypted(skb); +} #else static inline bool mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq *sq, @@ -93,6 +108,12 @@ static inline void mlx5e_ktls_handle_rx_skb(struct mlx5e_rq *rq, u32 *cqe_bcnt) { } + +static inline bool +mlx5e_ktls_shampo_can_merge(struct sk_buff *skb, struct mlx5_cqe64 *cqe) +{ + return true; +} #endif /* CONFIG_MLX5_EN_TLS */ #endif /* __MLX5E_TLS_TXRX_H__ */ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index d49f26323b1e2..ffcb6ec760a57 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -2271,7 +2271,7 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq if (*skb && !(match && mlx5e_hw_gro_skb_has_enough_space(*skb, data_bcnt, page_size) && - mlx5e_accel_shampo_can_merge(rq, cqe))) { + mlx5e_accel_shampo_can_merge(*skb, cqe))) { match = false; mlx5e_shampo_flush_skb(rq, cqe, match); } -- 2.53.0