FD.io VPP  v18.07-rc0-415-g6c78436
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 <plugins/gbp/gbp.h>
18 #include <plugins/gbp/gbp_recirc.h>
19 
20 #include <vnet/dpo/dvr_dpo.h>
21 #include <vnet/fib/ip4_fib.h>
22 #include <vnet/fib/ip6_fib.h>
23 #include <vnet/dpo/load_balance.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, fib_protocol_t fproto)
210 {
211  u32 n_left_from, next_index, *from, *to_next;
212 
213  from = vlib_frame_vector_args (from_frame);
214  n_left_from = from_frame->n_vectors;
215 
216  next_index = node->cached_next_index;
217 
218  while (n_left_from > 0)
219  {
220  u32 n_left_to_next;
221 
222  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
223 
224  while (n_left_from > 0 && n_left_to_next > 0)
225  {
226  const gbp_policy_dpo_t *gpd0;
227  u32 bi0, next0, acl_index0;
228  gbp_contract_key_t key0;
229  vlib_buffer_t *b0;
230 
231  bi0 = from[0];
232  to_next[0] = bi0;
233  from += 1;
234  to_next += 1;
235  n_left_from -= 1;
236  n_left_to_next -= 1;
237  next0 = GBP_POLICY_DROP;
238  acl_index0 = ~0;
239 
240  b0 = vlib_get_buffer (vm, bi0);
241  gpd0 =
242  gbp_policy_dpo_get_i (vnet_buffer (b0)->ip.adj_index[VLIB_TX]);
243  vnet_buffer (b0)->ip.adj_index[VLIB_TX] = gpd0->gpd_dpo.dpoi_index;
244 
245  key0.gck_src = vnet_buffer2 (b0)->gbp.src_epg;
246  key0.gck_dst = gpd0->gpd_epg;
247 
248  if (~0 != key0.gck_src)
249  {
250  if (PREDICT_FALSE (key0.gck_src == key0.gck_dst))
251  {
252  /*
253  * intra-epg allowed
254  */
255  next0 = gpd0->gpd_dpo.dpoi_next_node;
256  }
257  else
258  {
259  acl_index0 = gbp_acl_lookup (&key0);
260 
261  if (~0 != acl_index0)
262  {
263  /*
264  * TODO tests against the ACL
265  */
266  /*
267  * ACL tables are not available outside of ACL plugin
268  * until then bypass the ACL to next node
269  */
270  next0 = gpd0->gpd_dpo.dpoi_next_node;
271  }
272  }
273  }
274  else
275  {
276  /*
277  * the src EPG is not set when the packet arrives on an EPG
278  * uplink interface and we do not need to apply policy
279  */
280  next0 = gpd0->gpd_dpo.dpoi_next_node;
281  }
282 
283  if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
284  {
286 
287  tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
288  tr->src_epg = key0.gck_src;
289  tr->dst_epg = key0.gck_dst;
290  tr->acl_index = acl_index0;
291  }
292 
293  vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
294  n_left_to_next, bi0, next0);
295  }
296  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
297  }
298  return from_frame->n_vectors;
299 }
300 
301 static u8 *
302 format_gbp_policy_dpo_trace (u8 * s, va_list * args)
303 {
304  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
305  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
306  gbp_policy_dpo_trace_t *t = va_arg (*args, gbp_policy_dpo_trace_t *);
307 
308  s = format (s, " src-epg:%d dst-epg:%d acl-index:%d",
309  t->src_epg, t->dst_epg, t->acl_index);
310 
311  return s;
312 }
313 
314 static uword
316  vlib_node_runtime_t * node, vlib_frame_t * from_frame)
317 {
318  return (gbp_policy_dpo_inline (vm, node, from_frame, FIB_PROTOCOL_IP4));
319 }
320 
321 static uword
323  vlib_node_runtime_t * node, vlib_frame_t * from_frame)
324 {
325  return (gbp_policy_dpo_inline (vm, node, from_frame, FIB_PROTOCOL_IP6));
326 }
327 
328 /* *INDENT-OFF* */
330  .function = ip4_gbp_policy_dpo,
331  .name = "ip4-gbp-policy-dpo",
332  .vector_size = sizeof (u32),
333  .format_trace = format_gbp_policy_dpo_trace,
334  .n_next_nodes = GBP_POLICY_N_NEXT,
335  .next_nodes =
336  {
337  [GBP_POLICY_DROP] = "ip4-drop",
338  }
339 };
341  .function = ip6_gbp_policy_dpo,
342  .name = "ip6-gbp-policy-dpo",
343  .vector_size = sizeof (u32),
344  .format_trace = format_gbp_policy_dpo_trace,
345  .n_next_nodes = GBP_POLICY_N_NEXT,
346  .next_nodes =
347  {
348  [GBP_POLICY_DROP] = "ip6-drop",
349  }
350 };
351 
354 /* *INDENT-ON* */
355 
356  /**
357  * per-packet trace data
358  */
359 typedef struct gbp_classify_trace_t_
360 {
361  /* per-pkt trace data */
364 
366 {
369 
370 /*
371  * Determine the SRC EPG from a LPM
372  */
375  vlib_node_runtime_t * node,
376  vlib_frame_t * frame, fib_protocol_t fproto)
377 {
378  u32 n_left_from, *from, *to_next;
379  u32 next_index;
380 
381  next_index = 0;
382  n_left_from = frame->n_vectors;
383  from = vlib_frame_vector_args (frame);
384 
385  while (n_left_from > 0)
386  {
387  u32 n_left_to_next;
388 
389  vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
390 
391  while (n_left_from > 0 && n_left_to_next > 0)
392  {
393  u32 bi0, sw_if_index0, fib_index0, lbi0;
395  const gbp_policy_dpo_t *gpd0;
396  const gbp_recirc_t *gr0;
397  const dpo_id_t *dpo0;
398  load_balance_t *lb0;
399  ip4_header_t *ip4_0;
400  ip6_header_t *ip6_0;
401  vlib_buffer_t *b0;
402  epg_id_t src_epg0;
403 
404  bi0 = from[0];
405  to_next[0] = bi0;
406  from += 1;
407  to_next += 1;
408  n_left_from -= 1;
409  n_left_to_next -= 1;
410  next0 = GPB_LPM_CLASSIFY_DROP;
411 
412  b0 = vlib_get_buffer (vm, bi0);
413 
414  sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
415  gr0 = gbp_recirc_get (sw_if_index0);
416  fib_index0 = gr0->gr_fib_index[fproto];
417 
418  if (FIB_PROTOCOL_IP4 == fproto)
419  {
420  ip4_0 = vlib_buffer_get_current (b0);
421  lbi0 = ip4_fib_forwarding_lookup (fib_index0,
422  &ip4_0->src_address);
423  }
424  else
425  {
426  ip6_0 = vlib_buffer_get_current (b0);
427  lbi0 = ip6_fib_table_fwding_lookup (&ip6_main, fib_index0,
428  &ip6_0->src_address);
429  }
430 
431  lb0 = load_balance_get (lbi0);
432  dpo0 = load_balance_get_bucket_i (lb0, 0);
433 
434  if (gbp_policy_dpo_type == dpo0->dpoi_type)
435  {
436  gpd0 = gbp_policy_dpo_get_i (dpo0->dpoi_index);
437  src_epg0 = gpd0->gpd_epg;
438  vnet_feature_next (vnet_buffer (b0)->sw_if_index[VLIB_RX],
439  &next0, b0);
440  }
441  else
442  {
443  /* could not classify => drop */
444  src_epg0 = 0;
445  }
446 
447  vnet_buffer2 (b0)->gbp.src_epg = src_epg0;
448 
449  if (PREDICT_FALSE ((b0->flags & VLIB_BUFFER_IS_TRACED)))
450  {
452  vlib_add_trace (vm, node, b0, sizeof (*t));
453  t->src_epg = src_epg0;
454  }
455 
456  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
457  to_next, n_left_to_next,
458  bi0, next0);
459  }
460 
461  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
462  }
463 
464  return frame->n_vectors;
465 }
466 
467 static uword
469  vlib_node_runtime_t * node, vlib_frame_t * frame)
470 {
471  return (gbp_lpm_classify_inline (vm, node, frame, FIB_PROTOCOL_IP4));
472 }
473 
474 static uword
476  vlib_node_runtime_t * node, vlib_frame_t * frame)
477 {
478  return (gbp_lpm_classify_inline (vm, node, frame, FIB_PROTOCOL_IP6));
479 }
480 
481  /* packet trace format function */
482 static u8 *
483 format_gbp_classify_trace (u8 * s, va_list * args)
484 {
485  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
486  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
487  gbp_classify_trace_t *t = va_arg (*args, gbp_classify_trace_t *);
488 
489  s = format (s, "src-epg:%d", t->src_epg);
490 
491  return s;
492 }
493 
494 /* *INDENT-OFF* */
496  .function = gbp_ip4_lpm_classify,
497  .name = "ip4-gbp-lpm-classify",
498  .vector_size = sizeof (u32),
499  .format_trace = format_gbp_classify_trace,
500  .type = VLIB_NODE_TYPE_INTERNAL,
501 
502  .n_errors = 0,
503  .n_next_nodes = 1,
504  .next_nodes = {
505  [GPB_LPM_CLASSIFY_DROP] = "ip4-drop"
506  },
507 };
508 
510 
512  .function = gbp_ip6_lpm_classify,
513  .name = "ip6-gbp-lpm-classify",
514  .vector_size = sizeof (u32),
515  .format_trace = format_gbp_classify_trace,
516  .type = VLIB_NODE_TYPE_INTERNAL,
517 
518  .n_errors = 0,
519  .n_next_nodes = 1,
520  .next_nodes = {
521  [GPB_LPM_CLASSIFY_DROP] = "ip6-drop"
522  },
523 };
524 
526 
527 VNET_FEATURE_INIT (gbp_ip4_lpm_classify_feat_node, static) =
528 {
529  .arc_name = "ip4-unicast",
530  .node_name = "ip4-gbp-lpm-classify",
531  .runs_before = VNET_FEATURES ("nat44-out2in"),
532 };
533 VNET_FEATURE_INIT (gbp_ip6_lpm_classify_feat_node, static) =
534 {
535  .arc_name = "ip6-unicast",
536  .node_name = "ip6-gbp-lpm-classify",
537  .runs_before = VNET_FEATURES ("nat66-out2in"),
538 };
539 
540 /* *INDENT-ON* */
541 
542 /*
543  * fd.io coding-style-patch-verification: ON
544  *
545  * Local Variables:
546  * eval: (c-set-style "gnu")
547  * End:
548  */
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:402
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:227
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
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 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.
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:461
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
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:273
The FIB DPO provieds;.
Definition: load_balance.h:84
#define PREDICT_FALSE(x)
Definition: clib.h:105
static uword gbp_policy_dpo_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, fib_protocol_t fproto)
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
#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)
static u32 gbp_acl_lookup(gbp_contract_key_t *key)
Definition: gbp_contract.h:82
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)
ip6_main_t ip6_main
Definition: ip6_forward.c:2574
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:164
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
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)