1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
3
4 #ifndef __MLX5_ESW_IPSEC_FS_H__
5 #define __MLX5_ESW_IPSEC_FS_H__
6
7 struct mlx5e_ipsec;
8 struct mlx5e_ipsec_sa_entry;
9
10 #ifdef CONFIG_MLX5_ESWITCH
11 void mlx5_esw_ipsec_rx_status_destroy(struct mlx5e_ipsec *ipsec,
12 struct mlx5e_ipsec_rx *rx);
13 int mlx5_esw_ipsec_rx_status_create(struct mlx5e_ipsec *ipsec,
14 struct mlx5e_ipsec_rx *rx,
15 struct mlx5_flow_destination *dest);
16 void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
17 struct mlx5e_ipsec_rx_create_attr *attr);
18 int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,
19 struct mlx5_flow_destination *dest);
20 int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
21 struct mlx5_flow_act *flow_act);
22 void mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry *sa_entry);
23 int mlx5_esw_ipsec_rx_ipsec_obj_id_search(struct mlx5e_priv *priv, u32 id,
24 u32 *ipsec_obj_id);
25 void mlx5_esw_ipsec_tx_create_attr_set(struct mlx5e_ipsec *ipsec,
26 struct mlx5e_ipsec_tx_create_attr *attr);
27 void mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev *mdev);
28 #else
mlx5_esw_ipsec_rx_status_destroy(struct mlx5e_ipsec * ipsec,struct mlx5e_ipsec_rx * rx)29 static inline void mlx5_esw_ipsec_rx_status_destroy(struct mlx5e_ipsec *ipsec,
30 struct mlx5e_ipsec_rx *rx) {}
31
mlx5_esw_ipsec_rx_status_create(struct mlx5e_ipsec * ipsec,struct mlx5e_ipsec_rx * rx,struct mlx5_flow_destination * dest)32 static inline int mlx5_esw_ipsec_rx_status_create(struct mlx5e_ipsec *ipsec,
33 struct mlx5e_ipsec_rx *rx,
34 struct mlx5_flow_destination *dest)
35 {
36 return -EINVAL;
37 }
38
mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec * ipsec,struct mlx5e_ipsec_rx_create_attr * attr)39 static inline void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
40 struct mlx5e_ipsec_rx_create_attr *attr) {}
41
mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec * ipsec,struct mlx5_flow_destination * dest)42 static inline int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,
43 struct mlx5_flow_destination *dest)
44 {
45 return -EINVAL;
46 }
47
mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry * sa_entry,struct mlx5_flow_act * flow_act)48 static inline int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
49 struct mlx5_flow_act *flow_act)
50 {
51 return -EINVAL;
52 }
53
mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry * sa_entry)54 static inline void mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry *sa_entry) {}
55
mlx5_esw_ipsec_rx_ipsec_obj_id_search(struct mlx5e_priv * priv,u32 id,u32 * ipsec_obj_id)56 static inline int mlx5_esw_ipsec_rx_ipsec_obj_id_search(struct mlx5e_priv *priv, u32 id,
57 u32 *ipsec_obj_id)
58 {
59 return -EINVAL;
60 }
61
mlx5_esw_ipsec_tx_create_attr_set(struct mlx5e_ipsec * ipsec,struct mlx5e_ipsec_tx_create_attr * attr)62 static inline void mlx5_esw_ipsec_tx_create_attr_set(struct mlx5e_ipsec *ipsec,
63 struct mlx5e_ipsec_tx_create_attr *attr) {}
64
mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev * mdev)65 static inline void mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev *mdev) {}
66 #endif /* CONFIG_MLX5_ESWITCH */
67 #endif /* __MLX5_ESW_IPSEC_FS_H__ */
68