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 void mlx5_esw_ipsec_rx_rule_add_match_obj(struct mlx5e_ipsec_sa_entry *sa_entry,
24 struct mlx5_flow_spec *spec);
25 #else
mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec * ipsec,struct mlx5e_ipsec_rx_create_attr * attr)26 static inline void mlx5_esw_ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
27 struct mlx5e_ipsec_rx_create_attr *attr) {}
28
mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec * ipsec,struct mlx5_flow_destination * dest)29 static inline int mlx5_esw_ipsec_rx_status_pass_dest_get(struct mlx5e_ipsec *ipsec,
30 struct mlx5_flow_destination *dest)
31 {
32 return -EINVAL;
33 }
34
mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry * sa_entry,struct mlx5_flow_act * flow_act)35 static inline int mlx5_esw_ipsec_rx_setup_modify_header(struct mlx5e_ipsec_sa_entry *sa_entry,
36 struct mlx5_flow_act *flow_act)
37 {
38 return -EINVAL;
39 }
40
mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry * sa_entry)41 static inline void mlx5_esw_ipsec_rx_id_mapping_remove(struct mlx5e_ipsec_sa_entry *sa_entry) {}
42
mlx5_esw_ipsec_rx_ipsec_obj_id_search(struct mlx5e_priv * priv,u32 id,u32 * ipsec_obj_id)43 static inline int mlx5_esw_ipsec_rx_ipsec_obj_id_search(struct mlx5e_priv *priv, u32 id,
44 u32 *ipsec_obj_id)
45 {
46 return -EINVAL;
47 }
48
mlx5_esw_ipsec_tx_create_attr_set(struct mlx5e_ipsec * ipsec,struct mlx5e_ipsec_tx_create_attr * attr)49 static inline void mlx5_esw_ipsec_tx_create_attr_set(struct mlx5e_ipsec *ipsec,
50 struct mlx5e_ipsec_tx_create_attr *attr) {}
51
mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev * mdev)52 static inline void mlx5_esw_ipsec_restore_dest_uplink(struct mlx5_core_dev *mdev) {}
53 static inline void
mlx5_esw_ipsec_rx_rule_add_match_obj(struct mlx5e_ipsec_sa_entry * sa_entry,struct mlx5_flow_spec * spec)54 mlx5_esw_ipsec_rx_rule_add_match_obj(struct mlx5e_ipsec_sa_entry *sa_entry,
55 struct mlx5_flow_spec *spec) {}
56 #endif /* CONFIG_MLX5_ESWITCH */
57 #endif /* __MLX5_ESW_IPSEC_FS_H__ */
58