FD.io VPP  v21.06-3-gbb25fbf28
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 <lisp/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  */
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  */
108 lisp_gpe_sub_interface_find_ip6 (const ip6_address_t * addr, u32 vni)
109 {
111  const uword *p;
112 
113  ip_addr_v6 (&key.local_rloc).as_u64[0] = addr->as_u64[0];
114  ip_addr_v6 (&key.local_rloc).as_u64[1] = addr->as_u64[1];
115  ip_addr_version (&key.local_rloc) = AF_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  ip_addr_v4 (&key.local_rloc).as_u32 = addr->as_u32;
138  key.local_rloc.version = AF_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
lisp_gpe_sub_interface_key_t_::local_rloc
ip_address_t local_rloc
The local-RLOC.
Definition: lisp_gpe_sub_interface.h:34
ip_address
Definition: ip_types.h:79
lisp_gpe_sub_interface_t_::locks
u32 locks
A reference counting lock on the number of users of this interface.
Definition: lisp_gpe_sub_interface.h:70
lisp_gpe_sub_interface_find_or_create_and_lock
index_t lisp_gpe_sub_interface_find_or_create_and_lock(const ip_address_t *lrloc, u32 eid_table_id, u32 vni)
Definition: lisp_gpe_sub_interface.c:122
lisp_gpe_sub_interface_key_t_
A Key for lookup in the L£ sub-interface DB.
Definition: lisp_gpe_sub_interface.h:29
vni
u32 vni
Definition: flow_types.api:160
lisp_gpe_sub_interface_get
const lisp_gpe_sub_interface_t * lisp_gpe_sub_interface_get(index_t itf)
Definition: lisp_gpe_sub_interface.c:215
AF_IP4
@ AF_IP4
Definition: ip_types.h:23
lisp_gpe_sub_interface_t_::sw_if_index
u32 sw_if_index
The SW if index assigned to this sub-interface.
Definition: lisp_gpe_sub_interface.h:75
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
lisp_gpe.h
LISP-GPE definitions.
key
typedef key
Definition: ipsec_types.api:88
lisp_gpe_sub_interface_t_::main_sw_if_index
u32 main_sw_if_index
The SW IF index assigned to the main interface of which this is a sub.
Definition: lisp_gpe_sub_interface.h:80
ip_addr_version
#define ip_addr_version(_a)
Definition: ip_types.h:93
ip_addr_v6
#define ip_addr_v6(_a)
Definition: ip_types.h:92
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
uword
u64 uword
Definition: types.h:112
ip_addr_v4
#define ip_addr_v4(_a)
Definition: ip_types.h:91
lisp_gpe_sub_interface_find_ip6
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.
Definition: lisp_gpe_sub_interface.h:108
ip4_address_t
Definition: ip4_packet.h:50
lisp_gpe_sub_interface_t
struct lisp_gpe_sub_interface_t_ lisp_gpe_sub_interface_t
A LISP L3 sub-interface.
always_inline
#define always_inline
Definition: rdma_mlx5dv.h:23
hash_get_mem
#define hash_get_mem(h, key)
Definition: hash.h:269
lisp_gpe_sub_interfaces_sw_if_index
uword * lisp_gpe_sub_interfaces_sw_if_index
A DB of all L3 sub-interfaces.
Definition: lisp_gpe_sub_interface.c:39
lisp_gpe_sub_interface_find_ip4
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.
Definition: lisp_gpe_sub_interface.h:132
u32
unsigned int u32
Definition: types.h:88
lisp_gpe_sub_interface_key_t
struct lisp_gpe_sub_interface_key_t_ lisp_gpe_sub_interface_key_t
A Key for lookup in the L£ sub-interface DB.
AF_IP6
@ AF_IP6
Definition: ip_types.h:24
lisp_gpe_sub_interface_t_::key
lisp_gpe_sub_interface_key_t * key
The interface's key inthe DB; rloc & vni; The key is allocated from the heap so it can be used in the...
Definition: lisp_gpe_sub_interface.h:59
format_lisp_gpe_sub_interface
u8 * format_lisp_gpe_sub_interface(u8 *s, va_list *ap)
Definition: lisp_gpe_sub_interface.c:221
lisp_gpe_sub_interface_t_
A LISP L3 sub-interface.
Definition: lisp_gpe_sub_interface.h:52
u8
unsigned char u8
Definition: types.h:56
lisp_gpe_sub_interface_key_t_::vni
u32 vni
The VNI.
Definition: lisp_gpe_sub_interface.h:39
INDEX_INVALID
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:49
lisp_gpe_sub_interface_t_::eid_table_id
u32 eid_table_id
The Table-ID in the overlay that this interface is bound to.
Definition: lisp_gpe_sub_interface.h:64
lisp_gpe_sub_interface_unlock
void lisp_gpe_sub_interface_unlock(index_t itf)
Definition: lisp_gpe_sub_interface.c:189