You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
4.7 KiB
137 lines
4.7 KiB
From 0adbdaae599160549f4ed000cf10e0c68667be45 Mon Sep 17 00:00:00 2001
|
|
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
Date: Sun, 10 May 2020 15:04:50 -0400
|
|
Subject: [PATCH 125/312] [netdrv] net/mlx5e: kTLS, Fix corner-case checks in
|
|
TX resync flow
|
|
|
|
Message-id: <20200510150452.10307-86-ahleihel@redhat.com>
|
|
Patchwork-id: 306709
|
|
Patchwork-instance: patchwork
|
|
O-Subject: [RHEL8.3 BZ 1789380 v2 85/87] net/mlx5e: kTLS, Fix corner-case checks in TX resync flow
|
|
Bugzilla: 1789380
|
|
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
|
|
|
|
Bugzilla: http://bugzilla.redhat.com/1789380
|
|
Upstream: v5.5
|
|
|
|
commit ffbd9ca94e2ebbfe802d4b28bab5ba19818de853
|
|
Author: Tariq Toukan <tariqt@mellanox.com>
|
|
Date: Sun Jan 12 16:22:14 2020 +0200
|
|
|
|
net/mlx5e: kTLS, Fix corner-case checks in TX resync flow
|
|
|
|
There are the following cases:
|
|
|
|
1. Packet ends before start marker: bypass offload.
|
|
2. Packet starts before start marker and ends after it: drop,
|
|
not supported, breaks contract with kernel.
|
|
3. packet ends before tls record info starts: drop,
|
|
this packet was already acknowledged and its record info
|
|
was released.
|
|
|
|
Add the above as comment in code.
|
|
|
|
Mind possible wraparounds of the TCP seq, replace the simple comparison
|
|
with a call to the TCP before() method.
|
|
|
|
In addition, remove logic that handles negative sync_len values,
|
|
as it became impossible.
|
|
|
|
Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")
|
|
Fixes: 46a3ea98074e ("net/mlx5e: kTLS, Enhance TX resync flow")
|
|
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
|
|
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
|
|
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
|
|
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
|
|
|
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
|
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
|
---
|
|
.../ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 33 +++++++++++++---------
|
|
1 file changed, 19 insertions(+), 14 deletions(-)
|
|
|
|
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
|
|
index 778dab1af8fc..8dbb92176bd7 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
|
|
@@ -180,7 +180,7 @@ mlx5e_ktls_tx_post_param_wqes(struct mlx5e_txqsq *sq,
|
|
|
|
struct tx_sync_info {
|
|
u64 rcd_sn;
|
|
- s32 sync_len;
|
|
+ u32 sync_len;
|
|
int nr_frags;
|
|
skb_frag_t frags[MAX_SKB_FRAGS];
|
|
};
|
|
@@ -193,13 +193,14 @@ enum mlx5e_ktls_sync_retval {
|
|
|
|
static enum mlx5e_ktls_sync_retval
|
|
tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
|
|
- u32 tcp_seq, struct tx_sync_info *info)
|
|
+ u32 tcp_seq, int datalen, struct tx_sync_info *info)
|
|
{
|
|
struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx;
|
|
enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE;
|
|
struct tls_record_info *record;
|
|
int remaining, i = 0;
|
|
unsigned long flags;
|
|
+ bool ends_before;
|
|
|
|
spin_lock_irqsave(&tx_ctx->lock, flags);
|
|
record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn);
|
|
@@ -209,9 +210,21 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
|
|
goto out;
|
|
}
|
|
|
|
- if (unlikely(tcp_seq < tls_record_start_seq(record))) {
|
|
- ret = tls_record_is_start_marker(record) ?
|
|
- MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
|
|
+ /* There are the following cases:
|
|
+ * 1. packet ends before start marker: bypass offload.
|
|
+ * 2. packet starts before start marker and ends after it: drop,
|
|
+ * not supported, breaks contract with kernel.
|
|
+ * 3. packet ends before tls record info starts: drop,
|
|
+ * this packet was already acknowledged and its record info
|
|
+ * was released.
|
|
+ */
|
|
+ ends_before = before(tcp_seq + datalen, tls_record_start_seq(record));
|
|
+
|
|
+ if (unlikely(tls_record_is_start_marker(record))) {
|
|
+ ret = ends_before ? MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
|
|
+ goto out;
|
|
+ } else if (ends_before) {
|
|
+ ret = MLX5E_KTLS_SYNC_FAIL;
|
|
goto out;
|
|
}
|
|
|
|
@@ -337,7 +350,7 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
|
|
u8 num_wqebbs;
|
|
int i = 0;
|
|
|
|
- ret = tx_sync_info_get(priv_tx, seq, &info);
|
|
+ ret = tx_sync_info_get(priv_tx, seq, datalen, &info);
|
|
if (unlikely(ret != MLX5E_KTLS_SYNC_DONE)) {
|
|
if (ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA) {
|
|
stats->tls_skip_no_sync_data++;
|
|
@@ -351,14 +364,6 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
|
|
goto err_out;
|
|
}
|
|
|
|
- if (unlikely(info.sync_len < 0)) {
|
|
- if (likely(datalen <= -info.sync_len))
|
|
- return MLX5E_KTLS_SYNC_DONE;
|
|
-
|
|
- stats->tls_drop_bypass_req++;
|
|
- goto err_out;
|
|
- }
|
|
-
|
|
stats->tls_ooo++;
|
|
|
|
tx_post_resync_params(sq, priv_tx, info.rcd_sn);
|
|
--
|
|
2.13.6
|
|
|