DPDK  23.07.0
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 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
56 #include <stdint.h>
57 
58 #include <rte_port.h>
59 #include <rte_table.h>
60 #include <rte_common.h>
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 
216  union {
219  uint32_t port_id;
221  uint32_t table_id;
222  };
224  __extension__ uint8_t action_data[0];
225 };
226 
257  struct rte_pipeline *p,
258  struct rte_mbuf **pkts,
259  uint64_t pkts_mask,
260  struct rte_pipeline_table_entry **entries,
261  void *arg);
262 
293  struct rte_pipeline *p,
294  struct rte_mbuf **pkts,
295  uint64_t pkts_mask,
296  struct rte_pipeline_table_entry *entry,
297  void *arg);
298 
307  void *arg_create;
314 
317  void *arg_ah;
321 };
322 
336 int rte_pipeline_table_create(struct rte_pipeline *p,
337  struct rte_pipeline_table_params *params,
338  uint32_t *table_id);
339 
361 int rte_pipeline_table_default_entry_add(struct rte_pipeline *p,
362  uint32_t table_id,
363  struct rte_pipeline_table_entry *default_entry,
364  struct rte_pipeline_table_entry **default_entry_ptr);
365 
383 int rte_pipeline_table_default_entry_delete(struct rte_pipeline *p,
384  uint32_t table_id,
385  struct rte_pipeline_table_entry *entry);
386 
410 int rte_pipeline_table_entry_add(struct rte_pipeline *p,
411  uint32_t table_id,
412  void *key,
413  struct rte_pipeline_table_entry *entry,
414  int *key_found,
415  struct rte_pipeline_table_entry **entry_ptr);
416 
437 int rte_pipeline_table_entry_delete(struct rte_pipeline *p,
438  uint32_t table_id,
439  void *key,
440  int *key_found,
441  struct rte_pipeline_table_entry *entry);
442 
469 int rte_pipeline_table_entry_add_bulk(struct rte_pipeline *p,
470  uint32_t table_id,
471  void **keys,
472  struct rte_pipeline_table_entry **entries,
473  uint32_t n_keys,
474  int *key_found,
475  struct rte_pipeline_table_entry **entries_ptr);
476 
500 int rte_pipeline_table_entry_delete_bulk(struct rte_pipeline *p,
501  uint32_t table_id,
502  void **keys,
503  uint32_t n_keys,
504  int *key_found,
505  struct rte_pipeline_table_entry **entries);
506 
524 int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,
525  struct rte_pipeline_table_stats *stats, int clear);
526 
527 /*
528  * Port IN
529  */
532 #define RTE_PIPELINE_PORT_IN_MAX 64
533 
557  struct rte_pipeline *p,
558  struct rte_mbuf **pkts,
559  uint32_t n,
560  void *arg);
561 
567  void *arg_create;
568 
573  void *arg_ah;
574 
576  uint32_t burst_size;
577 };
578 
592 int rte_pipeline_port_in_create(struct rte_pipeline *p,
593  struct rte_pipeline_port_in_params *params,
594  uint32_t *port_id);
595 
608 int rte_pipeline_port_in_connect_to_table(struct rte_pipeline *p,
609  uint32_t port_id,
610  uint32_t table_id);
611 
622 int rte_pipeline_port_in_enable(struct rte_pipeline *p,
623  uint32_t port_id);
624 
635 int rte_pipeline_port_in_disable(struct rte_pipeline *p,
636  uint32_t port_id);
637 
655 int rte_pipeline_port_in_stats_read(struct rte_pipeline *p, uint32_t port_id,
656  struct rte_pipeline_port_in_stats *stats, int clear);
657 
658 /*
659  * Port OUT
660  */
663 #define RTE_PIPELINE_PORT_OUT_MAX 64
664 
689  struct rte_pipeline *p,
690  struct rte_mbuf **pkts,
691  uint64_t pkts_mask,
692  void *arg);
693 
702  void *arg_create;
703 
708  void *arg_ah;
709 };
710 
724 int rte_pipeline_port_out_create(struct rte_pipeline *p,
725  struct rte_pipeline_port_out_params *params,
726  uint32_t *port_id);
727 
745 int rte_pipeline_port_out_stats_read(struct rte_pipeline *p, uint32_t port_id,
746  struct rte_pipeline_port_out_stats *stats, int clear);
747 
748 /*
749  * Functions to be called as part of the port IN/OUT or table action handlers
750  */
771 int rte_pipeline_port_out_packet_insert(struct rte_pipeline *p,
772  uint32_t port_id,
773  struct rte_mbuf *pkt);
774 
775 #define rte_pipeline_ah_port_out_packet_insert \
776  rte_pipeline_port_out_packet_insert
777 
803 int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p,
804  uint64_t pkts_mask);
805 
834 int rte_pipeline_ah_packet_drop(struct rte_pipeline *p,
835  uint64_t pkts_mask);
836 
837 #ifdef __cplusplus
838 }
839 #endif
840 
841 #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:221
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:256
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:700
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:310
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:556
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:304
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:292
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:571
int rte_pipeline_port_in_disable(struct rte_pipeline *p, uint32_t port_id)
#define RTE_STD_C11
Definition: rte_common.h:39
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:688
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:219
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:706
struct rte_port_in_ops * ops
Definition: rte_pipeline.h:565
rte_pipeline_table_action_handler_miss f_action_miss
Definition: rte_pipeline.h:313
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