FD.io VPP  v21.06-1-gbb7418cf9
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  }
179  if (!(flags & ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH))
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 
318  if (FIB_NODE_INDEX_INVALID != tmp)
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  {
360  fib_entry_contribute_forwarding (fei, fct, &tmp);
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  }
420  adj_nbr_midchain_stack (ai, &tmp);
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 
515 const static dpo_vft_t adj_midchain_dpo_vft = {
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 {
568  dpo_register(DPO_ADJACENCY_MIDCHAIN, &adj_midchain_dpo_vft, midchain_nodes);
569 }
static const char *const midchain_nsh_nodes[]
Definition: adj_midchain.c:550
static const char *const midchain_ip6_nodes[]
Definition: adj_midchain.c:535
u16 lb_n_buckets
number of buckets in the load-balance.
Definition: load_balance.h:116
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
dpo_lock_fn_t dv_lock
A reference counting lock function.
Definition: dpo.h:428
adj_flags_t ia_flags
Flags on the adjacency 1-bytes.
Definition: adj.h:356
Contribute an object that is to be used to forward IP6 packets.
Definition: fib_types.h:112
vlib_node_registration_t ip6_midchain_node
(constructor) VLIB_REGISTER_NODE (ip6_midchain_node)
Definition: ip6_forward.c:2199
A virtual function table regisitered for a DPO type.
Definition: dpo.h:423
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105
void adj_lock(adj_index_t adj_index)
Take a reference counting lock on the adjacency.
Definition: adj.c:341
static const char *const midchain_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to a midchain object.
Definition: adj_midchain.c:530
const u8 * adj_get_rewrite(adj_index_t ai)
Return the rewrite string of the adjacency.
Definition: adj.c:566
static u32 ip4_compute_flow_hash(const ip4_header_t *ip, flow_hash_config_t flow_hash_config)
Definition: ip4_inlines.h:51
u16 adj_dpo_get_mtu(const dpo_id_t *dpo)
Definition: adj.c:331
Multicast Adjacency.
Definition: adj.h:82
Broadcast Adjacency.
Definition: adj.h:85
IP unicast adjacency.
Definition: adj.h:235
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
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
Definition: load_balance.h:161
vlib_node_registration_t ip4_midchain_node
(constructor) VLIB_REGISTER_NODE (ip4_midchain_node)
Definition: ip4_forward.c:2657
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
This packet is to be rewritten and forwarded to the next processing node.
Definition: adj.h:73
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definition: dpo.c:264
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
Contribute an object that is to be used to forward IP4 packets.
Definition: fib_types.h:108
ip_lookup_main_t lookup_main
Definition: ip4.h:109
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
vlib_node_registration_t adj_midchain_tx_node
(constructor) VLIB_REGISTER_NODE (adj_midchain_tx_node)
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
u32 adj_dpo_get_urpf(const dpo_id_t *dpo)
Definition: adj.c:321
this adj performs the flow hash fixup
Definition: rewrite.h:67
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
Definition: node_funcs.h:1177
unsigned char u8
Definition: types.h:56
u8 data[128]
Definition: ipsec_types.api:92
#define vlib_worker_thread_barrier_sync(X)
Definition: threads.h:194
vnet_link_t ia_link
link/ether-type 1 bytes
Definition: adj.h:343
unsigned int u32
Definition: types.h:88
Adjacency to punt this packet.
Definition: adj.h:55
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
Definition: drop_dpo.c:25
u8 output_feature_arc_index
Definition: lookup.h:145
ethernet_main_t ethernet_main
Definition: init.c:45
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
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
this adj performs IP4 over IP4 fixup
Definition: rewrite.h:62
dpo_proto_t vnet_link_to_dpo_proto(vnet_link_t linkt)
Definition: dpo.c:98
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
Definition: load_balance.h:121
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
description fragment has unexpected format
Definition: map.api:433
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
static const char *const *const midchain_nodes[DPO_PROTO_NUM]
Definition: adj_midchain.c:556
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
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
Definition: adj.c:358
vlib_node_registration_t mpls_midchain_node
(constructor) VLIB_REGISTER_NODE (mpls_midchain_node)
Definition: mpls_output.c:355
format_function_t format_vnet_rewrite
Definition: rewrite.h:270
u8 output_feature_arc_index
Definition: mpls.h:57
u8 arc
union ip_adjacency_t_::@144 sub_type
vlib_node_registration_t adj_l2_midchain_node
(constructor) VLIB_REGISTER_NODE (adj_l2_midchain_node)
Definition: adj_l2.c:197
static const char *const midchain_mpls_nodes[]
Definition: adj_midchain.c:540
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
u16 * next
#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
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
Definition: node.c:45
static u32 adj_get_midchain_node(vnet_link_t link)
Definition: adj_midchain.c:57
dpo_type_t dpoi_type
the type
Definition: dpo.h:178
vlib_node_registration_t adj_midchain_tx_no_count_node
(constructor) VLIB_REGISTER_NODE (adj_midchain_tx_no_count_node)
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
Definition: load_balance.h:229
nsh_main_placeholder_t nsh_main_placeholder
Definition: adj_nsh.c:21
void adj_midchain_module_init(void)
Module initialisation.
Definition: adj_midchain.c:566
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
load-balancing over a choice of [un]equal cost paths
Definition: dpo.h:104
struct ip_adjacency_t_::@144::@146 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
u32 * tmp
The FIB DPO provieds;.
Definition: load_balance.h:106
u32 ia_node_index
The VLIB node in which this adj is used to forward packets.
Definition: adj.h:330
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
Definition: adj.h:68
ip6_main_t ip6_main
Definition: ip6_forward.c:2787
u32 vnet_feature_modify_end_node(u8 arc_index, u32 sw_if_index, u32 end_node_index)
Definition: feature.c:380
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
static u8 adj_midchain_get_feature_arc_index_for_link_type(const ip_adjacency_t *adj)
Definition: adj_midchain.c:78
format_function_t format_ip46_address
Definition: ip46_address.h:50
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
Definition: adj.h:63
Adjacency to drop this packet.
Definition: adj.h:53
mpls_main_t mpls_main
Definition: mpls.c:25
static void adj_dpo_unlock(dpo_id_t *dpo)
Definition: adj_midchain.c:510
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:395
u32 index
Definition: flow_types.api:221
Multicast Midchain Adjacency.
Definition: adj.h:89
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
int fib_entry_recursive_loop_detect(fib_node_index_t entry_index, fib_node_index_t **entry_indicies)
Definition: fib_entry.c:1423
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
void adj_midchain_teardown(ip_adjacency_t *adj)
adj_midchain_setup
Definition: adj_midchain.c:132
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
u8 * format_adj_midchain(u8 *s, va_list *ap)
Format a midchain adjacency.
Definition: adj_midchain.c:474
This packets follow a mid-chain adjacency.
Definition: adj.h:76
static u32 adj_nbr_midchain_get_tx_node(ip_adjacency_t *adj)
Definition: adj_midchain.c:119
#define ASSERT(truth)
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *next)
adj_nbr_midchain_stack
Definition: adj_midchain.c:429
ip_lookup_main_t lookup_main
Definition: ip6.h:112
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
static load_balance_t * load_balance_get(index_t lbi)
Definition: load_balance.h:220
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
u32 ia_cfg_index
feature [arc] config index
Definition: adj.h:247
void adj_nbr_midchain_unstack(adj_index_t adj_index)
adj_nbr_midchain_unstack
Definition: adj_midchain.c:303
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
Definition: dpo.c:150
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:38
u32 entries
static void adj_dpo_lock(dpo_id_t *dpo)
Definition: adj_midchain.c:505
enum adj_flags_t_ adj_flags_t
Flags on an IP adjacency.
static u32 ip6_compute_flow_hash(const ip6_header_t *ip, flow_hash_config_t flow_hash_config)
Definition: ip6_inlines.h:49
This packets needs to go to ICMP error.
Definition: adj.h:79
This packet is for one of our own IP addresses.
Definition: adj.h:58
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
Definition: adj.h:350
#define DPO_PROTO_NUM
Definition: dpo.h:72
u8 adj_is_midchain(adj_index_t ai)
Definition: adj_midchain.c:29
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:190
#define FIB_NODE_INDEX_INVALID
Definition: fib_types.h:30
vlib_node_registration_t adj_nsh_midchain_node
(constructor) VLIB_REGISTER_NODE (adj_nsh_midchain_node)
Definition: adj_nsh.c:180
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
Definition: adj.h:337
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
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
Definition: dpo.h:204
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
Definition: threads.c:1386
void adj_nbr_midchain_reset_next_node(adj_index_t adj_index)
Return the adjacency&#39;s next node to its default value.
Definition: adj_midchain.c:272
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1105
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
Definition: dpo.c:234
#define vec_foreach(var, vec)
Vector iterator.
#define CLIB_MEMORY_BARRIER()
Definition: clib.h:137
u8 * format_vnet_link(u8 *s, va_list *ap)
Definition: fib_types.c:41
This adjacency/interface has output features configured.
Definition: rewrite.h:57
static const char *const midchain_ethernet_nodes[]
Definition: adj_midchain.c:545
struct ip_adjacency_t_::@144::@145 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
u8 output_feature_arc_index
Definition: ethernet.h:328
#define u8
Padding.
Definition: clib.h:121
static ip46_type_t adj_proto_to_46(fib_protocol_t proto)
Definition: adj_internal.h:90
rewrite
Definition: pnat.api:158
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