FD.io VPP  v17.01.1-3-gc6833f8
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_INPUT_SRC_ADDR] = "table-input-interface", \
46  [LOOKUP_INPUT_DST_ADDR] = "table-configured", \
47 }
48 
49 /**
50  * A representation of an MPLS label for imposition in the data-path
51  */
52 typedef struct lookup_dpo_t
53 {
54  /**
55  * The FIB, or interface from which to get a FIB, in which to perform
56  * the next lookup;
57  */
59 
60  /**
61  * The protocol of the FIB for the lookup, and hence
62  * the protocol of the packet
63  */
65 
66  /**
67  * Switch to use src or dst address
68  */
69  lookup_input_t lkd_input;
70 
71  /**
72  * Switch to use the table index passed, or the table of the input interface
73  */
74  lookup_table_t lkd_table;
75 
76  /**
77  * Number of locks
78  */
80 } lookup_dpo_t;
81 
83  dpo_proto_t proto,
84  lookup_input_t input,
85  lookup_table_t table,
86  dpo_id_t *dpo);
87 extern void lookup_dpo_add_or_lock_w_table_id(u32 table_id,
88  dpo_proto_t proto,
89  lookup_input_t input,
90  lookup_table_t table,
91  dpo_id_t *dpo);
92 
93 extern u8* format_lookup_dpo(u8 *s, va_list *args);
94 
95 /*
96  * Encapsulation violation for fast data-path access
97  */
99 
100 static inline lookup_dpo_t *
102 {
103  return (pool_elt_at_index(lookup_dpo_pool, index));
104 }
105 
106 extern void lookup_dpo_module_init(void);
107 
108 #endif
lookup_input_t lkd_input
Switch to use src or dst address.
Definition: lookup_dpo.h:69
A representation of an MPLS label for imposition in the data-path.
Definition: lookup_dpo.h:52
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
u16 lkd_locks
Number of locks.
Definition: lookup_dpo.h:79
lookup_dpo_t * lookup_dpo_pool
pool of all MPLS Label DPOs
Definition: lookup_dpo.c:44
dpo_proto_t lkd_proto
The protocol of the FIB for the lookup, and hence the protocol of the packet.
Definition: lookup_dpo.h:64
lookup_input_t_
Switch to use the packet&#39;s source or destination address for lookup.
Definition: lookup_dpo.h:26
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:138
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:369
static lookup_dpo_t * lookup_dpo_get(index_t index)
Definition: lookup_dpo.h:101
u8 * format_lookup_dpo(u8 *s, va_list *args)
Definition: lookup_dpo.c:150
struct lookup_dpo_t lookup_dpo_t
A representation of an MPLS label for imposition in the data-path.
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:28
lookup_table_t_
Switch to use the packet&#39;s source or destination address for lookup.
Definition: lookup_dpo.h:39
unsigned int u32
Definition: types.h:88
void lookup_dpo_add_or_lock_w_table_id(u32 table_id, dpo_proto_t proto, lookup_input_t input, lookup_table_t table, dpo_id_t *dpo)
Definition: lookup_dpo.c:130
void lookup_dpo_module_init(void)
Definition: lookup_dpo.c:1168
lookup_table_t lkd_table
Switch to use the table index passed, or the table of the input interface.
Definition: lookup_dpo.h:74
unsigned short u16
Definition: types.h:57
unsigned char u8
Definition: types.h:56
void lookup_dpo_add_or_lock_w_fib_index(fib_node_index_t fib_index, dpo_proto_t proto, lookup_input_t input, lookup_table_t table, dpo_id_t *dpo)
Definition: lookup_dpo.c:116
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:58