DPDK 25.03.0-rc0
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
59extern "C" {
60#endif
61
62struct rte_mbuf;
63
64/*
65 * Pipeline
66 */
68struct rte_pipeline;
69
73 const char *name;
74
78
83};
84
89
92
93};
94
99
102};
103
108
111
114
118
122};
123
132struct rte_pipeline *rte_pipeline_create(struct rte_pipeline_params *params);
133
142int rte_pipeline_free(struct rte_pipeline *p);
143
152int rte_pipeline_check(struct rte_pipeline *p);
153
162int rte_pipeline_run(struct rte_pipeline *p);
163
172int rte_pipeline_flush(struct rte_pipeline *p);
173
174/*
175 * Actions
176 */
181
184
187
190
194
195/*
196 * Table
197 */
200#define RTE_PIPELINE_TABLE_MAX 64
201
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
313
316 void *arg_ah;
320};
321
335int rte_pipeline_table_create(struct rte_pipeline *p,
336 struct rte_pipeline_table_params *params,
337 uint32_t *table_id);
338
360int 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
383 uint32_t table_id,
384 struct rte_pipeline_table_entry *entry);
385
409int 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
436int 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
468int 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
499int 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
523int 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
567
572 void *arg_ah;
573
575 uint32_t burst_size;
576};
577
591int rte_pipeline_port_in_create(struct rte_pipeline *p,
592 struct rte_pipeline_port_in_params *params,
593 uint32_t *port_id);
594
607int rte_pipeline_port_in_connect_to_table(struct rte_pipeline *p,
608 uint32_t port_id,
609 uint32_t table_id);
610
621int rte_pipeline_port_in_enable(struct rte_pipeline *p,
622 uint32_t port_id);
623
634int rte_pipeline_port_in_disable(struct rte_pipeline *p,
635 uint32_t port_id);
636
654int 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
702
707 void *arg_ah;
708};
709
723int rte_pipeline_port_out_create(struct rte_pipeline *p,
724 struct rte_pipeline_port_out_params *params,
725 uint32_t *port_id);
726
744int 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 */
770int 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
802int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p,
803 uint64_t pkts_mask);
804
833int 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_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)
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)
int rte_pipeline_port_out_create(struct rte_pipeline *p, struct rte_pipeline_port_out_params *params, uint32_t *port_id)
int rte_pipeline_ah_packet_drop(struct rte_pipeline *p, uint64_t pkts_mask)
int rte_pipeline_port_out_packet_insert(struct rte_pipeline *p, uint32_t port_id, struct rte_mbuf *pkt)
int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id, struct rte_pipeline_table_stats *stats, int clear)
int rte_pipeline_run(struct rte_pipeline *p)
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
rte_pipeline_action
Definition: rte_pipeline.h:178
@ RTE_PIPELINE_ACTIONS
Definition: rte_pipeline.h:192
@ RTE_PIPELINE_ACTION_PORT_META
Definition: rte_pipeline.h:186
@ RTE_PIPELINE_ACTION_TABLE
Definition: rte_pipeline.h:189
@ RTE_PIPELINE_ACTION_PORT
Definition: rte_pipeline.h:183
@ RTE_PIPELINE_ACTION_DROP
Definition: rte_pipeline.h:180
int rte_pipeline_port_in_disable(struct rte_pipeline *p, uint32_t port_id)
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_free(struct rte_pipeline *p)
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)
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_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)
struct rte_pipeline * rte_pipeline_create(struct rte_pipeline_params *params)
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_port_in_create(struct rte_pipeline *p, struct rte_pipeline_port_in_params *params, uint32_t *port_id)
int rte_pipeline_port_out_stats_read(struct rte_pipeline *p, uint32_t port_id, struct rte_pipeline_port_out_stats *stats, int clear)
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_flush(struct rte_pipeline *p)
int rte_pipeline_table_default_entry_delete(struct rte_pipeline *p, uint32_t table_id, struct rte_pipeline_table_entry *entry)
int rte_pipeline_check(struct rte_pipeline *p)
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_ah_packet_hijack(struct rte_pipeline *p, uint64_t pkts_mask)
int rte_pipeline_table_create(struct rte_pipeline *p, struct rte_pipeline_table_params *params, uint32_t *table_id)
int rte_pipeline_port_in_enable(struct rte_pipeline *p, uint32_t port_id)
uint32_t offset_port_id
Definition: rte_pipeline.h:82
const char * name
Definition: rte_pipeline.h:73
rte_pipeline_port_in_action_handler f_action
Definition: rte_pipeline.h:570
struct rte_port_in_ops * ops
Definition: rte_pipeline.h:564
struct rte_port_in_stats stats
Definition: rte_pipeline.h:88
rte_pipeline_port_out_action_handler f_action
Definition: rte_pipeline.h:705
struct rte_port_out_ops * ops
Definition: rte_pipeline.h:699
struct rte_port_out_stats stats
Definition: rte_pipeline.h:98
Definition: rte_pipeline.h:211
uint32_t table_id
Definition: rte_pipeline.h:220
uint32_t port_id
Definition: rte_pipeline.h:218
uint8_t action_data[]
Definition: rte_pipeline.h:223
enum rte_pipeline_action action
Definition: rte_pipeline.h:213
rte_pipeline_table_action_handler_miss f_action_miss
Definition: rte_pipeline.h:312
rte_pipeline_table_action_handler_hit f_action_hit
Definition: rte_pipeline.h:309
struct rte_table_ops * ops
Definition: rte_pipeline.h:303
uint64_t n_pkts_dropped_by_lkp_hit_ah
Definition: rte_pipeline.h:110
struct rte_table_stats stats
Definition: rte_pipeline.h:107
uint64_t n_pkts_dropped_by_lkp_miss_ah
Definition: rte_pipeline.h:113