DPDK  2.1.0
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 
103  const char *name;
104 
108 
112  uint32_t offset_port_id;
113 };
114 
119 
122 
123 };
124 
129 
132 };
133 
138 
141 
144 
148 
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  */
212 
215 
218 
221 
224 };
225 
226 /*
227  * Table
228  *
229  */
232 #define RTE_PIPELINE_TABLE_MAX 64
233 
246 
247  union {
250  uint32_t port_id;
252  uint32_t table_id;
253  };
255  uint8_t action_data[0];
256 };
257 
286  struct rte_mbuf **pkts,
287  uint64_t *pkts_mask,
288  struct rte_pipeline_table_entry **entries,
289  void *arg);
290 
319  struct rte_mbuf **pkts,
320  uint64_t *pkts_mask,
321  struct rte_pipeline_table_entry *entry,
322  void *arg);
323 
332  void *arg_create;
339 
342  void *arg_ah;
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 
521  struct rte_mbuf **pkts,
522  uint32_t n,
523  uint64_t *pkts_mask,
524  void *arg);
525 
531  void *arg_create;
532 
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 
649  struct rte_mbuf *pkt,
650  uint64_t *pkt_mask,
651  void *arg);
652 
675  struct rte_mbuf **pkts,
676  uint64_t *pkts_mask,
677  void *arg);
678 
687  void *arg_create;
688 
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