FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
gbp_endpoint.c
Go to the documentation of this file.
1 /*
2  * gbp.h : Group Based Policy
3  *
4  * Copyright (c) 2018 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
20 #include <plugins/gbp/gbp_itf.h>
25 #include <plugins/gbp/gbp_vxlan.h>
26 
27 #include <vnet/l2/l2_input.h>
28 #include <vnet/l2/l2_output.h>
29 #include <vnet/l2/feat_bitmap.h>
30 #include <vnet/l2/l2_fib.h>
31 #include <vnet/fib/fib_table.h>
33 #include <vnet/fib/fib_walk.h>
35 
37 
38 /**
39  * EP DBs
40  */
42 
47 
48 #define GBP_ENDPOINT_DBG(...) \
49  vlib_log_debug (gbp_ep_logger, __VA_ARGS__);
50 
51 #define GBP_ENDPOINT_INFO(...) \
52  vlib_log_notice (gbp_ep_logger, __VA_ARGS__);
53 
54 /**
55  * Pool of GBP endpoints
56  */
58 
59 /**
60  * A count of the number of dynamic entries
61  */
63 
64 #define FOR_EACH_GBP_ENDPOINT_ATTR(_item) \
65  for (_item = GBP_ENDPOINT_ATTR_FIRST; \
66  _item < GBP_ENDPOINT_ATTR_LAST; \
67  _item++)
68 
69 u8 *
70 format_gbp_endpoint_flags (u8 * s, va_list * args)
71 {
74 
76  {
77  if ((1 << attr) & flags)
78  {
79  s = format (s, "%s,", gbp_endpoint_attr_names[attr]);
80  }
81  }
82 
83  return (s);
84 }
85 
86 int
88 {
89  return (! !(ge->ge_fwd.gef_flags & GBP_ENDPOINT_FLAG_REMOTE));
90 }
91 
92 int
94 {
95  return (!(ge->ge_fwd.gef_flags & GBP_ENDPOINT_FLAG_REMOTE));
96 }
97 
98 int
100 {
101  return (! !(ge->ge_fwd.gef_flags & GBP_ENDPOINT_FLAG_EXTERNAL));
102 }
103 
104 int
106 {
107  if (0 == vec_len (ge->ge_locs))
108  return 0;
109 
110  /* DP is the highest source so if present it will be first */
111  return (ge->ge_locs[0].gel_src == GBP_ENDPOINT_SRC_DP);
112 }
113 
114 static void
117 {
118  mac_address_from_u64 (mac, key->key[0]);
119  *sw_if_index = key->key[1];
120 }
121 
122 static void
124  ip46_address_t * ip, u32 * sw_if_index)
125 {
126  ip->as_u64[0] = key->key[0];
127  ip->as_u64[1] = key->key[1];
128  *sw_if_index = key->key[2];
129 }
130 
132 gbp_endpoint_find_ip (const ip46_address_t * ip, u32 fib_index)
133 {
135  int rv;
136 
137  gbp_endpoint_mk_key_ip (ip, fib_index, &key);
138 
139  rv = clib_bihash_search_24_8 (&gbp_ep_db.ged_by_ip_rd, &key, &value);
140 
141  if (0 != rv)
142  return NULL;
143 
144  return (gbp_endpoint_get (value.value));
145 }
146 
147 static void
149 {
150  vec_validate_init_empty (gbp_ep_db.ged_by_sw_if_index, sw_if_index, ~0);
151 
152  gbp_ep_db.ged_by_sw_if_index[sw_if_index] = gei;
153 }
154 
155 static bool
157 {
159  int rv;
160 
161  gbp_endpoint_mk_key_mac (mac->bytes, bd_index, &key);
162  key.value = gei;
163 
164  rv = clib_bihash_add_del_16_8 (&gbp_ep_db.ged_by_mac_bd, &key, 1);
165 
166 
167  return (0 == rv);
168 }
169 
170 static bool
171 gbp_endpoint_add_ip (const ip46_address_t * ip, u32 fib_index, index_t gei)
172 {
174  int rv;
175 
176  gbp_endpoint_mk_key_ip (ip, fib_index, &key);
177  key.value = gei;
178 
179  rv = clib_bihash_add_del_24_8 (&gbp_ep_db.ged_by_ip_rd, &key, 1);
180 
181  return (0 == rv);
182 }
183 
184 static void
186 {
188 
189  gbp_endpoint_mk_key_mac (mac->bytes, bd_index, &key);
190 
191  clib_bihash_add_del_16_8 (&gbp_ep_db.ged_by_mac_bd, &key, 0);
192 }
193 
194 static void
195 gbp_endpoint_del_ip (const ip46_address_t * ip, u32 fib_index)
196 {
198 
199  gbp_endpoint_mk_key_ip (ip, fib_index, &key);
200 
201  clib_bihash_add_del_24_8 (&gbp_ep_db.ged_by_ip_rd, &key, 0);
202 }
203 
204 static index_t
206 {
207  return (ge - gbp_endpoint_pool);
208 }
209 
210 static int
211 gbp_endpoint_ip_is_equal (const fib_prefix_t * fp, const ip46_address_t * ip)
212 {
213  return (ip46_address_is_equal (ip, &fp->fp_addr));
214 }
215 
216 static void
218  const ip46_address_t * ips,
219  const gbp_route_domain_t * grd)
220 {
221  const ip46_address_t *ip;
222  index_t gei, grdi;
223 
224  gei = gbp_endpoint_index (ge);
225  grdi = gbp_route_domain_index (grd);
226 
227  ASSERT ((ge->ge_key.gek_grd == INDEX_INVALID) ||
228  (ge->ge_key.gek_grd == grdi));
229 
230  vec_foreach (ip, ips)
231  {
232  if (~0 == vec_search_with_function (ge->ge_key.gek_ips, ip,
234  {
235  fib_prefix_t *pfx;
236 
237  vec_add2 (ge->ge_key.gek_ips, pfx, 1);
238  fib_prefix_from_ip46_addr (ip, pfx);
239 
241  grd->grd_fib_index[pfx->fp_proto], gei);
242  }
243  ge->ge_key.gek_grd = grdi;
244  }
245 }
246 
247 static gbp_endpoint_t *
248 gbp_endpoint_alloc (const ip46_address_t * ips,
249  const gbp_route_domain_t * grd,
250  const mac_address_t * mac,
251  const gbp_bridge_domain_t * gbd)
252 {
254  index_t gei;
255 
256  pool_get_zero (gbp_endpoint_pool, ge);
257 
259  gei = gbp_endpoint_index (ge);
260  ge->ge_key.gek_gbd =
265 
266  if (NULL != mac)
267  {
268  mac_address_copy (&ge->ge_key.gek_mac, mac);
269  gbp_endpoint_add_mac (mac, gbd->gb_bd_index, gei);
270  }
271  gbp_endpoint_ips_update (ge, ips, grd);
272 
273  return (ge);
274 }
275 
276 static int
278 {
279  return (a->gel_src == b->gel_src);
280 }
281 
282 static int
284 {
285  return (a->gel_src - b->gel_src);
286 }
287 
288 static gbp_endpoint_loc_t *
290 {
291  gbp_endpoint_loc_t gel = {
292  .gel_src = src,
293  };
294  u32 pos;
295 
296  pos = vec_search_with_function (ge->ge_locs, &gel,
298 
299  if (~0 != pos)
300  return (&ge->ge_locs[pos]);
301 
302  return NULL;
303 }
304 
305 static int
307 {
308  u32 pos;
309 
310  gel->gel_locks--;
311 
312  if (0 == gel->gel_locks)
313  {
314  pos = gel - ge->ge_locs;
315 
316  vec_del1 (ge->ge_locs, pos);
317  if (vec_len (ge->ge_locs) > 1)
319 
320  /* This could be the last lock, so don't access the EP from
321  * this point on */
322  fib_node_unlock (&ge->ge_node);
323 
324  return (1);
325  }
326  return (0);
327 }
328 
329 static void
331 {
333  gbp_itf_unlock (&gel->gel_itf);
334 }
335 
336 static gbp_endpoint_loc_t *
338 {
339  gbp_endpoint_loc_t gel = {
340  .gel_src = src,
341  .gel_epg = INDEX_INVALID,
342  .gel_itf = GBP_ITF_HDL_INVALID,
343  .gel_locks = 0,
344  };
345  u32 pos;
346 
347  pos = vec_search_with_function (ge->ge_locs, &gel,
349 
350  if (~0 == pos)
351  {
352  vec_add1 (ge->ge_locs, gel);
353 
354  if (vec_len (ge->ge_locs) > 1)
355  {
357 
358  pos = vec_search_with_function (ge->ge_locs, &gel,
360  }
361  else
362  pos = 0;
363 
364  /*
365  * it's the sources and children that lock the endpoints
366  */
367  fib_node_lock (&ge->ge_node);
368  }
369 
370  return (&ge->ge_locs[pos]);
371 }
372 
373 /**
374  * Find an EP inthe DBs and check that if we find it in the L2 DB
375  * it has the same IPs as this update
376  */
377 static int
378 gbp_endpoint_find_for_update (const ip46_address_t * ips,
379  const gbp_route_domain_t * grd,
380  const mac_address_t * mac,
381  const gbp_bridge_domain_t * gbd,
382  gbp_endpoint_t ** ge)
383 {
384  gbp_endpoint_t *l2_ge, *l3_ge, *tmp;
385 
386  l2_ge = l3_ge = NULL;
387 
388  if (NULL != mac && !mac_address_is_zero (mac))
389  {
390  ASSERT (gbd);
391  l2_ge = gbp_endpoint_find_mac (mac->bytes, gbd->gb_bd_index);
392  }
393  if (NULL != ips && !ip46_address_is_zero (ips))
394  {
395  const ip46_address_t *ip;
396  fib_protocol_t fproto;
397 
398  ASSERT (grd);
399  vec_foreach (ip, ips)
400  {
402 
403  tmp = gbp_endpoint_find_ip (ip, grd->grd_fib_index[fproto]);
404 
405  if (NULL == tmp)
406  /* not found */
407  continue;
408  else if (NULL == l3_ge)
409  /* first match against an IP address */
410  l3_ge = tmp;
411  else if (tmp == l3_ge)
412  /* another match against IP address that is the same endpoint */
413  continue;
414  else
415  {
416  /*
417  * a match agains a different endpoint.
418  * this means the KEY of the EP is changing which is not allowed
419  */
420  return (-1);
421  }
422  }
423  }
424 
425  if (NULL == l2_ge && NULL == l3_ge)
426  /* not found */
427  *ge = NULL;
428  else if (NULL == l2_ge)
429  /* found at L3 */
430  *ge = l3_ge;
431  else if (NULL == l3_ge)
432  /* found at L2 */
433  *ge = l2_ge;
434  else
435  {
436  /* found both L3 and L2 - they must be the same else the KEY
437  * is changing
438  */
439  if (l2_ge == l3_ge)
440  *ge = l2_ge;
441  else
442  return (-1);
443  }
444 
445  return (0);
446 }
447 
448 static gbp_endpoint_src_t
450 {
451  if (0 == vec_len (ge->ge_locs))
452  return (GBP_ENDPOINT_SRC_MAX);
453 
454  return (ge->ge_locs[0].gel_src);
455 }
456 
457 static void
459 {
461 
462  if (n > 0 && 1 == gbp_n_learnt_endpoints)
463  {
465  gbp_scanner_node.index,
467  }
468  if (n < 0 && 0 == gbp_n_learnt_endpoints)
469  {
471  gbp_scanner_node.index,
473  }
474 }
475 
476 static void
478  gbp_endpoint_loc_t * gel,
479  const gbp_bridge_domain_t * gb,
481  index_t ggi,
483  const ip46_address_t * tun_src,
484  const ip46_address_t * tun_dst)
485 {
486  int was_learnt, is_learnt;
487 
488  gel->gel_locks++;
489  was_learnt = ! !(gel->gel_flags & GBP_ENDPOINT_FLAG_REMOTE);
490  gel->gel_flags = flags;
491  is_learnt = ! !(gel->gel_flags & GBP_ENDPOINT_FLAG_REMOTE);
492 
493  gbp_endpoint_n_learned (is_learnt - was_learnt);
494 
495  /*
496  * update the EPG
497  */
500  gel->gel_epg = ggi;
501 
503  {
504  if (NULL != tun_src)
505  ip46_address_copy (&gel->tun.gel_src, tun_src);
506  if (NULL != tun_dst)
507  ip46_address_copy (&gel->tun.gel_dst, tun_dst);
508 
510  {
511  /*
512  * we learnt the EP from the multicast tunnel.
513  * Create a unicast TEP from the packet's source
514  * and the fixed address of the BD's parent tunnel
515  */
516  const gbp_vxlan_tunnel_t *gt;
517 
518  gt = gbp_vxlan_tunnel_get (gb->gb_vni);
519 
520  if (NULL != gt)
521  {
522  ip46_address_copy (&gel->tun.gel_src, &gt->gt_src);
523  sw_if_index = gt->gt_sw_if_index;
524  }
525  }
526 
527  /*
528  * the input interface may be the parent GBP-vxlan interface,
529  * create a child vlxan-gbp tunnel and use that as the endpoint's
530  * interface.
531  */
532  gbp_itf_hdl_t old = gel->gel_itf;
533 
534  switch (gbp_vxlan_tunnel_get_type (sw_if_index))
535  {
538  gel->gel_itf = gbp_vxlan_tunnel_clone_and_lock (sw_if_index,
539  &gel->tun.gel_src,
540  &gel->tun.gel_dst);
541  break;
542  case VXLAN_GBP_TUNNEL:
544  vxlan_gbp_tunnel_get_parent (sw_if_index);
545  gel->gel_itf = vxlan_gbp_tunnel_lock_itf (sw_if_index);
546  break;
547  }
548 
549  gbp_itf_unlock (&old);
550  }
551  else
552  {
553  gel->gel_itf = gbp_itf_l2_add_and_lock (sw_if_index,
554  ge->ge_key.gek_gbd);
555  }
556 }
557 
558 static void
560 {
561  const gbp_route_domain_t *grd;
562  const gbp_bridge_domain_t *gbd;
563  gbp_endpoint_fwd_t *gef;
564  const fib_prefix_t *pfx;
565  index_t *ai;
566 
568  gef = &ge->ge_fwd;
569 
570  vec_foreach (pfx, ge->ge_key.gek_ips)
571  {
572  u32 fib_index;
573 
574  grd = gbp_route_domain_get (ge->ge_key.gek_grd);
575  fib_index = grd->grd_fib_index[pfx->fp_proto];
576 
578  &pfx->fp_addr, &ge->ge_key.gek_mac, 0);
579 
580  /*
581  * remove a host route
582  */
583  if (gbp_endpoint_is_remote (ge))
584  {
586  }
587 
588  fib_table_entry_delete (fib_index, pfx, gbp_fib_source_low);
589  }
590  vec_foreach (ai, gef->gef_adjs)
591  {
592  adj_unlock (*ai);
593  }
594 
595  if (gbp_itf_hdl_is_valid (gef->gef_itf))
596  {
598  gbd->gb_bd_index,
600  }
601 
602  gbp_itf_unlock (&gef->gef_itf);
603  vec_free (gef->gef_adjs);
604 }
605 
606 static void
608 {
609  const gbp_bridge_domain_t *gbd;
610  const gbp_endpoint_group_t *gg;
611  const gbp_route_domain_t *grd;
612  gbp_endpoint_loc_t *gel;
613  gbp_endpoint_fwd_t *gef;
614  const fib_prefix_t *pfx;
615  index_t gei;
616 
617  /*
618  * locations are sort in source priority order
619  */
620  gei = gbp_endpoint_index (ge);
621  gel = &ge->ge_locs[0];
622  gef = &ge->ge_fwd;
624 
625  gef->gef_flags = gel->gel_flags;
626 
627  if (INDEX_INVALID != gel->gel_epg)
628  {
629  gg = gbp_endpoint_group_get (gel->gel_epg);
630  gef->gef_sclass = gg->gg_sclass;
631  }
632  else
633  {
634  gg = NULL;
635  }
636 
637  gef->gef_itf = gbp_itf_clone_and_lock (gel->gel_itf);
638 
639  if (!mac_address_is_zero (&ge->ge_key.gek_mac))
640  {
641  gbp_itf_l2_set_input_feature (gef->gef_itf, L2INPUT_FEAT_GBP_FWD);
642 
644  {
645  /*
646  * bridged packets to external endpoints should be classifed
647  * based on the EP's/BD's EPG
648  */
650  L2OUTPUT_FEAT_GBP_POLICY_MAC);
651  }
652  else
653  {
656  L2OUTPUT_FEAT_GBP_POLICY_PORT);
657  }
659  gbd->gb_bd_index,
661  L2FIB_ENTRY_RESULT_FLAG_STATIC);
662  }
663 
664  vec_foreach (pfx, ge->ge_key.gek_ips)
665  {
666  ethernet_header_t *eth;
667  u32 ip_sw_if_index;
668  u32 fib_index;
669  u8 *rewrite;
670  index_t ai;
671 
672  rewrite = NULL;
673  grd = gbp_route_domain_get (ge->ge_key.gek_grd);
674  fib_index = grd->grd_fib_index[pfx->fp_proto];
675  gef->gef_fib_index = fib_index;
676 
678  &pfx->fp_addr, &ge->ge_key.gek_mac, 1);
679 
680  /*
681  * add a host route via the EPG's BVI we need this because the
682  * adj fib does not install, due to cover refinement check, since
683  * the BVI's prefix is /32
684  */
685  vec_validate (rewrite, sizeof (*eth) - 1);
686  eth = (ethernet_header_t *) rewrite;
687 
688  eth->type = clib_host_to_net_u16 ((pfx->fp_proto == FIB_PROTOCOL_IP4 ?
689  ETHERNET_TYPE_IP4 :
690  ETHERNET_TYPE_IP6));
691 
692  if (gbp_endpoint_is_remote (ge))
693  {
694  /*
695  * for dynamic EPs we must add the IP adjacency via the learned
696  * tunnel since the BD will not contain the EP's MAC since it was
697  * L3 learned. The dst MAC address used is the 'BD's MAC'.
698  */
699  ip_sw_if_index = gbp_itf_get_sw_if_index (gef->gef_itf);
700 
702  eth->src_address);
704  eth->dst_address);
705  }
706  else
707  {
708  /*
709  * for the static EPs we add the IP adjacency via the BVI
710  * knowing that the BD has the MAC address to route to and
711  * that policy will be applied on egress to the EP's port
712  */
713  ip_sw_if_index = gbd->gb_bvi_sw_if_index;
714 
715  clib_memcpy (eth->src_address,
717  ip_sw_if_index),
718  sizeof (eth->src_address));
720  }
721 
722  fib_table_entry_path_add (fib_index, pfx,
725  fib_proto_to_dpo (pfx->fp_proto),
726  &pfx->fp_addr, ip_sw_if_index,
728 
731  &pfx->fp_addr,
732  ip_sw_if_index, rewrite);
733  vec_add1 (gef->gef_adjs, ai);
734 
735  /*
736  * if the endpoint is external then routed packet to it must be
737  * classifed to the BD's EPG. but this will happen anyway with
738  * the GBP_MAC classification.
739  */
740 
741  if (NULL != gg)
742  {
743  if (gbp_endpoint_is_remote (ge))
744  {
745  dpo_id_t policy_dpo = DPO_INVALID;
746 
747  /*
748  * interpose a policy DPO from the endpoint so that policy
749  * is applied
750  */
752  grd->grd_scope,
753  gg->gg_sclass, ~0, &policy_dpo);
754 
755  fib_table_entry_special_dpo_add (fib_index, pfx,
758  &policy_dpo);
759  dpo_reset (&policy_dpo);
760  }
761 
762  /*
763  * send a gratuitous ARP on the EPG's uplink. this is done so
764  * that if this EP has moved from some other place in the
765  * 'fabric', upstream devices are informed
766  */
767  if (gbp_endpoint_is_local (ge) && ~0 != gg->gg_uplink_sw_if_index)
768  {
770  gei);
772  (FIB_PROTOCOL_IP4 == pfx->fp_proto ?
773  IP46_TYPE_IP4 :
774  IP46_TYPE_IP6),
775  &pfx->fp_addr, gg->gg_uplink_sw_if_index);
776  }
777  }
778  }
779 
780  if (gbp_endpoint_is_external (ge))
781  {
783  L2INPUT_FEAT_GBP_LPM_CLASSIFY);
784  }
785  else if (gbp_endpoint_is_local (ge))
786  {
787  /*
788  * non-remote endpoints (i.e. those not arriving on iVXLAN
789  * tunnels) need to be classifed based on the the input interface.
790  * We enable the GBP-FWD feature only if the group has an uplink
791  * interface (on which the GBP-FWD feature would send UU traffic).
792  * External endpoints get classified based on an LPM match
793  */
794  l2input_feat_masks_t feats = L2INPUT_FEAT_GBP_SRC_CLASSIFY;
795 
796  if (NULL != gg && ~0 != gg->gg_uplink_sw_if_index)
797  feats |= L2INPUT_FEAT_GBP_FWD;
799  }
800 
801  /*
802  * update children with the new forwarding info
803  */
804  fib_node_back_walk_ctx_t bw_ctx = {
806  .fnbw_flags = FIB_NODE_BW_FLAG_FORCE_SYNC,
807  };
808 
809  fib_walk_sync (gbp_endpoint_fib_type, gei, &bw_ctx);
810 }
811 
812 int
815  const ip46_address_t * ips,
816  const mac_address_t * mac,
817  index_t gbdi, index_t grdi,
820  const ip46_address_t * tun_src,
821  const ip46_address_t * tun_dst, u32 * handle)
822 {
823  gbp_bridge_domain_t *gbd;
825  gbp_endpoint_src_t best;
826  gbp_route_domain_t *grd;
827  gbp_endpoint_loc_t *gel;
829  index_t ggi, gei;
830  int rv;
831 
832  if (~0 == sw_if_index)
833  return (VNET_API_ERROR_INVALID_SW_IF_INDEX);
834 
835  ge = NULL;
836  gg = NULL;
837 
838  /*
839  * we need to determine the bridge-domain, either from the EPG or
840  * the BD passed
841  */
842  if (SCLASS_INVALID != sclass)
843  {
844  ggi = gbp_endpoint_group_find (sclass);
845 
846  if (INDEX_INVALID == ggi)
847  return (VNET_API_ERROR_NO_SUCH_ENTRY);
848 
849  gg = gbp_endpoint_group_get (ggi);
850  gbdi = gg->gg_gbd;
851  grdi = gg->gg_rd;
852  }
853  else
854  {
855  if (INDEX_INVALID == gbdi)
856  return (VNET_API_ERROR_NO_SUCH_ENTRY);
857  if (INDEX_INVALID == grdi)
858  return (VNET_API_ERROR_NO_SUCH_FIB);
859  ggi = INDEX_INVALID;
860  }
861 
862  gbd = gbp_bridge_domain_get (gbdi);
863  grd = gbp_route_domain_get (grdi);
864  rv = gbp_endpoint_find_for_update (ips, grd, mac, gbd, &ge);
865 
866  if (0 != rv)
867  return (rv);
868 
869  if (NULL == ge)
870  {
871  ge = gbp_endpoint_alloc (ips, grd, mac, gbd);
872  }
873  else
874  {
875  gbp_endpoint_ips_update (ge, ips, grd);
876  }
877 
878  best = gbp_endpoint_get_best_src (ge);
879  gei = gbp_endpoint_index (ge);
880  gel = gbp_endpoint_loc_find_or_add (ge, src);
881 
882  gbp_endpoint_loc_update (ge, gel, gbd, sw_if_index, ggi, flags,
883  tun_src, tun_dst);
884 
885  if (src <= best)
886  {
887  /*
888  * either the best source has been updated or we have a new best source
889  */
892  }
893  else
894  {
895  /*
896  * an update to a lower priority source, so we need do nothing
897  */
898  }
899 
900  if (handle)
901  *handle = gei;
902 
903  GBP_ENDPOINT_INFO ("update: %U", format_gbp_endpoint, gei);
904 
905  return (0);
906 }
907 
908 void
910 {
911  gbp_endpoint_loc_t *gel, gel_copy;
912  gbp_endpoint_src_t best;
914  int removed;
915 
916  if (pool_is_free_index (gbp_endpoint_pool, gei))
917  return;
918 
919  GBP_ENDPOINT_INFO ("delete: %U", format_gbp_endpoint, gei);
920 
921  ge = gbp_endpoint_get (gei);
922 
923  gel = gbp_endpoint_loc_find (ge, src);
924 
925  if (NULL == gel)
926  return;
927 
928  /*
929  * lock the EP so we can control when it is deleted
930  */
931  fib_node_lock (&ge->ge_node);
932  best = gbp_endpoint_get_best_src (ge);
933 
934  /*
935  * copy the location info since we'll lose it when it's removed from
936  * the vector
937  */
938  clib_memcpy (&gel_copy, gel, sizeof (gel_copy));
939 
940  /*
941  * remove the source we no longer need
942  */
943  removed = gbp_endpoint_loc_unlock (ge, gel);
944 
945  if (src == best)
946  {
947  /*
948  * we have removed the old best source => recalculate fwding
949  */
950  if (0 == vec_len (ge->ge_locs))
951  {
952  /*
953  * if there are no more sources left, then we need only release
954  * the fwding resources held and then this EP is gawn.
955  */
957  }
958  else
959  {
960  /*
961  * else there are more sources. release the old and get new
962  * fwding objects
963  */
966  }
967  }
968  /*
969  * else
970  * we removed a lower priority source so we need to do nothing
971  */
972 
973  /*
974  * clear up any resources held by the source
975  */
976  if (removed)
977  gbp_endpoint_loc_destroy (&gel_copy);
978 
979  /*
980  * remove the lock taken above
981  */
982  fib_node_unlock (&ge->ge_node);
983  /*
984  * We may have removed the last source and so this EP is now TOAST
985  * DO NOTHING BELOW HERE
986  */
987 }
988 
989 u32
992 {
993  return (fib_node_child_add (gbp_endpoint_fib_type, gei, type, index));
994 }
995 
996 void
998 {
999  return (fib_node_child_remove (gbp_endpoint_fib_type, gei, sibling));
1000 }
1001 
1003 {
1008 
1009 static walk_rc_t
1011 {
1012  gbp_endpoint_flush_ctx_t *ctx = args;
1013  gbp_endpoint_loc_t *gel;
1014  gbp_endpoint_t *ge;
1015 
1016  ge = gbp_endpoint_get (gei);
1017  gel = gbp_endpoint_loc_find (ge, ctx->src);
1018 
1019  if ((NULL != gel) && ctx->sw_if_index == gel->tun.gel_parent_sw_if_index)
1020  {
1021  vec_add1 (ctx->geis, gei);
1022  }
1023 
1024  return (WALK_CONTINUE);
1025 }
1026 
1027 /**
1028  * remove all learnt endpoints using the interface
1029  */
1030 void
1032 {
1034  .sw_if_index = sw_if_index,
1035  .src = src,
1036  };
1037  index_t *gei;
1038 
1039  GBP_ENDPOINT_INFO ("flush: %U %U",
1042  sw_if_index);
1044 
1045  vec_foreach (gei, ctx.geis)
1046  {
1047  gbp_endpoint_unlock (src, *gei);
1048  }
1049 
1050  vec_free (ctx.geis);
1051 }
1052 
1053 void
1055 {
1056  u32 index;
1057 
1058  /* *INDENT-OFF* */
1059  pool_foreach_index(index, gbp_endpoint_pool,
1060  {
1061  if (!cb(index, ctx))
1062  break;
1063  });
1064  /* *INDENT-ON* */
1065 }
1066 
1067 static clib_error_t *
1069  unformat_input_t * input, vlib_cli_command_t * cmd)
1070 {
1071  ip46_address_t ip = ip46_address_initializer, *ips = NULL;
1073  vnet_main_t *vnm = vnet_get_main ();
1075  u32 handle = INDEX_INVALID;
1076  u32 sw_if_index = ~0;
1078  u8 add = 1;
1079  int rv;
1080 
1081  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1082  {
1083  ip46_address_reset (&ip);
1084 
1085  if (unformat (input, "%U", unformat_vnet_sw_interface,
1086  vnm, &sw_if_index))
1087  ;
1088  else if (unformat (input, "add"))
1089  add = 1;
1090  else if (unformat (input, "del"))
1091  add = 0;
1092  else if (unformat (input, "sclass %d", &sclass))
1093  ;
1094  else if (unformat (input, "handle %d", &handle))
1095  ;
1096  else if (unformat (input, "ip %U", unformat_ip4_address, &ip.ip4))
1097  vec_add1 (ips, ip);
1098  else if (unformat (input, "ip %U", unformat_ip6_address, &ip.ip6))
1099  vec_add1 (ips, ip);
1100  else if (unformat (input, "mac %U", unformat_mac_address, &mac))
1101  ;
1102  else if (unformat (input, "flags 0x%x", &flags))
1103  ;
1104  else
1105  break;
1106  }
1107 
1108  if (add)
1109  {
1110  if (~0 == sw_if_index)
1111  return clib_error_return (0, "interface must be specified");
1112  if (SCLASS_INVALID == sclass)
1113  return clib_error_return (0, "SCLASS must be specified");
1114 
1115  rv =
1116  gbp_endpoint_update_and_lock (GBP_ENDPOINT_SRC_CP,
1117  sw_if_index, ips, &mac,
1119  sclass, flags, NULL, NULL, &handle);
1120 
1121  if (rv)
1122  return clib_error_return (0, "GBP Endpoint update returned %d", rv);
1123  else
1124  vlib_cli_output (vm, "handle %d\n", handle);
1125  }
1126  else
1127  {
1128  if (INDEX_INVALID == handle)
1129  return clib_error_return (0, "handle must be specified");
1130 
1131  gbp_endpoint_unlock (GBP_ENDPOINT_SRC_CP, handle);
1132  }
1133 
1134  vec_free (ips);
1135 
1136  return (NULL);
1137 }
1138 
1139 /*?
1140  * Configure a GBP Endpoint
1141  *
1142  * @cliexpar
1143  * @cliexstart{gbp endpoint del <handle> | [add] <interface> sclass <SCLASS> ip <IP> mac <MAC> [flags <flags>]}
1144  * @cliexend
1145  ?*/
1146 /* *INDENT-OFF* */
1147 VLIB_CLI_COMMAND (gbp_endpoint_cli_node, static) = {
1148  .path = "gbp endpoint",
1149  .short_help = "gbp endpoint del <handle> | [add] <interface> sclass <SCLASS> ip <IP> mac <MAC> [flags <flags>]",
1150  .function = gbp_endpoint_cli,
1151 };
1152 /* *INDENT-ON* */
1153 
1154 u8 *
1155 format_gbp_endpoint_src (u8 * s, va_list * args)
1156 {
1157  gbp_endpoint_src_t action = va_arg (*args, gbp_endpoint_src_t);
1158 
1159  switch (action)
1160  {
1161 #define _(v,a) case GBP_ENDPOINT_SRC_##v: return (format (s, "%s", a));
1163 #undef _
1164  }
1165 
1166  return (format (s, "unknown"));
1167 }
1168 
1169 static u8 *
1170 format_gbp_endpoint_fwd (u8 * s, va_list * args)
1171 {
1172  gbp_endpoint_fwd_t *gef = va_arg (*args, gbp_endpoint_fwd_t *);
1173 
1174  s = format (s, "fwd:");
1175  s = format (s, "\n itf:[%U]", format_gbp_itf_hdl, gef->gef_itf);
1176  if (GBP_ENDPOINT_FLAG_NONE != gef->gef_flags)
1177  {
1178  s = format (s, " flags:%U", format_gbp_endpoint_flags, gef->gef_flags);
1179  }
1180 
1181  return (s);
1182 }
1183 
1184 static u8 *
1185 format_gbp_endpoint_key (u8 * s, va_list * args)
1186 {
1187  gbp_endpoint_key_t *gek = va_arg (*args, gbp_endpoint_key_t *);
1188  const fib_prefix_t *pfx;
1189 
1190  s = format (s, "ips:[");
1191 
1192  vec_foreach (pfx, gek->gek_ips)
1193  {
1194  s = format (s, "%U, ", format_fib_prefix, pfx);
1195  }
1196  s = format (s, "]");
1197 
1198  s = format (s, " mac:%U", format_mac_address_t, &gek->gek_mac);
1199 
1200  return (s);
1201 }
1202 
1203 static u8 *
1204 format_gbp_endpoint_loc (u8 * s, va_list * args)
1205 {
1206  gbp_endpoint_loc_t *gel = va_arg (*args, gbp_endpoint_loc_t *);
1207 
1208  s = format (s, "%U", format_gbp_endpoint_src, gel->gel_src);
1209  s = format (s, "\n EPG:%d [%U]", gel->gel_epg,
1210  format_gbp_itf_hdl, gel->gel_itf);
1211 
1212  if (GBP_ENDPOINT_FLAG_NONE != gel->gel_flags)
1213  {
1214  s = format (s, " flags:%U", format_gbp_endpoint_flags, gel->gel_flags);
1215  }
1217  {
1218  s = format (s, " tun:[");
1219  s = format (s, "parent:%U", format_vnet_sw_if_index_name,
1221  s = format (s, " {%U,%U}]",
1224  }
1225 
1226  return (s);
1227 }
1228 
1229 u8 *
1230 format_gbp_endpoint (u8 * s, va_list * args)
1231 {
1232  index_t gei = va_arg (*args, index_t);
1233  gbp_endpoint_loc_t *gel;
1234  gbp_endpoint_t *ge;
1235 
1236  ge = gbp_endpoint_get (gei);
1237 
1238  s = format (s, "[@%d] %U", gei, format_gbp_endpoint_key, &ge->ge_key);
1239  s = format (s, " last-time:[%f]", ge->ge_last_time);
1240 
1241  vec_foreach (gel, ge->ge_locs)
1242  {
1243  s = format (s, "\n %U", format_gbp_endpoint_loc, gel);
1244  }
1245  s = format (s, "\n %U", format_gbp_endpoint_fwd, &ge->ge_fwd);
1246 
1247  return s;
1248 }
1249 
1250 static walk_rc_t
1252 {
1253  vlib_main_t *vm;
1254 
1255  vm = ctx;
1256  vlib_cli_output (vm, " %U", format_gbp_endpoint, gei);
1257 
1258  return (WALK_CONTINUE);
1259 }
1260 
1261 static int
1263 {
1264  ip46_address_t ip;
1265  vlib_main_t *vm;
1266  u32 sw_if_index;
1267 
1268  vm = arg;
1269 
1270  gbp_endpoint_extract_key_ip_itf (kvp, &ip, &sw_if_index);
1271 
1272  vlib_cli_output (vm, " {%U, %U} -> %d",
1275  sw_if_index, kvp->value);
1276  return (BIHASH_WALK_CONTINUE);
1277 }
1278 
1279 static int
1281 {
1283  vlib_main_t *vm;
1284  u32 sw_if_index;
1285 
1286  vm = arg;
1287 
1288  gbp_endpoint_extract_key_mac_itf (kvp, &mac, &sw_if_index);
1289 
1290  vlib_cli_output (vm, " {%U, %U} -> %d",
1291  format_mac_address_t, &mac,
1293  sw_if_index, kvp->value);
1294  return (BIHASH_WALK_CONTINUE);
1295 }
1296 
1297 static clib_error_t *
1299  unformat_input_t * input, vlib_cli_command_t * cmd)
1300 {
1301  u32 show_dbs, handle;
1302 
1303  handle = INDEX_INVALID;
1304  show_dbs = 0;
1305 
1306  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1307  {
1308  if (unformat (input, "%d", &handle))
1309  ;
1310  else if (unformat (input, "db"))
1311  show_dbs = 1;
1312  else
1313  break;
1314  }
1315 
1316  if (INDEX_INVALID != handle)
1317  {
1318  vlib_cli_output (vm, "%U", format_gbp_endpoint, handle);
1319  }
1320  else if (show_dbs)
1321  {
1322  vlib_cli_output (vm, "\nDatabases:");
1323  clib_bihash_foreach_key_value_pair_24_8 (&gbp_ep_db.ged_by_ip_rd,
1325  clib_bihash_foreach_key_value_pair_16_8
1326  (&gbp_ep_db.ged_by_mac_bd, gbp_endpoint_walk_mac_itf, vm);
1327  }
1328  else
1329  {
1330  vlib_cli_output (vm, "Endpoints:");
1332  }
1333 
1334  return (NULL);
1335 }
1336 
1337 /*?
1338  * Show Group Based Policy Endpoints and derived information
1339  *
1340  * @cliexpar
1341  * @cliexstart{show gbp endpoint}
1342  * @cliexend
1343  ?*/
1344 /* *INDENT-OFF* */
1345 VLIB_CLI_COMMAND (gbp_endpoint_show_node, static) = {
1346  .path = "show gbp endpoint",
1347  .short_help = "show gbp endpoint\n",
1348  .function = gbp_endpoint_show,
1349 };
1350 /* *INDENT-ON* */
1351 
1352 static void
1353 gbp_endpoint_check (index_t gei, f64 start_time)
1354 {
1356  gbp_endpoint_loc_t *gel;
1357  gbp_endpoint_t *ge;
1358 
1359  ge = gbp_endpoint_get (gei);
1360  gel = gbp_endpoint_loc_find (ge, GBP_ENDPOINT_SRC_DP);
1361 
1362  if (NULL != gel)
1363  {
1364  gg = gbp_endpoint_group_get (gel->gel_epg);
1365 
1366  if ((start_time - ge->ge_last_time) >
1368  {
1369  gbp_endpoint_unlock (GBP_ENDPOINT_SRC_DP, gei);
1370  }
1371  }
1372 }
1373 
1374 static void
1376 {
1377  clib_bihash_16_8_t *gte_table = &gbp_ep_db.ged_by_mac_bd;
1378  f64 last_start, start_time, delta_t;
1379  int i, j, k;
1380 
1381  if (!gte_table->instantiated)
1382  return;
1383 
1384  delta_t = 0;
1385  last_start = start_time = vlib_time_now (vm);
1386 
1387  for (i = 0; i < gte_table->nbuckets; i++)
1388  {
1389  clib_bihash_bucket_16_8_t *b;
1390  clib_bihash_value_16_8_t *v;
1391 
1392  /* allow no more than 20us without a pause */
1393  delta_t = vlib_time_now (vm) - last_start;
1394  if (delta_t > 20e-6)
1395  {
1396  /* suspend for 100 us */
1397  vlib_process_suspend (vm, 100e-6);
1398  last_start = vlib_time_now (vm);
1399  }
1400 
1401  b = &gte_table->buckets[i];
1402  if (b->offset == 0)
1403  continue;
1404  v = clib_bihash_get_value_16_8 (gte_table, b->offset);
1405 
1406  for (j = 0; j < (1 << b->log2_pages); j++)
1407  {
1408  for (k = 0; k < BIHASH_KVP_PER_PAGE; k++)
1409  {
1410  if (clib_bihash_is_free_16_8 (&v->kvp[k]))
1411  continue;
1412 
1413  gbp_endpoint_check (v->kvp[k].value, start_time);
1414 
1415  /*
1416  * Note: we may have just freed the bucket's backing
1417  * storage, so check right here...
1418  */
1419  if (b->offset == 0)
1420  goto doublebreak;
1421  }
1422  v++;
1423  }
1424  doublebreak:
1425  ;
1426  }
1427 }
1428 
1429 static void
1431 {
1432  clib_bihash_24_8_t *gte_table = &gbp_ep_db.ged_by_ip_rd;
1433  f64 last_start, start_time, delta_t;
1434  int i, j, k;
1435 
1436  if (!gte_table->instantiated)
1437  return;
1438 
1439  delta_t = 0;
1440  last_start = start_time = vlib_time_now (vm);
1441 
1442  for (i = 0; i < gte_table->nbuckets; i++)
1443  {
1444  clib_bihash_bucket_24_8_t *b;
1445  clib_bihash_value_24_8_t *v;
1446 
1447  /* allow no more than 20us without a pause */
1448  delta_t = vlib_time_now (vm) - last_start;
1449  if (delta_t > 20e-6)
1450  {
1451  /* suspend for 100 us */
1452  vlib_process_suspend (vm, 100e-6);
1453  last_start = vlib_time_now (vm);
1454  }
1455 
1456  b = &gte_table->buckets[i];
1457  if (b->offset == 0)
1458  continue;
1459  v = clib_bihash_get_value_24_8 (gte_table, b->offset);
1460 
1461  for (j = 0; j < (1 << b->log2_pages); j++)
1462  {
1463  for (k = 0; k < BIHASH_KVP_PER_PAGE; k++)
1464  {
1465  if (clib_bihash_is_free_24_8 (&v->kvp[k]))
1466  continue;
1467 
1468  gbp_endpoint_check (v->kvp[k].value, start_time);
1469 
1470  /*
1471  * Note: we may have just freed the bucket's backing
1472  * storage, so check right here...
1473  */
1474  if (b->offset == 0)
1475  goto doublebreak;
1476  }
1477  v++;
1478  }
1479  doublebreak:
1480  ;
1481  }
1482 }
1483 
1484 void
1486 {
1487  gbp_endpoint_scan_l2 (vm);
1488  gbp_endpoint_scan_l3 (vm);
1489 }
1490 
1491 static fib_node_t *
1493 {
1494  gbp_endpoint_t *ge;
1495 
1496  ge = gbp_endpoint_get (index);
1497 
1498  return (&ge->ge_node);
1499 }
1500 
1501 static gbp_endpoint_t *
1503 {
1505  return ((gbp_endpoint_t *) node);
1506 }
1507 
1508 static void
1510 {
1511  const gbp_bridge_domain_t *gbd;
1512  const gbp_route_domain_t *grd;
1513  const fib_prefix_t *pfx;
1514  gbp_endpoint_t *ge;
1515 
1516  ge = gbp_endpoint_from_fib_node (node);
1517 
1518  ASSERT (0 == vec_len (ge->ge_locs));
1519 
1520  gbd = gbp_bridge_domain_get (ge->ge_key.gek_gbd);
1521 
1522  /*
1523  * we have removed the last source. this EP is toast
1524  */
1525  if (INDEX_INVALID != ge->ge_key.gek_gbd)
1526  {
1528  }
1529  vec_foreach (pfx, ge->ge_key.gek_ips)
1530  {
1531  grd = gbp_route_domain_get (ge->ge_key.gek_grd);
1532  gbp_endpoint_del_ip (&pfx->fp_addr, grd->grd_fib_index[pfx->fp_proto]);
1533  }
1534  pool_put (gbp_endpoint_pool, ge);
1535 }
1536 
1540 {
1541  ASSERT (0);
1542 
1543  return (FIB_NODE_BACK_WALK_CONTINUE);
1544 }
1545 
1546 /*
1547  * The FIB path's graph node virtual function table
1548  */
1549 static const fib_node_vft_t gbp_endpoint_vft = {
1551  .fnv_last_lock = gbp_endpoint_last_lock_gone,
1552  .fnv_back_walk = gbp_endpoint_back_walk_notify,
1553  // .fnv_mem_show = fib_path_memory_show,
1554 };
1555 
1556 static clib_error_t *
1558 {
1559 #define GBP_EP_HASH_NUM_BUCKETS (2 * 1024)
1560 #define GBP_EP_HASH_MEMORY_SIZE (1 << 20)
1561 
1562  clib_bihash_init_24_8 (&gbp_ep_db.ged_by_ip_rd,
1563  "GBP Endpoints - IP/RD",
1565 
1566  clib_bihash_init_16_8 (&gbp_ep_db.ged_by_mac_bd,
1567  "GBP Endpoints - MAC/BD",
1569 
1570  gbp_ep_logger = vlib_log_register_class ("gbp", "ep");
1571  gbp_endpoint_fib_type = fib_node_register_new_type (&gbp_endpoint_vft);
1572  gbp_fib_source_hi = fib_source_allocate ("gbp-endpoint-hi",
1575  gbp_fib_source_low = fib_source_allocate ("gbp-endpoint-low",
1578 
1579  return (NULL);
1580 }
1581 
1583 
1584 /*
1585  * fd.io coding-style-patch-verification: ON
1586  *
1587  * Local Variables:
1588  * eval: (c-set-style "gnu")
1589  * End:
1590  */
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
Definition: log.c:176
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:440
A real VXLAN-GBP tunnel (from vnet/vxlan-gbp/...)
Definition: gbp_vxlan.h:100
static void gbp_endpoint_scan_l3(vlib_main_t *vm)
index_t gek_grd
Index of the Route-Domain.
Definition: gbp_endpoint.h:109
fib_protocol_t fp_proto
protocol type
Definition: fib_types.h:212
enum fib_source_t_ fib_source_t
The different sources that can create a route.
fib_node_index_t fib_table_entry_path_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, dpo_proto_t next_hop_proto, const ip46_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_fib_index, u32 next_hop_weight, fib_mpls_label_t *next_hop_labels, fib_route_path_flags_t path_flags)
Add one path to an entry (aka route) in the FIB.
Definition: fib_table.c:549
int gbp_endpoint_is_external(const gbp_endpoint_t *ge)
Definition: gbp_endpoint.c:99
static gbp_endpoint_loc_t * gbp_endpoint_loc_find_or_add(gbp_endpoint_t *ge, gbp_endpoint_src_t src)
Definition: gbp_endpoint.c:337
static gbp_endpoint_src_t gbp_endpoint_get_best_src(const gbp_endpoint_t *ge)
Definition: gbp_endpoint.c:449
u32 gef_fib_index
FIB index the EP is in.
Definition: gbp_endpoint.h:177
int gbp_endpoint_is_remote(const gbp_endpoint_t *ge)
Definition: gbp_endpoint.c:87
static gbp_endpoint_t * gbp_endpoint_get(index_t gbpei)
Get the endpoint from a port/interface.
Definition: gbp_endpoint.h:265
f64 ge_last_time
The last time a packet from seen from this end point.
Definition: gbp_endpoint.h:213
u16 sclass_t
Definition: gbp_types.h:25
index_t * ged_by_sw_if_index
Definition: gbp_endpoint.h:223
A Group Based Policy Endpoint.
Definition: gbp_endpoint.h:190
fib_prefix_t * gek_ips
A vector of ip addresses that belong to the endpoint.
Definition: gbp_endpoint.h:93
static uword ip46_address_is_multicast(const ip46_address_t *a)
Definition: ip46_address.h:154
const mac_address_t * gbp_route_domain_get_local_mac(void)
vl_api_mac_address_t mac
Definition: l2.api:491
#define BIHASH_KVP_PER_PAGE
Definition: bihash_16_8.h:21
a
Definition: bitmap.h:538
void gbp_endpoint_unlock(gbp_endpoint_src_t src, index_t gei)
Definition: gbp_endpoint.c:909
Information about the location of the endpoint provided by a source of endpoints. ...
Definition: gbp_endpoint.h:116
gbp_endpoint_fwd_t ge_fwd
Definition: gbp_endpoint.h:208
#define GBP_EP_HASH_NUM_BUCKETS
gbp_endpoint_key_t ge_key
The key/ID of this EP.
Definition: gbp_endpoint.h:200
u32 bd_add_del_ip_mac(u32 bd_index, ip46_type_t type, const ip46_address_t *ip, const mac_address_t *mac, u8 is_add)
Add/delete IP address to MAC address mapping.
Definition: l2_bd.c:812
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
Definition: pool.h:240
index_t * gef_adjs
The L3 adj, if created.
Definition: gbp_endpoint.h:167
void fib_node_init(fib_node_t *node, fib_node_type_t type)
Definition: fib_node.c:185
ip46_type_t fib_proto_to_ip46(fib_protocol_t fproto)
Convert from fib_protocol to ip46_type.
Definition: fib_types.c:310
u32 gb_vni
The index of the BD&#39;s VNI interface on which packets from unkown endpoints arrive.
void gbp_itf_l2_set_output_feature(gbp_itf_hdl_t gh, l2output_feat_masks_t feats)
Definition: gbp_itf.c:428
struct gbp_endpoint_flush_ctx_t_ gbp_endpoint_flush_ctx_t
static int gbp_endpoint_walk_ip_itf(clib_bihash_kv_24_8_t *kvp, void *arg)
Definition: fib_entry.h:123
static void gbp_endpoint_del_ip(const ip46_address_t *ip, u32 fib_index)
Definition: gbp_endpoint.c:195
#define NULL
Definition: clib.h:58
int gbp_endpoint_is_local(const gbp_endpoint_t *ge)
Definition: gbp_endpoint.c:93
static walk_rc_t gbp_endpoint_show_one(index_t gei, void *ctx)
gbp_endpoint_flags_t gef_flags
Definition: gbp_endpoint.h:179
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:279
ip46_address_t gt_src
The source address to use for child tunnels.
Definition: gbp_vxlan.h:82
static gbp_endpoint_loc_t * gbp_endpoint_loc_find(gbp_endpoint_t *ge, gbp_endpoint_src_t src)
Definition: gbp_endpoint.c:289
void gbp_itf_unlock(gbp_itf_hdl_t *gh)
Definition: gbp_itf.c:286
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
u8 src_address[6]
Definition: packet.h:56
enum gbp_endpoint_src_t_ gbp_endpoint_src_t
A bridge Domain Representation.
add paths without path extensions
Definition: fib_source.h:205
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:523
vl_api_address_t src
Definition: gre.api:60
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:561
int i
static void gbp_endpoint_scan_l2(vlib_main_t *vm)
static_always_inline void mac_address_copy(mac_address_t *dst, const mac_address_t *src)
Definition: mac_address.h:128
static_always_inline int mac_address_is_zero(const mac_address_t *mac)
Definition: mac_address.h:106
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
static u32 gbp_n_learnt_endpoints
A count of the number of dynamic entries.
Definition: gbp_endpoint.c:62
unformat_function_t unformat_vnet_sw_interface
index_t gg_rd
route-domain/IP-table ID the EPG is in
static ip46_type_t ip46_address_get_type(const ip46_address_t *ip)
Definition: ip46_address.h:148
static void gbp_endpoint_loc_update(const gbp_endpoint_t *ge, gbp_endpoint_loc_t *gel, const gbp_bridge_domain_t *gb, u32 sw_if_index, index_t ggi, gbp_endpoint_flags_t flags, const ip46_address_t *tun_src, const ip46_address_t *tun_dst)
Definition: gbp_endpoint.c:477
index_t gbp_route_domain_index(const gbp_route_domain_t *grd)
static gbp_bridge_domain_t * gbp_bridge_domain_get(index_t i)
gbp_endpoint_src_t gel_src
The source providing this location information.
Definition: gbp_endpoint.h:121
adj_index_t adj_nbr_add_or_lock_w_rewrite(fib_protocol_t nh_proto, vnet_link_t link_type, const ip46_address_t *nh_addr, u32 sw_if_index, u8 *rewrite)
Add (and lock) a new or lock an existing neighbour adjacency.
Definition: adj_nbr.c:264
static int clib_bihash_is_free_16_8(clib_bihash_kv_16_8_t *v)
Definition: bihash_16_8.h:39
static void gbb_endpoint_fwd_reset(gbp_endpoint_t *ge)
Definition: gbp_endpoint.c:559
format_function_t format_vnet_sw_if_index_name
#define GBP_ENDPOINT_SRC_MAX
Definition: gbp_endpoint.h:78
unsigned char u8
Definition: types.h:56
static gbp_endpoint_t * gbp_endpoint_from_fib_node(fib_node_t *node)
fib_node_type_t fib_node_register_new_type(const fib_node_vft_t *vft)
Create a new FIB node type and Register the function table for it.
Definition: fib_node.c:80
static int gbp_endpoint_ip_is_equal(const fib_prefix_t *fp, const ip46_address_t *ip)
Definition: gbp_endpoint.c:211
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t type, fib_node_index_t index)
Definition: fib_node.c:98
double f64
Definition: types.h:142
static void gbp_endpoint_loc_destroy(gbp_endpoint_loc_t *gel)
Definition: gbp_endpoint.c:330
u32 gbp_itf_get_sw_if_index(gbp_itf_hdl_t hdl)
Definition: gbp_itf.c:148
#define clib_memcpy(d, s, n)
Definition: string.h:180
index_t gbp_bridge_domain_index(const gbp_bridge_domain_t *gbd)
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
Definition: node_funcs.h:422
enum walk_rc_t_ walk_rc_t
Walk return code.
gbp_endpoint_t * gbp_endpoint_pool
Pool of GBP endpoints.
Definition: gbp_endpoint.c:57
static void ip46_address_reset(ip46_address_t *ip46)
Definition: ip46_address.h:74
u32 vlib_log_class_t
Definition: vlib.h:51
unformat_function_t unformat_ip4_address
Definition: format.h:68
gbp_endpoint_flags_t gel_flags
Endpoint flags.
Definition: gbp_endpoint.h:131
vl_api_interface_index_t sw_if_index
Definition: gre.api:59
static int gbp_endpoint_loc_unlock(gbp_endpoint_t *ge, gbp_endpoint_loc_t *gel)
Definition: gbp_endpoint.c:306
static_always_inline void mac_address_to_bytes(const mac_address_t *mac, u8 *bytes)
Definition: mac_address.h:99
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:173
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a &#39;special&#39; entry from the FIB.
Definition: fib_table.c:424
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
Definition: fib_walk.c:745
u8 dst_address[6]
Definition: packet.h:55
gbp_endpoint_group_t * gbp_endpoint_group_get(index_t i)
u8 * format_fib_prefix(u8 *s, va_list *args)
Definition: fib_types.c:200
clib_bihash_24_8_t ged_by_ip_rd
Definition: gbp_endpoint.h:224
static int clib_bihash_is_free_24_8(const clib_bihash_kv_24_8_t *v)
Definition: bihash_24_8.h:39
static_always_inline gbp_endpoint_t * gbp_endpoint_find_mac(const u8 *mac, u32 bd_index)
Definition: gbp_endpoint.h:279
Aggregate type for a prefix.
Definition: fib_types.h:203
u8 * format_gbp_endpoint_flags(u8 *s, va_list *args)
Definition: gbp_endpoint.c:70
#define clib_error_return(e, args...)
Definition: error.h:99
void l2fib_add_entry(const u8 *mac, u32 bd_index, u32 sw_if_index, l2fib_entry_result_flags_t flags)
Add an entry to the l2fib.
Definition: l2_fib.c:405
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
Definition: adj.c:324
unsigned int u32
Definition: types.h:88
index_t gek_gbd
Index of the Bridge-Domain.
Definition: gbp_endpoint.h:104
static void gbp_endpoint_extract_key_ip_itf(const clib_bihash_kv_24_8_t *key, ip46_address_t *ip, u32 *sw_if_index)
Definition: gbp_endpoint.c:123
static fib_node_back_walk_rc_t gbp_endpoint_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
fib_source_t fib_source_allocate(const char *name, fib_source_priority_t prio, fib_source_behaviour_t bh)
Definition: fib_source.c:118
static void gbp_endpoint_check(index_t gei, f64 start_time)
static const u8 * vnet_sw_interface_get_hw_address(vnet_main_t *vnm, u32 sw_if_index)
Definition: fib_entry.h:112
vl_api_fib_path_type_t type
Definition: fib_types.api:123
fib_protocol_t fib_proto_from_ip46(ip46_type_t iproto)
Convert from ip46_type to fib_protocol.
Definition: fib_types.c:326
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:170
fib_node_bw_reason_flag_t fnbw_reason
The reason/trigger for the backwalk.
Definition: fib_node.h:212
#define GBP_ENDPOINT_ATTR_NAMES
Definition: gbp_endpoint.h:51
static_always_inline void ip46_address_copy(ip46_address_t *dst, const ip46_address_t *src)
Definition: ip46_address.h:123
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
Definition: node_funcs.h:934
#define FIB_SOURCE_PRIORITY_HI
Some priority values that plugins might use when they are not to concerned where in the list they&#39;ll ...
Definition: fib_source.h:273
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
Definition: fib_types.h:226
GBP Endpoint Databases.
Definition: gbp_endpoint.h:221
gbp_itf_hdl_t gel_itf
The interface on which the EP is connected.
Definition: gbp_endpoint.h:126
void fib_node_lock(fib_node_t *node)
Definition: fib_node.c:203
static u8 ip46_address_is_zero(const ip46_address_t *ip46)
Definition: ip46_address.h:87
long ctx[MAX_CONNS]
Definition: main.c:144
static u8 * format_gbp_endpoint_key(u8 *s, va_list *args)
struct _unformat_input_t unformat_input_t
static fib_source_t gbp_fib_source_low
Definition: gbp_endpoint.c:44
void gbp_policy_dpo_add_or_lock(dpo_proto_t dproto, gbp_scope_t scope, sclass_t sclass, u32 sw_if_index, dpo_id_t *dpo)
void gbp_endpoint_scan(vlib_main_t *vm)
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:287
u16 sclass
Definition: gbp.api:123
This is the object type deifend above.
Definition: gbp_vxlan.h:95
static fib_node_t * gbp_endpoint_get_node(fib_node_index_t index)
clib_bihash_16_8_t ged_by_mac_bd
Definition: gbp_endpoint.h:225
#define vec_del1(v, i)
Delete the element at index I.
Definition: vec.h:806
u32 remote_ep_timeout
Aging timeout for remote endpoints.
static_always_inline void mac_address_from_u64(mac_address_t *mac, u64 u)
Definition: mac_address.h:122
#define SCLASS_INVALID
Definition: gbp_types.h:26
fib_node_type_t fn_type
The node&#39;s type.
Definition: fib_node.h:299
An node in the FIB graph.
Definition: fib_node.h:295
sclass_t gef_sclass
Endpoint Group&#39;s sclass.
Definition: gbp_endpoint.h:172
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
l2input_feat_masks_t
Definition: l2_input.h:141
void fib_node_unlock(fib_node_t *node)
Definition: fib_node.c:209
vlib_main_t * vm
Definition: in2out_ed.c:1810
mac_address_t gek_mac
MAC address of the endpoint.
Definition: gbp_endpoint.h:99
gbp_itf_hdl_t vxlan_gbp_tunnel_lock_itf(u32 sw_if_index)
Definition: gbp_vxlan.c:237
int gbp_endpoint_update_and_lock(gbp_endpoint_src_t src, u32 sw_if_index, const ip46_address_t *ips, const mac_address_t *mac, index_t gbdi, index_t grdi, sclass_t sclass, gbp_endpoint_flags_t flags, const ip46_address_t *tun_src, const ip46_address_t *tun_dst, u32 *handle)
Definition: gbp_endpoint.c:813
u32 gbp_endpoint_child_add(index_t gei, fib_node_type_t type, fib_node_index_t index)
Definition: gbp_endpoint.c:990
static u8 ip46_address_is_equal(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
Definition: ip46_address.h:93
An Endpoint Group representation.
format_function_t format_ip46_address
Definition: ip46_address.h:50
vlib_node_registration_t gbp_scanner_node
(constructor) VLIB_REGISTER_NODE (gbp_scanner_node)
Definition: gbp_scanner.c:89
void gbp_itf_hdl_reset(gbp_itf_hdl_t *gh)
Definition: gbp_itf.c:108
static void gbp_endpoint_ips_update(gbp_endpoint_t *ge, const ip46_address_t *ips, const gbp_route_domain_t *grd)
Definition: gbp_endpoint.c:217
unformat_function_t unformat_ip6_address
Definition: format.h:89
static u8 * format_gbp_endpoint_loc(u8 *s, va_list *args)
bool gbp_itf_hdl_is_valid(gbp_itf_hdl_t gh)
Definition: gbp_itf.c:114
#define UNFORMAT_END_OF_INPUT
Definition: format.h:145
u32 flags
Definition: vhost_user.h:141
u32 l2fib_del_entry(const u8 *mac, u32 bd_index, u32 sw_if_index)
Delete an entry from the l2fib.
Definition: l2_fib.c:689
static void gbp_endpoint_add_itf(u32 sw_if_index, index_t gei)
Definition: gbp_endpoint.c:148
enum gbp_endpoint_attr_t_ gbp_endpoint_attr_t
Flags for each endpoint.
static int gbp_endpoint_walk_mac_itf(clib_bihash_kv_16_8_t *kvp, void *arg)
static fib_source_t gbp_fib_source_hi
Definition: gbp_endpoint.c:43
static bool gbp_endpoint_add_ip(const ip46_address_t *ip, u32 fib_index, index_t gei)
Definition: gbp_endpoint.c:171
gbp_itf_hdl_t gbp_itf_l2_add_and_lock(u32 sw_if_index, index_t gbi)
Definition: gbp_itf.c:196
void gbp_endpoint_walk(gbp_endpoint_cb_t cb, void *ctx)
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:342
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
Definition: fib_table.c:886
Force the walk to be synchronous.
Definition: fib_node.h:174
#define FOR_EACH_GBP_ENDPOINT_ATTR(_item)
Definition: gbp_endpoint.c:64
u32 grd_fib_index[FIB_PROTOCOL_IP_MAX]
void gbp_endpoint_group_lock(index_t ggi)
fib_node_get_t fnv_get
Definition: fib_node.h:283
#define vec_search_with_function(v, E, fn)
Search a vector for the index of the entry that matches.
Definition: vec.h:964
static void gbb_endpoint_fwd_recalc(gbp_endpoint_t *ge)
Definition: gbp_endpoint.c:607
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:30
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:284
uword unformat_mac_address(unformat_input_t *input, va_list *args)
Definition: format.c:241
struct gbp_endpoint_loc_t_::@553 tun
Tunnel info for remote endpoints.
void fib_prefix_from_ip46_addr(const ip46_address_t *addr, fib_prefix_t *pfx)
Host prefix from ip.
Definition: fib_types.c:81
static clib_error_t * gbp_endpoint_init(vlib_main_t *vm)
gbp_endpoint_t * gbp_endpoint_find_ip(const ip46_address_t *ip, u32 fib_index)
Definition: gbp_endpoint.c:132
vlib_main_t vlib_node_runtime_t * node
Definition: in2out_ed.c:1810
void gbp_endpoint_flush(gbp_endpoint_src_t src, u32 sw_if_index)
remove all learnt endpoints using the interface
Context passed between object during a back walk.
Definition: fib_node.h:208
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:152
This is the identity of an endpoint, as such it is information about an endpoint that is idempotent...
Definition: gbp_endpoint.h:87
static walk_rc_t gbp_endpoint_flush_cb(index_t gei, void *args)
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a &#39;special&#39; entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
Definition: fib_table.c:324
gbp_endpoint_src_t src
enum gbp_endpoint_flags_t_ gbp_endpoint_flags_t
static bool gbp_endpoint_add_mac(const mac_address_t *mac, u32 bd_index, index_t gei)
Definition: gbp_endpoint.c:156
u8 value
Definition: qos.api:54
#define ASSERT(truth)
gbp_route_domain_t * gbp_route_domain_get(index_t i)
static u8 * format_gbp_endpoint_fwd(u8 *s, va_list *args)
u8 * format_gbp_endpoint(u8 *s, va_list *args)
const mac_address_t ZERO_MAC_ADDRESS
Definition: mac_address.c:19
u32 gb_bvi_sw_if_index
The BD&#39;s BVI interface (obligatory)
u8 * format_gbp_itf_hdl(u8 *s, va_list *args)
Definition: gbp_itf.c:520
static vlib_log_class_t gbp_ep_logger
Definition: gbp_endpoint.c:46
void gbp_endpoint_group_unlock(index_t ggi)
const mac_address_t * gbp_route_domain_get_remote_mac(void)
#define GBP_ENDPOINT_INFO(...)
Definition: gbp_endpoint.c:51
static clib_error_t * gbp_endpoint_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
Definition: fib_node.c:123
gbp_endpoint_retention_t gg_retention
EP retention policy.
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
Definition: fib_types.c:260
static gbp_endpoint_t * gbp_endpoint_alloc(const ip46_address_t *ips, const gbp_route_domain_t *grd, const mac_address_t *mac, const gbp_bridge_domain_t *gbd)
Definition: gbp_endpoint.c:248
static void gbp_endpoint_del_mac(const mac_address_t *mac, u32 bd_index)
Definition: gbp_endpoint.c:185
#define FIB_SOURCE_PRIORITY_LOW
Definition: fib_source.h:274
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
static_always_inline void gbp_endpoint_mk_key_mac(const u8 *mac, u32 bd_index, clib_bihash_kv_16_8_t *key)
Definition: gbp_endpoint.h:271
typedef key
Definition: ipsec_types.api:83
int gbp_endpoint_is_learnt(const gbp_endpoint_t *ge)
Definition: gbp_endpoint.c:105
static_always_inline void gbp_endpoint_mk_key_ip(const ip46_address_t *ip, u32 fib_index, clib_bihash_kv_24_8_t *key)
Definition: gbp_endpoint.h:295
static int gbp_endpoint_find_for_update(const ip46_address_t *ips, const gbp_route_domain_t *grd, const mac_address_t *mac, const gbp_bridge_domain_t *gbd, gbp_endpoint_t **ge)
Find an EP inthe DBs and check that if we find it in the L2 DB it has the same IPs as this update...
Definition: gbp_endpoint.c:378
static int gbp_endpoint_loc_cmp_for_sort(gbp_endpoint_loc_t *a, gbp_endpoint_loc_t *b)
Definition: gbp_endpoint.c:283
fib_node_t ge_node
A FIB node that allows the tracking of children.
Definition: gbp_endpoint.h:195
gbp_itf_hdl_t gef_itf
The interface on which the EP is connected.
Definition: gbp_endpoint.h:162
u8 action
Definition: l2.api:173
vl_api_address_t ip
Definition: l2.api:490
gbp_vxlan_tunnel_t * gbp_vxlan_tunnel_get(index_t gti)
Definition: gbp_vxlan.c:84
u32 gel_locks
number of times this source has locked this
Definition: gbp_endpoint.h:141
void gbp_itf_l2_set_input_feature(gbp_itf_hdl_t gh, l2input_feat_masks_t feats)
Definition: gbp_itf.c:382
And endpoints current forwarding state.
Definition: gbp_endpoint.h:157
u32 vxlan_gbp_tunnel_get_parent(u32 sw_if_index)
Definition: gbp_vxlan.c:222
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
A route Domain Representation.
u32 gg_uplink_sw_if_index
the uplink interface dedicated to the EPG
static void gbp_endpoint_n_learned(int n)
Definition: gbp_endpoint.c:458
#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 ip_neighbor_advertise(vlib_main_t *vm, ip46_type_t type, const ip46_address_t *addr, u32 sw_if_index)
Definition: ip_neighbor.c:979
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
Definition: vec.h:983
gbp_itf_hdl_t gbp_itf_clone_and_lock(gbp_itf_hdl_t gh)
Definition: gbp_itf.c:271
static int gbp_endpoint_loc_is_equal(gbp_endpoint_loc_t *a, gbp_endpoint_loc_t *b)
Definition: gbp_endpoint.c:277
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:197
static void gbp_endpoint_last_lock_gone(fib_node_t *node)
gbp_vxlan_tunnel_type_t gbp_vxlan_tunnel_get_type(u32 sw_if_index)
Definition: gbp_vxlan.c:253
gbp_ep_db_t gbp_ep_db
EP DBs.
Definition: gbp_endpoint.c:41
A FIB graph nodes virtual function table.
Definition: fib_node.h:282
GBP VXLAN (template) tunnel.
Definition: gbp_vxlan.h:39
static const gbp_itf_hdl_t GBP_ITF_HDL_INVALID
Definition: gbp_itf.h:57
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
index_t gbp_endpoint_group_find(sclass_t sclass)
u8 * format_mac_address_t(u8 *s, va_list *args)
Definition: mac_address.c:27
vl_api_address_t ips[n_ips]
Definition: gbp.api:128
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:232
#define vec_foreach(var, vec)
Vector iterator.
vnet_link_t fib_proto_to_link(fib_protocol_t proto)
Convert from a protocol to a link type.
Definition: fib_types.c:294
static void gbp_endpoint_extract_key_mac_itf(const clib_bihash_kv_16_8_t *key, mac_address_t *mac, u32 *sw_if_index)
Definition: gbp_endpoint.c:115
index_t gel_epg
Endpoint Group.
Definition: gbp_endpoint.h:136
#define pool_foreach_index(i, v, body)
Iterate pool by index.
Definition: pool.h:543
static const char * gbp_endpoint_attr_names[]
Definition: gbp_endpoint.c:36
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
Definition: vec.h:487
u8 ge
Definition: ip_types.api:136
static fib_node_type_t gbp_endpoint_fib_type
Definition: gbp_endpoint.c:45
gbp_endpoint_loc_t * ge_locs
Location information provided by the various sources.
Definition: gbp_endpoint.h:206
ip46_address_t gel_dst
Definition: gbp_endpoint.h:150
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:689
#define ip46_address_initializer
Definition: ip46_address.h:52
#define GBP_EP_HASH_MEMORY_SIZE
void gbp_endpoint_child_remove(index_t gei, u32 sibling)
Definition: gbp_endpoint.c:997
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
static index_t gbp_endpoint_index(const gbp_endpoint_t *ge)
Definition: gbp_endpoint.c:205
static clib_error_t * gbp_endpoint_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:171
walk_rc_t(* gbp_endpoint_cb_t)(index_t gbpei, void *ctx)
Definition: gbp_endpoint.h:244
index_t gg_gbd
Bridge-domain ID the EPG is in.
u8 * format_gbp_endpoint_src(u8 *s, va_list *args)