FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
gbp_classify.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 
18 #include <plugins/gbp/gbp.h>
21 #include <vnet/fib/ip4_fib.h>
22 #include <vnet/fib/ip6_fib.h>
23 #include <vnet/dpo/load_balance.h>
24 #include <vnet/l2/l2_input.h>
25 #include <vnet/l2/feat_bitmap.h>
26 #include <vnet/fib/fib_table.h>
28 
30 {
35 
36 #define GBP_SRC_N_CLASSIFY (GBP_SRC_CLASSIFY_LPM + 1)
37 
38 /**
39  * Grouping of global data for the GBP source EPG classification feature
40  */
42 {
43  /**
44  * Next nodes for L2 output features
45  */
48 
50 
51 /**
52  * per-packet trace data
53  */
54 typedef struct gbp_classify_trace_t_
55 {
56  /* per-pkt trace data */
59 
60 /*
61  * determine the SRC EPG form the input port
62  */
65  vlib_node_runtime_t * node,
66  vlib_frame_t * frame,
68 {
70  u32 n_left_from, *from, *to_next;
71  u32 next_index;
72 
73  next_index = 0;
74  n_left_from = frame->n_vectors;
75  from = vlib_frame_vector_args (frame);
76 
77  while (n_left_from > 0)
78  {
79  u32 n_left_to_next;
80 
81  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
82 
83  while (n_left_from > 0 && n_left_to_next > 0)
84  {
85  u32 next0, bi0, src_epg, sw_if_index0;
86  const gbp_endpoint_t *ge0;
87  vlib_buffer_t *b0;
88 
89  bi0 = from[0];
90  to_next[0] = bi0;
91  from += 1;
92  to_next += 1;
93  n_left_from -= 1;
94  n_left_to_next -= 1;
95 
96  b0 = vlib_get_buffer (vm, bi0);
97 
98  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
99  vnet_buffer2 (b0)->gbp.flags = VXLAN_GBP_GPFLAGS_NONE;
100 
101  if (GBP_SRC_CLASSIFY_NULL == type)
102  {
103  src_epg = EPG_INVALID;
104  next0 =
105  vnet_l2_feature_next (b0, gscm->l2_input_feat_next[type],
106  L2INPUT_FEAT_GBP_NULL_CLASSIFY);
107  }
108  else
109  {
110  if (DPO_PROTO_ETHERNET == dproto)
111  {
112  const ethernet_header_t *h0;
113 
114  h0 = vlib_buffer_get_current (b0);
115  next0 =
116  vnet_l2_feature_next (b0, gscm->l2_input_feat_next[type],
117  L2INPUT_FEAT_GBP_SRC_CLASSIFY);
119  vnet_buffer (b0)->l2.bd_index);
120  }
121  else if (DPO_PROTO_IP4 == dproto)
122  {
123  const ip4_header_t *h0;
124 
125  h0 = vlib_buffer_get_current (b0);
126 
128  (&h0->src_address,
130  sw_if_index0));
131 
132 
133  /*
134  * Go straight to looukp, do not pass go, do not collect $200
135  */
136  next0 = 0;
137  }
138  else if (DPO_PROTO_IP6 == dproto)
139  {
140  const ip6_header_t *h0;
141 
142  h0 = vlib_buffer_get_current (b0);
143 
145  (&h0->src_address,
147  sw_if_index0));
148 
149 
150  /*
151  * Go straight to lookup, do not pass go, do not collect $200
152  */
153  next0 = 0;
154  }
155  else
156  {
157  ge0 = NULL;
158  next0 = 0;
159  ASSERT (0);
160  }
161 
162  if (PREDICT_TRUE (NULL != ge0))
163  src_epg = ge0->ge_fwd.gef_epg_id;
164  else
165  src_epg = EPG_INVALID;
166  }
167 
168  vnet_buffer2 (b0)->gbp.src_epg = src_epg;
169 
170  if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
171  {
173  vlib_add_trace (vm, node, b0, sizeof (*t));
174  t->src_epg = src_epg;
175  }
176 
177  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
178  to_next, n_left_to_next,
179  bi0, next0);
180  }
181 
182  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
183  }
184 
185  return frame->n_vectors;
186 }
187 
188 static uword
190  vlib_node_runtime_t * node, vlib_frame_t * frame)
191 {
192  return (gbp_classify_inline (vm, node, frame,
194 }
195 
196 static uword
198  vlib_node_runtime_t * node, vlib_frame_t * frame)
199 {
200  return (gbp_classify_inline (vm, node, frame,
202 }
203 
204 static uword
206  vlib_node_runtime_t * node, vlib_frame_t * frame)
207 {
208  return (gbp_classify_inline (vm, node, frame,
210 }
211 
212 static uword
214  vlib_node_runtime_t * node, vlib_frame_t * frame)
215 {
216  return (gbp_classify_inline (vm, node, frame,
218 }
219 
220 
221 /* packet trace format function */
222 static u8 *
223 format_gbp_classify_trace (u8 * s, va_list * args)
224 {
225  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
226  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
227  gbp_classify_trace_t *t = va_arg (*args, gbp_classify_trace_t *);
228 
229  s = format (s, "src-epg:%d", t->src_epg);
230 
231  return s;
232 }
233 
234 /* *INDENT-OFF* */
236  .function = gbp_null_classify,
237  .name = "gbp-null-classify",
238  .vector_size = sizeof (u32),
239  .format_trace = format_gbp_classify_trace,
240  .type = VLIB_NODE_TYPE_INTERNAL,
241 
242  .n_errors = 0,
243  .n_next_nodes = 0,
244 };
245 
247 
249  .function = gbp_src_classify,
250  .name = "gbp-src-classify",
251  .vector_size = sizeof (u32),
252  .format_trace = format_gbp_classify_trace,
253  .type = VLIB_NODE_TYPE_INTERNAL,
254 
255  .n_errors = 0,
256  .n_next_nodes = 0,
257 };
258 
260 
262  .function = gbp_ip4_src_classify,
263  .name = "ip4-gbp-src-classify",
264  .vector_size = sizeof (u32),
265  .format_trace = format_gbp_classify_trace,
266  .type = VLIB_NODE_TYPE_INTERNAL,
267 
268  .n_errors = 0,
269  .n_next_nodes = 1,
270  .next_nodes = {
271  [0] = "ip4-lookup"
272  },
273 };
274 
276 
278  .function = gbp_ip6_src_classify,
279  .name = "ip6-gbp-src-classify",
280  .vector_size = sizeof (u32),
281  .format_trace = format_gbp_classify_trace,
282  .type = VLIB_NODE_TYPE_INTERNAL,
283 
284  .n_errors = 0,
285  .n_next_nodes = 1,
286  .next_nodes = {
287  [0] = "ip6-lookup"
288  },
289 };
290 
292 
293 VNET_FEATURE_INIT (gbp_ip4_src_classify_feat_node, static) =
294 {
295  .arc_name = "ip4-unicast",
296  .node_name = "ip4-gbp-src-classify",
297  .runs_before = VNET_FEATURES ("nat44-out2in"),
298 };
299 VNET_FEATURE_INIT (gbp_ip6_src_classify_feat_node, static) =
300 {
301  .arc_name = "ip6-unicast",
302  .node_name = "ip6-gbp-src-classify",
303  .runs_before = VNET_FEATURES ("nat66-out2in"),
304 };
305 
306 /* *INDENT-ON* */
307 
309 {
312 
315 {
316  u16 etype = clib_net_to_host_u16 (eh0->type);
317 
318  switch (etype)
319  {
320  case ETHERNET_TYPE_IP4:
321  return (DPO_PROTO_IP4);
322  case ETHERNET_TYPE_IP6:
323  return (DPO_PROTO_IP6);
324  case ETHERNET_TYPE_VLAN:
325  {
327 
328  vh0 = (ethernet_vlan_header_t *) (eh0 + 1);
329 
330  switch (clib_net_to_host_u16 (vh0->type))
331  {
332  case ETHERNET_TYPE_IP4:
333  return (DPO_PROTO_IP4);
334  case ETHERNET_TYPE_IP6:
335  return (DPO_PROTO_IP6);
336  }
337  }
338  }
339 
340  return (DPO_PROTO_NONE);
341 }
342 
343 /*
344  * Determine the SRC EPG from a LPM
345  */
348  vlib_node_runtime_t * node,
349  vlib_frame_t * frame,
350  dpo_proto_t dproto, u8 is_recirc)
351 {
353  u32 n_left_from, *from, *to_next;
354  u32 next_index;
355 
356  next_index = 0;
357  n_left_from = frame->n_vectors;
358  from = vlib_frame_vector_args (frame);
359 
360  while (n_left_from > 0)
361  {
362  u32 n_left_to_next;
363 
364  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
365 
366  while (n_left_from > 0 && n_left_to_next > 0)
367  {
368  u32 bi0, sw_if_index0, fib_index0, lbi0;
370  const gbp_policy_dpo_t *gpd0;
371  const gbp_ext_itf_t *gx0;
372  const gbp_recirc_t *gr0;
373  const dpo_id_t *dpo0;
374  load_balance_t *lb0;
375  ip4_header_t *ip4_0;
376  ip6_header_t *ip6_0;
377  vlib_buffer_t *b0;
378  epg_id_t src_epg0;
379 
380  bi0 = from[0];
381  to_next[0] = bi0;
382  from += 1;
383  to_next += 1;
384  n_left_from -= 1;
385  n_left_to_next -= 1;
386  ip4_0 = NULL;
387  ip6_0 = NULL;
388  next0 = GPB_LPM_CLASSIFY_DROP;
389 
390  b0 = vlib_get_buffer (vm, bi0);
391 
392  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
393  vnet_buffer2 (b0)->gbp.flags = VXLAN_GBP_GPFLAGS_NONE;
394 
395  if (DPO_PROTO_IP4 == dproto)
396  ip4_0 = vlib_buffer_get_current (b0);
397  else if (DPO_PROTO_IP6 == dproto)
398  ip6_0 = vlib_buffer_get_current (b0);
399  else if (DPO_PROTO_ETHERNET == dproto)
400  {
401  const ethernet_header_t *eh0;
402 
403  eh0 = vlib_buffer_get_current (b0);
404 
405  dproto = ethertype_to_dpo_proto (eh0);
406 
407  switch (dproto)
408  {
409  case DPO_PROTO_IP4:
410  ip4_0 = (vlib_buffer_get_current (b0) +
411  vnet_buffer (b0)->l2.l2_len);
412  break;
413  case DPO_PROTO_IP6:
414  ip6_0 = (vlib_buffer_get_current (b0) +
415  vnet_buffer (b0)->l2.l2_len);
416  break;
417  default:
418  /* not IP so no LPM classify possible */
419  src_epg0 = EPG_INVALID;
420  goto trace;
421  }
422  }
423 
424  if (is_recirc)
425  {
426  gr0 = gbp_recirc_get (sw_if_index0);
427  fib_index0 = gr0->gr_fib_index[dproto];
428 
429  vnet_feature_next (&next0, b0);
430  }
431  else
432  {
433  gx0 = gbp_ext_itf_get (sw_if_index0);
434  fib_index0 = gx0->gx_fib_index[dproto];
435 
436  next0 = vnet_l2_feature_next
438  L2INPUT_FEAT_GBP_LPM_CLASSIFY);
439  }
440 
441  if (DPO_PROTO_IP4 == dproto)
442  {
443  lbi0 = ip4_fib_forwarding_lookup (fib_index0,
444  &ip4_0->src_address);
445  }
446  else if (DPO_PROTO_IP6 == dproto)
447  {
448  lbi0 = ip6_fib_table_fwding_lookup (&ip6_main, fib_index0,
449  &ip6_0->src_address);
450  }
451  else
452  {
453  /* not IP so no LPM classify possible */
454  src_epg0 = EPG_INVALID;
455  goto trace;
456  }
457  lb0 = load_balance_get (lbi0);
458  dpo0 = load_balance_get_bucket_i (lb0, 0);
459 
460  if (gbp_policy_dpo_type == dpo0->dpoi_type)
461  {
462  gpd0 = gbp_policy_dpo_get (dpo0->dpoi_index);
463  src_epg0 = gpd0->gpd_epg;
464  }
465  else
466  {
467  /* could not classify => drop */
468  src_epg0 = EPG_INVALID;
469  next0 = GPB_LPM_CLASSIFY_DROP;
470  }
471 
472  trace:
473  vnet_buffer2 (b0)->gbp.src_epg = src_epg0;
474 
475  if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
476  {
478  vlib_add_trace (vm, node, b0, sizeof (*t));
479  t->src_epg = src_epg0;
480  }
481 
482  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
483  to_next, n_left_to_next,
484  bi0, next0);
485  }
486 
487  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
488  }
489 
490  return frame->n_vectors;
491 }
492 
493 static uword
495  vlib_node_runtime_t * node, vlib_frame_t * frame)
496 {
497  return (gbp_lpm_classify_inline (vm, node, frame, DPO_PROTO_IP4, 1));
498 }
499 
500 static uword
502  vlib_node_runtime_t * node, vlib_frame_t * frame)
503 {
504  return (gbp_lpm_classify_inline (vm, node, frame, DPO_PROTO_IP6, 1));
505 }
506 
507 static uword
509  vlib_node_runtime_t * node, vlib_frame_t * frame)
510 {
511  return (gbp_lpm_classify_inline (vm, node, frame, DPO_PROTO_ETHERNET, 0));
512 }
513 
514 /* *INDENT-OFF* */
516  .function = gbp_ip4_lpm_classify,
517  .name = "ip4-gbp-lpm-classify",
518  .vector_size = sizeof (u32),
519  .format_trace = format_gbp_classify_trace,
520  .type = VLIB_NODE_TYPE_INTERNAL,
521 
522  .n_errors = 0,
523  .n_next_nodes = 1,
524  .next_nodes = {
525  [GPB_LPM_CLASSIFY_DROP] = "ip4-drop"
526  },
527 };
528 
530 
532  .function = gbp_ip6_lpm_classify,
533  .name = "ip6-gbp-lpm-classify",
534  .vector_size = sizeof (u32),
535  .format_trace = format_gbp_classify_trace,
536  .type = VLIB_NODE_TYPE_INTERNAL,
537 
538  .n_errors = 0,
539  .n_next_nodes = 1,
540  .next_nodes = {
541  [GPB_LPM_CLASSIFY_DROP] = "ip6-drop"
542  },
543 };
544 
546 
548  .function = gbp_l2_lpm_classify,
549  .name = "l2-gbp-lpm-classify",
550  .vector_size = sizeof (u32),
551  .format_trace = format_gbp_classify_trace,
552  .type = VLIB_NODE_TYPE_INTERNAL,
553 
554  .n_errors = 0,
555  .n_next_nodes = 1,
556  .next_nodes = {
557  [GPB_LPM_CLASSIFY_DROP] = "error-drop"
558  },
559 };
560 
562 
563 VNET_FEATURE_INIT (gbp_ip4_lpm_classify_feat_node, static) =
564 {
565  .arc_name = "ip4-unicast",
566  .node_name = "ip4-gbp-lpm-classify",
567  .runs_before = VNET_FEATURES ("nat44-out2in"),
568 };
569 VNET_FEATURE_INIT (gbp_ip6_lpm_classify_feat_node, static) =
570 {
571  .arc_name = "ip6-unicast",
572  .node_name = "ip6-gbp-lpm-classify",
573  .runs_before = VNET_FEATURES ("nat66-out2in"),
574 };
575 
576 /* *INDENT-ON* */
577 
578 static clib_error_t *
580 {
582 
583  /* Initialize the feature next-node indexes */
585  gbp_src_classify_node.index,
599 
600  return 0;
601 }
602 
604 
605 /*
606  * fd.io coding-style-patch-verification: ON
607  *
608  * Local Variables:
609  * eval: (c-set-style "gnu")
610  * End:
611  */
static uword gbp_lpm_classify_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, dpo_proto_t dproto, u8 is_recirc)
Definition: gbp_classify.c:347
static u8 * format_gbp_classify_trace(u8 *s, va_list *args)
Definition: gbp_classify.c:223
static uword gbp_null_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: gbp_classify.c:197
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
Definition: vlib_api_cli.c:862
u16 epg_id_t
Definition: gbp_types.h:21
A Group Based Policy Endpoint.
Definition: gbp_endpoint.h:182
#define CLIB_UNUSED(x)
Definition: clib.h:82
enum gbp_lpm_classify_next_t_ gbp_lpm_classify_next_t
vlib_node_registration_t gbp_src_classify_node
(constructor) VLIB_REGISTER_NODE (gbp_src_classify_node)
Definition: gbp_classify.c:248
gbp_endpoint_fwd_t ge_fwd
Definition: gbp_endpoint.h:200
ip4_address_t src_address
Definition: ip4_packet.h:170
#define vnet_buffer2(b)
Definition: buffer.h:413
#define PREDICT_TRUE(x)
Definition: clib.h:112
#define NULL
Definition: clib.h:58
u32 fib_table_get_index_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the index of the FIB bound to the interface.
Definition: fib_table.c:956
u8 src_address[6]
Definition: packet.h:56
static gbp_src_classify_main_t gbp_src_classify_main
Definition: gbp_classify.c:49
static uword gbp_src_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: gbp_classify.c:189
struct gbp_classify_trace_t_ gbp_classify_trace_t
per-packet trace data
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
vlib_node_registration_t gbp_ip6_lpm_classify_node
(constructor) VLIB_REGISTER_NODE (gbp_ip6_lpm_classify_node)
Definition: gbp_classify.c:531
static u32 ip6_fib_table_fwding_lookup(ip6_main_t *im, u32 fib_index, const ip6_address_t *dst)
Definition: ip6_fib.h:67
ip6_address_t src_address
Definition: ip6_packet.h:378
unsigned char u8
Definition: types.h:56
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
Definition: feat_bitmap.h:94
epg_id_t gef_epg_id
Endpoint Group&#39;s ID.
Definition: gbp_endpoint.h:169
static dpo_proto_t ethertype_to_dpo_proto(const ethernet_header_t *eh0)
Definition: gbp_classify.c:314
static_always_inline gbp_endpoint_t * gbp_endpoint_find_ip4(const ip4_address_t *ip, u32 fib_index)
Definition: gbp_endpoint.h:307
#define GBP_SRC_N_CLASSIFY
Definition: gbp_classify.c:36
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:163
#define always_inline
Definition: clib.h:98
epg_id_t gpd_epg
EPG.
gbp_src_classify_type_t_
Definition: gbp_classify.c:29
#define DPO_PROTO_NONE
Definition: dpo.h:71
u32 gx_fib_index[DPO_PROTO_NUM]
cached FIB indices from the RD
Definition: gbp_ext_itf.h:47
static_always_inline gbp_endpoint_t * gbp_endpoint_find_mac(const u8 *mac, u32 bd_index)
Definition: gbp_endpoint.h:272
static clib_error_t * gbp_src_classify_init(vlib_main_t *vm)
Definition: gbp_classify.c:579
struct gbp_src_classify_main_t_ gbp_src_classify_main_t
Grouping of global data for the GBP source EPG classification feature.
A GBP recirculation interface representation Thes interfaces join Bridge domains that are internal to...
Definition: gbp_recirc.h:28
unsigned int u32
Definition: types.h:88
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
vlib_node_registration_t gbp_ip4_lpm_classify_node
(constructor) VLIB_REGISTER_NODE (gbp_ip4_lpm_classify_node)
Definition: gbp_classify.c:515
static uword gbp_ip4_src_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: gbp_classify.c:205
static uword gbp_ip6_src_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: gbp_classify.c:213
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:168
u32 gr_fib_index[DPO_PROTO_NUM]
FIB indices the EPG is mapped to.
Definition: gbp_recirc.h:43
The GBP FWD DPO.
static gbp_ext_itf_t * gbp_ext_itf_get(u32 sw_if_index)
Definition: gbp_ext_itf.h:68
dpo_type_t dpoi_type
the type
Definition: dpo.h:172
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
Definition: load_balance.h:228
per-packet trace data
Definition: gbp_classify.c:54
unsigned short u16
Definition: types.h:57
gbp_lpm_classify_next_t_
Definition: gbp_classify.c:308
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:214
The FIB DPO provieds;.
Definition: load_balance.h:106
#define PREDICT_FALSE(x)
Definition: clib.h:111
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
Definition: buffer_node.h:218
enum gbp_src_classify_type_t_ gbp_src_classify_type_t
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
Definition: node_funcs.h:338
An external interface maps directly to an oflex L3ExternalInterface.
Definition: gbp_ext_itf.h:27
vlib_node_registration_t gbp_ip6_src_classify_node
(constructor) VLIB_REGISTER_NODE (gbp_ip6_src_classify_node)
Definition: gbp_classify.c:277
static_always_inline gbp_endpoint_t * gbp_endpoint_find_ip6(const ip6_address_t *ip, u32 fib_index)
Definition: gbp_endpoint.h:332
static uword gbp_ip6_lpm_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: gbp_classify.c:501
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:169
u16 n_vectors
Definition: node.h:420
vlib_main_t * vm
Definition: buffer.c:301
static gbp_recirc_t * gbp_recirc_get(u32 sw_if_index)
Definition: gbp_recirc.h:75
Grouping of global data for the GBP source EPG classification feature.
Definition: gbp_classify.c:41
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
Definition: feature.h:295
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
Definition: feat_bitmap.h:43
u32 l2_input_feat_next[GBP_SRC_N_CLASSIFY][32]
Next nodes for L2 output features.
Definition: gbp_classify.c:46
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
Definition: main.c:452
char ** l2input_get_feat_names(void)
Return an array of strings containing graph node names of each feature.
Definition: l2_input.c:60
static gbp_policy_dpo_t * gbp_policy_dpo_get(index_t index)
vlib_node_registration_t gbp_l2_lpm_classify_node
(constructor) VLIB_REGISTER_NODE (gbp_l2_lpm_classify_node)
Definition: gbp_classify.c:547
#define ASSERT(truth)
static uword gbp_l2_lpm_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: gbp_classify.c:508
ip6_main_t ip6_main
Definition: ip6_forward.c:2624
static uword gbp_ip4_lpm_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: gbp_classify.c:494
static load_balance_t * load_balance_get(index_t lbi)
Definition: load_balance.h:219
dpo_type_t gbp_policy_dpo_type
DPO type registered for these GBP FWD.
VLIB_NODE_FUNCTION_MULTIARCH(gbp_null_classify_node, gbp_null_classify)
#define EPG_INVALID
Definition: gbp_types.h:22
static index_t ip4_fib_forwarding_lookup(u32 fib_index, const ip4_address_t *addr)
Definition: ip4_fib.h:160
#define VNET_FEATURES(...)
Definition: feature.h:435
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
Definition: trace_funcs.h:57
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:184
vlib_node_registration_t gbp_ip4_src_classify_node
(constructor) VLIB_REGISTER_NODE (gbp_ip4_src_classify_node)
Definition: gbp_classify.c:261
u64 uword
Definition: types.h:112
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:244
#define vnet_buffer(b)
Definition: buffer.h:368
VNET_FEATURE_INIT(gbp_ip4_src_classify_feat_node, static)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:117
vlib_node_registration_t gbp_null_classify_node
(constructor) VLIB_REGISTER_NODE (gbp_null_classify_node)
Definition: gbp_classify.c:235
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:62
Definition: defs.h:46
static uword gbp_classify_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, gbp_src_classify_type_t type, dpo_proto_t dproto)
Definition: gbp_classify.c:64