FD.io VPP  v20.09-64-g4f7b92f0a
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 the input interface
68  * @param is_ipv6 - 0 if ip4, 1 if ip6
69  * @param rpaths The set of paths to add to the forwarding set
70  * @return error code
71  */
72 extern int l3xc_update (u32 sw_if_index,
73  u8 is_ip6, const fib_route_path_t * rpaths);
74 
75 /**
76  * Delete an L3XC.
77  *
78  * @param sw_if_index the input interface
79  * @param is_ipv6 - 0 if ip4, 1 if ip6
80  */
81 extern int l3xc_delete (u32 sw_if_index, u8 is_ip6);
82 
83 /**
84  * Callback function invoked during a walk of all policies
85  */
86 typedef int (*l3xc_walk_cb_t) (index_t l3xci, void *ctx);
87 
88 /**
89  * Walk/visit each of the L3XC policies
90  */
91 extern void l3xc_walk (l3xc_walk_cb_t cb, void *ctx);
92 
93 /**
94  * Find a L3 XC object from an interface and FIB protocol
95  */
97 
98 /**
99  * Data-plane functions
100  */
101 extern l3xc_t *l3xc_pool;
102 
105 {
106  return (pool_elt_at_index (l3xc_pool, index));
107 }
108 
111 
112 /*
113  * fd.io coding-style-patch-verification: ON
114  *
115  * Local Variables:
116  * eval: (c-set-style "gnu")
117  * End:
118  */
119 
120 #endif
Definition: l3xc.h:33
A representation of a path as described by a route producer.
Definition: fib_types.h:490
int(* l3xc_walk_cb_t)(index_t l3xci, void *ctx)
Callback function invoked during a walk of all policies.
Definition: l3xc.h:86
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 interface 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:108
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:104
bool is_ip6
Definition: ip.api:43
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:534
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)
u32 index
Definition: flow_types.api:221
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
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:33
fib_protocol_t l3xc_proto
Definition: l3xc.h:46