DPDK  2.2.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 
494 int rte_pipeline_table_entry_add_bulk(struct rte_pipeline *p,
495  uint32_t table_id,
496  void **keys,
497  struct rte_pipeline_table_entry **entries,
498  uint32_t n_keys,
499  int *key_found,
500  struct rte_pipeline_table_entry **entries_ptr);
501 
525 int rte_pipeline_table_entry_delete_bulk(struct rte_pipeline *p,
526  uint32_t table_id,
527  void **keys,
528  uint32_t n_keys,
529  int *key_found,
530  struct rte_pipeline_table_entry **entries);
531 
549 int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,
550  struct rte_pipeline_table_stats *stats, int clear);
551 
552 /*
553  * Port IN
554  *
555  */
558 #define RTE_PIPELINE_PORT_IN_MAX 64
559 
585  struct rte_mbuf **pkts,
586  uint32_t n,
587  uint64_t *pkts_mask,
588  void *arg);
589 
595  void *arg_create;
596 
601  void *arg_ah;
602 
604  uint32_t burst_size;
605 };
606 
620 int rte_pipeline_port_in_create(struct rte_pipeline *p,
621  struct rte_pipeline_port_in_params *params,
622  uint32_t *port_id);
623 
636 int rte_pipeline_port_in_connect_to_table(struct rte_pipeline *p,
637  uint32_t port_id,
638  uint32_t table_id);
639 
650 int rte_pipeline_port_in_enable(struct rte_pipeline *p,
651  uint32_t port_id);
652 
663 int rte_pipeline_port_in_disable(struct rte_pipeline *p,
664  uint32_t port_id);
665 
683 int rte_pipeline_port_in_stats_read(struct rte_pipeline *p, uint32_t port_id,
684  struct rte_pipeline_port_in_stats *stats, int clear);
685 
686 /*
687  * Port OUT
688  *
689  */
692 #define RTE_PIPELINE_PORT_OUT_MAX 64
693 
713  struct rte_mbuf *pkt,
714  uint64_t *pkt_mask,
715  void *arg);
716 
739  struct rte_mbuf **pkts,
740  uint64_t *pkts_mask,
741  void *arg);
742 
751  void *arg_create;
752 
760  void *arg_ah;
761 };
762 
776 int rte_pipeline_port_out_create(struct rte_pipeline *p,
777  struct rte_pipeline_port_out_params *params,
778  uint32_t *port_id);
779 
800 int rte_pipeline_port_out_packet_insert(struct rte_pipeline *p,
801  uint32_t port_id,
802  struct rte_mbuf *pkt);
803 
821 int rte_pipeline_port_out_stats_read(struct rte_pipeline *p, uint32_t port_id,
822  struct rte_pipeline_port_out_stats *stats, int clear);
823 #ifdef __cplusplus
824 }
825 #endif
826 
827 #endif