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
{
57 uint32_t port_local_dest
;
59 /* routing packet encapsulation */
60 enum pipeline_routing_encap encap
;
62 uint32_t mpls_color_mark
;
65 uint32_t n_arp_entries
;
67 /* packet buffer offsets */
68 uint32_t ip_hdr_offset
;
69 uint32_t arp_key_offset
;
70 uint32_t color_offset
;
73 uint32_t dbg_ah_disable
;
77 pipeline_routing_parse_args(struct pipeline_routing_params
*p
,
78 struct pipeline_params
*params
);
83 enum pipeline_routing_route_key_type
{
84 PIPELINE_ROUTING_ROUTE_IPV4
,
87 struct pipeline_routing_route_key_ipv4
{
92 struct pipeline_routing_route_key
{
93 enum pipeline_routing_route_key_type type
;
95 struct pipeline_routing_route_key_ipv4 ipv4
;
99 enum pipeline_routing_route_flags
{
100 PIPELINE_ROUTING_ROUTE_LOCAL
= 1 << 0, /* 0 = remote; 1 = local */
101 PIPELINE_ROUTING_ROUTE_ARP
= 1 << 1, /* 0 = ARP OFF; 1 = ARP ON */
102 PIPELINE_ROUTING_ROUTE_QINQ
= 1 << 2, /* 0 = QINQ OFF; 1 = QINQ ON */
103 PIPELINE_ROUTING_ROUTE_MPLS
= 1 << 3, /* 0 = MPLS OFF; 1 = MPLS ON */
106 #define PIPELINE_ROUTING_MPLS_LABELS_MAX 4
108 struct pipeline_routing_route_data
{
110 uint32_t port_id
; /* Output port ID */
113 /* Next hop IP (valid only when ARP is enabled) */
116 /* Next hop MAC address (valid only when ARP disabled */
117 struct ether_addr macaddr
;
127 uint32_t labels
[PIPELINE_ROUTING_MPLS_LABELS_MAX
];
136 enum pipeline_routing_arp_key_type
{
137 PIPELINE_ROUTING_ARP_IPV4
,
140 struct pipeline_routing_arp_key_ipv4
{
145 struct pipeline_routing_arp_key
{
146 enum pipeline_routing_arp_key_type type
;
148 struct pipeline_routing_arp_key_ipv4 ipv4
;
155 enum pipeline_routing_msg_req_type
{
156 PIPELINE_ROUTING_MSG_REQ_ROUTE_ADD
,
157 PIPELINE_ROUTING_MSG_REQ_ROUTE_DEL
,
158 PIPELINE_ROUTING_MSG_REQ_ROUTE_ADD_DEFAULT
,
159 PIPELINE_ROUTING_MSG_REQ_ROUTE_DEL_DEFAULT
,
160 PIPELINE_ROUTING_MSG_REQ_ARP_ADD
,
161 PIPELINE_ROUTING_MSG_REQ_ARP_DEL
,
162 PIPELINE_ROUTING_MSG_REQ_ARP_ADD_DEFAULT
,
163 PIPELINE_ROUTING_MSG_REQ_ARP_DEL_DEFAULT
,
164 PIPELINE_ROUTING_MSG_REQ_SET_MACADDR
,
165 PIPELINE_ROUTING_MSG_REQS
171 struct pipeline_routing_route_add_msg_req
{
172 enum pipeline_msg_req_type type
;
173 enum pipeline_routing_msg_req_type subtype
;
176 struct pipeline_routing_route_key key
;
179 struct pipeline_routing_route_data data
;
182 struct pipeline_routing_route_add_msg_rsp
{
191 struct pipeline_routing_route_delete_msg_req
{
192 enum pipeline_msg_req_type type
;
193 enum pipeline_routing_msg_req_type subtype
;
196 struct pipeline_routing_route_key key
;
199 struct pipeline_routing_route_delete_msg_rsp
{
205 * MSG ROUTE ADD DEFAULT
207 struct pipeline_routing_route_add_default_msg_req
{
208 enum pipeline_msg_req_type type
;
209 enum pipeline_routing_msg_req_type subtype
;
215 struct pipeline_routing_route_add_default_msg_rsp
{
221 * MSG ROUTE DELETE DEFAULT
223 struct pipeline_routing_route_delete_default_msg_req
{
224 enum pipeline_msg_req_type type
;
225 enum pipeline_routing_msg_req_type subtype
;
228 struct pipeline_routing_route_delete_default_msg_rsp
{
235 struct pipeline_routing_arp_add_msg_req
{
236 enum pipeline_msg_req_type type
;
237 enum pipeline_routing_msg_req_type subtype
;
240 struct pipeline_routing_arp_key key
;
243 struct ether_addr macaddr
;
246 struct pipeline_routing_arp_add_msg_rsp
{
255 struct pipeline_routing_arp_delete_msg_req
{
256 enum pipeline_msg_req_type type
;
257 enum pipeline_routing_msg_req_type subtype
;
260 struct pipeline_routing_arp_key key
;
263 struct pipeline_routing_arp_delete_msg_rsp
{
269 * MSG ARP ADD DEFAULT
271 struct pipeline_routing_arp_add_default_msg_req
{
272 enum pipeline_msg_req_type type
;
273 enum pipeline_routing_msg_req_type subtype
;
279 struct pipeline_routing_arp_add_default_msg_rsp
{
285 * MSG ARP DELETE DEFAULT
287 struct pipeline_routing_arp_delete_default_msg_req
{
288 enum pipeline_msg_req_type type
;
289 enum pipeline_routing_msg_req_type subtype
;
292 struct pipeline_routing_arp_delete_default_msg_rsp
{
299 struct pipeline_routing_set_macaddr_msg_req
{
300 enum pipeline_msg_req_type type
;
301 enum pipeline_routing_msg_req_type subtype
;
303 uint64_t macaddr
[PIPELINE_MAX_PORT_OUT
];
306 struct pipeline_routing_set_macaddr_msg_rsp
{
310 extern struct pipeline_be_ops pipeline_routing_be_ops
;