DPDK  24.11.0-rc3
rte_flow_driver.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2016 6WIND S.A.
3  * Copyright 2016 Mellanox Technologies, Ltd
4  */
5 
6 #ifndef RTE_FLOW_DRIVER_H_
7 #define RTE_FLOW_DRIVER_H_
8 
18 #include <stdint.h>
19 
20 #include "rte_ethdev.h"
21 #include "ethdev_driver.h"
22 #include "rte_flow.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
39 struct rte_flow_ops {
41  int (*validate)
42  (struct rte_eth_dev *,
43  const struct rte_flow_attr *,
44  const struct rte_flow_item [],
45  const struct rte_flow_action [],
46  struct rte_flow_error *);
48  struct rte_flow *(*create)
49  (struct rte_eth_dev *,
50  const struct rte_flow_attr *,
51  const struct rte_flow_item [],
52  const struct rte_flow_action [],
53  struct rte_flow_error *);
55  int (*destroy)
56  (struct rte_eth_dev *,
57  struct rte_flow *,
58  struct rte_flow_error *);
60  int (*flush)
61  (struct rte_eth_dev *,
62  struct rte_flow_error *);
64  int (*query)
65  (struct rte_eth_dev *,
66  struct rte_flow *,
67  const struct rte_flow_action *,
68  void *,
69  struct rte_flow_error *);
71  int (*isolate)
72  (struct rte_eth_dev *,
73  int,
74  struct rte_flow_error *);
76  int (*dev_dump)
77  (struct rte_eth_dev *dev,
78  struct rte_flow *flow,
79  FILE *file,
80  struct rte_flow_error *error);
82  int (*get_aged_flows)
83  (struct rte_eth_dev *dev,
84  void **context,
85  uint32_t nb_contexts,
86  struct rte_flow_error *err);
88  int (*get_q_aged_flows)
89  (struct rte_eth_dev *dev,
90  uint32_t queue_id,
91  void **contexts,
92  uint32_t nb_contexts,
93  struct rte_flow_error *error);
95  struct rte_flow_action_handle *(*action_handle_create)
96  (struct rte_eth_dev *dev,
97  const struct rte_flow_indir_action_conf *conf,
98  const struct rte_flow_action *action,
99  struct rte_flow_error *error);
101  int (*action_handle_destroy)
102  (struct rte_eth_dev *dev,
103  struct rte_flow_action_handle *handle,
104  struct rte_flow_error *error);
106  int (*action_handle_update)
107  (struct rte_eth_dev *dev,
108  struct rte_flow_action_handle *handle,
109  const void *update,
110  struct rte_flow_error *error);
112  int (*action_handle_query)
113  (struct rte_eth_dev *dev,
114  const struct rte_flow_action_handle *handle,
115  void *data,
116  struct rte_flow_error *error);
119  (struct rte_eth_dev *dev,
120  struct rte_flow_action_handle *handle,
121  const void *update, void *query,
122  enum rte_flow_query_update_mode qu_mode,
123  struct rte_flow_error *error);
125  struct rte_flow_action_list_handle *(*action_list_handle_create)
126  (struct rte_eth_dev *dev,
127  const struct rte_flow_indir_action_conf *conf,
128  const struct rte_flow_action actions[],
129  struct rte_flow_error *error);
132  (struct rte_eth_dev *dev,
133  struct rte_flow_action_list_handle *handle,
134  struct rte_flow_error *error);
136  int (*tunnel_decap_set)
137  (struct rte_eth_dev *dev,
138  struct rte_flow_tunnel *tunnel,
139  struct rte_flow_action **pmd_actions,
140  uint32_t *num_of_actions,
141  struct rte_flow_error *err);
143  int (*tunnel_match)
144  (struct rte_eth_dev *dev,
145  struct rte_flow_tunnel *tunnel,
146  struct rte_flow_item **pmd_items,
147  uint32_t *num_of_items,
148  struct rte_flow_error *err);
150  int (*get_restore_info)
151  (struct rte_eth_dev *dev,
152  struct rte_mbuf *m,
153  struct rte_flow_restore_info *info,
154  struct rte_flow_error *err);
157  (struct rte_eth_dev *dev,
158  struct rte_flow_action *pmd_actions,
159  uint32_t num_of_actions,
160  struct rte_flow_error *err);
162  int (*tunnel_item_release)
163  (struct rte_eth_dev *dev,
164  struct rte_flow_item *pmd_items,
165  uint32_t num_of_items,
166  struct rte_flow_error *err);
168  int (*pick_transfer_proxy)
169  (struct rte_eth_dev *dev,
170  uint16_t *proxy_port_id,
171  struct rte_flow_error *error);
172  struct rte_flow_item_flex_handle *(*flex_item_create)
173  (struct rte_eth_dev *dev,
174  const struct rte_flow_item_flex_conf *conf,
175  struct rte_flow_error *error);
176  int (*flex_item_release)
177  (struct rte_eth_dev *dev,
178  const struct rte_flow_item_flex_handle *handle,
179  struct rte_flow_error *error);
181  int (*info_get)
182  (struct rte_eth_dev *dev,
183  struct rte_flow_port_info *port_info,
184  struct rte_flow_queue_info *queue_info,
185  struct rte_flow_error *err);
187  int (*configure)
188  (struct rte_eth_dev *dev,
189  const struct rte_flow_port_attr *port_attr,
190  uint16_t nb_queue,
191  const struct rte_flow_queue_attr *queue_attr[],
192  struct rte_flow_error *err);
194  struct rte_flow_pattern_template *(*pattern_template_create)
195  (struct rte_eth_dev *dev,
196  const struct rte_flow_pattern_template_attr *template_attr,
197  const struct rte_flow_item pattern[],
198  struct rte_flow_error *err);
201  (struct rte_eth_dev *dev,
202  struct rte_flow_pattern_template *pattern_template,
203  struct rte_flow_error *err);
205  struct rte_flow_actions_template *(*actions_template_create)
206  (struct rte_eth_dev *dev,
207  const struct rte_flow_actions_template_attr *template_attr,
208  const struct rte_flow_action actions[],
209  const struct rte_flow_action masks[],
210  struct rte_flow_error *err);
213  (struct rte_eth_dev *dev,
214  struct rte_flow_actions_template *actions_template,
215  struct rte_flow_error *err);
217  struct rte_flow_template_table *(*template_table_create)
218  (struct rte_eth_dev *dev,
219  const struct rte_flow_template_table_attr *table_attr,
220  struct rte_flow_pattern_template *pattern_templates[],
221  uint8_t nb_pattern_templates,
222  struct rte_flow_actions_template *actions_templates[],
223  uint8_t nb_actions_templates,
224  struct rte_flow_error *err);
227  (struct rte_eth_dev *dev,
228  struct rte_flow_template_table *template_table,
229  struct rte_flow_error *err);
232  (struct rte_eth_dev *dev,
233  uint32_t group_id,
234  const struct rte_flow_group_attr *attr,
235  const struct rte_flow_action actions[],
236  struct rte_flow_error *err);
238  int (*actions_update)
239  (struct rte_eth_dev *dev,
240  struct rte_flow *flow,
241  const struct rte_flow_action actions[],
242  struct rte_flow_error *error);
245  (struct rte_eth_dev *dev,
246  const struct rte_flow_action_list_handle *handle,
247  const void **update, void **query,
248  enum rte_flow_query_update_mode mode,
249  struct rte_flow_error *error);
251  int (*flow_calc_table_hash)
252  (struct rte_eth_dev *dev, const struct rte_flow_template_table *table,
253  const struct rte_flow_item pattern[], uint8_t pattern_template_index,
254  uint32_t *hash, struct rte_flow_error *error);
256  int (*flow_calc_encap_hash)
257  (struct rte_eth_dev *dev, const struct rte_flow_item pattern[],
258  enum rte_flow_encap_hash_field dest_field, uint8_t *hash,
259  struct rte_flow_error *error);
261  int (*flow_template_table_resize)(struct rte_eth_dev *dev,
262  struct rte_flow_template_table *table,
263  uint32_t nb_rules,
264  struct rte_flow_error *error);
266  int (*flow_update_resized)(struct rte_eth_dev *dev, uint32_t queue,
267  const struct rte_flow_op_attr *attr,
268  struct rte_flow *rule, void *user_data,
269  struct rte_flow_error *error);
272  (struct rte_eth_dev *dev,
273  struct rte_flow_template_table *table,
274  struct rte_flow_error *error);
275 };
276 
290 const struct rte_flow_ops *
291 rte_flow_ops_get(uint16_t port_id, struct rte_flow_error *error);
292 
296 int
298 
300 typedef struct rte_flow *(*rte_flow_async_create_t)(struct rte_eth_dev *dev,
301  uint32_t queue,
302  const struct rte_flow_op_attr *attr,
303  struct rte_flow_template_table *table,
304  const struct rte_flow_item *items,
305  uint8_t pattern_template_index,
306  const struct rte_flow_action *actions,
307  uint8_t action_template_index,
308  void *user_data,
309  struct rte_flow_error *error);
310 
312 typedef struct rte_flow *(*rte_flow_async_create_by_index_t)(struct rte_eth_dev *dev,
313  uint32_t queue,
314  const struct rte_flow_op_attr *attr,
315  struct rte_flow_template_table *table,
316  uint32_t rule_index,
317  const struct rte_flow_action *actions,
318  uint8_t action_template_index,
319  void *user_data,
320  struct rte_flow_error *error);
321 
323 typedef struct rte_flow *(*rte_flow_async_create_by_index_with_pattern_t)(struct rte_eth_dev *dev,
324  uint32_t queue,
325  const struct rte_flow_op_attr *attr,
326  struct rte_flow_template_table *table,
327  uint32_t rule_index,
328  const struct rte_flow_item *items,
329  uint8_t pattern_template_index,
330  const struct rte_flow_action *actions,
331  uint8_t action_template_index,
332  void *user_data,
333  struct rte_flow_error *error);
334 
336 typedef int (*rte_flow_async_actions_update_t)(struct rte_eth_dev *dev,
337  uint32_t queue_id,
338  const struct rte_flow_op_attr *op_attr,
339  struct rte_flow *flow,
340  const struct rte_flow_action *actions,
341  uint8_t actions_template_index,
342  void *user_data,
343  struct rte_flow_error *error);
344 
346 typedef int (*rte_flow_async_destroy_t)(struct rte_eth_dev *dev,
347  uint32_t queue_id,
348  const struct rte_flow_op_attr *op_attr,
349  struct rte_flow *flow,
350  void *user_data,
351  struct rte_flow_error *error);
352 
354 typedef int (*rte_flow_push_t)(struct rte_eth_dev *dev,
355  uint32_t queue_id,
356  struct rte_flow_error *error);
357 
359 typedef int (*rte_flow_pull_t)(struct rte_eth_dev *dev,
360  uint32_t queue_id,
361  struct rte_flow_op_result *res,
362  uint16_t n_res,
363  struct rte_flow_error *error);
364 
366 typedef struct rte_flow_action_handle *(*rte_flow_async_action_handle_create_t)(
367  struct rte_eth_dev *dev,
368  uint32_t queue_id,
369  const struct rte_flow_op_attr *op_attr,
370  const struct rte_flow_indir_action_conf *indir_action_conf,
371  const struct rte_flow_action *action,
372  void *user_data,
373  struct rte_flow_error *error);
374 
376 typedef int (*rte_flow_async_action_handle_destroy_t)(struct rte_eth_dev *dev,
377  uint32_t queue_id,
378  const struct rte_flow_op_attr *op_attr,
379  struct rte_flow_action_handle *action_handle,
380  void *user_data,
381  struct rte_flow_error *error);
382 
384 typedef int (*rte_flow_async_action_handle_update_t)(struct rte_eth_dev *dev,
385  uint32_t queue_id,
386  const struct rte_flow_op_attr *op_attr,
387  struct rte_flow_action_handle *action_handle,
388  const void *update,
389  void *user_data,
390  struct rte_flow_error *error);
391 
393 typedef int (*rte_flow_async_action_handle_query_t)
394  (struct rte_eth_dev *dev,
395  uint32_t queue_id,
396  const struct rte_flow_op_attr *op_attr,
397  const struct rte_flow_action_handle *action_handle,
398  void *data,
399  void *user_data,
400  struct rte_flow_error *error);
401 
403 typedef int (*rte_flow_async_action_handle_query_update_t)(struct rte_eth_dev *dev,
404  uint32_t queue_id,
405  const struct rte_flow_op_attr *attr,
406  struct rte_flow_action_handle *handle,
407  const void *update, void *query,
408  enum rte_flow_query_update_mode mode,
409  void *user_data,
410  struct rte_flow_error *error);
411 
413 typedef struct rte_flow_action_list_handle *(*rte_flow_async_action_list_handle_create_t)(
414  struct rte_eth_dev *dev,
415  uint32_t queue_id,
416  const struct rte_flow_op_attr *attr,
417  const struct rte_flow_indir_action_conf *conf,
418  const struct rte_flow_action *actions,
419  void *user_data,
420  struct rte_flow_error *error);
421 
423 typedef int (*rte_flow_async_action_list_handle_destroy_t)(
424  struct rte_eth_dev *dev,
425  uint32_t queue_id,
426  const struct rte_flow_op_attr *op_attr,
427  struct rte_flow_action_list_handle *handle,
428  void *user_data,
429  struct rte_flow_error *error);
430 
432 typedef int (*rte_flow_async_action_list_handle_query_update_t)(
433  struct rte_eth_dev *dev,
434  uint32_t queue_id,
435  const struct rte_flow_op_attr *attr,
436  const struct rte_flow_action_list_handle *handle,
437  const void **update,
438  void **query,
439  enum rte_flow_query_update_mode mode,
440  void *user_data,
441  struct rte_flow_error *error);
442 
448 struct __rte_cache_aligned rte_flow_fp_ops {
449  rte_flow_async_create_t async_create;
450  rte_flow_async_create_by_index_t async_create_by_index;
451  rte_flow_async_actions_update_t async_actions_update;
452  rte_flow_async_create_by_index_with_pattern_t async_create_by_index_with_pattern;
453  rte_flow_async_destroy_t async_destroy;
454  rte_flow_push_t push;
455  rte_flow_pull_t pull;
456  rte_flow_async_action_handle_create_t async_action_handle_create;
457  rte_flow_async_action_handle_destroy_t async_action_handle_destroy;
458  rte_flow_async_action_handle_update_t async_action_handle_update;
459  rte_flow_async_action_handle_query_t async_action_handle_query;
460  rte_flow_async_action_handle_query_update_t async_action_handle_query_update;
461  rte_flow_async_action_list_handle_create_t async_action_list_handle_create;
462  rte_flow_async_action_list_handle_destroy_t async_action_list_handle_destroy;
463  rte_flow_async_action_list_handle_query_update_t async_action_list_handle_query_update;
464 };
465 
470 extern struct rte_flow_fp_ops rte_flow_fp_default_ops;
471 
472 #ifdef __cplusplus
473 }
474 #endif
475 
476 #endif /* RTE_FLOW_DRIVER_H_ */
int(* tunnel_item_release)(struct rte_eth_dev *dev, struct rte_flow_item *pmd_items, uint32_t num_of_items, struct rte_flow_error *err)
int(* group_set_miss_actions)(struct rte_eth_dev *dev, uint32_t group_id, const struct rte_flow_group_attr *attr, const struct rte_flow_action actions[], struct rte_flow_error *err)
int(* action_list_handle_destroy)(struct rte_eth_dev *dev, struct rte_flow_action_list_handle *handle, struct rte_flow_error *error)
int(* action_handle_query_update)(struct rte_eth_dev *dev, struct rte_flow_action_handle *handle, const void *update, void *query, enum rte_flow_query_update_mode qu_mode, struct rte_flow_error *error)
rte_flow_encap_hash_field
Definition: rte_flow.h:6990
int(* template_table_destroy)(struct rte_eth_dev *dev, struct rte_flow_template_table *template_table, struct rte_flow_error *err)
int(* actions_update)(struct rte_eth_dev *dev, struct rte_flow *flow, const struct rte_flow_action actions[], struct rte_flow_error *error)
int(* actions_template_destroy)(struct rte_eth_dev *dev, struct rte_flow_actions_template *actions_template, struct rte_flow_error *err)
int(* get_q_aged_flows)(struct rte_eth_dev *dev, uint32_t queue_id, void **contexts, uint32_t nb_contexts, struct rte_flow_error *error)
int(* tunnel_match)(struct rte_eth_dev *dev, struct rte_flow_tunnel *tunnel, struct rte_flow_item **pmd_items, uint32_t *num_of_items, struct rte_flow_error *err)
int(* query)(struct rte_eth_dev *, struct rte_flow *, const struct rte_flow_action *, void *, struct rte_flow_error *)
#define __rte_cache_aligned
Definition: rte_common.h:627
int(* action_handle_query)(struct rte_eth_dev *dev, const struct rte_flow_action_handle *handle, void *data, struct rte_flow_error *error)
int(* info_get)(struct rte_eth_dev *dev, struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info, struct rte_flow_error *err)
int(* validate)(struct rte_eth_dev *, const struct rte_flow_attr *, const struct rte_flow_item [], const struct rte_flow_action [], struct rte_flow_error *)
int(* pattern_template_destroy)(struct rte_eth_dev *dev, struct rte_flow_pattern_template *pattern_template, struct rte_flow_error *err)
int(* get_aged_flows)(struct rte_eth_dev *dev, void **context, uint32_t nb_contexts, struct rte_flow_error *err)
int(* action_handle_destroy)(struct rte_eth_dev *dev, struct rte_flow_action_handle *handle, struct rte_flow_error *error)
int(* pick_transfer_proxy)(struct rte_eth_dev *dev, uint16_t *proxy_port_id, struct rte_flow_error *error)
int rte_flow_restore_info_dynflag_register(void)
int(* flow_template_table_resize)(struct rte_eth_dev *dev, struct rte_flow_template_table *table, uint32_t nb_rules, struct rte_flow_error *error)
int(* flow_update_resized)(struct rte_eth_dev *dev, uint32_t queue, const struct rte_flow_op_attr *attr, struct rte_flow *rule, void *user_data, struct rte_flow_error *error)
int(* tunnel_decap_set)(struct rte_eth_dev *dev, struct rte_flow_tunnel *tunnel, struct rte_flow_action **pmd_actions, uint32_t *num_of_actions, struct rte_flow_error *err)
int(* get_restore_info)(struct rte_eth_dev *dev, struct rte_mbuf *m, struct rte_flow_restore_info *info, struct rte_flow_error *err)
rte_flow_query_update_mode
Definition: rte_flow.h:6593
int(* flow_template_table_resize_complete)(struct rte_eth_dev *dev, struct rte_flow_template_table *table, struct rte_flow_error *error)
int(* flow_calc_table_hash)(struct rte_eth_dev *dev, const struct rte_flow_template_table *table, const struct rte_flow_item pattern[], uint8_t pattern_template_index, uint32_t *hash, struct rte_flow_error *error)
int(* tunnel_action_decap_release)(struct rte_eth_dev *dev, struct rte_flow_action *pmd_actions, uint32_t num_of_actions, struct rte_flow_error *err)
int(* action_list_handle_query_update)(struct rte_eth_dev *dev, const struct rte_flow_action_list_handle *handle, const void **update, void **query, enum rte_flow_query_update_mode mode, struct rte_flow_error *error)
int(* isolate)(struct rte_eth_dev *, int, struct rte_flow_error *)
int(* flow_calc_encap_hash)(struct rte_eth_dev *dev, const struct rte_flow_item pattern[], enum rte_flow_encap_hash_field dest_field, uint8_t *hash, struct rte_flow_error *error)
int(* flush)(struct rte_eth_dev *, struct rte_flow_error *)
int(* dev_dump)(struct rte_eth_dev *dev, struct rte_flow *flow, FILE *file, struct rte_flow_error *error)
int(* destroy)(struct rte_eth_dev *, struct rte_flow *, struct rte_flow_error *)
int(* configure)(struct rte_eth_dev *dev, const struct rte_flow_port_attr *port_attr, uint16_t nb_queue, const struct rte_flow_queue_attr *queue_attr[], struct rte_flow_error *err)
int(* action_handle_update)(struct rte_eth_dev *dev, struct rte_flow_action_handle *handle, const void *update, struct rte_flow_error *error)
const struct rte_flow_ops * rte_flow_ops_get(uint16_t port_id, struct rte_flow_error *error)