blob: 51adbc3d55a0fc6a2a886172aa555fd30dc7d8ce [file] [log] [blame]
Neale Ranns0bfe5d82016-08-25 15:29:12 +01001/*
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>
32#include <vnet/dpo/mpls_label_dpo.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>
Neale Ranns948e00f2016-10-20 13:39:34 +010038#include <vnet/dpo/ip_null_dpo.h>
Neale Ranns32e1c012016-11-22 17:07:28 +000039#include <vnet/dpo/replicate_dpo.h>
Neale Ranns43161a82017-08-12 02:12:00 -070040#include <vnet/dpo/interface_rx_dpo.h>
41#include <vnet/dpo/interface_tx_dpo.h>
Neale Ranns0f26c5a2017-03-01 15:12:11 -080042#include <vnet/dpo/mpls_disposition.h>
Neale Rannsf068c3e2018-01-03 04:18:48 -080043#include <vnet/dpo/dvr_dpo.h>
Andrew Yourtchenko5f3fcb92017-10-25 05:50:37 -070044#include <vnet/dpo/l3_proxy_dpo.h>
Neale Ranns0bfe5d82016-08-25 15:29:12 +010045
46/**
47 * Array of char* names for the DPO types and protos
48 */
49static const char* dpo_type_names[] = DPO_TYPES;
50static const char* dpo_proto_names[] = DPO_PROTOS;
51
52/**
53 * @brief Vector of virtual function tables for the DPO types
54 *
55 * This is a vector so we can dynamically register new DPO types in plugins.
56 */
57static dpo_vft_t *dpo_vfts;
58
59/**
60 * @brief vector of graph node names associated with each DPO type and protocol.
61 *
62 * dpo_nodes[child_type][child_proto][node_X] = node_name;
63 * i.e.
64 * dpo_node[DPO_LOAD_BALANCE][DPO_PROTO_IP4][0] = "ip4-lookup"
65 * dpo_node[DPO_LOAD_BALANCE][DPO_PROTO_IP4][1] = "ip4-load-balance"
66 *
67 * This is a vector so we can dynamically register new DPO types in plugins.
68 */
69static const char* const * const ** dpo_nodes;
70
71/**
72 * @brief Vector of edge indicies from parent DPO nodes to child
73 *
Neale Ranns8fe8cc22016-11-01 10:05:08 +000074 * dpo_edges[child_type][child_proto][parent_type][parent_proto] = edge_index
Neale Ranns0bfe5d82016-08-25 15:29:12 +010075 *
76 * This array is derived at init time from the dpo_nodes above. Note that
77 * the third dimension in dpo_nodes is lost, hence, the edge index from each
78 * node MUST be the same.
Neale Ranns8fe8cc22016-11-01 10:05:08 +000079 * Including both the child and parent protocol is required to support the
80 * case where it changes as the grapth is traversed, most notablly when an
81 * MPLS label is popped.
Neale Ranns0bfe5d82016-08-25 15:29:12 +010082 *
83 * Note that this array is child type specific, not child instance specific.
84 */
Neale Ranns8fe8cc22016-11-01 10:05:08 +000085static u32 ****dpo_edges;
Neale Ranns0bfe5d82016-08-25 15:29:12 +010086
87/**
88 * @brief The DPO type value that can be assigend to the next dynamic
89 * type registration.
90 */
91static dpo_type_t dpo_dynamic = DPO_LAST;
92
Neale Rannsad95b5d2016-11-10 20:35:14 +000093dpo_proto_t
94vnet_link_to_dpo_proto (vnet_link_t linkt)
95{
96 switch (linkt)
97 {
98 case VNET_LINK_IP6:
99 return (DPO_PROTO_IP6);
100 case VNET_LINK_IP4:
101 return (DPO_PROTO_IP4);
102 case VNET_LINK_MPLS:
103 return (DPO_PROTO_MPLS);
104 case VNET_LINK_ETHERNET:
105 return (DPO_PROTO_ETHERNET);
Florin Corasce1b4c72017-01-26 14:25:34 -0800106 case VNET_LINK_NSH:
107 return (DPO_PROTO_NSH);
Neale Rannsad95b5d2016-11-10 20:35:14 +0000108 case VNET_LINK_ARP:
109 break;
110 }
111 ASSERT(0);
112 return (0);
113}
114
Neale Rannsda78f952017-05-24 09:15:43 -0700115vnet_link_t
116dpo_proto_to_link (dpo_proto_t dp)
117{
118 switch (dp)
119 {
120 case DPO_PROTO_IP6:
121 return (VNET_LINK_IP6);
122 case DPO_PROTO_IP4:
123 return (VNET_LINK_IP4);
124 case DPO_PROTO_MPLS:
Neale Rannsd792d9c2017-10-21 10:53:20 -0700125 case DPO_PROTO_BIER:
Neale Rannsda78f952017-05-24 09:15:43 -0700126 return (VNET_LINK_MPLS);
127 case DPO_PROTO_ETHERNET:
128 return (VNET_LINK_ETHERNET);
129 case DPO_PROTO_NSH:
130 return (VNET_LINK_NSH);
131 }
132 return (~0);
133}
134
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100135u8 *
136format_dpo_type (u8 * s, va_list * args)
137{
138 dpo_type_t type = va_arg (*args, int);
139
140 s = format(s, "%s", dpo_type_names[type]);
141
142 return (s);
143}
144
145u8 *
146format_dpo_id (u8 * s, va_list * args)
147{
148 dpo_id_t *dpo = va_arg (*args, dpo_id_t*);
149 u32 indent = va_arg (*args, u32);
150
151 s = format(s, "[@%d]: ", dpo->dpoi_next_node);
152
153 if (NULL != dpo_vfts[dpo->dpoi_type].dv_format)
154 {
155 return (format(s, "%U",
156 dpo_vfts[dpo->dpoi_type].dv_format,
157 dpo->dpoi_index,
158 indent));
159 }
160
161 switch (dpo->dpoi_type)
162 {
163 case DPO_FIRST:
164 s = format(s, "unset");
165 break;
166 default:
167 s = format(s, "unknown");
168 break;
169 }
170 return (s);
171}
172
173u8 *
174format_dpo_proto (u8 * s, va_list * args)
175{
176 dpo_proto_t proto = va_arg (*args, int);
177
178 return (format(s, "%s", dpo_proto_names[proto]));
179}
180
181void
182dpo_set (dpo_id_t *dpo,
183 dpo_type_t type,
184 dpo_proto_t proto,
185 index_t index)
186{
187 dpo_id_t tmp = *dpo;
188
189 dpo->dpoi_type = type;
190 dpo->dpoi_proto = proto,
191 dpo->dpoi_index = index;
192
193 if (DPO_ADJACENCY == type)
194 {
195 /*
196 * set the adj subtype
197 */
198 ip_adjacency_t *adj;
199
200 adj = adj_get(index);
201
202 switch (adj->lookup_next_index)
203 {
204 case IP_LOOKUP_NEXT_ARP:
205 dpo->dpoi_type = DPO_ADJACENCY_INCOMPLETE;
206 break;
207 case IP_LOOKUP_NEXT_MIDCHAIN:
208 dpo->dpoi_type = DPO_ADJACENCY_MIDCHAIN;
209 break;
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800210 case IP_LOOKUP_NEXT_MCAST_MIDCHAIN:
211 dpo->dpoi_type = DPO_ADJACENCY_MCAST_MIDCHAIN;
212 break;
213 case IP_LOOKUP_NEXT_MCAST:
214 dpo->dpoi_type = DPO_ADJACENCY_MCAST;
Neale Ranns8c4611b2017-05-23 03:43:47 -0700215 break;
216 case IP_LOOKUP_NEXT_GLEAN:
217 dpo->dpoi_type = DPO_ADJACENCY_GLEAN;
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800218 break;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100219 default:
220 break;
221 }
222 }
223 dpo_lock(dpo);
224 dpo_unlock(&tmp);
225}
226
227void
228dpo_reset (dpo_id_t *dpo)
229{
Neale Rannsad95b5d2016-11-10 20:35:14 +0000230 dpo_id_t tmp = DPO_INVALID;
231
232 /*
233 * use the atomic copy operation.
234 */
235 dpo_copy(dpo, &tmp);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100236}
237
238/**
239 * \brief
240 * Compare two Data-path objects
241 *
242 * like memcmp, return 0 is matching, !0 otherwise.
243 */
244int
245dpo_cmp (const dpo_id_t *dpo1,
246 const dpo_id_t *dpo2)
247{
248 int res;
249
250 res = dpo1->dpoi_type - dpo2->dpoi_type;
251
252 if (0 != res) return (res);
253
254 return (dpo1->dpoi_index - dpo2->dpoi_index);
255}
256
257void
258dpo_copy (dpo_id_t *dst,
259 const dpo_id_t *src)
260{
261 dpo_id_t tmp = *dst;
262
263 /*
264 * the destination is written in a single u64 write - hence atomically w.r.t
265 * any packets inflight.
266 */
267 *((u64*)dst) = *(u64*)src;
268
269 dpo_lock(dst);
270 dpo_unlock(&tmp);
271}
272
273int
274dpo_is_adj (const dpo_id_t *dpo)
275{
276 return ((dpo->dpoi_type == DPO_ADJACENCY) ||
277 (dpo->dpoi_type == DPO_ADJACENCY_INCOMPLETE) ||
278 (dpo->dpoi_type == DPO_ADJACENCY_MIDCHAIN) ||
279 (dpo->dpoi_type == DPO_ADJACENCY_GLEAN));
280}
281
Neale Ranns43161a82017-08-12 02:12:00 -0700282static u32 *
283dpo_default_get_next_node (const dpo_id_t *dpo)
284{
285 u32 *node_indices = NULL;
286 const char *node_name;
287 u32 ii = 0;
288
289 node_name = dpo_nodes[dpo->dpoi_type][dpo->dpoi_proto][ii];
290 while (NULL != node_name)
291 {
292 vlib_node_t *node;
293
294 node = vlib_get_node_by_name(vlib_get_main(), (u8*) node_name);
295 ASSERT(NULL != node);
296 vec_add1(node_indices, node->index);
297
298 ++ii;
299 node_name = dpo_nodes[dpo->dpoi_type][dpo->dpoi_proto][ii];
300 }
301
302 return (node_indices);
303}
304
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100305void
306dpo_register (dpo_type_t type,
307 const dpo_vft_t *vft,
308 const char * const * const * nodes)
309{
310 vec_validate(dpo_vfts, type);
311 dpo_vfts[type] = *vft;
Neale Ranns43161a82017-08-12 02:12:00 -0700312 if (NULL == dpo_vfts[type].dv_get_next_node)
313 {
314 dpo_vfts[type].dv_get_next_node = dpo_default_get_next_node;
315 }
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100316
317 vec_validate(dpo_nodes, type);
318 dpo_nodes[type] = nodes;
319}
320
321dpo_type_t
322dpo_register_new_type (const dpo_vft_t *vft,
323 const char * const * const * nodes)
324{
325 dpo_type_t type = dpo_dynamic++;
326
327 dpo_register(type, vft, nodes);
328
329 return (type);
330}
331
332void
333dpo_lock (dpo_id_t *dpo)
334{
335 if (!dpo_id_is_valid(dpo))
336 return;
337
338 dpo_vfts[dpo->dpoi_type].dv_lock(dpo);
339}
340
341void
342dpo_unlock (dpo_id_t *dpo)
343{
344 if (!dpo_id_is_valid(dpo))
345 return;
346
347 dpo_vfts[dpo->dpoi_type].dv_unlock(dpo);
348}
349
Andrew Yourtchenko5f3fcb92017-10-25 05:50:37 -0700350u32
351dpo_get_urpf(const dpo_id_t *dpo)
352{
353 if (dpo_id_is_valid(dpo) &&
354 (NULL != dpo_vfts[dpo->dpoi_type].dv_get_urpf))
355 {
356 return (dpo_vfts[dpo->dpoi_type].dv_get_urpf(dpo));
357 }
358
359 return (~0);
360}
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100361
362static u32
363dpo_get_next_node (dpo_type_t child_type,
364 dpo_proto_t child_proto,
365 const dpo_id_t *parent_dpo)
366{
367 dpo_proto_t parent_proto;
368 dpo_type_t parent_type;
369
370 parent_type = parent_dpo->dpoi_type;
371 parent_proto = parent_dpo->dpoi_proto;
372
373 vec_validate(dpo_edges, child_type);
374 vec_validate(dpo_edges[child_type], child_proto);
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000375 vec_validate(dpo_edges[child_type][child_proto], parent_type);
376 vec_validate_init_empty(
377 dpo_edges[child_type][child_proto][parent_type],
378 parent_proto, ~0);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100379
380 /*
381 * if the edge index has not yet been created for this node to node transistion
382 */
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000383 if (~0 == dpo_edges[child_type][child_proto][parent_type][parent_proto])
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100384 {
Neale Ranns43161a82017-08-12 02:12:00 -0700385 vlib_node_t *child_node;
386 u32 *parent_indices;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100387 vlib_main_t *vm;
Neale Ranns43161a82017-08-12 02:12:00 -0700388 u32 edge, *pi, cc;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100389
390 vm = vlib_get_main();
391
Neale Ranns43161a82017-08-12 02:12:00 -0700392 ASSERT(NULL != dpo_vfts[parent_type].dv_get_next_node);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100393 ASSERT(NULL != dpo_nodes[child_type]);
394 ASSERT(NULL != dpo_nodes[child_type][child_proto]);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100395
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000396 cc = 0;
Neale Ranns43161a82017-08-12 02:12:00 -0700397 parent_indices = dpo_vfts[parent_type].dv_get_next_node(parent_dpo);
398
399 vlib_worker_thread_barrier_sync(vm);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100400
401 /*
Neale Ranns43161a82017-08-12 02:12:00 -0700402 * create a graph arc from each of the child's registered node types,
403 * to each of the parent's.
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100404 */
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000405 while (NULL != dpo_nodes[child_type][child_proto][cc])
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100406 {
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000407 child_node =
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100408 vlib_get_node_by_name(vm,
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000409 (u8*) dpo_nodes[child_type][child_proto][cc]);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100410
Neale Ranns43161a82017-08-12 02:12:00 -0700411 vec_foreach(pi, parent_indices)
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100412 {
Neale Ranns43161a82017-08-12 02:12:00 -0700413 edge = vlib_node_add_next(vm, child_node->index, *pi);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100414
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000415 if (~0 == dpo_edges[child_type][child_proto][parent_type][parent_proto])
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100416 {
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000417 dpo_edges[child_type][child_proto][parent_type][parent_proto] = edge;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100418 }
419 else
420 {
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000421 ASSERT(dpo_edges[child_type][child_proto][parent_type][parent_proto] == edge);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100422 }
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100423 }
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000424 cc++;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100425 }
Neale Rannsbb620d72017-06-29 00:19:08 -0700426
427 vlib_worker_thread_barrier_release(vm);
Neale Ranns43161a82017-08-12 02:12:00 -0700428 vec_free(parent_indices);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100429 }
430
Neale Ranns8fe8cc22016-11-01 10:05:08 +0000431 return (dpo_edges[child_type][child_proto][parent_type][parent_proto]);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100432}
433
434/**
435 * @brief Stack one DPO object on another, and thus establish a child parent
436 * relationship. The VLIB graph arc used is taken from the parent and child types
437 * passed.
438 */
439static void
440dpo_stack_i (u32 edge,
441 dpo_id_t *dpo,
442 const dpo_id_t *parent)
443{
444 /*
445 * in order to get an atomic update of the parent we create a temporary,
446 * from a copy of the child, and add the next_node. then we copy to the parent
447 */
Neale Ranns948e00f2016-10-20 13:39:34 +0100448 dpo_id_t tmp = DPO_INVALID;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100449 dpo_copy(&tmp, parent);
450
451 /*
452 * get the edge index for the parent to child VLIB graph transisition
453 */
454 tmp.dpoi_next_node = edge;
455
456 /*
457 * this update is atomic.
458 */
459 dpo_copy(dpo, &tmp);
460
461 dpo_reset(&tmp);
462}
463
464/**
465 * @brief Stack one DPO object on another, and thus establish a child-parent
466 * relationship. The VLIB graph arc used is taken from the parent and child types
467 * passed.
468 */
469void
470dpo_stack (dpo_type_t child_type,
471 dpo_proto_t child_proto,
472 dpo_id_t *dpo,
473 const dpo_id_t *parent)
474{
475 dpo_stack_i(dpo_get_next_node(child_type, child_proto, parent), dpo, parent);
476}
477
478/**
479 * @brief Stack one DPO object on another, and thus establish a child parent
480 * relationship. A new VLIB graph arc is created from the child node passed
481 * to the nodes registered by the parent. The VLIB infra will ensure this arc
482 * is added only once.
483 */
484void
485dpo_stack_from_node (u32 child_node_index,
486 dpo_id_t *dpo,
487 const dpo_id_t *parent)
488{
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100489 dpo_type_t parent_type;
Neale Ranns43161a82017-08-12 02:12:00 -0700490 u32 *parent_indices;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100491 vlib_main_t *vm;
Neale Ranns43161a82017-08-12 02:12:00 -0700492 u32 edge, *pi;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100493
Neale Ranns43161a82017-08-12 02:12:00 -0700494 edge = 0;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100495 parent_type = parent->dpoi_type;
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100496 vm = vlib_get_main();
497
Neale Ranns43161a82017-08-12 02:12:00 -0700498 ASSERT(NULL != dpo_vfts[parent_type].dv_get_next_node);
499 parent_indices = dpo_vfts[parent_type].dv_get_next_node(parent);
500 ASSERT(parent_indices);
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100501
Neale Ranns43161a82017-08-12 02:12:00 -0700502 /*
503 * This loop is purposefully written with the worker thread lock in the
504 * inner loop because;
505 * 1) the likelihood that the edge does not exist is smaller
506 * 2) the likelihood there is more than one node is even smaller
507 * so we are optimising for not need to take the lock
508 */
509 vec_foreach(pi, parent_indices)
Neale Rannsbb620d72017-06-29 00:19:08 -0700510 {
Neale Ranns43161a82017-08-12 02:12:00 -0700511 edge = vlib_node_get_next(vm, child_node_index, *pi);
Neale Rannsbb620d72017-06-29 00:19:08 -0700512
Neale Ranns43161a82017-08-12 02:12:00 -0700513 if (~0 == edge)
514 {
515 vlib_worker_thread_barrier_sync(vm);
Neale Rannsbb620d72017-06-29 00:19:08 -0700516
Neale Ranns43161a82017-08-12 02:12:00 -0700517 edge = vlib_node_add_next(vm, child_node_index, *pi);
518
519 vlib_worker_thread_barrier_release(vm);
520 }
Neale Rannsbb620d72017-06-29 00:19:08 -0700521 }
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100522 dpo_stack_i(edge, dpo, parent);
523}
524
525static clib_error_t *
526dpo_module_init (vlib_main_t * vm)
527{
528 drop_dpo_module_init();
529 punt_dpo_module_init();
530 receive_dpo_module_init();
531 load_balance_module_init();
532 mpls_label_dpo_module_init();
533 classify_dpo_module_init();
534 lookup_dpo_module_init();
Neale Ranns948e00f2016-10-20 13:39:34 +0100535 ip_null_dpo_module_init();
Neale Ranns32e1c012016-11-22 17:07:28 +0000536 replicate_module_init();
Neale Ranns43161a82017-08-12 02:12:00 -0700537 interface_rx_dpo_module_init();
538 interface_tx_dpo_module_init();
Neale Ranns0f26c5a2017-03-01 15:12:11 -0800539 mpls_disp_dpo_module_init();
Neale Rannsf068c3e2018-01-03 04:18:48 -0800540 dvr_dpo_module_init();
Andrew Yourtchenko5f3fcb92017-10-25 05:50:37 -0700541 l3_proxy_dpo_module_init();
Neale Ranns0bfe5d82016-08-25 15:29:12 +0100542
543 return (NULL);
544}
545
546VLIB_INIT_FUNCTION(dpo_module_init);
Neale Ranns6c3ebcc2016-10-02 21:20:15 +0100547
548static clib_error_t *
549dpo_memory_show (vlib_main_t * vm,
550 unformat_input_t * input,
551 vlib_cli_command_t * cmd)
552{
553 dpo_vft_t *vft;
554
555 vlib_cli_output (vm, "DPO memory");
556 vlib_cli_output (vm, "%=30s %=5s %=8s/%=9s totals",
557 "Name","Size", "in-use", "allocated");
558
559 vec_foreach(vft, dpo_vfts)
560 {
561 if (NULL != vft->dv_mem_show)
562 vft->dv_mem_show();
563 }
564
565 return (NULL);
566}
567
568/* *INDENT-OFF* */
569/*?
570 * The '<em>sh dpo memory </em>' command displays the memory usage for each
571 * data-plane object type.
572 *
573 * @cliexpar
574 * @cliexstart{show dpo memory}
575 * DPO memory
576 * Name Size in-use /allocated totals
577 * load-balance 64 12 / 12 768/768
578 * Adjacency 256 1 / 1 256/256
579 * Receive 24 5 / 5 120/120
580 * Lookup 12 0 / 0 0/0
581 * Classify 12 0 / 0 0/0
582 * MPLS label 24 0 / 0 0/0
583 * @cliexend
584?*/
585VLIB_CLI_COMMAND (show_fib_memory, static) = {
586 .path = "show dpo memory",
587 .function = dpo_memory_show,
588 .short_help = "show dpo memory",
589};
590/* *INDENT-ON* */