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_REQ_SET_MACADDR,
164 PIPELINE_ROUTING_MSG_REQS
170 struct pipeline_routing_route_add_msg_req {
171 enum pipeline_msg_req_type type;
172 enum pipeline_routing_msg_req_type subtype;
175 struct pipeline_routing_route_key key;
178 struct pipeline_routing_route_data data;
181 struct pipeline_routing_route_add_msg_rsp {
190 struct pipeline_routing_route_delete_msg_req {
191 enum pipeline_msg_req_type type;
192 enum pipeline_routing_msg_req_type subtype;
195 struct pipeline_routing_route_key key;
198 struct pipeline_routing_route_delete_msg_rsp {
204 * MSG ROUTE ADD DEFAULT
206 struct pipeline_routing_route_add_default_msg_req {
207 enum pipeline_msg_req_type type;
208 enum pipeline_routing_msg_req_type subtype;
214 struct pipeline_routing_route_add_default_msg_rsp {
220 * MSG ROUTE DELETE DEFAULT
222 struct pipeline_routing_route_delete_default_msg_req {
223 enum pipeline_msg_req_type type;
224 enum pipeline_routing_msg_req_type subtype;
227 struct pipeline_routing_route_delete_default_msg_rsp {
234 struct pipeline_routing_arp_add_msg_req {
235 enum pipeline_msg_req_type type;
236 enum pipeline_routing_msg_req_type subtype;
239 struct pipeline_routing_arp_key key;
242 struct ether_addr macaddr;
245 struct pipeline_routing_arp_add_msg_rsp {
254 struct pipeline_routing_arp_delete_msg_req {
255 enum pipeline_msg_req_type type;
256 enum pipeline_routing_msg_req_type subtype;
259 struct pipeline_routing_arp_key key;
262 struct pipeline_routing_arp_delete_msg_rsp {
268 * MSG ARP ADD DEFAULT
270 struct pipeline_routing_arp_add_default_msg_req {
271 enum pipeline_msg_req_type type;
272 enum pipeline_routing_msg_req_type subtype;
278 struct pipeline_routing_arp_add_default_msg_rsp {
284 * MSG ARP DELETE DEFAULT
286 struct pipeline_routing_arp_delete_default_msg_req {
287 enum pipeline_msg_req_type type;
288 enum pipeline_routing_msg_req_type subtype;
291 struct pipeline_routing_arp_delete_default_msg_rsp {
298 struct pipeline_routing_set_macaddr_msg_req {
299 enum pipeline_msg_req_type type;
300 enum pipeline_routing_msg_req_type subtype;
302 uint64_t macaddr[PIPELINE_MAX_PORT_OUT];
305 struct pipeline_routing_set_macaddr_msg_rsp {
309 extern struct pipeline_be_ops pipeline_routing_be_ops;