Commit 23b1cf1e authored by Tariq Toukan's avatar Tariq Toukan Committed by Jakub Kicinski

net/mlx5e: kTLS, Take stats out of OOO handler

Let the caller of mlx5e_ktls_tx_handle_ooo() take care of updating the
stats, according to the returned value.  As the switch/case blocks are
already there, this change saves unnecessary branches in the handler.
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Reviewed-by: default avatarGal Pressman <gal@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent da6682fa
...@@ -381,26 +381,17 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, ...@@ -381,26 +381,17 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
int datalen, int datalen,
u32 seq) u32 seq)
{ {
struct mlx5e_sq_stats *stats = sq->stats;
enum mlx5e_ktls_sync_retval ret; enum mlx5e_ktls_sync_retval ret;
struct tx_sync_info info = {}; struct tx_sync_info info = {};
int i = 0; int i;
ret = tx_sync_info_get(priv_tx, seq, datalen, &info); ret = tx_sync_info_get(priv_tx, seq, datalen, &info);
if (unlikely(ret != MLX5E_KTLS_SYNC_DONE)) { if (unlikely(ret != MLX5E_KTLS_SYNC_DONE))
if (ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA) { /* We might get here with ret == FAIL if a retransmission
stats->tls_skip_no_sync_data++; * reaches the driver after the relevant record is acked.
return MLX5E_KTLS_SYNC_SKIP_NO_DATA;
}
/* We might get here if a retransmission reaches the driver
* after the relevant record is acked.
* It should be safe to drop the packet in this case * It should be safe to drop the packet in this case
*/ */
stats->tls_drop_no_sync_data++; return ret;
goto err_out;
}
stats->tls_ooo++;
tx_post_resync_params(sq, priv_tx, info.rcd_sn); tx_post_resync_params(sq, priv_tx, info.rcd_sn);
...@@ -412,7 +403,7 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, ...@@ -412,7 +403,7 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx,
return MLX5E_KTLS_SYNC_DONE; return MLX5E_KTLS_SYNC_DONE;
} }
for (; i < info.nr_frags; i++) { for (i = 0; i < info.nr_frags; i++) {
unsigned int orig_fsz, frag_offset = 0, n = 0; unsigned int orig_fsz, frag_offset = 0, n = 0;
skb_frag_t *f = &info.frags[i]; skb_frag_t *f = &info.frags[i];
...@@ -482,15 +473,19 @@ bool mlx5e_ktls_handle_tx_skb(struct net_device *netdev, struct mlx5e_txqsq *sq, ...@@ -482,15 +473,19 @@ bool mlx5e_ktls_handle_tx_skb(struct net_device *netdev, struct mlx5e_txqsq *sq,
enum mlx5e_ktls_sync_retval ret = enum mlx5e_ktls_sync_retval ret =
mlx5e_ktls_tx_handle_ooo(priv_tx, sq, datalen, seq); mlx5e_ktls_tx_handle_ooo(priv_tx, sq, datalen, seq);
stats->tls_ooo++;
switch (ret) { switch (ret) {
case MLX5E_KTLS_SYNC_DONE: case MLX5E_KTLS_SYNC_DONE:
break; break;
case MLX5E_KTLS_SYNC_SKIP_NO_DATA: case MLX5E_KTLS_SYNC_SKIP_NO_DATA:
stats->tls_skip_no_sync_data++;
if (likely(!skb->decrypted)) if (likely(!skb->decrypted))
goto out; goto out;
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
fallthrough; goto err_out;
case MLX5E_KTLS_SYNC_FAIL: case MLX5E_KTLS_SYNC_FAIL:
stats->tls_drop_no_sync_data++;
goto err_out; goto err_out;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment