FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
gbp_vxlan.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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 <plugins/gbp/gbp_vxlan.h>
17 #include <plugins/gbp/gbp_learn.h>
20 
22 #include <vlibmemory/api.h>
23 #include <vnet/fib/fib_table.h>
24 #include <vlib/punt.h>
25 
26 /**
27  * A reference to a VXLAN-GBP tunnel created as a child/dependent tunnel
28  * of the template GBP-VXLAN tunnel
29  */
30 typedef struct vxlan_tunnel_ref_t_
31 {
37 
38 /**
39  * DB of added tunnels
40  */
42 
43 /**
44  * Logger
45  */
47 
48 /**
49  * Pool of template tunnels
50  */
52 
53 /**
54  * Pool of child tunnels
55  */
57 
58 /**
59  * DB of template interfaces by SW interface index
60  */
62 
63 /**
64  * DB of child interfaces by SW interface index
65  */
67 
68 /**
69  * handle registered with the ;unt infra
70  */
72 
74 #define _(n,s) [GBP_VXLAN_TUN_##n] = s,
76 #undef _
77 };
78 
79 #define GBP_VXLAN_TUN_DBG(...) \
80  vlib_log_debug (gt_logger, __VA_ARGS__);
81 
82 
85 {
87 }
88 
89 static vxlan_tunnel_ref_t *
91 {
93 }
94 
95 static u8 *
96 format_vxlan_tunnel_ref (u8 * s, va_list * args)
97 {
98  index_t vxri = va_arg (*args, u32);
99  vxlan_tunnel_ref_t *vxr;
100 
101  vxr = vxlan_tunnel_ref_get (vxri);
102 
103  s = format (s, "[%U]", format_gbp_itf_hdl, vxr->vxr_itf);
104 
105  return (s);
106 }
107 
108 static void
110 {
111  vxlan_tunnel_ref_t *vxr;
112  gbp_vxlan_tunnel_t *gt;
113  index_t vxri;
114  u32 pos;
115 
117  vxri = vxr - vxlan_tunnel_ref_pool;
118  gt = gbp_vxlan_tunnel_get (vxr->vxr_parent);
119 
120  GBP_VXLAN_TUN_DBG ("del-dep:%U", format_vxlan_tunnel_ref, vxri);
121 
123  pos = vec_search (gt->gt_tuns, vxri);
124 
125  ASSERT (~0 != pos);
126  vec_del1 (gt->gt_tuns, pos);
127 
129 
131 }
132 
133 static gbp_itf_hdl_t
135  const ip46_address_t * src, const ip46_address_t * dst)
136 {
138  .is_add = 1,
139  .is_ip6 = !ip46_address_is_ip4 (src),
140  .vni = gt->gt_vni,
141  .src = *src,
142  .dst = *dst,
143  .instance = ~0,
144  .mode = (GBP_VXLAN_TUN_L2 == gt->gt_layer ?
146  };
147  vxlan_tunnel_ref_t *vxr;
149  index_t vxri;
150  int rv;
151 
152  sw_if_index = ~0;
154 
155  if (VNET_API_ERROR_TUNNEL_EXIST == rv)
156  {
158 
159  vxr = vxlan_tunnel_ref_get (vxri);
160  gbp_itf_lock (vxr->vxr_itf);
161  }
162  else if (0 == rv)
163  {
164  ASSERT (~0 != sw_if_index);
165  GBP_VXLAN_TUN_DBG ("add-dep:%U %U %U %d", format_vnet_sw_if_index_name,
169 
171 
172  vxri = (vxr - vxlan_tunnel_ref_pool);
173  vxr->vxr_parent = gt - gbp_vxlan_tunnel_pool;
175  vxr->vxr_layer = gt->gt_layer;
176 
177  /*
178  * store the child both on the parent's list and the global DB
179  */
180  vec_add1 (gt->gt_tuns, vxri);
181 
185 
186  if (GBP_VXLAN_TUN_L2 == vxr->vxr_layer)
187  {
188  l2output_feat_masks_t ofeat;
189  l2input_feat_masks_t ifeat;
190  gbp_bridge_domain_t *gbd;
191 
192  gbd = gbp_bridge_domain_get (gt->gt_gbd);
195 
196  ofeat = L2OUTPUT_FEAT_GBP_POLICY_MAC;
197  ifeat = L2INPUT_FEAT_NONE;
198 
199  if (!(gbd->gb_flags & GBP_BD_FLAG_DO_NOT_LEARN))
200  ifeat |= L2INPUT_FEAT_GBP_LEARN;
201 
204  }
205  else
206  {
209 
211  }
212  }
213  else
214  {
215  return (GBP_ITF_HDL_INVALID);
216  }
217 
218  return (vxr->vxr_itf);
219 }
220 
221 u32
223 {
226 
227  gbp_vxlan_tunnel_t *gt;
228  vxlan_tunnel_ref_t *vxr;
229 
231  gt = gbp_vxlan_tunnel_get (vxr->vxr_parent);
232 
233  return (gt->gt_sw_if_index);
234 }
235 
238 {
241 
242  vxlan_tunnel_ref_t *vxr;
243 
245 
246  gbp_itf_lock (vxr->vxr_itf);
247 
248  return (vxr->vxr_itf);
249 }
250 
251 
254 {
257  {
258  return (VXLAN_GBP_TUNNEL);
259  }
260  else if (sw_if_index < vec_len (gbp_vxlan_tunnel_db) &&
262  {
263  return (GBP_VXLAN_TEMPLATE_TUNNEL);
264  }
265 
266  ASSERT (0);
267  return (GBP_VXLAN_TEMPLATE_TUNNEL);
268 }
269 
272  const ip46_address_t * src,
273  const ip46_address_t * dst)
274 {
275  gbp_vxlan_tunnel_t *gt;
276  index_t gti;
277 
279 
280  if (INDEX_INVALID == gti)
281  return (GBP_ITF_HDL_INVALID);
282 
284 
285  return (gdb_vxlan_dep_add (gt, src, dst));
286 }
287 
288 void
290 {
291  /* vxlan_tunnel_ref_t *vxr; */
292  /* index_t vxri; */
293 
294  /* vxri = vxlan_tunnel_ref_db[sw_if_index]; */
295 
296  /* ASSERT (vxri != INDEX_INVALID); */
297 
298  /* vxr = vxlan_tunnel_ref_get (vxri); */
299 
300  /* gdb_vxlan_dep_del (vxri); */
301 }
302 
303 void
305 {
306  gbp_vxlan_tunnel_t *gt;
307 
308  /* *INDENT-OFF* */
310  {
311  if (WALK_CONTINUE != cb(gt, ctx))
312  break;
313  }
314  /* *INDENT-ON* */
315 }
316 
317 static walk_rc_t
319 {
321  gt - gbp_vxlan_tunnel_pool);
322 
323  return (WALK_CONTINUE);
324 }
325 
326 static u8 *
327 format_gbp_vxlan_tunnel_name (u8 * s, va_list * args)
328 {
329  u32 dev_instance = va_arg (*args, u32);
330 
331  return format (s, "gbp-vxlan-%d", dev_instance);
332 }
333 
334 u8 *
335 format_gbp_vxlan_tunnel_layer (u8 * s, va_list * args)
336 {
338  s = format (s, "%s", gbp_vxlan_tunnel_layer_strings[gl]);
339 
340  return (s);
341 }
342 
343 u8 *
344 format_gbp_vxlan_tunnel (u8 * s, va_list * args)
345 {
346  u32 dev_instance = va_arg (*args, u32);
347  CLIB_UNUSED (int verbose) = va_arg (*args, int);
348  gbp_vxlan_tunnel_t *gt = gbp_vxlan_tunnel_get (dev_instance);
349  index_t *vxri;
350 
351  s = format (s, " [%d] gbp-vxlan-tunnel: hw:%d sw:%d vni:%d %U",
352  dev_instance, gt->gt_hw_if_index,
353  gt->gt_sw_if_index, gt->gt_vni,
355  if (GBP_VXLAN_TUN_L2 == gt->gt_layer)
356  s = format (s, " BD:%d gbd-index:%d", gt->gt_bd_rd_id, gt->gt_gbd);
357  else
358  s = format (s, " RD:%d grd-index:%d", gt->gt_bd_rd_id, gt->gt_grd);
359 
360  s = format (s, " dependents:");
361  vec_foreach (vxri, gt->gt_tuns)
362  {
363  s = format (s, "\n %U, ", format_vxlan_tunnel_ref, *vxri);
364  }
365 
366  return s;
367 }
368 
369 typedef struct gbp_vxlan_tx_trace_t_
370 {
373 
374 u8 *
375 format_gbp_vxlan_tx_trace (u8 * s, va_list * args)
376 {
377  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
378  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
379  gbp_vxlan_tx_trace_t *t = va_arg (*args, gbp_vxlan_tx_trace_t *);
380 
381  s = format (s, "GBP-VXLAN: vni:%d", t->vni);
382 
383  return (s);
384 }
385 
386 clib_error_t *
388  u32 hw_if_index, u32 flags)
389 {
391  u32 ti;
392 
393  hi = vnet_get_hw_interface (vnm, hw_if_index);
394 
395  if (NULL == gbp_vxlan_tunnel_db ||
396  hi->sw_if_index >= vec_len (gbp_vxlan_tunnel_db))
397  return (NULL);
398 
399  ti = gbp_vxlan_tunnel_db[hi->sw_if_index];
400 
401  if (~0 == ti)
402  /* not one of ours */
403  return (NULL);
404 
406  vnet_hw_interface_set_flags (vnm, hw_if_index,
408  else
409  vnet_hw_interface_set_flags (vnm, hw_if_index, 0);
410 
411  return (NULL);
412 }
413 
414 static uword
417 {
418  clib_warning ("you shouldn't be here, leaking buffers...");
419  return frame->n_vectors;
420 }
421 
422 /* *INDENT-OFF* */
423 VNET_DEVICE_CLASS (gbp_vxlan_device_class) = {
424  .name = "GBP VXLAN tunnel-template",
425  .format_device_name = format_gbp_vxlan_tunnel_name,
426  .format_device = format_gbp_vxlan_tunnel,
427  .format_tx_trace = format_gbp_vxlan_tx_trace,
428  .admin_up_down_function = gbp_vxlan_interface_admin_up_down,
429  .tx_function = gbp_vxlan_interface_tx,
430 };
431 
432 VNET_HW_INTERFACE_CLASS (gbp_vxlan_hw_interface_class) = {
433  .name = "GBP-VXLAN",
435 };
436 /* *INDENT-ON* */
437 
438 int
440  u32 bd_rd_id,
441  const ip4_address_t * src, u32 * sw_if_indexp)
442 {
443  gbp_vxlan_tunnel_t *gt;
444  index_t gti;
445  uword *p;
446  int rv;
447 
448  rv = 0;
449  p = hash_get (gv_db, vni);
450 
451  GBP_VXLAN_TUN_DBG ("add: %d %d %d", vni, layer, bd_rd_id);
452 
453  if (NULL == p)
454  {
457  index_t gbi, grdi;
458  vnet_main_t *vnm;
459 
460  gbi = grdi = INDEX_INVALID;
461 
462  if (layer == GBP_VXLAN_TUN_L2)
463  {
465 
466  if (INDEX_INVALID == gbi)
467  {
468  return (VNET_API_ERROR_BD_NOT_MODIFIABLE);
469  }
470  }
471  else
472  {
474 
475  if (INDEX_INVALID == grdi)
476  {
477  return (VNET_API_ERROR_NO_SUCH_FIB);
478  }
479  }
480 
481  vnm = vnet_get_main ();
483  gti = gt - gbp_vxlan_tunnel_pool;
484 
485  gt->gt_vni = vni;
486  gt->gt_layer = layer;
487  gt->gt_bd_rd_id = bd_rd_id;
488  gt->gt_src.ip4.as_u32 = src->as_u32;
490  gbp_vxlan_device_class.index,
491  gti,
492  gbp_vxlan_hw_interface_class.index,
493  gti);
494 
496 
497  gt->gt_sw_if_index = hi->sw_if_index;
498 
499  /* don't flood packets in a BD to these interfaces */
502 
503  if (layer == GBP_VXLAN_TUN_L2)
504  {
506 
507  gb = gbp_bridge_domain_get (gbi);
508 
509  gt->gt_gbd = gbi;
510  gb->gb_vni = gti;
511  /* set it up as a GBP interface */
513  gt->gt_gbd);
514  gbp_itf_l2_set_input_feature (gt->gt_itf, L2INPUT_FEAT_GBP_LEARN);
515  }
516  else
517  {
518  gt->gt_grd = grdi;
520  gt->gt_grd);
522  }
523 
524  /*
525  * save the tunnel by VNI and by sw_if_index
526  */
527  hash_set (gv_db, vni, gti);
528 
532 
533  if (sw_if_indexp)
534  *sw_if_indexp = gt->gt_sw_if_index;
535 
537  }
538  else
539  {
540  gti = p[0];
541  rv = VNET_API_ERROR_IF_ALREADY_EXISTS;
542  }
543 
544  GBP_VXLAN_TUN_DBG ("add: %U", format_gbp_vxlan_tunnel, gti);
545 
546  return (rv);
547 }
548 
549 int
551 {
552  gbp_vxlan_tunnel_t *gt;
553  uword *p;
554 
555  p = hash_get (gv_db, vni);
556 
557  if (NULL != p)
558  {
559  vnet_main_t *vnm;
560 
561  vnm = vnet_get_main ();
562  gt = gbp_vxlan_tunnel_get (p[0]);
563 
565 
567  gt - gbp_vxlan_tunnel_pool);
568 
569  gbp_endpoint_flush (GBP_ENDPOINT_SRC_DP, gt->gt_sw_if_index);
570  ASSERT (0 == vec_len (gt->gt_tuns));
571  vec_free (gt->gt_tuns);
572 
573  gbp_itf_unlock (&gt->gt_itf);
574 
575  if (GBP_VXLAN_TUN_L2 == gt->gt_layer)
576  {
578  }
579  else
580  {
582  }
583 
586 
587  hash_unset (gv_db, vni);
589 
591  }
592  else
593  return VNET_API_ERROR_NO_SUCH_ENTRY;
594 
595  return (0);
596 }
597 
598 static clib_error_t *
600  unformat_input_t * input, vlib_cli_command_t * cmd)
601 {
602 
603  vlib_cli_output (vm, "GBP-VXLAN Interfaces:");
604 
606 
607  return (NULL);
608 }
609 
610 /*?
611  * Show Group Based Policy VXLAN tunnels
612  *
613  * @cliexpar
614  * @cliexstart{show gbp vxlan}
615  * @cliexend
616  ?*/
617 /* *INDENT-OFF* */
619  .path = "show gbp vxlan",
620  .short_help = "show gbp vxlan\n",
621  .function = gbp_vxlan_show,
622 };
623 /* *INDENT-ON* */
624 
625 static clib_error_t *
627 {
629 
630  gt_logger = vlib_log_register_class ("gbp", "tun");
631 
632  punt_hdl = vlib_punt_client_register ("gbp-vxlan");
633 
636  "gbp-vxlan4");
637 
638  return (0);
639 }
640 
641 /* *INDENT-OFF* */
643 {
644  .runs_after = VLIB_INITS("punt_init", "vxlan_gbp_init"),
645 };
646 /* *INDENT-ON* */
647 
648 /*
649  * fd.io coding-style-patch-verification: ON
650  *
651  * Local Variables:
652  * eval: (c-set-style "gnu")
653  * End:
654  */
gbp_learn.h
gbp_itf_l2_set_input_feature
void gbp_itf_l2_set_input_feature(gbp_itf_hdl_t gh, l2input_feat_masks_t feats)
Definition: gbp_itf.c:384
GBP_BD_FLAG_DO_NOT_LEARN
@ GBP_BD_FLAG_DO_NOT_LEARN
Definition: gbp_bridge_domain.h:31
gbp_vxlan_interface_tx
static uword gbp_vxlan_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: gbp_vxlan.c:415
punt.h
gbp_vxlan_show
static clib_error_t * gbp_vxlan_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: gbp_vxlan.c:599
api.h
vnet_sw_interface_set_flags
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
Definition: interface.c:523
vnet_sw_interface_t
Definition: interface.h:868
gbp_vxlan_interface_admin_up_down
clib_error_t * gbp_vxlan_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: gbp_vxlan.c:387
frame
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
Definition: nat44_ei.c:3048
WALK_CONTINUE
@ WALK_CONTINUE
Definition: interface_funcs.h:174
vxlan_tunnel_ref_t_::vxr_sw_if_index
u32 vxr_sw_if_index
Definition: gbp_vxlan.c:33
vxlan_tunnel_ref_t_
A reference to a VXLAN-GBP tunnel created as a child/dependent tunnel of the template GBP-VXLAN tunne...
Definition: gbp_vxlan.c:30
gbp_vxlan_tunnel_clone_and_lock
gbp_itf_hdl_t gbp_vxlan_tunnel_clone_and_lock(u32 sw_if_index, const ip46_address_t *src, const ip46_address_t *dst)
Definition: gbp_vxlan.c:271
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
gbp_vxlan_tunnel_db
static index_t * gbp_vxlan_tunnel_db
DB of template interfaces by SW interface index.
Definition: gbp_vxlan.c:61
vlib_log_class_t
u32 vlib_log_class_t
Definition: vlib.h:52
format_gbp_vxlan_tunnel_name
static u8 * format_gbp_vxlan_tunnel_name(u8 *s, va_list *args)
Definition: gbp_vxlan.c:327
gv_db
uword * gv_db
DB of added tunnels.
Definition: gbp_vxlan.c:41
vnet_vxlan_gbp_tunnel_add_del_args_t::is_add
u8 is_add
Definition: vxlan_gbp.h:214
VXLAN_GBP_TUNNEL_MODE_L2
@ VXLAN_GBP_TUNNEL_MODE_L2
Definition: vxlan_gbp.h:65
gbp_itf_hdl_t_
Definition: gbp_itf.h:45
gbp_bridge_domain_t_::gb_vni
u32 gb_vni
The index of the BD's VNI interface on which packets from unkown endpoints arrive.
Definition: gbp_bridge_domain.h:80
vlib_log_register_class
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
Definition: log.c:339
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
vxlan_tunnel_ref_t_::vxr_itf
gbp_itf_hdl_t vxr_itf
Definition: gbp_vxlan.c:32
vni
u32 vni
Definition: flow_types.api:160
ip46_address_is_ip4
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
Definition: ip46_address.h:55
vlib_cli_command_t::path
char * path
Definition: cli.h:96
fib_table.h
vxlan_gbp_tunnel_get_parent
u32 vxlan_gbp_tunnel_get_parent(u32 sw_if_index)
Definition: gbp_vxlan.c:222
gbp_vxlan_tx_trace_t
struct gbp_vxlan_tx_trace_t_ gbp_vxlan_tx_trace_t
foreach_gbp_vxlan_tunnel_layer
@ foreach_gbp_vxlan_tunnel_layer
Definition: gbp_vxlan.h:29
vnet_vxlan_gbp_tunnel_del
int vnet_vxlan_gbp_tunnel_del(u32 sw_if_index)
Definition: vxlan_gbp.c:666
VNET_SW_INTERFACE_FLAG_ADMIN_UP
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
Definition: interface.h:843
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vxlan_tunnel_ref_pool
static vxlan_tunnel_ref_t * vxlan_tunnel_ref_pool
Pool of child tunnels.
Definition: gbp_vxlan.c:56
gbp_itf_l2_add_and_lock_w_free
gbp_itf_hdl_t gbp_itf_l2_add_and_lock_w_free(u32 sw_if_index, index_t gbi, gbp_itf_free_fn_t ff)
Definition: gbp_itf.c:204
format_gbp_vxlan_tunnel_layer
u8 * format_gbp_vxlan_tunnel_layer(u8 *s, va_list *args)
Definition: gbp_vxlan.c:335
vnet_get_sw_interface
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:58
VNET_HW_INTERFACE_FLAG_LINK_UP
@ VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:509
gbp_vxlan_tunnel_get_type
gbp_vxlan_tunnel_type_t gbp_vxlan_tunnel_get_type(u32 sw_if_index)
Definition: gbp_vxlan.c:253
vxlan_tunnel_ref_t_::vxr_layer
gbp_vxlan_tunnel_layer_t vxr_layer
Definition: gbp_vxlan.c:35
gbp_itf_l3_add_and_lock
gbp_itf_hdl_t gbp_itf_l3_add_and_lock(u32 sw_if_index, index_t gri)
Definition: gbp_itf.c:247
gbp_bridge_domain_get
static gbp_bridge_domain_t * gbp_bridge_domain_get(index_t i)
Definition: gbp_bridge_domain.h:128
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
gbp_vxlan_tunnel_t_::gt_src
ip46_address_t gt_src
The source address to use for child tunnels.
Definition: gbp_vxlan.h:82
vlib_punt_register
int vlib_punt_register(vlib_punt_hdl_t client, vlib_punt_reason_t reason, const char *node_name)
Register a node to receive particular punted buffers.
Definition: punt.c:283
unformat_input_t
struct _unformat_input_t unformat_input_t
VXLAN_GBP_TUNNEL_MODE_L3
@ VXLAN_GBP_TUNNEL_MODE_L3
Definition: vxlan_gbp.h:66
vlib_frame_t
Definition: node.h:372
GBP_VXLAN_TUN_DBG
#define GBP_VXLAN_TUN_DBG(...)
Definition: gbp_vxlan.c:79
gbp_vxlan_tunnel_show_one
static walk_rc_t gbp_vxlan_tunnel_show_one(gbp_vxlan_tunnel_t *gt, void *ctx)
Definition: gbp_vxlan.c:318
gdb_vxlan_dep_add
static gbp_itf_hdl_t gdb_vxlan_dep_add(gbp_vxlan_tunnel_t *gt, const ip46_address_t *src, const ip46_address_t *dst)
Definition: gbp_vxlan.c:134
gbp_itf_l2_set_output_feature
void gbp_itf_l2_set_output_feature(gbp_itf_hdl_t gh, l2output_feat_masks_t feats)
Definition: gbp_itf.c:430
vxlan_gbp_tunnel_lock_itf
gbp_itf_hdl_t vxlan_gbp_tunnel_lock_itf(u32 sw_if_index)
Definition: gbp_vxlan.c:237
GBP_ITF_L3_FEAT_LEARN
#define GBP_ITF_L3_FEAT_LEARN
Definition: gbp_itf.h:43
GBP_VXLAN_TEMPLATE_TUNNEL
@ GBP_VXLAN_TEMPLATE_TUNNEL
This is the object type defined above.
Definition: gbp_vxlan.h:95
hash_set
#define hash_set(h, key, value)
Definition: hash.h:255
ti
u32 ti
Definition: interface_output.c:405
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
gbp_vxlan_tunnel_layer_t
enum gbp_vxlan_tunnel_layer_t_ gbp_vxlan_tunnel_layer_t
gbp_vxlan.h
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
gbp_vxlan_tunnel_t_::gt_itf
gbp_itf_hdl_t gt_itf
gbp-itf config for this interface
Definition: gbp_vxlan.h:72
vnet_get_hw_interface
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface_funcs.h:44
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
VNET_DEVICE_CLASS
VNET_DEVICE_CLASS(gbp_vxlan_device_class)
bd_rd_id
u32 bd_rd_id
Definition: gbp.api:387
l2output_feat_masks_t
l2output_feat_masks_t
Definition: l2_output.h:111
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
vxlan_gbp_unregister_udp_ports
void vxlan_gbp_unregister_udp_ports(void)
Definition: vxlan_gbp.c:367
vnet_sw_interface_t::flood_class
vnet_flood_class_t flood_class
Definition: interface.h:897
uword
u64 uword
Definition: types.h:112
vnet_delete_hw_interface
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:1052
hash_get
#define hash_get(h, key)
Definition: hash.h:249
gbp_itf_lock
void gbp_itf_lock(gbp_itf_hdl_t gh)
Definition: gbp_itf.c:260
format_gbp_itf_hdl
u8 * format_gbp_itf_hdl(u8 *s, va_list *args)
Definition: gbp_itf.c:522
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
src
vl_api_address_t src
Definition: gre.api:54
gbp_vxlan_tunnel_t_::gt_vni
u32 gt_vni
Definition: gbp_vxlan.h:43
gbp_vxlan_tx_trace_t_::vni
u32 vni
Definition: gbp_vxlan.c:371
gbp_vxlan_tunnel_t_::gt_sw_if_index
u32 gt_sw_if_index
Definition: gbp_vxlan.h:42
ip4_address_t
Definition: ip4_packet.h:50
FIB_PROTOCOL_IP4
@ FIB_PROTOCOL_IP4
Definition: fib_types.h:36
gbp_vxlan_tunnel_t_::gt_layer
gbp_vxlan_tunnel_layer_t gt_layer
Definition: gbp_vxlan.h:49
gbp_bridge_domain.h
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
L2INPUT_FEAT_NONE
@ L2INPUT_FEAT_NONE
Definition: l2_input.h:171
gbp_vxlan_cb_t
walk_rc_t(* gbp_vxlan_cb_t)(gbp_vxlan_tunnel_t *gt, void *ctx)
Definition: gbp_vxlan.h:120
vec_search
#define vec_search(v, E)
Search a vector for the index of the entry that matches.
Definition: vec.h:1054
gbp_vxlan_tunnel_layer_strings
static char * gbp_vxlan_tunnel_layer_strings[]
Definition: gbp_vxlan.c:73
gbp_vxlan_tunnel_pool
static gbp_vxlan_tunnel_t * gbp_vxlan_tunnel_pool
Pool of template tunnels.
Definition: gbp_vxlan.c:51
gbp_endpoint_flush
void gbp_endpoint_flush(gbp_endpoint_src_t src, u32 sw_if_index)
remove all learnt endpoints using the interface
Definition: gbp_endpoint.c:1038
vnet_vxlan_gbp_tunnel_add_del_args_t
Definition: vxlan_gbp.h:212
gbp_vxlan_tunnel_t_
GBP VXLAN (template) tunnel.
Definition: gbp_vxlan.h:39
vxlan_gbp_register_udp_ports
void vxlan_gbp_register_udp_ports(void)
Definition: vxlan_gbp.c:349
format_vxlan_tunnel_ref
static u8 * format_vxlan_tunnel_ref(u8 *s, va_list *args)
Definition: gbp_vxlan.c:96
vxlan_tunnel_ref_t_::vxr_parent
index_t vxr_parent
Definition: gbp_vxlan.c:34
GBP_ITF_HDL_INVALID
const static gbp_itf_hdl_t GBP_ITF_HDL_INVALID
Definition: gbp_itf.h:58
gbp_itf_l3_set_input_feature
void gbp_itf_l3_set_input_feature(gbp_itf_hdl_t gh, gbp_itf_l3_feat_t feats)
Definition: gbp_itf.c:337
vnet_hw_interface_t
Definition: interface.h:638
vnet_main_t
Definition: vnet.h:76
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
vxlan_gbp_main_t
Definition: vxlan_gbp.h:165
gbp_vxlan_tunnel_t_::gt_gbd
index_t gt_gbd
Reference to the GPB-BD.
Definition: gbp_vxlan.h:58
format_vnet_sw_if_index_name
format_function_t format_vnet_sw_if_index_name
Definition: interface_funcs.h:455
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
punt_hdl
static vlib_punt_hdl_t punt_hdl
handle registered with the ;unt infra
Definition: gbp_vxlan.c:71
vec_validate_init_empty
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
Definition: vec.h:570
VNET_FLOOD_CLASS_NO_FLOOD
@ VNET_FLOOD_CLASS_NO_FLOOD
Definition: interface.h:823
format_ip46_address
format_function_t format_ip46_address
Definition: ip46_address.h:50
u32
unsigned int u32
Definition: types.h:88
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
gbp_vxlan_init
static clib_error_t * gbp_vxlan_init(vlib_main_t *vm)
Definition: gbp_vxlan.c:626
VNET_HW_INTERFACE_CLASS
VNET_HW_INTERFACE_CLASS(gbp_vxlan_hw_interface_class)
dst
vl_api_ip4_address_t dst
Definition: pnat.api:41
gbp_itf_l3_add_and_lock_w_free
gbp_itf_hdl_t gbp_itf_l3_add_and_lock_w_free(u32 sw_if_index, index_t gri, gbp_itf_free_fn_t ff)
Definition: gbp_itf.c:253
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
si
vnet_sw_interface_t * si
Definition: interface_output.c:398
format_gbp_vxlan_tunnel
u8 * format_gbp_vxlan_tunnel(u8 *s, va_list *args)
Definition: gbp_vxlan.c:344
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
gbp_itf_l2_add_and_lock
gbp_itf_hdl_t gbp_itf_l2_add_and_lock(u32 sw_if_index, index_t gbi)
Definition: gbp_itf.c:198
vlib_punt_hdl_t
int vlib_punt_hdl_t
Typedef for a client handle.
Definition: punt.h:52
vnet_vxlan_gbp_tunnel_add_del
int vnet_vxlan_gbp_tunnel_add_del(vnet_vxlan_gbp_tunnel_add_del_args_t *a, u32 *sw_if_indexp)
Definition: vxlan_gbp.c:385
gbp_bridge_domain_find_and_lock
index_t gbp_bridge_domain_find_and_lock(u32 bd_id)
Definition: gbp_bridge_domain.c:91
gbp_bridge_domain_t_
A bridge Domain Representation.
Definition: gbp_bridge_domain.h:42
gbp_route_domain_find_and_lock
index_t gbp_route_domain_find_and_lock(u32 rd_id)
Definition: gbp_route_domain.c:100
gdb_vxlan_dep_del
static void gdb_vxlan_dep_del(u32 sw_if_index)
Definition: gbp_vxlan.c:109
format_gbp_vxlan_tx_trace
u8 * format_gbp_vxlan_tx_trace(u8 *s, va_list *args)
Definition: gbp_vxlan.c:375
hash_unset
#define hash_unset(h, key)
Definition: hash.h:261
vxlan_gbp_main_t::punt_no_such_tunnel
vlib_punt_reason_t punt_no_such_tunnel[FIB_PROTOCOL_IP_MAX]
Punt reasons for no such tunnel.
Definition: vxlan_gbp.h:198
vlib_main_t
Definition: main.h:102
vlib_node_t
Definition: node.h:247
vxlan_gbp_tunnel_unlock
void vxlan_gbp_tunnel_unlock(u32 sw_if_index)
Definition: gbp_vxlan.c:289
gbp_vxlan_tunnel_t_::gt_hw_if_index
u32 gt_hw_if_index
Definition: gbp_vxlan.h:41
VLIB_INITS
#define VLIB_INITS(...)
Definition: init.h:352
pool_get_zero
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
Definition: pool.h:258
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vnet_hw_interface_set_flags
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
Definition: interface.c:513
vxlan_tunnel_ref_db
static index_t * vxlan_tunnel_ref_db
DB of child interfaces by SW interface index.
Definition: gbp_vxlan.c:66
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
gbp_vxlan_tunnel_t_::gt_grd
index_t gt_grd
References to the GBP-RD.
Definition: gbp_vxlan.h:65
VNET_HW_INTERFACE_CLASS_FLAG_P2P
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
Definition: interface.h:394
gbp_vxlan_tunnel_t_::gt_tuns
index_t * gt_tuns
list of child vxlan-gbp tunnels built from this template
Definition: gbp_vxlan.h:77
clib_warning
#define clib_warning(format, args...)
Definition: error.h:59
VXLAN_GBP_TUNNEL
@ VXLAN_GBP_TUNNEL
A real VXLAN-GBP tunnel (from vnet/vxlan-gbp/...)
Definition: gbp_vxlan.h:100
vxlan_tunnel_ref_get
static vxlan_tunnel_ref_t * vxlan_tunnel_ref_get(index_t vxri)
Definition: gbp_vxlan.c:90
gbp_vxlan_tunnel_add
int gbp_vxlan_tunnel_add(u32 vni, gbp_vxlan_tunnel_layer_t layer, u32 bd_rd_id, const ip4_address_t *src, u32 *sw_if_indexp)
Definition: gbp_vxlan.c:439
rv
int __clib_unused rv
Definition: application.c:491
gbp_route_domain.h
IP46_TYPE_ANY
@ IP46_TYPE_ANY
Definition: ip46_address.h:24
gbp_vxlan_tunnel_type_t
enum gbp_vxlan_tunnel_type_t_ gbp_vxlan_tunnel_type_t
The different types of interfaces that endpoints are learned on.
l2input_feat_masks_t
l2input_feat_masks_t
Definition: l2_input.h:169
vlib_node_runtime_t
Definition: node.h:454
vxlan_tunnel_ref_t
struct vxlan_tunnel_ref_t_ vxlan_tunnel_ref_t
A reference to a VXLAN-GBP tunnel created as a child/dependent tunnel of the template GBP-VXLAN tunne...
vlib_cli_command_t
Definition: cli.h:92
vlib_punt_client_register
vlib_punt_hdl_t vlib_punt_client_register(const char *who)
Register a new clinet.
Definition: punt.c:171
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
gt_logger
static vlib_log_class_t gt_logger
Logger.
Definition: gbp_vxlan.c:46
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
gbp_vxlan_walk
void gbp_vxlan_walk(gbp_vxlan_cb_t cb, void *ctx)
Definition: gbp_vxlan.c:304
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
gbp_vxlan_show_node
static vlib_cli_command_t gbp_vxlan_show_node
(constructor) VLIB_CLI_COMMAND (gbp_vxlan_show_node)
Definition: gbp_vxlan.c:618
gbp_bridge_domain_t_::gb_flags
gbp_bridge_domain_flags_t gb_flags
Flags conttrolling behaviour.
Definition: gbp_bridge_domain.h:59
gbp_vxlan_tx_trace_t_
Definition: gbp_vxlan.c:369
gbp_vxlan_tunnel_get
gbp_vxlan_tunnel_t * gbp_vxlan_tunnel_get(index_t gti)
Definition: gbp_vxlan.c:84
vxlan_gbp_main
vxlan_gbp_main_t vxlan_gbp_main
Definition: vxlan_gbp.c:35
vnet_register_interface
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
Definition: interface.c:812
gbp_vxlan_tunnel_del
int gbp_vxlan_tunnel_del(u32 vni)
Definition: gbp_vxlan.c:550
vec_del1
#define vec_del1(v, i)
Delete the element at index I.
Definition: vec.h:896
vxlan_gbp.h
gbp_route_domain_unlock
void gbp_route_domain_unlock(index_t index)
Definition: gbp_route_domain.c:208
gbp_itf_unlock
void gbp_itf_unlock(gbp_itf_hdl_t *gh)
Definition: gbp_itf.c:288
gbp_bridge_domain_unlock
void gbp_bridge_domain_unlock(index_t gbdi)
Definition: gbp_bridge_domain.c:312
gbp_vxlan_tunnel_t_::gt_bd_rd_id
u32 gt_bd_rd_id
The BD or RD value (depending on the layer) that the tunnel is bound to.
Definition: gbp_vxlan.h:48
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105