FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
lookup_dpo.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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 #ifndef __LOOKUP_DPO_H__
17 #define __LOOKUP_DPO_H__
18 
19 #include <vnet/vnet.h>
20 #include <vnet/fib/fib_types.h>
21 #include <vnet/dpo/dpo.h>
22 
23 /**
24  * Switch to use the packet's source or destination address for lookup
25  */
26 typedef enum lookup_input_t_ {
29 } __attribute__ ((packed)) lookup_input_t;
30 
31 #define LOOKUP_INPUTS { \
32  [LOOKUP_INPUT_SRC_ADDR] = "src-address", \
33  [LOOKUP_INPUT_DST_ADDR] = "dst-address", \
34 }
35 
36 /**
37  * Switch to use the packet's source or destination address for lookup
38  */
39 typedef enum lookup_table_t_ {
42 } __attribute__ ((packed)) lookup_table_t;
43 
44 #define LOOKUP_TABLES { \
45  [LOOKUP_TABLE_FROM_INPUT_INTERFACE] = "table-input-interface", \
46  [LOOKUP_TABLE_FROM_CONFIG] = "table-configured", \
47 }
48 
49 /**
50  * Switch to use the packet's source or destination address for lookup
51  */
52 typedef enum lookup_cast_t_ {
55 } __attribute__ ((packed)) lookup_cast_t;
56 
57 #define LOOKUP_CASTS { \
58  [LOOKUP_UNICAST] = "unicast", \
59  [LOOKUP_MULTICAST] = "multicast", \
60 }
61 
62 /**
63  * A representation of an MPLS label for imposition in the data-path
64  */
65 typedef struct lookup_dpo_t
66 {
67  /**
68  * required for pool_get_aligned.
69  * memebers used in the switch path come first!
70  */
71  CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
72 
73  /**
74  * The FIB, or interface from which to get a FIB, in which to perform
75  * the next lookup;
76  */
78 
79  /**
80  * The protocol of the FIB for the lookup, and hence
81  * the protocol of the packet
82  */
84 
85  /**
86  * Switch to use src or dst address
87  */
89 
90  /**
91  * Switch to use the table index passed, or the table of the input interface
92  */
94 
95  /**
96  * Unicast of rmulticast FIB lookup
97  */
99 
100  /**
101  * Number of locks
102  */
104 } lookup_dpo_t;
105 
108  lookup_cast_t cast,
109  lookup_input_t input,
110  lookup_table_t table,
111  dpo_id_t *dpo);
114  lookup_cast_t cast,
115  lookup_input_t input,
116  lookup_table_t table,
117  dpo_id_t *dpo);
118 
119 extern u8* format_lookup_dpo(u8 *s, va_list *args);
120 
121 /*
122  * Encapsulation violation for fast data-path access
123  */
125 
126 static inline lookup_dpo_t *
128 {
130 }
131 
132 extern void lookup_dpo_module_init(void);
133 
134 #endif
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
lookup_dpo_get
static lookup_dpo_t * lookup_dpo_get(index_t index)
Definition: lookup_dpo.h:127
lookup_dpo_t
A representation of an MPLS label for imposition in the data-path.
Definition: lookup_dpo.h:65
lookup_table_t
enum lookup_table_t_ lookup_table_t
Switch to use the packet's source or destination address for lookup.
u16
unsigned short u16
Definition: types.h:57
lookup_dpo_t::CLIB_CACHE_LINE_ALIGN_MARK
CLIB_CACHE_LINE_ALIGN_MARK(cacheline0)
required for pool_get_aligned.
LOOKUP_MULTICAST
@ LOOKUP_MULTICAST
Definition: lookup_dpo.h:54
LOOKUP_INPUT_SRC_ADDR
@ LOOKUP_INPUT_SRC_ADDR
Definition: lookup_dpo.h:27
lookup_dpo_t::lkd_locks
u16 lkd_locks
Number of locks.
Definition: lookup_dpo.h:103
lookup_dpo_t
struct lookup_dpo_t lookup_dpo_t
A representation of an MPLS label for imposition in the data-path.
lookup_input_t_
lookup_input_t_
Switch to use the packet's source or destination address for lookup.
Definition: lookup_dpo.h:26
lookup_cast_t_
lookup_cast_t_
Switch to use the packet's source or destination address for lookup.
Definition: lookup_dpo.h:52
dpo.h
lookup_dpo_pool
lookup_dpo_t * lookup_dpo_pool
pool of all MPLS Label DPOs
Definition: lookup_dpo.c:55
fib_types.h
index_t
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:43
LOOKUP_UNICAST
@ LOOKUP_UNICAST
Definition: lookup_dpo.h:53
lookup_dpo_add_or_lock_w_fib_index
void lookup_dpo_add_or_lock_w_fib_index(fib_node_index_t fib_index, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table, dpo_id_t *dpo)
Definition: lookup_dpo.c:137
LOOKUP_INPUT_DST_ADDR
@ LOOKUP_INPUT_DST_ADDR
Definition: lookup_dpo.h:28
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
LOOKUP_TABLE_FROM_CONFIG
@ LOOKUP_TABLE_FROM_CONFIG
Definition: lookup_dpo.h:41
lookup_dpo_add_or_lock_w_table_id
void lookup_dpo_add_or_lock_w_table_id(u32 table_id, dpo_proto_t proto, lookup_cast_t cast, lookup_input_t input, lookup_table_t table, dpo_id_t *dpo)
Definition: lookup_dpo.c:163
format_lookup_dpo
u8 * format_lookup_dpo(u8 *s, va_list *args)
Definition: lookup_dpo.c:195
lookup_dpo_t::lkd_table
lookup_table_t lkd_table
Switch to use the table index passed, or the table of the input interface.
Definition: lookup_dpo.h:93
lookup_dpo_t::lkd_cast
lookup_cast_t lkd_cast
Unicast of rmulticast FIB lookup.
Definition: lookup_dpo.h:98
index
u32 index
Definition: flow_types.api:221
LOOKUP_TABLE_FROM_INPUT_INTERFACE
@ LOOKUP_TABLE_FROM_INPUT_INTERFACE
Definition: lookup_dpo.h:40
u32
unsigned int u32
Definition: types.h:88
table_id
u32 table_id
Definition: wireguard.api:102
lookup_dpo_module_init
void lookup_dpo_module_init(void)
Definition: lookup_dpo.c:1502
lookup_input_t
enum lookup_input_t_ lookup_input_t
Switch to use the packet's source or destination address for lookup.
lookup_cast_t
enum lookup_cast_t_ lookup_cast_t
Switch to use the packet's source or destination address for lookup.
u8
unsigned char u8
Definition: types.h:56
lookup_table_t_
lookup_table_t_
Switch to use the packet's source or destination address for lookup.
Definition: lookup_dpo.h:39
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
lookup_dpo_t::lkd_proto
dpo_proto_t lkd_proto
The protocol of the FIB for the lookup, and hence the protocol of the packet.
Definition: lookup_dpo.h:83
lookup_dpo_t::lkd_fib_index
fib_node_index_t lkd_fib_index
The FIB, or interface from which to get a FIB, in which to perform the next lookup;.
Definition: lookup_dpo.h:77
vnet.h
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
lookup_dpo_t::lkd_input
lookup_input_t lkd_input
Switch to use src or dst address.
Definition: lookup_dpo.h:88