FD.io VPP  v18.07-34-g55fbdb9
Vector Packet Processing
gbp_policy_dpo.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 <vnet/dpo/dvr_dpo.h>
17 #include <vnet/fib/ip4_fib.h>
18 #include <vnet/fib/ip6_fib.h>
19 #include <vnet/dpo/load_balance.h>
20 
21 #include <plugins/gbp/gbp.h>
23 #include <plugins/gbp/gbp_recirc.h>
24 
25 /**
26  * DPO pool
27  */
29 
30 /**
31  * DPO type registered for these GBP FWD
32  */
34 
35 static inline gbp_policy_dpo_t *
37 {
38  return (pool_elt_at_index (gbp_policy_dpo_pool, index));
39 }
40 
43 {
44  return (gbp_policy_dpo_get_i (index));
45 }
46 
47 static gbp_policy_dpo_t *
49 {
50  gbp_policy_dpo_t *gpd;
51 
52  pool_get (gbp_policy_dpo_pool, gpd);
53 
54  return (gpd);
55 }
56 
57 static inline gbp_policy_dpo_t *
59 {
61 
62  return (gbp_policy_dpo_get_i (dpo->dpoi_index));
63 }
64 
65 static inline index_t
67 {
68  return (gpd - gbp_policy_dpo_pool);
69 }
70 
71 static void
73 {
74  gbp_policy_dpo_t *gpd;
75 
76  gpd = gbp_policy_dpo_get_from_dpo (dpo);
77  gpd->gpd_locks++;
78 }
79 
80 static void
82 {
83  gbp_policy_dpo_t *gpd;
84 
85  gpd = gbp_policy_dpo_get_from_dpo (dpo);
86  gpd->gpd_locks--;
87 
88  if (0 == gpd->gpd_locks)
89  {
90  dpo_reset (&gpd->gpd_dpo);
91  pool_put (gbp_policy_dpo_pool, gpd);
92  }
93 }
94 
95 static u32
97 {
98  gbp_policy_dpo_t *gpd;
99 
100  gpd = gbp_policy_dpo_get_from_dpo (dpo);
101 
102  return (gpd->gpd_sw_if_index);
103 }
104 
105 void
107  epg_id_t epg, u32 sw_if_index, dpo_id_t * dpo)
108 {
109  gbp_policy_dpo_t *gpd;
110  dpo_id_t parent = DPO_INVALID;
111 
112  gpd = gbp_policy_dpo_alloc ();
113  memset (gpd, 0, sizeof (*gpd));
114 
115  gpd->gpd_proto = dproto;
116  gpd->gpd_sw_if_index = sw_if_index;
117  gpd->gpd_epg = epg;
118 
119  /*
120  * stack on the DVR DPO for the output interface
121  */
122  dvr_dpo_add_or_lock (sw_if_index, dproto, &parent);
123 
124  dpo_stack (gbp_policy_dpo_type, dproto, &gpd->gpd_dpo, &parent);
125 
127 }
128 
129 u8 *
130 format_gbp_policy_dpo (u8 * s, va_list * ap)
131 {
132  index_t index = va_arg (*ap, index_t);
133  u32 indent = va_arg (*ap, u32);
134  gbp_policy_dpo_t *gpd = gbp_policy_dpo_get_i (index);
135  vnet_main_t *vnm = vnet_get_main ();
136 
137  s = format (s, "gbp-policy-dpo: %U, epg:%d out:%U",
139  gpd->gpd_epg,
141  s = format (s, "\n%U", format_white_space, indent + 2);
142  s = format (s, "%U", format_dpo_id, &gpd->gpd_dpo, indent + 4);
143 
144  return (s);
145 }
146 
147 const static dpo_vft_t gbp_policy_dpo_vft = {
149  .dv_unlock = gbp_policy_dpo_unlock,
150  .dv_format = format_gbp_policy_dpo,
151  .dv_get_urpf = gbp_policy_dpo_get_urpf,
152 };
153 
154 /**
155  * @brief The per-protocol VLIB graph nodes that are assigned to a glean
156  * object.
157  *
158  * this means that these graph nodes are ones from which a glean is the
159  * parent object in the DPO-graph.
160  */
161 const static char *const gbp_policy_dpo_ip4_nodes[] = {
162  "ip4-gbp-policy-dpo",
163  NULL,
164 };
165 
166 const static char *const gbp_policy_dpo_ip6_nodes[] = {
167  "ip6-gbp-policy-dpo",
168  NULL,
169 };
170 
171 const static char *const *const gbp_policy_dpo_nodes[DPO_PROTO_NUM] = {
174 };
175 
178 {
179  return (gbp_policy_dpo_type);
180 }
181 
182 static clib_error_t *
184 {
185  gbp_policy_dpo_type = dpo_register_new_type (&gbp_policy_dpo_vft,
187 
188  return (NULL);
189 }
190 
192 
194 {
199 
200 typedef enum
201 {
205 
208  vlib_node_runtime_t * node,
209  vlib_frame_t * from_frame, u8 is_ip6)
210 {
211  gbp_main_t *gm = &gbp_main;
212  u32 n_left_from, next_index, *from, *to_next;
213 
214  from = vlib_frame_vector_args (from_frame);
215  n_left_from = from_frame->n_vectors;
216 
217  next_index = node->cached_next_index;
218 
219  while (n_left_from > 0)
220  {
221  u32 n_left_to_next;
222 
223  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
224 
225  while (n_left_from > 0 && n_left_to_next > 0)
226  {
227  const gbp_policy_dpo_t *gpd0;
228  u32 bi0, next0;
229  gbp_contract_key_t key0;
230  gbp_contract_value_t value0 = {
231  .as_u64 = ~0,
232  };
233  vlib_buffer_t *b0;
234 
235  bi0 = from[0];
236  to_next[0] = bi0;
237  from += 1;
238  to_next += 1;
239  n_left_from -= 1;
240  n_left_to_next -= 1;
241  next0 = GBP_POLICY_DROP;
242 
243  b0 = vlib_get_buffer (vm, bi0);
244  gpd0 =
245  gbp_policy_dpo_get_i (vnet_buffer (b0)->ip.adj_index[VLIB_TX]);
246  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = gpd0->gpd_dpo.dpoi_index;
247 
248  key0.gck_src = vnet_buffer2 (b0)->gbp.src_epg;
249  key0.gck_dst = gpd0->gpd_epg;
250 
251  if (~0 != key0.gck_src)
252  {
253  if (PREDICT_FALSE (key0.gck_src == key0.gck_dst))
254  {
255  /*
256  * intra-epg allowed
257  */
258  next0 = gpd0->gpd_dpo.dpoi_next_node;
259  }
260  else
261  {
262  value0.as_u64 = gbp_acl_lookup (&key0);
263 
264  if (~0 != value0.gc_lc_index)
265  {
266  fa_5tuple_opaque_t pkt_5tuple0;
267  u8 action0 = 0;
268  u32 acl_pos_p0, acl_match_p0;
269  u32 rule_match_p0, trace_bitmap0;
270  /*
271  * tests against the ACL
272  */
275  value0.gc_lc_index, b0,
276  is_ip6,
277  /* is_input */ 1,
278  /* is_l2_path */ 0,
279  &pkt_5tuple0);
282  value0.gc_lc_index,
283  &pkt_5tuple0, is_ip6,
284  &action0, &acl_pos_p0,
285  &acl_match_p0,
286  &rule_match_p0,
287  &trace_bitmap0);
288 
289  if (action0 > 0)
290  next0 = gpd0->gpd_dpo.dpoi_next_node;
291  }
292  }
293  }
294  else
295  {
296  /*
297  * the src EPG is not set when the packet arrives on an EPG
298  * uplink interface and we do not need to apply policy
299  */
300  next0 = gpd0->gpd_dpo.dpoi_next_node;
301  }
302 
303  if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
304  {
306 
307  tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
308  tr->src_epg = key0.gck_src;
309  tr->dst_epg = key0.gck_dst;
310  tr->acl_index = value0.gc_acl_index;
311  }
312 
313  vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
314  n_left_to_next, bi0, next0);
315  }
316  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
317  }
318  return from_frame->n_vectors;
319 }
320 
321 static u8 *
322 format_gbp_policy_dpo_trace (u8 * s, va_list * args)
323 {
324  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
325  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
326  gbp_policy_dpo_trace_t *t = va_arg (*args, gbp_policy_dpo_trace_t *);
327 
328  s = format (s, " src-epg:%d dst-epg:%d acl-index:%d",
329  t->src_epg, t->dst_epg, t->acl_index);
330 
331  return s;
332 }
333 
334 static uword
336  vlib_node_runtime_t * node, vlib_frame_t * from_frame)
337 {
338  return (gbp_policy_dpo_inline (vm, node, from_frame, 0));
339 }
340 
341 static uword
343  vlib_node_runtime_t * node, vlib_frame_t * from_frame)
344 {
345  return (gbp_policy_dpo_inline (vm, node, from_frame, 1));
346 }
347 
348 /* *INDENT-OFF* */
350  .function = ip4_gbp_policy_dpo,
351  .name = "ip4-gbp-policy-dpo",
352  .vector_size = sizeof (u32),
353  .format_trace = format_gbp_policy_dpo_trace,
354  .n_next_nodes = GBP_POLICY_N_NEXT,
355  .next_nodes =
356  {
357  [GBP_POLICY_DROP] = "ip4-drop",
358  }
359 };
361  .function = ip6_gbp_policy_dpo,
362  .name = "ip6-gbp-policy-dpo",
363  .vector_size = sizeof (u32),
364  .format_trace = format_gbp_policy_dpo_trace,
365  .n_next_nodes = GBP_POLICY_N_NEXT,
366  .next_nodes =
367  {
368  [GBP_POLICY_DROP] = "ip6-drop",
369  }
370 };
371 
374 /* *INDENT-ON* */
375 
376  /**
377  * per-packet trace data
378  */
379 typedef struct gbp_classify_trace_t_
380 {
381  /* per-pkt trace data */
384 
386 {
389 
390 /*
391  * Determine the SRC EPG from a LPM
392  */
395  vlib_node_runtime_t * node,
396  vlib_frame_t * frame, fib_protocol_t fproto)
397 {
398  u32 n_left_from, *from, *to_next;
399  u32 next_index;
400 
401  next_index = 0;
402  n_left_from = frame->n_vectors;
403  from = vlib_frame_vector_args (frame);
404 
405  while (n_left_from > 0)
406  {
407  u32 n_left_to_next;
408 
409  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
410 
411  while (n_left_from > 0 && n_left_to_next > 0)
412  {
413  u32 bi0, sw_if_index0, fib_index0, lbi0;
415  const gbp_policy_dpo_t *gpd0;
416  const gbp_recirc_t *gr0;
417  const dpo_id_t *dpo0;
418  load_balance_t *lb0;
419  ip4_header_t *ip4_0;
420  ip6_header_t *ip6_0;
421  vlib_buffer_t *b0;
422  epg_id_t src_epg0;
423 
424  bi0 = from[0];
425  to_next[0] = bi0;
426  from += 1;
427  to_next += 1;
428  n_left_from -= 1;
429  n_left_to_next -= 1;
430  next0 = GPB_LPM_CLASSIFY_DROP;
431 
432  b0 = vlib_get_buffer (vm, bi0);
433 
434  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
435  gr0 = gbp_recirc_get (sw_if_index0);
436  fib_index0 = gr0->gr_fib_index[fproto];
437 
438  if (FIB_PROTOCOL_IP4 == fproto)
439  {
440  ip4_0 = vlib_buffer_get_current (b0);
441  lbi0 = ip4_fib_forwarding_lookup (fib_index0,
442  &ip4_0->src_address);
443  }
444  else
445  {
446  ip6_0 = vlib_buffer_get_current (b0);
447  lbi0 = ip6_fib_table_fwding_lookup (&ip6_main, fib_index0,
448  &ip6_0->src_address);
449  }
450 
451  lb0 = load_balance_get (lbi0);
452  dpo0 = load_balance_get_bucket_i (lb0, 0);
453 
454  if (gbp_policy_dpo_type == dpo0->dpoi_type)
455  {
456  gpd0 = gbp_policy_dpo_get_i (dpo0->dpoi_index);
457  src_epg0 = gpd0->gpd_epg;
458  vnet_feature_next (vnet_buffer (b0)->sw_if_index[VLIB_RX],
459  &next0, b0);
460  }
461  else
462  {
463  /* could not classify => drop */
464  src_epg0 = 0;
465  }
466 
467  vnet_buffer2 (b0)->gbp.src_epg = src_epg0;
468 
469  if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
470  {
472  vlib_add_trace (vm, node, b0, sizeof (*t));
473  t->src_epg = src_epg0;
474  }
475 
476  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
477  to_next, n_left_to_next,
478  bi0, next0);
479  }
480 
481  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
482  }
483 
484  return frame->n_vectors;
485 }
486 
487 static uword
489  vlib_node_runtime_t * node, vlib_frame_t * frame)
490 {
491  return (gbp_lpm_classify_inline (vm, node, frame, FIB_PROTOCOL_IP4));
492 }
493 
494 static uword
496  vlib_node_runtime_t * node, vlib_frame_t * frame)
497 {
498  return (gbp_lpm_classify_inline (vm, node, frame, FIB_PROTOCOL_IP6));
499 }
500 
501  /* packet trace format function */
502 static u8 *
503 format_gbp_classify_trace (u8 * s, va_list * args)
504 {
505  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
506  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
507  gbp_classify_trace_t *t = va_arg (*args, gbp_classify_trace_t *);
508 
509  s = format (s, "src-epg:%d", t->src_epg);
510 
511  return s;
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 
547 VNET_FEATURE_INIT (gbp_ip4_lpm_classify_feat_node, static) =
548 {
549  .arc_name = "ip4-unicast",
550  .node_name = "ip4-gbp-lpm-classify",
551  .runs_before = VNET_FEATURES ("nat44-out2in"),
552 };
553 VNET_FEATURE_INIT (gbp_ip6_lpm_classify_feat_node, static) =
554 {
555  .arc_name = "ip6-unicast",
556  .node_name = "ip6-gbp-lpm-classify",
557  .runs_before = VNET_FEATURES ("nat66-out2in"),
558 };
559 
560 /* *INDENT-ON* */
561 
562 /*
563  * fd.io coding-style-patch-verification: ON
564  *
565  * Local Variables:
566  * eval: (c-set-style "gnu")
567  * End:
568  */
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:404
gbp_policy_next_t
#define CLIB_UNUSED(x)
Definition: clib.h:79
A virtual function table regisitered for a DPO type.
Definition: dpo.h:399
ip4_address_t src_address
Definition: ip4_packet.h:169
vnet_main_t * vnet_get_main(void)
Definition: misc.c:47
#define vnet_buffer2(b)
Definition: buffer.h:403
struct gbp_classify_trace_t_ gbp_classify_trace_t
per-packet trace data
vlib_node_registration_t gbp_ip6_lpm_classify_node
(constructor) VLIB_REGISTER_NODE (gbp_ip6_lpm_classify_node)
#define NULL
Definition: clib.h:55
static uword ip4_gbp_policy_dpo(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
The key for an Contract.
Definition: gbp_contract.h:24
u32 gr_fib_index[FIB_PROTOCOL_IP_MAX]
FIB indices the EPG is mapped to.
Definition: gbp_recirc.h:35
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
gbp_policy_dpo_t * gbp_policy_dpo_get(index_t index)
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
static u32 ip6_fib_table_fwding_lookup(ip6_main_t *im, u32 fib_index, const ip6_address_t *dst)
Definition: ip6_fib.h:67
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:228
static gbp_policy_dpo_t * gbp_policy_dpo_get_from_dpo(const dpo_id_t *dpo)
ip6_address_t src_address
Definition: ip6_packet.h:347
format_function_t format_vnet_sw_if_index_name
unsigned char u8
Definition: types.h:56
static acl_plugin_methods_t acl_plugin
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static const char *const gbp_policy_dpo_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to a glean object.
static gbp_policy_dpo_t * gbp_policy_dpo_pool
DPO pool.
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:156
#define always_inline
Definition: clib.h:92
epg_id_t gpd_epg
EPG.
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:113
u32 epg_id_t
Definition: gbp_types.h:21
static uword gbp_policy_dpo_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip6)
static u8 * format_gbp_policy_dpo_trace(u8 *s, va_list *args)
static gbp_policy_dpo_t * gbp_policy_dpo_alloc(void)
An Endpoint Group representation.
Definition: gbp_recirc.h:25
unsigned int u32
Definition: types.h:88
u32 gpd_sw_if_index
output sw_if_index
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
static void acl_plugin_fill_5tuple_inline(void *p_acl_main, u32 lc_index, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_opaque_t *p5tuple_pkt)
dpo_type_t dpo_register_new_type(const dpo_vft_t *vft, const char *const *const *nodes)
Create and register a new DPO type.
Definition: dpo.c:341
static clib_error_t * gbp_policy_dpo_module_init(vlib_main_t *vm)
dpo_type_t gbp_policy_dpo_get_type(void)
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
u8 * format_gbp_policy_dpo(u8 *s, va_list *ap)
static u32 gbp_policy_dpo_get_urpf(const dpo_id_t *dpo)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:464
static gbp_policy_dpo_t * gbp_policy_dpo_get_i(index_t index)
The GBP FWD DPO.
static void gbp_policy_dpo_lock(dpo_id_t *dpo)
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:209
per-packet trace data
Definition: gbp_classify.c:44
u32 gc_lc_index
lookup context and acl index
Definition: gbp_contract.h:52
static const char *const gbp_policy_dpo_ip6_nodes[]
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:202
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:274
The FIB DPO provieds;.
Definition: load_balance.h:84
The value for an Contract.
Definition: gbp_contract.h:43
#define PREDICT_FALSE(x)
Definition: clib.h:105
static void gbp_policy_dpo_unlock(dpo_id_t *dpo)
static const gbp_recirc_t * gbp_recirc_get(u32 sw_if_index)
Definition: gbp_recirc.h:62
static_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
Definition: feature.h:237
#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
#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:364
void dvr_dpo_add_or_lock(u32 sw_if_index, dpo_proto_t dproto, dpo_id_t *dpo)
Definition: dvr_dpo.c:87
static u64 gbp_acl_lookup(gbp_contract_key_t *key)
Definition: gbp_contract.h:101
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:153
u16 n_vectors
Definition: node.h:380
vlib_main_t * vm
Definition: buffer.c:294
void gbp_policy_dpo_add_or_lock(dpo_proto_t dproto, epg_id_t epg, u32 sw_if_index, dpo_id_t *dpo)
struct gbp_policy_dpo_trace_t_ gbp_policy_dpo_trace_t
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:454
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
Definition: dpo.c:185
epg_id_t gck_src
source and destination EPGs for which the ACL applies
Definition: gbp_contract.h:33
static const char *const *const gbp_policy_dpo_nodes[DPO_PROTO_NUM]
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
Definition: node.h:492
#define ASSERT(truth)
gbp_main_t gbp_main
Definition: gbp_api.c:66
ip6_main_t ip6_main
Definition: ip6_forward.c:2574
static int acl_plugin_match_5tuple_inline(void *p_acl_main, u32 lc_index, fa_5tuple_opaque_t *pkt_5tuple, int is_ip6, u8 *r_action, u32 *r_acl_pos_p, u32 *r_acl_match_p, u32 *r_rule_match_p, u32 *trace_bitmap)
VNET_FEATURE_INIT(gbp_ip4_lpm_classify_feat_node, static)
static load_balance_t * load_balance_get(index_t lbi)
Definition: load_balance.h:200
u16 gpd_locks
number of locks.
static dpo_type_t gbp_policy_dpo_type
DPO type registered for these GBP FWD.
vlib_node_registration_t ip4_gbp_policy_dpo_node
(constructor) VLIB_REGISTER_NODE (ip4_gbp_policy_dpo_node)
static index_t ip4_fib_forwarding_lookup(u32 fib_index, const ip4_address_t *addr)
Definition: ip4_fib.h:160
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
Definition: dpo.c:147
#define VNET_FEATURES(...)
Definition: feature.h:391
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:55
Definition: defs.h:47
#define DPO_PROTO_NUM
Definition: dpo.h:70
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:184
enum gbp_lpm_classify_next_t_ gbp_lpm_classify_next_t
static uword gbp_ip6_lpm_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u64 uword
Definition: types.h:112
dpo_id_t gpd_dpo
Stacked DPO on DVR of output interface.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:267
static index_t gbp_policy_dpo_get_index(gbp_policy_dpo_t *gpd)
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:195
u8 * format_dpo_proto(u8 *s, va_list *args)
format a DPO protocol
Definition: dpo.c:177
Group Base Policy (GBP) defines:
Definition: gbp.h:43
VLIB_NODE_FUNCTION_MULTIARCH(gbp_ip4_lpm_classify_node, gbp_ip4_lpm_classify)
dpo_proto_t gpd_proto
The protocol of packets using this DPO.
#define vnet_buffer(b)
Definition: buffer.h:360
static uword ip6_gbp_policy_dpo(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
vlib_node_registration_t gbp_ip4_lpm_classify_node
(constructor) VLIB_REGISTER_NODE (gbp_ip4_lpm_classify_node)
static uword gbp_lpm_classify_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, fib_protocol_t fproto)
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:231
u16 dpoi_next_node
The next VLIB node to follow.
Definition: dpo.h:180
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:111
vlib_node_registration_t ip6_gbp_policy_dpo_node
(constructor) VLIB_REGISTER_NODE (ip6_gbp_policy_dpo_node)
static u8 * format_gbp_classify_trace(u8 *s, va_list *args)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:57
Definition: defs.h:46
gbp_lpm_classify_next_t_
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
Definition: dpo.c:515
static uword gbp_ip4_lpm_classify(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)