FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
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  * @brief
17  * A Data-Path Object is an object that represents actions that are
18  * applied to packets are they are switched through VPP.
19  *
20  * The DPO is a base class that is specialised by other objects to provide
21  * concreate actions
22  *
23  * The VLIB graph nodes are graph of types, the DPO graph is a graph of instances.
24  */
25 
26 #include <vnet/dpo/dpo.h>
27 #include <vnet/ip/lookup.h>
28 #include <vnet/ip/format.h>
29 #include <vnet/adj/adj.h>
30 
31 #include <vnet/dpo/load_balance.h>
33 #include <vnet/dpo/lookup_dpo.h>
34 #include <vnet/dpo/drop_dpo.h>
35 #include <vnet/dpo/receive_dpo.h>
36 #include <vnet/dpo/punt_dpo.h>
37 #include <vnet/dpo/classify_dpo.h>
38 #include <vnet/dpo/ip_null_dpo.h>
39 #include <vnet/dpo/replicate_dpo.h>
43 #include <vnet/dpo/dvr_dpo.h>
44 #include <vnet/dpo/l3_proxy_dpo.h>
45 #include <vnet/dpo/ip6_ll_dpo.h>
46 
47 /**
48  * Array of char* names for the DPO types and protos
49  */
50 static const char* dpo_type_names[] = DPO_TYPES;
51 static const char* dpo_proto_names[] = DPO_PROTOS;
52 
53 /**
54  * @brief Vector of virtual function tables for the DPO types
55  *
56  * This is a vector so we can dynamically register new DPO types in plugins.
57  */
59 
60 /**
61  * @brief vector of graph node names associated with each DPO type and protocol.
62  *
63  * dpo_nodes[child_type][child_proto][node_X] = node_name;
64  * i.e.
65  * dpo_node[DPO_LOAD_BALANCE][DPO_PROTO_IP4][0] = "ip4-lookup"
66  * dpo_node[DPO_LOAD_BALANCE][DPO_PROTO_IP4][1] = "ip4-load-balance"
67  *
68  * This is a vector so we can dynamically register new DPO types in plugins.
69  */
70 static const char* const * const ** dpo_nodes;
71 
72 /**
73  * @brief Vector of edge indicies from parent DPO nodes to child
74  *
75  * dpo_edges[child_type][child_proto][parent_type][parent_proto] = edge_index
76  *
77  * This array is derived at init time from the dpo_nodes above. Note that
78  * the third dimension in dpo_nodes is lost, hence, the edge index from each
79  * node MUST be the same.
80  * Including both the child and parent protocol is required to support the
81  * case where it changes as the grapth is traversed, most notablly when an
82  * MPLS label is popped.
83  *
84  * Note that this array is child type specific, not child instance specific.
85  */
86 static u32 ****dpo_edges;
87 
88 /**
89  * @brief The DPO type value that can be assigend to the next dynamic
90  * type registration.
91  */
93 
96 {
97  switch (linkt)
98  {
99  case VNET_LINK_IP6:
100  return (DPO_PROTO_IP6);
101  case VNET_LINK_IP4:
102  return (DPO_PROTO_IP4);
103  case VNET_LINK_MPLS:
104  return (DPO_PROTO_MPLS);
105  case VNET_LINK_ETHERNET:
106  return (DPO_PROTO_ETHERNET);
107  case VNET_LINK_NSH:
108  return (DPO_PROTO_NSH);
109  case VNET_LINK_ARP:
110  break;
111  }
112  ASSERT(0);
113  return (0);
114 }
115 
118 {
119  switch (dp)
120  {
121  case DPO_PROTO_IP6:
122  return (VNET_LINK_IP6);
123  case DPO_PROTO_IP4:
124  return (VNET_LINK_IP4);
125  case DPO_PROTO_MPLS:
126  case DPO_PROTO_BIER:
127  return (VNET_LINK_MPLS);
128  case DPO_PROTO_ETHERNET:
129  return (VNET_LINK_ETHERNET);
130  case DPO_PROTO_NSH:
131  return (VNET_LINK_NSH);
132  }
133  return (~0);
134 }
135 
136 u8 *
137 format_dpo_type (u8 * s, va_list * args)
138 {
139  dpo_type_t type = va_arg (*args, int);
140 
141  s = format(s, "%s", dpo_type_names[type]);
142 
143  return (s);
144 }
145 
146 u8 *
147 format_dpo_id (u8 * s, va_list * args)
148 {
149  dpo_id_t *dpo = va_arg (*args, dpo_id_t*);
150  u32 indent = va_arg (*args, u32);
151 
152  s = format(s, "[@%d]: ", dpo->dpoi_next_node);
153 
154  if (NULL != dpo_vfts[dpo->dpoi_type].dv_format)
155  {
156  s = format(s, "%U",
157  dpo_vfts[dpo->dpoi_type].dv_format,
158  dpo->dpoi_index,
159  indent);
160  }
161  else
162  {
163  switch (dpo->dpoi_type)
164  {
165  case DPO_FIRST:
166  s = format(s, "unset");
167  break;
168  default:
169  s = format(s, "unknown");
170  break;
171  }
172  }
173  return (s);
174 }
175 
176 u8 *
177 format_dpo_proto (u8 * s, va_list * args)
178 {
179  dpo_proto_t proto = va_arg (*args, int);
180 
181  return (format(s, "%s", dpo_proto_names[proto]));
182 }
183 
184 void
186  dpo_type_t type,
187  dpo_proto_t proto,
188  index_t index)
189 {
190  dpo_id_t tmp = *dpo;
191 
192  dpo->dpoi_type = type;
193  dpo->dpoi_proto = proto,
194  dpo->dpoi_index = index;
195 
196  if (DPO_ADJACENCY == type)
197  {
198  /*
199  * set the adj subtype
200  */
201  ip_adjacency_t *adj;
202 
203  adj = adj_get(index);
204 
205  switch (adj->lookup_next_index)
206  {
207  case IP_LOOKUP_NEXT_ARP:
209  break;
212  break;
215  break;
218  break;
221  break;
222  default:
223  break;
224  }
225  }
226  dpo_lock(dpo);
227  dpo_unlock(&tmp);
228 }
229 
230 void
232 {
233  dpo_id_t tmp = DPO_INVALID;
234 
235  /*
236  * use the atomic copy operation.
237  */
238  dpo_copy(dpo, &tmp);
239 }
240 
241 /**
242  * \brief
243  * Compare two Data-path objects
244  *
245  * like memcmp, return 0 is matching, !0 otherwise.
246  */
247 int
248 dpo_cmp (const dpo_id_t *dpo1,
249  const dpo_id_t *dpo2)
250 {
251  int res;
252 
253  res = dpo1->dpoi_type - dpo2->dpoi_type;
254 
255  if (0 != res) return (res);
256 
257  return (dpo1->dpoi_index - dpo2->dpoi_index);
258 }
259 
260 void
262  const dpo_id_t *src)
263 {
264  dpo_id_t tmp = *dst;
265 
266  /*
267  * the destination is written in a single u64 write - hence atomically w.r.t
268  * any packets inflight.
269  */
270  *((u64*)dst) = *(u64*)src;
271 
272  dpo_lock(dst);
273  dpo_unlock(&tmp);
274 }
275 
276 int
277 dpo_is_adj (const dpo_id_t *dpo)
278 {
279  return ((dpo->dpoi_type == DPO_ADJACENCY) ||
281  (dpo->dpoi_type == DPO_ADJACENCY_MIDCHAIN) ||
282  (dpo->dpoi_type == DPO_ADJACENCY_GLEAN));
283 }
284 
285 static u32 *
287 {
288  u32 *node_indices = NULL;
289  const char *node_name;
290  u32 ii = 0;
291 
292  node_name = dpo_nodes[dpo->dpoi_type][dpo->dpoi_proto][ii];
293  while (NULL != node_name)
294  {
295  vlib_node_t *node;
296 
297  node = vlib_get_node_by_name(vlib_get_main(), (u8*) node_name);
298  ASSERT(NULL != node);
299  vec_add1(node_indices, node->index);
300 
301  ++ii;
302  node_name = dpo_nodes[dpo->dpoi_type][dpo->dpoi_proto][ii];
303  }
304 
305  return (node_indices);
306 }
307 
308 /**
309  * A default variant of the make interpose function that just returns
310  * the original
311  */
312 static void
314  const dpo_id_t *parent,
315  dpo_id_t *clone)
316 {
317  dpo_copy(clone, original);
318 }
319 
320 void
322  const dpo_vft_t *vft,
323  const char * const * const * nodes)
324 {
325  vec_validate(dpo_vfts, type);
326  dpo_vfts[type] = *vft;
327  if (NULL == dpo_vfts[type].dv_get_next_node)
328  {
330  }
331  if (NULL == dpo_vfts[type].dv_mk_interpose)
332  {
333  dpo_vfts[type].dv_mk_interpose = dpo_default_mk_interpose;
334  }
335 
336  vec_validate(dpo_nodes, type);
337  dpo_nodes[type] = nodes;
338 }
339 
342  const char * const * const * nodes)
343 {
344  dpo_type_t type = dpo_dynamic++;
345 
346  dpo_register(type, vft, nodes);
347 
348  return (type);
349 }
350 
351 void
352 dpo_mk_interpose (const dpo_id_t *original,
353  const dpo_id_t *parent,
354  dpo_id_t *clone)
355 {
356  if (!dpo_id_is_valid(original))
357  return;
358 
359  dpo_vfts[original->dpoi_type].dv_mk_interpose(original, parent, clone);
360 }
361 
362 void
364 {
365  if (!dpo_id_is_valid(dpo))
366  return;
367 
368  dpo_vfts[dpo->dpoi_type].dv_lock(dpo);
369 }
370 
371 void
373 {
374  if (!dpo_id_is_valid(dpo))
375  return;
376 
377  dpo_vfts[dpo->dpoi_type].dv_unlock(dpo);
378 }
379 
380 u32
382 {
383  if (dpo_id_is_valid(dpo) &&
384  (NULL != dpo_vfts[dpo->dpoi_type].dv_get_urpf))
385  {
386  return (dpo_vfts[dpo->dpoi_type].dv_get_urpf(dpo));
387  }
388 
389  return (~0);
390 }
391 
392 static u32
394  dpo_proto_t child_proto,
395  const dpo_id_t *parent_dpo)
396 {
397  dpo_proto_t parent_proto;
398  dpo_type_t parent_type;
399 
400  parent_type = parent_dpo->dpoi_type;
401  parent_proto = parent_dpo->dpoi_proto;
402 
403  vec_validate(dpo_edges, child_type);
404  vec_validate(dpo_edges[child_type], child_proto);
405  vec_validate(dpo_edges[child_type][child_proto], parent_type);
407  dpo_edges[child_type][child_proto][parent_type],
408  parent_proto, ~0);
409 
410  /*
411  * if the edge index has not yet been created for this node to node transistion
412  */
413  if (~0 == dpo_edges[child_type][child_proto][parent_type][parent_proto])
414  {
415  vlib_node_t *child_node;
416  u32 *parent_indices;
417  vlib_main_t *vm;
418  u32 edge, *pi, cc;
419 
420  vm = vlib_get_main();
421 
422  ASSERT(NULL != dpo_vfts[parent_type].dv_get_next_node);
423  ASSERT(NULL != dpo_nodes[child_type]);
424  ASSERT(NULL != dpo_nodes[child_type][child_proto]);
425 
426  cc = 0;
427  parent_indices = dpo_vfts[parent_type].dv_get_next_node(parent_dpo);
428 
430 
431  /*
432  * create a graph arc from each of the child's registered node types,
433  * to each of the parent's.
434  */
435  while (NULL != dpo_nodes[child_type][child_proto][cc])
436  {
437  child_node =
439  (u8*) dpo_nodes[child_type][child_proto][cc]);
440 
441  vec_foreach(pi, parent_indices)
442  {
443  edge = vlib_node_add_next(vm, child_node->index, *pi);
444 
445  if (~0 == dpo_edges[child_type][child_proto][parent_type][parent_proto])
446  {
447  dpo_edges[child_type][child_proto][parent_type][parent_proto] = edge;
448  }
449  else
450  {
451  ASSERT(dpo_edges[child_type][child_proto][parent_type][parent_proto] == edge);
452  }
453  }
454  cc++;
455  }
456 
458  vec_free(parent_indices);
459  }
460 
461  return (dpo_edges[child_type][child_proto][parent_type][parent_proto]);
462 }
463 
464 /**
465  * @brief return already stacked up next node index for a given
466  * child_type/child_proto and parent_type/patent_proto.
467  * The VLIB graph arc used is taken from the parent and child types
468  * passed.
469  */
470 u32
472  dpo_proto_t child_proto,
473  dpo_type_t parent_type,
474  dpo_proto_t parent_proto)
475 {
476  return (dpo_edges[child_type][child_proto][parent_type][parent_proto]);
477 }
478 
479 /**
480  * @brief Stack one DPO object on another, and thus establish a child parent
481  * relationship. The VLIB graph arc used is taken from the parent and child types
482  * passed.
483  */
484 static void
486  dpo_id_t *dpo,
487  const dpo_id_t *parent)
488 {
489  /*
490  * in order to get an atomic update of the parent we create a temporary,
491  * from a copy of the child, and add the next_node. then we copy to the parent
492  */
493  dpo_id_t tmp = DPO_INVALID;
494  dpo_copy(&tmp, parent);
495 
496  /*
497  * get the edge index for the parent to child VLIB graph transisition
498  */
499  tmp.dpoi_next_node = edge;
500 
501  /*
502  * this update is atomic.
503  */
504  dpo_copy(dpo, &tmp);
505 
506  dpo_reset(&tmp);
507 }
508 
509 /**
510  * @brief Stack one DPO object on another, and thus establish a child-parent
511  * relationship. The VLIB graph arc used is taken from the parent and child types
512  * passed.
513  */
514 void
515 dpo_stack (dpo_type_t child_type,
516  dpo_proto_t child_proto,
517  dpo_id_t *dpo,
518  const dpo_id_t *parent)
519 {
520  dpo_stack_i(dpo_get_next_node(child_type, child_proto, parent), dpo, parent);
521 }
522 
523 /**
524  * @brief Stack one DPO object on another, and thus establish a child parent
525  * relationship. A new VLIB graph arc is created from the child node passed
526  * to the nodes registered by the parent. The VLIB infra will ensure this arc
527  * is added only once.
528  */
529 void
530 dpo_stack_from_node (u32 child_node_index,
531  dpo_id_t *dpo,
532  const dpo_id_t *parent)
533 {
534  dpo_type_t parent_type;
535  u32 *parent_indices;
536  vlib_main_t *vm;
537  u32 edge, *pi;
538 
539  edge = 0;
540  parent_type = parent->dpoi_type;
541  vm = vlib_get_main();
542 
543  ASSERT(NULL != dpo_vfts[parent_type].dv_get_next_node);
544  parent_indices = dpo_vfts[parent_type].dv_get_next_node(parent);
545  ASSERT(parent_indices);
546 
547  /*
548  * This loop is purposefully written with the worker thread lock in the
549  * inner loop because;
550  * 1) the likelihood that the edge does not exist is smaller
551  * 2) the likelihood there is more than one node is even smaller
552  * so we are optimising for not need to take the lock
553  */
554  vec_foreach(pi, parent_indices)
555  {
556  edge = vlib_node_get_next(vm, child_node_index, *pi);
557 
558  if (~0 == edge)
559  {
561 
562  edge = vlib_node_add_next(vm, child_node_index, *pi);
563 
565  }
566  }
567  dpo_stack_i(edge, dpo, parent);
568 
569  /* should free this local vector to avoid memory leak */
570  vec_free(parent_indices);
571 }
572 
573 static clib_error_t *
575 {
591 
592  return (NULL);
593 }
594 
596 
597 static clib_error_t *
599  unformat_input_t * input,
600  vlib_cli_command_t * cmd)
601 {
602  dpo_vft_t *vft;
603 
604  vlib_cli_output (vm, "DPO memory");
605  vlib_cli_output (vm, "%=30s %=5s %=8s/%=9s totals",
606  "Name","Size", "in-use", "allocated");
607 
608  vec_foreach(vft, dpo_vfts)
609  {
610  if (NULL != vft->dv_mem_show)
611  vft->dv_mem_show();
612  }
613 
614  return (NULL);
615 }
616 
617 /* *INDENT-OFF* */
618 /*?
619  * The '<em>sh dpo memory </em>' command displays the memory usage for each
620  * data-plane object type.
621  *
622  * @cliexpar
623  * @cliexstart{show dpo memory}
624  * DPO memory
625  * Name Size in-use /allocated totals
626  * load-balance 64 12 / 12 768/768
627  * Adjacency 256 1 / 1 256/256
628  * Receive 24 5 / 5 120/120
629  * Lookup 12 0 / 0 0/0
630  * Classify 12 0 / 0 0/0
631  * MPLS label 24 0 / 0 0/0
632  * @cliexend
633 ?*/
634 VLIB_CLI_COMMAND (show_fib_memory, static) = {
635  .path = "show dpo memory",
636  .function = dpo_memory_show,
637  .short_help = "show dpo memory",
638 };
639 /* *INDENT-ON* */
void dpo_unlock(dpo_id_t *dpo)
Release a reference counting lock on the DPO.
Definition: dpo.c:372
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:439
void dpo_stack_from_node(u32 child_node_index, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child parent relationship.
Definition: dpo.c:530
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:404
static const char * dpo_type_names[]
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.c:50
vl_api_address_t src
Definition: vxlan_gbp.api:32
A virtual function table regisitered for a DPO type.
Definition: dpo.h:399
u8 * format_dpo_type(u8 *s, va_list *args)
format a DPO type
Definition: dpo.c:137
int dpo_is_adj(const dpo_id_t *dpo)
Return TRUE is the DPO is any type of adjacency.
Definition: dpo.c:277
static dpo_type_t dpo_dynamic
The DPO type value that can be assigend to the next dynamic type registration.
Definition: dpo.c:92
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
Definition: dpo.h:207
unsigned long u64
Definition: types.h:89
dpo_get_urpf_t dv_get_urpf
Get uRPF interface.
Definition: dpo.h:427
void l3_proxy_dpo_module_init(void)
Definition: l3_proxy_dpo.c:172
Multicast Adjacency.
Definition: adj.h:82
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
#define NULL
Definition: clib.h:58
dpo_proto_t dpoi_proto
the data-path protocol of the type.
Definition: dpo.h:176
u32 index
Definition: node.h:304
IP unicast adjacency.
Definition: adj.h:221
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:261
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
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:525
#define DPO_PROTOS
Definition: dpo.h:73
u32 dpo_get_urpf(const dpo_id_t *dpo)
Get a uRPF interface for the DPO.
Definition: dpo.c:381
static const char * dpo_proto_names[]
Definition: dpo.c:51
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
Definition: node_funcs.h:1092
unsigned char u8
Definition: types.h:56
#define vlib_worker_thread_barrier_sync(X)
Definition: threads.h:204
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Definition: adj.h:433
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:321
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:163
dpo_proto_t vnet_link_to_dpo_proto(vnet_link_t linkt)
Definition: dpo.c:95
static u32 dpo_get_next_node(dpo_type_t child_type, dpo_proto_t child_proto, const dpo_id_t *parent_dpo)
Definition: dpo.c:393
void load_balance_module_init(void)
Definition: load_balance.c:933
#define DPO_TYPES
Definition: dpo.h:132
void receive_dpo_module_init(void)
Definition: receive_dpo.c:173
void dpo_mk_interpose(const dpo_id_t *original, const dpo_id_t *parent, dpo_id_t *clone)
Make an interpose DPO from an original.
Definition: dpo.c:352
unsigned int u32
Definition: types.h:88
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
Definition: dpo.c:341
static u32 * dpo_default_get_next_node(const dpo_id_t *dpo)
Definition: dpo.c:286
static u32 **** dpo_edges
Vector of edge indicies from parent DPO nodes to child.
Definition: dpo.c:86
dpo_get_next_node_t dv_get_next_node
A function to get the next VLIB node given an instance of the DPO.
Definition: dpo.h:423
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:168
void ip_null_dpo_module_init(void)
Definition: ip_null_dpo.c:411
void interface_rx_dpo_module_init(void)
Definition: dpo.h:127
dpo_type_t dpoi_type
the type
Definition: dpo.h:172
static const char *const *const ** dpo_nodes
vector of graph node names associated with each DPO type and protocol.
Definition: dpo.c:70
struct _unformat_input_t unformat_input_t
void classify_dpo_module_init(void)
Definition: classify_dpo.c:128
static void dpo_default_mk_interpose(const dpo_id_t *original, const dpo_id_t *parent, dpo_id_t *clone)
A default variant of the make interpose function that just returns the original.
Definition: dpo.c:313
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
Definition: adj.h:68
void dvr_dpo_module_init(void)
Definition: dvr_dpo.c:221
void dpo_lock(dpo_id_t *dpo)
Take a reference counting lock on the DPO.
Definition: dpo.c:363
void lookup_dpo_module_init(void)
Definition: lookup_dpo.c:1527
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
Definition: adj.h:63
vlib_main_t * vm
Definition: buffer.c:301
vl_api_address_t dst
Definition: vxlan_gbp.api:33
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:341
Multicast Midchain Adjacency.
Definition: adj.h:89
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
Definition: node.c:45
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:185
void mpls_disp_dpo_module_init(void)
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:155
This packets follow a mid-chain adjacency.
Definition: adj.h:76
void mpls_label_dpo_module_init(void)
static clib_error_t * dpo_module_init(vlib_main_t *vm)
Definition: dpo.c:574
#define ASSERT(truth)
static dpo_vft_t * dpo_vfts
Vector of virtual function tables for the DPO types.
Definition: dpo.c:58
vnet_link_t dpo_proto_to_link(dpo_proto_t dp)
format a DPO protocol
Definition: dpo.c:117
void interface_tx_dpo_module_init(void)
void punt_dpo_module_init(void)
Definition: punt_dpo.c:97
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
A non-zero value first so we can spot unitialisation errors.
Definition: dpo.h:95
int dpo_cmp(const dpo_id_t *dpo1, const dpo_id_t *dpo2)
Compare two Data-path objects.
Definition: dpo.c:248
void ip6_ll_dpo_module_init(void)
Definition: ip6_ll_dpo.c:192
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
Definition: dpo.c:147
dpo_mem_show_t dv_mem_show
A show memory usage function.
Definition: dpo.h:416
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
uword vlib_node_get_next(vlib_main_t *vm, uword node_index, uword next_node_index)
Definition: node.c:184
static clib_error_t * dpo_memory_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: dpo.c:598
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:184
format_function_t * dv_format
A format function.
Definition: dpo.h:412
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
Definition: adj.h:236
dpo_lock_fn_t dv_unlock
A reference counting unlock function.
Definition: dpo.h:408
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:195
u8 * format_dpo_proto(u8 *s, va_list *args)
format a DPO protocol
Definition: dpo.c:177
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
Definition: threads.c:1470
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:231
#define vec_foreach(var, vec)
Vector iterator.
u16 dpoi_next_node
The next VLIB node to follow.
Definition: dpo.h:180
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
Definition: vec.h:488
void drop_dpo_module_init(void)
Definition: drop_dpo.c:115
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:762
static void dpo_stack_i(u32 edge, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child parent relationship.
Definition: dpo.c:485
void replicate_module_init(void)
u32 dpo_get_next_node_by_type_and_proto(dpo_type_t child_type, dpo_proto_t child_proto, dpo_type_t parent_type, dpo_proto_t parent_proto)
return already stacked up next node index for a given child_type/child_proto and parent_type/patent_p...
Definition: dpo.c:471
dpo_mk_interpose_t dv_mk_interpose
Signal on an interposed child that the parent has changed.
Definition: dpo.h:431
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
Definition: dpo.c:515