DPDK  20.05.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 
57 #include <stdint.h>
58 
59 #include <rte_port.h>
60 #include <rte_table.h>
61 #include <rte_common.h>
62 
63 struct rte_mbuf;
64 
65 /*
66  * Pipeline
67  *
68  */
70 struct rte_pipeline;
71 
75  const char *name;
76 
79  int socket_id;
80 
84  uint32_t offset_port_id;
85 };
86 
91 
94 
95 };
96 
101 
104 };
105 
110 
113 
116 
120 
124 };
125 
134 struct rte_pipeline *rte_pipeline_create(struct rte_pipeline_params *params);
135 
144 int rte_pipeline_free(struct rte_pipeline *p);
145 
154 int rte_pipeline_check(struct rte_pipeline *p);
155 
164 int rte_pipeline_run(struct rte_pipeline *p);
165 
174 int rte_pipeline_flush(struct rte_pipeline *p);
175 
176 /*
177  * Actions
178  *
179  */
184 
187 
190 
193 
196 };
197 
198 /*
199  * Table
200  *
201  */
204 #define RTE_PIPELINE_TABLE_MAX 64
205 
218 
220  union {
223  uint32_t port_id;
225  uint32_t table_id;
226  };
228  __extension__ uint8_t action_data[0];
229 };
230 
261  struct rte_pipeline *p,
262  struct rte_mbuf **pkts,
263  uint64_t pkts_mask,
264  struct rte_pipeline_table_entry **entries,
265  void *arg);
266 
297  struct rte_pipeline *p,
298  struct rte_mbuf **pkts,
299  uint64_t pkts_mask,
300  struct rte_pipeline_table_entry *entry,
301  void *arg);
302 
311  void *arg_create;
318 
321  void *arg_ah;
325 };
326 
340 int rte_pipeline_table_create(struct rte_pipeline *p,
341  struct rte_pipeline_table_params *params,
342  uint32_t *table_id);
343 
365 int rte_pipeline_table_default_entry_add(struct rte_pipeline *p,
366  uint32_t table_id,
367  struct rte_pipeline_table_entry *default_entry,
368  struct rte_pipeline_table_entry **default_entry_ptr);
369 
387 int rte_pipeline_table_default_entry_delete(struct rte_pipeline *p,
388  uint32_t table_id,
389  struct rte_pipeline_table_entry *entry);
390 
414 int rte_pipeline_table_entry_add(struct rte_pipeline *p,
415  uint32_t table_id,
416  void *key,
417  struct rte_pipeline_table_entry *entry,
418  int *key_found,
419  struct rte_pipeline_table_entry **entry_ptr);
420 
441 int rte_pipeline_table_entry_delete(struct rte_pipeline *p,
442  uint32_t table_id,
443  void *key,
444  int *key_found,
445  struct rte_pipeline_table_entry *entry);
446 
473 int rte_pipeline_table_entry_add_bulk(struct rte_pipeline *p,
474  uint32_t table_id,
475  void **keys,
476  struct rte_pipeline_table_entry **entries,
477  uint32_t n_keys,
478  int *key_found,
479  struct rte_pipeline_table_entry **entries_ptr);
480 
504 int rte_pipeline_table_entry_delete_bulk(struct rte_pipeline *p,
505  uint32_t table_id,
506  void **keys,
507  uint32_t n_keys,
508  int *key_found,
509  struct rte_pipeline_table_entry **entries);
510 
528 int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,
529  struct rte_pipeline_table_stats *stats, int clear);
530 
531 /*
532  * Port IN
533  *
534  */
537 #define RTE_PIPELINE_PORT_IN_MAX 64
538 
562  struct rte_pipeline *p,
563  struct rte_mbuf **pkts,
564  uint32_t n,
565  void *arg);
566 
572  void *arg_create;
573 
578  void *arg_ah;
579 
581  uint32_t burst_size;
582 };
583 
597 int rte_pipeline_port_in_create(struct rte_pipeline *p,
598  struct rte_pipeline_port_in_params *params,
599  uint32_t *port_id);
600 
613 int rte_pipeline_port_in_connect_to_table(struct rte_pipeline *p,
614  uint32_t port_id,
615  uint32_t table_id);
616 
627 int rte_pipeline_port_in_enable(struct rte_pipeline *p,
628  uint32_t port_id);
629 
640 int rte_pipeline_port_in_disable(struct rte_pipeline *p,
641  uint32_t port_id);
642 
660 int rte_pipeline_port_in_stats_read(struct rte_pipeline *p, uint32_t port_id,
661  struct rte_pipeline_port_in_stats *stats, int clear);
662 
663 /*
664  * Port OUT
665  *
666  */
669 #define RTE_PIPELINE_PORT_OUT_MAX 64
670 
695  struct rte_pipeline *p,
696  struct rte_mbuf **pkts,
697  uint64_t pkts_mask,
698  void *arg);
699 
708  void *arg_create;
709 
714  void *arg_ah;
715 };
716 
730 int rte_pipeline_port_out_create(struct rte_pipeline *p,
731  struct rte_pipeline_port_out_params *params,
732  uint32_t *port_id);
733 
751 int rte_pipeline_port_out_stats_read(struct rte_pipeline *p, uint32_t port_id,
752  struct rte_pipeline_port_out_stats *stats, int clear);
753 
754 /*
755  * Functions to be called as part of the port IN/OUT or table action handlers
756  *
757  */
778 int rte_pipeline_port_out_packet_insert(struct rte_pipeline *p,
779  uint32_t port_id,
780  struct rte_mbuf *pkt);
781 
782 #define rte_pipeline_ah_port_out_packet_insert \
783  rte_pipeline_port_out_packet_insert
784 
810 int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p,
811  uint64_t pkts_mask);
812 
841 int rte_pipeline_ah_packet_drop(struct rte_pipeline *p,
842  uint64_t pkts_mask);
843 
844 #ifdef __cplusplus
845 }
846 #endif
847 
848 #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:75
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:225
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:260
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)
enum rte_pipeline_action action
Definition: rte_pipeline.h:217
struct rte_port_out_ops * ops
Definition: rte_pipeline.h:706
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:215
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:314
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:561
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:308
__extension__ uint8_t action_data[0]
Definition: rte_pipeline.h:228
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:181
struct rte_port_out_stats stats
Definition: rte_pipeline.h:100
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:296
uint64_t n_pkts_dropped_by_lkp_miss_ah
Definition: rte_pipeline.h:115
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:576
int rte_pipeline_port_in_disable(struct rte_pipeline *p, uint32_t port_id)
#define RTE_STD_C11
Definition: rte_common.h:40
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:694
struct rte_table_stats stats
Definition: rte_pipeline.h:109
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:223
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:712
struct rte_port_in_ops * ops
Definition: rte_pipeline.h:570
rte_pipeline_table_action_handler_miss f_action_miss
Definition: rte_pipeline.h:317
struct rte_port_in_stats stats
Definition: rte_pipeline.h:90
struct rte_pipeline * rte_pipeline_create(struct rte_pipeline_params *params)
uint32_t offset_port_id
Definition: rte_pipeline.h:84
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:112