Skip to content

Commit 342508c

Browse files
Tariq ToukanSaeed Mahameed
authored andcommitted
net/mlx5e: kTLS, Do not send decrypted-marked SKBs via non-accel path
When TCP out-of-order is identified (unexpected tcp seq mismatch), driver analyzes the packet and decides what handling should it get: 1. go to accelerated path (to be encrypted in HW), 2. go to regular xmit path (send w/o encryption), 3. drop. Packets marked with skb->decrypted by the TLS stack in the TX flow skips SW encryption, and rely on the HW offload. Verify that such packets are never sent un-encrypted on the wire. Add a WARN to catch such bugs, and prefer dropping the packet in these cases. Fixes: 46a3ea9 ("net/mlx5e: kTLS, Enhance TX resync flow") Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: Boris Pismenny <[email protected]> Reviewed-by: Boris Pismenny <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 1e92899 commit 342508c

File tree

1 file changed

+10
-4
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en_accel

1 file changed

+10
-4
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,18 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev,
458458
enum mlx5e_ktls_sync_retval ret =
459459
mlx5e_ktls_tx_handle_ooo(priv_tx, sq, datalen, seq);
460460

461-
if (likely(ret == MLX5E_KTLS_SYNC_DONE))
461+
switch (ret) {
462+
case MLX5E_KTLS_SYNC_DONE:
462463
*wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi);
463-
else if (ret == MLX5E_KTLS_SYNC_FAIL)
464+
break;
465+
case MLX5E_KTLS_SYNC_SKIP_NO_DATA:
466+
if (likely(!skb->decrypted))
467+
goto out;
468+
WARN_ON_ONCE(1);
469+
/* fall-through */
470+
default: /* MLX5E_KTLS_SYNC_FAIL */
464471
goto err_out;
465-
else /* ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA */
466-
goto out;
472+
}
467473
}
468474

469475
priv_tx->expected_seq = seq + datalen;

0 commit comments

Comments
 (0)