FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
lisp_cp_dpo.c
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 #include <vnet/dpo/dpo.h>
17 #include <lisp/lisp-gpe/lisp_gpe.h>
18 #include <lisp/lisp-cp/control.h>
19 
20 /**
21  * The static array of LISP punt DPOs
22  */
24 
25 const dpo_id_t *
27 {
28  /*
29  * there are only two instances of this DPO type.
30  * we can use the protocol as the index
31  */
32  return (&lisp_cp_dpos[proto]);
33 }
34 
35 static u8 *
36 format_lisp_cp_dpo (u8 * s, va_list * args)
37 {
38  index_t index = va_arg (*args, index_t);
39  CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
40 
41  return (format (s, "lisp-cp-punt-%U", format_dpo_proto, index));
42 }
43 
44 static void
46 {
47 }
48 
49 static void
51 {
52 }
53 
54 const static dpo_vft_t lisp_cp_vft = {
56  .dv_unlock = lisp_cp_dpo_unlock,
57  .dv_format = format_lisp_cp_dpo,
58 };
59 
60 /**
61  * @brief The per-protocol VLIB graph nodes that are assigned to a LISP-CP
62  * object.
63  *
64  * this means that these graph nodes are ones from which a LISP-CP is the
65  * parent object in the DPO-graph.
66  */
67 const static char *const lisp_cp_ip4_nodes[] = {
68  "lisp-cp-lookup-ip4",
69  NULL,
70 };
71 
72 const static char *const lisp_cp_ip6_nodes[] = {
73  "lisp-cp-lookup-ip6",
74  NULL,
75 };
76 
77 const static char *const lisp_cp_ethernet_nodes[] = {
78  "lisp-cp-lookup-l2",
79  NULL,
80 };
81 
82 const static char *const lisp_cp_nsh_nodes[] = {
83  "lisp-cp-lookup-nsh",
84  NULL,
85 };
86 
87 const static char *const *const lisp_cp_nodes[DPO_PROTO_NUM] = {
91  [DPO_PROTO_MPLS] = NULL,
93 };
94 
97 {
98  dpo_proto_t dproto;
99 
100  /*
101  * there are no exit arcs from the LIS-CP VLIB node, so we
102  * pass NULL as said node array.
103  */
105 
106  FOR_EACH_DPO_PROTO (dproto)
107  {
108  dpo_set (&lisp_cp_dpos[dproto], DPO_LISP_CP, dproto, dproto);
109  }
110 
111  return (NULL);
112 }
113 
115 
116 /*
117  * fd.io coding-style-patch-verification: ON
118  *
119  * Local Variables:
120  * eval: (c-set-style "gnu")
121  * End:
122  */
FOR_EACH_DPO_PROTO
#define FOR_EACH_DPO_PROTO(_proto)
Definition: dpo.h:84
format_lisp_cp_dpo
static u8 * format_lisp_cp_dpo(u8 *s, va_list *args)
Definition: lisp_cp_dpo.c:36
lisp_cp_dpo_lock
static void lisp_cp_dpo_lock(dpo_id_t *dpo)
Definition: lisp_cp_dpo.c:45
lisp_cp_ip4_nodes
const static char *const lisp_cp_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to a LISP-CP object.
Definition: lisp_cp_dpo.c:67
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
control.h
lisp_cp_dpos
static dpo_id_t lisp_cp_dpos[DPO_PROTO_NUM]
The static array of LISP punt DPOs.
Definition: lisp_cp_dpo.c:23
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
lisp_cp_vft
const static dpo_vft_t lisp_cp_vft
Definition: lisp_cp_dpo.c:54
lisp_cp_dpo_get
const dpo_id_t * lisp_cp_dpo_get(dpo_proto_t proto)
Definition: lisp_cp_dpo.c:26
lisp_cp_nsh_nodes
const static char *const lisp_cp_nsh_nodes[]
Definition: lisp_cp_dpo.c:82
lisp_gpe.h
LISP-GPE definitions.
dpo.h
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
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
lisp_cp_ip6_nodes
const static char *const lisp_cp_ip6_nodes[]
Definition: lisp_cp_dpo.c:72
dpo_vft_t_::dv_lock
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:428
index
u32 index
Definition: flow_types.api:221
format
description fragment has unexpected format
Definition: map.api:433
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
DPO_PROTO_MPLS
@ DPO_PROTO_MPLS
Definition: dpo.h:66
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
lisp_cp_ethernet_nodes
const static char *const lisp_cp_ethernet_nodes[]
Definition: lisp_cp_dpo.c:77
vlib_main_t
Definition: main.h:102
dpo_vft_t_
A virtual function table regisitered for a DPO type.
Definition: dpo.h:423
lisp_cp_nodes
const static char *const *const lisp_cp_nodes[DPO_PROTO_NUM]
Definition: lisp_cp_dpo.c:87
format_dpo_proto
u8 * format_dpo_proto(u8 *s, va_list *args)
format a DPO protocol
Definition: dpo.c:180
lisp_cp_dpo_module_init
clib_error_t * lisp_cp_dpo_module_init(vlib_main_t *vm)
Definition: lisp_cp_dpo.c:96
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
DPO_LISP_CP
@ DPO_LISP_CP
Definition: dpo.h:114
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
lisp_cp_dpo_unlock
static void lisp_cp_dpo_unlock(dpo_id_t *dpo)
Definition: lisp_cp_dpo.c:50
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
DPO_PROTO_NSH
@ DPO_PROTO_NSH
Definition: dpo.h:69
DPO_PROTO_ETHERNET
@ DPO_PROTO_ETHERNET
Definition: dpo.h:67
dpo_set
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:188
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
DPO_PROTO_NUM
#define DPO_PROTO_NUM
Definition: dpo.h:72
dpo_register
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
Definition: dpo.c:329