DPDK 22.11.6
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
9extern "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
63struct rte_mbuf;
64
65/*
66 * Pipeline
67 *
68 */
70struct rte_pipeline;
71
75 const char *name;
76
80
85};
86
91
94
95};
96
101
104};
105
110
113
116
120
124};
125
134struct rte_pipeline *rte_pipeline_create(struct rte_pipeline_params *params);
135
144int rte_pipeline_free(struct rte_pipeline *p);
145
154int rte_pipeline_check(struct rte_pipeline *p);
155
164int rte_pipeline_run(struct rte_pipeline *p);
165
174int rte_pipeline_flush(struct rte_pipeline *p);
175
176/*
177 * Actions
178 *
179 */
184
187
190
193
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
318
321 void *arg_ah;
325};
326
340int rte_pipeline_table_create(struct rte_pipeline *p,
341 struct rte_pipeline_table_params *params,
342 uint32_t *table_id);
343
365int 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
388 uint32_t table_id,
389 struct rte_pipeline_table_entry *entry);
390
414int 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
441int 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
473int 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
504int 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
528int 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
573
578 void *arg_ah;
579
581 uint32_t burst_size;
582};
583
597int rte_pipeline_port_in_create(struct rte_pipeline *p,
598 struct rte_pipeline_port_in_params *params,
599 uint32_t *port_id);
600
613int rte_pipeline_port_in_connect_to_table(struct rte_pipeline *p,
614 uint32_t port_id,
615 uint32_t table_id);
616
627int rte_pipeline_port_in_enable(struct rte_pipeline *p,
628 uint32_t port_id);
629
640int rte_pipeline_port_in_disable(struct rte_pipeline *p,
641 uint32_t port_id);
642
660int 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
709
714 void *arg_ah;
715};
716
730int rte_pipeline_port_out_create(struct rte_pipeline *p,
731 struct rte_pipeline_port_out_params *params,
732 uint32_t *port_id);
733
751int 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 */
778int 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
810int rte_pipeline_ah_packet_hijack(struct rte_pipeline *p,
811 uint64_t pkts_mask);
812
841int rte_pipeline_ah_packet_drop(struct rte_pipeline *p,
842 uint64_t pkts_mask);
843
844#ifdef __cplusplus
845}
846#endif
847
848#endif
#define RTE_STD_C11
Definition: rte_common.h:39
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:296
rte_pipeline_action
Definition: rte_pipeline.h:181
@ RTE_PIPELINE_ACTIONS
Definition: rte_pipeline.h:195
@ RTE_PIPELINE_ACTION_PORT_META
Definition: rte_pipeline.h:189
@ RTE_PIPELINE_ACTION_TABLE
Definition: rte_pipeline.h:192
@ RTE_PIPELINE_ACTION_PORT
Definition: rte_pipeline.h:186
@ RTE_PIPELINE_ACTION_DROP
Definition: rte_pipeline.h:183
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:260
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:694
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:561
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:84
const char * name
Definition: rte_pipeline.h:75
rte_pipeline_port_in_action_handler f_action
Definition: rte_pipeline.h:576
struct rte_port_in_ops * ops
Definition: rte_pipeline.h:570
struct rte_port_in_stats stats
Definition: rte_pipeline.h:90
rte_pipeline_port_out_action_handler f_action
Definition: rte_pipeline.h:712
struct rte_port_out_ops * ops
Definition: rte_pipeline.h:706
struct rte_port_out_stats stats
Definition: rte_pipeline.h:100
Definition: rte_pipeline.h:215
__extension__ uint8_t action_data[0]
Definition: rte_pipeline.h:228
uint32_t table_id
Definition: rte_pipeline.h:225
uint32_t port_id
Definition: rte_pipeline.h:223
enum rte_pipeline_action action
Definition: rte_pipeline.h:217
rte_pipeline_table_action_handler_miss f_action_miss
Definition: rte_pipeline.h:317
rte_pipeline_table_action_handler_hit f_action_hit
Definition: rte_pipeline.h:314
struct rte_table_ops * ops
Definition: rte_pipeline.h:308
uint64_t n_pkts_dropped_by_lkp_hit_ah
Definition: rte_pipeline.h:112
struct rte_table_stats stats
Definition: rte_pipeline.h:109
uint64_t n_pkts_dropped_by_lkp_miss_ah
Definition: rte_pipeline.h:115