FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
lisp_gpe_sub_interface.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  * @file
17  * @brief LISP sub-interfaces.
18  *
19  */
20 
21 #ifndef __LISP_GPE_SUB_INTERFACE_H__
22 #define __LISP_GPE_SUB_INTERFACE_H__
23 
24 #include <vnet/lisp-gpe/lisp_gpe.h>
25 
26 /**
27  * A Key for lookup in the L£ sub-interface DB
28  */
30 {
31  /**
32  * The local-RLOC. This is the interface's 'source' address.
33  */
34  ip_address_t local_rloc;
35 
36  /**
37  * The VNI. In network byte order!
38  */
41 
42 /**
43  * @brief A LISP L3 sub-interface
44  *
45  * A LISP sub-interface is a multi-access interface, whose local address is a
46  * single local-RLOC. Adjacencies that form on this sub-interface, represent
47  * remote RLOCs.
48  * This is analogous to an ethernet interface.
49  * As with all interface types it can only be present in one VRF, hence a
50  * LISP sub-interface is per-local-rloc and per-VNI.
51  */
53 {
54  /**
55  * The interface's key inthe DB; rloc & vni;
56  * The key is allocated from the heap so it can be used in the hash-table.
57  * if it's part of the object, then it is subjet to realloc, which no-worky.
58  */
60 
61  /**
62  * The Table-ID in the overlay that this interface is bound to.
63  */
65 
66  /**
67  * A reference counting lock on the number of users of this interface.
68  * When this count drops to 0 the interface is deleted.
69  */
71 
72  /**
73  * The SW if index assigned to this sub-interface
74  */
76 
77  /**
78  * The SW IF index assigned to the main interface of which this is a sub.
79  */
82 
84  ip_address_t *
85  lrloc,
86  u32
87  eid_table_id,
88  u32 vni);
89 
90 extern u8 *format_lisp_gpe_sub_interface (u8 * s, va_list * ap);
91 
92 extern void lisp_gpe_sub_interface_unlock (index_t itf);
93 
95  itf);
96 
97 /**
98  * A DB of all L3 sub-interfaces. The key is:{VNI,l-RLOC}
99  */
101 
102 /**
103  * @brief
104  * Get a VNET L3 interface matching the local-RLOC and VNI
105  * Called from the data-plane
106  */
109 {
111  const uword *p;
112 
113  key.local_rloc.ip.v6.as_u64[0] = addr->as_u64[0];
114  key.local_rloc.ip.v6.as_u64[1] = addr->as_u64[1];
115  key.local_rloc.version = IP6;
116  key.vni = vni;
117 
119 
120  if (NULL != p)
121  return p[0];
122 
123  return (INDEX_INVALID);
124 }
125 
126 /**
127  * @brief
128  * Get a VNET L3 interface matching the local-RLOC and VNI
129  * Called from the data-plane
130  */
133 {
135  const uword *p;
136 
137  key.local_rloc.ip.v4.as_u32 = addr->as_u32;
138  key.local_rloc.version = IP4;
139  key.vni = vni;
140 
142 
143  if (NULL != p)
144  return p[0];
145 
146  return (INDEX_INVALID);
147 }
148 
149 /*
150  * fd.io coding-style-patch-verification: ON
151  *
152  * Local Variables:
153  * eval: (c-set-style "gnu")
154  * End:
155  */
156 
157 #endif
u64 as_u64[2]
Definition: ip6_packet.h:51
#define NULL
Definition: clib.h:55
void lisp_gpe_sub_interface_unlock(index_t itf)
u32 locks
A reference counting lock on the number of users of this interface.
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
struct lisp_gpe_sub_interface_key_t_ lisp_gpe_sub_interface_key_t
A Key for lookup in the L£ sub-interface DB.
ip_address_t local_rloc
The local-RLOC.
u32 main_sw_if_index
The SW IF index assigned to the main interface of which this is a sub.
const lisp_gpe_sub_interface_t * lisp_gpe_sub_interface_get(index_t itf)
#define always_inline
Definition: clib.h:92
u32 sw_if_index
The SW if index assigned to this sub-interface.
A Key for lookup in the L£ sub-interface DB.
lisp_gpe_sub_interface_key_t * key
The interface&#39;s key inthe DB; rloc & vni; The key is allocated from the heap so it can be used in the...
u32 eid_table_id
The Table-ID in the overlay that this interface is bound to.
uword * lisp_gpe_sub_interfaces_sw_if_index
A DB of all L3 sub-interfaces.
static u32 lisp_gpe_sub_interface_find_ip6(const ip6_address_t *addr, u32 vni)
Get a VNET L3 interface matching the local-RLOC and VNI Called from the data-plane.
static index_t lisp_gpe_sub_interface_find_ip4(const ip4_address_t *addr, u32 vni)
Get a VNET L3 interface matching the local-RLOC and VNI Called from the data-plane.
unsigned int u32
Definition: types.h:88
u8 * format_lisp_gpe_sub_interface(u8 *s, va_list *ap)
u64 uword
Definition: types.h:112
struct lisp_gpe_sub_interface_t_ lisp_gpe_sub_interface_t
A LISP L3 sub-interface.
unsigned char u8
Definition: types.h:56
A LISP L3 sub-interface.
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:47
Definition: lisp_types.h:37
#define hash_get_mem(h, key)
Definition: hash.h:268
index_t lisp_gpe_sub_interface_find_or_create_and_lock(const ip_address_t *lrloc, u32 eid_table_id, u32 vni)
vhost_vring_addr_t addr
Definition: vhost-user.h:83
Definition: lisp_types.h:38
LISP-GPE definitions.