This source file includes following definitions.
- mlx5dr_is_supported
- mlx5dr_domain_create
- mlx5dr_domain_destroy
- mlx5dr_domain_sync
- mlx5dr_domain_set_peer
- mlx5dr_table_create
- mlx5dr_table_destroy
- mlx5dr_table_get_id
- mlx5dr_matcher_create
- mlx5dr_matcher_destroy
- mlx5dr_rule_create
- mlx5dr_rule_destroy
- mlx5dr_table_set_miss_action
- mlx5dr_action_create_dest_table
- mlx5dr_create_action_dest_flow_fw_table
- mlx5dr_action_create_dest_vport
- mlx5dr_action_create_drop
- mlx5dr_action_create_tag
- mlx5dr_action_create_flow_counter
- mlx5dr_action_create_packet_reformat
- mlx5dr_action_create_modify_header
- mlx5dr_action_create_pop_vlan
- mlx5dr_action_create_push_vlan
- mlx5dr_action_destroy
- mlx5dr_is_supported
1
2
3
4 #ifndef _MLX5DR_H_
5 #define _MLX5DR_H_
6
7 struct mlx5dr_domain;
8 struct mlx5dr_table;
9 struct mlx5dr_matcher;
10 struct mlx5dr_rule;
11 struct mlx5dr_action;
12
13 enum mlx5dr_domain_type {
14 MLX5DR_DOMAIN_TYPE_NIC_RX,
15 MLX5DR_DOMAIN_TYPE_NIC_TX,
16 MLX5DR_DOMAIN_TYPE_FDB,
17 };
18
19 enum mlx5dr_domain_sync_flags {
20 MLX5DR_DOMAIN_SYNC_FLAGS_SW = 1 << 0,
21 MLX5DR_DOMAIN_SYNC_FLAGS_HW = 1 << 1,
22 };
23
24 enum mlx5dr_action_reformat_type {
25 DR_ACTION_REFORMAT_TYP_TNL_L2_TO_L2,
26 DR_ACTION_REFORMAT_TYP_L2_TO_TNL_L2,
27 DR_ACTION_REFORMAT_TYP_TNL_L3_TO_L2,
28 DR_ACTION_REFORMAT_TYP_L2_TO_TNL_L3,
29 };
30
31 struct mlx5dr_match_parameters {
32 size_t match_sz;
33 u64 *match_buf;
34 };
35
36 #ifdef CONFIG_MLX5_SW_STEERING
37
38 struct mlx5dr_domain *
39 mlx5dr_domain_create(struct mlx5_core_dev *mdev, enum mlx5dr_domain_type type);
40
41 int mlx5dr_domain_destroy(struct mlx5dr_domain *domain);
42
43 int mlx5dr_domain_sync(struct mlx5dr_domain *domain, u32 flags);
44
45 void mlx5dr_domain_set_peer(struct mlx5dr_domain *dmn,
46 struct mlx5dr_domain *peer_dmn);
47
48 struct mlx5dr_table *
49 mlx5dr_table_create(struct mlx5dr_domain *domain, u32 level);
50
51 int mlx5dr_table_destroy(struct mlx5dr_table *table);
52
53 u32 mlx5dr_table_get_id(struct mlx5dr_table *table);
54
55 struct mlx5dr_matcher *
56 mlx5dr_matcher_create(struct mlx5dr_table *table,
57 u16 priority,
58 u8 match_criteria_enable,
59 struct mlx5dr_match_parameters *mask);
60
61 int mlx5dr_matcher_destroy(struct mlx5dr_matcher *matcher);
62
63 struct mlx5dr_rule *
64 mlx5dr_rule_create(struct mlx5dr_matcher *matcher,
65 struct mlx5dr_match_parameters *value,
66 size_t num_actions,
67 struct mlx5dr_action *actions[]);
68
69 int mlx5dr_rule_destroy(struct mlx5dr_rule *rule);
70
71 int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
72 struct mlx5dr_action *action);
73
74 struct mlx5dr_action *
75 mlx5dr_action_create_dest_table(struct mlx5dr_table *table);
76
77 struct mlx5dr_action *
78 mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft,
79 struct mlx5_core_dev *mdev);
80
81 struct mlx5dr_action *
82 mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain,
83 u32 vport, u8 vhca_id_valid,
84 u16 vhca_id);
85
86 struct mlx5dr_action *mlx5dr_action_create_drop(void);
87
88 struct mlx5dr_action *mlx5dr_action_create_tag(u32 tag_value);
89
90 struct mlx5dr_action *
91 mlx5dr_action_create_flow_counter(u32 counter_id);
92
93 struct mlx5dr_action *
94 mlx5dr_action_create_packet_reformat(struct mlx5dr_domain *dmn,
95 enum mlx5dr_action_reformat_type reformat_type,
96 size_t data_sz,
97 void *data);
98
99 struct mlx5dr_action *
100 mlx5dr_action_create_modify_header(struct mlx5dr_domain *domain,
101 u32 flags,
102 size_t actions_sz,
103 __be64 actions[]);
104
105 struct mlx5dr_action *mlx5dr_action_create_pop_vlan(void);
106
107 struct mlx5dr_action *
108 mlx5dr_action_create_push_vlan(struct mlx5dr_domain *domain, __be32 vlan_hdr);
109
110 int mlx5dr_action_destroy(struct mlx5dr_action *action);
111
112 static inline bool
113 mlx5dr_is_supported(struct mlx5_core_dev *dev)
114 {
115 return MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner);
116 }
117
118 #else
119
120 static inline struct mlx5dr_domain *
121 mlx5dr_domain_create(struct mlx5_core_dev *mdev, enum mlx5dr_domain_type type) { return NULL; }
122
123 static inline int
124 mlx5dr_domain_destroy(struct mlx5dr_domain *domain) { return 0; }
125
126 static inline int
127 mlx5dr_domain_sync(struct mlx5dr_domain *domain, u32 flags) { return 0; }
128
129 static inline void
130 mlx5dr_domain_set_peer(struct mlx5dr_domain *dmn,
131 struct mlx5dr_domain *peer_dmn) { }
132
133 static inline struct mlx5dr_table *
134 mlx5dr_table_create(struct mlx5dr_domain *domain, u32 level) { return NULL; }
135
136 static inline int
137 mlx5dr_table_destroy(struct mlx5dr_table *table) { return 0; }
138
139 static inline u32
140 mlx5dr_table_get_id(struct mlx5dr_table *table) { return 0; }
141
142 static inline struct mlx5dr_matcher *
143 mlx5dr_matcher_create(struct mlx5dr_table *table,
144 u16 priority,
145 u8 match_criteria_enable,
146 struct mlx5dr_match_parameters *mask) { return NULL; }
147
148 static inline int
149 mlx5dr_matcher_destroy(struct mlx5dr_matcher *matcher) { return 0; }
150
151 static inline struct mlx5dr_rule *
152 mlx5dr_rule_create(struct mlx5dr_matcher *matcher,
153 struct mlx5dr_match_parameters *value,
154 size_t num_actions,
155 struct mlx5dr_action *actions[]) { return NULL; }
156
157 static inline int
158 mlx5dr_rule_destroy(struct mlx5dr_rule *rule) { return 0; }
159
160 static inline int
161 mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
162 struct mlx5dr_action *action) { return 0; }
163
164 static inline struct mlx5dr_action *
165 mlx5dr_action_create_dest_table(struct mlx5dr_table *table) { return NULL; }
166
167 static inline struct mlx5dr_action *
168 mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft,
169 struct mlx5_core_dev *mdev) { return NULL; }
170
171 static inline struct mlx5dr_action *
172 mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain,
173 u32 vport, u8 vhca_id_valid,
174 u16 vhca_id) { return NULL; }
175
176 static inline struct mlx5dr_action *
177 mlx5dr_action_create_drop(void) { return NULL; }
178
179 static inline struct mlx5dr_action *
180 mlx5dr_action_create_tag(u32 tag_value) { return NULL; }
181
182 static inline struct mlx5dr_action *
183 mlx5dr_action_create_flow_counter(u32 counter_id) { return NULL; }
184
185 static inline struct mlx5dr_action *
186 mlx5dr_action_create_packet_reformat(struct mlx5dr_domain *dmn,
187 enum mlx5dr_action_reformat_type reformat_type,
188 size_t data_sz,
189 void *data) { return NULL; }
190
191 static inline struct mlx5dr_action *
192 mlx5dr_action_create_modify_header(struct mlx5dr_domain *domain,
193 u32 flags,
194 size_t actions_sz,
195 __be64 actions[]) { return NULL; }
196
197 static inline struct mlx5dr_action *
198 mlx5dr_action_create_pop_vlan(void) { return NULL; }
199
200 static inline struct mlx5dr_action *
201 mlx5dr_action_create_push_vlan(struct mlx5dr_domain *domain,
202 __be32 vlan_hdr) { return NULL; }
203
204 static inline int
205 mlx5dr_action_destroy(struct mlx5dr_action *action) { return 0; }
206
207 static inline bool
208 mlx5dr_is_supported(struct mlx5_core_dev *dev) { return false; }
209
210 #endif
211
212 #endif