• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2019 Mellanox Technologies. */
3 
4 #ifndef __MLX5E_KTLS_H__
5 #define __MLX5E_KTLS_H__
6 
7 #include "en.h"
8 
9 #ifdef CONFIG_MLX5_EN_TLS
10 
11 void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv);
12 int mlx5e_ktls_init_rx(struct mlx5e_priv *priv);
13 void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv);
14 int mlx5e_ktls_set_feature_rx(struct net_device *netdev, bool enable);
15 struct mlx5e_ktls_resync_resp *
16 mlx5e_ktls_rx_resync_create_resp_list(void);
17 void mlx5e_ktls_rx_resync_destroy_resp_list(struct mlx5e_ktls_resync_resp *resp_list);
18 
mlx5e_accel_is_ktls_tx(struct mlx5_core_dev * mdev)19 static inline bool mlx5e_accel_is_ktls_tx(struct mlx5_core_dev *mdev)
20 {
21 	return !is_kdump_kernel() &&
22 		mlx5_accel_is_ktls_tx(mdev);
23 }
24 
mlx5e_accel_is_ktls_rx(struct mlx5_core_dev * mdev)25 static inline bool mlx5e_accel_is_ktls_rx(struct mlx5_core_dev *mdev)
26 {
27 	return !is_kdump_kernel() &&
28 		mlx5_accel_is_ktls_rx(mdev);
29 }
30 
mlx5e_accel_is_ktls_device(struct mlx5_core_dev * mdev)31 static inline bool mlx5e_accel_is_ktls_device(struct mlx5_core_dev *mdev)
32 {
33 	return !is_kdump_kernel() &&
34 		mlx5_accel_is_ktls_device(mdev);
35 }
36 
37 #else
38 
mlx5e_ktls_build_netdev(struct mlx5e_priv * priv)39 static inline void mlx5e_ktls_build_netdev(struct mlx5e_priv *priv)
40 {
41 }
42 
mlx5e_ktls_init_rx(struct mlx5e_priv * priv)43 static inline int mlx5e_ktls_init_rx(struct mlx5e_priv *priv)
44 {
45 	return 0;
46 }
47 
mlx5e_ktls_cleanup_rx(struct mlx5e_priv * priv)48 static inline void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv)
49 {
50 }
51 
mlx5e_ktls_set_feature_rx(struct net_device * netdev,bool enable)52 static inline int mlx5e_ktls_set_feature_rx(struct net_device *netdev, bool enable)
53 {
54 	netdev_warn(netdev, "kTLS is not supported\n");
55 	return -EOPNOTSUPP;
56 }
57 
58 static inline struct mlx5e_ktls_resync_resp *
mlx5e_ktls_rx_resync_create_resp_list(void)59 mlx5e_ktls_rx_resync_create_resp_list(void)
60 {
61 	return ERR_PTR(-EOPNOTSUPP);
62 }
63 
64 static inline void
mlx5e_ktls_rx_resync_destroy_resp_list(struct mlx5e_ktls_resync_resp * resp_list)65 mlx5e_ktls_rx_resync_destroy_resp_list(struct mlx5e_ktls_resync_resp *resp_list) {}
66 
mlx5e_accel_is_ktls_tx(struct mlx5_core_dev * mdev)67 static inline bool mlx5e_accel_is_ktls_tx(struct mlx5_core_dev *mdev) { return false; }
mlx5e_accel_is_ktls_rx(struct mlx5_core_dev * mdev)68 static inline bool mlx5e_accel_is_ktls_rx(struct mlx5_core_dev *mdev) { return false; }
mlx5e_accel_is_ktls_device(struct mlx5_core_dev * mdev)69 static inline bool mlx5e_accel_is_ktls_device(struct mlx5_core_dev *mdev) { return false; }
70 
71 #endif
72 
73 #endif /* __MLX5E_TLS_H__ */
74