dpdk-ipsec: use single queue pair per crypto resource
[vpp.git] / src / plugins / dpdk / ipsec / esp_encrypt.c
1 /*
2  * esp_encrypt.c : IPSec ESP encrypt node using DPDK Cryptodev
3  *
4  * Copyright (c) 2017 Intel 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 <vnet/vnet.h>
19 #include <vnet/api_errno.h>
20 #include <vnet/ip/ip.h>
21
22 #include <vnet/ipsec/ipsec.h>
23 #include <vnet/ipsec/esp.h>
24 #include <vnet/udp/udp.h>
25 #include <dpdk/buffer.h>
26 #include <dpdk/ipsec/ipsec.h>
27 #include <dpdk/device/dpdk.h>
28 #include <dpdk/device/dpdk_priv.h>
29
30 #define foreach_esp_encrypt_next                   \
31 _(DROP, "error-drop")                              \
32 _(IP4_LOOKUP, "ip4-lookup")                        \
33 _(IP6_LOOKUP, "ip6-lookup")                        \
34 _(INTERFACE_OUTPUT, "interface-output")
35
36 #define _(v, s) ESP_ENCRYPT_NEXT_##v,
37 typedef enum
38 {
39   foreach_esp_encrypt_next
40 #undef _
41     ESP_ENCRYPT_N_NEXT,
42 } esp_encrypt_next_t;
43
44 #define foreach_esp_encrypt_error                   \
45  _(RX_PKTS, "ESP pkts received")                    \
46  _(SEQ_CYCLED, "Sequence number cycled")            \
47  _(ENQ_FAIL, "Enqueue failed to crypto device")     \
48  _(DISCARD, "Not enough crypto operations, discarding frame")  \
49  _(SESSION, "Failed to get crypto session")         \
50  _(NOSUP, "Cipher/Auth not supported")
51
52
53 typedef enum
54 {
55 #define _(sym,str) ESP_ENCRYPT_ERROR_##sym,
56   foreach_esp_encrypt_error
57 #undef _
58     ESP_ENCRYPT_N_ERROR,
59 } esp_encrypt_error_t;
60
61 static char *esp_encrypt_error_strings[] = {
62 #define _(sym,string) string,
63   foreach_esp_encrypt_error
64 #undef _
65 };
66
67 extern vlib_node_registration_t dpdk_esp4_encrypt_node;
68 extern vlib_node_registration_t dpdk_esp6_encrypt_node;
69
70 typedef struct
71 {
72   ipsec_crypto_alg_t crypto_alg;
73   ipsec_integ_alg_t integ_alg;
74   u8 packet_data[64];
75 } esp_encrypt_trace_t;
76
77 /* packet trace format function */
78 static u8 *
79 format_esp_encrypt_trace (u8 * s, va_list * args)
80 {
81   CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
82   CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
83   esp_encrypt_trace_t *t = va_arg (*args, esp_encrypt_trace_t *);
84   ip4_header_t *ih4 = (ip4_header_t *) t->packet_data;
85   u32 indent = format_get_indent (s), offset;
86
87   s = format (s, "cipher %U auth %U\n",
88               format_ipsec_crypto_alg, t->crypto_alg,
89               format_ipsec_integ_alg, t->integ_alg);
90
91   if ((ih4->ip_version_and_header_length & 0xF0) == 0x60)
92     {
93       s = format (s, "%U%U", format_white_space, indent,
94                   format_ip6_header, ih4);
95       offset = sizeof (ip6_header_t);
96     }
97   else
98     {
99       s = format (s, "%U%U", format_white_space, indent,
100                   format_ip4_header, ih4);
101       offset = ip4_header_bytes (ih4);
102     }
103
104   s = format (s, "\n%U%U", format_white_space, indent,
105               format_esp_header, t->packet_data + offset);
106
107   return s;
108 }
109
110 always_inline uword
111 dpdk_esp_encrypt_inline (vlib_main_t * vm,
112                          vlib_node_runtime_t * node,
113                          vlib_frame_t * from_frame, int is_ip6)
114 {
115   u32 n_left_from, *from, *to_next, next_index;
116   ipsec_main_t *im = &ipsec_main;
117   u32 thread_idx = vlib_get_thread_index ();
118   dpdk_crypto_main_t *dcm = &dpdk_crypto_main;
119   crypto_resource_t *res = 0;
120   ipsec_sa_t *sa0 = 0;
121   crypto_alg_t *cipher_alg = 0, *auth_alg = 0;
122   struct rte_cryptodev_sym_session *session = 0;
123   u32 ret, last_sa_index = ~0;
124   u8 numa = rte_socket_id ();
125   u8 is_aead = 0;
126   crypto_worker_main_t *cwm =
127     vec_elt_at_index (dcm->workers_main, thread_idx);
128   struct rte_crypto_op **ops = cwm->ops;
129
130   from = vlib_frame_vector_args (from_frame);
131   n_left_from = from_frame->n_vectors;
132
133   ret = crypto_alloc_ops (numa, ops, n_left_from);
134   if (ret)
135     {
136       if (is_ip6)
137         vlib_node_increment_counter (vm, dpdk_esp6_encrypt_node.index,
138                                      ESP_ENCRYPT_ERROR_DISCARD, 1);
139       else
140         vlib_node_increment_counter (vm, dpdk_esp4_encrypt_node.index,
141                                      ESP_ENCRYPT_ERROR_DISCARD, 1);
142       /* Discard whole frame */
143       return n_left_from;
144     }
145
146   next_index = ESP_ENCRYPT_NEXT_DROP;
147
148   while (n_left_from > 0)
149     {
150       u32 n_left_to_next;
151
152       vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
153
154       while (n_left_from > 0 && n_left_to_next > 0)
155         {
156           clib_error_t *error;
157           u32 bi0;
158           vlib_buffer_t *b0 = 0;
159           u32 sa_index0;
160           ip4_and_esp_header_t *ih0, *oh0 = 0;
161           ip6_and_esp_header_t *ih6_0, *oh6_0 = 0;
162           ip4_and_udp_and_esp_header_t *ouh0 = 0;
163           esp_header_t *esp0;
164           esp_footer_t *f0;
165           u8 next_hdr_type;
166           u32 iv_size;
167           u16 orig_sz;
168           u8 trunc_size;
169           u16 rewrite_len;
170           u16 udp_encap_adv = 0;
171           struct rte_mbuf *mb0 = 0;
172           struct rte_crypto_op *op;
173           u16 res_idx;
174
175           bi0 = from[0];
176           from += 1;
177           n_left_from -= 1;
178
179           b0 = vlib_get_buffer (vm, bi0);
180           ih0 = vlib_buffer_get_current (b0);
181           mb0 = rte_mbuf_from_vlib_buffer (b0);
182
183           /* ih0/ih6_0 */
184           CLIB_PREFETCH (ih0, sizeof (ih6_0[0]), LOAD);
185           /* f0 */
186           CLIB_PREFETCH (vlib_buffer_get_tail (b0), 20, STORE);
187           /* mb0 */
188           CLIB_PREFETCH (mb0, CLIB_CACHE_LINE_BYTES, STORE);
189
190           op = ops[0];
191           ops += 1;
192           ASSERT (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED);
193
194           dpdk_op_priv_t *priv = crypto_op_get_priv (op);
195
196           u16 op_len =
197             sizeof (op[0]) + sizeof (op[0].sym[0]) + sizeof (priv[0]);
198           CLIB_PREFETCH (op, op_len, STORE);
199
200           sa_index0 = vnet_buffer (b0)->ipsec.sad_index;
201
202           if (sa_index0 != last_sa_index)
203             {
204               sa0 = pool_elt_at_index (im->sad, sa_index0);
205
206               cipher_alg =
207                 vec_elt_at_index (dcm->cipher_algs, sa0->crypto_alg);
208               auth_alg = vec_elt_at_index (dcm->auth_algs, sa0->integ_alg);
209
210               is_aead = (cipher_alg->type == RTE_CRYPTO_SYM_XFORM_AEAD);
211
212               if (is_aead)
213                 auth_alg = cipher_alg;
214
215               res_idx = get_resource (cwm, sa0);
216
217               if (PREDICT_FALSE (res_idx == (u16) ~ 0))
218                 {
219                   clib_warning ("unsupported SA by thread index %u",
220                                 thread_idx);
221                   if (is_ip6)
222                     vlib_node_increment_counter (vm,
223                                                  dpdk_esp6_encrypt_node.index,
224                                                  ESP_ENCRYPT_ERROR_NOSUP, 1);
225                   else
226                     vlib_node_increment_counter (vm,
227                                                  dpdk_esp4_encrypt_node.index,
228                                                  ESP_ENCRYPT_ERROR_NOSUP, 1);
229                   to_next[0] = bi0;
230                   to_next += 1;
231                   n_left_to_next -= 1;
232                   goto trace;
233                 }
234               res = vec_elt_at_index (dcm->resource, res_idx);
235
236               error = crypto_get_session (&session, sa_index0, res, cwm, 1);
237               if (PREDICT_FALSE (error || !session))
238                 {
239                   clib_warning ("failed to get crypto session");
240                   if (is_ip6)
241                     vlib_node_increment_counter (vm,
242                                                  dpdk_esp6_encrypt_node.index,
243                                                  ESP_ENCRYPT_ERROR_SESSION,
244                                                  1);
245                   else
246                     vlib_node_increment_counter (vm,
247                                                  dpdk_esp4_encrypt_node.index,
248                                                  ESP_ENCRYPT_ERROR_SESSION,
249                                                  1);
250                   to_next[0] = bi0;
251                   to_next += 1;
252                   n_left_to_next -= 1;
253                   goto trace;
254                 }
255
256               last_sa_index = sa_index0;
257             }
258
259           if (PREDICT_FALSE (esp_seq_advance (sa0)))
260             {
261               clib_warning ("sequence number counter has cycled SPI %u",
262                             sa0->spi);
263               if (is_ip6)
264                 vlib_node_increment_counter (vm,
265                                              dpdk_esp6_encrypt_node.index,
266                                              ESP_ENCRYPT_ERROR_SEQ_CYCLED, 1);
267               else
268                 vlib_node_increment_counter (vm,
269                                              dpdk_esp4_encrypt_node.index,
270                                              ESP_ENCRYPT_ERROR_SEQ_CYCLED, 1);
271               //TODO: rekey SA
272               to_next[0] = bi0;
273               to_next += 1;
274               n_left_to_next -= 1;
275               goto trace;
276             }
277
278           orig_sz = b0->current_length;
279
280           /* TODO multi-seg support - total_length_not_including_first_buffer */
281           sa0->total_data_size += b0->current_length;
282
283           res->ops[res->n_ops] = op;
284           res->bi[res->n_ops] = bi0;
285           res->n_ops += 1;
286
287           dpdk_gcm_cnt_blk *icb = &priv->cb;
288
289           crypto_set_icb (icb, sa0->salt, sa0->seq, sa0->seq_hi);
290
291           iv_size = cipher_alg->iv_len;
292           trunc_size = auth_alg->trunc_size;
293
294           /* if UDP encapsulation is used adjust the address of the IP header */
295           if (sa0->udp_encap && !is_ip6)
296             udp_encap_adv = sizeof (udp_header_t);
297
298           if (sa0->is_tunnel)
299             {
300               rewrite_len = 0;
301               if (!is_ip6 && !sa0->is_tunnel_ip6)       /* ip4inip4 */
302                 {
303                   /* in tunnel mode send it back to FIB */
304                   priv->next = DPDK_CRYPTO_INPUT_NEXT_IP4_LOOKUP;
305                   u8 adv = sizeof (ip4_header_t) + udp_encap_adv +
306                     sizeof (esp_header_t) + iv_size;
307                   vlib_buffer_advance (b0, -adv);
308                   oh0 = vlib_buffer_get_current (b0);
309                   ouh0 = vlib_buffer_get_current (b0);
310                   next_hdr_type = IP_PROTOCOL_IP_IN_IP;
311                   /*
312                    * oh0->ip4.ip_version_and_header_length = 0x45;
313                    * oh0->ip4.tos = ih0->ip4.tos;
314                    * oh0->ip4.fragment_id = 0;
315                    * oh0->ip4.flags_and_fragment_offset = 0;
316                    */
317                   oh0->ip4.checksum_data_64[0] =
318                     clib_host_to_net_u64 (0x45ULL << 56);
319                   /*
320                    * oh0->ip4.ttl = 254;
321                    * oh0->ip4.protocol = IP_PROTOCOL_IPSEC_ESP;
322                    */
323                   oh0->ip4.checksum_data_32[2] =
324                     clib_host_to_net_u32 (0xfe320000);
325
326                   oh0->ip4.src_address.as_u32 =
327                     sa0->tunnel_src_addr.ip4.as_u32;
328                   oh0->ip4.dst_address.as_u32 =
329                     sa0->tunnel_dst_addr.ip4.as_u32;
330
331                   if (sa0->udp_encap)
332                     {
333                       oh0->ip4.protocol = IP_PROTOCOL_UDP;
334                       esp0 = &ouh0->esp;
335                     }
336                   else
337                     esp0 = &oh0->esp;
338                   esp0->spi = clib_host_to_net_u32 (sa0->spi);
339                   esp0->seq = clib_host_to_net_u32 (sa0->seq);
340                 }
341               else if (is_ip6 && sa0->is_tunnel_ip6)    /* ip6inip6 */
342                 {
343                   /* in tunnel mode send it back to FIB */
344                   priv->next = DPDK_CRYPTO_INPUT_NEXT_IP6_LOOKUP;
345
346                   u8 adv =
347                     sizeof (ip6_header_t) + sizeof (esp_header_t) + iv_size;
348                   vlib_buffer_advance (b0, -adv);
349                   ih6_0 = (ip6_and_esp_header_t *) ih0;
350                   oh6_0 = vlib_buffer_get_current (b0);
351
352                   next_hdr_type = IP_PROTOCOL_IPV6;
353
354                   oh6_0->ip6.ip_version_traffic_class_and_flow_label =
355                     ih6_0->ip6.ip_version_traffic_class_and_flow_label;
356
357                   oh6_0->ip6.protocol = IP_PROTOCOL_IPSEC_ESP;
358                   oh6_0->ip6.hop_limit = 254;
359                   oh6_0->ip6.src_address.as_u64[0] =
360                     sa0->tunnel_src_addr.ip6.as_u64[0];
361                   oh6_0->ip6.src_address.as_u64[1] =
362                     sa0->tunnel_src_addr.ip6.as_u64[1];
363                   oh6_0->ip6.dst_address.as_u64[0] =
364                     sa0->tunnel_dst_addr.ip6.as_u64[0];
365                   oh6_0->ip6.dst_address.as_u64[1] =
366                     sa0->tunnel_dst_addr.ip6.as_u64[1];
367                   esp0 = &oh6_0->esp;
368                   oh6_0->esp.spi = clib_host_to_net_u32 (sa0->spi);
369                   oh6_0->esp.seq = clib_host_to_net_u32 (sa0->seq);
370                 }
371               else              /* unsupported ip4inip6, ip6inip4 */
372                 {
373                   if (is_ip6)
374                     vlib_node_increment_counter (vm,
375                                                  dpdk_esp6_encrypt_node.index,
376                                                  ESP_ENCRYPT_ERROR_NOSUP, 1);
377                   else
378                     vlib_node_increment_counter (vm,
379                                                  dpdk_esp4_encrypt_node.index,
380                                                  ESP_ENCRYPT_ERROR_NOSUP, 1);
381                   to_next[0] = bi0;
382                   to_next += 1;
383                   n_left_to_next -= 1;
384                   goto trace;
385                 }
386               vnet_buffer (b0)->sw_if_index[VLIB_TX] = (u32) ~ 0;
387             }
388           else                  /* transport mode */
389             {
390               priv->next = DPDK_CRYPTO_INPUT_NEXT_INTERFACE_OUTPUT;
391               rewrite_len = vnet_buffer (b0)->ip.save_rewrite_length;
392               u16 adv = sizeof (esp_header_t) + iv_size + udp_encap_adv;
393               vlib_buffer_advance (b0, -adv - rewrite_len);
394               u8 *src = ((u8 *) ih0) - rewrite_len;
395               u8 *dst = vlib_buffer_get_current (b0);
396               oh0 = vlib_buffer_get_current (b0) + rewrite_len;
397
398               if (is_ip6)
399                 {
400                   orig_sz -= sizeof (ip6_header_t);
401                   ih6_0 = (ip6_and_esp_header_t *) ih0;
402                   next_hdr_type = ih6_0->ip6.protocol;
403                   memmove (dst, src, rewrite_len + sizeof (ip6_header_t));
404                   oh6_0 = (ip6_and_esp_header_t *) oh0;
405                   oh6_0->ip6.protocol = IP_PROTOCOL_IPSEC_ESP;
406                   esp0 = &oh6_0->esp;
407                 }
408               else              /* ipv4 */
409                 {
410                   u16 ip_size = ip4_header_bytes (&ih0->ip4);
411                   orig_sz -= ip_size;
412                   next_hdr_type = ih0->ip4.protocol;
413                   memmove (dst, src, rewrite_len + ip_size);
414                   oh0->ip4.protocol = IP_PROTOCOL_IPSEC_ESP;
415                   esp0 = (esp_header_t *) (((u8 *) oh0) + ip_size);
416                   if (sa0->udp_encap)
417                     {
418                       oh0->ip4.protocol = IP_PROTOCOL_UDP;
419                       esp0 = (esp_header_t *)
420                         (((u8 *) oh0) + ip_size + udp_encap_adv);
421                     }
422                   else
423                     {
424                       oh0->ip4.protocol = IP_PROTOCOL_IPSEC_ESP;
425                       esp0 = (esp_header_t *) (((u8 *) oh0) + ip_size);
426                     }
427                 }
428               esp0->spi = clib_host_to_net_u32 (sa0->spi);
429               esp0->seq = clib_host_to_net_u32 (sa0->seq);
430             }
431
432           if (sa0->udp_encap && ouh0)
433             {
434               ouh0->udp.src_port = clib_host_to_net_u16 (UDP_DST_PORT_ipsec);
435               ouh0->udp.dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipsec);
436               ouh0->udp.checksum = 0;
437             }
438           ASSERT (is_pow2 (cipher_alg->boundary));
439           u16 mask = cipher_alg->boundary - 1;
440           u16 pad_payload_len = ((orig_sz + 2) + mask) & ~mask;
441           u8 pad_bytes = pad_payload_len - 2 - orig_sz;
442
443           u8 *padding =
444             vlib_buffer_put_uninit (b0, pad_bytes + 2 + trunc_size);
445
446           /* The extra pad bytes would be overwritten by the digest */
447           if (pad_bytes)
448             clib_memcpy_fast (padding, pad_data, 16);
449
450           f0 = (esp_footer_t *) (padding + pad_bytes);
451           f0->pad_length = pad_bytes;
452           f0->next_header = next_hdr_type;
453
454           if (is_ip6)
455             {
456               u16 len = b0->current_length - sizeof (ip6_header_t);
457               oh6_0->ip6.payload_length =
458                 clib_host_to_net_u16 (len - rewrite_len);
459             }
460           else
461             {
462               oh0->ip4.length =
463                 clib_host_to_net_u16 (b0->current_length - rewrite_len);
464               oh0->ip4.checksum = ip4_header_checksum (&oh0->ip4);
465               if (sa0->udp_encap && ouh0)
466                 {
467                   ouh0->udp.length =
468                     clib_host_to_net_u16 (clib_net_to_host_u16
469                                           (ouh0->ip4.length) -
470                                           ip4_header_bytes (&ouh0->ip4));
471                 }
472             }
473
474           b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
475
476           /* mbuf packet starts at ESP header */
477           mb0->data_len = vlib_buffer_get_tail (b0) - ((u8 *) esp0);
478           mb0->pkt_len = vlib_buffer_get_tail (b0) - ((u8 *) esp0);
479           mb0->data_off = ((void *) esp0) - mb0->buf_addr;
480
481           u32 cipher_off, cipher_len, auth_len = 0;
482           u32 *aad = NULL;
483
484           u8 *digest = vlib_buffer_get_tail (b0) - trunc_size;
485           u64 digest_paddr =
486             mb0->buf_physaddr + digest - ((u8 *) mb0->buf_addr);
487
488           if (!is_aead && cipher_alg->alg == RTE_CRYPTO_CIPHER_AES_CBC)
489             {
490               cipher_off = sizeof (esp_header_t);
491               cipher_len = iv_size + pad_payload_len;
492             }
493           else                  /* CTR/GCM */
494             {
495               u32 *esp_iv = (u32 *) (esp0 + 1);
496               esp_iv[0] = sa0->seq;
497               esp_iv[1] = sa0->seq_hi;
498
499               cipher_off = sizeof (esp_header_t) + iv_size;
500               cipher_len = pad_payload_len;
501             }
502
503           if (is_aead)
504             {
505               aad = (u32 *) priv->aad;
506               aad[0] = clib_host_to_net_u32 (sa0->spi);
507               aad[1] = clib_host_to_net_u32 (sa0->seq);
508
509               /* aad[3] should always be 0 */
510               if (PREDICT_FALSE (sa0->use_esn))
511                 aad[2] = clib_host_to_net_u32 (sa0->seq_hi);
512               else
513                 aad[2] = 0;
514             }
515           else
516             {
517               auth_len =
518                 vlib_buffer_get_tail (b0) - ((u8 *) esp0) - trunc_size;
519               if (sa0->use_esn)
520                 {
521                   u32 *_digest = (u32 *) digest;
522                   _digest[0] = clib_host_to_net_u32 (sa0->seq_hi);
523                   auth_len += 4;
524                 }
525             }
526
527           crypto_op_setup (is_aead, mb0, op, session, cipher_off, cipher_len,
528                            0, auth_len, (u8 *) aad, digest, digest_paddr);
529
530         trace:
531           if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED))
532             {
533               esp_encrypt_trace_t *tr =
534                 vlib_add_trace (vm, node, b0, sizeof (*tr));
535               tr->crypto_alg = sa0->crypto_alg;
536               tr->integ_alg = sa0->integ_alg;
537               u8 *p = vlib_buffer_get_current (b0);
538               if (!sa0->is_tunnel)
539                 p += vnet_buffer (b0)->ip.save_rewrite_length;
540               clib_memcpy_fast (tr->packet_data, p, sizeof (tr->packet_data));
541             }
542         }
543       vlib_put_next_frame (vm, node, next_index, n_left_to_next);
544     }
545   if (is_ip6)
546     {
547       vlib_node_increment_counter (vm, dpdk_esp6_encrypt_node.index,
548                                    ESP_ENCRYPT_ERROR_RX_PKTS,
549                                    from_frame->n_vectors);
550
551       crypto_enqueue_ops (vm, cwm, dpdk_esp6_encrypt_node.index,
552                           ESP_ENCRYPT_ERROR_ENQ_FAIL, numa);
553     }
554   else
555     {
556       vlib_node_increment_counter (vm, dpdk_esp4_encrypt_node.index,
557                                    ESP_ENCRYPT_ERROR_RX_PKTS,
558                                    from_frame->n_vectors);
559
560       crypto_enqueue_ops (vm, cwm, dpdk_esp4_encrypt_node.index,
561                           ESP_ENCRYPT_ERROR_ENQ_FAIL, numa);
562     }
563
564   crypto_free_ops (numa, ops, cwm->ops + from_frame->n_vectors - ops);
565
566   return from_frame->n_vectors;
567 }
568
569 VLIB_NODE_FN (dpdk_esp4_encrypt_node) (vlib_main_t * vm,
570                                        vlib_node_runtime_t * node,
571                                        vlib_frame_t * from_frame)
572 {
573   return dpdk_esp_encrypt_inline (vm, node, from_frame, 0 /*is_ip6 */ );
574 }
575
576 /* *INDENT-OFF* */
577 VLIB_REGISTER_NODE (dpdk_esp4_encrypt_node) = {
578   .name = "dpdk-esp4-encrypt",
579   .flags = VLIB_NODE_FLAG_IS_OUTPUT,
580   .vector_size = sizeof (u32),
581   .format_trace = format_esp_encrypt_trace,
582   .n_errors = ARRAY_LEN (esp_encrypt_error_strings),
583   .error_strings = esp_encrypt_error_strings,
584   .n_next_nodes = 1,
585   .next_nodes =
586     {
587       [ESP_ENCRYPT_NEXT_DROP] = "error-drop",
588     }
589 };
590 /* *INDENT-ON* */
591
592 VLIB_NODE_FN (dpdk_esp6_encrypt_node) (vlib_main_t * vm,
593                                        vlib_node_runtime_t * node,
594                                        vlib_frame_t * from_frame)
595 {
596   return dpdk_esp_encrypt_inline (vm, node, from_frame, 1 /*is_ip6 */ );
597 }
598
599 /* *INDENT-OFF* */
600 VLIB_REGISTER_NODE (dpdk_esp6_encrypt_node) = {
601   .name = "dpdk-esp6-encrypt",
602   .flags = VLIB_NODE_FLAG_IS_OUTPUT,
603   .vector_size = sizeof (u32),
604   .format_trace = format_esp_encrypt_trace,
605   .n_errors = ARRAY_LEN (esp_encrypt_error_strings),
606   .error_strings = esp_encrypt_error_strings,
607   .n_next_nodes = 1,
608   .next_nodes =
609     {
610       [ESP_ENCRYPT_NEXT_DROP] = "error-drop",
611     }
612 };
613 /* *INDENT-ON* */
614
615 /*
616  * fd.io coding-style-patch-verification: ON
617  *
618  * Local Variables:
619  * eval: (c-set-style "gnu")
620  * End:
621  */