FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
adj_midchain.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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/adj/adj_nbr.h>
17 #include <vnet/adj/adj_internal.h>
18 #include <vnet/adj/adj_l2.h>
19 #include <vnet/adj/adj_nsh.h>
20 #include <vnet/adj/adj_midchain.h>
21 #include <vnet/dpo/drop_dpo.h>
22 #include <vnet/dpo/load_balance.h>
23 #include <vnet/fib/fib_walk.h>
24 #include <vnet/fib/fib_entry.h>
25 #include <vnet/ip/ip4_inlines.h>
26 #include <vnet/ip/ip6_inlines.h>
27 
28 u8
30 {
31  ip_adjacency_t *adj;
32 
33  adj = adj_get(ai);
34 
35  switch (adj->lookup_next_index)
36  {
39  return (1);
40  case IP_LOOKUP_NEXT_ARP:
49  case IP_LOOKUP_N_NEXT:
50  return (0);
51  }
52 
53  return (0);
54 }
55 
56 static inline u32
58 {
59  switch (link) {
60  case VNET_LINK_IP4:
61  return (ip4_midchain_node.index);
62  case VNET_LINK_IP6:
63  return (ip6_midchain_node.index);
64  case VNET_LINK_MPLS:
65  return (mpls_midchain_node.index);
66  case VNET_LINK_ETHERNET:
67  return (adj_l2_midchain_node.index);
68  case VNET_LINK_NSH:
69  return (adj_nsh_midchain_node.index);
70  case VNET_LINK_ARP:
71  break;
72  }
73  ASSERT(0);
74  return (0);
75 }
76 
77 static u8
79 {
80  u8 arc = (u8) ~0;
81  switch (adj->ia_link)
82  {
83  case VNET_LINK_IP4:
84  {
86  break;
87  }
88  case VNET_LINK_IP6:
89  {
91  break;
92  }
93  case VNET_LINK_MPLS:
94  {
96  break;
97  }
98  case VNET_LINK_ETHERNET:
99  {
101  break;
102  }
103  case VNET_LINK_NSH:
104  {
105  arc = nsh_main_placeholder.output_feature_arc_index;
106  break;
107  }
108  case VNET_LINK_ARP:
109  ASSERT(0);
110  break;
111  }
112 
113  ASSERT (arc != (u8) ~0);
114 
115  return (arc);
116 }
117 
118 static u32
120 {
121  return ((adj->ia_flags & ADJ_FLAG_MIDCHAIN_NO_COUNT) ?
123  adj_midchain_tx_node.index);
124 }
125 
126 /**
127  * adj_midchain_setup
128  *
129  * Setup the adj as a mid-chain
130  */
131 void
133 {
135 
136  dpo_reset(&adj->sub_type.midchain.next_dpo);
137 
141  adj->rewrite_header.sw_if_index,
143  (u8*) "interface-output")->index);
145 }
146 
147 /**
148  * adj_midchain_setup
149  *
150  * Setup the adj as a mid-chain
151  */
152 void
154  adj_midchain_fixup_t fixup,
155  const void *data,
157 {
159  ip_adjacency_t *adj;
160  u32 tx_node;
161 
162  ASSERT(ADJ_INDEX_INVALID != adj_index);
163 
164  adj = adj_get(adj_index);
165 
166  adj->sub_type.midchain.fixup_func = fixup;
167  adj->sub_type.midchain.fixup_data = data;
169  adj->ia_flags |= flags;
170 
172  {
173  adj->rewrite_header.flags |= VNET_REWRITE_FIXUP_IP4_O_4;
174  }
175  else
176  {
177  adj->rewrite_header.flags &= ~VNET_REWRITE_FIXUP_IP4_O_4;
178  }
180  {
181  adj->rewrite_header.flags &= ~VNET_REWRITE_FIXUP_FLOW_HASH;
182  }
183 
184  tx_node = adj_nbr_midchain_get_tx_node(adj);
185 
189  adj->rewrite_header.sw_if_index,
190  tx_node);
192 
193  /*
194  * stack the midchain on the drop so it's ready to forward in the adj-midchain-tx.
195  * The graph arc used/created here is from the midchain-tx node to the
196  * child's registered node. This is because post adj processing the next
197  * node are any output features, then the midchain-tx. from there we
198  * need to get to the stacked child's node.
199  */
200  dpo_stack_from_node(tx_node,
201  &adj->sub_type.midchain.next_dpo,
203 }
204 
205 /**
206  * adj_nbr_midchain_update_rewrite
207  *
208  * Update the adjacency's rewrite string. A NULL string implies the
209  * rewrite is reset (i.e. when ARP/ND entry is gone).
210  * NB: the adj being updated may be handling traffic in the DP.
211  */
212 void
214  adj_midchain_fixup_t fixup,
215  const void *fixup_data,
217  u8 *rewrite)
218 {
219  ip_adjacency_t *adj;
220 
221  ASSERT(ADJ_INDEX_INVALID != adj_index);
222 
223  adj = adj_get(adj_index);
224 
225  /*
226  * one time only update. since we don't support changing the tunnel
227  * src,dst, this is all we need.
228  */
231  {
232  adj_midchain_setup(adj_index, fixup, fixup_data, flags);
233  }
234 
235  /*
236  * update the rewrite with the workers paused.
237  */
242  rewrite);
243 }
244 
245 void
247  u32 next_node)
248 {
249  ip_adjacency_t *adj;
250  vlib_main_t * vm;
251 
252  ASSERT(ADJ_INDEX_INVALID != adj_index);
253 
254  adj = adj_get(adj_index);
255  vm = vlib_get_main();
256 
258 
259  adj->rewrite_header.next_index = vlib_node_add_next(vlib_get_main(),
260  adj->ia_node_index,
261  next_node);
262 
265  adj->rewrite_header.sw_if_index,
266  next_node);
267 
269 }
270 
271 void
273 {
274  ip_adjacency_t *adj;
275  vlib_main_t * vm;
276 
277  ASSERT(ADJ_INDEX_INVALID != adj_index);
278 
279  adj = adj_get(adj_index);
280  vm = vlib_get_main();
281 
283 
284  adj->rewrite_header.next_index =
286  adj->ia_node_index,
288 
291  adj->rewrite_header.sw_if_index,
293 
295 }
296 
297 /**
298  * adj_nbr_midchain_unstack
299  *
300  * Unstack the adj. stack it on drop
301  */
302 void
304 {
305  fib_node_index_t *entry_indicies, tmp;
306  ip_adjacency_t *adj;
307 
308  ASSERT(ADJ_INDEX_INVALID != adj_index);
309  adj = adj_get (adj_index);
310 
311  /*
312  * check to see if this unstacking breaks a recursion loop
313  */
314  entry_indicies = NULL;
315  tmp = adj->sub_type.midchain.fei;
317 
319  {
320  fib_entry_recursive_loop_detect(tmp, &entry_indicies);
321  vec_free(entry_indicies);
322  }
323 
324  /*
325  * stack on the drop
326  */
329  &adj->sub_type.midchain.next_dpo,
332 }
333 
334 void
336  fib_node_index_t fei,
338 {
339  fib_node_index_t *entry_indicies;
341  ip_adjacency_t *adj;
342 
343  adj = adj_get (ai);
344 
345  /*
346  * check to see if this stacking will form a recursion loop
347  */
348  entry_indicies = NULL;
349  adj->sub_type.midchain.fei = fei;
350 
351  if (fib_entry_recursive_loop_detect(adj->sub_type.midchain.fei, &entry_indicies))
352  {
353  /*
354  * loop formed, stack on the drop.
355  */
357  }
358  else
359  {
361 
362  if (DPO_LOAD_BALANCE == tmp.dpoi_type)
363  {
364  load_balance_t *lb;
365 
366  lb = load_balance_get (tmp.dpoi_index);
367 
368  if ((adj->ia_flags & ADJ_FLAG_MIDCHAIN_IP_STACK) ||
369  lb->lb_n_buckets == 1)
370  {
371  /*
372  * do that hash now and stack on the choice.
373  * If the choice is an incomplete adj then we will need a poke when
374  * it becomes complete. This happens since the adj update walk propagates
375  * as far a recursive paths.
376  */
377  const dpo_id_t *choice;
378  int hash;
379 
381  {
383  lb->lb_hash_config);
384  }
385  else if (FIB_FORW_CHAIN_TYPE_UNICAST_IP6 == fct)
386  {
388  lb->lb_hash_config);
389  }
390  else
391  {
392  hash = 0;
393  ASSERT(0);
394  }
395 
396  choice = load_balance_get_bucket_i (lb, hash & lb->lb_n_buckets_minus_1);
397  dpo_copy (&tmp, choice);
398  }
399  else if (lb->lb_n_buckets > 1)
400  {
401  /*
402  * the client has chosen not to use the stacking to select a
403  * bucket, and there are more than one buckets. there's no
404  * value in using the midchain's fixed rewrite string to select
405  * the path, so force a flow hash on the inner.
406  */
407  adj->rewrite_header.flags |= VNET_REWRITE_FIXUP_FLOW_HASH;
408  }
409 
411  {
412  /*
413  * The client, for reasons unbeknownst to adj, wants to force
414  * a flow hash on the inner, we will oblige.
415  */
416  adj->rewrite_header.flags |= VNET_REWRITE_FIXUP_FLOW_HASH;
417  }
418  }
419  }
421  dpo_reset(&tmp);
422  vec_free(entry_indicies);
423 }
424 
425 /**
426  * adj_nbr_midchain_stack
427  */
428 void
430  const dpo_id_t *next)
431 {
432  ip_adjacency_t *adj;
433 
434  ASSERT(ADJ_INDEX_INVALID != adj_index);
435 
436  adj = adj_get(adj_index);
437 
440 
442  &adj->sub_type.midchain.next_dpo,
443  next);
444 }
445 
446 int
448  fib_node_index_t **entry_indicies)
449 {
450  fib_node_index_t *entry_index, *entries;
451  ip_adjacency_t * adj;
452 
453  adj = adj_get(ai);
454  entries = *entry_indicies;
455 
456  vec_foreach(entry_index, entries)
457  {
458  if (*entry_index == adj->sub_type.midchain.fei)
459  {
460  /*
461  * The entry this midchain links to is already in the set
462  * of visited entries, this is a loop
463  */
465  return (1);
466  }
467  }
468 
470  return (0);
471 }
472 
473 u8*
474 format_adj_midchain (u8* s, va_list *ap)
475 {
476  index_t index = va_arg(*ap, index_t);
477  u32 indent = va_arg(*ap, u32);
478  ip_adjacency_t * adj = adj_get(index);
479 
480  s = format (s, "%U", format_vnet_link, adj->ia_link);
481  if (adj->rewrite_header.flags & VNET_REWRITE_HAS_FEATURES)
482  s = format(s, " [features]");
483  s = format (s, " via %U",
484  format_ip46_address, &adj->sub_type.nbr.next_hop,
486  s = format (s, " %U",
488  &adj->rewrite_header, sizeof (adj->rewrite_data), indent);
489  s = format (s, "\n%Ustacked-on",
490  format_white_space, indent);
491 
492  if (FIB_NODE_INDEX_INVALID != adj->sub_type.midchain.fei)
493  {
494  s = format (s, " entry:%d", adj->sub_type.midchain.fei);
495 
496  }
497  s = format (s, ":\n%U%U",
498  format_white_space, indent+2,
499  format_dpo_id, &adj->sub_type.midchain.next_dpo, indent+2);
500 
501  return (s);
502 }
503 
504 static void
506 {
507  adj_lock(dpo->dpoi_index);
508 }
509 static void
511 {
512  adj_unlock(dpo->dpoi_index);
513 }
514 
517  .dv_unlock = adj_dpo_unlock,
518  .dv_format = format_adj_midchain,
519  .dv_get_urpf = adj_dpo_get_urpf,
520  .dv_get_mtu = adj_dpo_get_mtu,
521 };
522 
523 /**
524  * @brief The per-protocol VLIB graph nodes that are assigned to a midchain
525  * object.
526  *
527  * this means that these graph nodes are ones from which a midchain is the
528  * parent object in the DPO-graph.
529  */
530 const static char* const midchain_ip4_nodes[] =
531 {
532  "ip4-midchain",
533  NULL,
534 };
535 const static char* const midchain_ip6_nodes[] =
536 {
537  "ip6-midchain",
538  NULL,
539 };
540 const static char* const midchain_mpls_nodes[] =
541 {
542  "mpls-midchain",
543  NULL,
544 };
545 const static char* const midchain_ethernet_nodes[] =
546 {
547  "adj-l2-midchain",
548  NULL,
549 };
550 const static char* const midchain_nsh_nodes[] =
551 {
552  "adj-nsh-midchain",
553  NULL,
554 };
555 
556 const static char* const * const midchain_nodes[DPO_PROTO_NUM] =
557 {
563 };
564 
565 void
567 {
569 }
load_balance.h
ADJ_FLAG_MIDCHAIN_NO_COUNT
@ ADJ_FLAG_MIDCHAIN_NO_COUNT
Definition: adj.h:217
adj_dpo_get_urpf
u32 adj_dpo_get_urpf(const dpo_id_t *dpo)
Definition: adj.c:321
tmp
u32 * tmp
Definition: interface_output.c:1078
ip_adjacency_t_::ia_flags
adj_flags_t ia_flags
Flags on the adjacency 1-bytes.
Definition: adj.h:356
ip4_midchain_node
vlib_node_registration_t ip4_midchain_node
(constructor) VLIB_REGISTER_NODE (ip4_midchain_node)
Definition: ip4_forward.c:2657
fib_entry.h
adj_midchain.h
ip_adjacency_t_::ia_nh_proto
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
Definition: adj.h:350
load_balance_t_::lb_n_buckets
u16 lb_n_buckets
number of buckets in the load-balance.
Definition: load_balance.h:116
adj_proto_to_46
static ip46_type_t adj_proto_to_46(fib_protocol_t proto)
Definition: adj_internal.h:90
vlib_worker_thread_barrier_release
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
Definition: threads.c:1386
dpo_id_t_::dpoi_index
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:190
DPO_INVALID
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:204
IP_LOOKUP_NEXT_ARP
@ IP_LOOKUP_NEXT_ARP
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
Definition: adj.h:63
format_vnet_link
u8 * format_vnet_link(u8 *s, va_list *ap)
Definition: fib_types.c:41
adj_midchain_tx_node
vlib_node_registration_t adj_midchain_tx_node
(constructor) VLIB_REGISTER_NODE (adj_midchain_tx_node)
Definition: adj_midchain_node.c:213
ip4_main_t::lookup_main
ip_lookup_main_t lookup_main
Definition: ip4.h:109
ADJ_FLAG_MIDCHAIN_FIXUP_IP4O4_HDR
@ ADJ_FLAG_MIDCHAIN_FIXUP_IP4O4_HDR
Definition: adj.h:220
vlib_node_add_next
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
Definition: node_funcs.h:1177
ip4_main
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1105
adj_get_rewrite
const u8 * adj_get_rewrite(adj_index_t ai)
Return the rewrite string of the adjacency.
Definition: adj.c:566
DPO_ADJACENCY_MIDCHAIN
@ DPO_ADJACENCY_MIDCHAIN
Definition: dpo.h:108
midchain_ethernet_nodes
const static char *const midchain_ethernet_nodes[]
Definition: adj_midchain.c:545
VNET_LINK_ETHERNET
@ VNET_LINK_ETHERNET
Definition: interface.h:350
ADJ_INDEX_INVALID
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
Definition: adj_types.h:36
ip4_inlines.h
adj_midchain_fixup_t
void(* adj_midchain_fixup_t)(vlib_main_t *vm, const struct ip_adjacency_t_ *adj, vlib_buffer_t *b0, const void *data)
A function type for post-rewrite fixups on midchain adjacency.
Definition: adj.h:152
next
u16 * next
Definition: nat44_ei_out2in.c:718
load_balance_t_::lb_hash_config
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
Definition: load_balance.h:161
IP_LOOKUP_NEXT_GLEAN
@ IP_LOOKUP_NEXT_GLEAN
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
Definition: adj.h:68
mpls_main
mpls_main_t mpls_main
Definition: mpls.c:25
u8
#define u8
Padding.
Definition: clib.h:121
VNET_REWRITE_FIXUP_FLOW_HASH
@ VNET_REWRITE_FIXUP_FLOW_HASH
this adj performs the flow hash fixup
Definition: rewrite.h:67
FIB_NODE_INDEX_INVALID
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
adj_unlock
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
Definition: adj.c:358
midchain_nsh_nodes
const static char *const midchain_nsh_nodes[]
Definition: adj_midchain.c:550
IP_LOOKUP_NEXT_LOCAL
@ IP_LOOKUP_NEXT_LOCAL
This packet is for one of our own IP addresses.
Definition: adj.h:58
entries
u32 entries
Definition: flowhash_template.h:362
ADJ_FLAG_MIDCHAIN_LOOPED
@ ADJ_FLAG_MIDCHAIN_LOOPED
Definition: adj.h:219
adj_midchain_dpo_vft
const static dpo_vft_t adj_midchain_dpo_vft
Definition: adj_midchain.c:515
adj_l2.h
VNET_REWRITE_HAS_FEATURES
@ VNET_REWRITE_HAS_FEATURES
This adjacency/interface has output features configured.
Definition: rewrite.h:57
IP_LOOKUP_NEXT_MIDCHAIN
@ IP_LOOKUP_NEXT_MIDCHAIN
This packets follow a mid-chain adjacency.
Definition: adj.h:76
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
adj_dpo_get_mtu
u16 adj_dpo_get_mtu(const dpo_id_t *dpo)
Definition: adj.c:331
VNET_LINK_ARP
@ VNET_LINK_ARP
Definition: interface.h:351
ethernet_main_t_::output_feature_arc_index
u8 output_feature_arc_index
Definition: ethernet.h:328
ip_adjacency_t_::ia_link
vnet_link_t ia_link
link/ether-type 1 bytes
Definition: adj.h:343
adj_nbr_update_rewrite_internal
void adj_nbr_update_rewrite_internal(ip_adjacency_t *adj, ip_lookup_next_t adj_next_index, u32 complete_next_index, u32 next_index, u8 *rewrite)
adj_nbr_update_rewrite_internal
Definition: adj_nbr.c:382
drop_dpo.h
adj_nbr_midchain_update_next_node
void adj_nbr_midchain_update_next_node(adj_index_t adj_index, u32 next_node)
Update the VLIB node to which packets are sent post processing.
Definition: adj_midchain.c:246
adj_nbr_midchain_stack_on_fib_entry
void adj_nbr_midchain_stack_on_fib_entry(adj_index_t ai, fib_node_index_t fei, fib_forward_chain_type_t fct)
[re]stack a midchain.
Definition: adj_midchain.c:335
ip4_header_t
Definition: ip4_packet.h:87
nsh_main_placeholder
nsh_main_placeholder_t nsh_main_placeholder
Definition: adj_nsh.c:21
fib_entry_contribute_forwarding
void fib_entry_contribute_forwarding(fib_node_index_t fib_entry_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
Definition: fib_entry.c:437
vnet_link_to_dpo_proto
dpo_proto_t vnet_link_to_dpo_proto(vnet_link_t linkt)
Definition: dpo.c:98
adj_flags_t
enum adj_flags_t_ adj_flags_t
Flags on an IP adjacency.
FIB_FORW_CHAIN_TYPE_UNICAST_IP4
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP4
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:108
IP_LOOKUP_NEXT_MCAST_MIDCHAIN
@ IP_LOOKUP_NEXT_MCAST_MIDCHAIN
Multicast Midchain Adjacency.
Definition: adj.h:89
IP_LOOKUP_NEXT_DROP
@ IP_LOOKUP_NEXT_DROP
Adjacency to drop this packet.
Definition: adj.h:53
VNET_LINK_IP4
@ VNET_LINK_IP4
Definition: interface.h:344
dpo_stack
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:535
adj_get_midchain_node
static u32 adj_get_midchain_node(vnet_link_t link)
Definition: adj_midchain.c:57
ip_adjacency_t_::lookup_next_index
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
Definition: adj.h:337
ip6_compute_flow_hash
static u32 ip6_compute_flow_hash(const ip6_header_t *ip, flow_hash_config_t flow_hash_config)
Definition: ip6_inlines.h:49
fib_forward_chain_type_t
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
fib_walk.h
adj_midchain_module_init
void adj_midchain_module_init(void)
Module initialisation.
Definition: adj_midchain.c:566
fib_forw_chain_type_to_dpo_proto
dpo_proto_t fib_forw_chain_type_to_dpo_proto(fib_forward_chain_type_t fct)
Convert from a chain type to the DPO proto it will install.
Definition: fib_types.c:516
format_vnet_rewrite
format_function_t format_vnet_rewrite
Definition: rewrite.h:270
vlib_worker_thread_barrier_sync
#define vlib_worker_thread_barrier_sync(X)
Definition: threads.h:194
index_t
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:43
adj_midchain_get_feature_arc_index_for_link_type
static u8 adj_midchain_get_feature_arc_index_for_link_type(const ip_adjacency_t *adj)
Definition: adj_midchain.c:78
fib_node_index_t
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
VNET_LINK_NSH
@ VNET_LINK_NSH
Definition: interface.h:352
IP_LOOKUP_NEXT_REWRITE
@ IP_LOOKUP_NEXT_REWRITE
This packet is to be rewritten and forwarded to the next processing node.
Definition: adj.h:73
VNET_LINK_MPLS
@ VNET_LINK_MPLS
Definition: interface.h:349
adj_nsh.h
ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH
@ ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH
Definition: adj.h:221
load_balance_get_bucket_i
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
Definition: load_balance.h:229
adj_ndr_midchain_recursive_loop_detect
int adj_ndr_midchain_recursive_loop_detect(adj_index_t ai, fib_node_index_t **entry_indicies)
descend the FIB graph looking for loops
Definition: adj_midchain.c:447
mpls_midchain_node
vlib_node_registration_t mpls_midchain_node
(constructor) VLIB_REGISTER_NODE (mpls_midchain_node)
Definition: mpls_output.c:355
IP_LOOKUP_NEXT_PUNT
@ IP_LOOKUP_NEXT_PUNT
Adjacency to punt this packet.
Definition: adj.h:55
dpo_stack_from_node
void dpo_stack_from_node(u32 child_node_index, 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:550
midchain_ip4_nodes
const static char *const midchain_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to a midchain object.
Definition: adj_midchain.c:530
dpo_vft_t_::dv_lock
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:428
midchain_ip6_nodes
const static char *const midchain_ip6_nodes[]
Definition: adj_midchain.c:535
adj_l2_midchain_node
vlib_node_registration_t adj_l2_midchain_node
(constructor) VLIB_REGISTER_NODE (adj_l2_midchain_node)
Definition: adj_l2.c:197
IP_LOOKUP_NEXT_BCAST
@ IP_LOOKUP_NEXT_BCAST
Broadcast Adjacency.
Definition: adj.h:85
CLIB_MEMORY_BARRIER
#define CLIB_MEMORY_BARRIER()
Definition: clib.h:137
ip_adjacency_t_
IP unicast adjacency.
Definition: adj.h:235
ip6_inlines.h
adj_midchain_teardown
void adj_midchain_teardown(ip_adjacency_t *adj)
adj_midchain_setup
Definition: adj_midchain.c:132
format_dpo_id
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
Definition: dpo.c:150
adj_midchain_tx_no_count_node
vlib_node_registration_t adj_midchain_tx_no_count_node
(constructor) VLIB_REGISTER_NODE (adj_midchain_tx_no_count_node)
Definition: adj_midchain_node.c:234
VNET_REWRITE_FIXUP_IP4_O_4
@ VNET_REWRITE_FIXUP_IP4_O_4
this adj performs IP4 over IP4 fixup
Definition: rewrite.h:62
IP_LOOKUP_NEXT_ICMP_ERROR
@ IP_LOOKUP_NEXT_ICMP_ERROR
This packets needs to go to ICMP error.
Definition: adj.h:79
ip6_main
ip6_main_t ip6_main
Definition: ip6_forward.c:2787
data
u8 data[128]
Definition: ipsec_types.api:92
adj_nbr_midchain_get_tx_node
static u32 adj_nbr_midchain_get_tx_node(ip_adjacency_t *adj)
Definition: adj_midchain.c:119
arc
u8 arc
Definition: interface_output.c:406
midchain_nodes
const static char *const *const midchain_nodes[DPO_PROTO_NUM]
Definition: adj_midchain.c:556
DPO_LOAD_BALANCE
@ DPO_LOAD_BALANCE
load-balancing over a choice of [un]equal cost paths
Definition: dpo.h:104
adj_nbr_midchain_stack
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *next)
adj_nbr_midchain_stack
Definition: adj_midchain.c:429
fib_entry_recursive_loop_detect
int fib_entry_recursive_loop_detect(fib_node_index_t entry_index, fib_node_index_t **entry_indicies)
Definition: fib_entry.c:1423
adj_dpo_unlock
static void adj_dpo_unlock(dpo_id_t *dpo)
Definition: adj_midchain.c:510
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
ip_adjacency_t_::sub_type
union ip_adjacency_t_::@144 sub_type
index
u32 index
Definition: flow_types.api:221
vlib_get_node_by_name
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
Definition: node.c:45
dpo_copy
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:264
adj_nbr_midchain_update_rewrite
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
Definition: adj_midchain.c:213
vnet_feature_modify_end_node
u32 vnet_feature_modify_end_node(u8 arc_index, u32 sw_if_index, u32 end_node_index)
Definition: feature.c:380
ethernet_main
ethernet_main_t ethernet_main
Definition: init.c:45
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
format_ip46_address
format_function_t format_ip46_address
Definition: ip46_address.h:50
DPO_PROTO_IP6
@ DPO_PROTO_IP6
Definition: dpo.h:65
DPO_PROTO_MPLS
@ DPO_PROTO_MPLS
Definition: dpo.h:66
ip_adjacency_t_::ia_node_index
u32 ia_node_index
The VLIB node in which this adj is used to forward packets.
Definition: adj.h:330
u32
unsigned int u32
Definition: types.h:88
adj_internal.h
adj_dpo_lock
static void adj_dpo_lock(dpo_id_t *dpo)
Definition: adj_midchain.c:505
format_adj_midchain
u8 * format_adj_midchain(u8 *s, va_list *ap)
Format a midchain adjacency.
Definition: adj_midchain.c:474
ip_adjacency_t_::ia_cfg_index
u32 ia_cfg_index
feature [arc] config index
Definition: adj.h:247
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
load_balance_get
static load_balance_t * load_balance_get(index_t lbi)
Definition: load_balance.h:220
ip6_main_t::lookup_main
ip_lookup_main_t lookup_main
Definition: ip6.h:112
adj_nsh_midchain_node
vlib_node_registration_t adj_nsh_midchain_node
(constructor) VLIB_REGISTER_NODE (adj_nsh_midchain_node)
Definition: adj_nsh.c:180
ip4_compute_flow_hash
static u32 ip4_compute_flow_hash(const ip4_header_t *ip, flow_hash_config_t flow_hash_config)
Definition: ip4_inlines.h:51
ip6_header_t
Definition: ip6_packet.h:294
adj_nbr.h
adj_nbr_midchain_unstack
void adj_nbr_midchain_unstack(adj_index_t adj_index)
adj_nbr_midchain_unstack
Definition: adj_midchain.c:303
adj_index_t
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
vlib_main_t
Definition: main.h:102
drop_dpo_get
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
vnet_link_t
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
midchain_mpls_nodes
const static char *const midchain_mpls_nodes[]
Definition: adj_midchain.c:540
adj_lock
void adj_lock(adj_index_t adj_index)
Take a reference counting lock on the adjacency.
Definition: adj.c:341
IP_LOOKUP_N_NEXT
@ IP_LOOKUP_N_NEXT
Definition: adj.h:91
dpo_vft_t_
A virtual function table regisitered for a DPO type.
Definition: dpo.h:423
vlib_get_main
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
u8
unsigned char u8
Definition: types.h:56
VNET_LINK_IP6
@ VNET_LINK_IP6
Definition: interface.h:348
ip6_midchain_node
vlib_node_registration_t ip6_midchain_node
(constructor) VLIB_REGISTER_NODE (ip6_midchain_node)
Definition: ip6_forward.c:2199
IP_LOOKUP_NEXT_MCAST
@ IP_LOOKUP_NEXT_MCAST
Multicast Adjacency.
Definition: adj.h:82
DPO_PROTO_IP4
@ DPO_PROTO_IP4
Definition: dpo.h:64
ip_adjacency_t_::nbr
struct ip_adjacency_t_::@144::@145 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
adj_is_midchain
u8 adj_is_midchain(adj_index_t ai)
Definition: adj_midchain.c:29
dpo_id_t_
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:172
load_balance_t_::lb_n_buckets_minus_1
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
Definition: load_balance.h:121
DPO_PROTO_NSH
@ DPO_PROTO_NSH
Definition: dpo.h:69
adj_midchain_setup
void adj_midchain_setup(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *data, adj_flags_t flags)
adj_midchain_setup
Definition: adj_midchain.c:153
load_balance_t_
The FIB DPO provieds;.
Definition: load_balance.h:106
DPO_PROTO_ETHERNET
@ DPO_PROTO_ETHERNET
Definition: dpo.h:67
FIB_FORW_CHAIN_TYPE_UNICAST_IP6
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP6
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:112
rewrite
rewrite
Definition: pnat.api:158
adj_nbr_midchain_reset_next_node
void adj_nbr_midchain_reset_next_node(adj_index_t adj_index)
Return the adjacency's next node to its default value.
Definition: adj_midchain.c:272
dpo_reset
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:234
ADJ_FLAG_MIDCHAIN_IP_STACK
@ ADJ_FLAG_MIDCHAIN_IP_STACK
Definition: adj.h:218
adj_get
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Definition: adj.h:470
DPO_PROTO_NUM
#define DPO_PROTO_NUM
Definition: dpo.h:72
ip_lookup_main_t::output_feature_arc_index
u8 output_feature_arc_index
Definition: lookup.h:145
format_white_space
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
mpls_main_t::output_feature_arc_index
u8 output_feature_arc_index
Definition: mpls.h:57
dpo_register
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
Definition: dpo.c:329
ip_adjacency_t_::midchain
struct ip_adjacency_t_::@144::@146 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105