4 * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
34 #ifndef __INCLUDE_PIPELINE_ROUTING_BE_H__
35 #define __INCLUDE_PIPELINE_ROUTING_BE_H__
37 #include <rte_ether.h>
39 #include "pipeline_common_be.h"
42 * Pipeline argument parsing
44 #ifndef PIPELINE_ROUTING_N_ROUTES_DEFAULT
45 #define PIPELINE_ROUTING_N_ROUTES_DEFAULT 4096
48 enum pipeline_routing_encap {
49 PIPELINE_ROUTING_ENCAP_ETHERNET = 0,
50 PIPELINE_ROUTING_ENCAP_ETHERNET_QINQ,
51 PIPELINE_ROUTING_ENCAP_ETHERNET_MPLS,
54 struct pipeline_routing_params {
58 /* routing packet encapsulation */
59 enum pipeline_routing_encap encap;
61 uint32_t mpls_color_mark;
64 uint32_t n_arp_entries;
66 /* packet buffer offsets */
67 uint32_t ip_hdr_offset;
68 uint32_t arp_key_offset;
69 uint32_t color_offset;
72 uint32_t dbg_ah_disable;
76 pipeline_routing_parse_args(struct pipeline_routing_params *p,
77 struct pipeline_params *params);
82 enum pipeline_routing_route_key_type {
83 PIPELINE_ROUTING_ROUTE_IPV4,
86 struct pipeline_routing_route_key_ipv4 {
91 struct pipeline_routing_route_key {
92 enum pipeline_routing_route_key_type type;
94 struct pipeline_routing_route_key_ipv4 ipv4;
98 enum pipeline_routing_route_flags {
99 PIPELINE_ROUTING_ROUTE_LOCAL = 1 << 0, /* 0 = remote; 1 = local */
100 PIPELINE_ROUTING_ROUTE_ARP = 1 << 1, /* 0 = ARP OFF; 1 = ARP ON */
101 PIPELINE_ROUTING_ROUTE_QINQ = 1 << 2, /* 0 = QINQ OFF; 1 = QINQ ON */
102 PIPELINE_ROUTING_ROUTE_MPLS = 1 << 3, /* 0 = MPLS OFF; 1 = MPLS ON */
105 #define PIPELINE_ROUTING_MPLS_LABELS_MAX 4
107 struct pipeline_routing_route_data {
109 uint32_t port_id; /* Output port ID */
112 /* Next hop IP (valid only when ARP is enabled) */
115 /* Next hop MAC address (valid only when ARP disabled */
116 struct ether_addr macaddr;
126 uint32_t labels[PIPELINE_ROUTING_MPLS_LABELS_MAX];
135 enum pipeline_routing_arp_key_type {
136 PIPELINE_ROUTING_ARP_IPV4,
139 struct pipeline_routing_arp_key_ipv4 {
144 struct pipeline_routing_arp_key {
145 enum pipeline_routing_arp_key_type type;
147 struct pipeline_routing_arp_key_ipv4 ipv4;
154 enum pipeline_routing_msg_req_type {
155 PIPELINE_ROUTING_MSG_REQ_ROUTE_ADD,
156 PIPELINE_ROUTING_MSG_REQ_ROUTE_DEL,
157 PIPELINE_ROUTING_MSG_REQ_ROUTE_ADD_DEFAULT,
158 PIPELINE_ROUTING_MSG_REQ_ROUTE_DEL_DEFAULT,
159 PIPELINE_ROUTING_MSG_REQ_ARP_ADD,
160 PIPELINE_ROUTING_MSG_REQ_ARP_DEL,
161 PIPELINE_ROUTING_MSG_REQ_ARP_ADD_DEFAULT,
162 PIPELINE_ROUTING_MSG_REQ_ARP_DEL_DEFAULT,
163 PIPELINE_ROUTING_MSG_REQS
169 struct pipeline_routing_route_add_msg_req {
170 enum pipeline_msg_req_type type;
171 enum pipeline_routing_msg_req_type subtype;
174 struct pipeline_routing_route_key key;
177 struct pipeline_routing_route_data data;
180 struct pipeline_routing_route_add_msg_rsp {
189 struct pipeline_routing_route_delete_msg_req {
190 enum pipeline_msg_req_type type;
191 enum pipeline_routing_msg_req_type subtype;
194 struct pipeline_routing_route_key key;
197 struct pipeline_routing_route_delete_msg_rsp {
203 * MSG ROUTE ADD DEFAULT
205 struct pipeline_routing_route_add_default_msg_req {
206 enum pipeline_msg_req_type type;
207 enum pipeline_routing_msg_req_type subtype;
213 struct pipeline_routing_route_add_default_msg_rsp {
219 * MSG ROUTE DELETE DEFAULT
221 struct pipeline_routing_route_delete_default_msg_req {
222 enum pipeline_msg_req_type type;
223 enum pipeline_routing_msg_req_type subtype;
226 struct pipeline_routing_route_delete_default_msg_rsp {
233 struct pipeline_routing_arp_add_msg_req {
234 enum pipeline_msg_req_type type;
235 enum pipeline_routing_msg_req_type subtype;
238 struct pipeline_routing_arp_key key;
241 struct ether_addr macaddr;
244 struct pipeline_routing_arp_add_msg_rsp {
253 struct pipeline_routing_arp_delete_msg_req {
254 enum pipeline_msg_req_type type;
255 enum pipeline_routing_msg_req_type subtype;
258 struct pipeline_routing_arp_key key;
261 struct pipeline_routing_arp_delete_msg_rsp {
267 * MSG ARP ADD DEFAULT
269 struct pipeline_routing_arp_add_default_msg_req {
270 enum pipeline_msg_req_type type;
271 enum pipeline_routing_msg_req_type subtype;
277 struct pipeline_routing_arp_add_default_msg_rsp {
283 * MSG ARP DELETE DEFAULT
285 struct pipeline_routing_arp_delete_default_msg_req {
286 enum pipeline_msg_req_type type;
287 enum pipeline_routing_msg_req_type subtype;
290 struct pipeline_routing_arp_delete_default_msg_rsp {
294 extern struct pipeline_be_ops pipeline_routing_be_ops;