1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */
3
4 #ifndef __MLX5E_KTLS_TXRX_H__
5 #define __MLX5E_KTLS_TXRX_H__
6
7 #ifdef CONFIG_MLX5_EN_TLS
8
9 #include <net/tls.h>
10 #include "en.h"
11 #include "en/txrx.h"
12
13 struct mlx5e_accel_tx_tls_state {
14 u32 tls_tisn;
15 };
16
17 u16 mlx5e_ktls_get_stop_room(struct mlx5e_txqsq *sq);
18
19 bool mlx5e_ktls_handle_tx_skb(struct tls_context *tls_ctx, struct mlx5e_txqsq *sq,
20 struct sk_buff *skb, int datalen,
21 struct mlx5e_accel_tx_tls_state *state);
22 void mlx5e_ktls_handle_rx_skb(struct mlx5e_rq *rq, struct sk_buff *skb,
23 struct mlx5_cqe64 *cqe, u32 *cqe_bcnt);
24
25 void mlx5e_ktls_handle_ctx_completion(struct mlx5e_icosq_wqe_info *wi);
26 void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi,
27 struct mlx5e_icosq *sq);
28
29 void mlx5e_ktls_tx_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
30 struct mlx5e_tx_wqe_info *wi,
31 u32 *dma_fifo_cc);
32 static inline bool
mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq * sq,struct mlx5e_tx_wqe_info * wi,u32 * dma_fifo_cc)33 mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
34 struct mlx5e_tx_wqe_info *wi,
35 u32 *dma_fifo_cc)
36 {
37 if (unlikely(wi->resync_dump_frag_page)) {
38 mlx5e_ktls_tx_handle_resync_dump_comp(sq, wi, dma_fifo_cc);
39 return true;
40 }
41 return false;
42 }
43 #else
44 static inline bool
mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq * sq,struct mlx5e_tx_wqe_info * wi,u32 * dma_fifo_cc)45 mlx5e_ktls_tx_try_handle_resync_dump_comp(struct mlx5e_txqsq *sq,
46 struct mlx5e_tx_wqe_info *wi,
47 u32 *dma_fifo_cc)
48 {
49 return false;
50 }
51
52 #endif /* CONFIG_MLX5_EN_TLS */
53
54 #endif /* __MLX5E_TLS_TXRX_H__ */
55