FD.io VPP  v18.10-34-gcce845e
Vector Packet Processing
bier_fmask.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/fib/fib_entry.h>
17 #include <vnet/fib/fib_table.h>
18 #include <vnet/fib/fib_walk.h>
19 #include <vnet/fib/fib_path_list.h>
20 
21 #include <vnet/bier/bier_table.h>
22 #include <vnet/bier/bier_fmask.h>
25 
26 #include <vnet/mpls/mpls.h>
27 #include <vnet/dpo/drop_dpo.h>
28 #include <vnet/dpo/load_balance.h>
29 
30 /*
31  * attributes names for formatting
32  */
33 static const char *const bier_fmask_attr_names[] = BIER_FMASK_ATTR_NAMES;
34 
35 /*
36  * pool of BIER fmask objects
37  */
39 
40 /**
41  * Stats for each BIER fmask object
42  */
44 
45 static inline index_t
47 {
48  return (bfm - bier_fmask_pool);
49 }
50 
51 static void
53  bier_hdr_len_id_t hlid)
54 {
55  bits->bfmb_refs = clib_mem_alloc(sizeof(bits->bfmb_refs[0]) *
57  memset(bits->bfmb_refs,
58  0,
59  (sizeof(bits->bfmb_refs[0]) *
61 
64 
65  /*
66  * The buckets are accessed in the switch path
67  */
70  sizeof(bits->bfmb_input_reset_string.bbs_buckets[0]) *
74  0,
75  sizeof(bits->bfmb_input_reset_string.bbs_buckets[0]) *
77 }
78 
79 static void
81 {
82  dpo_id_t via_dpo = DPO_INVALID;
84 
86  {
88  }
89  else
90  {
92  }
93 
96  &via_dpo);
97 
98  /*
99  * If the via PL entry provides no forwarding (i.e. a drop)
100  * then neither does this fmask. That way children consider this fmask
101  * unresolved and other ECMP options are used instead.
102  */
103  if (dpo_is_drop(&via_dpo))
104  {
106  }
107  else
108  {
110  }
111 
114  &bfm->bfm_dpo,
115  &via_dpo);
116  dpo_reset(&via_dpo);
117 }
118 
119 void
121  dpo_id_t *dpo)
122 {
123  bier_fmask_t *bfm;
124 
125  bfm = bier_fmask_get(bfmi);
126 
128  {
129  dpo_set(dpo,
132  bfmi);
133  }
134  else
135  {
137  }
138 }
139 
140 u32
142  fib_node_type_t child_type,
143  fib_node_index_t child_index)
144 {
146  bfmi,
147  child_type,
148  child_index));
149 };
150 
151 void
153  u32 sibling_index)
154 {
155  if (INDEX_INVALID == bfmi)
156  {
157  return;
158  }
159 
161  bfmi,
162  sibling_index);
163 }
164 
165 static void
167  const bier_fmask_id_t *fmid,
168  const fib_route_path_t *rpath)
169 {
170  const bier_table_id_t *btid;
171  fib_route_path_t *rpaths;
172  mpls_label_t olabel;
173 
174  memset(bfm, 0, sizeof(*bfm));
175 
176  bfm->bfm_id = clib_mem_alloc(sizeof(*bfm->bfm_id));
177 
179  *bfm->bfm_id = *fmid;
180  dpo_reset(&bfm->bfm_dpo);
181  btid = bier_table_get_id(bfm->bfm_id->bfmi_bti);
183 
184  if (rpath->frp_flags & FIB_ROUTE_PATH_UDP_ENCAP)
185  {
187  }
188  else if (ip46_address_is_zero(&(bfm->bfm_id->bfmi_nh)))
189  {
191  }
192 
193  if (!(bfm->bfm_flags & BIER_FMASK_FLAG_DISP))
194  {
195  if (NULL != rpath->frp_label_stack)
196  {
197  olabel = rpath->frp_label_stack[0].fml_value;
198  vnet_mpls_uc_set_label(&bfm->bfm_label, olabel);
200  vnet_mpls_uc_set_s(&bfm->bfm_label, 1);
201  vnet_mpls_uc_set_ttl(&bfm->bfm_label, 64);
203  }
204  else
205  {
207 
208  /*
209  * not an MPLS label
210  */
212 
213  /*
214  * use a label as encoded for BIFT value
215  */
216  id = bier_bift_id_encode(btid->bti_set,
217  btid->bti_sub_domain,
218  btid->bti_hdr_len);
220  vnet_mpls_uc_set_s(&bfm->bfm_label, 1);
222  vnet_mpls_uc_set_ttl(&bfm->bfm_label, 64);
223  }
224  bfm->bfm_label = clib_host_to_net_u32(bfm->bfm_label);
225  }
226 
227  rpaths = NULL;
228  vec_add1(rpaths, *rpath);
231  rpaths);
234  bier_fmask_get_index(bfm));
235  vec_free(rpaths);
236  bier_fmask_stack(bfm);
237 }
238 
239 static void
241 {
244 
247  bfm->bfm_sibling);
248  dpo_reset(&bfm->bfm_dpo);
249  clib_mem_free(bfm->bfm_id);
250  pool_put(bier_fmask_pool, bfm);
251 }
252 
253 void
255 {
256  bier_fmask_t *bfm;
257 
258  if (INDEX_INVALID == bfmi)
259  {
260  return;
261  }
262 
263  bfm = bier_fmask_get(bfmi);
264 
265  fib_node_unlock(&bfm->bfm_node);
266 }
267 
268 void
270 {
271  bier_fmask_t *bfm;
272 
273  if (INDEX_INVALID == bfmi)
274  {
275  return;
276  }
277 
278  bfm = bier_fmask_get(bfmi);
279 
280  fib_node_lock(&bfm->bfm_node);
281 }
282 
283 index_t
285  const fib_route_path_t *rpath)
286 {
287  bier_fmask_t *bfm;
288  index_t bfmi;
289 
290  pool_get_aligned(bier_fmask_pool, bfm, CLIB_CACHE_LINE_BYTES);
291  bfmi = bier_fmask_get_index(bfm);
292 
293  vlib_validate_combined_counter (&(bier_fmask_counters), bfmi);
294  vlib_zero_combined_counter (&(bier_fmask_counters), bfmi);
295 
296  bier_fmask_init(bfm, fmid, rpath);
297 
298  bier_fmask_lock(bfmi);
299 
300  return (bfmi);
301 }
302 
303 void
305  bier_bp_t bp)
306 {
307  bier_fmask_t *bfm;
308 
309  bfm = bier_fmask_get(bfmi);
310 
311  if (0 == bfm->bfm_bits.bfmb_refs[BIER_BP_TO_INDEX(bp)])
312  {
313  /*
314  * 0 -> 1 transistion - set the bit in the string
315  */
317  }
318 
319  ++bfm->bfm_bits.bfmb_refs[BIER_BP_TO_INDEX(bp)];
320  ++bfm->bfm_bits.bfmb_count;
321 }
322 
323 void
325  bier_bp_t bp)
326 {
327  bier_fmask_t *bfm;
328 
329  bfm = bier_fmask_get(bfmi);
330 
331  --bfm->bfm_bits.bfmb_refs[BIER_BP_TO_INDEX(bp)];
332  --bfm->bfm_bits.bfmb_count;
333 
334  if (0 == bfm->bfm_bits.bfmb_refs[BIER_BP_TO_INDEX(bp)])
335  {
336  /*
337  * 1 -> 0 transistion - clear the bit in the string
338  */
340  }
341 }
342 
343 u8*
344 format_bier_fmask (u8 *s, va_list *ap)
345 {
346  index_t bfmi = va_arg(*ap, index_t);
347  u32 indent = va_arg(*ap, u32);
349  bier_fmask_t *bfm;
350  vlib_counter_t to;
351 
352  if (pool_is_free_index(bier_fmask_pool, bfmi))
353  {
354  return (format(s, "No BIER f-mask %d", bfmi));
355  }
356 
357  bfm = bier_fmask_get(bfmi);
358 
359  s = format(s, "fmask: nh:%U bs:%U locks:%d ",
362  bfm->bfm_node.fn_locks);
363  s = format(s, "flags:");
365  if ((1<<attr) & bfm->bfm_flags) {
366  s = format (s, "%s,", bier_fmask_attr_names[attr]);
367  }
368  }
369  vlib_get_combined_counter (&(bier_fmask_counters), bfmi, &to);
370  s = format (s, " to:[%Ld:%Ld]]", to.packets, to.bytes);
371  s = format(s, "\n");
372  s = fib_path_list_format(bfm->bfm_pl, s);
373 
374  if (bfm->bfm_flags & BIER_FMASK_FLAG_MPLS)
375  {
376  s = format(s, " output-label:%U",
378  vnet_mpls_uc_get_label(clib_net_to_host_u32(bfm->bfm_label)));
379  }
380  else
381  {
382  s = format(s, " output-bfit:[%U]",
384  vnet_mpls_uc_get_label(clib_net_to_host_u32(bfm->bfm_label)));
385  }
386  s = format(s, "\n %U%U",
387  format_white_space, indent,
388  format_dpo_id, &bfm->bfm_dpo, indent+2);
389 
390  return (s);
391 }
392 
393 void
394 bier_fmask_get_stats (index_t bfmi, u64 * packets, u64 * bytes)
395 {
396  vlib_counter_t to;
397 
398  vlib_get_combined_counter (&(bier_fmask_counters), bfmi, &to);
399 
400  *packets = to.packets;
401  *bytes = to.bytes;
402 }
403 
404 void
406  bier_table_id_t *btid,
408 {
409  bier_fmask_t *bfm;
410 
411  bfm = bier_fmask_get(bfmi);
412  *btid = *bier_table_get_id(bfm->bfm_id->bfmi_bti);
413 
414  memset(rpath, 0, sizeof(*rpath));
415 
416  rpath->rpath.frp_sw_if_index = ~0;
417 
418  switch (bfm->bfm_id->bfmi_nh_type)
419  {
420  case BIER_NH_UDP:
422  rpath->rpath.frp_udp_encap_id = bfm->bfm_id->bfmi_id;
423  break;
424  case BIER_NH_IP:
425  memcpy(&rpath->rpath.frp_addr, &bfm->bfm_id->bfmi_nh,
426  sizeof(rpath->rpath.frp_addr));
427  break;
428  }
429 }
430 
431 static fib_node_t *
433 {
434  bier_fmask_t *bfm = bier_fmask_get(index);
435  return (&(bfm->bfm_node));
436 }
437 
438 static bier_fmask_t*
440 {
441  return ((bier_fmask_t*)(((char*)node) -
443  bfm_node)));
444 }
445 
446 /*
447  * bier_fmask_last_lock_gone
448  */
449 static void
451 {
453 }
454 
455 /*
456  * bier_fmask_back_walk_notify
457  *
458  * A back walk has reached this BIER fmask
459  */
463 {
464  /*
465  * re-stack the fmask on the n-eos of the via
466  */
468 
469  bier_fmask_stack(bfm);
470 
471  /*
472  * propagate further up the graph.
473  * we can do this synchronously since the fan out is small.
474  */
476 
478 }
479 
480 /*
481  * The BIER fmask's graph node virtual function table
482  */
483 static const fib_node_vft_t bier_fmask_vft = {
485  .fnv_last_lock = bier_fmask_last_lock_gone,
486  .fnv_back_walk = bier_fmask_back_walk_notify,
487 };
488 
489 static void
491 {
492 }
493 
494 static void
496 {
497 }
498 
499 static void
501 {
502  fib_show_memory_usage("BIER-fmask",
503  pool_elts(bier_fmask_pool),
504  pool_len(bier_fmask_pool),
505  sizeof(bier_fmask_t));
506 }
507 
508 const static dpo_vft_t bier_fmask_dpo_vft = {
510  .dv_unlock = bier_fmask_dpo_unlock,
511  .dv_mem_show = bier_fmask_dpo_mem_show,
512  .dv_format = format_bier_fmask,
513 };
514 
515 const static char *const bier_fmask_mpls_nodes[] =
516 {
517  "bier-output",
518  NULL
519 };
520 const static char * const * const bier_fmask_nodes[DPO_PROTO_NUM] =
521 {
524 };
525 
526 clib_error_t *
528 {
530  dpo_register(DPO_BIER_FMASK, &bier_fmask_dpo_vft, bier_fmask_nodes);
531 
532  return (NULL);
533 }
534 
536 
537 static clib_error_t *
539  unformat_input_t * input,
540  vlib_cli_command_t * cmd)
541 {
542  bier_fmask_t *bfm;
543  index_t bfmi;
544 
545  bfmi = INDEX_INVALID;
546 
547  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
548  if (unformat (input, "%d", &bfmi))
549  {
550  ;
551  } else
552  {
553  break;
554  }
555  }
556 
557  if (INDEX_INVALID == bfmi)
558  {
559  pool_foreach(bfm, bier_fmask_pool,
560  ({
561  vlib_cli_output (vm, "[@%d] %U",
564  }));
565  }
566  else
567  {
568  vlib_cli_output (vm, "%U", format_bier_fmask, bfmi, 0);
569  }
570 
571  return (NULL);
572 }
573 
574 VLIB_CLI_COMMAND (show_bier_fmask, static) = {
575  .path = "show bier fmask",
576  .short_help = "show bier fmask",
577  .function = bier_fmask_show,
578 };
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:404
Contribute an object that is to be used to forward BIER packets.
Definition: fib_types.h:122
static void bier_fmask_bits_init(bier_fmask_bits_t *bits, bier_hdr_len_id_t hlid)
Definition: bier_fmask.c:52
ip46_address_t frp_addr
The next-hop address.
Definition: fib_types.h:486
clib_error_t * bier_fmask_module_init(vlib_main_t *vm)
Definition: bier_fmask.c:527
u8 * format_bier_bit_string(u8 *string, va_list *args)
u32 bfmb_count
The total number of references to bits set on this mask in effect a count of the number of children...
Definition: bier_fmask.h:57
u8 * format_bier_fmask(u8 *s, va_list *ap)
Definition: bier_fmask.c:344
void bier_bit_string_set_bit(bier_bit_string_t *bit_string, bier_bp_t bp)
A virtual function table regisitered for a DPO type.
Definition: dpo.h:399
A representation of a fib path for fib_path_encode to convey the information to the caller...
Definition: fib_types.h:584
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
Definition: counter.c:106
void fib_path_list_child_remove(fib_node_index_t path_list_index, u32 si)
void bier_fmask_lock(index_t bfmi)
Definition: bier_fmask.c:269
u32 bfmi_id
ID of the next-hop object, e.g.
Definition: bier_fmask_db.h:70
A representation of a path as described by a route producer.
Definition: fib_types.h:470
index_t bier_fmask_create_and_lock(const bier_fmask_id_t *fmid, const fib_route_path_t *rpath)
Definition: bier_fmask.c:284
bier_fmask_t * bier_fmask_pool
Definition: bier_fmask.c:38
void bier_fmask_contribute_forwarding(index_t bfmi, dpo_id_t *dpo)
Definition: bier_fmask.c:120
void fib_node_init(fib_node_t *node, fib_node_type_t type)
Definition: fib_node.c:185
static const char *const *const bier_fmask_nodes[DPO_PROTO_NUM]
Definition: bier_fmask.c:520
unsigned long u64
Definition: types.h:89
bier_fmask_id_t * bfm_id
The key to this fmask - used for store/lookup in the DB.
Definition: bier_fmask.h:124
#define NULL
Definition: clib.h:57
static bier_fmask_t * bier_fmask_get(u32 index)
Definition: bier_fmask.h:177
static void bier_fmask_dpo_lock(dpo_id_t *dpo)
Definition: bier_fmask.c:490
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
u32 mpls_label_t
A label value only, i.e.
Definition: packet.h:24
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:523
u8 * format_bier_bift_id(u8 *s, va_list *ap)
Definition: bier_types.c:222
BIER header in non-MPLS networks.
Definition: bier_fmask_db.h:53
Combined counter to hold both packets and byte differences.
Definition: counter_types.h:26
bier_fmask : The BIER fmask
Definition: bier_fmask.h:45
format_function_t format_ip46_address
Definition: format.h:61
#define STRUCT_OFFSET_OF(t, f)
Definition: clib.h:64
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
bier_fmask_bits_t bfm_bits
The bits, and their ref counts, that are set on this mask This mask changes as BIER entries link to a...
Definition: bier_fmask.h:119
The ID of a table.
Definition: bier_types.h:394
fib_node_index_t bfm_pl
The path-list.
Definition: bier_fmask.h:134
u32 fib_path_list_child_add(fib_node_index_t path_list_index, fib_node_type_t child_type, fib_node_index_t child_index)
unsigned char u8
Definition: types.h:56
#define pool_len(p)
Number of elements in pool vector.
Definition: pool.h:140
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t type, fib_node_index_t index)
Definition: fib_node.c:98
u16 bbs_len
The length of the string in BYTES.
Definition: bier_types.h:282
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
Definition: fib_node.c:60
static const char *const bier_fmask_mpls_nodes[]
Definition: bier_fmask.c:515
void bier_fmask_unlink(index_t bfmi, bier_bp_t bp)
Definition: bier_fmask.c:324
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
memset(h->entries, 0, sizeof(h->entries[0])*entries)
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
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:443
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:505
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:163
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
Definition: fib_walk.c:729
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:113
bier_table_set_id_t bti_set
The SET-ID The control plane divdies the bit-position space into sets in the case the max bit-positio...
Definition: bier_types.h:401
void bier_fmask_child_remove(fib_node_index_t bfmi, u32 sibling_index)
Definition: bier_fmask.c:152
bier_bift_id_t bier_bift_id_encode(bier_table_set_id_t set, bier_table_sub_domain_id_t sd, bier_hdr_len_id_t bsl)
Encode a BIFT-ID as per draft-wijnandsxu-bier-non-mpls-bift-encoding-00.txt.
Definition: bier_types.c:164
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
Definition: fib_node.c:220
static index_t bier_fmask_get_index(const bier_fmask_t *bfm)
Definition: bier_fmask.c:46
A path via a UDP encap object.
Definition: fib_types.h:361
unsigned int u32
Definition: types.h:88
static void vnet_mpls_uc_set_label(mpls_label_t *label_exp_s_ttl, u32 value)
Definition: packet.h:123
u32 bier_bp_t
A bit positon as assigned to egress PEs.
Definition: bier_types.h:294
static void vnet_mpls_uc_set_exp(mpls_label_t *label_exp_s_ttl, u32 exp)
Definition: packet.h:130
void bier_fmask_link(index_t bfmi, bier_bp_t bp)
Definition: bier_fmask.c:304
u32 bier_hdr_len_id_to_num_bits(bier_hdr_len_id_t id)
Definition: bier_types.c:78
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
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
Definition: counter.h:269
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
counter_t packets
packet counter
Definition: counter_types.h:28
bier_hdr_len_id_t bti_hdr_len
The size of the bit string processed by this table.
Definition: bier_types.h:419
static fib_node_back_walk_rc_t bier_fmask_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Definition: bier_fmask.c:461
void fib_node_lock(fib_node_t *node)
Definition: fib_node.c:203
long ctx[MAX_CONNS]
Definition: main.c:144
struct _unformat_input_t unformat_input_t
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:274
void bier_bit_string_clear_bit(bier_bit_string_t *bit_string, bier_bp_t bp)
static u32 vnet_mpls_uc_get_label(mpls_label_t label_exp_s_ttl)
Definition: packet.h:103
fib_mpls_label_t * frp_label_stack
The outgoing MPLS label Stack.
Definition: fib_types.h:525
#define BIER_FMASK_ATTR_NAMES
Definition: bier_fmask.h:72
An node in the FIB graph.
Definition: fib_node.h:289
void fib_node_unlock(fib_node_t *node)
Definition: fib_node.c:209
void bier_fmask_db_remove(const bier_fmask_id_t *fmid)
An outgoing BIER mask.
Definition: bier_fmask.h:99
mpls_label_t bfm_label
The MPLS label to paint on the header during forwarding.
Definition: bier_fmask.h:129
static bier_fmask_t * bier_fmask_get_from_node(fib_node_t *node)
Definition: bier_fmask.c:439
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
Definition: pool.h:188
#define UNFORMAT_END_OF_INPUT
Definition: format.h:144
static void vlib_get_combined_counter(const vlib_combined_counter_main_t *cm, u32 index, vlib_counter_t *result)
Get the value of a combined counter, never called in the speed path Scrapes the entire set of per-thr...
Definition: counter.h:243
vlib_main_t * vm
Definition: buffer.c:294
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:339
static void bier_fmask_stack(bier_fmask_t *bfm)
Definition: bier_fmask.c:80
fib_node_get_t fnv_get
Definition: fib_node.h:277
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
u32 bier_hdr_len_id_to_num_buckets(bier_hdr_len_id_t id)
Conversion functions for the enumerated bit-string length values, to bit and bytes.
Definition: bier_types.c:60
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:271
enum bier_hdr_len_id_t_ bier_hdr_len_id_t
bier_hdr_len_id_t enumerator
mpls_label_t fml_value
The label value.
Definition: fib_types.h:430
bier_fmask_flags_t bfm_flags
operational/state flags on the fmask
Definition: bier_fmask.h:113
fib_node_t bfm_node
The BIER fmask is a child of a FIB entry in the FIB graph.
Definition: bier_fmask.h:108
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
static void bier_fmask_dpo_mem_show(void)
Definition: bier_fmask.c:500
Context passed between object during a back walk.
Definition: fib_node.h:202
u32 bier_bift_id_t
The BIER universal &#39;label&#39;.
Definition: bier_types.h:458
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:155
A key/ID for a BIER forwarding Mas (FMask).
Definition: bier_fmask_db.h:60
const bier_table_id_t * bier_table_get_id(index_t bti)
Definition: bier_table.c:524
static void clib_mem_free(void *p)
Definition: mem.h:205
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
#define FOR_EACH_BIER_FMASK_ATTR(_item)
Definition: bier_fmask.h:78
fib_route_path_flags_t frp_flags
flags on the path
Definition: fib_types.h:567
bier_bit_mask_bucket_t * bbs_buckets
The buckets in the string.
Definition: bier_types.h:287
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
Definition: fib_node.c:123
static clib_error_t * bier_fmask_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: bier_fmask.c:538
static void * clib_mem_alloc(uword size)
Definition: mem.h:132
static void vnet_mpls_uc_set_s(mpls_label_t *label_exp_s_ttl, u32 eos)
Definition: packet.h:137
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
Definition: dpo.c:147
index_t bfmi_bti
The BIER table this fmask is in.
Definition: bier_fmask_db.h:75
format_function_t format_mpls_unicast_label
Definition: mpls.h:69
counter_t bytes
byte counter
Definition: counter_types.h:29
#define DPO_PROTO_NUM
Definition: dpo.h:70
static fib_node_t * bier_fmask_get_node(fib_node_index_t index)
Definition: bier_fmask.c:432
u32 fn_locks
Number of dependents on this node.
Definition: fib_node.h:309
void bier_fmask_get_stats(index_t bfmi, u64 *packets, u64 *bytes)
Definition: bier_fmask.c:394
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:47
bier_table_sub_domain_id_t bti_sub_domain
The Sub-Domain-ID The control plane has the configuration option to specify multiple domains or topol...
Definition: bier_types.h:408
u8 * fib_path_list_format(fib_node_index_t path_list_index, u8 *s)
bier_nh_type_t bfmi_nh_type
Union discriminator.
Definition: bier_fmask_db.h:85
vlib_combined_counter_main_t bier_fmask_counters
Stats for each BIER fmask object.
Definition: bier_fmask.c:43
BIER Header in MPLS networks.
Definition: bier_fmask_db.h:48
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:195
A collection of combined counters.
Definition: counter.h:172
void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t fct, fib_path_list_fwd_flags_t flags, dpo_id_t *dpo)
#define BIER_BP_TO_INDEX(bp)
Definition: bier_types.h:296
bier_bit_string_t bfmb_input_reset_string
each bit in the mask needs to be reference counted and set/cleared on the 0->1 and 1->0 transitions...
Definition: bier_fmask.h:50
static void bier_fmask_last_lock_gone(fib_node_t *node)
Definition: bier_fmask.c:450
A FIB graph nodes virtual function table.
Definition: fib_node.h:276
static void vnet_mpls_uc_set_ttl(mpls_label_t *label_exp_s_ttl, u32 ttl)
Definition: packet.h:144
void bier_fmask_unlock(index_t bfmi)
Definition: bier_fmask.c:254
static void bier_fmask_init(bier_fmask_t *bfm, const bier_fmask_id_t *fmid, const fib_route_path_t *rpath)
Definition: bier_fmask.c:166
static void * clib_mem_alloc_aligned(uword size, uword align)
Definition: mem.h:140
static void bier_fmask_dpo_unlock(dpo_id_t *dpo)
Definition: bier_fmask.c:495
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
static void bier_fmask_destroy(bier_fmask_t *bfm)
Definition: bier_fmask.c:240
static const char *const bier_fmask_attr_names[]
Definition: bier_fmask.c:33
dpo_id_t bfm_dpo
The index into the adj table for the adj that this fmask resolves via.
Definition: bier_fmask.h:145
int dpo_is_drop(const dpo_id_t *dpo)
The Drop DPO will drop all packets, no questions asked.
Definition: drop_dpo.c:33
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:231
fib_route_path_t rpath
Definition: fib_types.h:585
Contribute an object that is to be used to forward non-end-of-stack MPLS packets. ...
Definition: fib_types.h:118
u32 id
Definition: udp.api:45
void bier_fmask_encode(index_t bfmi, bier_table_id_t *btid, fib_route_path_encode_t *rpath)
Definition: bier_fmask.c:405
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
u32 frp_udp_encap_id
UDP encap ID.
Definition: fib_types.h:547
#define ip46_address_is_zero(ip46)
Definition: ip6_packet.h:93
u32 bier_fmask_child_add(fib_node_index_t bfmi, fib_node_type_t child_type, fib_node_index_t child_index)
Definition: bier_fmask.c:141
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:725
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:972
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:170
enum bier_fmask_attributes_t_ bier_fmask_attributes_t
Flags on fmask.
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
ip46_address_t bfmi_nh
next-hop of the peer
Definition: bier_fmask_db.h:65
u32 bfm_sibling
the index of this fmask in the parent&#39;s child list.
Definition: bier_fmask.h:139
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:128