DPDK
2.1.0
Main Page
Data Structures
Files
File List
Globals
lib
librte_pipeline
rte_pipeline.h
Go to the documentation of this file.
1
/*-
2
* BSD LICENSE
3
*
4
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
*
11
* * Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
13
* * Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in
15
* the documentation and/or other materials provided with the
16
* distribution.
17
* * Neither the name of Intel Corporation nor the names of its
18
* contributors may be used to endorse or promote products derived
19
* from this software without specific prior written permission.
20
*
21
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
*/
33
34
#ifndef __INCLUDE_RTE_PIPELINE_H__
35
#define __INCLUDE_RTE_PIPELINE_H__
36
37
#ifdef __cplusplus
38
extern
"C"
{
39
#endif
40
86
#include <stdint.h>
87
88
#include <
rte_port.h
>
89
#include <
rte_table.h
>
90
91
struct
rte_mbuf
;
92
93
/*
94
* Pipeline
95
*
96
*/
98
struct
rte_pipeline;
99
101
struct
rte_pipeline_params
{
103
const
char
*
name
;
104
107
int
socket_id
;
108
112
uint32_t
offset_port_id
;
113
};
114
116
struct
rte_pipeline_port_in_stats
{
118
struct
rte_port_in_stats
stats
;
119
121
uint64_t
n_pkts_dropped_by_ah
;
122
123
};
124
126
struct
rte_pipeline_port_out_stats
{
128
struct
rte_port_out_stats
stats
;
129
131
uint64_t
n_pkts_dropped_by_ah
;
132
};
133
135
struct
rte_pipeline_table_stats
{
137
struct
rte_table_stats
stats
;
138
140
uint64_t
n_pkts_dropped_by_lkp_hit_ah
;
141
143
uint64_t
n_pkts_dropped_by_lkp_miss_ah
;
144
147
uint64_t
n_pkts_dropped_lkp_hit
;
148
151
uint64_t
n_pkts_dropped_lkp_miss
;
152
};
153
162
struct
rte_pipeline *
rte_pipeline_create
(
struct
rte_pipeline_params
*params);
163
172
int
rte_pipeline_free
(
struct
rte_pipeline *p);
173
182
int
rte_pipeline_check
(
struct
rte_pipeline *p);
183
192
int
rte_pipeline_run
(
struct
rte_pipeline *p);
193
202
int
rte_pipeline_flush
(
struct
rte_pipeline *p);
203
204
/*
205
* Actions
206
*
207
*/
209
enum
rte_pipeline_action
{
211
RTE_PIPELINE_ACTION_DROP
= 0,
212
214
RTE_PIPELINE_ACTION_PORT
,
215
217
RTE_PIPELINE_ACTION_PORT_META
,
218
220
RTE_PIPELINE_ACTION_TABLE
,
221
223
RTE_PIPELINE_ACTIONS
224
};
225
226
/*
227
* Table
228
*
229
*/
232
#define RTE_PIPELINE_TABLE_MAX 64
233
243
struct
rte_pipeline_table_entry
{
245
enum
rte_pipeline_action
action
;
246
247
union
{
250
uint32_t
port_id
;
252
uint32_t
table_id
;
253
};
255
uint8_t
action_data
[0];
256
};
257
285
typedef
int (*
rte_pipeline_table_action_handler_hit
)(
286
struct
rte_mbuf
**pkts,
287
uint64_t *pkts_mask,
288
struct
rte_pipeline_table_entry
**entries,
289
void
*arg);
290
318
typedef
int (*
rte_pipeline_table_action_handler_miss
)(
319
struct
rte_mbuf
**pkts,
320
uint64_t *pkts_mask,
321
struct
rte_pipeline_table_entry
*entry,
322
void
*arg);
323
327
struct
rte_pipeline_table_params
{
329
struct
rte_table_ops
*
ops
;
332
void
*
arg_create
;
335
rte_pipeline_table_action_handler_hit
f_action_hit
;
338
rte_pipeline_table_action_handler_miss
f_action_miss
;
339
342
void
*
arg_ah
;
345
uint32_t
action_data_size
;
346
};
347
361
int
rte_pipeline_table_create
(
struct
rte_pipeline *p,
362
struct
rte_pipeline_table_params
*params,
363
uint32_t *table_id);
364
386
int
rte_pipeline_table_default_entry_add
(
struct
rte_pipeline *p,
387
uint32_t table_id,
388
struct
rte_pipeline_table_entry
*default_entry,
389
struct
rte_pipeline_table_entry
**default_entry_ptr);
390
408
int
rte_pipeline_table_default_entry_delete
(
struct
rte_pipeline *p,
409
uint32_t table_id,
410
struct
rte_pipeline_table_entry
*entry);
411
435
int
rte_pipeline_table_entry_add
(
struct
rte_pipeline *p,
436
uint32_t table_id,
437
void
*key,
438
struct
rte_pipeline_table_entry
*entry,
439
int
*key_found,
440
struct
rte_pipeline_table_entry
**entry_ptr);
441
462
int
rte_pipeline_table_entry_delete
(
struct
rte_pipeline *p,
463
uint32_t table_id,
464
void
*key,
465
int
*key_found,
466
struct
rte_pipeline_table_entry
*entry);
467
485
int
rte_pipeline_table_stats_read
(
struct
rte_pipeline *p, uint32_t table_id,
486
struct
rte_pipeline_table_stats
*stats,
int
clear);
487
488
/*
489
* Port IN
490
*
491
*/
494
#define RTE_PIPELINE_PORT_IN_MAX 64
495
520
typedef
int (*
rte_pipeline_port_in_action_handler
)(
521
struct
rte_mbuf
**pkts,
522
uint32_t n,
523
uint64_t *pkts_mask,
524
void
*arg);
525
527
struct
rte_pipeline_port_in_params
{
529
struct
rte_port_in_ops
*
ops
;
531
void
*
arg_create
;
532
535
rte_pipeline_port_in_action_handler
f_action
;
537
void
*
arg_ah
;
538
540
uint32_t
burst_size
;
541
};
542
556
int
rte_pipeline_port_in_create
(
struct
rte_pipeline *p,
557
struct
rte_pipeline_port_in_params
*params,
558
uint32_t *port_id);
559
572
int
rte_pipeline_port_in_connect_to_table
(
struct
rte_pipeline *p,
573
uint32_t port_id,
574
uint32_t table_id);
575
586
int
rte_pipeline_port_in_enable
(
struct
rte_pipeline *p,
587
uint32_t port_id);
588
599
int
rte_pipeline_port_in_disable
(
struct
rte_pipeline *p,
600
uint32_t port_id);
601
619
int
rte_pipeline_port_in_stats_read
(
struct
rte_pipeline *p, uint32_t port_id,
620
struct
rte_pipeline_port_in_stats
*stats,
int
clear);
621
622
/*
623
* Port OUT
624
*
625
*/
628
#define RTE_PIPELINE_PORT_OUT_MAX 64
629
648
typedef
int (*
rte_pipeline_port_out_action_handler
)(
649
struct
rte_mbuf
*pkt,
650
uint64_t *pkt_mask,
651
void
*arg);
652
674
typedef
int (*
rte_pipeline_port_out_action_handler_bulk
)(
675
struct
rte_mbuf
**pkts,
676
uint64_t *pkts_mask,
677
void
*arg);
678
683
struct
rte_pipeline_port_out_params
{
685
struct
rte_port_out_ops
*
ops
;
687
void
*
arg_create
;
688
691
rte_pipeline_port_out_action_handler
f_action
;
694
rte_pipeline_port_out_action_handler_bulk
f_action_bulk
;
696
void
*
arg_ah
;
697
};
698
712
int
rte_pipeline_port_out_create
(
struct
rte_pipeline *p,
713
struct
rte_pipeline_port_out_params
*params,
714
uint32_t *port_id);
715
736
int
rte_pipeline_port_out_packet_insert
(
struct
rte_pipeline *p,
737
uint32_t port_id,
738
struct
rte_mbuf
*pkt);
739
757
int
rte_pipeline_port_out_stats_read
(
struct
rte_pipeline *p, uint32_t port_id,
758
struct
rte_pipeline_port_out_stats
*stats,
int
clear);
759
#ifdef __cplusplus
760
}
761
#endif
762
763
#endif
Generated by
1.8.1.2