crypto/dpaax_sec: enable build without rte_security
[dpdk.git] / drivers / crypto / dpaa2_sec / dpaa2_sec_priv.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
4  *   Copyright 2016 NXP
5  *
6  */
7
8 #ifndef _RTE_DPAA2_SEC_PMD_PRIVATE_H_
9 #define _RTE_DPAA2_SEC_PMD_PRIVATE_H_
10
11 #ifdef RTE_LIBRTE_SECURITY
12 #include <rte_security_driver.h>
13 #endif
14
15 #define CRYPTODEV_NAME_DPAA2_SEC_PMD    crypto_dpaa2_sec
16 /**< NXP DPAA2 - SEC PMD device name */
17
18 #define MAX_QUEUES              64
19 #define MAX_DESC_SIZE           64
20 /** private data structure for each DPAA2_SEC device */
21 struct dpaa2_sec_dev_private {
22         void *mc_portal; /**< MC Portal for configuring this device */
23         void *hw; /**< Hardware handle for this device.Used by NADK framework */
24         struct rte_mempool *fle_pool; /* per device memory pool for FLE */
25         int32_t hw_id; /**< An unique ID of this device instance */
26         int32_t vfio_fd; /**< File descriptor received via VFIO */
27         uint16_t token; /**< Token required by DPxxx objects */
28         unsigned int max_nb_queue_pairs;
29         /**< Max number of queue pairs supported by device */
30 };
31
32 struct dpaa2_sec_qp {
33         struct dpaa2_queue rx_vq;
34         struct dpaa2_queue tx_vq;
35 };
36
37 enum shr_desc_type {
38         DESC_UPDATE,
39         DESC_FINAL,
40         DESC_INITFINAL,
41 };
42
43 #define DIR_ENC                 1
44 #define DIR_DEC                 0
45
46 #define DPAA2_IPv6_DEFAULT_VTC_FLOW     0x60000000
47
48 #define DPAA2_SET_FLC_EWS(flc)  (flc->word1_bits23_16 |= 0x1)
49 #define DPAA2_SET_FLC_RSC(flc)  (flc->word1_bits31_24 |= 0x1)
50 #define DPAA2_SET_FLC_REUSE_BS(flc) (flc->mode_bits |= 0x8000)
51 #define DPAA2_SET_FLC_REUSE_FF(flc) (flc->mode_bits |= 0x2000)
52
53 /* SEC Flow Context Descriptor */
54 struct sec_flow_context {
55         /* word 0 */
56         uint16_t word0_sdid;            /* 11-0  SDID */
57         uint16_t word0_res;             /* 31-12 reserved */
58
59         /* word 1 */
60         uint8_t word1_sdl;              /* 5-0 SDL */
61                                         /* 7-6 reserved */
62
63         uint8_t word1_bits_15_8;        /* 11-8 CRID */
64                                         /* 14-12 reserved */
65                                         /* 15 CRJD */
66
67         uint8_t word1_bits23_16;        /* 16  EWS */
68                                         /* 17 DAC */
69                                         /* 18,19,20 ? */
70                                         /* 23-21 reserved */
71
72         uint8_t word1_bits31_24;        /* 24 RSC */
73                                         /* 25 RBMT */
74                                         /* 31-26 reserved */
75
76         /* word 2  RFLC[31-0] */
77         uint32_t word2_rflc_31_0;
78
79         /* word 3  RFLC[63-32] */
80         uint32_t word3_rflc_63_32;
81
82         /* word 4 */
83         uint16_t word4_iicid;           /* 15-0  IICID */
84         uint16_t word4_oicid;           /* 31-16 OICID */
85
86         /* word 5 */
87         uint32_t word5_ofqid:24;                /* 23-0 OFQID */
88         uint32_t word5_31_24:8;
89                                         /* 24 OSC */
90                                         /* 25 OBMT */
91                                         /* 29-26 reserved */
92                                         /* 31-30 ICR */
93
94         /* word 6 */
95         uint32_t word6_oflc_31_0;
96
97         /* word 7 */
98         uint32_t word7_oflc_63_32;
99
100         /* Word 8-15 storage profiles */
101         uint16_t dl;                    /**<  DataLength(correction) */
102         uint16_t reserved;              /**< reserved */
103         uint16_t dhr;                   /**< DataHeadRoom(correction) */
104         uint16_t mode_bits;             /**< mode bits */
105         uint16_t bpv0;                  /**< buffer pool0 valid */
106         uint16_t bpid0;                 /**< Bypass Memory Translation */
107         uint16_t bpv1;                  /**< buffer pool1 valid */
108         uint16_t bpid1;                 /**< Bypass Memory Translation */
109         uint64_t word_12_15[2];         /**< word 12-15 are reserved */
110 };
111
112 struct sec_flc_desc {
113         struct sec_flow_context flc;
114         uint32_t desc[MAX_DESC_SIZE];
115 };
116
117 struct ctxt_priv {
118         struct rte_mempool *fle_pool; /* per device memory pool for FLE */
119         struct sec_flc_desc flc_desc[0];
120 };
121
122 enum dpaa2_sec_op_type {
123         DPAA2_SEC_NONE,  /*!< No Cipher operations*/
124         DPAA2_SEC_CIPHER,/*!< CIPHER operations */
125         DPAA2_SEC_AUTH,  /*!< Authentication Operations */
126         DPAA2_SEC_AEAD,  /*!< AEAD (AES-GCM/CCM) type operations */
127         DPAA2_SEC_CIPHER_HASH,  /*!< Authenticated Encryption with
128                                  * associated data
129                                  */
130         DPAA2_SEC_HASH_CIPHER,  /*!< Encryption with Authenticated
131                                  * associated data
132                                  */
133         DPAA2_SEC_IPSEC, /*!< IPSEC protocol operations*/
134         DPAA2_SEC_PDCP,  /*!< PDCP protocol operations*/
135         DPAA2_SEC_PKC,   /*!< Public Key Cryptographic Operations */
136         DPAA2_SEC_MAX
137 };
138
139 struct dpaa2_sec_aead_ctxt {
140         uint16_t auth_only_len; /*!< Length of data for Auth only */
141         uint8_t auth_cipher_text;       /**< Authenticate/cipher ordering */
142 };
143
144 #ifdef RTE_LIBRTE_SECURITY
145 /*
146  * The structure is to be filled by user for PDCP Protocol
147  */
148 struct dpaa2_pdcp_ctxt {
149         enum rte_security_pdcp_domain domain; /*!< Data/Control mode*/
150         int8_t bearer;  /*!< PDCP bearer ID */
151         int8_t pkt_dir;/*!< PDCP Frame Direction 0:UL 1:DL*/
152         int8_t hfn_ovd;/*!< Overwrite HFN per packet*/
153         uint8_t sn_size;        /*!< Sequence number size, 5/7/12/15/18 */
154         uint32_t hfn_ovd_offset;/*!< offset from rte_crypto_op at which
155                                  * per packet hfn is stored
156                                  */
157         uint32_t hfn;   /*!< Hyper Frame Number */
158         uint32_t hfn_threshold; /*!< HFN Threashold for key renegotiation */
159 };
160 #endif
161 typedef struct dpaa2_sec_session_entry {
162         void *ctxt;
163         uint8_t ctxt_type;
164         uint8_t dir;         /*!< Operation Direction */
165         enum rte_crypto_cipher_algorithm cipher_alg; /*!< Cipher Algorithm*/
166         enum rte_crypto_auth_algorithm auth_alg; /*!< Authentication Algorithm*/
167         enum rte_crypto_aead_algorithm aead_alg; /*!< AEAD Algorithm*/
168         union {
169                 struct {
170                         uint8_t *data;  /**< pointer to key data */
171                         size_t length;  /**< key length in bytes */
172                 } aead_key;
173                 struct {
174                         struct {
175                                 uint8_t *data;  /**< pointer to key data */
176                                 size_t length;  /**< key length in bytes */
177                         } cipher_key;
178                         struct {
179                                 uint8_t *data;  /**< pointer to key data */
180                                 size_t length;  /**< key length in bytes */
181                         } auth_key;
182                 };
183         };
184         union {
185                 struct {
186                         struct {
187                                 uint16_t length; /**< IV length in bytes */
188                                 uint16_t offset; /**< IV offset in bytes */
189                         } iv;
190                         uint16_t digest_length;
191                         uint8_t status;
192                         union {
193                                 struct dpaa2_sec_aead_ctxt aead_ctxt;
194                         } ext_params;
195                 };
196 #ifdef RTE_LIBRTE_SECURITY
197                 struct dpaa2_pdcp_ctxt pdcp;
198 #endif
199         };
200 } dpaa2_sec_session;
201
202 static const struct rte_cryptodev_capabilities dpaa2_sec_capabilities[] = {
203         {       /* MD5 HMAC */
204                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
205                 {.sym = {
206                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
207                         {.auth = {
208                                 .algo = RTE_CRYPTO_AUTH_MD5_HMAC,
209                                 .block_size = 64,
210                                 .key_size = {
211                                         .min = 1,
212                                         .max = 64,
213                                         .increment = 1
214                                 },
215                                 .digest_size = {
216                                         .min = 1,
217                                         .max = 16,
218                                         .increment = 1
219                                 },
220                                 .iv_size = { 0 }
221                         }, }
222                 }, }
223         },
224         {       /* SHA1 HMAC */
225                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
226                 {.sym = {
227                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
228                         {.auth = {
229                                 .algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
230                                 .block_size = 64,
231                                 .key_size = {
232                                         .min = 1,
233                                         .max = 64,
234                                         .increment = 1
235                                 },
236                                 .digest_size = {
237                                         .min = 1,
238                                         .max = 20,
239                                         .increment = 1
240                                 },
241                                 .iv_size = { 0 }
242                         }, }
243                 }, }
244         },
245         {       /* SHA224 HMAC */
246                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
247                 {.sym = {
248                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
249                         {.auth = {
250                                 .algo = RTE_CRYPTO_AUTH_SHA224_HMAC,
251                                 .block_size = 64,
252                                 .key_size = {
253                                         .min = 1,
254                                         .max = 64,
255                                         .increment = 1
256                                 },
257                                 .digest_size = {
258                                         .min = 1,
259                                         .max = 28,
260                                         .increment = 1
261                                 },
262                                 .iv_size = { 0 }
263                         }, }
264                 }, }
265         },
266         {       /* SHA256 HMAC */
267                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
268                 {.sym = {
269                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
270                         {.auth = {
271                                 .algo = RTE_CRYPTO_AUTH_SHA256_HMAC,
272                                 .block_size = 64,
273                                 .key_size = {
274                                         .min = 1,
275                                         .max = 64,
276                                         .increment = 1
277                                 },
278                                 .digest_size = {
279                                         .min = 1,
280                                         .max = 32,
281                                         .increment = 1
282                                 },
283                                 .iv_size = { 0 }
284                                 }, }
285                         }, }
286                 },
287         {       /* SHA384 HMAC */
288                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
289                 {.sym = {
290                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
291                         {.auth = {
292                                 .algo = RTE_CRYPTO_AUTH_SHA384_HMAC,
293                                 .block_size = 128,
294                                 .key_size = {
295                                         .min = 1,
296                                         .max = 128,
297                                         .increment = 1
298                                 },
299                                 .digest_size = {
300                                         .min = 1,
301                                         .max = 48,
302                                         .increment = 1
303                                 },
304                                 .iv_size = { 0 }
305                         }, }
306                 }, }
307         },
308         {       /* SHA512 HMAC */
309                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
310                 {.sym = {
311                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
312                         {.auth = {
313                                 .algo = RTE_CRYPTO_AUTH_SHA512_HMAC,
314                                 .block_size = 128,
315                                 .key_size = {
316                                         .min = 1,
317                                         .max = 128,
318                                         .increment = 1
319                                 },
320                                 .digest_size = {
321                                         .min = 1,
322                                         .max = 64,
323                                         .increment = 1
324                                 },
325                                 .iv_size = { 0 }
326                         }, }
327                 }, }
328         },
329         {       /* AES GCM */
330                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
331                 {.sym = {
332                         .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,
333                         {.aead = {
334                                 .algo = RTE_CRYPTO_AEAD_AES_GCM,
335                                 .block_size = 16,
336                                 .key_size = {
337                                         .min = 16,
338                                         .max = 32,
339                                         .increment = 8
340                                 },
341                                 .digest_size = {
342                                         .min = 8,
343                                         .max = 16,
344                                         .increment = 4
345                                 },
346                                 .aad_size = {
347                                         .min = 0,
348                                         .max = 240,
349                                         .increment = 1
350                                 },
351                                 .iv_size = {
352                                         .min = 12,
353                                         .max = 12,
354                                         .increment = 0
355                                 },
356                         }, }
357                 }, }
358         },
359         {       /* AES CBC */
360                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
361                 {.sym = {
362                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
363                         {.cipher = {
364                                 .algo = RTE_CRYPTO_CIPHER_AES_CBC,
365                                 .block_size = 16,
366                                 .key_size = {
367                                         .min = 16,
368                                         .max = 32,
369                                         .increment = 8
370                                 },
371                                 .iv_size = {
372                                         .min = 16,
373                                         .max = 16,
374                                         .increment = 0
375                                 }
376                         }, }
377                 }, }
378         },
379         {       /* AES CTR */
380                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
381                 {.sym = {
382                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
383                         {.cipher = {
384                                 .algo = RTE_CRYPTO_CIPHER_AES_CTR,
385                                 .block_size = 16,
386                                 .key_size = {
387                                         .min = 16,
388                                         .max = 32,
389                                         .increment = 8
390                                 },
391                                 .iv_size = {
392                                         .min = 16,
393                                         .max = 16,
394                                         .increment = 0
395                                 },
396                         }, }
397                 }, }
398         },
399         {       /* 3DES CBC */
400                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
401                 {.sym = {
402                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
403                         {.cipher = {
404                                 .algo = RTE_CRYPTO_CIPHER_3DES_CBC,
405                                 .block_size = 8,
406                                 .key_size = {
407                                         .min = 16,
408                                         .max = 24,
409                                         .increment = 8
410                                 },
411                                 .iv_size = {
412                                         .min = 8,
413                                         .max = 8,
414                                         .increment = 0
415                                 }
416                         }, }
417                 }, }
418         },
419         {       /* SNOW 3G (UIA2) */
420                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
421                 {.sym = {
422                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
423                         {.auth = {
424                                 .algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
425                                 .block_size = 16,
426                                 .key_size = {
427                                         .min = 16,
428                                         .max = 16,
429                                         .increment = 0
430                                 },
431                                 .digest_size = {
432                                         .min = 4,
433                                         .max = 4,
434                                         .increment = 0
435                                 },
436                                 .iv_size = {
437                                         .min = 16,
438                                         .max = 16,
439                                         .increment = 0
440                                 }
441                         }, }
442                 }, }
443         },
444         {       /* SNOW 3G (UEA2) */
445                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
446                 {.sym = {
447                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
448                         {.cipher = {
449                                 .algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
450                                 .block_size = 16,
451                                 .key_size = {
452                                         .min = 16,
453                                         .max = 16,
454                                         .increment = 0
455                                 },
456                                 .iv_size = {
457                                         .min = 16,
458                                         .max = 16,
459                                         .increment = 0
460                                 }
461                         }, }
462                 }, }
463         },
464         {       /* ZUC (EEA3) */
465                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
466                 {.sym = {
467                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
468                         {.cipher = {
469                                 .algo = RTE_CRYPTO_CIPHER_ZUC_EEA3,
470                                 .block_size = 16,
471                                 .key_size = {
472                                         .min = 16,
473                                         .max = 16,
474                                         .increment = 0
475                                 },
476                                 .iv_size = {
477                                         .min = 16,
478                                         .max = 16,
479                                         .increment = 0
480                                 }
481                         }, }
482                 }, }
483         },
484         {       /* ZUC (EIA3) */
485                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
486                 {.sym = {
487                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
488                         {.auth = {
489                                 .algo = RTE_CRYPTO_AUTH_ZUC_EIA3,
490                                 .block_size = 16,
491                                 .key_size = {
492                                         .min = 16,
493                                         .max = 16,
494                                         .increment = 0
495                                 },
496                                 .digest_size = {
497                                         .min = 4,
498                                         .max = 4,
499                                         .increment = 0
500                                 },
501                                 .iv_size = {
502                                         .min = 16,
503                                         .max = 16,
504                                         .increment = 0
505                                 }
506                         }, }
507                 }, }
508         },
509         RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
510 };
511
512 #ifdef RTE_LIBRTE_SECURITY
513
514 static const struct rte_cryptodev_capabilities dpaa2_pdcp_capabilities[] = {
515         {       /* SNOW 3G (UIA2) */
516                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
517                 {.sym = {
518                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
519                         {.auth = {
520                                 .algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2,
521                                 .block_size = 16,
522                                 .key_size = {
523                                         .min = 16,
524                                         .max = 16,
525                                         .increment = 0
526                                 },
527                                 .digest_size = {
528                                         .min = 4,
529                                         .max = 4,
530                                         .increment = 0
531                                 },
532                                 .iv_size = {
533                                         .min = 16,
534                                         .max = 16,
535                                         .increment = 0
536                                 }
537                         }, }
538                 }, }
539         },
540         {       /* SNOW 3G (UEA2) */
541                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
542                 {.sym = {
543                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
544                         {.cipher = {
545                                 .algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
546                                 .block_size = 16,
547                                 .key_size = {
548                                         .min = 16,
549                                         .max = 16,
550                                         .increment = 0
551                                 },
552                                 .iv_size = {
553                                         .min = 16,
554                                         .max = 16,
555                                         .increment = 0
556                                 }
557                         }, }
558                 }, }
559         },
560         {       /* AES CTR */
561                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
562                 {.sym = {
563                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
564                         {.cipher = {
565                                 .algo = RTE_CRYPTO_CIPHER_AES_CTR,
566                                 .block_size = 16,
567                                 .key_size = {
568                                         .min = 16,
569                                         .max = 32,
570                                         .increment = 8
571                                 },
572                                 .iv_size = {
573                                         .min = 16,
574                                         .max = 16,
575                                         .increment = 0
576                                 }
577                         }, }
578                 }, }
579         },
580         {       /* NULL (AUTH) */
581                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
582                 {.sym = {
583                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
584                         {.auth = {
585                                 .algo = RTE_CRYPTO_AUTH_NULL,
586                                 .block_size = 1,
587                                 .key_size = {
588                                         .min = 0,
589                                         .max = 0,
590                                         .increment = 0
591                                 },
592                                 .digest_size = {
593                                         .min = 0,
594                                         .max = 0,
595                                         .increment = 0
596                                 },
597                                 .iv_size = { 0 }
598                         }, },
599                 }, },
600         },
601         {       /* NULL (CIPHER) */
602                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
603                 {.sym = {
604                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
605                         {.cipher = {
606                                 .algo = RTE_CRYPTO_CIPHER_NULL,
607                                 .block_size = 1,
608                                 .key_size = {
609                                         .min = 0,
610                                         .max = 0,
611                                         .increment = 0
612                                 },
613                                 .iv_size = {
614                                         .min = 0,
615                                         .max = 0,
616                                         .increment = 0
617                                 }
618                         }, },
619                 }, }
620         },
621         {       /* ZUC (EEA3) */
622                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
623                 {.sym = {
624                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
625                         {.cipher = {
626                                 .algo = RTE_CRYPTO_CIPHER_ZUC_EEA3,
627                                 .block_size = 16,
628                                 .key_size = {
629                                         .min = 16,
630                                         .max = 16,
631                                         .increment = 0
632                                 },
633                                 .iv_size = {
634                                         .min = 16,
635                                         .max = 16,
636                                         .increment = 0
637                                 }
638                         }, }
639                 }, }
640         },
641         {       /* ZUC (EIA3) */
642                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
643                 {.sym = {
644                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
645                         {.auth = {
646                                 .algo = RTE_CRYPTO_AUTH_ZUC_EIA3,
647                                 .block_size = 16,
648                                 .key_size = {
649                                         .min = 16,
650                                         .max = 16,
651                                         .increment = 0
652                                 },
653                                 .digest_size = {
654                                         .min = 4,
655                                         .max = 4,
656                                         .increment = 0
657                                 },
658                                 .iv_size = {
659                                         .min = 16,
660                                         .max = 16,
661                                         .increment = 0
662                                 }
663                         }, }
664                 }, }
665         },
666
667         RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
668 };
669
670 static const struct rte_security_capability dpaa2_sec_security_cap[] = {
671         { /* IPsec Lookaside Protocol offload ESP Transport Egress */
672                 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
673                 .protocol = RTE_SECURITY_PROTOCOL_IPSEC,
674                 .ipsec = {
675                         .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
676                         .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
677                         .direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
678                         .options = { 0 }
679                 },
680                 .crypto_capabilities = dpaa2_sec_capabilities
681         },
682         { /* IPsec Lookaside Protocol offload ESP Tunnel Ingress */
683                 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
684                 .protocol = RTE_SECURITY_PROTOCOL_IPSEC,
685                 .ipsec = {
686                         .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
687                         .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
688                         .direction = RTE_SECURITY_IPSEC_SA_DIR_INGRESS,
689                         .options = { 0 }
690                 },
691                 .crypto_capabilities = dpaa2_sec_capabilities
692         },
693         { /* PDCP Lookaside Protocol offload Data */
694                 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
695                 .protocol = RTE_SECURITY_PROTOCOL_PDCP,
696                 .pdcp = {
697                         .domain = RTE_SECURITY_PDCP_MODE_DATA,
698                         .capa_flags = 0
699                 },
700                 .crypto_capabilities = dpaa2_pdcp_capabilities
701         },
702         { /* PDCP Lookaside Protocol offload Control */
703                 .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
704                 .protocol = RTE_SECURITY_PROTOCOL_PDCP,
705                 .pdcp = {
706                         .domain = RTE_SECURITY_PDCP_MODE_CONTROL,
707                         .capa_flags = 0
708                 },
709                 .crypto_capabilities = dpaa2_pdcp_capabilities
710         },
711         {
712                 .action = RTE_SECURITY_ACTION_TYPE_NONE
713         }
714 };
715 #endif
716 /**
717  * Checksum
718  *
719  * @param buffer calculate chksum for buffer
720  * @param len    buffer length
721  *
722  * @return checksum value in host cpu order
723  */
724 static inline uint16_t
725 calc_chksum(void *buffer, int len)
726 {
727         uint16_t *buf = (uint16_t *)buffer;
728         uint32_t sum = 0;
729         uint16_t result;
730
731         for (sum = 0; len > 1; len -= 2)
732                 sum += *buf++;
733
734         if (len == 1)
735                 sum += *(unsigned char *)buf;
736
737         sum = (sum >> 16) + (sum & 0xFFFF);
738         sum += (sum >> 16);
739         result = ~sum;
740
741         return  result;
742 }
743
744 #endif /* _RTE_DPAA2_SEC_PMD_PRIVATE_H_ */