FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
bier_api.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * bier_api.c - vnet BIER api
4  *
5  * Copyright (c) 2016 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #include <vnet/vnet.h>
21 #include <vlibmemory/api.h>
22 
23 #include <vnet/api_errno.h>
24 #include <vnet/bier/bier_table.h>
25 #include <vnet/bier/bier_imp.h>
30 #include <vnet/fib/fib_path_list.h>
31 #include <vnet/fib/fib_api.h>
32 #include <vnet/fib/fib_table.h>
33 #include <vnet/mfib/mfib_table.h>
34 
35 #include <vnet/vnet_msg_enum.h>
36 
37 #define vl_typedefs /* define message structures */
38 #include <vnet/vnet_all_api_h.h>
39 #undef vl_typedefs
40 
41 #define vl_endianfun /* define message structures */
42 #include <vnet/vnet_all_api_h.h>
43 #undef vl_endianfun
44 
45 /* instantiate all the print functions we know about */
46 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
47 #define vl_printfun
48 #include <vnet/vnet_all_api_h.h>
49 #undef vl_printfun
50 
52 
53 #define foreach_bier_api_msg \
54  _(BIER_TABLE_ADD_DEL, bier_table_add_del) \
55  _(BIER_TABLE_DUMP, bier_table_dump) \
56  _(BIER_ROUTE_ADD_DEL, bier_route_add_del) \
57  _(BIER_ROUTE_DUMP, bier_route_dump) \
58  _(BIER_IMP_ADD, bier_imp_add) \
59  _(BIER_IMP_DEL, bier_imp_del) \
60  _(BIER_IMP_DUMP, bier_imp_dump) \
61  _(BIER_DISP_TABLE_ADD_DEL, bier_disp_table_add_del) \
62  _(BIER_DISP_TABLE_DUMP, bier_disp_table_dump) \
63  _(BIER_DISP_ENTRY_ADD_DEL, bier_disp_entry_add_del) \
64  _(BIER_DISP_ENTRY_DUMP, bier_disp_entry_dump)
65 
66 static void
68 {
69  vl_api_bier_table_add_del_reply_t *rmp;
70  vnet_main_t *vnm;
71  int rv;
72 
73  vnm = vnet_get_main ();
74  vnm->api_errno = 0;
75 
76  bier_table_id_t bti = {
77  .bti_set = mp->bt_tbl_id.bt_set,
78  .bti_sub_domain = mp->bt_tbl_id.bt_sub_domain,
79  .bti_hdr_len = mp->bt_tbl_id.bt_hdr_len_id,
80  .bti_type = BIER_TABLE_MPLS_SPF,
81  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
82  };
83 
84  if (mp->bt_is_add)
85  {
86  mpls_label_t label = ntohl(mp->bt_label);
87 
88  /*
89  * convert acceptable 'don't want a label' values from
90  * the API to the correct internal INVLID value
91  */
92  if ((0 == label) || (~0 == label))
93  {
94  label = MPLS_LABEL_INVALID;
95  }
96  bier_table_add_or_lock(&bti, label);
97  }
98  else
99  {
100  bier_table_unlock(&bti);
101  }
102 
103  rv = vnm->api_errno;
104 
105  REPLY_MACRO (VL_API_BIER_TABLE_ADD_DEL_REPLY);
106 }
107 
108 static void
110  u32 context,
111  const bier_table_t *bt)
112 {
114 
115  mp = vl_msg_api_alloc(sizeof(*mp));
116  if (!mp)
117  return;
118  memset(mp, 0, sizeof(*mp));
119  mp->_vl_msg_id = ntohs(VL_API_BIER_TABLE_DETAILS);
120  mp->context = context;
121 
122  mp->bt_label = bt->bt_ll;
123  mp->bt_tbl_id.bt_set = bt->bt_id.bti_set;
126 
127  vl_msg_api_send_shmem (q, (u8 *) & mp);
128 }
129 
130 static void
132 {
134  bier_table_t *bt;
135 
137  if (q == 0)
138  return;
139 
141  ({
142  /*
143  * skip the ecmp tables.
144  */
145  if (bier_table_is_main(bt))
146  {
147  send_bier_table_details(q, mp->context, bt);
148  }
149  }));
150 }
151 
152 static void
154 {
155  vl_api_bier_route_add_del_reply_t *rmp;
156  fib_route_path_t *brpaths, *brpath;
157  vnet_main_t *vnm;
158  bier_bp_t bp;
159  int rv = 0;
160  u8 ii, jj;
161 
162  vnm = vnet_get_main ();
163  vnm->api_errno = 0;
164 
165  bp = ntohl(mp->br_bp);
166  brpaths = NULL;
167 
168  if (0 == bp || bp > BIER_BP_MAX)
169  {
170  rv = -1;
171  goto done;
172  }
173 
174  bier_table_id_t bti = {
175  .bti_set = mp->br_tbl_id.bt_set,
176  .bti_sub_domain = mp->br_tbl_id.bt_sub_domain,
177  .bti_hdr_len = mp->br_tbl_id.bt_hdr_len_id,
178  .bti_type = BIER_TABLE_MPLS_SPF,
179  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
180  };
181 
182  vec_validate(brpaths, mp->br_n_paths - 1);
183 
184  vec_foreach_index(ii, brpaths)
185  {
186  brpath = &brpaths[ii];
187  memset(brpath, 0, sizeof(*brpath));
188  brpath->frp_sw_if_index = ~0;
189 
191  mp->br_paths[ii].n_labels - 1);
192  for (jj = 0; jj < mp->br_paths[ii].n_labels; jj++)
193  {
194  brpath->frp_label_stack[jj] =
195  ntohl(mp->br_paths[ii].label_stack[jj]);
196  }
197 
198  if (mp->br_paths[ii].is_udp_encap)
199  {
201  brpath->frp_udp_encap_id = ntohl(mp->br_paths[ii].next_hop_id);
202  }
203  else
204  {
205  if (0 == mp->br_paths[ii].afi)
206  {
207  clib_memcpy (&brpath->frp_addr.ip4,
208  mp->br_paths[ii].next_hop,
209  sizeof (brpath->frp_addr.ip4));
210  }
211  else
212  {
213  clib_memcpy (&brpath->frp_addr.ip6,
214  mp->br_paths[ii].next_hop,
215  sizeof (brpath->frp_addr.ip6));
216  }
217  if (ip46_address_is_zero(&brpath->frp_addr))
218  {
219  index_t bdti;
220 
221  bdti = bier_disp_table_find(ntohl(mp->br_paths[ii].table_id));
222 
223  if (INDEX_INVALID != bdti)
224  {
225  brpath->frp_fib_index = bdti;
226  brpath->frp_proto = DPO_PROTO_BIER;
227  }
228  else
229  {
230  rv = VNET_API_ERROR_NO_SUCH_FIB;
231  goto done;
232  }
233  }
234  }
235  }
236 
237  if (mp->br_is_add)
238  {
239  bier_table_route_add(&bti, bp, brpaths);
240  }
241  else
242  {
243  bier_table_route_remove(&bti, bp, brpaths);
244  }
245 
246 done:
247  vec_free(brpaths);
248  rv = (rv == 0) ? vnm->api_errno : rv;
249 
250  REPLY_MACRO (VL_API_BIER_ROUTE_ADD_DEL_REPLY);
251 }
252 
254 {
258 
259 static void
261  const bier_entry_t *be,
262  void *args)
263 {
264  fib_route_path_encode_t *api_rpaths = NULL, *api_rpath;
267  vl_api_fib_path3_t *fp;
268  u32 n_paths, m_size;
269 
271  m_size = sizeof(*mp) + (n_paths * sizeof(vl_api_fib_path3_t));
272  mp = vl_msg_api_alloc(m_size);
273  if (!mp)
274  return;
275 
276  memset(mp, 0, m_size);
277  mp->_vl_msg_id = ntohs(VL_API_BIER_ROUTE_DETAILS);
278  mp->context = ctx->context;
279 
280  mp->br_tbl_id.bt_set = bt->bt_id.bti_set;
283  mp->br_bp = htons(be->be_bp);
284  mp->br_n_paths = htonl(n_paths);
285 
287 
288  fp = mp->br_paths;
289  vec_foreach (api_rpath, api_rpaths)
290  {
291  fp->weight = api_rpath->rpath.frp_weight;
292  fp->preference = api_rpath->rpath.frp_preference;
293  fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
294  fp->n_labels = 0;
295  copy_fib_next_hop (api_rpath, fp);
296  fp++;
297  }
298 
299  vl_msg_api_send_shmem (ctx->q, (u8 *) & mp);
300 }
301 
302 static void
304 {
306 
308  if (q == 0)
309  return;
310 
311  bier_table_id_t bti = {
312  .bti_set = mp->br_tbl_id.bt_set,
313  .bti_sub_domain = mp->br_tbl_id.bt_sub_domain,
314  .bti_hdr_len = mp->br_tbl_id.bt_hdr_len_id,
315  .bti_type = BIER_TABLE_MPLS_SPF,
316  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
317  };
319  .q = q,
320  .context = mp->context,
321  };
323 }
324 
325 static void
327 {
329  vnet_main_t *vnm;
330  index_t bii;
331  int rv = 0;
332 
333  vnm = vnet_get_main ();
334  vnm->api_errno = 0;
335 
336  bier_table_id_t bti = {
337  .bti_set = mp->bi_tbl_id.bt_set,
338  .bti_sub_domain = mp->bi_tbl_id.bt_sub_domain,
339  .bti_hdr_len = mp->bi_tbl_id.bt_hdr_len_id,
340  .bti_type = BIER_TABLE_MPLS_SPF,
341  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
342  };
343  bier_bit_string_t bs = {
344  .bbs_len = mp->bi_n_bytes,
345  .bbs_buckets = mp->bi_bytes,
346  };
347 
348  bii = bier_imp_add_or_lock(&bti, ntohs(mp->bi_src), &bs);
349 
350  /* *INDENT-OFF* */
351  REPLY_MACRO2 (VL_API_BIER_IMP_ADD_REPLY,
352  ({
353  rmp->bi_index = ntohl (bii);
354  }));
355  /* *INDENT-OM* */
356 }
357 
358 static void
360 {
361  vl_api_bier_imp_del_reply_t *rmp;
362  vnet_main_t *vnm;
363  int rv = 0;
364 
365  vnm = vnet_get_main ();
366  vnm->api_errno = 0;
367 
368  bier_imp_unlock(ntohl(mp->bi_index));
369 
370  REPLY_MACRO(VL_API_BIER_IMP_DEL_REPLY);
371 }
372 
373 static void
375  u32 context,
376  const bier_imp_t *bi)
377 {
379  bier_hdr_t copy;
380  u8 n_bytes;
381 
382  copy = bi->bi_hdr;
383  bier_hdr_ntoh(&copy);
384 
386  bier_hdr_get_len_id(&copy));
387  mp = vl_msg_api_alloc(sizeof(*mp) + n_bytes);
388  if (!mp)
389  return;
390  memset(mp, 0, sizeof(*mp)+n_bytes);
391  mp->_vl_msg_id = ntohs(VL_API_BIER_IMP_DETAILS);
392  mp->context = context;
393 
394  mp->bi_tbl_id.bt_set = bi->bi_tbl.bti_set;
397 
398 
399  mp->bi_src = htons(bier_hdr_get_src_id(&copy));
400  mp->bi_n_bytes = n_bytes;
401  memcpy(mp->bi_bytes, bi->bi_bits.bits, n_bytes);
402 
403  vl_msg_api_send_shmem (q, (u8 *) & mp);
404 }
405 
406 static void
408 {
410  bier_imp_t *bi;
411 
413  if (q == 0)
414  return;
415 
417  ({
418  send_bier_imp_details(q, mp->context, bi);
419  }));
420 }
421 
422 static void
424 {
425  vl_api_bier_disp_table_add_del_reply_t *rmp;
426  vnet_main_t *vnm;
427  u32 table_id;
428  int rv;
429 
430  vnm = vnet_get_main ();
431  vnm->api_errno = 0;
432  table_id = ntohl(mp->bdt_tbl_id);
433 
434  if (mp->bdt_is_add)
435  {
436  bier_disp_table_add_or_lock(table_id);
437  }
438  else
439  {
441  }
442 
443  rv = vnm->api_errno;
444 
445  REPLY_MACRO (VL_API_BIER_DISP_TABLE_ADD_DEL_REPLY);
446 }
447 
448 static void
450  u32 context,
451  const bier_disp_table_t *bdt)
452 {
454 
455  mp = vl_msg_api_alloc(sizeof(*mp));
456  if (!mp)
457  return;
458  memset(mp, 0, sizeof(*mp));
459  mp->_vl_msg_id = ntohs(VL_API_BIER_DISP_TABLE_DETAILS);
460  mp->context = context;
461 
462  mp->bdt_tbl_id = htonl(bdt->bdt_table_id);
463 
464  vl_msg_api_send_shmem (q, (u8 *) & mp);
465 }
466 
467 static void
469 {
471  bier_disp_table_t *bdt;
472 
474  if (q == 0)
475  return;
476 
478  ({
480  }));
481 }
482 
483 static void
485 {
486  vl_api_bier_disp_entry_add_del_reply_t *rmp;
487  fib_route_path_t *brps = NULL, *brp;
488  vnet_main_t *vnm;
489  bier_bp_t bp;
490  u32 table_id;
491  int rv = 0;
492  u32 ii;
493 
494  vnm = vnet_get_main ();
495  vnm->api_errno = 0;
496  table_id = ntohl(mp->bde_tbl_id);
497  bp = ntohs(mp->bde_bp);
498 
499  /*
500  * BP=0 is the default route
501  */
502  if (bp > 0xffff)
503  {
504  rv = -1;
505  goto done;
506  }
507 
508  vec_validate(brps, mp->bde_n_paths - 1);
509  vec_foreach_index(ii, brps)
510  {
511  brp = &brps[ii];
512  brp->frp_fib_index = ntohl(mp->bde_paths[ii].table_id);
513  brp->frp_sw_if_index = ntohl(mp->bde_paths[ii].sw_if_index);
514 
515  if (~0 != ntohl(mp->bde_paths[ii].rpf_id))
516  {
517  brp->frp_flags = FIB_ROUTE_PATH_RPF_ID;
518  brp->frp_rpf_id = ntohl(mp->bde_paths[ii].rpf_id);
519  }
520 
521  if (0 == mp->bde_paths[ii].afi)
522  {
523  clib_memcpy (&brp->frp_addr.ip4,
524  mp->bde_paths[ii].next_hop,
525  sizeof (brp->frp_addr.ip4));
526  }
527  else
528  {
529  clib_memcpy (&brp->frp_addr.ip6,
530  mp->bde_paths[ii].next_hop,
531  sizeof (brp->frp_addr.ip6));
532  }
533  if (ip46_address_is_zero(&brp->frp_addr))
534  {
535  index_t fti;
536 
537  switch (mp->bde_payload_proto)
538  {
544  case BIER_HDR_PROTO_CTRL:
545  case BIER_HDR_PROTO_OAM:
546  rv = VNET_API_ERROR_UNSUPPORTED;
547  goto done;
548  break;
549  case BIER_HDR_PROTO_IPV4:
550  case BIER_HDR_PROTO_IPV6:
551  {
552  fib_protocol_t fproto;
553 
554  fproto = (mp->bde_payload_proto == BIER_HDR_PROTO_IPV4 ?
557 
558  if (brp->frp_flags & FIB_ROUTE_PATH_RPF_ID)
559  {
560  fti = mfib_table_find (fproto,
561  ntohl (mp->bde_paths[ii].table_id));
562  }
563  else
564  {
565  fti = fib_table_find (fproto,
566  ntohl (mp->bde_paths[ii].table_id));
567  }
568 
569  if (INDEX_INVALID != fti)
570  {
571  brp->frp_fib_index = fti;
572  }
573  else
574  {
575  rv = VNET_API_ERROR_NO_SUCH_FIB;
576  goto done;
577  }
578  break;
579  }
580  }
581  }
582  }
583 
584  if (mp->bde_is_add)
585  {
586  bier_disp_table_entry_path_add(table_id, bp,
587  mp->bde_payload_proto,
588  brps);
589  }
590  else
591  {
593  mp->bde_payload_proto,
594  brps);
595  }
596 
597 done:
598  vec_free(brps);
599  rv = (rv == 0) ? vnm->api_errno : rv;
600 
601  REPLY_MACRO (VL_API_BIER_DISP_ENTRY_ADD_DEL_REPLY);
602 }
603 
605 {
609 
610 static void
612  const bier_disp_entry_t *bde,
613  u16 bp,
614  void *args)
615 {
616  fib_route_path_encode_t *api_rpaths = NULL, *api_rpath;
619  bier_hdr_proto_id_t pproto;
620  vl_api_fib_path3_t *fp;
621  u32 n_paths, m_size;
622 
624  {
625  fib_node_index_t pl = bde->bde_pl[pproto];
626  if (INDEX_INVALID != pl)
627  {
628  n_paths = fib_path_list_get_n_paths(pl);
629  m_size = sizeof(*mp) + (n_paths * sizeof(vl_api_fib_path3_t));
630  mp = vl_msg_api_alloc(m_size);
631  if (!mp)
632  return;
633 
634  memset(mp, 0, m_size);
635  mp->_vl_msg_id = ntohs(VL_API_BIER_DISP_ENTRY_DETAILS);
636  mp->context = ctx->context;
637 
638  mp->bde_tbl_id = htonl(bdt->bdt_table_id);
639  mp->bde_n_paths = htonl(n_paths);
640  mp->bde_payload_proto = pproto;
641  mp->bde_bp = htons(bp);
642 
643  fib_path_list_walk(pl, fib_path_encode, &api_rpaths);
644 
645  fp = mp->bde_paths;
646  vec_foreach (api_rpath, api_rpaths)
647  {
648  fp->weight = api_rpath->rpath.frp_weight;
649  fp->preference = api_rpath->rpath.frp_preference;
650  fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
651  fp->n_labels = 0;
652  copy_fib_next_hop (api_rpath, fp);
653  fp++;
654  }
655 
656  vl_msg_api_send_shmem (ctx->q, (u8 *) & mp);
657  }
658  }
659 }
660 
661 static void
663 {
665 
667  if (q == 0)
668  return;
669 
671  .q = q,
672  .context = mp->context,
673  };
674  bier_disp_table_walk(ntohl(mp->bde_tbl_id),
676  &ctx);
677 }
678 
679 #define vl_msg_name_crc_list
680 #include <vnet/bier/bier.api.h>
681 #undef vl_msg_name_crc_list
682 
683 static void
685 {
686 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
687  foreach_vl_msg_name_crc_bier;
688 #undef _
689 }
690 
691 static clib_error_t *
693 {
694  api_main_t *am = &api_main;
695 
696 #define _(N,n) \
697  vl_msg_api_set_handlers(VL_API_##N, #n, \
698  vl_api_##n##_t_handler, \
699  vl_noop_handler, \
700  vl_api_##n##_t_endian, \
701  vl_api_##n##_t_print, \
702  sizeof(vl_api_##n##_t), 1);
704 #undef _
705 
706  /*
707  * Set up the (msg_name, crc, message-id) table
708  */
710 
711  return 0;
712 }
713 
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:432
static void vl_api_bier_imp_del_t_handler(vl_api_bier_imp_del_t *mp)
Definition: bier_api.c:359
#define vec_foreach_index(var, v)
Iterate over vector indices.
ip46_address_t frp_addr
The next-hop address.
Definition: fib_types.h:393
unix_shared_memory_queue_t * q
Definition: bier_api.c:606
A representation of a fib path for fib_path_encode to convey the information to the caller...
Definition: fib_types.h:486
static bier_hdr_len_id_t bier_hdr_get_len_id(const bier_hdr_t *bier_hdr)
fib_node_index_t bde_pl[BIER_HDR_N_PROTO]
The path-lists used by per-payload protocol parents.
struct bier_route_details_walk_t_ bier_route_details_walk_t
vl_api_bier_table_id_t bt_tbl_id
Definition: bier.api:63
A representation of a path as described by a route producer.
Definition: fib_types.h:377
static void vl_api_bier_table_dump_t_handler(vl_api_bier_table_dump_t *mp)
Definition: bier_api.c:131
vnet_main_t * vnet_get_main(void)
Definition: misc.c:47
static void vl_api_bier_table_add_del_t_handler(vl_api_bier_table_add_del_t *mp)
Definition: bier_api.c:67
Definition: bier_api.c:604
vl_api_bier_table_id_t bi_tbl_id
Definition: bier.api:149
#define REPLY_MACRO2(t, body)
#define NULL
Definition: clib.h:55
bier_disp_table_t * bier_disp_table_pool
memory pool for disposition tables
u32 mpls_label_t
A label value only, i.e.
Definition: packet.h:24
u32 bde_tbl_id
Definition: bier.api:238
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
static void setup_message_id_table(api_main_t *am)
Definition: bier_api.c:684
static void vl_api_bier_route_add_del_t_handler(vl_api_bier_route_add_del_t *mp)
Definition: bier_api.c:153
fib_node_index_t be_path_list
the FIB path-list this entry resolves through.
Definition: bier_entry.h:67
Reply for BIER route add / del request.
Definition: bier.api:160
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
bier_bit_mask_4096_t bi_bits
The bit string.
Definition: bier_imp.h:63
u8 bi_bytes[bi_n_bytes]
Definition: bier.api:193
void bier_disp_table_entry_path_remove(u32 table_id, bier_bp_t src, bier_hdr_proto_id_t payload_proto, const fib_route_path_t *rpath)
dpo_proto_t frp_proto
The protocol of the address below.
Definition: fib_types.h:382
u32 bier_hdr_len_id_to_num_bytes(bier_hdr_len_id_t id)
Definition: bier_types.c:66
static void send_bier_disp_table_details(unix_shared_memory_queue_t *q, u32 context, const bier_disp_table_t *bdt)
Definition: bier_api.c:449
static void send_bier_route_details(const bier_table_t *bt, const bier_entry_t *be, void *args)
Definition: bier_api.c:260
The ID of a table.
Definition: bier_types.h:446
void bier_disp_table_entry_path_add(u32 table_id, bier_bp_t src, bier_hdr_proto_id_t payload_proto, const fib_route_path_t *rpaths)
vl_api_bier_table_id_t br_tbl_id
Definition: bier.api:115
bier_bp_t be_bp
the bit position this entry represents.
Definition: bier_entry.h:61
bier_dispositon : The BIER dispositon object
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u16 bbs_len
The length of the string in BYTES.
Definition: bier_types.h:327
u16 bde_bp
Definition: bier.api:237
A Variable length BitString.
Definition: bier_types.h:323
A local path with a RPF-ID => multicast traffic.
Definition: fib_types.h:322
VLIB_API_INIT_FUNCTION(bier_api_hookup)
bier_bit_mask_bucket_t bits[BIER_HDR_BUCKETS_4096]
Definition: bier_types.h:300
bier_imposition : The BIER imposition object
Definition: bier_imp.h:34
u32 context
Definition: bier_api.c:607
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:438
u32 frp_sw_if_index
The interface.
Definition: fib_types.h:412
mpls_label_t * frp_label_stack
The outgoing MPLS label Stack.
Definition: fib_types.h:432
int bier_table_is_main(const bier_table_t *bt)
Definition: bier_table.c:53
bier_hdr_t bi_hdr
The Header to impose.
Definition: bier_imp.h:55
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:453
static clib_error_t * bier_api_hookup(vlib_main_t *vm)
Definition: bier_api.c:692
vl_api_bier_table_id_t bi_tbl_id
Definition: bier.api:190
A path via a UDP encap object.
Definition: fib_types.h:330
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: fib_table.c:1028
#define foreach_bier_api_msg
Definition: bier_api.c:53
Definition: bier.api:252
mpls_label_t bt_ll
Save the MPLS local label associated with the table.
Definition: bier_table.h:42
u32 bier_bp_t
A bit positon as assigned to egress PEs.
Definition: bier_types.h:346
void * vl_msg_api_alloc(int nbytes)
static void vl_api_bier_imp_dump_t_handler(vl_api_bier_imp_dump_t *mp)
Definition: bier_api.c:407
BIER Imposition Del.
Definition: bier.api:173
u16 bde_bp
Definition: bier.api:255
vnet_api_error_t api_errno
Definition: vnet.h:76
u32 context
Definition: bier.api:254
bier_hdr_len_id_t bti_hdr_len
The size of the bit string processed by this table.
Definition: bier_types.h:471
struct bier_disp_entry_details_walk_t_ bier_disp_entry_details_walk_t
static bier_hdr_src_id_t bier_hdr_get_src_id(const bier_hdr_t *bier_hdr)
index_t bier_table_add_or_lock(const bier_table_id_t *btid, mpls_label_t local_label)
Definition: bier_table.c:333
BIER Imposition Add.
Definition: bier.api:145
#define REPLY_MACRO(t)
BIER Table Add / del route.
Definition: bier.api:44
void bier_table_route_add(const bier_table_id_t *btid, bier_bp_t bp, fib_route_path_t *brps)
Definition: bier_table.c:513
vl_api_bier_table_id_t br_tbl_id
Definition: bier.api:132
index_t bier_imp_add_or_lock(const bier_table_id_t *bti, bier_bp_t sender, const bier_bit_string_t *bs)
Definition: bier_imp.c:60
static void vl_api_bier_route_dump_t_handler(vl_api_bier_route_dump_t *mp)
Definition: bier_api.c:303
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:198
BIER Disposition Table Add / del route.
Definition: bier.api:201
static void vl_api_bier_disp_entry_dump_t_handler(vl_api_bier_disp_entry_dump_t *mp)
Definition: bier_api.c:662
vl_api_fib_path3_t bde_paths[bde_n_paths]
Definition: bier.api:260
static void send_bier_imp_details(unix_shared_memory_queue_t *q, u32 context, const bier_imp_t *bi)
Definition: bier_api.c:374
static void vl_api_bier_disp_table_dump_t_handler(vl_api_bier_disp_table_dump_t *mp)
Definition: bier_api.c:468
api_main_t api_main
Definition: api_shared.c:35
vl_api_fib_path3_t br_paths[br_n_paths]
Definition: bier.api:117
vlib_main_t * vm
Definition: buffer.c:283
static void vl_api_bier_imp_add_t_handler(vl_api_bier_imp_add_t *mp)
Definition: bier_api.c:326
bier_imp_t * bier_imp_pool
bier_imposition : The BIER imposition object
Definition: bier_imp.c:33
#define MPLS_LABEL_INVALID
Definition: mpls_types.h:48
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
static void send_bier_disp_entry_details(const bier_disp_table_t *bdt, const bier_disp_entry_t *bde, u16 bp, void *args)
Definition: bier_api.c:611
#define clib_memcpy(a, b, c)
Definition: string.h:75
unix_shared_memory_queue_t * vl_api_client_index_to_input_queue(u32 index)
u32 fib_path_list_get_n_paths(fib_node_index_t path_list_index)
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
enum bier_hdr_proto_id_t_ bier_hdr_proto_id_t
BIER header protocol payload types.
index_t bier_disp_table_find(u32 table_id)
u8 bde_payload_proto
Definition: bier.api:258
void bier_table_walk(const bier_table_id_t *bti, bier_table_walk_fn_t fn, void *ctx)
Definition: bier_table.c:798
bier_table_t * bier_table_pool
Memory pool of all the allocated tables.
Definition: bier_table.c:32
static void send_bier_table_details(unix_shared_memory_queue_t *q, u32 context, const bier_table_t *bt)
Definition: bier_api.c:109
The BIER entry.
Definition: bier_entry.h:46
void vl_msg_api_send_shmem(unix_shared_memory_queue_t *q, u8 *elem)
void bier_table_unlock(const bier_table_id_t *bti)
Definition: bier_table.c:218
u32 label_stack[16]
Definition: bier.api:94
unsigned int u32
Definition: types.h:88
u8 bde_payload_proto
Definition: bier.api:240
long ctx[MAX_CONNS]
Definition: main.c:122
fib_path_list_walk_rc_t fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, void *ctx)
Definition: fib_path.c:2551
#define FOR_EACH_BIER_HDR_PROTO(_proto)
Definition: bier_types.h:201
fib_route_path_flags_t frp_flags
flags on the path
Definition: fib_types.h:469
vl_api_fib_path3_t bde_paths[bde_n_paths]
Definition: bier.api:242
u32 bde_tbl_id
Definition: bier.api:249
u32 context
Definition: bier.api:248
vl_api_bier_table_id_t br_tbl_id
Definition: bier.api:124
#define BIER_BP_MAX
The maximum BP that can be assigned.
Definition: bier_types.h:353
BIER Disposition Entry Add / del.
Definition: bier.api:233
bier_table_id_t bt_id
The identity/key or the table.
Definition: bier_table.h:75
static void vl_api_bier_disp_table_add_del_t_handler(vl_api_bier_disp_table_add_del_t *mp)
Definition: bier_api.c:423
unsigned short u16
Definition: types.h:57
A BIER header of variable length The encoding follows: https://tools.ietf.org/html/draft-ietf-bier-mp...
Definition: bier_types.h:373
unix_shared_memory_queue_t * q
Definition: bier_api.c:255
void bier_disp_table_unlock_w_table_id(u32 table_id)
unsigned char u8
Definition: types.h:56
u32 client_index
Definition: bier.api:247
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:47
void bier_table_route_remove(const bier_table_id_t *bti, bier_bp_t bp, fib_route_path_t *brps)
Definition: bier_table.c:565
A BIER Table is the bit-indexed forwarding table.
Definition: bier_table.h:38
u32 mfib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
Definition: mfib_table.c:409
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:460
u8 bi_bytes[bi_n_bytes]
Definition: bier.api:152
A protocol Independent IP multicast FIB table.
void copy_fib_next_hop(fib_route_path_encode_t *api_rpath, void *fp_arg)
Definition: ip_api.c:178
vl_api_bier_table_id_t bt_tbl_id
Definition: bier.api:48
#define BIER_ECMP_TABLE_ID_MAIN
Definition of the ID of the BIER main table.
Definition: bier_types.h:441
u8 bde_is_add
Definition: bier.api:239
FIB path.
Definition: bier.api:80
static void vl_api_bier_disp_entry_add_del_t_handler(vl_api_bier_disp_entry_add_del_t *mp)
Definition: bier_api.c:484
u8 bde_n_paths
Definition: bier.api:241
bier_table_id_t bi_tbl
The BIER table into which to forward the post imposed packet.
Definition: bier_imp.h:38
#define vec_foreach(var, vec)
Vector iterator.
void bier_disp_table_walk(u32 table_id, bier_disp_table_walk_fn_t fn, void *ctx)
Definition: bier.api:245
vl_api_fib_path3_t br_paths[br_n_paths]
Definition: bier.api:134
u8 next_hop[16]
Definition: bier.api:90
u32 frp_udp_encap_id
UDP encap ID.
Definition: fib_types.h:449
#define ip46_address_is_zero(ip46)
Definition: ip6_packet.h:81
void bier_imp_unlock(index_t bii)
Definition: bier_imp.c:110
u32 frp_fib_index
The FIB index to lookup the nexthop Only valid for recursive paths.
Definition: fib_types.h:423
static void bier_hdr_ntoh(bier_hdr_t *bier_hdr)
BIER over MPLS with SPF.
Definition: bier_types.h:37
BIER Route Add / del route.
Definition: bier.api:108
u32 bdt_table_id
Table ID (hash key) for this FIB.
struct _unix_shared_memory_queue unix_shared_memory_queue_t
u8 bde_n_paths
Definition: bier.api:259
u32 bde_tbl_id
Definition: bier.api:256
index_t bier_disp_table_add_or_lock(u32 table_id)