FD.io VPP  v17.07.01-10-g3be13f0
Vector Packet Processing
gtpu_encap.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Intel 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 #include <vppinfra/error.h>
16 #include <vppinfra/hash.h>
17 #include <vnet/vnet.h>
18 #include <vnet/ip/ip.h>
19 #include <vnet/ethernet/ethernet.h>
20 #include <gtpu/gtpu.h>
21 
22 /* Statistics (not all errors) */
23 #define foreach_gtpu_encap_error \
24 _(ENCAPSULATED, "good packets encapsulated")
25 
26 static char * gtpu_encap_error_strings[] = {
27 #define _(sym,string) string,
29 #undef _
30 };
31 
32 typedef enum {
33 #define _(sym,str) GTPU_ENCAP_ERROR_##sym,
35 #undef _
38 
39 typedef enum {
43 
44 typedef struct {
48 
49 u8 * format_gtpu_encap_trace (u8 * s, va_list * args)
50 {
51  CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
52  CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
54  = va_arg (*args, gtpu_encap_trace_t *);
55 
56  s = format (s, "GTPU encap to gtpu_tunnel%d teid %d",
57  t->tunnel_index, t->teid);
58  return s;
59 }
60 
61 
62 #define foreach_fixed_header4_offset \
63  _(0) _(1) _(2) _(3)
64 
65 #define foreach_fixed_header6_offset \
66  _(0) _(1) _(2) _(3) _(4) _(5) _(6)
67 
70  vlib_node_runtime_t * node,
71  vlib_frame_t * from_frame,
72  u32 is_ip4)
73 {
74  u32 n_left_from, next_index, * from, * to_next;
75  gtpu_main_t * gtm = &gtpu_main;
76  vnet_main_t * vnm = gtm->vnet_main;
78  u32 pkts_encapsulated = 0;
79  u16 old_l0 = 0, old_l1 = 0;
80  u32 thread_index = vlib_get_thread_index();
81  u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
82  u32 sw_if_index0 = 0, sw_if_index1 = 0;
83  u32 next0 = 0, next1 = 0;
84  vnet_hw_interface_t * hi0, * hi1;
85  gtpu_tunnel_t * t0 = NULL, * t1 = NULL;
86 
87  from = vlib_frame_vector_args (from_frame);
88  n_left_from = from_frame->n_vectors;
89 
90  next_index = node->cached_next_index;
91  stats_sw_if_index = node->runtime_data[0];
92  stats_n_packets = stats_n_bytes = 0;
93 
94  while (n_left_from > 0)
95  {
96  u32 n_left_to_next;
97 
98  vlib_get_next_frame (vm, node, next_index,
99  to_next, n_left_to_next);
100 
101  while (n_left_from >= 4 && n_left_to_next >= 2)
102  {
103  u32 bi0, bi1;
104  vlib_buffer_t * b0, * b1;
105  u32 flow_hash0, flow_hash1;
106  u32 len0, len1;
107  ip4_header_t * ip4_0, * ip4_1;
108  ip6_header_t * ip6_0, * ip6_1;
109  udp_header_t * udp0, * udp1;
110  gtpu_header_t * gtpu0, * gtpu1;
111  u64 * copy_src0, * copy_dst0;
112  u64 * copy_src1, * copy_dst1;
113  u32 * copy_src_last0, * copy_dst_last0;
114  u32 * copy_src_last1, * copy_dst_last1;
115  u16 new_l0, new_l1;
116  ip_csum_t sum0, sum1;
117 
118  /* Prefetch next iteration. */
119  {
120  vlib_buffer_t * p2, * p3;
121 
122  p2 = vlib_get_buffer (vm, from[2]);
123  p3 = vlib_get_buffer (vm, from[3]);
124 
125  vlib_prefetch_buffer_header (p2, LOAD);
126  vlib_prefetch_buffer_header (p3, LOAD);
127 
130  }
131 
132  bi0 = from[0];
133  bi1 = from[1];
134  to_next[0] = bi0;
135  to_next[1] = bi1;
136  from += 2;
137  to_next += 2;
138  n_left_to_next -= 2;
139  n_left_from -= 2;
140 
141  b0 = vlib_get_buffer (vm, bi0);
142  b1 = vlib_get_buffer (vm, bi1);
143 
144  flow_hash0 = vnet_l2_compute_flow_hash (b0);
145  flow_hash1 = vnet_l2_compute_flow_hash (b1);
146 
147  /* Get next node index and adj index from tunnel next_dpo */
148  sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
149  hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
150  t0 = &gtm->tunnels[hi0->dev_instance];
151  /* Note: change to always set next0 if it may be set to drop */
152  next0 = t0->next_dpo.dpoi_next_node;
153  vnet_buffer(b0)->ip.adj_index[VLIB_TX] = t0->next_dpo.dpoi_index;
154 
155  /* Get next node index and adj index from tunnel next_dpo */
156  sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_TX];
157  hi1 = vnet_get_sup_hw_interface (vnm, sw_if_index1);
158  t1 = &gtm->tunnels[hi1->dev_instance];
159  /* Note: change to always set next1 if it may be set to drop */
160  next1 = t1->next_dpo.dpoi_next_node;
161  vnet_buffer(b1)->ip.adj_index[VLIB_TX] = t1->next_dpo.dpoi_index;
162 
163  /* Apply the rewrite string. $$$$ vnet_rewrite? */
164  vlib_buffer_advance (b0, -(word)_vec_len(t0->rewrite));
165  vlib_buffer_advance (b1, -(word)_vec_len(t1->rewrite));
166 
167  if (is_ip4)
168  {
169  ip4_0 = vlib_buffer_get_current(b0);
170  ip4_1 = vlib_buffer_get_current(b1);
171 
172  /* Copy the fixed header */
173  copy_dst0 = (u64 *) ip4_0;
174  copy_src0 = (u64 *) t0->rewrite;
175  copy_dst1 = (u64 *) ip4_1;
176  copy_src1 = (u64 *) t1->rewrite;
177  /* Copy first 32 octets 8-bytes at a time */
178 #define _(offs) copy_dst0[offs] = copy_src0[offs];
180 #undef _
181 #define _(offs) copy_dst1[offs] = copy_src1[offs];
183 #undef _
184  /* Last 4 octets. Hopefully gcc will be our friend */
185  copy_dst_last0 = (u32 *)(&copy_dst0[4]);
186  copy_src_last0 = (u32 *)(&copy_src0[4]);
187  copy_dst_last0[0] = copy_src_last0[0];
188  copy_dst_last1 = (u32 *)(&copy_dst1[4]);
189  copy_src_last1 = (u32 *)(&copy_src1[4]);
190  copy_dst_last1[0] = copy_src_last1[0];
191 
192  /* Fix the IP4 checksum and length */
193  sum0 = ip4_0->checksum;
194  new_l0 = /* old_l0 always 0, see the rewrite setup */
195  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0));
196  sum0 = ip_csum_update (sum0, old_l0, new_l0, ip4_header_t,
197  length /* changed member */);
198  ip4_0->checksum = ip_csum_fold (sum0);
199  ip4_0->length = new_l0;
200  sum1 = ip4_1->checksum;
201  new_l1 = /* old_l1 always 0, see the rewrite setup */
202  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b1));
203  sum1 = ip_csum_update (sum1, old_l1, new_l1, ip4_header_t,
204  length /* changed member */);
205  ip4_1->checksum = ip_csum_fold (sum1);
206  ip4_1->length = new_l1;
207 
208  /* Fix UDP length and set source port */
209  udp0 = (udp_header_t *)(ip4_0+1);
210  new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
211  - sizeof (*ip4_0));
212  udp0->length = new_l0;
213  udp0->src_port = flow_hash0;
214  udp1 = (udp_header_t *)(ip4_1+1);
215  new_l1 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b1)
216  - sizeof (*ip4_1));
217  udp1->length = new_l1;
218  udp1->src_port = flow_hash1;
219 
220  /* Fix GTPU length */
221  gtpu0 = (gtpu_header_t *)(udp0+1);
222  new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
223  - sizeof (*ip4_0) - sizeof(*udp0));
224  gtpu0->length = new_l0;
225  gtpu1 = (gtpu_header_t *)(udp1+1);
226  new_l1 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b1)
227  - sizeof (*ip4_1) - sizeof(*udp1));
228  gtpu1->length = new_l1;
229  }
230  else /* ipv6 */
231  {
232  int bogus = 0;
233 
234  ip6_0 = vlib_buffer_get_current(b0);
235  ip6_1 = vlib_buffer_get_current(b1);
236 
237  /* Copy the fixed header */
238  copy_dst0 = (u64 *) ip6_0;
239  copy_src0 = (u64 *) t0->rewrite;
240  copy_dst1 = (u64 *) ip6_1;
241  copy_src1 = (u64 *) t1->rewrite;
242  /* Copy first 56 (ip6) octets 8-bytes at a time */
243 #define _(offs) copy_dst0[offs] = copy_src0[offs];
245 #undef _
246 #define _(offs) copy_dst1[offs] = copy_src1[offs];
248 #undef _
249  /* Fix IP6 payload length */
250  new_l0 =
251  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0)
252  - sizeof(*ip6_0));
253  ip6_0->payload_length = new_l0;
254  new_l1 =
255  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b1)
256  - sizeof(*ip6_1));
257  ip6_1->payload_length = new_l1;
258 
259  /* Fix UDP length and set source port */
260  udp0 = (udp_header_t *)(ip6_0+1);
261  udp0->length = new_l0;
262  udp0->src_port = flow_hash0;
263  udp1 = (udp_header_t *)(ip6_1+1);
264  udp1->length = new_l1;
265  udp1->src_port = flow_hash1;
266 
267  /* IPv6 UDP checksum is mandatory */
269  ip6_0, &bogus);
270  if (udp0->checksum == 0)
271  udp0->checksum = 0xffff;
273  ip6_1, &bogus);
274  if (udp1->checksum == 0)
275  udp1->checksum = 0xffff;
276 
277  /* Fix GTPU length */
278  gtpu0 = (gtpu_header_t *)(udp0+1);
279  new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
280  - sizeof (*ip4_0) - sizeof(*udp0));
281  gtpu0->length = new_l0;
282  gtpu1 = (gtpu_header_t *)(udp1+1);
283  new_l1 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b1)
284  - sizeof (*ip4_1) - sizeof(*udp1));
285  gtpu1->length = new_l1;
286  }
287 
288  pkts_encapsulated += 2;
289  len0 = vlib_buffer_length_in_chain (vm, b0);
290  len1 = vlib_buffer_length_in_chain (vm, b1);
291  stats_n_packets += 2;
292  stats_n_bytes += len0 + len1;
293 
294  /* Batch stats increment on the same gtpu tunnel so counter is not
295  incremented per packet. Note stats are still incremented for deleted
296  and admin-down tunnel where packets are dropped. It is not worthwhile
297  to check for this rare case and affect normal path performance. */
298  if (PREDICT_FALSE ((sw_if_index0 != stats_sw_if_index) ||
299  (sw_if_index1 != stats_sw_if_index)))
300  {
301  stats_n_packets -= 2;
302  stats_n_bytes -= len0 + len1;
303  if (sw_if_index0 == sw_if_index1)
304  {
305  if (stats_n_packets)
308  thread_index, stats_sw_if_index,
309  stats_n_packets, stats_n_bytes);
310  stats_sw_if_index = sw_if_index0;
311  stats_n_packets = 2;
312  stats_n_bytes = len0 + len1;
313  }
314  else
315  {
318  thread_index, sw_if_index0, 1, len0);
321  thread_index, sw_if_index1, 1, len1);
322  }
323  }
324 
326  {
327  gtpu_encap_trace_t *tr =
328  vlib_add_trace (vm, node, b0, sizeof (*tr));
329  tr->tunnel_index = t0 - gtm->tunnels;
330  tr->teid = t0->teid;
331  }
332 
334  {
335  gtpu_encap_trace_t *tr =
336  vlib_add_trace (vm, node, b1, sizeof (*tr));
337  tr->tunnel_index = t1 - gtm->tunnels;
338  tr->teid = t1->teid;
339  }
340 
341  vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
342  to_next, n_left_to_next,
343  bi0, bi1, next0, next1);
344  }
345 
346  while (n_left_from > 0 && n_left_to_next > 0)
347  {
348  u32 bi0;
349  vlib_buffer_t * b0;
350  u32 flow_hash0;
351  u32 len0;
352  ip4_header_t * ip4_0;
353  ip6_header_t * ip6_0;
354  udp_header_t * udp0;
355  gtpu_header_t * gtpu0;
356  u64 * copy_src0, * copy_dst0;
357  u32 * copy_src_last0, * copy_dst_last0;
358  u16 new_l0;
359  ip_csum_t sum0;
360 
361  bi0 = from[0];
362  to_next[0] = bi0;
363  from += 1;
364  to_next += 1;
365  n_left_from -= 1;
366  n_left_to_next -= 1;
367 
368  b0 = vlib_get_buffer (vm, bi0);
369 
370  flow_hash0 = vnet_l2_compute_flow_hash(b0);
371 
372  /* Get next node index and adj index from tunnel next_dpo */
373  sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
374  hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
375  t0 = &gtm->tunnels[hi0->dev_instance];
376  /* Note: change to always set next0 if it may be set to drop */
377  next0 = t0->next_dpo.dpoi_next_node;
378  vnet_buffer(b0)->ip.adj_index[VLIB_TX] = t0->next_dpo.dpoi_index;
379 
380  /* Apply the rewrite string. $$$$ vnet_rewrite? */
381  vlib_buffer_advance (b0, -(word)_vec_len(t0->rewrite));
382 
383  if (is_ip4)
384  {
385  ip4_0 = vlib_buffer_get_current(b0);
386 
387  /* Copy the fixed header */
388  copy_dst0 = (u64 *) ip4_0;
389  copy_src0 = (u64 *) t0->rewrite;
390  /* Copy first 32 octets 8-bytes at a time */
391 #define _(offs) copy_dst0[offs] = copy_src0[offs];
393 #undef _
394  /* Last 4 octets. Hopefully gcc will be our friend */
395  copy_dst_last0 = (u32 *)(&copy_dst0[4]);
396  copy_src_last0 = (u32 *)(&copy_src0[4]);
397  copy_dst_last0[0] = copy_src_last0[0];
398 
399  /* Fix the IP4 checksum and length */
400  sum0 = ip4_0->checksum;
401  new_l0 = /* old_l0 always 0, see the rewrite setup */
402  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0));
403  sum0 = ip_csum_update (sum0, old_l0, new_l0, ip4_header_t,
404  length /* changed member */);
405  ip4_0->checksum = ip_csum_fold (sum0);
406  ip4_0->length = new_l0;
407 
408  /* Fix UDP length and set source port */
409  udp0 = (udp_header_t *)(ip4_0+1);
410  new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
411  - sizeof (*ip4_0));
412  udp0->length = new_l0;
413  udp0->src_port = flow_hash0;
414 
415  /* Fix GTPU length */
416  gtpu0 = (gtpu_header_t *)(udp0+1);
417  new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
418  - sizeof (*ip4_0) - sizeof(*udp0));
419  gtpu0->length = new_l0;
420  }
421 
422  else /* ip6 path */
423  {
424  int bogus = 0;
425 
426  ip6_0 = vlib_buffer_get_current(b0);
427  /* Copy the fixed header */
428  copy_dst0 = (u64 *) ip6_0;
429  copy_src0 = (u64 *) t0->rewrite;
430  /* Copy first 56 (ip6) octets 8-bytes at a time */
431 #define _(offs) copy_dst0[offs] = copy_src0[offs];
433 #undef _
434  /* Fix IP6 payload length */
435  new_l0 =
436  clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0)
437  - sizeof(*ip6_0));
438  ip6_0->payload_length = new_l0;
439 
440  /* Fix UDP length and set source port */
441  udp0 = (udp_header_t *)(ip6_0+1);
442  udp0->length = new_l0;
443  udp0->src_port = flow_hash0;
444 
445  /* IPv6 UDP checksum is mandatory */
447  ip6_0, &bogus);
448  if (udp0->checksum == 0)
449  udp0->checksum = 0xffff;
450 
451  /* Fix GTPU length */
452  gtpu0 = (gtpu_header_t *)(udp0+1);
453  new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
454  - sizeof (*ip4_0) - sizeof(*udp0));
455  gtpu0->length = new_l0;
456  }
457 
458  pkts_encapsulated ++;
459  len0 = vlib_buffer_length_in_chain (vm, b0);
460  stats_n_packets += 1;
461  stats_n_bytes += len0;
462 
463  /* Batch stats increment on the same gtpu tunnel so counter is not
464  incremented per packet. Note stats are still incremented for deleted
465  and admin-down tunnel where packets are dropped. It is not worthwhile
466  to check for this rare case and affect normal path performance. */
467  if (PREDICT_FALSE (sw_if_index0 != stats_sw_if_index))
468  {
469  stats_n_packets -= 1;
470  stats_n_bytes -= len0;
471  if (stats_n_packets)
474  thread_index, stats_sw_if_index,
475  stats_n_packets, stats_n_bytes);
476  stats_n_packets = 1;
477  stats_n_bytes = len0;
478  stats_sw_if_index = sw_if_index0;
479  }
480 
482  {
483  gtpu_encap_trace_t *tr =
484  vlib_add_trace (vm, node, b0, sizeof (*tr));
485  tr->tunnel_index = t0 - gtm->tunnels;
486  tr->teid = t0->teid;
487  }
488  vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
489  to_next, n_left_to_next,
490  bi0, next0);
491  }
492 
493  vlib_put_next_frame (vm, node, next_index, n_left_to_next);
494  }
495 
496  /* Do we still need this now that tunnel tx stats is kept? */
498  GTPU_ENCAP_ERROR_ENCAPSULATED,
499  pkts_encapsulated);
500 
501  /* Increment any remaining batch stats */
502  if (stats_n_packets)
503  {
506  thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
507  node->runtime_data[0] = stats_sw_if_index;
508  }
509 
510  return from_frame->n_vectors;
511 }
512 
513 static uword
515  vlib_node_runtime_t * node,
516  vlib_frame_t * from_frame)
517 {
518  return gtpu_encap_inline (vm, node, from_frame, /* is_ip4 */ 1);
519 }
520 
521 static uword
523  vlib_node_runtime_t * node,
524  vlib_frame_t * from_frame)
525 {
526  return gtpu_encap_inline (vm, node, from_frame, /* is_ip4 */ 0);
527 }
528 
530  .function = gtpu4_encap,
531  .name = "gtpu4-encap",
532  .vector_size = sizeof (u32),
533  .format_trace = format_gtpu_encap_trace,
534  .type = VLIB_NODE_TYPE_INTERNAL,
535  .n_errors = ARRAY_LEN(gtpu_encap_error_strings),
536  .error_strings = gtpu_encap_error_strings,
537  .n_next_nodes = GTPU_ENCAP_N_NEXT,
538  .next_nodes = {
539  [GTPU_ENCAP_NEXT_DROP] = "error-drop",
540  },
541 };
542 
544 
546  .function = gtpu6_encap,
547  .name = "gtpu6-encap",
548  .vector_size = sizeof (u32),
549  .format_trace = format_gtpu_encap_trace,
550  .type = VLIB_NODE_TYPE_INTERNAL,
551  .n_errors = ARRAY_LEN(gtpu_encap_error_strings),
552  .error_strings = gtpu_encap_error_strings,
553  .n_next_nodes = GTPU_ENCAP_N_NEXT,
554  .next_nodes = {
555  [GTPU_ENCAP_NEXT_DROP] = "error-drop",
556  },
557 };
558 
560 
static uword gtpu_encap_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u32 is_ip4)
Definition: gtpu_encap.c:69
#define CLIB_UNUSED(x)
Definition: clib.h:79
vnet_main_t * vnet_main
Definition: gtpu.h:228
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
Definition: counter.h:211
u8 runtime_data[0]
Function dependent node-runtime data.
Definition: node.h:468
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
u32 teid
Definition: gtpu.h:133
vnet_interface_main_t interface_main
Definition: vnet.h:56
#define NULL
Definition: clib.h:55
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:459
static uword gtpu4_encap(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: gtpu_encap.c:514
uword ip_csum_t
Definition: ip_packet.h:90
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
u16 length
Definition: gtpu.h:58
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:100
#define foreach_fixed_header6_offset
Definition: gtpu_encap.c:65
dpo_id_t next_dpo
Definition: gtpu.h:130
#define always_inline
Definition: clib.h:84
gtpu_encap_error_t
Definition: gtpu_encap.c:32
vlib_combined_counter_main_t * combined_sw_if_counters
Definition: interface.h:653
gtpu_encap_next_t
Definition: gtpu_encap.c:39
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:164
unsigned long u64
Definition: types.h:89
u8 * format_gtpu_encap_trace(u8 *s, va_list *args)
Definition: gtpu_encap.c:49
static u32 vnet_l2_compute_flow_hash(vlib_buffer_t *b)
Definition: l2_input.h:253
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
Definition: buffer.h:188
#define PREDICT_FALSE(x)
Definition: clib.h:97
u32 node_index
Node index.
Definition: node.h:441
#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:216
#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:366
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
Definition: node_funcs.h:1131
u16 n_vectors
Definition: node.h:345
static_always_inline uword vlib_get_thread_index(void)
Definition: threads.h:185
#define CLIB_PREFETCH(addr, size, type)
Definition: cache.h:82
#define VLIB_BUFFER_IS_TRACED
Definition: buffer.h:85
#define ARRAY_LEN(x)
Definition: clib.h:59
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
Definition: ip6_forward.c:1195
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
Definition: node.h:460
unsigned int u32
Definition: types.h:88
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
Definition: buffer.h:201
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
Definition: defs.h:47
unsigned short u16
Definition: types.h:57
#define foreach_fixed_header4_offset
Definition: gtpu_encap.c:62
u16 payload_length
Definition: ip6_packet.h:332
i64 word
Definition: types.h:111
index_t dpoi_index
the index of objects of that type
Definition: dpo.h:168
unsigned char u8
Definition: types.h:56
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Definition: node_funcs.h:269
#define ip_csum_update(sum, old, new, type, field)
Definition: ip_packet.h:139
Bits Octets 8 7 6 5 4 3 2 1 1 Version PT (*) E S PN 2 Message Type 3 Length (1st Octet) 4 Length...
Definition: gtpu.h:54
#define vnet_buffer(b)
Definition: buffer.h:304
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
Definition: node.h:159
gtpu_main_t gtpu_main
Definition: jvpp_gtpu.h:39
gtpu_tunnel_t * tunnels
Definition: gtpu.h:198
#define VLIB_REGISTER_NODE(x,...)
Definition: node.h:144
u8 data[0]
Packet data.
Definition: buffer.h:152
vlib_node_registration_t gtpu4_encap_node
(constructor) VLIB_REGISTER_NODE (gtpu4_encap_node)
Definition: gtpu_encap.c:529
u8 * rewrite
Definition: gtpu.h:127
static uword gtpu6_encap(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Definition: gtpu_encap.c:522
u16 dpoi_next_node
The next VLIB node to follow.
Definition: dpo.h:164
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:67
static char * gtpu_encap_error_strings[]
Definition: gtpu_encap.c:26
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
Definition: buffer.h:74
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
Definition: buffer_funcs.h:57
static u16 ip_csum_fold(ip_csum_t c)
Definition: ip_packet.h:145
vlib_node_registration_t gtpu6_encap_node
(constructor) VLIB_REGISTER_NODE (gtpu6_encap_node)
Definition: gtpu_encap.c:545
#define foreach_gtpu_encap_error
Definition: gtpu_encap.c:23