FD.io VPP  v18.10-34-gcce845e
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 #include <vnet/fib/fib_api.h>
53 
54 #define foreach_bier_api_msg \
55  _(BIER_TABLE_ADD_DEL, bier_table_add_del) \
56  _(BIER_TABLE_DUMP, bier_table_dump) \
57  _(BIER_ROUTE_ADD_DEL, bier_route_add_del) \
58  _(BIER_ROUTE_DUMP, bier_route_dump) \
59  _(BIER_IMP_ADD, bier_imp_add) \
60  _(BIER_IMP_DEL, bier_imp_del) \
61  _(BIER_IMP_DUMP, bier_imp_dump) \
62  _(BIER_DISP_TABLE_ADD_DEL, bier_disp_table_add_del) \
63  _(BIER_DISP_TABLE_DUMP, bier_disp_table_dump) \
64  _(BIER_DISP_ENTRY_ADD_DEL, bier_disp_entry_add_del) \
65  _(BIER_DISP_ENTRY_DUMP, bier_disp_entry_dump)
66 
67 static void
69 {
70  vl_api_bier_table_add_del_reply_t *rmp;
71  vnet_main_t *vnm;
72  int rv;
73 
74  vnm = vnet_get_main ();
75  vnm->api_errno = 0;
76 
78  {
79  rv = VNET_API_ERROR_BIER_BSL_UNSUP;
80  }
81  else
82  {
83  bier_table_id_t bti = {
84  .bti_set = mp->bt_tbl_id.bt_set,
85  .bti_sub_domain = mp->bt_tbl_id.bt_sub_domain,
86  .bti_hdr_len = mp->bt_tbl_id.bt_hdr_len_id,
87  .bti_type = BIER_TABLE_MPLS_SPF,
88  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
89  };
90 
91  if (mp->bt_is_add)
92  {
93  mpls_label_t label = ntohl(mp->bt_label);
94 
95  /*
96  * convert acceptable 'don't want a label' values from
97  * the API to the correct internal INVLID value
98  */
99  if ((0 == label) || (~0 == label))
100  {
101  label = MPLS_LABEL_INVALID;
102  }
103  bier_table_add_or_lock(&bti, label);
104  }
105  else
106  {
107  bier_table_unlock(&bti);
108  }
109 
110  rv = vnm->api_errno;
111  }
112 
113  REPLY_MACRO (VL_API_BIER_TABLE_ADD_DEL_REPLY);
114 }
115 
116 static void
118  u32 context,
119  const bier_table_t *bt)
120 {
122 
123  mp = vl_msg_api_alloc(sizeof(*mp));
124  if (!mp)
125  return;
126  memset(mp, 0, sizeof(*mp));
127  mp->_vl_msg_id = ntohs(VL_API_BIER_TABLE_DETAILS);
128  mp->context = context;
129 
130  mp->bt_label = bt->bt_ll;
131  mp->bt_tbl_id.bt_set = bt->bt_id.bti_set;
134 
135  vl_api_send_msg (reg, (u8 *) mp);
136 }
137 
138 static void
140 {
142  bier_table_t *bt;
143 
145  if (!reg)
146  return;
147 
149  ({
150  /*
151  * skip the ecmp tables.
152  */
153  if (bier_table_is_main(bt))
154  {
155  send_bier_table_details(reg, mp->context, bt);
156  }
157  }));
158 }
159 
160 static void
162 {
163  vl_api_bier_route_add_del_reply_t *rmp;
164  fib_route_path_t *brpaths, *brpath;
165  vnet_main_t *vnm;
166  bier_bp_t bp;
167  int rv = 0;
168  u8 ii;
169 
170  vnm = vnet_get_main ();
171  vnm->api_errno = 0;
172  bp = ntohl(mp->br_bp);
173  brpaths = NULL;
174 
176  {
177  rv = VNET_API_ERROR_BIER_BSL_UNSUP;
178  goto done;
179  }
180  if (0 == bp || bp > BIER_BP_MAX)
181  {
182  rv = -1;
183  goto done;
184  }
185 
186  bier_table_id_t bti = {
187  .bti_set = mp->br_tbl_id.bt_set,
188  .bti_sub_domain = mp->br_tbl_id.bt_sub_domain,
189  .bti_hdr_len = mp->br_tbl_id.bt_hdr_len_id,
190  .bti_type = BIER_TABLE_MPLS_SPF,
191  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
192  };
193 
194  vec_validate(brpaths, mp->br_n_paths - 1);
195 
196  vec_foreach_index(ii, brpaths)
197  {
198  brpath = &brpaths[ii];
199  rv = fib_path_api_parse(&mp->br_paths[ii], brpath);
200 
201  if (0 != rv)
202  {
203  goto done;
204  }
205  }
206 
207  if (mp->br_is_replace)
208  {
209  if (0 == vec_len(brpaths))
210  {
211  bier_table_route_delete(&bti, bp);
212  }
213  else
214  {
215  bier_table_route_path_update(&bti, bp, brpaths);
216  }
217  }
218  else if (mp->br_is_add)
219  {
220  bier_table_route_path_add(&bti, bp, brpaths);
221  }
222  else
223  {
224  bier_table_route_path_remove(&bti, bp, brpaths);
225  }
226  vec_free(brpaths);
227 
228 done:
229  rv = (rv == 0) ? vnm->api_errno : rv;
230 
231  REPLY_MACRO (VL_API_BIER_ROUTE_ADD_DEL_REPLY);
232 }
233 
235 {
239 
240 static void
242  const bier_entry_t *be,
243  void *args)
244 {
245  fib_route_path_encode_t *api_rpaths = NULL, *api_rpath;
248  vl_api_fib_path_t *fp;
249  u32 n_paths, m_size;
250 
252  m_size = sizeof(*mp) + (n_paths * sizeof(vl_api_fib_path_t));
253  mp = vl_msg_api_alloc(m_size);
254  if (!mp)
255  return;
256 
257  memset(mp, 0, m_size);
258  mp->_vl_msg_id = ntohs(VL_API_BIER_ROUTE_DETAILS);
259  mp->context = ctx->context;
260 
261  mp->br_tbl_id.bt_set = bt->bt_id.bti_set;
264  mp->br_bp = htons(be->be_bp);
265  mp->br_n_paths = htonl(n_paths);
266 
268 
269  fp = mp->br_paths;
270  vec_foreach (api_rpath, api_rpaths)
271  {
272  fib_api_path_encode(api_rpath, fp);
273  fp++;
274  }
275 
276  vl_api_send_msg (ctx->reg, (u8 *) mp);
277 }
278 
279 static void
281 {
283 
285  if (!reg)
286  return;
287 
288  bier_table_id_t bti = {
289  .bti_set = mp->br_tbl_id.bt_set,
290  .bti_sub_domain = mp->br_tbl_id.bt_sub_domain,
291  .bti_hdr_len = mp->br_tbl_id.bt_hdr_len_id,
292  .bti_type = BIER_TABLE_MPLS_SPF,
293  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
294  };
296  .reg = reg,
297  .context = mp->context,
298  };
300 }
301 
302 static void
304 {
306  vnet_main_t *vnm;
307  index_t bii = ~0;
308  int rv = 0;
309 
310  vnm = vnet_get_main ();
311  vnm->api_errno = 0;
312 
313  /*
314  * The BSL support by VPP is limited to the size of the
315  * available space in the vlib_buffer_t
316  */
318  {
319  rv = VNET_API_ERROR_BIER_BSL_UNSUP;
320  }
321  else
322  {
323  bier_table_id_t bti = {
324  .bti_set = mp->bi_tbl_id.bt_set,
325  .bti_sub_domain = mp->bi_tbl_id.bt_sub_domain,
326  .bti_hdr_len = mp->bi_tbl_id.bt_hdr_len_id,
327  .bti_type = BIER_TABLE_MPLS_SPF,
328  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
329  };
330  bier_bit_string_t bs = {
331  .bbs_len = mp->bi_n_bytes,
332  .bbs_buckets = mp->bi_bytes,
333  };
334 
335  bii = bier_imp_add_or_lock(&bti, ntohs(mp->bi_src), &bs);
336  }
337 
338  REPLY_MACRO2 (VL_API_BIER_IMP_ADD_REPLY,
339  ({
340  rmp->bi_index = ntohl (bii);
341  }));
342 }
343 
344 static void
346 {
347  vl_api_bier_imp_del_reply_t *rmp;
348  vnet_main_t *vnm;
349  int rv = 0;
350 
351  vnm = vnet_get_main ();
352  vnm->api_errno = 0;
353 
354  bier_imp_unlock(ntohl(mp->bi_index));
355 
356  REPLY_MACRO(VL_API_BIER_IMP_DEL_REPLY);
357 }
358 
359 static void
361  u32 context,
362  const bier_imp_t *bi)
363 {
365  bier_hdr_t copy;
366  u8 n_bytes;
367 
368  copy = bi->bi_hdr;
369  bier_hdr_ntoh(&copy);
370 
372  bier_hdr_get_len_id(&copy));
373  mp = vl_msg_api_alloc(sizeof(*mp) + n_bytes);
374  if (!mp)
375  return;
376  memset(mp, 0, sizeof(*mp)+n_bytes);
377  mp->_vl_msg_id = ntohs(VL_API_BIER_IMP_DETAILS);
378  mp->context = context;
379 
380  mp->bi_tbl_id.bt_set = bi->bi_tbl.bti_set;
383 
384  mp->bi_src = htons(bier_hdr_get_src_id(&copy));
385  mp->bi_n_bytes = n_bytes;
386  memcpy(mp->bi_bytes, bi->bi_bits, n_bytes);
387 
388  vl_api_send_msg (reg, (u8 *) mp);
389 }
390 
391 static void
393 {
395  bier_imp_t *bi;
396 
398  if (!reg)
399  return;
400 
402  ({
403  send_bier_imp_details(reg, mp->context, bi);
404  }));
405 }
406 
407 static void
409 {
410  vl_api_bier_disp_table_add_del_reply_t *rmp;
411  vnet_main_t *vnm;
412  u32 table_id;
413  int rv;
414 
415  vnm = vnet_get_main ();
416  vnm->api_errno = 0;
417  table_id = ntohl(mp->bdt_tbl_id);
418 
419  if (mp->bdt_is_add)
420  {
421  bier_disp_table_add_or_lock(table_id);
422  }
423  else
424  {
426  }
427 
428  rv = vnm->api_errno;
429 
430  REPLY_MACRO (VL_API_BIER_DISP_TABLE_ADD_DEL_REPLY);
431 }
432 
433 static void
435  u32 context,
436  const bier_disp_table_t *bdt)
437 {
439 
440  mp = vl_msg_api_alloc(sizeof(*mp));
441  if (!mp)
442  return;
443  memset(mp, 0, sizeof(*mp));
444  mp->_vl_msg_id = ntohs(VL_API_BIER_DISP_TABLE_DETAILS);
445  mp->context = context;
446 
447  mp->bdt_tbl_id = htonl(bdt->bdt_table_id);
448 
449  vl_api_send_msg (reg, (u8 *) mp);
450 }
451 
452 static void
454 {
456  bier_disp_table_t *bdt;
457 
459  if (!reg)
460  return;
461 
463  ({
464  send_bier_disp_table_details(reg, mp->context, bdt);
465  }));
466 }
467 
468 static void
470 {
471  vl_api_bier_disp_entry_add_del_reply_t *rmp;
472  fib_route_path_t *brps = NULL, *brp;
473  vnet_main_t *vnm;
474  bier_bp_t bp;
475  u32 table_id;
476  int rv = 0;
477  u32 ii;
478 
479  vnm = vnet_get_main ();
480  vnm->api_errno = 0;
481  table_id = ntohl(mp->bde_tbl_id);
482  bp = ntohs(mp->bde_bp);
483 
484  /*
485  * BP=0 is the default route
486  */
487  if (bp > 0xffff)
488  {
489  rv = -1;
490  goto done;
491  }
492 
493  vec_validate(brps, mp->bde_n_paths - 1);
494  vec_foreach_index(ii, brps)
495  {
496  brp = &brps[ii];
497  brp->frp_fib_index = ntohl(mp->bde_paths[ii].table_id);
498  brp->frp_sw_if_index = ntohl(mp->bde_paths[ii].sw_if_index);
499 
500  if (~0 != ntohl(mp->bde_paths[ii].rpf_id))
501  {
502  brp->frp_flags = FIB_ROUTE_PATH_RPF_ID;
503  brp->frp_rpf_id = ntohl(mp->bde_paths[ii].rpf_id);
504  }
505 
506  if (0 == mp->bde_paths[ii].afi)
507  {
508  clib_memcpy (&brp->frp_addr.ip4,
509  mp->bde_paths[ii].next_hop,
510  sizeof (brp->frp_addr.ip4));
511  }
512  else
513  {
514  clib_memcpy (&brp->frp_addr.ip6,
515  mp->bde_paths[ii].next_hop,
516  sizeof (brp->frp_addr.ip6));
517  }
518  if (ip46_address_is_zero(&brp->frp_addr))
519  {
520  index_t fti;
521 
522  switch (mp->bde_payload_proto)
523  {
529  case BIER_HDR_PROTO_CTRL:
530  case BIER_HDR_PROTO_OAM:
531  rv = VNET_API_ERROR_UNSUPPORTED;
532  goto done;
533  break;
534  case BIER_HDR_PROTO_IPV4:
535  case BIER_HDR_PROTO_IPV6:
536  {
537  fib_protocol_t fproto;
538 
539  fproto = (mp->bde_payload_proto == BIER_HDR_PROTO_IPV4 ?
542 
543  if (brp->frp_flags & FIB_ROUTE_PATH_RPF_ID)
544  {
545  fti = mfib_table_find (fproto,
546  ntohl (mp->bde_paths[ii].table_id));
547  }
548  else
549  {
550  fti = fib_table_find (fproto,
551  ntohl (mp->bde_paths[ii].table_id));
552  }
553 
554  if (INDEX_INVALID != fti)
555  {
556  brp->frp_fib_index = fti;
557  }
558  else
559  {
560  rv = VNET_API_ERROR_NO_SUCH_FIB;
561  goto done;
562  }
563  break;
564  }
565  }
566  }
567  }
568 
569  if (mp->bde_is_add)
570  {
571  bier_disp_table_entry_path_add(table_id, bp,
572  mp->bde_payload_proto,
573  brps);
574  }
575  else
576  {
578  mp->bde_payload_proto,
579  brps);
580  }
581 
582 done:
583  vec_free(brps);
584  rv = (rv == 0) ? vnm->api_errno : rv;
585 
586  REPLY_MACRO (VL_API_BIER_DISP_ENTRY_ADD_DEL_REPLY);
587 }
588 
590 {
594 
595 static void
597  const bier_disp_entry_t *bde,
598  u16 bp,
599  void *args)
600 {
601  fib_route_path_encode_t *api_rpaths = NULL, *api_rpath;
604  bier_hdr_proto_id_t pproto;
605  vl_api_fib_path_t *fp;
606  u32 n_paths, m_size;
607 
609  {
610  fib_node_index_t pl = bde->bde_pl[pproto];
611  if (INDEX_INVALID != pl)
612  {
613  n_paths = fib_path_list_get_n_paths(pl);
614  m_size = sizeof(*mp) + (n_paths * sizeof(vl_api_fib_path_t));
615  mp = vl_msg_api_alloc(m_size);
616  if (!mp)
617  return;
618 
619  memset(mp, 0, m_size);
620  mp->_vl_msg_id = ntohs(VL_API_BIER_DISP_ENTRY_DETAILS);
621  mp->context = ctx->context;
622 
623  mp->bde_tbl_id = htonl(bdt->bdt_table_id);
624  mp->bde_n_paths = htonl(n_paths);
625  mp->bde_payload_proto = pproto;
626  mp->bde_bp = htons(bp);
627 
628  fib_path_list_walk(pl, fib_path_encode, &api_rpaths);
629 
630  fp = mp->bde_paths;
631  vec_foreach (api_rpath, api_rpaths)
632  {
633  fib_api_path_encode(api_rpath, fp);
634  fp++;
635  }
636 
637  vl_api_send_msg (ctx->reg, (u8 *) mp);
638  }
639  }
640 }
641 
642 static void
644 {
646 
648  if (!reg)
649  return;
650 
652  .reg = reg,
653  .context = mp->context,
654  };
655  bier_disp_table_walk(ntohl(mp->bde_tbl_id),
657  &ctx);
658 }
659 
660 #define vl_msg_name_crc_list
661 #include <vnet/bier/bier.api.h>
662 #undef vl_msg_name_crc_list
663 
664 static void
666 {
667 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
668  foreach_vl_msg_name_crc_bier;
669 #undef _
670 }
671 
672 static clib_error_t *
674 {
675  api_main_t *am = &api_main;
676 
677 #define _(N,n) \
678  vl_msg_api_set_handlers(VL_API_##N, #n, \
679  vl_api_##n##_t_handler, \
680  vl_noop_handler, \
681  vl_api_##n##_t_endian, \
682  vl_api_##n##_t_print, \
683  sizeof(vl_api_##n##_t), 1);
685 #undef _
686 
687  /*
688  * Set up the (msg_name, crc, message-id) table
689  */
691 
692  return 0;
693 }
694 
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:437
static void vl_api_bier_imp_del_t_handler(vl_api_bier_imp_del_t *mp)
Definition: bier_api.c:345
#define vec_foreach_index(var, v)
Iterate over vector indices.
A representation of a fib path for fib_path_encode to convey the information to the caller...
Definition: fib_types.h:584
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:64
A representation of a path as described by a route producer.
Definition: fib_types.h:470
vl_api_fib_path_t br_paths[br_n_paths]
Definition: bier.api:89
static void vl_api_bier_table_dump_t_handler(vl_api_bier_table_dump_t *mp)
Definition: bier_api.c:139
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:68
Definition: bier_api.c:589
vl_api_bier_table_id_t bi_tbl_id
Definition: bier.api:122
#define REPLY_MACRO2(t, body)
#define NULL
Definition: clib.h:57
bier_disp_table_t * bier_disp_table_pool
memory pool for disposition tables
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:34
u32 mpls_label_t
A label value only, i.e.
Definition: packet.h:24
u32 bde_tbl_id
Definition: bier.api:210
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:665
static void vl_api_bier_route_add_del_t_handler(vl_api_bier_route_add_del_t *mp)
Definition: bier_api.c:161
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:133
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
u8 bi_bytes[bi_n_bytes]
Definition: bier.api:165
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)
u32 bier_hdr_len_id_to_num_bytes(bier_hdr_len_id_t id)
Definition: bier_types.c:66
static void send_bier_route_details(const bier_table_t *bt, const bier_entry_t *be, void *args)
Definition: bier_api.c:241
The ID of a table.
Definition: bier_types.h:394
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)
void * vl_msg_api_alloc(int nbytes)
vl_api_bier_table_id_t br_tbl_id
Definition: bier.api:87
bier_bp_t be_bp
the bit position this entry represents.
Definition: bier_entry.h:61
bier_dispositon : The BIER dispositon object
unsigned char u8
Definition: types.h:56
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u16 bbs_len
The length of the string in BYTES.
Definition: bier_types.h:282
u16 bde_bp
Definition: bier.api:209
A Variable length BitString.
Definition: bier_types.h:278
A local path with a RPF-ID => multicast traffic.
Definition: fib_types.h:353
memset(h->entries, 0, sizeof(h->entries[0])*entries)
VLIB_API_INIT_FUNCTION(bier_api_hookup)
bier_imposition : The BIER imposition object
Definition: bier_imp.h:34
u32 context
Definition: bier_api.c:592
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:443
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:50
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
static clib_error_t * bier_api_hookup(vlib_main_t *vm)
Definition: bier_api.c:673
void bier_table_route_path_remove(const bier_table_id_t *btid, bier_bp_t bp, fib_route_path_t *brps)
Definition: bier_table.c:658
vl_api_bier_table_id_t bi_tbl_id
Definition: bier.api:162
unsigned int u32
Definition: types.h:88
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:1064
#define foreach_bier_api_msg
Definition: bier_api.c:54
Definition: bier.api:224
mpls_label_t bt_ll
Save the MPLS local label associated with the table.
Definition: bier_table.h:48
u32 bier_bp_t
A bit positon as assigned to egress PEs.
Definition: bier_types.h:294
static void vl_api_bier_imp_dump_t_handler(vl_api_bier_imp_dump_t *mp)
Definition: bier_api.c:392
BIER Imposition Del.
Definition: bier.api:146
u16 bde_bp
Definition: bier.api:227
vnet_api_error_t api_errno
Definition: vnet.h:78
Bit-string lengths greater than 1024 are not supported due to the limited about pf space available in...
Definition: bier_types.h:64
u32 context
Definition: bier.api:226
bier_hdr_len_id_t bti_hdr_len
The size of the bit string processed by this table.
Definition: bier_types.h:419
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)
long ctx[MAX_CONNS]
Definition: main.c:144
unsigned short u16
Definition: types.h:57
index_t bier_table_add_or_lock(const bier_table_id_t *btid, mpls_label_t local_label)
Definition: bier_table.c:397
BIER Imposition Add.
Definition: bier.api:118
vl_api_registration_t * reg
Definition: bier_api.c:236
#define REPLY_MACRO(t)
static void send_bier_imp_details(vl_api_registration_t *reg, u32 context, const bier_imp_t *bi)
Definition: bier_api.c:360
BIER Table Add / del route.
Definition: bier.api:45
vl_api_fib_path_t bde_paths[bde_n_paths]
Definition: bier.api:214
vl_api_bier_table_id_t br_tbl_id
Definition: bier.api:103
vl_api_fib_path_t br_paths[br_n_paths]
Definition: bier.api:105
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:280
API main structure, used by both vpp and binary API clients.
Definition: api_common.h:201
BIER Disposition Table Add / del route.
Definition: bier.api:173
static void vl_api_bier_disp_entry_dump_t_handler(vl_api_bier_disp_entry_dump_t *mp)
Definition: bier_api.c:643
An API client registration, only in vpp/vlib.
Definition: api_common.h:44
static void vl_api_bier_disp_table_dump_t_handler(vl_api_bier_disp_table_dump_t *mp)
Definition: bier_api.c:453
vlib_main_t * vm
Definition: buffer.c:294
static void vl_api_bier_imp_add_t_handler(vl_api_bier_imp_add_t *mp)
Definition: bier_api.c:303
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:339
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:596
#define clib_memcpy(a, b, c)
Definition: string.h:75
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:30
enum bier_hdr_proto_id_t_ bier_hdr_proto_id_t
BIER header protocol payload types.
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:56
u8 bde_payload_proto
Definition: bier.api:230
void bier_table_walk(const bier_table_id_t *bti, bier_table_walk_fn_t fn, void *ctx)
Definition: bier_table.c:925
bier_table_t * bier_table_pool
Memory pool of all the allocated tables.
Definition: bier_table.c:32
The BIER entry.
Definition: bier_entry.h:46
void bier_table_unlock(const bier_table_id_t *bti)
Definition: bier_table.c:218
vl_api_fib_path_t bde_paths[bde_n_paths]
Definition: bier.api:232
static void send_bier_table_details(vl_api_registration_t *reg, u32 context, const bier_table_t *bt)
Definition: bier_api.c:117
u8 bde_payload_proto
Definition: bier.api:212
void bier_table_route_delete(const bier_table_id_t *btid, bier_bp_t bp)
Definition: bier_table.c:633
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:2592
FIB path.
Definition: fib_types.api:47
#define FOR_EACH_BIER_HDR_PROTO(_proto)
Definition: bier_types.h:206
u32 bde_tbl_id
Definition: bier.api:221
void fib_api_path_encode(const fib_route_path_encode_t *api_rpath, vl_api_fib_path_t *out)
Definition: fib_api.c:217
u32 context
Definition: bier.api:220
vl_api_bier_table_id_t br_tbl_id
Definition: bier.api:96
#define BIER_BP_MAX
The maximum BP that can be assigned.
Definition: bier_types.h:301
vl_api_registration_t * reg
Definition: bier_api.c:591
BIER Disposition Entry Add / del.
Definition: bier.api:205
bier_table_id_t bt_id
The identity/key or the table.
Definition: bier_table.h:76
u8 bi_bits[BIER_HDR_BUCKETS_1024]
The bit string.
Definition: bier_imp.h:58
static void vl_api_bier_disp_table_add_del_t_handler(vl_api_bier_disp_table_add_del_t *mp)
Definition: bier_api.c:408
A BIER header of variable length The encoding follows: https://tools.ietf.org/html/draft-ietf-bier-mp...
Definition: bier_types.h:321
void bier_disp_table_unlock_w_table_id(u32 table_id)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 client_index
Definition: bier.api:219
void bier_table_route_path_add(const bier_table_id_t *btid, bier_bp_t bp, fib_route_path_t *brps)
Definition: bier_table.c:625
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:47
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:408
u8 bi_bytes[bi_n_bytes]
Definition: bier.api:125
static void send_bier_disp_table_details(vl_api_registration_t *reg, u32 context, const bier_disp_table_t *bdt)
Definition: bier_api.c:434
A protocol Independent IP multicast FIB table.
vl_api_bier_table_id_t bt_tbl_id
Definition: bier.api:49
#define BIER_ECMP_TABLE_ID_MAIN
Definition of the ID of the BIER main table.
Definition: bier_types.h:389
u8 bde_is_add
Definition: bier.api:211
int fib_path_api_parse(const vl_api_fib_path_t *in, fib_route_path_t *out)
Definition: fib_api.c:42
static void vl_api_bier_disp_entry_add_del_t_handler(vl_api_bier_disp_entry_add_del_t *mp)
Definition: bier_api.c:469
u8 bde_n_paths
Definition: bier.api:213
bier_table_id_t bi_tbl
The BIER table into which to forward the post imposed packet.
Definition: bier_imp.h:63
#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:217
#define ip46_address_is_zero(ip46)
Definition: ip6_packet.h:93
api_main_t api_main
Definition: api_shared.c:35
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:516
static void bier_hdr_ntoh(bier_hdr_t *bier_hdr)
void bier_table_route_path_update(const bier_table_id_t *btid, bier_bp_t bp, fib_route_path_t *brps)
Definition: bier_table.c:618
BIER over MPLS with SPF.
Definition: bier_types.h:37
BIER Route Add / del route.
Definition: bier.api:80
u32 bdt_table_id
Table ID (hash key) for this FIB.
u8 bde_n_paths
Definition: bier.api:231
u32 bde_tbl_id
Definition: bier.api:228
index_t bier_disp_table_add_or_lock(u32 table_id)