DPDK  24.11.0-rc3
rte_pipeline.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2016 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_RTE_PIPELINE_H__
6 #define __INCLUDE_RTE_PIPELINE_H__
7 
52 #include <stdint.h>
53 
54 #include <rte_port.h>
55 #include <rte_table.h>
56 #include <rte_common.h>
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 struct rte_mbuf;
63 
64 /*
65  * Pipeline
66  */
68 struct rte_pipeline;
69 
73  const char *name;
74 
77  int socket_id;
78 
82  uint32_t offset_port_id;
83 };
84 
88  struct rte_port_in_stats stats;
89 
92 
93 };
94 
98  struct rte_port_out_stats stats;
99 
102 };
103 
107  struct rte_table_stats stats;
108 
111 
114 
118 
122 };
123 
132 struct rte_pipeline *rte_pipeline_create(struct rte_pipeline_params *params);
133 
142 int rte_pipeline_free(struct rte_pipeline *p);
143 
152 int rte_pipeline_check(struct rte_pipeline *p);
153 
162 int rte_pipeline_run(struct rte_pipeline *p);
163 
172 int rte_pipeline_flush(struct rte_pipeline *p);
173 
174 /*
175  * Actions
176  */
181 
184 
187 
190 
193 };
194 
195 /*
196  * Table
197  */
200 #define RTE_PIPELINE_TABLE_MAX 64
201 
213  enum rte_pipeline_action action;
214 
215  union {
218  uint32_t port_id;
220  uint32_t table_id;
221  };
223  uint8_t action_data[];
224 };
225 
256  struct rte_pipeline *p,
257  struct rte_mbuf **pkts,
258  uint64_t pkts_mask,
259  struct rte_pipeline_table_entry **entries,
260  void *arg);
261 
292  struct rte_pipeline *p,
293  struct rte_mbuf **pkts,
294  uint64_t pkts_mask,
295  struct rte_pipeline_table_entry *entry,
296  void *arg);
297 
306  void *arg_create;
313 
316  void *arg_ah;
320 };
321 
335 int rte_pipeline_table_create(struct rte_pipeline *p,
336  struct rte_pipeline_table_params *params,
337  uint32_t *table_id);
338 
360 int rte_pipeline_table_default_entry_add(struct rte_pipeline *p,
361  uint32_t table_id,
362  struct rte_pipeline_table_entry *default_entry,
363  struct rte_pipeline_table_entry **default_entry_ptr);
364 
382 int rte_pipeline_table_default_entry_delete(struct rte_pipeline *p,
383  uint32_t table_id,
384  struct rte_pipeline_table_entry *entry);
385 
409 int rte_pipeline_table_entry_add(struct rte_pipeline *p,
410  uint32_t table_id,
411  void *key,
412  struct rte_pipeline_table_entry *entry,
413  int *key_found,
414  struct rte_pipeline_table_entry **entry_ptr);
415 
436 int rte_pipeline_table_entry_delete(struct rte_pipeline *p,
437  uint32_t table_id,
438  void *key,
439  int *key_found,
440  struct rte_pipeline_table_entry *entry);
441 
468 int rte_pipeline_table_entry_add_bulk(struct rte_pipeline *p,
469  uint32_t table_id,
470  void **keys,
471  struct rte_pipeline_table_entry **entries,
472  uint32_t n_keys,
473  int *key_found,
474  struct rte_pipeline_table_entry **entries_ptr);
475 
499 int rte_pipeline_table_entry_delete_bulk(struct rte_pipeline *p,
500  uint32_t table_id,
501  void **keys,
502  uint32_t n_keys,
503  int *key_found,
504  struct rte_pipeline_table_entry **entries);
505 
523 int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,
524  struct rte_pipeline_table_stats *stats, int clear);
525 
526 /*
527  * Port IN
528  */
531 #define RTE_PIPELINE_PORT_IN_MAX 64
532 
556  struct rte_pipeline *p,
557  struct rte_mbuf **pkts,
558  uint32_t n,
559  void *arg);
560 
566  void *arg_create;
567 
572  void *arg_ah;
573 
575  uint32_t burst_size;
576 };
577 
591 int rte_pipeline_port_in_create(struct rte_pipeline *p,
592  struct rte_pipeline_port_in_params *params,
593  uint32_t *port_id);
594 
607 int rte_pipeline_port_in_connect_to_table(struct rte_pipeline *p,
608  uint32_t port_id,
609  uint32_t table_id);
610 
621 int rte_pipeline_port_in_enable(struct rte_pipeline *p,
622  uint32_t port_id);
623 
634 int rte_pipeline_port_in_disable(struct rte_pipeline *p,
635  uint32_t port_id);
636 
654 int rte_pipeline_port_in_stats_read(struct rte_pipeline *p, uint32_t port_id,
655  struct rte_pipeline_port_in_stats *stats, int clear);
656 
657 /*
658  * Port OUT
659  */
662 #define RTE_PIPELINE_PORT_OUT_MAX 64
663 
688  struct rte_pipeline *p,
689  struct rte_mbuf **pkts,
690  uint64_t pkts_mask,
691  void *arg);
692 
701  void *arg_create;
702 
707  void *arg_ah;
708 };
709 
723 int rte_pipeline_port_out_create(struct rte_pipeline *p,
724  struct rte_pipeline_port_out_params *params,
725  uint32_t *port_id);
726 
744 int rte_pipeline_port_out_stats_read(struct rte_pipeline *p, uint32_t port_id,
745  struct rte_pipeline_port_out_stats *stats, int clear);
746 
747 /*
748  * Functions to be called as part of the port IN/OUT or table action handlers
749  */
770 int rte_pipeline_port_out_packet_insert(struct rte_pipeline *p,
771  uint32_t port_id,
772  struct rte_mbuf *pkt);
773 
774 #define rte_pipeline_ah_port_out_packet_insert \
775  rte_pipeline_port_out_packet_insert
776 
802 int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p,
803  uint64_t pkts_mask);
804 
833 int rte_pipeline_ah_packet_drop(struct rte_pipeline *p,
834  uint64_t pkts_mask);
835 
836 #ifdef __cplusplus
837 }
838 #endif
839 
840 #endif
int rte_pipeline_port_out_stats_read(struct rte_pipeline *p, uint32_t port_id, struct rte_pipeline_port_out_stats *stats, int clear)
const char * name
Definition: rte_pipeline.h:73
int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id, struct rte_pipeline_table_stats *stats, int clear)
uint32_t table_id
Definition: rte_pipeline.h:220
int rte_pipeline_flush(struct rte_pipeline *p)
int(* rte_pipeline_table_action_handler_hit)(struct rte_pipeline *p, struct rte_mbuf **pkts, uint64_t pkts_mask, struct rte_pipeline_table_entry **entries, void *arg)
Definition: rte_pipeline.h:255
int rte_pipeline_table_entry_add(struct rte_pipeline *p, uint32_t table_id, void *key, struct rte_pipeline_table_entry *entry, int *key_found, struct rte_pipeline_table_entry **entry_ptr)
struct rte_port_out_ops * ops
Definition: rte_pipeline.h:699
int rte_pipeline_table_create(struct rte_pipeline *p, struct rte_pipeline_table_params *params, uint32_t *table_id)
int rte_pipeline_table_default_entry_delete(struct rte_pipeline *p, uint32_t table_id, struct rte_pipeline_table_entry *entry)
Definition: rte_pipeline.h:211
int rte_pipeline_port_in_enable(struct rte_pipeline *p, uint32_t port_id)
rte_pipeline_table_action_handler_hit f_action_hit
Definition: rte_pipeline.h:309
int rte_pipeline_port_in_connect_to_table(struct rte_pipeline *p, uint32_t port_id, uint32_t table_id)
int(* rte_pipeline_port_in_action_handler)(struct rte_pipeline *p, struct rte_mbuf **pkts, uint32_t n, void *arg)
Definition: rte_pipeline.h:555
int rte_pipeline_table_entry_delete_bulk(struct rte_pipeline *p, uint32_t table_id, void **keys, uint32_t n_keys, int *key_found, struct rte_pipeline_table_entry **entries)
struct rte_table_ops * ops
Definition: rte_pipeline.h:303
int rte_pipeline_port_in_create(struct rte_pipeline *p, struct rte_pipeline_port_in_params *params, uint32_t *port_id)
rte_pipeline_action
Definition: rte_pipeline.h:178
int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p, uint64_t pkts_mask)
int rte_pipeline_ah_packet_drop(struct rte_pipeline *p, uint64_t pkts_mask)
int rte_pipeline_check(struct rte_pipeline *p)
int rte_pipeline_table_entry_delete(struct rte_pipeline *p, uint32_t table_id, void *key, int *key_found, struct rte_pipeline_table_entry *entry)
int(* rte_pipeline_table_action_handler_miss)(struct rte_pipeline *p, struct rte_mbuf **pkts, uint64_t pkts_mask, struct rte_pipeline_table_entry *entry, void *arg)
Definition: rte_pipeline.h:291
uint64_t n_pkts_dropped_by_lkp_miss_ah
Definition: rte_pipeline.h:113
int rte_pipeline_free(struct rte_pipeline *p)
int rte_pipeline_port_out_create(struct rte_pipeline *p, struct rte_pipeline_port_out_params *params, uint32_t *port_id)
rte_pipeline_port_in_action_handler f_action
Definition: rte_pipeline.h:570
int rte_pipeline_port_in_disable(struct rte_pipeline *p, uint32_t port_id)
int(* rte_pipeline_port_out_action_handler)(struct rte_pipeline *p, struct rte_mbuf **pkts, uint64_t pkts_mask, void *arg)
Definition: rte_pipeline.h:687
int rte_pipeline_port_out_packet_insert(struct rte_pipeline *p, uint32_t port_id, struct rte_mbuf *pkt)
int rte_pipeline_table_entry_add_bulk(struct rte_pipeline *p, uint32_t table_id, void **keys, struct rte_pipeline_table_entry **entries, uint32_t n_keys, int *key_found, struct rte_pipeline_table_entry **entries_ptr)
uint32_t port_id
Definition: rte_pipeline.h:218
int rte_pipeline_port_in_stats_read(struct rte_pipeline *p, uint32_t port_id, struct rte_pipeline_port_in_stats *stats, int clear)
int rte_pipeline_run(struct rte_pipeline *p)
rte_pipeline_port_out_action_handler f_action
Definition: rte_pipeline.h:705
struct rte_port_in_ops * ops
Definition: rte_pipeline.h:564
rte_pipeline_table_action_handler_miss f_action_miss
Definition: rte_pipeline.h:312
struct rte_pipeline * rte_pipeline_create(struct rte_pipeline_params *params)
uint32_t offset_port_id
Definition: rte_pipeline.h:82
int rte_pipeline_table_default_entry_add(struct rte_pipeline *p, uint32_t table_id, struct rte_pipeline_table_entry *default_entry, struct rte_pipeline_table_entry **default_entry_ptr)
uint64_t n_pkts_dropped_by_lkp_hit_ah
Definition: rte_pipeline.h:110