1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2025 NVIDIA Corporation & Affiliates */
3 
4 #ifndef _MLX5_FS_HWS_
5 #define _MLX5_FS_HWS_
6 
7 #include "mlx5hws.h"
8 #include "fs_hws_pools.h"
9 
10 struct mlx5_fs_hws_actions_pool {
11 	struct mlx5hws_action *tag_action;
12 	struct mlx5hws_action *pop_vlan_action;
13 	struct mlx5hws_action *push_vlan_action;
14 	struct mlx5hws_action *drop_action;
15 	struct mlx5hws_action *decapl2_action;
16 	struct mlx5hws_action *remove_hdr_vlan_action;
17 	struct mlx5_fs_pool insert_hdr_pool;
18 	struct mlx5_fs_pool dl3tnltol2_pool;
19 	struct xarray el2tol3tnl_pools;
20 	struct xarray el2tol2tnl_pools;
21 	struct xarray mh_pools;
22 	struct xarray table_dests;
23 	struct xarray vport_vhca_dests;
24 	struct xarray vport_dests;
25 };
26 
27 struct mlx5_fs_hws_context {
28 	struct mlx5hws_context	*hws_ctx;
29 	struct mlx5_fs_hws_actions_pool hws_pool;
30 };
31 
32 struct mlx5_fs_hws_table {
33 	struct mlx5hws_table *hws_table;
34 	bool miss_ft_set;
35 };
36 
37 struct mlx5_fs_hws_action {
38 	struct mlx5hws_action *hws_action;
39 	struct mlx5_fs_pool *fs_pool;
40 	struct mlx5_fs_hws_pr *pr_data;
41 	struct mlx5_fs_hws_mh *mh_data;
42 };
43 
44 struct mlx5_fs_hws_matcher {
45 	struct mlx5hws_bwc_matcher *matcher;
46 };
47 
48 struct mlx5_fs_hws_rule_action {
49 	struct mlx5hws_action *action;
50 	union {
51 		struct mlx5_fc *counter;
52 	};
53 };
54 
55 struct mlx5_fs_hws_rule {
56 	struct mlx5hws_bwc_rule *bwc_rule;
57 	struct mlx5_fs_hws_rule_action *hws_fs_actions;
58 	int num_fs_actions;
59 };
60 
61 #ifdef CONFIG_MLX5_HW_STEERING
62 
63 bool mlx5_fs_hws_is_supported(struct mlx5_core_dev *dev);
64 
65 const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds(void);
66 
67 #else
68 
mlx5_fs_hws_is_supported(struct mlx5_core_dev * dev)69 static inline bool mlx5_fs_hws_is_supported(struct mlx5_core_dev *dev)
70 {
71 	return false;
72 }
73 
mlx5_fs_cmd_get_hws_cmds(void)74 static inline const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds(void)
75 {
76 	return NULL;
77 }
78 
79 #endif /* CONFIG_MLX5_HWS_STEERING */
80 #endif
81