FD.io VPP  v16.09
Vector Packet Processing
decap.c
Go to the documentation of this file.
1 /*
2  * decap.c: vxlan tunnel decap packet processing
3  *
4  * Copyright (c) 2013 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include <vlib/vlib.h>
19 #include <vnet/pg/pg.h>
20 #include <vnet/vxlan/vxlan.h>
21 
24 
25 typedef struct {
31 
32 static u8 * format_vxlan_rx_trace (u8 * s, va_list * args)
33 {
34  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
35  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
36  vxlan_rx_trace_t * t = va_arg (*args, vxlan_rx_trace_t *);
37 
38  if (t->tunnel_index != ~0)
39  {
40  s = format (s, "VXLAN: tunnel %d vni %d next %d error %d",
41  t->tunnel_index, t->vni, t->next_index, t->error);
42  }
43  else
44  {
45  s = format (s, "VXLAN: no tunnel for vni %d next %d error %d",
46  t->vni, t->next_index, t->error);
47  }
48  return s;
49 }
50 
53  vlib_node_runtime_t * node,
54  vlib_frame_t * from_frame,
55  char is_ip4)
56 {
57  u32 n_left_from, next_index, * from, * to_next;
58  vxlan_main_t * vxm = &vxlan_main;
59  vnet_main_t * vnm = vxm->vnet_main;
61  u32 last_tunnel_index = ~0;
62  vxlan4_tunnel_key_t last_key4;
63  vxlan6_tunnel_key_t last_key6;
64  u32 pkts_decapsulated = 0;
65  u32 cpu_index = os_get_cpu_number();
66  u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
67 
68  if (is_ip4)
69  last_key4.as_u64 = ~0;
70  else
71  memset (&last_key6, 0xff, sizeof (last_key6));
72 
73  from = vlib_frame_vector_args (from_frame);
74  n_left_from = from_frame->n_vectors;
75 
76  next_index = node->cached_next_index;
77  stats_sw_if_index = node->runtime_data[0];
78  stats_n_packets = stats_n_bytes = 0;
79 
80  while (n_left_from > 0)
81  {
82  u32 n_left_to_next;
83 
84  vlib_get_next_frame (vm, node, next_index,
85  to_next, n_left_to_next);
86  while (n_left_from >= 4 && n_left_to_next >= 2)
87  {
88  u32 bi0, bi1;
89  vlib_buffer_t * b0, * b1;
90  u32 next0, next1;
91  ip4_header_t * ip4_0, * ip4_1;
92  ip6_header_t * ip6_0, * ip6_1;
93  vxlan_header_t * vxlan0, * vxlan1;
94  uword * p0, * p1;
95  u32 tunnel_index0, tunnel_index1;
96  vxlan_tunnel_t * t0, * t1;
97  vxlan4_tunnel_key_t key4_0, key4_1;
98  vxlan6_tunnel_key_t key6_0, key6_1;
99  u32 error0, error1;
100  u32 sw_if_index0, sw_if_index1, len0, len1;
101 
102  /* Prefetch next iteration. */
103  {
104  vlib_buffer_t * p2, * p3;
105 
106  p2 = vlib_get_buffer (vm, from[2]);
107  p3 = vlib_get_buffer (vm, from[3]);
108 
109  vlib_prefetch_buffer_header (p2, LOAD);
110  vlib_prefetch_buffer_header (p3, LOAD);
111 
114  }
115 
116  bi0 = from[0];
117  bi1 = from[1];
118  to_next[0] = bi0;
119  to_next[1] = bi1;
120  from += 2;
121  to_next += 2;
122  n_left_to_next -= 2;
123  n_left_from -= 2;
124 
125  b0 = vlib_get_buffer (vm, bi0);
126  b1 = vlib_get_buffer (vm, bi1);
127 
128  /* udp leaves current_data pointing at the vxlan header */
129  vxlan0 = vlib_buffer_get_current (b0);
130  vxlan1 = vlib_buffer_get_current (b1);
131 
132  if (is_ip4) {
134  (b0, -(word)(sizeof(udp_header_t)+sizeof(ip4_header_t)));
136  (b1, -(word)(sizeof(udp_header_t)+sizeof(ip4_header_t)));
137  ip4_0 = vlib_buffer_get_current (b0);
138  ip4_1 = vlib_buffer_get_current (b1);
139  } else {
141  (b0, -(word)(sizeof(udp_header_t)+sizeof(ip6_header_t)));
143  (b1, -(word)(sizeof(udp_header_t)+sizeof(ip6_header_t)));
144  ip6_0 = vlib_buffer_get_current (b0);
145  ip6_1 = vlib_buffer_get_current (b1);
146  }
147 
148  /* pop (ip, udp, vxlan) */
149  if (is_ip4) {
151  (b0, sizeof(*ip4_0)+sizeof(udp_header_t)+sizeof(*vxlan0));
153  (b1, sizeof(*ip4_1)+sizeof(udp_header_t)+sizeof(*vxlan1));
154  } else {
156  (b0, sizeof(*ip6_0)+sizeof(udp_header_t)+sizeof(*vxlan0));
158  (b1, sizeof(*ip6_1)+sizeof(udp_header_t)+sizeof(*vxlan1));
159  }
160 
161  tunnel_index0 = ~0;
162  error0 = 0;
163 
164  tunnel_index1 = ~0;
165  error1 = 0;
166 
167  if (is_ip4) {
168  key4_0.src = ip4_0->src_address.as_u32;
169  key4_0.vni = vxlan0->vni_reserved;
170 
171  if (PREDICT_FALSE (key4_0.as_u64 != last_key4.as_u64))
172  {
173  p0 = hash_get (vxm->vxlan4_tunnel_by_key, key4_0.as_u64);
174 
175  if (p0 == 0)
176  {
177  error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
178  next0 = VXLAN_INPUT_NEXT_DROP;
179  goto trace0;
180  }
181 
182  last_key4.as_u64 = key4_0.as_u64;
183  tunnel_index0 = last_tunnel_index = p0[0];
184  }
185  else
186  tunnel_index0 = last_tunnel_index;
187  } else /* !is_ip4 */ {
188  key6_0.src.as_u64[0] = ip6_0->src_address.as_u64[0];
189  key6_0.src.as_u64[1] = ip6_0->src_address.as_u64[1];
190  key6_0.vni = vxlan0->vni_reserved;
191 
192  if (PREDICT_FALSE (memcmp(&key6_0, &last_key6, sizeof(last_key6)) != 0))
193  {
194  p0 = hash_get_mem (vxm->vxlan6_tunnel_by_key, &key6_0);
195 
196  if (p0 == 0)
197  {
198  error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
199  next0 = VXLAN_INPUT_NEXT_DROP;
200  goto trace0;
201  }
202 
203  clib_memcpy (&last_key6, &key6_0, sizeof(key6_0));
204  tunnel_index0 = last_tunnel_index = p0[0];
205  }
206  else
207  tunnel_index0 = last_tunnel_index;
208  }
209 
210  t0 = pool_elt_at_index (vxm->tunnels, tunnel_index0);
211 
212  next0 = t0->decap_next_index;
213  sw_if_index0 = t0->sw_if_index;
214  len0 = vlib_buffer_length_in_chain (vm, b0);
215 
216  /* Required to make the l2 tag push / pop code work on l2 subifs */
217  if (PREDICT_TRUE(next0 == VXLAN_INPUT_NEXT_L2_INPUT))
218  vnet_update_l2_len (b0);
219 
220  /* Set input sw_if_index to VXLAN tunnel for learning */
221  vnet_buffer(b0)->sw_if_index[VLIB_RX] = sw_if_index0;
222 
223  pkts_decapsulated ++;
224  stats_n_packets += 1;
225  stats_n_bytes += len0;
226 
227  /* Batch stats increment on the same vxlan tunnel so counter
228  is not incremented per packet */
229  if (PREDICT_FALSE (sw_if_index0 != stats_sw_if_index))
230  {
231  stats_n_packets -= 1;
232  stats_n_bytes -= len0;
233  if (stats_n_packets)
236  cpu_index, stats_sw_if_index,
237  stats_n_packets, stats_n_bytes);
238  stats_n_packets = 1;
239  stats_n_bytes = len0;
240  stats_sw_if_index = sw_if_index0;
241  }
242 
243  trace0:
244  b0->error = error0 ? node->errors[error0] : 0;
245 
247  {
248  vxlan_rx_trace_t *tr
249  = vlib_add_trace (vm, node, b0, sizeof (*tr));
250  tr->next_index = next0;
251  tr->error = error0;
252  tr->tunnel_index = tunnel_index0;
253  tr->vni = vnet_get_vni (vxlan0);
254  }
255 
256 
257  if (is_ip4) {
258  key4_1.src = ip4_1->src_address.as_u32;
259  key4_1.vni = vxlan1->vni_reserved;
260 
261  if (PREDICT_FALSE (key4_1.as_u64 != last_key4.as_u64))
262  {
263  p1 = hash_get (vxm->vxlan4_tunnel_by_key, key4_1.as_u64);
264 
265  if (p1 == 0)
266  {
267  error1 = VXLAN_ERROR_NO_SUCH_TUNNEL;
268  next1 = VXLAN_INPUT_NEXT_DROP;
269  goto trace1;
270  }
271 
272  last_key4.as_u64 = key4_1.as_u64;
273  tunnel_index1 = last_tunnel_index = p1[0];
274  }
275  else
276  tunnel_index1 = last_tunnel_index;
277  } else /* !is_ip4 */ {
278  key6_1.src.as_u64[0] = ip6_1->src_address.as_u64[0];
279  key6_1.src.as_u64[1] = ip6_1->src_address.as_u64[1];
280  key6_1.vni = vxlan1->vni_reserved;
281 
282  if (PREDICT_FALSE (memcmp(&key6_1, &last_key6, sizeof(last_key6)) != 0))
283  {
284  p1 = hash_get_mem (vxm->vxlan6_tunnel_by_key, &key6_1);
285 
286  if (p1 == 0)
287  {
288  error1 = VXLAN_ERROR_NO_SUCH_TUNNEL;
289  next1 = VXLAN_INPUT_NEXT_DROP;
290  goto trace1;
291  }
292 
293  clib_memcpy (&last_key6, &key6_1, sizeof(key6_1));
294  tunnel_index1 = last_tunnel_index = p1[0];
295  }
296  else
297  tunnel_index1 = last_tunnel_index;
298  }
299 
300  t1 = pool_elt_at_index (vxm->tunnels, tunnel_index1);
301 
302  next1 = t1->decap_next_index;
303  sw_if_index1 = t1->sw_if_index;
304  len1 = vlib_buffer_length_in_chain (vm, b1);
305 
306  /* Required to make the l2 tag push / pop code work on l2 subifs */
307  if (PREDICT_TRUE(next1 == VXLAN_INPUT_NEXT_L2_INPUT))
308  vnet_update_l2_len (b1);
309 
310  /* Set input sw_if_index to VXLAN tunnel for learning */
311  vnet_buffer(b1)->sw_if_index[VLIB_RX] = sw_if_index1;
312 
313  pkts_decapsulated ++;
314  stats_n_packets += 1;
315  stats_n_bytes += len1;
316 
317  /* Batch stats increment on the same vxlan tunnel so counter
318  is not incremented per packet */
319  if (PREDICT_FALSE (sw_if_index1 != stats_sw_if_index))
320  {
321  stats_n_packets -= 1;
322  stats_n_bytes -= len1;
323  if (stats_n_packets)
326  cpu_index, stats_sw_if_index,
327  stats_n_packets, stats_n_bytes);
328  stats_n_packets = 1;
329  stats_n_bytes = len1;
330  stats_sw_if_index = sw_if_index1;
331  }
332 
333  trace1:
334  b1->error = error1 ? node->errors[error1] : 0;
335 
337  {
338  vxlan_rx_trace_t *tr
339  = vlib_add_trace (vm, node, b1, sizeof (*tr));
340  tr->next_index = next1;
341  tr->error = error1;
342  tr->tunnel_index = tunnel_index1;
343  tr->vni = vnet_get_vni (vxlan1);
344  }
345 
346  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
347  to_next, n_left_to_next,
348  bi0, bi1, next0, next1);
349  }
350 
351  while (n_left_from > 0 && n_left_to_next > 0)
352  {
353  u32 bi0;
354  vlib_buffer_t * b0;
355  u32 next0;
356  ip4_header_t * ip4_0;
357  ip6_header_t * ip6_0;
358  vxlan_header_t * vxlan0;
359  uword * p0;
360  u32 tunnel_index0;
361  vxlan_tunnel_t * t0;
362  vxlan4_tunnel_key_t key4_0;
363  vxlan6_tunnel_key_t key6_0;
364  u32 error0;
365  u32 sw_if_index0, len0;
366 
367  bi0 = from[0];
368  to_next[0] = bi0;
369  from += 1;
370  to_next += 1;
371  n_left_from -= 1;
372  n_left_to_next -= 1;
373 
374  b0 = vlib_get_buffer (vm, bi0);
375 
376  /* udp leaves current_data pointing at the vxlan header */
377  vxlan0 = vlib_buffer_get_current (b0);
378 
379  if (is_ip4) {
381  (b0, -(word)(sizeof(udp_header_t)+sizeof(ip4_header_t)));
382  ip4_0 = vlib_buffer_get_current (b0);
383  } else {
385  (b0, -(word)(sizeof(udp_header_t)+sizeof(ip6_header_t)));
386  ip6_0 = vlib_buffer_get_current (b0);
387  }
388 
389  /* pop (ip, udp, vxlan) */
390  if (is_ip4) {
392  (b0, sizeof(*ip4_0)+sizeof(udp_header_t)+sizeof(*vxlan0));
393  } else {
395  (b0, sizeof(*ip6_0)+sizeof(udp_header_t)+sizeof(*vxlan0));
396  }
397 
398  tunnel_index0 = ~0;
399  error0 = 0;
400 
401  if (is_ip4) {
402  key4_0.src = ip4_0->src_address.as_u32;
403  key4_0.vni = vxlan0->vni_reserved;
404 
405  if (PREDICT_FALSE (key4_0.as_u64 != last_key4.as_u64))
406  {
407  p0 = hash_get (vxm->vxlan4_tunnel_by_key, key4_0.as_u64);
408 
409  if (p0 == 0)
410  {
411  error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
412  next0 = VXLAN_INPUT_NEXT_DROP;
413  goto trace00;
414  }
415 
416  last_key4.as_u64 = key4_0.as_u64;
417  tunnel_index0 = last_tunnel_index = p0[0];
418  }
419  else
420  tunnel_index0 = last_tunnel_index;
421  } else /* !is_ip4 */ {
422  key6_0.src.as_u64[0] = ip6_0->src_address.as_u64[0];
423  key6_0.src.as_u64[1] = ip6_0->src_address.as_u64[1];
424  key6_0.vni = vxlan0->vni_reserved;
425 
426  if (PREDICT_FALSE (memcmp(&key6_0, &last_key6, sizeof(last_key6)) != 0))
427  {
428  p0 = hash_get_mem (vxm->vxlan6_tunnel_by_key, &key6_0);
429 
430  if (p0 == 0)
431  {
432  error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
433  next0 = VXLAN_INPUT_NEXT_DROP;
434  goto trace00;
435  }
436 
437  clib_memcpy (&last_key6, &key6_0, sizeof(key6_0));
438  tunnel_index0 = last_tunnel_index = p0[0];
439  }
440  else
441  tunnel_index0 = last_tunnel_index;
442  }
443 
444  t0 = pool_elt_at_index (vxm->tunnels, tunnel_index0);
445 
446  next0 = t0->decap_next_index;
447  sw_if_index0 = t0->sw_if_index;
448  len0 = vlib_buffer_length_in_chain (vm, b0);
449 
450  /* Required to make the l2 tag push / pop code work on l2 subifs */
451  if (PREDICT_TRUE(next0 == VXLAN_INPUT_NEXT_L2_INPUT))
452  vnet_update_l2_len (b0);
453 
454  /* Set input sw_if_index to VXLAN tunnel for learning */
455  vnet_buffer(b0)->sw_if_index[VLIB_RX] = sw_if_index0;
456 
457  pkts_decapsulated ++;
458  stats_n_packets += 1;
459  stats_n_bytes += len0;
460 
461  /* Batch stats increment on the same vxlan tunnel so counter
462  is not incremented per packet */
463  if (PREDICT_FALSE (sw_if_index0 != stats_sw_if_index))
464  {
465  stats_n_packets -= 1;
466  stats_n_bytes -= len0;
467  if (stats_n_packets)
470  cpu_index, stats_sw_if_index,
471  stats_n_packets, stats_n_bytes);
472  stats_n_packets = 1;
473  stats_n_bytes = len0;
474  stats_sw_if_index = sw_if_index0;
475  }
476 
477  trace00:
478  b0->error = error0 ? node->errors[error0] : 0;
479 
481  {
482  vxlan_rx_trace_t *tr
483  = vlib_add_trace (vm, node, b0, sizeof (*tr));
484  tr->next_index = next0;
485  tr->error = error0;
486  tr->tunnel_index = tunnel_index0;
487  tr->vni = vnet_get_vni (vxlan0);
488  }
489  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
490  to_next, n_left_to_next,
491  bi0, next0);
492  }
493 
494  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
495  }
496  /* Do we still need this now that tunnel tx stats is kept? */
497  vlib_node_increment_counter (vm, is_ip4?
499  VXLAN_ERROR_DECAPSULATED,
500  pkts_decapsulated);
501 
502  /* Increment any remaining batch stats */
503  if (stats_n_packets)
504  {
507  cpu_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
508  node->runtime_data[0] = stats_sw_if_index;
509  }
510 
511  return from_frame->n_vectors;
512 }
513 
514 static uword
516  vlib_node_runtime_t * node,
517  vlib_frame_t * from_frame)
518 {
519  return vxlan_input(vm, node, from_frame, /* is_ip4 */ 1);
520 }
521 
522 static uword
524  vlib_node_runtime_t * node,
525  vlib_frame_t * from_frame)
526 {
527  return vxlan_input(vm, node, from_frame, /* is_ip4 */ 0);
528 }
529 
530 static char * vxlan_error_strings[] = {
531 #define vxlan_error(n,s) s,
533 #undef vxlan_error
534 #undef _
535 };
536 
538  .function = vxlan4_input,
539  .name = "vxlan4-input",
540  /* Takes a vector of packets. */
541  .vector_size = sizeof (u32),
542 
543  .n_errors = VXLAN_N_ERROR,
544  .error_strings = vxlan_error_strings,
545 
546  .n_next_nodes = VXLAN_INPUT_N_NEXT,
547  .next_nodes = {
548 #define _(s,n) [VXLAN_INPUT_NEXT_##s] = n,
550 #undef _
551  },
552 
553 //temp .format_buffer = format_vxlan_header,
554  .format_trace = format_vxlan_rx_trace,
555  // $$$$ .unformat_buffer = unformat_vxlan_header,
556 };
557 
559 
561  .function = vxlan6_input,
562  .name = "vxlan6-input",
563  /* Takes a vector of packets. */
564  .vector_size = sizeof (u32),
565 
566  .n_errors = VXLAN_N_ERROR,
567  .error_strings = vxlan_error_strings,
568 
569  .n_next_nodes = VXLAN_INPUT_N_NEXT,
570  .next_nodes = {
571 #define _(s,n) [VXLAN_INPUT_NEXT_##s] = n,
573 #undef _
574  },
575 
576 //temp .format_buffer = format_vxlan_header,
577  .format_trace = format_vxlan_rx_trace,
578  // $$$$ .unformat_buffer = unformat_vxlan_header,
579 };
580 
582 
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:457
#define CLIB_UNUSED(x)
Definition: clib.h:79
ip4_address_t src_address
Definition: ip4_packet.h:138
vnet_interface_main_t interface_main
Definition: vnet.h:64
vlib_node_registration_t vxlan4_input_node
(constructor) VLIB_REGISTER_NODE (vxlan4_input_node)
Definition: decap.c:22
#define foreach_vxlan_input_next
Definition: vxlan.h:99
#define PREDICT_TRUE(x)
Definition: clib.h:98
u64 as_u64[2]
Definition: ip6_packet.h:50
struct _vlib_node_registration vlib_node_registration_t
vlib_error_t * errors
Definition: node.h:418
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
Definition: buffer_funcs.h:112
ip6_address_t src_address
Definition: ip6_packet.h:298
vnet_main_t * vnet_main
Definition: vxlan.h:135
u32 tunnel_index
Definition: decap.c:27
#define always_inline
Definition: clib.h:84
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:187
vlib_combined_counter_main_t * combined_sw_if_counters
Definition: interface.h:501
#define hash_get(h, key)
Definition: hash.h:248
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:369
uword * vxlan4_tunnel_by_key
Definition: vxlan.h:124
uword os_get_cpu_number(void)
Definition: unix-misc.c:224
vxlan_main_t vxlan_main
Definition: vxlan.c:35
#define PREDICT_FALSE(x)
Definition: clib.h:97
vlib_node_registration_t vxlan6_input_node
(constructor) VLIB_REGISTER_NODE (vxlan6_input_node)
Definition: decap.c:23
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
Definition: buffer_node.h:70
#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:130
#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:348
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:118
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1111
static u32 vnet_get_vni(vxlan_header_t *h)
Definition: vxlan_packet.h:52
static uword vxlan4_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: decap.c:515
u16 n_vectors
Definition: node.h:344
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:82
static char * vxlan_error_strings[]
Definition: decap.c:530
#define clib_memcpy(a, b, c)
Definition: string.h:63
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:200
u32 decap_next_index
Definition: vxlan.h:78
u16 cached_next_index
Definition: node.h:462
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
Increment a combined counter.
Definition: counter.h:241
static uword vxlan_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, char is_ip4)
Definition: decap.c:52
unsigned int u32
Definition: types.h:88
#define vnet_buffer(b)
Definition: buffer.h:335
u8 * format(u8 *s, char *fmt,...)
Definition: format.c:418
uword * vxlan6_tunnel_by_key
Definition: vxlan.h:125
u32 sw_if_index
Definition: vxlan.h:85
#define VLIB_BUFFER_IS_TRACED
Definition: buffer.h:93
u64 uword
Definition: types.h:112
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
i64 word
Definition: types.h:111
unsigned char u8
Definition: types.h:56
static void vnet_update_l2_len(vlib_buffer_t *b)
Definition: l2_input.h:230
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:251
#define hash_get_mem(h, key)
Definition: hash.h:268
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:163
VLIB_NODE_FUNCTION_MULTIARCH(l2t_decap_node, l2t_decap_node_fn)
static u8 * format_vxlan_rx_trace(u8 *s, va_list *args)
Definition: decap.c:32
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:143
u8 data[0]
Packet data.
Definition: buffer.h:151
u32 next_index
Definition: decap.c:26
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:67
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:85
uword runtime_data[(128-1 *sizeof(vlib_node_function_t *)-1 *sizeof(vlib_error_t *)-11 *sizeof(u32)-5 *sizeof(u16))/sizeof(uword)]
Definition: node.h:472
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:69
vxlan_tunnel_t * tunnels
Definition: vxlan.h:121
static uword vxlan6_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: decap.c:523
Definition: defs.h:46