FD.io VPP  v16.06
Vector Packet Processing
node.c
Go to the documentation of this file.
1 /*
2  * node.c: gre packet processing
3  *
4  * Copyright (c) 2012 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/gre/gre.h>
21 #include <vppinfra/sparse_vec.h>
22 
23 #define foreach_gre_input_next \
24 _(PUNT, "error-punt") \
25 _(DROP, "error-drop") \
26 _(IP4_INPUT, "ip4-input") \
27 _(IP6_INPUT, "ip6-input")
28 
29 typedef enum {
30 #define _(s,n) GRE_INPUT_NEXT_##s,
32 #undef _
35 
36 typedef struct {
42 
43 u8 * format_gre_rx_trace (u8 * s, va_list * args)
44 {
45  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
46  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
47  gre_rx_trace_t * t = va_arg (*args, gre_rx_trace_t *);
48 
49  s = format (s, "GRE: tunnel %d len %d src %U dst %U",
50  t->tunnel_id, clib_net_to_host_u16(t->length),
53  return s;
54 }
55 
56 typedef struct {
57  /* Sparse vector mapping gre protocol in network byte order
58  to next index. */
60 
63 
64 static uword
66  vlib_node_runtime_t * node,
67  vlib_frame_t * from_frame)
68 {
69  gre_main_t * gm = &gre_main;
70  gre_input_runtime_t * rt = (void *) node->runtime_data;
71  __attribute__((unused)) u32 n_left_from, next_index, i_next, * from, * to_next;
72  u64 cached_tunnel_key = (u64) ~0;
73  u32 cached_tunnel_sw_if_index = 0, tunnel_sw_if_index;
74  u32 cached_tunnel_fib_index = 0, tunnel_fib_index;
75 
76  u32 cpu_index = os_get_cpu_number();
77 
78  from = vlib_frame_vector_args (from_frame);
79  n_left_from = from_frame->n_vectors;
80 
81  next_index = node->cached_next_index;
82  i_next = vec_elt (rt->sparse_index_by_next_index, next_index);
83 
84  while (n_left_from > 0)
85  {
86  u32 n_left_to_next;
87 
88  vlib_get_next_frame (vm, node, next_index,
89  to_next, n_left_to_next);
90 
91  while (n_left_from >= 4 && n_left_to_next >= 2)
92  {
93  u32 bi0, bi1;
94  vlib_buffer_t * b0, * b1;
95  gre_header_t * h0, * h1;
96  u16 version0, version1;
97  int verr0, verr1;
98  u32 i0, i1, next0, next1, protocol0, protocol1;
99  ip4_header_t *ip0, *ip1;
100 
101  /* Prefetch next iteration. */
102  {
103  vlib_buffer_t * p2, * p3;
104 
105  p2 = vlib_get_buffer (vm, from[2]);
106  p3 = vlib_get_buffer (vm, from[3]);
107 
108  vlib_prefetch_buffer_header (p2, LOAD);
109  vlib_prefetch_buffer_header (p3, LOAD);
110 
111  CLIB_PREFETCH (p2->data, sizeof (h0[0]), LOAD);
112  CLIB_PREFETCH (p3->data, sizeof (h1[0]), LOAD);
113  }
114 
115  bi0 = from[0];
116  bi1 = from[1];
117  to_next[0] = bi0;
118  to_next[1] = bi1;
119  from += 2;
120  to_next += 2;
121  n_left_to_next -= 2;
122  n_left_from -= 2;
123 
124  b0 = vlib_get_buffer (vm, bi0);
125  b1 = vlib_get_buffer (vm, bi1);
126 
127  /* ip4_local hands us the ip header, not the gre header */
128  ip0 = vlib_buffer_get_current (b0);
129  ip1 = vlib_buffer_get_current (b1);
130 
131  /* Save src + dst ip4 address, e.g. for mpls-o-gre */
132  vnet_buffer(b0)->gre.src = ip0->src_address.as_u32;
133  vnet_buffer(b0)->gre.dst = ip0->dst_address.as_u32;
134  vnet_buffer(b1)->gre.src = ip1->src_address.as_u32;
135  vnet_buffer(b1)->gre.dst = ip1->dst_address.as_u32;
136 
137  vlib_buffer_advance (b0, sizeof (*ip0));
138  vlib_buffer_advance (b1, sizeof (*ip1));
139 
140  h0 = vlib_buffer_get_current (b0);
141  h1 = vlib_buffer_get_current (b1);
142 
143  /* Index sparse array with network byte order. */
144  protocol0 = h0->protocol;
145  protocol1 = h1->protocol;
146  sparse_vec_index2 (rt->next_by_protocol, protocol0, protocol1,
147  &i0, &i1);
148  next0 = vec_elt(rt->next_by_protocol, i0);
149  next1 = vec_elt(rt->next_by_protocol, i1);
150 
151  b0->error = node->errors[next0 == SPARSE_VEC_INVALID_INDEX ? GRE_ERROR_UNKNOWN_PROTOCOL : GRE_ERROR_NONE];
152  b1->error = node->errors[next1 == SPARSE_VEC_INVALID_INDEX ? GRE_ERROR_UNKNOWN_PROTOCOL : GRE_ERROR_NONE];
153 
154  version0 = clib_net_to_host_u16 (h0->flags_and_version);
155  verr0 = version0 & GRE_VERSION_MASK;
156  version1 = clib_net_to_host_u16 (h1->flags_and_version);
157  verr1 = version1 & GRE_VERSION_MASK;
158 
159  b0->error = verr0 ? node->errors[GRE_ERROR_UNSUPPORTED_VERSION]
160  : b0->error;
161  next0 = verr0 ? GRE_INPUT_NEXT_DROP : next0;
162  b1->error = verr1 ? node->errors[GRE_ERROR_UNSUPPORTED_VERSION]
163  : b1->error;
164  next1 = verr1 ? GRE_INPUT_NEXT_DROP : next1;
165 
166  /* RPF check for ip4/ip6 input */
167  if (PREDICT_FALSE(next0 == GRE_INPUT_NEXT_IP4_INPUT
168  || next0 == GRE_INPUT_NEXT_IP6_INPUT))
169  {
170  u64 key = ((u64)(vnet_buffer(b0)->gre.dst) << 32) |
171  (u64)(vnet_buffer(b0)->gre.src);
172 
173  if (cached_tunnel_key != key)
174  {
176  gre_tunnel_t * t;
177  uword * p;
178 
179  ip4_main_t * ip4m = &ip4_main;
180  p = hash_get (gm->tunnel_by_key, key);
181  if (!p)
182  {
183  next0 = GRE_INPUT_NEXT_DROP;
184  b0->error = node->errors[GRE_ERROR_NO_SUCH_TUNNEL];
185  goto drop0;
186  }
187  t = pool_elt_at_index (gm->tunnels, p[0]);
189  t->hw_if_index);
190  tunnel_sw_if_index = hi->sw_if_index;
191  tunnel_fib_index = vec_elt (ip4m->fib_index_by_sw_if_index,
192  tunnel_sw_if_index);
193 
194  cached_tunnel_sw_if_index = tunnel_sw_if_index;
195  cached_tunnel_fib_index = tunnel_fib_index;
196  }
197  else
198  {
199  tunnel_sw_if_index = cached_tunnel_sw_if_index;
200  tunnel_fib_index = cached_tunnel_fib_index;
201  }
202 
203  u32 len = vlib_buffer_length_in_chain (vm, b0);
207  cpu_index,
208  tunnel_sw_if_index,
209  1 /* packets */,
210  len /* bytes */);
211 
212  vnet_buffer(b0)->sw_if_index[VLIB_TX] = tunnel_fib_index;
213  }
214 
215 drop0:
216  if (PREDICT_FALSE(next1 == GRE_INPUT_NEXT_IP4_INPUT
217  || next1 == GRE_INPUT_NEXT_IP6_INPUT))
218  {
219  u64 key = ((u64)(vnet_buffer(b1)->gre.dst) << 32) |
220  (u64)(vnet_buffer(b1)->gre.src);
221 
222  if (cached_tunnel_key != key)
223  {
225  gre_tunnel_t * t;
226  uword * p;
227 
228  ip4_main_t * ip4m = &ip4_main;
229  p = hash_get (gm->tunnel_by_key, key);
230  if (!p)
231  {
232  next1 = GRE_INPUT_NEXT_DROP;
233  b1->error = node->errors[GRE_ERROR_NO_SUCH_TUNNEL];
234  goto drop1;
235  }
236  t = pool_elt_at_index (gm->tunnels, p[0]);
238  t->hw_if_index);
239  tunnel_sw_if_index = hi->sw_if_index;
240  tunnel_fib_index = vec_elt (ip4m->fib_index_by_sw_if_index,
241  tunnel_sw_if_index);
242 
243  cached_tunnel_sw_if_index = tunnel_sw_if_index;
244  cached_tunnel_fib_index = tunnel_fib_index;
245  }
246  else
247  {
248  tunnel_sw_if_index = cached_tunnel_sw_if_index;
249  tunnel_fib_index = cached_tunnel_fib_index;
250  }
251 
252  u32 len = vlib_buffer_length_in_chain (vm, b1);
256  cpu_index,
257  tunnel_sw_if_index,
258  1 /* packets */,
259  len /* bytes */);
260 
261  vnet_buffer(b1)->sw_if_index[VLIB_TX] = tunnel_fib_index;
262  }
263 drop1:
265  {
266  gre_rx_trace_t *tr = vlib_add_trace (vm, node,
267  b0, sizeof (*tr));
268  tr->tunnel_id = ~0;
269  tr->length = ip0->length;
270  tr->src.as_u32 = ip0->src_address.as_u32;
271  tr->dst.as_u32 = ip0->dst_address.as_u32;
272  }
273 
275  {
276  gre_rx_trace_t *tr = vlib_add_trace (vm, node,
277  b1, sizeof (*tr));
278  tr->tunnel_id = ~0;
279  tr->length = ip1->length;
280  tr->src.as_u32 = ip1->src_address.as_u32;
281  tr->dst.as_u32 = ip1->dst_address.as_u32;
282  }
283 
284  vlib_buffer_advance (b0, sizeof (*h0));
285  vlib_buffer_advance (b1, sizeof (*h1));
286 
287  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
288  to_next, n_left_to_next,
289  bi0, bi1, next0, next1);
290  }
291 
292  while (n_left_from > 0 && n_left_to_next > 0)
293  {
294  u32 bi0;
295  vlib_buffer_t * b0;
296  gre_header_t * h0;
297  ip4_header_t * ip0;
298  u16 version0;
299  int verr0;
300  u32 i0, next0;
301 
302  bi0 = from[0];
303  to_next[0] = bi0;
304  from += 1;
305  to_next += 1;
306  n_left_from -= 1;
307  n_left_to_next -= 1;
308 
309  b0 = vlib_get_buffer (vm, bi0);
310  ip0 = vlib_buffer_get_current (b0);
311 
312  vnet_buffer(b0)->gre.src = ip0->src_address.as_u32;
313  vnet_buffer(b0)->gre.dst = ip0->dst_address.as_u32;
314 
315  vlib_buffer_advance (b0, sizeof (*ip0));
316 
317  h0 = vlib_buffer_get_current (b0);
318 
320  next0 = vec_elt(rt->next_by_protocol, i0);
321 
322  b0->error =
323  node->errors[next0 == SPARSE_VEC_INVALID_INDEX
324  ? GRE_ERROR_UNKNOWN_PROTOCOL : GRE_ERROR_NONE];
325 
326  version0 = clib_net_to_host_u16 (h0->flags_and_version);
327  verr0 = version0 & GRE_VERSION_MASK;
328  b0->error = verr0 ? node->errors[GRE_ERROR_UNSUPPORTED_VERSION]
329  : b0->error;
330  next0 = verr0 ? GRE_INPUT_NEXT_DROP : next0;
331 
332  /* For IP payload we need to find source interface
333  so we can increase counters and help forward node to
334  pick right FIB */
335  if (PREDICT_FALSE(next0 == GRE_INPUT_NEXT_IP4_INPUT
336  || next0 == GRE_INPUT_NEXT_IP6_INPUT))
337  {
338  u64 key = ((u64)(vnet_buffer(b0)->gre.dst) << 32) |
339  (u64)(vnet_buffer(b0)->gre.src);
340 
341  if (cached_tunnel_key != key)
342  {
344  gre_tunnel_t * t;
345  uword * p;
346 
347  ip4_main_t * ip4m = &ip4_main;
348  p = hash_get (gm->tunnel_by_key, key);
349  if (!p)
350  {
351  next0 = GRE_INPUT_NEXT_DROP;
352  b0->error = node->errors[GRE_ERROR_NO_SUCH_TUNNEL];
353  goto drop;
354  }
355  t = pool_elt_at_index (gm->tunnels, p[0]);
357  t->hw_if_index);
358  tunnel_sw_if_index = hi->sw_if_index;
359  tunnel_fib_index = vec_elt (ip4m->fib_index_by_sw_if_index,
360  tunnel_sw_if_index);
361 
362  cached_tunnel_sw_if_index = tunnel_sw_if_index;
363  cached_tunnel_fib_index = tunnel_fib_index;
364  }
365  else
366  {
367  tunnel_sw_if_index = cached_tunnel_sw_if_index;
368  tunnel_fib_index = cached_tunnel_fib_index;
369  }
370 
371  u32 len = vlib_buffer_length_in_chain (vm, b0);
375  cpu_index,
376  tunnel_sw_if_index,
377  1 /* packets */,
378  len /* bytes */);
379 
380  vnet_buffer(b0)->sw_if_index[VLIB_TX] = tunnel_fib_index;
381  }
382 
383 drop:
385  {
386  gre_rx_trace_t *tr = vlib_add_trace (vm, node,
387  b0, sizeof (*tr));
388  tr->tunnel_id = ~0;
389  tr->length = ip0->length;
390  tr->src.as_u32 = ip0->src_address.as_u32;
391  tr->dst.as_u32 = ip0->dst_address.as_u32;
392  }
393 
394  vlib_buffer_advance (b0, sizeof (*h0));
395 
396  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
397  to_next, n_left_to_next,
398  bi0, next0);
399  }
400 
401  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
402  }
404  GRE_ERROR_PKTS_DECAP, from_frame->n_vectors);
405  return from_frame->n_vectors;
406 }
407 
408 static char * gre_error_strings[] = {
409 #define gre_error(n,s) s,
410 #include "error.def"
411 #undef gre_error
412 };
413 
415  .function = gre_input,
416  .name = "gre-input",
417  /* Takes a vector of packets. */
418  .vector_size = sizeof (u32),
419 
420  .runtime_data_bytes = sizeof (gre_input_runtime_t),
421 
422  .n_errors = GRE_N_ERROR,
423  .error_strings = gre_error_strings,
424 
425  .n_next_nodes = GRE_INPUT_N_NEXT,
426  .next_nodes = {
427 #define _(s,n) [GRE_INPUT_NEXT_##s] = n,
429 #undef _
430  },
431 
432  .format_buffer = format_gre_header_with_length,
433  .format_trace = format_gre_rx_trace,
434  .unformat_buffer = unformat_gre_header,
435 };
436 
437 void
439  gre_protocol_t protocol,
440  u32 node_index)
441 {
442  gre_main_t * em = &gre_main;
443  gre_protocol_info_t * pi;
444  gre_input_runtime_t * rt;
445  u16 * n;
446  u32 i;
447 
448  {
450  if (error)
451  clib_error_report (error);
452  }
453 
454  pi = gre_get_protocol_info (em, protocol);
455  pi->node_index = node_index;
456  pi->next_index = vlib_node_add_next (vm,
457  gre_input_node.index,
458  node_index);
459 
460  /* Setup gre protocol -> next index sparse vector mapping. */
463  clib_host_to_net_u16 (protocol));
464  n[0] = pi->next_index;
465 
466  /* Rebuild next index -> sparse index inverse mapping when sparse vector
467  is updated. */
469  for (i = 1; i < vec_len (rt->next_by_protocol); i++)
471 }
472 
473 static void
474 gre_setup_node (vlib_main_t * vm, u32 node_index)
475 {
476  vlib_node_t * n = vlib_get_node (vm, node_index);
477  pg_node_t * pn = pg_get_node (node_index);
478 
482 }
483 
485 {
486  gre_input_runtime_t * rt;
487  vlib_node_t *ip4_input, *ip6_input, *mpls_unicast_input;
488 
489  {
490  clib_error_t * error;
491  error = vlib_call_init_function (vm, gre_init);
492  if (error)
493  clib_error_report (error);
494  }
495 
496  gre_setup_node (vm, gre_input_node.index);
497 
499 
501  (/* elt bytes */ sizeof (rt->next_by_protocol[0]),
502  /* bits in index */ BITS (((gre_header_t *) 0)->protocol));
503 
504  vec_validate (rt->sparse_index_by_next_index, GRE_INPUT_NEXT_DROP);
505  vec_validate (rt->sparse_index_by_next_index, GRE_INPUT_NEXT_PUNT);
506  rt->sparse_index_by_next_index[GRE_INPUT_NEXT_DROP]
508  rt->sparse_index_by_next_index[GRE_INPUT_NEXT_PUNT]
510 
511  /* These could be moved to the supported protocol input node defn's */
512  ip4_input = vlib_get_node_by_name (vm, (u8 *)"ip4-input");
513  ASSERT(ip4_input);
514  ip6_input = vlib_get_node_by_name (vm, (u8 *)"ip6-input");
515  ASSERT(ip6_input);
516  mpls_unicast_input = vlib_get_node_by_name (vm, (u8 *)"mpls-gre-input");
517  ASSERT(mpls_unicast_input);
518 
519  gre_register_input_protocol (vm, GRE_PROTOCOL_ip4,
520  ip4_input->index);
521 
522  gre_register_input_protocol (vm, GRE_PROTOCOL_ip6,
523  ip6_input->index);
524 
525  gre_register_input_protocol (vm, GRE_PROTOCOL_mpls_unicast,
526  mpls_unicast_input->index);
527 
528  ip4_register_protocol (IP_PROTOCOL_GRE, gre_input_node.index);
529 
530  return 0;
531 }
532 
vnet_main_t * vnet_main
Definition: gre.h:79
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:394
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Definition: main.c:459
vmrglw vmrglh hi
Definition: gre.h:60
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:267
format_function_t format_gre_header_with_length
Definition: gre.h:103
#define CLIB_UNUSED(x)
Definition: clib.h:79
u32 hw_if_index
Definition: gre.h:56
static uword ip4_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: ip4_input.c:332
ip4_address_t dst
Definition: node.c:40
always_inline pg_node_t * pg_get_node(uword node_index)
Definition: pg.h:335
ip4_address_t src_address
Definition: ip4_packet.h:138
always_inline vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Definition: node_funcs.h:46
vnet_interface_main_t interface_main
Definition: vnet.h:62
uword * tunnel_by_key
Definition: gre.h:69
u32 index
Definition: node.h:203
u32 * fib_index_by_sw_if_index
Definition: ip4.h:137
#define clib_error_report(e)
Definition: error.h:126
u16 * next_by_protocol
Definition: node.c:59
u32 tunnel_id
Definition: node.c:37
void ip4_register_protocol(u32 protocol, u32 node_index)
Definition: ip4_forward.c:2125
vlib_error_t * errors
Definition: node.h:378
format_function_t format_ip4_address
Definition: format.h:71
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:184
always_inline gre_protocol_info_t * gre_get_protocol_info(gre_main_t *em, gre_protocol_t protocol)
Definition: gre.h:83
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:109
ip4_address_t dst_address
Definition: ip4_packet.h:138
vlib_combined_counter_main_t * combined_sw_if_counters
Definition: interface.h:458
always_inline void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
Definition: counter.h:210
#define sparse_vec_validate(v, i)
Definition: sparse_vec.h:213
#define GRE_VERSION_MASK
Definition: packet.h:48
always_inline 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
unsigned long u64
Definition: types.h:89
unformat_function_t unformat_gre_header
Definition: gre.h:114
#define vlib_call_init_function(vm, x)
Definition: init.h:159
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
Definition: node_funcs.h:202
#define hash_get(h, key)
Definition: hash.h:231
#define pool_elt_at_index(p, i)
Definition: pool.h:346
static uword gre_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: node.c:65
uword os_get_cpu_number(void)
Definition: unix-misc.c:206
always_inline void * sparse_vec_new(uword elt_bytes, uword sparse_index_bits)
Definition: sparse_vec.h:68
u32 node_index
Definition: gre.h:46
#define PREDICT_FALSE(x)
Definition: clib.h:97
u32 length
Definition: node.c:38
always_inline void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:970
format_function_t * format_buffer
Definition: node.h:277
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Definition: buffer_node.h:43
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Definition: buffer_node.h:83
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Definition: node_funcs.h:265
u16 flags_and_version
Definition: packet.h:36
void gre_register_input_protocol(vlib_main_t *vm, gre_protocol_t protocol, u32 node_index)
Definition: node.c:438
vlib_error_t error
Error code for buffers to be enqueued to error handler.
Definition: buffer.h:129
static char * gre_error_strings[]
Definition: node.c:408
static clib_error_t * gre_init(vlib_main_t *vm)
Definition: gre.c:483
u16 n_vectors
Definition: node.h:307
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:82
u16 protocol
Definition: packet.h:51
gre_protocol_t
Definition: packet.h:28
u8 * format_gre_rx_trace(u8 *s, va_list *args)
Definition: node.c:43
unformat_function_t * unformat_buffer
Definition: node.h:278
unformat_function_t * unformat_edit
Definition: pg.h:290
always_inline vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static void gre_setup_node(vlib_main_t *vm, u32 node_index)
Definition: node.c:474
static clib_error_t * gre_input_init(vlib_main_t *vm)
Definition: node.c:484
u16 cached_next_index
Definition: node.h:422
#define ASSERT(truth)
always_inline void sparse_vec_index2(void *v, u32 si0, u32 si1, u32 *i0_return, u32 *i1_return)
Definition: sparse_vec.h:158
unsigned int u32
Definition: types.h:88
#define foreach_gre_input_next
Definition: node.c:23
#define vnet_buffer(b)
Definition: buffer.h:300
u32 next_index
Definition: gre.h:49
u8 * format(u8 *s, char *fmt,...)
Definition: format.c:405
gre_tunnel_t * tunnels
Definition: gre.h:62
ip4_address_t src
Definition: node.c:39
vlib_node_registration_t gre_input_node
(constructor) VLIB_REGISTER_NODE (gre_input_node)
Definition: node.c:414
u32 * sparse_index_by_next_index
Definition: node.c:61
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
Definition: node_funcs.h:919
#define VLIB_BUFFER_IS_TRACED
Definition: buffer.h:91
u64 uword
Definition: types.h:112
#define vec_elt(v, i)
Get vector value at index i.
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
Definition: node.c:44
Definition: defs.h:46
unsigned short u16
Definition: types.h:57
always_inline void * vlib_node_get_runtime_data(vlib_main_t *vm, u32 node_index)
Definition: node_funcs.h:76
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:197
unsigned char u8
Definition: types.h:56
unformat_function_t unformat_pg_gre_header
Definition: gre.h:115
gre_input_next_t
Definition: node.c:29
always_inline 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
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:162
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:140
ip4_main_t ip4_main
Definition: ip4_forward.c:1394
u8 data[0]
Packet data.
Definition: buffer.h:150
static uword ip6_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: ip6_input.c:72
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:84
#define BITS(x)
Definition: clib.h:58
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:432
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:69
gre_main_t gre_main
Definition: gre.c:21
Definition: pg.h:288
#define SPARSE_VEC_INVALID_INDEX
Definition: sparse_vec.h:65
always_inline uword sparse_vec_index(void *v, uword sparse_index)
Definition: sparse_vec.h:150