FD.io VPP  v21.10.1-2-g0a485f517
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/format_fns.h>
36 #include <bier/bier.api_enum.h>
37 #include <bier/bier.api_types.h>
38 
39 #define REPLY_MSG_ID_BASE bier_main.msg_id_base
41 
42 typedef struct
43 {
45 } bier_main_t;
46 
48 
49 static void
51 {
52  vl_api_bier_table_add_del_reply_t *rmp;
53  vnet_main_t *vnm;
54  int rv;
55 
56  vnm = vnet_get_main ();
57  vnm->api_errno = 0;
58 
59  if (mp->bt_tbl_id.bt_hdr_len_id >= BIER_HDR_LEN_2048)
60  {
61  rv = VNET_API_ERROR_BIER_BSL_UNSUP;
62  }
63  else
64  {
65  bier_table_id_t bti = {
66  .bti_set = mp->bt_tbl_id.bt_set,
67  .bti_sub_domain = mp->bt_tbl_id.bt_sub_domain,
68  .bti_hdr_len = mp->bt_tbl_id.bt_hdr_len_id,
69  .bti_type = BIER_TABLE_MPLS_SPF,
70  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
71  };
72 
73  if (mp->bt_is_add)
74  {
75  mpls_label_t label = ntohl(mp->bt_label);
76 
77  /*
78  * convert acceptable 'don't want a label' values from
79  * the API to the correct internal INVLID value
80  */
81  if ((0 == label) || (~0 == label))
82  {
84  }
86  }
87  else
88  {
89  bier_table_unlock(&bti);
90  }
91 
92  rv = vnm->api_errno;
93  }
94 
95  REPLY_MACRO (VL_API_BIER_TABLE_ADD_DEL_REPLY);
96 }
97 
98 static void
100  u32 context,
101  const bier_table_t *bt)
102 {
104 
105  mp = vl_msg_api_alloc(sizeof(*mp));
106  if (!mp)
107  return;
108  clib_memset(mp, 0, sizeof(*mp));
109  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_BIER_TABLE_DETAILS);
110  mp->context = context;
111 
112  mp->bt_label = bt->bt_ll;
113  mp->bt_tbl_id.bt_set = bt->bt_id.bti_set;
114  mp->bt_tbl_id.bt_sub_domain = bt->bt_id.bti_sub_domain;
115  mp->bt_tbl_id.bt_hdr_len_id = bt->bt_id.bti_hdr_len;
116 
117  vl_api_send_msg (reg, (u8 *) mp);
118 }
119 
120 static void
122 {
124  bier_table_t *bt;
125 
127  if (!reg)
128  return;
129 
131  {
132  /*
133  * skip the ecmp tables.
134  */
135  if (bier_table_is_main(bt))
136  {
137  send_bier_table_details(reg, mp->context, bt);
138  }
139  }
140 }
141 
142 static void
144 {
145  vl_api_bier_route_add_del_reply_t *rmp;
146  fib_route_path_t *brpaths, *brpath;
147  vnet_main_t *vnm;
148  bier_bp_t bp;
149  int rv = 0;
150  u8 ii;
151 
152  vnm = vnet_get_main ();
153  vnm->api_errno = 0;
154  bp = ntohl(mp->br_route.br_bp);
155  brpaths = NULL;
156 
157  if (mp->br_route.br_tbl_id.bt_hdr_len_id >= BIER_HDR_LEN_2048)
158  {
159  rv = VNET_API_ERROR_BIER_BSL_UNSUP;
160  goto done;
161  }
162  if (0 == bp || bp > BIER_BP_MAX)
163  {
164  rv = -1;
165  goto done;
166  }
167 
168  bier_table_id_t bti = {
169  .bti_set = mp->br_route.br_tbl_id.bt_set,
170  .bti_sub_domain = mp->br_route.br_tbl_id.bt_sub_domain,
171  .bti_hdr_len = mp->br_route.br_tbl_id.bt_hdr_len_id,
172  .bti_type = BIER_TABLE_MPLS_SPF,
173  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
174  };
175 
176  vec_validate(brpaths, mp->br_route.br_n_paths - 1);
177 
178  vec_foreach_index(ii, brpaths)
179  {
180  brpath = &brpaths[ii];
181  rv = fib_api_path_decode(&mp->br_route.br_paths[ii], brpath);
182 
183  if (0 != rv)
184  {
185  goto done;
186  }
187  }
188 
189  if (mp->br_is_replace)
190  {
191  if (0 == vec_len(brpaths))
192  {
193  bier_table_route_delete(&bti, bp);
194  }
195  else
196  {
197  bier_table_route_path_update(&bti, bp, brpaths);
198  }
199  }
200  else if (mp->br_is_add)
201  {
202  bier_table_route_path_add(&bti, bp, brpaths);
203  }
204  else
205  {
206  bier_table_route_path_remove(&bti, bp, brpaths);
207  }
208  vec_free(brpaths);
209 
210 done:
211  rv = (rv == 0) ? vnm->api_errno : rv;
212 
213  REPLY_MACRO (VL_API_BIER_ROUTE_ADD_DEL_REPLY);
214 }
215 
217 {
221 
222 static void
224  const bier_entry_t *be,
225  void *args)
226 {
229  fib_path_encode_ctx_t path_ctx = {
230  .rpaths = NULL,
231  };
232  fib_route_path_t *rpath;
233  vl_api_fib_path_t *fp;
234  u32 n_paths, m_size;
235 
237  m_size = sizeof(*mp) + (n_paths * sizeof(vl_api_fib_path_t));
238  mp = vl_msg_api_alloc(m_size);
239  if (!mp)
240  return;
241 
242  clib_memset(mp, 0, m_size);
243  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_BIER_ROUTE_DETAILS);
244  mp->context = ctx->context;
245 
246  mp->br_route.br_tbl_id.bt_set = bt->bt_id.bti_set;
247  mp->br_route.br_tbl_id.bt_sub_domain = bt->bt_id.bti_sub_domain;
248  mp->br_route.br_tbl_id.bt_hdr_len_id = bt->bt_id.bti_hdr_len;
249  mp->br_route.br_bp = htonl(be->be_bp);
250  mp->br_route.br_n_paths = htonl(n_paths);
251 
253  NULL,
255  &path_ctx);
256 
257  fp = mp->br_route.br_paths;
258  vec_foreach (rpath, path_ctx.rpaths)
259  {
260  fib_api_path_encode(rpath, fp);
261  fp++;
262  }
263 
264  vec_free(path_ctx.rpaths);
265  vl_api_send_msg (ctx->reg, (u8 *) mp);
266 }
267 
268 static void
270 {
272 
274  if (!reg)
275  return;
276 
277  bier_table_id_t bti = {
278  .bti_set = mp->br_tbl_id.bt_set,
279  .bti_sub_domain = mp->br_tbl_id.bt_sub_domain,
280  .bti_hdr_len = mp->br_tbl_id.bt_hdr_len_id,
281  .bti_type = BIER_TABLE_MPLS_SPF,
282  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
283  };
285  .reg = reg,
286  .context = mp->context,
287  };
289 }
290 
291 static void
293 {
295  vnet_main_t *vnm;
296  index_t bii = ~0;
297  int rv = 0;
298 
299  vnm = vnet_get_main ();
300  vnm->api_errno = 0;
301 
302  /*
303  * The BSL support by VPP is limited to the size of the
304  * available space in the vlib_buffer_t
305  */
306  if (mp->bi_tbl_id.bt_hdr_len_id >= BIER_HDR_LEN_2048)
307  {
308  rv = VNET_API_ERROR_BIER_BSL_UNSUP;
309  }
310  else
311  {
312  bier_table_id_t bti = {
313  .bti_set = mp->bi_tbl_id.bt_set,
314  .bti_sub_domain = mp->bi_tbl_id.bt_sub_domain,
315  .bti_hdr_len = mp->bi_tbl_id.bt_hdr_len_id,
316  .bti_type = BIER_TABLE_MPLS_SPF,
317  .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
318  };
319  bier_bit_string_t bs = {
320  .bbs_len = mp->bi_n_bytes,
321  .bbs_buckets = mp->bi_bytes,
322  };
323 
324  bii = bier_imp_add_or_lock(&bti, ntohs(mp->bi_src), &bs);
325  }
326 
327  REPLY_MACRO2 (VL_API_BIER_IMP_ADD_REPLY,
328  ({
329  rmp->bi_index = ntohl (bii);
330  }));
331 }
332 
333 static void
335 {
336  vl_api_bier_imp_del_reply_t *rmp;
337  vnet_main_t *vnm;
338  int rv = 0;
339 
340  vnm = vnet_get_main ();
341  vnm->api_errno = 0;
342 
343  bier_imp_unlock(ntohl(mp->bi_index));
344 
345  REPLY_MACRO(VL_API_BIER_IMP_DEL_REPLY);
346 }
347 
348 static void
350  u32 context,
351  const bier_imp_t *bi)
352 {
354  bier_hdr_t copy;
355  u8 n_bytes;
356 
357  copy = bi->bi_hdr;
358  bier_hdr_ntoh(&copy);
359 
361  bier_hdr_get_len_id(&copy));
362  mp = vl_msg_api_alloc(sizeof(*mp) + n_bytes);
363  if (!mp)
364  return;
365  clib_memset(mp, 0, sizeof(*mp)+n_bytes);
366  mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_BIER_IMP_DETAILS);
367  mp->context = context;
368 
369  mp->bi_tbl_id.bt_set = bi->bi_tbl.bti_set;
370  mp->bi_tbl_id.bt_sub_domain = bi->bi_tbl.bti_sub_domain;
371  mp->bi_tbl_id.bt_hdr_len_id = bi->bi_tbl.bti_hdr_len;
372 
373  mp->bi_src = htons(bier_hdr_get_src_id(&copy));
374  mp->bi_n_bytes = n_bytes;
375  memcpy(mp->bi_bytes, bi->bi_bits, n_bytes);
376 
377  vl_api_send_msg (reg, (u8 *) mp);
378 }
379 
380 static void
382 {
384  bier_imp_t *bi;
385 
387  if (!reg)
388  return;
389 
391  {
392  send_bier_imp_details(reg, mp->context, bi);
393  }
394 }
395 
396 static void
398 {
399  vl_api_bier_disp_table_add_del_reply_t *rmp;
400  vnet_main_t *vnm;
401  u32 table_id;
402  int rv;
403 
404  vnm = vnet_get_main ();
405  vnm->api_errno = 0;
406  table_id = ntohl(mp->bdt_tbl_id);
407 
408  if (mp->bdt_is_add)
409  {
411  }
412  else
413  {
415  }
416 
417  rv = vnm->api_errno;
418 
419  REPLY_MACRO (VL_API_BIER_DISP_TABLE_ADD_DEL_REPLY);
420 }
421 
422 static void
424  u32 context,
425  const bier_disp_table_t *bdt)
426 {
428 
429  mp = vl_msg_api_alloc(sizeof(*mp));
430  if (!mp)
431  return;
432  clib_memset(mp, 0, sizeof(*mp));
433  mp->_vl_msg_id =
434  ntohs (REPLY_MSG_ID_BASE + VL_API_BIER_DISP_TABLE_DETAILS);
435  mp->context = context;
436 
437  mp->bdt_tbl_id = htonl(bdt->bdt_table_id);
438 
439  vl_api_send_msg (reg, (u8 *) mp);
440 }
441 
442 static void
444 {
446  bier_disp_table_t *bdt;
447 
449  if (!reg)
450  return;
451 
453  {
454  send_bier_disp_table_details(reg, mp->context, bdt);
455  }
456 }
457 
458 static void
460 {
461  vl_api_bier_disp_entry_add_del_reply_t *rmp;
462  fib_route_path_t *brps = NULL, *brp;
463  vnet_main_t *vnm;
464  bier_bp_t bp;
465  u32 table_id;
466  int rv = 0;
467  u32 ii;
468 
469  vnm = vnet_get_main ();
470  vnm->api_errno = 0;
471  table_id = ntohl(mp->bde_tbl_id);
472  bp = ntohs(mp->bde_bp);
473 
474  /*
475  * BP=0 is the default route
476  */
477  if (bp > 0xffff)
478  {
479  rv = -1;
480  goto done;
481  }
482 
483  vec_validate(brps, mp->bde_n_paths - 1);
484  vec_foreach_index(ii, brps)
485  {
486  brp = &brps[ii];
487  brp->frp_fib_index = ntohl(mp->bde_paths[ii].table_id);
488  brp->frp_sw_if_index = ntohl(mp->bde_paths[ii].sw_if_index);
489 
490  if (~0 != ntohl(mp->bde_paths[ii].rpf_id))
491  {
492  brp->frp_flags = FIB_ROUTE_PATH_RPF_ID;
493  brp->frp_rpf_id = ntohl(mp->bde_paths[ii].rpf_id);
494  }
495 
496  if (FIB_API_PATH_NH_PROTO_IP4 == mp->bde_paths[ii].proto)
497  {
498  clib_memcpy (&brp->frp_addr.ip4,
499  &mp->bde_paths[ii].nh.address.ip4,
500  sizeof (brp->frp_addr.ip4));
501  }
502  else if (FIB_API_PATH_NH_PROTO_IP6 == mp->bde_paths[ii].proto)
503  {
504  clib_memcpy (&brp->frp_addr.ip6,
505  &mp->bde_paths[ii].nh.address.ip6,
506  sizeof (brp->frp_addr.ip6));
507  }
508  if (ip46_address_is_zero(&brp->frp_addr))
509  {
510  index_t fti;
511 
512  switch (mp->bde_payload_proto)
513  {
519  case BIER_HDR_PROTO_CTRL:
520  case BIER_HDR_PROTO_OAM:
521  rv = VNET_API_ERROR_UNSUPPORTED;
522  goto done;
523  break;
524  case BIER_HDR_PROTO_IPV4:
525  case BIER_HDR_PROTO_IPV6:
526  {
527  fib_protocol_t fproto;
528 
529  fproto = (mp->bde_payload_proto == BIER_HDR_PROTO_IPV4 ?
532 
533  if (brp->frp_flags & FIB_ROUTE_PATH_RPF_ID)
534  {
535  fti = mfib_table_find (fproto,
536  ntohl (mp->bde_paths[ii].table_id));
537  }
538  else
539  {
540  fti = fib_table_find (fproto,
541  ntohl (mp->bde_paths[ii].table_id));
542  }
543 
544  if (INDEX_INVALID != fti)
545  {
546  brp->frp_fib_index = fti;
547  }
548  else
549  {
550  rv = VNET_API_ERROR_NO_SUCH_FIB;
551  goto done;
552  }
553  break;
554  }
555  }
556  }
557  }
558 
559  if (mp->bde_is_add)
560  {
562  mp->bde_payload_proto,
563  brps);
564  }
565  else
566  {
568  mp->bde_payload_proto,
569  brps);
570  }
571 
572 done:
573  vec_free(brps);
574  rv = (rv == 0) ? vnm->api_errno : rv;
575 
576  REPLY_MACRO (VL_API_BIER_DISP_ENTRY_ADD_DEL_REPLY);
577 }
578 
580 {
584 
585 static void
587  const bier_disp_entry_t *bde,
588  u16 bp,
589  void *args)
590 {
593  bier_hdr_proto_id_t pproto;
594  vl_api_fib_path_t *fp;
595  u32 n_paths, m_size;
596 
598  {
599  fib_node_index_t pl = bde->bde_pl[pproto];
600 
601  if (INDEX_INVALID != pl)
602  {
603  fib_path_encode_ctx_t path_ctx = {
604  .rpaths = NULL,
605  };
606  fib_route_path_t *rpath;
607 
609  m_size = sizeof(*mp) + (n_paths * sizeof(vl_api_fib_path_t));
610  mp = vl_msg_api_alloc(m_size);
611  if (!mp)
612  return;
613 
614  clib_memset(mp, 0, m_size);
615  mp->_vl_msg_id =
616  ntohs (REPLY_MSG_ID_BASE + VL_API_BIER_DISP_ENTRY_DETAILS);
617  mp->context = ctx->context;
618 
619  mp->bde_tbl_id = htonl (bdt->bdt_table_id);
620  mp->bde_n_paths = htonl (n_paths);
621  mp->bde_payload_proto = pproto;
622  mp->bde_bp = htons (bp);
623 
624  fib_path_list_walk_w_ext (pl, NULL, fib_path_encode, &path_ctx);
625 
626  fp = mp->bde_paths;
627  vec_foreach (rpath, path_ctx.rpaths)
628  {
629  fib_api_path_encode (rpath, fp);
630  fp++;
631  }
632 
633  vl_api_send_msg (ctx->reg, (u8 *) mp);
634  vec_free (path_ctx.rpaths);
635  }
636  }
637 }
638 
639 static void
641 {
643 
645  if (!reg)
646  return;
647 
649  .reg = reg,
650  .context = mp->context,
651  };
652  bier_disp_table_walk(ntohl(mp->bde_tbl_id),
654  &ctx);
655 }
656 
657 #include <bier/bier.api.c>
658 
659 static clib_error_t *
661 {
663 
664  return 0;
665 }
666 
BIER_HDR_PROTO_MPLS_UP_STREAM
@ BIER_HDR_PROTO_MPLS_UP_STREAM
Definition: bier_types.h:183
FOR_EACH_BIER_HDR_PROTO
#define FOR_EACH_BIER_HDR_PROTO(_proto)
Definition: bier_types.h:206
fib_route_path_t_::frp_fib_index
u32 frp_fib_index
The FIB index to lookup the nexthop Only valid for recursive paths.
Definition: fib_types.h:556
vl_api_bier_imp_add_reply_t::bi_index
u32 bi_index
Definition: bier.api:140
vl_api_client_index_to_registration
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
Definition: api.h:79
bier_disp_entry_t_::bde_pl
fib_node_index_t bde_pl[BIER_HDR_N_PROTO]
The path-lists used by per-payload protocol parents.
Definition: bier_disp_entry.h:59
api.h
BIER_HDR_PROTO_VXLAN
@ BIER_HDR_PROTO_VXLAN
Definition: bier_types.h:187
vl_api_bier_imp_details_t::context
u32 context
Definition: bier.api:164
label
u32 label
Definition: fib_types.api:25
vl_api_bier_disp_entry_add_del_t::bde_paths
vl_api_fib_path_t bde_paths[bde_n_paths]
Definition: bier.api:217
ntohs
#define ntohs(x)
Definition: af_xdp.bpf.c:29
bier_main
bier_main_t bier_main
Definition: bier_api.c:47
vl_api_bier_disp_entry_dump_t_handler
static void vl_api_bier_disp_entry_dump_t_handler(vl_api_bier_disp_entry_dump_t *mp)
Definition: bier_api.c:640
vl_api_bier_imp_add_t::bi_tbl_id
vl_api_bier_table_id_t bi_tbl_id
Definition: bier.api:125
BIER_TABLE_MPLS_SPF
@ BIER_TABLE_MPLS_SPF
BIER over MPLS with SPF.
Definition: bier_types.h:37
REPLY_MACRO2
#define REPLY_MACRO2(t, body)
Definition: api_helper_macros.h:65
BIER_BP_MAX
#define BIER_BP_MAX
The maximum BP that can be assigned.
Definition: bier_types.h:301
vl_api_bier_imp_dump_t
Definition: bier.api:156
clib_memcpy
#define clib_memcpy(d, s, n)
Definition: string.h:197
BIER_HDR_PROTO_IPV4
@ BIER_HDR_PROTO_IPV4
Definition: bier_types.h:185
fib_path_encode_ctx_t_
Path encode context to use when walking a path-list to encode paths.
Definition: fib_path.h:219
send_bier_disp_entry_details
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:586
bier_table_add_or_lock
index_t bier_table_add_or_lock(const bier_table_id_t *btid, mpls_label_t local_label)
Definition: bier_table.c:397
vl_api_bier_disp_table_add_del_t_handler
static void vl_api_bier_disp_table_add_del_t_handler(vl_api_bier_disp_table_add_del_t *mp)
Definition: bier_api.c:397
vl_api_send_msg
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
Definition: api.h:35
vl_api_bier_disp_entry_details_t::context
u32 context
Definition: bier.api:229
vl_api_bier_disp_table_dump_t::client_index
u32 client_index
Definition: bier.api:186
vl_api_bier_route_dump_t::br_tbl_id
vl_api_bier_table_id_t br_tbl_id
Definition: bier.api:102
vl_api_bier_table_add_del_t_handler
static void vl_api_bier_table_add_del_t_handler(vl_api_bier_table_add_del_t *mp)
Definition: bier_api.c:50
bier_disp_entry.h
bier_table_id_t_
The ID of a table.
Definition: bier_types.h:394
vl_api_bier_disp_table_dump_t::context
u32 context
Definition: bier.api:187
vl_api_bier_imp_dump_t::client_index
u32 client_index
Definition: bier.api:158
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(bier_api_hookup)
vl_api_bier_disp_entry_details_t::bde_payload_proto
u8 bde_payload_proto
Definition: bier.api:233
vl_api_bier_route_dump_t::context
u32 context
Definition: bier.api:101
fib_table.h
vl_api_bier_route_dump_t
Definition: bier.api:98
u16
unsigned short u16
Definition: types.h:57
BIER_HDR_PROTO_MPLS_DOWN_STREAM
@ BIER_HDR_PROTO_MPLS_DOWN_STREAM
Definition: bier_types.h:182
vl_api_bier_table_details_t
Definition: bier.api:61
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
bier_hdr_inlines.h
vl_api_bier_disp_entry_add_del_t::bde_n_paths
u8 bde_n_paths
Definition: bier.api:216
vl_api_bier_table_dump_t::client_index
u32 client_index
Definition: bier.api:57
vl_api_bier_table_add_del_t::bt_is_add
bool bt_is_add
Definition: bier.api:52
send_bier_imp_details
static void send_bier_imp_details(vl_api_registration_t *reg, u32 context, const bier_imp_t *bi)
Definition: bier_api.c:349
vl_api_bier_table_dump_t_handler
static void vl_api_bier_table_dump_t_handler(vl_api_bier_table_dump_t *mp)
Definition: bier_api.c:121
vl_api_bier_disp_entry_add_del_t::bde_is_add
bool bde_is_add
Definition: bier.api:214
vl_api_bier_imp_details_t::bi_src
u16 bi_src
Definition: bier.api:166
bier_imp_unlock
void bier_imp_unlock(index_t bii)
Definition: bier_imp.c:110
bier_disp_table_add_or_lock
index_t bier_disp_table_add_or_lock(u32 table_id)
Definition: bier_disp_table.c:57
bier_bp_t
u32 bier_bp_t
A bit positon as assigned to egress PEs.
Definition: bier_types.h:294
vl_api_bier_imp_dump_t::context
u32 context
Definition: bier.api:159
vl_api_bier_table_add_del_t
BIER Table Add / del route.
Definition: bier.api:46
fib_api_path_encode
void fib_api_path_encode(const fib_route_path_t *rpath, vl_api_fib_path_t *out)
Encode and decode functions from the API types to internal types.
Definition: fib_api.c:349
vl_api_bier_disp_table_details_t
Definition: bier.api:190
vl_api_bier_route_add_del_t_handler
static void vl_api_bier_route_add_del_t_handler(vl_api_bier_route_add_del_t *mp)
Definition: bier_api.c:143
fib_path_list_get_n_paths
u32 fib_path_list_get_n_paths(fib_node_index_t path_list_index)
Definition: fib_path_list.c:595
bier_hdr_ntoh
static void bier_hdr_ntoh(bier_hdr_t *bier_hdr)
Definition: bier_hdr_inlines.h:133
vl_api_bier_disp_table_dump_t
Definition: bier.api:184
fib_path_encode_ctx_t_::rpaths
fib_route_path_t * rpaths
Definition: fib_path.h:221
bier_bit_string_t_::bbs_len
u16 bbs_len
The length of the string in BYTES.
Definition: bier_types.h:282
send_bier_route_details
static void send_bier_route_details(const bier_table_t *bt, const bier_entry_t *be, void *args)
Definition: bier_api.c:223
vl_api_bier_table_details_t::bt_tbl_id
vl_api_bier_table_id_t bt_tbl_id
Definition: bier.api:65
vl_api_bier_disp_entry_dump_t::context
u32 context
Definition: bier.api:223
bier_disp_table_entry_path_add
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)
Definition: bier_disp_table.c:217
bier_disp_table_unlock_w_table_id
void bier_disp_table_unlock_w_table_id(u32 table_id)
Definition: bier_disp_table.c:91
bier_table.h
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
vl_api_bier_route_add_del_t
Definition: bier.api:89
FIB_API_PATH_NH_PROTO_IP4
@ FIB_API_PATH_NH_PROTO_IP4
Definition: fib_types.api:34
bier_imp_t_
bier_imposition : The BIER imposition object
Definition: bier_imp.h:34
bier_disp_entry_t_
bier_disposition : The BIER disposition object
Definition: bier_disp_entry.h:32
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
bier_table_walk
void bier_table_walk(const bier_table_id_t *bti, bier_table_walk_fn_t fn, void *ctx)
Definition: bier_table.c:928
BIER_HDR_PROTO_OAM
@ BIER_HDR_PROTO_OAM
Definition: bier_types.h:189
bier_table_id_t_::bti_sub_domain
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
vl_api_bier_disp_entry_details_t::bde_bp
u16 bde_bp
Definition: bier.api:230
bier_table_is_main
int bier_table_is_main(const bier_table_t *bt)
Definition: bier_table.c:53
vl_api_bier_imp_details_t::bi_n_bytes
u8 bi_n_bytes
Definition: bier.api:167
vl_api_bier_disp_entry_details_t
Definition: bier.api:227
BIER_ECMP_TABLE_ID_MAIN
#define BIER_ECMP_TABLE_ID_MAIN
Definition of the ID of the BIER main table.
Definition: bier_types.h:389
bier_disp_entry_details_walk_t_::reg
vl_api_registration_t * reg
Definition: bier_api.c:581
bier_route_details_walk_t
struct bier_route_details_walk_t_ bier_route_details_walk_t
bier_imp_t_::bi_tbl
bier_table_id_t bi_tbl
The BIER table into which to forward the post imposed packet.
Definition: bier_imp.h:63
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
vl_api_bier_imp_add_t::bi_bytes
u8 bi_bytes[bi_n_bytes]
Definition: bier.api:128
vl_api_bier_table_details_t::bt_label
u32 bt_label
Definition: bier.api:64
vl_api_bier_table_dump_t
Definition: bier.api:55
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition: api_common.h:47
vl_api_bier_imp_details_t::bi_bytes
u8 bi_bytes[bi_n_bytes]
Definition: bier.api:168
REPLY_MACRO
#define REPLY_MACRO(t)
Definition: api_helper_macros.h:30
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition: sr_mpls_api.c:174
BIER_HDR_PROTO_INVALID
@ BIER_HDR_PROTO_INVALID
Definition: bier_types.h:181
vl_api_bier_disp_entry_add_del_t::bde_payload_proto
u8 bde_payload_proto
Definition: bier.api:215
vl_api_bier_imp_del_t_handler
static void vl_api_bier_imp_del_t_handler(vl_api_bier_imp_del_t *mp)
Definition: bier_api.c:334
vl_api_bier_disp_entry_dump_t::client_index
u32 client_index
Definition: bier.api:222
index_t
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:43
vl_api_bier_imp_del_t
BIER Imposition Del.
Definition: bier.api:149
bier_table_t_::bt_ll
mpls_label_t bt_ll
Save the MPLS local label associated with the table.
Definition: bier_table.h:48
bier_api_hookup
static clib_error_t * bier_api_hookup(vlib_main_t *vm)
Definition: bier_api.c:660
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
vec_foreach_index
#define vec_foreach_index(var, v)
Iterate over vector indices.
Definition: vec_bootstrap.h:220
bier_table_route_path_update
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
vl_api_bier_route_dump_t::client_index
u32 client_index
Definition: bier.api:100
bier_route_details_walk_t_
Definition: bier_api.c:216
bier_imp.h
vl_api_bier_table_add_del_t::bt_tbl_id
vl_api_bier_table_id_t bt_tbl_id
Definition: bier.api:50
vl_api_bier_imp_details_t::bi_tbl_id
vl_api_bier_table_id_t bi_tbl_id
Definition: bier.api:165
bier_hdr_get_len_id
static bier_hdr_len_id_t bier_hdr_get_len_id(const bier_hdr_t *bier_hdr)
Definition: bier_hdr_inlines.h:69
BIER_HDR_PROTO_ETHERNET
@ BIER_HDR_PROTO_ETHERNET
Definition: bier_types.h:184
vl_api_bier_disp_table_details_t::context
u32 context
Definition: bier.api:192
bier_disp_table_entry_path_remove
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)
Definition: bier_disp_table.c:243
vl_api_bier_imp_add_t
BIER Imposition Add.
Definition: bier.api:121
bier_table_route_path_remove
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
bier_disp_table.h
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
vl_api_bier_table_details_t::context
u32 context
Definition: bier.api:63
FIB_ROUTE_PATH_RPF_ID
@ FIB_ROUTE_PATH_RPF_ID
A local path with a RPF-ID => multicast traffic.
Definition: fib_types.h:365
bier_disp_entry_details_walk_t
struct bier_disp_entry_details_walk_t_ bier_disp_entry_details_walk_t
vl_api_bier_disp_entry_details_t::bde_paths
vl_api_fib_path_t bde_paths[bde_n_paths]
Definition: bier.api:235
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
vl_api_bier_imp_details_t
Definition: bier.api:162
vl_api_bier_table_dump_t::context
u32 context
Definition: bier.api:58
bier_bit_string.h
vl_api_bier_route_details_t::context
u32 context
Definition: bier.api:107
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
vl_api_bier_disp_entry_add_del_t_handler
static void vl_api_bier_disp_entry_add_del_t_handler(vl_api_bier_disp_entry_add_del_t *mp)
Definition: bier_api.c:459
bier_imp_add_or_lock
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
mfib_table.h
bier_table_id_t_::bti_hdr_len
bier_hdr_len_id_t bti_hdr_len
The size of the bit string processed by this table.
Definition: bier_types.h:419
fib_api.h
send_bier_disp_table_details
static void send_bier_disp_table_details(vl_api_registration_t *reg, u32 context, const bier_disp_table_t *bdt)
Definition: bier_api.c:423
bier_imp_t_::bi_hdr
bier_hdr_t bi_hdr
The Header to impose.
Definition: bier_imp.h:50
bier_disp_table_pool
bier_disp_table_t * bier_disp_table_pool
memory pool for disposition tables
Definition: bier_disp_table.c:22
vl_api_bier_route_dump_t_handler
static void vl_api_bier_route_dump_t_handler(vl_api_bier_route_dump_t *mp)
Definition: bier_api.c:269
vl_api_bier_route_add_del_t::br_route
vl_api_bier_route_t br_route
Definition: bier.api:95
n_paths
u8 n_paths
Definition: ip.api:176
ip46_address_is_zero
static u8 ip46_address_is_zero(const ip46_address_t *ip46)
Definition: ip46_address.h:87
vnet_main_t::api_errno
vnet_api_error_t api_errno
Definition: vnet.h:109
fib_path_list_walk_w_ext
void fib_path_list_walk_w_ext(fib_node_index_t path_list_index, const fib_path_ext_list_t *ext_list, fib_path_list_walk_w_ext_fn_t func, void *ctx)
Definition: fib_path_list.c:1401
bier_hdr_proto_id_t
enum bier_hdr_proto_id_t_ bier_hdr_proto_id_t
BIER header protocol payload types.
vl_api_bier_disp_entry_add_del_t::bde_tbl_id
u32 bde_tbl_id
Definition: bier.api:213
vl_api_bier_disp_entry_dump_t
Definition: bier.api:220
vnet_main_t
Definition: vnet.h:76
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
vl_api_bier_imp_add_t::bi_src
u16 bi_src
Definition: bier.api:126
bier_entry_t_
The BIER entry.
Definition: bier_entry.h:46
fib_path_list.h
bier_imp_t_::bi_bits
u8 bi_bits[BIER_HDR_BUCKETS_1024]
The bit string.
Definition: bier_imp.h:58
BIER_HDR_LEN_2048
@ BIER_HDR_LEN_2048
Bit-string lengths greater than 1024 are not supported due to the limited about pf space available in...
Definition: bier_types.h:64
format_fns.h
mfib_table_find
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:555
BIER_HDR_PROTO_IPV6
@ BIER_HDR_PROTO_IPV6
Definition: bier_types.h:186
bier_table_route_path_add
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
vl_api_bier_disp_table_add_del_t::bdt_is_add
bool bdt_is_add
Definition: bier.api:181
u32
unsigned int u32
Definition: types.h:88
vl_api_bier_imp_dump_t_handler
static void vl_api_bier_imp_dump_t_handler(vl_api_bier_imp_dump_t *mp)
Definition: bier_api.c:381
table_id
u32 table_id
Definition: wireguard.api:102
n_bytes
u32 n_bytes
Definition: interface_output.c:421
FIB_API_PATH_NH_PROTO_IP6
@ FIB_API_PATH_NH_PROTO_IP6
Definition: fib_types.api:35
FIB_PROTOCOL_IP6
@ FIB_PROTOCOL_IP6
Definition: fib_types.h:37
vl_api_bier_imp_add_t_handler
static void vl_api_bier_imp_add_t_handler(vl_api_bier_imp_add_t *mp)
Definition: bier_api.c:292
fib_route_path_t_
A representation of a path as described by a route producer.
Definition: fib_types.h:500
fib_path_encode
fib_path_list_walk_rc_t fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, const fib_path_ext_t *path_ext, void *args)
Definition: fib_path.c:2710
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
api_helper_macros.h
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
bier_table_unlock
void bier_table_unlock(const bier_table_id_t *bti)
Definition: bier_table.c:218
vl_api_bier_disp_entry_details_t::bde_n_paths
u8 bde_n_paths
Definition: bier.api:234
vl_api_bier_table_add_del_t::bt_label
u32 bt_label
Definition: bier.api:51
bier_table_t_::bt_id
bier_table_id_t bt_id
The identity/key or the table.
Definition: bier_table.h:76
vl_api_bier_imp_add_t::bi_n_bytes
u8 bi_n_bytes
Definition: bier.api:127
bier_table_route_delete
void bier_table_route_delete(const bier_table_id_t *btid, bier_bp_t bp)
Definition: bier_table.c:633
bier_route_details_walk_t_::context
u32 context
Definition: bier_api.c:219
vl_api_bier_disp_entry_add_del_t
BIER Disposition Entry Add / del.
Definition: bier.api:208
vl_api_bier_disp_table_add_del_t::bdt_tbl_id
u32 bdt_tbl_id
Definition: bier.api:180
REPLY_MSG_ID_BASE
#define REPLY_MSG_ID_BASE
Definition: bier_api.c:39
bier_disp_table_t_
A protocol Independent IP multicast FIB table.
Definition: bier_disp_table.h:30
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vl_api_bier_disp_table_dump_t_handler
static void vl_api_bier_disp_table_dump_t_handler(vl_api_bier_disp_table_dump_t *mp)
Definition: bier_api.c:443
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
bier_table_pool
bier_table_t * bier_table_pool
Memory pool of all the allocated tables.
Definition: bier_table.c:32
bier_disp_table_walk
void bier_disp_table_walk(u32 table_id, bier_disp_table_walk_fn_t fn, void *ctx)
Definition: bier_disp_table.c:274
bier_main_t
Definition: bier_api.c:42
send_bier_table_details
static void send_bier_table_details(vl_api_registration_t *reg, u32 context, const bier_table_t *bt)
Definition: bier_api.c:99
bier_disp_entry_details_walk_t_
Definition: bier_api.c:579
bier_route_details_walk_t_::reg
vl_api_registration_t * reg
Definition: bier_api.c:218
vl_api_bier_route_add_del_t::br_is_add
bool br_is_add
Definition: bier.api:93
bier_main_t::msg_id_base
u16 msg_id_base
Definition: bier_api.c:44
bier_hdr_t_
A BIER header of variable length The encoding follows: https://tools.ietf.org/html/draft-ietf-bier-mp...
Definition: bier_types.h:321
context
u32 context
Definition: ip.api:852
bier_table_t_
A BIER Table is the bit-indexed forwarding table.
Definition: bier_table.h:38
mpls_label_t
u32 mpls_label_t
A label value only, i.e.
Definition: packet.h:26
rv
int __clib_unused rv
Definition: application.c:491
vl_api_bier_route_details_t::br_route
vl_api_bier_route_t br_route
Definition: bier.api:108
bier_disp_entry_details_walk_t_::context
u32 context
Definition: bier_api.c:582
vnet.h
api_errno.h
vl_api_bier_imp_add_reply_t
Reply for BIER route add / del request.
Definition: bier.api:136
bier_hdr_len_id_to_num_bytes
u32 bier_hdr_len_id_to_num_bytes(bier_hdr_len_id_t id)
Definition: bier_types.c:66
bier_table_id_t_::bti_set
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
bier_imp_pool
bier_imp_t * bier_imp_pool
bier_imposition : The BIER imposition object
Definition: bier_imp.c:33
vl_api_bier_disp_entry_details_t::bde_tbl_id
u32 bde_tbl_id
Definition: bier.api:231
bier_entry_t_::be_path_list
fib_node_index_t be_path_list
the FIB path-list this entry resolves through.
Definition: bier_entry.h:67
MPLS_LABEL_INVALID
#define MPLS_LABEL_INVALID
Definition: mpls_types.h:48
INDEX_INVALID
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
Definition: dpo.h:49
vl_api_bier_disp_table_add_del_t
BIER Disposition Table Add / del route.
Definition: bier.api:176
fib_api_path_decode
int fib_api_path_decode(vl_api_fib_path_t *in, fib_route_path_t *out)
Definition: fib_api.c:141
fib_table_find
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:1111
bier_disp_table_t_::bdt_table_id
u32 bdt_table_id
Table ID (hash key) for this FIB.
Definition: bier_disp_table.h:45
vl_api_bier_disp_table_details_t::bdt_tbl_id
u32 bdt_tbl_id
Definition: bier.api:193
BIER_HDR_PROTO_CTRL
@ BIER_HDR_PROTO_CTRL
Definition: bier_types.h:188
bier_bit_string_t_
A Variable length BitString.
Definition: bier_types.h:278
vl_api_bier_route_add_del_t::br_is_replace
bool br_is_replace
Definition: bier.api:94
vl_api_bier_route_details_t
Definition: bier.api:105
vl_api_bier_imp_del_t::bi_index
u32 bi_index
Definition: bier.api:153
vl_api_bier_disp_entry_dump_t::bde_tbl_id
u32 bde_tbl_id
Definition: bier.api:224
bier_hdr_get_src_id
static bier_hdr_src_id_t bier_hdr_get_src_id(const bier_hdr_t *bier_hdr)
Definition: bier_hdr_inlines.h:149
bier_entry_t_::be_bp
bier_bp_t be_bp
the bit position this entry represents.
Definition: bier_entry.h:61
vl_msg_api_alloc
void * vl_msg_api_alloc(int nbytes)
Definition: memory_shared.c:199
vl_api_bier_disp_entry_add_del_t::bde_bp
u16 bde_bp
Definition: bier.api:212