Add GTP-U plugin. VPP-694
[vpp.git] / src / plugins / gtpu / gtpu_encap.c
1 /*
2  * Copyright (c) 2015 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 #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,
28   foreach_gtpu_encap_error
29 #undef _
30 };
31
32 typedef enum {
33 #define _(sym,str) GTPU_ENCAP_ERROR_##sym,
34     foreach_gtpu_encap_error
35 #undef _
36     GTPU_ENCAP_N_ERROR,
37 } gtpu_encap_error_t;
38
39 typedef enum {
40     GTPU_ENCAP_NEXT_DROP,
41     GTPU_ENCAP_N_NEXT,
42 } gtpu_encap_next_t;
43
44 typedef struct {
45   u32 tunnel_index;
46   u32 teid;
47 } gtpu_encap_trace_t;
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 *);
53   gtpu_encap_trace_t * 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
68 always_inline uword
69 gtpu_encap_inline (vlib_main_t * vm,
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;
77   vnet_interface_main_t * im = &vnm->interface_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
128             CLIB_PREFETCH (p2->data, 2*CLIB_CACHE_LINE_BYTES, LOAD);
129             CLIB_PREFETCH (p3->data, 2*CLIB_CACHE_LINE_BYTES, LOAD);
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           if (sw_if_index0 != vnet_buffer(b0)->sw_if_index[VLIB_TX])
149             {
150               sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
151               hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
152               t0 = &gtm->tunnels[hi0->dev_instance];
153               /* Note: change to always set next0 if it may be set to drop */
154               next0 = t0->next_dpo.dpoi_next_node;
155             }
156           vnet_buffer(b0)->ip.adj_index[VLIB_TX] = t0->next_dpo.dpoi_index;
157
158           /* Get next node index and adj index from tunnel next_dpo */
159           if (sw_if_index1 != vnet_buffer(b1)->sw_if_index[VLIB_TX])
160             {
161               sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_TX];
162               hi1 = vnet_get_sup_hw_interface (vnm, sw_if_index1);
163               t1 = &gtm->tunnels[hi1->dev_instance];
164               /* Note: change to always set next1 if it may be set to drop */
165               next1 = t1->next_dpo.dpoi_next_node;
166             }
167           vnet_buffer(b1)->ip.adj_index[VLIB_TX] = t1->next_dpo.dpoi_index;
168
169           /* Apply the rewrite string. $$$$ vnet_rewrite? */
170           vlib_buffer_advance (b0, -(word)_vec_len(t0->rewrite));
171           vlib_buffer_advance (b1, -(word)_vec_len(t1->rewrite));
172
173           if (is_ip4)
174             {
175               ip4_0 = vlib_buffer_get_current(b0);
176               ip4_1 = vlib_buffer_get_current(b1);
177
178               /* Copy the fixed header */
179               copy_dst0 = (u64 *) ip4_0;
180               copy_src0 = (u64 *) t0->rewrite;
181               copy_dst1 = (u64 *) ip4_1;
182               copy_src1 = (u64 *) t1->rewrite;
183               /* Copy first 32 octets 8-bytes at a time */
184 #define _(offs) copy_dst0[offs] = copy_src0[offs];
185               foreach_fixed_header4_offset;
186 #undef _
187 #define _(offs) copy_dst1[offs] = copy_src1[offs];
188               foreach_fixed_header4_offset;
189 #undef _
190               /* Last 4 octets. Hopefully gcc will be our friend */
191               copy_dst_last0 = (u32 *)(&copy_dst0[4]);
192               copy_src_last0 = (u32 *)(&copy_src0[4]);
193               copy_dst_last0[0] = copy_src_last0[0];
194               copy_dst_last1 = (u32 *)(&copy_dst1[4]);
195               copy_src_last1 = (u32 *)(&copy_src1[4]);
196               copy_dst_last1[0] = copy_src_last1[0];
197
198               /* Fix the IP4 checksum and length */
199               sum0 = ip4_0->checksum;
200               new_l0 = /* old_l0 always 0, see the rewrite setup */
201                 clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0));
202               sum0 = ip_csum_update (sum0, old_l0, new_l0, ip4_header_t,
203                                      length /* changed member */);
204               ip4_0->checksum = ip_csum_fold (sum0);
205               ip4_0->length = new_l0;
206               sum1 = ip4_1->checksum;
207               new_l1 = /* old_l1 always 0, see the rewrite setup */
208                 clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b1));
209               sum1 = ip_csum_update (sum1, old_l1, new_l1, ip4_header_t,
210                                      length /* changed member */);
211               ip4_1->checksum = ip_csum_fold (sum1);
212               ip4_1->length = new_l1;
213
214               /* Fix UDP length and set source port */
215               udp0 = (udp_header_t *)(ip4_0+1);
216               new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
217                                              - sizeof (*ip4_0));
218               udp0->length = new_l0;
219               udp0->src_port = flow_hash0;
220               udp1 = (udp_header_t *)(ip4_1+1);
221               new_l1 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b1)
222                                              - sizeof (*ip4_1));
223               udp1->length = new_l1;
224               udp1->src_port = flow_hash1;
225
226               /* Fix GTPU length */
227               gtpu0 = (gtpu_header_t *)(udp0+1);
228               new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
229                                              - sizeof (*ip4_0) - sizeof(*udp0));
230               gtpu0->length = new_l0;
231               gtpu1 = (gtpu_header_t *)(udp1+1);
232               new_l1 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b1)
233                                              - sizeof (*ip4_1) - sizeof(*udp1));
234               gtpu1->length = new_l1;
235             }
236           else /* ipv6 */
237             {
238               int bogus = 0;
239
240               ip6_0 = vlib_buffer_get_current(b0);
241               ip6_1 = vlib_buffer_get_current(b1);
242
243               /* Copy the fixed header */
244               copy_dst0 = (u64 *) ip6_0;
245               copy_src0 = (u64 *) t0->rewrite;
246               copy_dst1 = (u64 *) ip6_1;
247               copy_src1 = (u64 *) t1->rewrite;
248               /* Copy first 56 (ip6) octets 8-bytes at a time */
249 #define _(offs) copy_dst0[offs] = copy_src0[offs];
250               foreach_fixed_header6_offset;
251 #undef _
252 #define _(offs) copy_dst1[offs] = copy_src1[offs];
253               foreach_fixed_header6_offset;
254 #undef _
255               /* Fix IP6 payload length */
256               new_l0 =
257                 clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0)
258                                       - sizeof(*ip6_0));
259               ip6_0->payload_length = new_l0;
260               new_l1 =
261                 clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b1)
262                                       - sizeof(*ip6_1));
263               ip6_1->payload_length = new_l1;
264
265               /* Fix UDP length  and set source port */
266               udp0 = (udp_header_t *)(ip6_0+1);
267               udp0->length = new_l0;
268               udp0->src_port = flow_hash0;
269               udp1 = (udp_header_t *)(ip6_1+1);
270               udp1->length = new_l1;
271               udp1->src_port = flow_hash1;
272
273               /* IPv6 UDP checksum is mandatory */
274               udp0->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b0,
275                                                                  ip6_0, &bogus);
276               if (udp0->checksum == 0)
277                 udp0->checksum = 0xffff;
278               udp1->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b1,
279                                                         ip6_1, &bogus);
280               if (udp1->checksum == 0)
281                 udp1->checksum = 0xffff;
282
283               /* Fix GTPU length */
284               gtpu0 = (gtpu_header_t *)(udp0+1);
285               new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
286                                              - sizeof (*ip4_0) - sizeof(*udp0));
287               gtpu0->length = new_l0;
288               gtpu1 = (gtpu_header_t *)(udp1+1);
289               new_l1 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b1)
290                                              - sizeof (*ip4_1) - sizeof(*udp1));
291               gtpu1->length = new_l1;
292             }
293
294           pkts_encapsulated += 2;
295           len0 = vlib_buffer_length_in_chain (vm, b0);
296           len1 = vlib_buffer_length_in_chain (vm, b1);
297           stats_n_packets += 2;
298           stats_n_bytes += len0 + len1;
299
300           /* Batch stats increment on the same gtpu tunnel so counter is not
301              incremented per packet. Note stats are still incremented for deleted
302              and admin-down tunnel where packets are dropped. It is not worthwhile
303              to check for this rare case and affect normal path performance. */
304           if (PREDICT_FALSE ((sw_if_index0 != stats_sw_if_index) ||
305                              (sw_if_index1 != stats_sw_if_index)))
306             {
307               stats_n_packets -= 2;
308               stats_n_bytes -= len0 + len1;
309               if (sw_if_index0 == sw_if_index1)
310                 {
311                   if (stats_n_packets)
312                     vlib_increment_combined_counter
313                       (im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_TX,
314                        thread_index, stats_sw_if_index,
315                        stats_n_packets, stats_n_bytes);
316                   stats_sw_if_index = sw_if_index0;
317                   stats_n_packets = 2;
318                   stats_n_bytes = len0 + len1;
319                 }
320               else
321                 {
322                   vlib_increment_combined_counter
323                       (im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_TX,
324                        thread_index, sw_if_index0, 1, len0);
325                   vlib_increment_combined_counter
326                       (im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_TX,
327                        thread_index, sw_if_index1, 1, len1);
328                 }
329             }
330
331           if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
332             {
333               gtpu_encap_trace_t *tr =
334                 vlib_add_trace (vm, node, b0, sizeof (*tr));
335               tr->tunnel_index = t0 - gtm->tunnels;
336               tr->teid = t0->teid;
337            }
338
339           if (PREDICT_FALSE(b1->flags & VLIB_BUFFER_IS_TRACED))
340             {
341               gtpu_encap_trace_t *tr =
342                 vlib_add_trace (vm, node, b1, sizeof (*tr));
343               tr->tunnel_index = t1 - gtm->tunnels;
344               tr->teid = t1->teid;
345             }
346
347           vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
348                                            to_next, n_left_to_next,
349                                            bi0, bi1, next0, next1);
350         }
351
352       while (n_left_from > 0 && n_left_to_next > 0)
353         {
354           u32 bi0;
355           vlib_buffer_t * b0;
356           u32 flow_hash0;
357           u32 len0;
358           ip4_header_t * ip4_0;
359           ip6_header_t * ip6_0;
360           udp_header_t * udp0;
361           gtpu_header_t * gtpu0;
362           u64 * copy_src0, * copy_dst0;
363           u32 * copy_src_last0, * copy_dst_last0;
364           u16 new_l0;
365           ip_csum_t sum0;
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           flow_hash0 = vnet_l2_compute_flow_hash(b0);
377
378           /* Get next node index and adj index from tunnel next_dpo */
379           if (sw_if_index0 != vnet_buffer(b0)->sw_if_index[VLIB_TX])
380             {
381               sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_TX];
382               hi0 = vnet_get_sup_hw_interface (vnm, sw_if_index0);
383               t0 = &gtm->tunnels[hi0->dev_instance];
384               /* Note: change to always set next0 if it may be set to drop */
385               next0 = t0->next_dpo.dpoi_next_node;
386             }
387           vnet_buffer(b0)->ip.adj_index[VLIB_TX] = t0->next_dpo.dpoi_index;
388
389           /* Apply the rewrite string. $$$$ vnet_rewrite? */
390           vlib_buffer_advance (b0, -(word)_vec_len(t0->rewrite));
391
392           if (is_ip4)
393             {
394               ip4_0 = vlib_buffer_get_current(b0);
395
396               /* Copy the fixed header */
397               copy_dst0 = (u64 *) ip4_0;
398               copy_src0 = (u64 *) t0->rewrite;
399               /* Copy first 32 octets 8-bytes at a time */
400 #define _(offs) copy_dst0[offs] = copy_src0[offs];
401               foreach_fixed_header4_offset;
402 #undef _
403               /* Last 4 octets. Hopefully gcc will be our friend */
404               copy_dst_last0 = (u32 *)(&copy_dst0[4]);
405               copy_src_last0 = (u32 *)(&copy_src0[4]);
406               copy_dst_last0[0] = copy_src_last0[0];
407
408               /* Fix the IP4 checksum and length */
409               sum0 = ip4_0->checksum;
410               new_l0 = /* old_l0 always 0, see the rewrite setup */
411                 clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0));
412               sum0 = ip_csum_update (sum0, old_l0, new_l0, ip4_header_t,
413                                      length /* changed member */);
414               ip4_0->checksum = ip_csum_fold (sum0);
415               ip4_0->length = new_l0;
416
417               /* Fix UDP length and set source port */
418               udp0 = (udp_header_t *)(ip4_0+1);
419               new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
420                                              - sizeof (*ip4_0));
421               udp0->length = new_l0;
422               udp0->src_port = flow_hash0;
423
424               /* Fix GTPU length */
425               gtpu0 = (gtpu_header_t *)(udp0+1);
426               new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
427                                              - sizeof (*ip4_0) - sizeof(*udp0));
428               gtpu0->length = new_l0;
429             }
430
431           else /* ip6 path */
432             {
433               int bogus = 0;
434
435               ip6_0 = vlib_buffer_get_current(b0);
436               /* Copy the fixed header */
437               copy_dst0 = (u64 *) ip6_0;
438               copy_src0 = (u64 *) t0->rewrite;
439               /* Copy first 56 (ip6) octets 8-bytes at a time */
440 #define _(offs) copy_dst0[offs] = copy_src0[offs];
441               foreach_fixed_header6_offset;
442 #undef _
443               /* Fix IP6 payload length */
444               new_l0 =
445                 clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b0)
446                                       - sizeof(*ip6_0));
447               ip6_0->payload_length = new_l0;
448
449               /* Fix UDP length  and set source port */
450               udp0 = (udp_header_t *)(ip6_0+1);
451               udp0->length = new_l0;
452               udp0->src_port = flow_hash0;
453
454               /* IPv6 UDP checksum is mandatory */
455               udp0->checksum = ip6_tcp_udp_icmp_compute_checksum(vm, b0,
456                                                                  ip6_0, &bogus);
457               if (udp0->checksum == 0)
458                 udp0->checksum = 0xffff;
459
460               /* Fix GTPU length */
461               gtpu0 = (gtpu_header_t *)(udp0+1);
462               new_l0 = clib_host_to_net_u16 (vlib_buffer_length_in_chain(vm, b0)
463                                              - sizeof (*ip4_0) - sizeof(*udp0));
464               gtpu0->length = new_l0;
465             }
466
467           pkts_encapsulated ++;
468           len0 = vlib_buffer_length_in_chain (vm, b0);
469           stats_n_packets += 1;
470           stats_n_bytes += len0;
471
472           /* Batch stats increment on the same gtpu tunnel so counter is not
473              incremented per packet. Note stats are still incremented for deleted
474              and admin-down tunnel where packets are dropped. It is not worthwhile
475              to check for this rare case and affect normal path performance. */
476           if (PREDICT_FALSE (sw_if_index0 != stats_sw_if_index))
477             {
478               stats_n_packets -= 1;
479               stats_n_bytes -= len0;
480               if (stats_n_packets)
481                 vlib_increment_combined_counter
482                   (im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_TX,
483                    thread_index, stats_sw_if_index,
484                    stats_n_packets, stats_n_bytes);
485               stats_n_packets = 1;
486               stats_n_bytes = len0;
487               stats_sw_if_index = sw_if_index0;
488             }
489
490           if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
491             {
492               gtpu_encap_trace_t *tr =
493                 vlib_add_trace (vm, node, b0, sizeof (*tr));
494               tr->tunnel_index = t0 - gtm->tunnels;
495               tr->teid = t0->teid;
496             }
497           vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
498                                            to_next, n_left_to_next,
499                                            bi0, next0);
500         }
501
502       vlib_put_next_frame (vm, node, next_index, n_left_to_next);
503     }
504
505   /* Do we still need this now that tunnel tx stats is kept? */
506   vlib_node_increment_counter (vm, node->node_index,
507                                GTPU_ENCAP_ERROR_ENCAPSULATED,
508                                pkts_encapsulated);
509
510   /* Increment any remaining batch stats */
511   if (stats_n_packets)
512     {
513       vlib_increment_combined_counter
514         (im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_TX,
515          thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
516       node->runtime_data[0] = stats_sw_if_index;
517     }
518
519   return from_frame->n_vectors;
520 }
521
522 static uword
523 gtpu4_encap (vlib_main_t * vm,
524               vlib_node_runtime_t * node,
525               vlib_frame_t * from_frame)
526 {
527   return gtpu_encap_inline (vm, node, from_frame, /* is_ip4 */ 1);
528 }
529
530 static uword
531 gtpu6_encap (vlib_main_t * vm,
532               vlib_node_runtime_t * node,
533               vlib_frame_t * from_frame)
534 {
535   return gtpu_encap_inline (vm, node, from_frame, /* is_ip4 */ 0);
536 }
537
538 VLIB_REGISTER_NODE (gtpu4_encap_node) = {
539   .function = gtpu4_encap,
540   .name = "gtpu4-encap",
541   .vector_size = sizeof (u32),
542   .format_trace = format_gtpu_encap_trace,
543   .type = VLIB_NODE_TYPE_INTERNAL,
544   .n_errors = ARRAY_LEN(gtpu_encap_error_strings),
545   .error_strings = gtpu_encap_error_strings,
546   .n_next_nodes = GTPU_ENCAP_N_NEXT,
547   .next_nodes = {
548         [GTPU_ENCAP_NEXT_DROP] = "error-drop",
549   },
550 };
551
552 VLIB_NODE_FUNCTION_MULTIARCH (gtpu4_encap_node, gtpu4_encap)
553
554 VLIB_REGISTER_NODE (gtpu6_encap_node) = {
555   .function = gtpu6_encap,
556   .name = "gtpu6-encap",
557   .vector_size = sizeof (u32),
558   .format_trace = format_gtpu_encap_trace,
559   .type = VLIB_NODE_TYPE_INTERNAL,
560   .n_errors = ARRAY_LEN(gtpu_encap_error_strings),
561   .error_strings = gtpu_encap_error_strings,
562   .n_next_nodes = GTPU_ENCAP_N_NEXT,
563   .next_nodes = {
564         [GTPU_ENCAP_NEXT_DROP] = "error-drop",
565   },
566 };
567
568 VLIB_NODE_FUNCTION_MULTIARCH (gtpu6_encap_node, gtpu6_encap)
569