crypto/mvsam: support AES ECB
[dpdk.git] / drivers / crypto / mvsam / rte_mrvl_pmd_ops.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Marvell International Ltd.
3  * Copyright(c) 2017 Semihalf.
4  * All rights reserved.
5  */
6
7 #include <string.h>
8
9 #include <rte_common.h>
10 #include <rte_malloc.h>
11 #include <rte_cryptodev_pmd.h>
12
13 #include "rte_mrvl_pmd_private.h"
14
15 /**
16  * Capabilities list to be used in reporting to DPDK.
17  */
18 static const struct rte_cryptodev_capabilities
19         mrvl_crypto_pmd_capabilities[] = {
20         {       /* MD5 HMAC */
21                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
22                 {.sym = {
23                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
24                         {.auth = {
25                                 .algo = RTE_CRYPTO_AUTH_MD5_HMAC,
26                                 .block_size = 64,
27                                 .key_size = {
28                                         .min = 1,
29                                         .max = 64,
30                                         .increment = 1
31                                 },
32                                 .digest_size = {
33                                         .min = 12,
34                                         .max = 16,
35                                         .increment = 4
36                                 },
37                         }, }
38                 }, }
39         },
40         {       /* MD5 */
41                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
42                         {.sym = {
43                                 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
44                                 {.auth = {
45                                         .algo = RTE_CRYPTO_AUTH_MD5,
46                                         .block_size = 64,
47                                         .key_size = {
48                                                 .min = 0,
49                                                 .max = 0,
50                                                 .increment = 0
51                                         },
52                                         .digest_size = {
53                                                 .min = 12,
54                                                 .max = 16,
55                                                 .increment = 4
56                                         },
57                                 }, }
58                         }, }
59         },
60         {       /* SHA1 HMAC */
61                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
62                         {.sym = {
63                                 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
64                                 {.auth = {
65                                         .algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
66                                         .block_size = 64,
67                                         .key_size = {
68                                                 .min = 1,
69                                                 .max = 64,
70                                                 .increment = 1
71                                         },
72                                         .digest_size = {
73                                                 .min = 12,
74                                                 .max = 20,
75                                                 .increment = 4
76                                         },
77                                 }, }
78                         }, }
79         },
80         {       /* SHA1 */
81                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
82                 {.sym = {
83                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
84                         {.auth = {
85                                 .algo = RTE_CRYPTO_AUTH_SHA1,
86                                 .block_size = 64,
87                                 .key_size = {
88                                         .min = 0,
89                                         .max = 0,
90                                         .increment = 0
91                                 },
92                                 .digest_size = {
93                                         .min = 12,
94                                         .max = 20,
95                                         .increment = 4
96                                 },
97                         }, }
98                 }, }
99         },
100         {
101                 /* SHA224 HMAC */
102                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
103                 {.sym = {
104                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
105                         {.auth = {
106                                 .algo = RTE_CRYPTO_AUTH_SHA224_HMAC,
107                                 .block_size = 64,
108                                 .key_size = {
109                                         .min = 1,
110                                         .max = 64,
111                                         .increment = 1
112                                 },
113                                 .digest_size = {
114                                         .min = 28,
115                                         .max = 28,
116                                         .increment = 0
117                                 },
118                         }, }
119                 }, }
120         },
121         {       /* SHA224 */
122                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
123                 {.sym = {
124                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
125                         {.auth = {
126                                 .algo = RTE_CRYPTO_AUTH_SHA224,
127                                 .block_size = 64,
128                                 .key_size = {
129                                         .min = 0,
130                                         .max = 0,
131                                         .increment = 0
132                                 },
133                                 .digest_size = {
134                                         .min = 12,
135                                         .max = 28,
136                                         .increment = 4
137                                 },
138                         }, }
139                 }, }
140         },
141         {       /* SHA256 HMAC */
142                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
143                         {.sym = {
144                                 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
145                                 {.auth = {
146                                         .algo = RTE_CRYPTO_AUTH_SHA256_HMAC,
147                                         .block_size = 64,
148                                         .key_size = {
149                                                 .min = 1,
150                                                 .max = 64,
151                                                 .increment = 1
152                                         },
153                                         .digest_size = {
154                                                 .min = 12,
155                                                 .max = 32,
156                                                 .increment = 4
157                                         },
158                                 }, }
159                         }, }
160         },
161         {       /* SHA256 */
162                         .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
163                         {.sym = {
164                                 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
165                                 {.auth = {
166                                         .algo = RTE_CRYPTO_AUTH_SHA256,
167                                         .block_size = 64,
168                                         .key_size = {
169                                                 .min = 0,
170                                                 .max = 0,
171                                                 .increment = 0
172                                         },
173                                         .digest_size = {
174                                                 .min = 12,
175                                                 .max = 32,
176                                                 .increment = 4
177                                         },
178                                 }, }
179                         }, }
180                 },
181         {       /* SHA384 HMAC */
182                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
183                 {.sym = {
184                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
185                         {.auth = {
186                                 .algo = RTE_CRYPTO_AUTH_SHA384_HMAC,
187                                 .block_size = 128,
188                                 .key_size = {
189                                         .min = 1,
190                                         .max = 128,
191                                         .increment = 1
192                                 },
193                                 .digest_size = {
194                                         .min = 12,
195                                         .max = 48,
196                                         .increment = 4
197                                 },
198                         }, }
199                 }, }
200         },
201         {       /* SHA384 */
202                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
203                 {.sym = {
204                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
205                         {.auth = {
206                                 .algo = RTE_CRYPTO_AUTH_SHA384,
207                                 .block_size = 128,
208                                 .key_size = {
209                                         .min = 0,
210                                         .max = 0,
211                                         .increment = 0
212                                 },
213                                 .digest_size = {
214                                         .min = 12,
215                                         .max = 48,
216                                         .increment = 4
217                                 },
218                         }, }
219                 }, }
220         },
221         {       /* SHA512 HMAC */
222                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
223                 {.sym = {
224                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
225                         {.auth = {
226                                 .algo = RTE_CRYPTO_AUTH_SHA512_HMAC,
227                                 .block_size = 128,
228                                 .key_size = {
229                                         .min = 1,
230                                         .max = 128,
231                                         .increment = 1
232                                 },
233                                 .digest_size = {
234                                         .min = 12,
235                                         .max = 48,
236                                         .increment = 4
237                                 },
238                         }, }
239                 }, }
240         },
241         {       /* SHA512  */
242                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
243                 {.sym = {
244                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
245                         {.auth = {
246                                 .algo = RTE_CRYPTO_AUTH_SHA512,
247                                 .block_size = 128,
248                                 .key_size = {
249                                         .min = 0,
250                                         .max = 0,
251                                         .increment = 0
252                                 },
253                                 .digest_size = {
254                                         .min = 12,
255                                         .max = 48,
256                                         .increment = 0
257                                 },
258                         }, }
259                 }, }
260         },
261         {       /* AES CBC */
262                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
263                         {.sym = {
264                                 .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
265                                 {.cipher = {
266                                         .algo = RTE_CRYPTO_CIPHER_AES_CBC,
267                                         .block_size = 16,
268                                         .key_size = {
269                                                 .min = 16,
270                                                 .max = 32,
271                                                 .increment = 8
272                                         },
273                                         .iv_size = {
274                                                 .min = 16,
275                                                 .max = 16,
276                                                 .increment = 0
277                                         }
278                                 }, }
279                         }, }
280         },
281         {       /* AES CTR */
282                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
283                 {.sym = {
284                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
285                         {.cipher = {
286                                 .algo = RTE_CRYPTO_CIPHER_AES_CTR,
287                                 .block_size = 16,
288                                 .key_size = {
289                                         .min = 16,
290                                         .max = 32,
291                                         .increment = 8
292                                 },
293                                 .iv_size = {
294                                         .min = 16,
295                                         .max = 16,
296                                         .increment = 0
297                                 }
298                         }, }
299                 }, }
300         },
301         {       /* AES ECB */
302                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
303                 {.sym = {
304                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
305                         {.cipher = {
306                                 .algo = RTE_CRYPTO_CIPHER_AES_ECB,
307                                 .block_size = 16,
308                                 .key_size = {
309                                         .min = 16,
310                                         .max = 32,
311                                         .increment = 8
312                                 },
313                                 .iv_size = {
314                                         .min = 0,
315                                         .max = 0,
316                                         .increment = 0
317                                 }
318                         }, }
319                 }, }
320         },
321         {       /* AES GCM */
322                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
323                 {.sym = {
324                         .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,
325                         {.aead = {
326                                 .algo = RTE_CRYPTO_AEAD_AES_GCM,
327                                 .block_size = 16,
328                                 .key_size = {
329                                         .min = 16,
330                                         .max = 32,
331                                         .increment = 8
332                                 },
333                                 .digest_size = {
334                                         .min = 16,
335                                         .max = 16,
336                                         .increment = 0
337                                 },
338                                 .aad_size = {
339                                         .min = 8,
340                                         .max = 12,
341                                         .increment = 4
342                                 },
343                                 .iv_size = {
344                                         .min = 12,
345                                         .max = 16,
346                                         .increment = 4
347                                 }
348                         }, }
349                 }, }
350         },
351         {       /* AES GMAC (AUTH) */
352                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
353                 {.sym = {
354                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
355                         {.auth = {
356                                 .algo = RTE_CRYPTO_AUTH_AES_GMAC,
357                                 .block_size = 16,
358                                 .key_size = {
359                                         .min = 16,
360                                         .max = 32,
361                                         .increment = 8
362                                 },
363                                 .digest_size = {
364                                         .min = 16,
365                                         .max = 16,
366                                         .increment = 0
367                                 },
368                                 .iv_size = {
369                                         .min = 8,
370                                         .max = 65532,
371                                         .increment = 4
372                                 }
373                         }, }
374                 }, }
375         },
376         {       /* 3DES CBC */
377                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
378                 {.sym = {
379                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
380                         {.cipher = {
381                                 .algo = RTE_CRYPTO_CIPHER_3DES_CBC,
382                                 .block_size = 8,
383                                 .key_size = {
384                                         .min = 24,
385                                         .max = 24,
386                                         .increment = 0
387                                 },
388                                 .iv_size = {
389                                         .min = 8,
390                                         .max = 8,
391                                         .increment = 0
392                                 }
393                         }, }
394                 }, }
395         },
396         {       /* 3DES CTR */
397                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
398                 {.sym = {
399                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
400                         {.cipher = {
401                                 .algo = RTE_CRYPTO_CIPHER_3DES_CTR,
402                                 .block_size = 8,
403                                 .key_size = {
404                                         .min = 24,
405                                         .max = 24,
406                                         .increment = 0
407                                 },
408                                 .iv_size = {
409                                         .min = 8,
410                                         .max = 8,
411                                         .increment = 0
412                                 }
413                         }, }
414                 }, }
415         },
416
417         RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
418 };
419
420
421 /**
422  * Configure device (PMD ops callback).
423  *
424  * @param dev Pointer to the device structure.
425  * @param config Pointer to configuration structure.
426  * @returns 0. Always.
427  */
428 static int
429 mrvl_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev,
430                 __rte_unused struct rte_cryptodev_config *config)
431 {
432         return 0;
433 }
434
435 /**
436  * Start device (PMD ops callback).
437  *
438  * @param dev Pointer to the device structure.
439  * @returns 0. Always.
440  */
441 static int
442 mrvl_crypto_pmd_start(__rte_unused struct rte_cryptodev *dev)
443 {
444         return 0;
445 }
446
447 /**
448  * Stop device (PMD ops callback).
449  *
450  * @param dev Pointer to the device structure.
451  * @returns 0. Always.
452  */
453 static void
454 mrvl_crypto_pmd_stop(__rte_unused struct rte_cryptodev *dev)
455 {
456 }
457
458 /**
459  * Get device statistics (PMD ops callback).
460  *
461  * @param dev Pointer to the device structure.
462  * @param stats Pointer to statistics structure [out].
463  */
464 static void
465 mrvl_crypto_pmd_stats_get(struct rte_cryptodev *dev,
466                 struct rte_cryptodev_stats *stats)
467 {
468         int qp_id;
469
470         for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
471                 struct mrvl_crypto_qp *qp = dev->data->queue_pairs[qp_id];
472
473                 stats->enqueued_count += qp->stats.enqueued_count;
474                 stats->dequeued_count += qp->stats.dequeued_count;
475
476                 stats->enqueue_err_count += qp->stats.enqueue_err_count;
477                 stats->dequeue_err_count += qp->stats.dequeue_err_count;
478         }
479 }
480
481 /**
482  * Reset device statistics (PMD ops callback).
483  *
484  * @param dev Pointer to the device structure.
485  */
486 static void
487 mrvl_crypto_pmd_stats_reset(struct rte_cryptodev *dev)
488 {
489         int qp_id;
490
491         for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
492                 struct mrvl_crypto_qp *qp = dev->data->queue_pairs[qp_id];
493
494                 memset(&qp->stats, 0, sizeof(qp->stats));
495         }
496 }
497
498 /**
499  * Get device info (PMD ops callback).
500  *
501  * @param dev Pointer to the device structure.
502  * @param dev_info Pointer to the device info structure [out].
503  */
504 static void
505 mrvl_crypto_pmd_info_get(struct rte_cryptodev *dev,
506                 struct rte_cryptodev_info *dev_info)
507 {
508         struct mrvl_crypto_private *internals = dev->data->dev_private;
509
510         if (dev_info != NULL) {
511                 dev_info->driver_id = dev->driver_id;
512                 dev_info->feature_flags = dev->feature_flags;
513                 dev_info->capabilities = mrvl_crypto_pmd_capabilities;
514                 dev_info->max_nb_queue_pairs = internals->max_nb_qpairs;
515                 dev_info->sym.max_nb_sessions = internals->max_nb_sessions;
516         }
517 }
518
519 /**
520  * Release queue pair (PMD ops callback).
521  *
522  * @param dev Pointer to the device structure.
523  * @param qp_id ID of Queue Pair to release.
524  * @returns 0. Always.
525  */
526 static int
527 mrvl_crypto_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
528 {
529         struct mrvl_crypto_qp *qp =
530                         (struct mrvl_crypto_qp *)dev->data->queue_pairs[qp_id];
531
532         if (dev->data->queue_pairs[qp_id] != NULL) {
533                 sam_cio_flush(qp->cio);
534                 sam_cio_deinit(qp->cio);
535                 rte_free(dev->data->queue_pairs[qp_id]);
536                 dev->data->queue_pairs[qp_id] = NULL;
537         }
538
539         return 0;
540 }
541
542 /**
543  * Close device (PMD ops callback).
544  *
545  * @param dev Pointer to the device structure.
546  * @returns 0. Always.
547  */
548 static int
549 mrvl_crypto_pmd_close(struct rte_cryptodev *dev)
550 {
551         int qp_id;
552
553         for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++)
554                 mrvl_crypto_pmd_qp_release(dev, qp_id);
555
556         return 0;
557 }
558
559 /**
560  * Setup a queue pair (PMD ops callback).
561  *
562  * @param dev Pointer to the device structure.
563  * @param qp_id ID of the Queue Pair.
564  * @param qp_conf Queue pair configuration (nb of descriptors).
565  * @param socket_id NUMA socket to allocate memory on.
566  * @returns 0 upon success, negative value otherwise.
567  */
568 static int
569 mrvl_crypto_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
570                 const struct rte_cryptodev_qp_conf *qp_conf,
571                 int socket_id, struct rte_mempool *session_pool)
572 {
573         struct mrvl_crypto_qp *qp = NULL;
574         char match[RTE_CRYPTODEV_NAME_MAX_LEN];
575         unsigned int n;
576
577         /* Allocate the queue pair data structure. */
578         qp = rte_zmalloc_socket("MRVL Crypto PMD Queue Pair", sizeof(*qp),
579                                         RTE_CACHE_LINE_SIZE, socket_id);
580         if (qp == NULL)
581                 return -ENOMEM;
582
583         /* Free old qp prior setup if needed. */
584         if (dev->data->queue_pairs[qp_id] != NULL)
585                 mrvl_crypto_pmd_qp_release(dev, qp_id);
586
587         do { /* Error handling block */
588
589                 /*
590                  * This extra check is necessary due to a bug in
591                  * crypto library.
592                  */
593                 int num = sam_get_num_inst();
594                 if (num == 0) {
595                         MRVL_CRYPTO_LOG_ERR("No crypto engines detected.\n");
596                         return -1;
597                 }
598
599                 /*
600                  * In case two crypto engines are enabled qps will
601                  * be evenly spread among them. Even and odd qps will
602                  * be handled by cio-0 and cio-1 respectively. qp-cio mapping
603                  * will look as follows:
604                  *
605                  * qp:      0        1        2        3
606                  * cio-x:y: cio-0:0, cio-1:0, cio-0:1, cio-1:1
607                  *
608                  * qp:      4        5        6        7
609                  * cio-x:y: cio-0:2, cio-1:2, cio-0:3, cio-1:3
610                  *
611                  * In case just one engine is enabled mapping will look as
612                  * follows:
613                  * qp:      0        1        2        3
614                  * cio-x:y: cio-0:0, cio-0:1, cio-0:2, cio-0:3
615                  */
616                 n = snprintf(match, sizeof(match), "cio-%u:%u",
617                                 qp_id % num, qp_id / num);
618
619                 if (n >= sizeof(match))
620                         break;
621
622                 qp->cio_params.match = match;
623                 qp->cio_params.size = qp_conf->nb_descriptors;
624
625                 if (sam_cio_init(&qp->cio_params, &qp->cio) < 0)
626                         break;
627
628                 qp->sess_mp = session_pool;
629
630                 memset(&qp->stats, 0, sizeof(qp->stats));
631                 dev->data->queue_pairs[qp_id] = qp;
632                 return 0;
633         } while (0);
634
635         rte_free(qp);
636         return -1;
637 }
638
639 /** Return the number of allocated queue pairs (PMD ops callback).
640  *
641  * @param dev Pointer to the device structure.
642  * @returns Number of allocated queue pairs.
643  */
644 static uint32_t
645 mrvl_crypto_pmd_qp_count(struct rte_cryptodev *dev)
646 {
647         return dev->data->nb_queue_pairs;
648 }
649
650 /** Returns the size of the session structure (PMD ops callback).
651  *
652  * @param dev Pointer to the device structure [Unused].
653  * @returns Size of Marvell crypto session.
654  */
655 static unsigned
656 mrvl_crypto_pmd_sym_session_get_size(__rte_unused struct rte_cryptodev *dev)
657 {
658         return sizeof(struct mrvl_crypto_session);
659 }
660
661 /** Configure the session from a crypto xform chain (PMD ops callback).
662  *
663  * @param dev Pointer to the device structure.
664  * @param xform Pointer to the crytpo configuration structure.
665  * @param sess Pointer to the empty session structure.
666  * @returns 0 upon success, negative value otherwise.
667  */
668 static int
669 mrvl_crypto_pmd_sym_session_configure(__rte_unused struct rte_cryptodev *dev,
670                 struct rte_crypto_sym_xform *xform,
671                 struct rte_cryptodev_sym_session *sess,
672                 struct rte_mempool *mp)
673 {
674         struct mrvl_crypto_session *mrvl_sess;
675         void *sess_private_data;
676         int ret;
677
678         if (sess == NULL) {
679                 MRVL_CRYPTO_LOG_ERR("Invalid session struct.");
680                 return -EINVAL;
681         }
682
683         if (rte_mempool_get(mp, &sess_private_data)) {
684                 CDEV_LOG_ERR("Couldn't get object from session mempool.");
685                 return -ENOMEM;
686         }
687
688         ret = mrvl_crypto_set_session_parameters(sess_private_data, xform);
689         if (ret != 0) {
690                 MRVL_CRYPTO_LOG_ERR("Failed to configure session parameters.");
691
692                 /* Return session to mempool */
693                 rte_mempool_put(mp, sess_private_data);
694                 return ret;
695         }
696
697         set_sym_session_private_data(sess, dev->driver_id, sess_private_data);
698
699         mrvl_sess = (struct mrvl_crypto_session *)sess_private_data;
700         if (sam_session_create(&mrvl_sess->sam_sess_params,
701                                 &mrvl_sess->sam_sess) < 0) {
702                 MRVL_CRYPTO_LOG_DBG("Failed to create session!");
703                 return -EIO;
704         }
705
706         return 0;
707 }
708
709 /**
710  * Clear the memory of session so it doesn't leave key material behind.
711  *
712  * @param dev Pointer to the device structure.
713  * @returns 0. Always.
714  */
715 static void
716 mrvl_crypto_pmd_sym_session_clear(struct rte_cryptodev *dev,
717                 struct rte_cryptodev_sym_session *sess)
718 {
719
720         uint8_t index = dev->driver_id;
721         void *sess_priv = get_sym_session_private_data(sess, index);
722
723         /* Zero out the whole structure */
724         if (sess_priv) {
725                 struct mrvl_crypto_session *mrvl_sess =
726                         (struct mrvl_crypto_session *)sess_priv;
727
728                 if (mrvl_sess->sam_sess &&
729                     sam_session_destroy(mrvl_sess->sam_sess) < 0) {
730                         MRVL_CRYPTO_LOG_INFO("Error while destroying session!");
731                 }
732
733                 memset(sess, 0, sizeof(struct mrvl_crypto_session));
734                 struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
735                 set_sym_session_private_data(sess, index, NULL);
736                 rte_mempool_put(sess_mp, sess_priv);
737         }
738 }
739
740 /**
741  * PMD handlers for crypto ops.
742  */
743 static struct rte_cryptodev_ops mrvl_crypto_pmd_ops = {
744                 .dev_configure          = mrvl_crypto_pmd_config,
745                 .dev_start              = mrvl_crypto_pmd_start,
746                 .dev_stop               = mrvl_crypto_pmd_stop,
747                 .dev_close              = mrvl_crypto_pmd_close,
748
749                 .dev_infos_get          = mrvl_crypto_pmd_info_get,
750
751                 .stats_get              = mrvl_crypto_pmd_stats_get,
752                 .stats_reset            = mrvl_crypto_pmd_stats_reset,
753
754                 .queue_pair_setup       = mrvl_crypto_pmd_qp_setup,
755                 .queue_pair_release     = mrvl_crypto_pmd_qp_release,
756                 .queue_pair_count       = mrvl_crypto_pmd_qp_count,
757
758                 .sym_session_get_size   = mrvl_crypto_pmd_sym_session_get_size,
759                 .sym_session_configure  = mrvl_crypto_pmd_sym_session_configure,
760                 .sym_session_clear      = mrvl_crypto_pmd_sym_session_clear
761 };
762
763 struct rte_cryptodev_ops *rte_mrvl_crypto_pmd_ops = &mrvl_crypto_pmd_ops;