Blame SOURCES/0064-netdrv-net-mlx5e-kTLS-Save-a-copy-of-the-crypto-info.patch

d8f823
From 1bf2b8f0c26bc563683d7b063778bd6e532247f9 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Sun, 10 May 2020 14:52:39 -0400
d8f823
Subject: [PATCH 064/312] [netdrv] net/mlx5e: kTLS, Save a copy of the crypto
d8f823
 info
d8f823
d8f823
Message-id: <20200510145245.10054-77-ahleihel@redhat.com>
d8f823
Patchwork-id: 306615
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789378 v2 76/82] net/mlx5e: kTLS, Save a copy of the crypto info
d8f823
Bugzilla: 1789378
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789378
d8f823
Upstream: v5.4-rc6
d8f823
d8f823
commit af11a7a42454b17c77da5fa55b6b6325b11d60e5
d8f823
Author: Tariq Toukan <tariqt@mellanox.com>
d8f823
Date:   Sun Sep 22 14:05:24 2019 +0300
d8f823
d8f823
    net/mlx5e: kTLS, Save a copy of the crypto info
d8f823
d8f823
    Do not assume the crypto info is accessible during the
d8f823
    connection lifetime. Save a copy of it in the private
d8f823
    TX context.
d8f823
d8f823
    Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")
d8f823
    Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
d8f823
    Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
d8f823
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
d8f823
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c    | 2 +-
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h    | 2 +-
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 8 ++------
d8f823
 3 files changed, 4 insertions(+), 8 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
d8f823
index d2ff74d52720..46725cd743a3 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
d8f823
@@ -38,7 +38,7 @@ static int mlx5e_ktls_add(struct net_device *netdev, struct sock *sk,
d8f823
 		return -ENOMEM;
d8f823
 
d8f823
 	tx_priv->expected_seq = start_offload_tcp_sn;
d8f823
-	tx_priv->crypto_info  = crypto_info;
d8f823
+	tx_priv->crypto_info  = *(struct tls12_crypto_info_aes_gcm_128 *)crypto_info;
d8f823
 	mlx5e_set_ktls_tx_priv_ctx(tls_ctx, tx_priv);
d8f823
 
d8f823
 	/* tc and underlay_qpn values are not in use for tls tis */
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
d8f823
index 929966e6fbc4..a3efa29a4629 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.h
d8f823
@@ -44,7 +44,7 @@ enum {
d8f823
 
d8f823
 struct mlx5e_ktls_offload_context_tx {
d8f823
 	struct tls_offload_context_tx *tx_ctx;
d8f823
-	struct tls_crypto_info *crypto_info;
d8f823
+	struct tls12_crypto_info_aes_gcm_128 crypto_info;
d8f823
 	u32 expected_seq;
d8f823
 	u32 tisn;
d8f823
 	u32 key_id;
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
d8f823
index 1bfeb558ff78..badc6fd26a14 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
d8f823
@@ -24,14 +24,12 @@ enum {
d8f823
 static void
d8f823
 fill_static_params_ctx(void *ctx, struct mlx5e_ktls_offload_context_tx *priv_tx)
d8f823
 {
d8f823
-	struct tls_crypto_info *crypto_info = priv_tx->crypto_info;
d8f823
-	struct tls12_crypto_info_aes_gcm_128 *info;
d8f823
+	struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info;
d8f823
 	char *initial_rn, *gcm_iv;
d8f823
 	u16 salt_sz, rec_seq_sz;
d8f823
 	char *salt, *rec_seq;
d8f823
 	u8 tls_version;
d8f823
 
d8f823
-	info = (struct tls12_crypto_info_aes_gcm_128 *)crypto_info;
d8f823
 	EXTRACT_INFO_FIELDS;
d8f823
 
d8f823
 	gcm_iv      = MLX5_ADDR_OF(tls_static_params, ctx, gcm_iv);
d8f823
@@ -233,14 +231,12 @@ tx_post_resync_params(struct mlx5e_txqsq *sq,
d8f823
 		      struct mlx5e_ktls_offload_context_tx *priv_tx,
d8f823
 		      u64 rcd_sn)
d8f823
 {
d8f823
-	struct tls_crypto_info *crypto_info = priv_tx->crypto_info;
d8f823
-	struct tls12_crypto_info_aes_gcm_128 *info;
d8f823
+	struct tls12_crypto_info_aes_gcm_128 *info = &priv_tx->crypto_info;
d8f823
 	__be64 rn_be = cpu_to_be64(rcd_sn);
d8f823
 	bool skip_static_post;
d8f823
 	u16 rec_seq_sz;
d8f823
 	char *rec_seq;
d8f823
 
d8f823
-	info = (struct tls12_crypto_info_aes_gcm_128 *)crypto_info;
d8f823
 	rec_seq = info->rec_seq;
d8f823
 	rec_seq_sz = sizeof(info->rec_seq);
d8f823
 
d8f823
-- 
d8f823
2.13.6
d8f823