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_create_attr_set(struct mlx5e_ipsec *ipsec,
12 				       struct mlx5e_ipsec_rx_create_attr *attr);
13 int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,
14 					   struct mlx5_flow_destination *dest);
15 int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
16 					  struct mlx5_flow_act *flow_act);
17 void mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry *sa_entry);
18 int mlx5_esw_ipsec_rx_ipsec_obj_id_search(struct mlx5e_priv *priv, u32 id,
19 					  u32 *ipsec_obj_id);
20 void mlx5_esw_ipsec_tx_create_attr_set(struct mlx5e_ipsec *ipsec,
21 				       struct mlx5e_ipsec_tx_create_attr *attr);
22 void mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev *mdev);
23 #else
mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec * ipsec,struct mlx5e_ipsec_rx_create_attr * attr)24 static inline void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
25 						     struct mlx5e_ipsec_rx_create_attr *attr) {}
26 
mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec * ipsec,struct mlx5_flow_destination * dest)27 static inline int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,
28 							 struct mlx5_flow_destination *dest)
29 {
30 	return -EINVAL;
31 }
32 
mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry * sa_entry,struct mlx5_flow_act * flow_act)33 static inline int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
34 							struct mlx5_flow_act *flow_act)
35 {
36 	return -EINVAL;
37 }
38 
mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry * sa_entry)39 static inline void mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry *sa_entry) {}
40 
mlx5_esw_ipsec_rx_ipsec_obj_id_search(struct mlx5e_priv * priv,u32 id,u32 * ipsec_obj_id)41 static inline int mlx5_esw_ipsec_rx_ipsec_obj_id_search(struct mlx5e_priv *priv, u32 id,
42 							u32 *ipsec_obj_id)
43 {
44 	return -EINVAL;
45 }
46 
mlx5_esw_ipsec_tx_create_attr_set(struct mlx5e_ipsec * ipsec,struct mlx5e_ipsec_tx_create_attr * attr)47 static inline void mlx5_esw_ipsec_tx_create_attr_set(struct mlx5e_ipsec *ipsec,
48 						     struct mlx5e_ipsec_tx_create_attr *attr) {}
49 
mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev * mdev)50 static inline void mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev *mdev) {}
51 #endif /* CONFIG_MLX5_ESWITCH */
52 #endif /* __MLX5_ESW_IPSEC_FS_H__ */
53