FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
l3xc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * A L3 cross connect will send all traffic that is received on the input
18  * interface to the [set of] paths requested.
19  * It is a much more memory efficient solution than using a separate IP table
20  * for each input interface and much faster than an ABF match all rule.
21  */
22 
23 #ifndef __L3XC_H__
24 #define __L3XC_H__
25 
26 #include <vnet/fib/fib_node.h>
27 
28 #define L3XC_PLUGIN_VERSION_MAJOR 1
29 #define L3XC_PLUGIN_VERSION_MINOR 0
30 
31 /**
32  */
33 typedef struct l3xc_t_
34 {
35  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
36  /**
37  * Linkage into the FIB graph
38  */
40 
41  /**
42  * The path-list describing how to forward in case of a match
43  */
45 
47 
48  /**
49  * Sibling index on the path-list
50  */
52 
53  /**
54  * The input interface
55  */
57 
58  /**
59  * DPO for forwarding
60  */
62 } l3xc_t;
63 
64 /**
65  * Create or update an L3XC Policy
66  *
67  * @param sw_if_index_index the input interface
68  * @param rpaths The set of paths to add to the forwarding set
69  * @return error code
70  */
71 extern int l3xc_update (u32 sw_if_index,
72  u8 is_ip6, const fib_route_path_t * rpaths);
73 
74 /**
75  * Delete an L3XC.
76  *
77  * @param sw_if_index_index the input interface
78  */
79 extern int l3xc_delete (u32 sw_if_index, u8 is_ip6);
80 
81 /**
82  * Callback function invoked during a walk of all policies
83  */
84 typedef int (*l3xc_walk_cb_t) (index_t l3xci, void *ctx);
85 
86 /**
87  * Walk/visit each of the L3XC policies
88  */
89 extern void l3xc_walk (l3xc_walk_cb_t cb, void *ctx);
90 
91 /**
92  * Find a L3 XC object from an interfce and FIB protocol
93  */
95 
96 /**
97  * Data-plane functions
98  */
99 extern l3xc_t *l3xc_pool;
100 
102 l3xc_get (u32 index)
103 {
104  return (pool_elt_at_index (l3xc_pool, index));
105 }
106 
109 
110 /*
111  * fd.io coding-style-patch-verification: ON
112  *
113  * Local Variables:
114  * eval: (c-set-style "gnu")
115  * End:
116  */
117 
118 #endif
Definition: l3xc.h:33
A representation of a path as described by a route producer.
Definition: fib_types.h:485
int(* l3xc_walk_cb_t)(index_t l3xci, void *ctx)
Callback function invoked during a walk of all policies.
Definition: l3xc.h:84
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
index_t l3xc_find(u32 sw_if_index, fib_protocol_t fproto)
Find a L3 XC object from an interfce and FIB protocol.
Definition: l3xc.c:38
l3xc_t * l3xc_pool
Data-plane functions.
Definition: l3xc.c:30
dpo_id_t l3xc_dpo
DPO for forwarding.
Definition: l3xc.h:61
struct l3xc_t_ l3xc_t
unsigned char u8
Definition: types.h:56
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
vlib_node_registration_t l3xc_ip4_node
(constructor) VLIB_REGISTER_NODE (l3xc_ip4_node)
Definition: l3xc_node.c:203
#define static_always_inline
Definition: clib.h:100
vl_api_interface_index_t sw_if_index
Definition: gre.api:50
int l3xc_update(u32 sw_if_index, u8 is_ip6, const fib_route_path_t *rpaths)
Create or update an L3XC Policy.
Definition: l3xc.c:83
void l3xc_walk(l3xc_walk_cb_t cb, void *ctx)
Walk/visit each of the L3XC policies.
Definition: l3xc.c:303
unsigned int u32
Definition: types.h:88
static_always_inline l3xc_t * l3xc_get(u32 index)
Definition: l3xc.h:102
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:170
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:514
u32 l3xc_sw_if_index
The input interface.
Definition: l3xc.h:56
long ctx[MAX_CONNS]
Definition: main.c:144
An node in the FIB graph.
Definition: fib_node.h:295
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
vlib_node_registration_t l3xc_ip6_node
(constructor) VLIB_REGISTER_NODE (l3xc_ip6_node)
Definition: l3xc_node.c:219
u32 l3xc_sibling
Sibling index on the path-list.
Definition: l3xc.h:51
struct _vlib_node_registration vlib_node_registration_t
CLIB_CACHE_LINE_ALIGN_MARK(cacheline0)
int l3xc_delete(u32 sw_if_index, u8 is_ip6)
Delete an L3XC.
Definition: l3xc.c:156
fib_node_index_t l3xc_pl
The path-list describing how to forward in case of a match.
Definition: l3xc.h:44
fib_node_t l3xc_node
Linkage into the FIB graph.
Definition: l3xc.h:39
fib_protocol_t l3xc_proto
Definition: l3xc.h:46