1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
3 
4 #ifndef __MLX5_MACSEC_STEERING_H__
5 #define __MLX5_MACSEC_STEERING_H__
6 
7 #ifdef CONFIG_MLX5_EN_MACSEC
8 
9 #include "en_accel/macsec.h"
10 
11 #define MLX5_MACSEC_NUM_OF_SUPPORTED_INTERFACES 16
12 
13 struct mlx5e_macsec_fs;
14 union mlx5e_macsec_rule;
15 
16 struct mlx5_macsec_rule_attrs {
17 	sci_t sci;
18 	u32 macsec_obj_id;
19 	u8 assoc_num;
20 	int action;
21 };
22 
23 enum mlx5_macsec_action {
24 	MLX5_ACCEL_MACSEC_ACTION_ENCRYPT,
25 	MLX5_ACCEL_MACSEC_ACTION_DECRYPT,
26 };
27 
28 void mlx5e_macsec_fs_cleanup(struct mlx5e_macsec_fs *macsec_fs);
29 
30 struct mlx5e_macsec_fs *
31 mlx5e_macsec_fs_init(struct mlx5_core_dev *mdev, struct net_device *netdev);
32 
33 union mlx5e_macsec_rule *
34 mlx5e_macsec_fs_add_rule(struct mlx5e_macsec_fs *macsec_fs,
35 			 const struct macsec_context *ctx,
36 			 struct mlx5_macsec_rule_attrs *attrs,
37 			 u32 *sa_fs_id);
38 
39 void mlx5e_macsec_fs_del_rule(struct mlx5e_macsec_fs *macsec_fs,
40 			      union mlx5e_macsec_rule *macsec_rule,
41 			      int action);
42 
43 void mlx5e_macsec_fs_get_stats_fill(struct mlx5e_macsec_fs *macsec_fs, void *macsec_stats);
44 
45 #endif
46 
47 #endif /* __MLX5_MACSEC_STEERING_H__ */
48