net/mlx5e: kTLS, Fix TCP seq off-by-1 issue in TX resync flow
authorTariq Toukan <tariqt@mellanox.com>
Thu, 20 Feb 2020 11:40:24 +0000 (13:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Apr 2020 07:08:40 +0000 (09:08 +0200)
[ Upstream commit 56917766def72f5afdf4235adb91b6897ff26d9d ]

We have an off-by-1 issue in the TCP seq comparison.
The last sequence number that belongs to the TCP packet's payload
is not "start_seq + len", but one byte before it.
Fix it so the 'ends_before' is evaluated properly.

This fixes a bug that results in error completions in the
kTLS HW offload flows.

Fixes: ffbd9ca94e2e ("net/mlx5e: kTLS, Fix corner-case checks in TX resync flow")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c

index f260dd9..52a5662 100644 (file)
@@ -218,7 +218,7 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
         *    this packet was already acknowledged and its record info
         *    was released.
         */
-       ends_before = before(tcp_seq + datalen, tls_record_start_seq(record));
+       ends_before = before(tcp_seq + datalen - 1, 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;