73077e3d9dee3a7a9a4ee9be3bb62bded88c5d02
[dpdk.git] / drivers / crypto / kasumi / rte_kasumi_pmd.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2018 Intel Corporation
3  */
4
5 #include <rte_common.h>
6 #include <rte_hexdump.h>
7 #include <rte_cryptodev.h>
8 #include <rte_cryptodev_pmd.h>
9 #include <rte_bus_vdev.h>
10 #include <rte_malloc.h>
11 #include <rte_cpuflags.h>
12
13 #include "kasumi_pmd_private.h"
14
15 #define KASUMI_KEY_LENGTH 16
16 #define KASUMI_IV_LENGTH 8
17 #define KASUMI_MAX_BURST 4
18 #define BYTE_LEN 8
19
20 int kasumi_logtype_driver;
21 static uint8_t cryptodev_driver_id;
22
23 /** Get xform chain order. */
24 static enum kasumi_operation
25 kasumi_get_mode(const struct rte_crypto_sym_xform *xform)
26 {
27         if (xform == NULL)
28                 return KASUMI_OP_NOT_SUPPORTED;
29
30         if (xform->next)
31                 if (xform->next->next != NULL)
32                         return KASUMI_OP_NOT_SUPPORTED;
33
34         if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
35                 if (xform->next == NULL)
36                         return KASUMI_OP_ONLY_AUTH;
37                 else if (xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER)
38                         return KASUMI_OP_AUTH_CIPHER;
39                 else
40                         return KASUMI_OP_NOT_SUPPORTED;
41         }
42
43         if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER) {
44                 if (xform->next == NULL)
45                         return KASUMI_OP_ONLY_CIPHER;
46                 else if (xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH)
47                         return KASUMI_OP_CIPHER_AUTH;
48                 else
49                         return KASUMI_OP_NOT_SUPPORTED;
50         }
51
52         return KASUMI_OP_NOT_SUPPORTED;
53 }
54
55
56 /** Parse crypto xform chain and set private session parameters. */
57 int
58 kasumi_set_session_parameters(MB_MGR *mgr, struct kasumi_session *sess,
59                 const struct rte_crypto_sym_xform *xform)
60 {
61         const struct rte_crypto_sym_xform *auth_xform = NULL;
62         const struct rte_crypto_sym_xform *cipher_xform = NULL;
63         enum kasumi_operation mode;
64
65         /* Select Crypto operation - hash then cipher / cipher then hash */
66         mode = kasumi_get_mode(xform);
67
68         switch (mode) {
69         case KASUMI_OP_CIPHER_AUTH:
70                 auth_xform = xform->next;
71                 /* Fall-through */
72         case KASUMI_OP_ONLY_CIPHER:
73                 cipher_xform = xform;
74                 break;
75         case KASUMI_OP_AUTH_CIPHER:
76                 cipher_xform = xform->next;
77                 /* Fall-through */
78         case KASUMI_OP_ONLY_AUTH:
79                 auth_xform = xform;
80                 break;
81         case KASUMI_OP_NOT_SUPPORTED:
82         default:
83                 KASUMI_LOG(ERR, "Unsupported operation chain order parameter");
84                 return -ENOTSUP;
85         }
86
87         if (cipher_xform) {
88                 /* Only KASUMI F8 supported */
89                 if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_KASUMI_F8) {
90                         KASUMI_LOG(ERR, "Unsupported cipher algorithm ");
91                         return -ENOTSUP;
92                 }
93
94                 sess->cipher_iv_offset = cipher_xform->cipher.iv.offset;
95                 if (cipher_xform->cipher.iv.length != KASUMI_IV_LENGTH) {
96                         KASUMI_LOG(ERR, "Wrong IV length");
97                         return -EINVAL;
98                 }
99
100                 /* Initialize key */
101                 IMB_KASUMI_INIT_F8_KEY_SCHED(mgr, cipher_xform->cipher.key.data,
102                                 &sess->pKeySched_cipher);
103         }
104
105         if (auth_xform) {
106                 /* Only KASUMI F9 supported */
107                 if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_KASUMI_F9) {
108                         KASUMI_LOG(ERR, "Unsupported authentication");
109                         return -ENOTSUP;
110                 }
111
112                 if (auth_xform->auth.digest_length != KASUMI_DIGEST_LENGTH) {
113                         KASUMI_LOG(ERR, "Wrong digest length");
114                         return -EINVAL;
115                 }
116
117                 sess->auth_op = auth_xform->auth.op;
118
119                 /* Initialize key */
120                 IMB_KASUMI_INIT_F9_KEY_SCHED(mgr, auth_xform->auth.key.data,
121                                 &sess->pKeySched_hash);
122         }
123
124
125         sess->op = mode;
126
127         return 0;
128 }
129
130 /** Get KASUMI session. */
131 static struct kasumi_session *
132 kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
133 {
134         struct kasumi_session *sess = NULL;
135
136         if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
137                 if (likely(op->sym->session != NULL))
138                         sess = (struct kasumi_session *)
139                                         get_sym_session_private_data(
140                                         op->sym->session,
141                                         cryptodev_driver_id);
142         } else {
143                 void *_sess = NULL;
144                 void *_sess_private_data = NULL;
145
146                 if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
147                         return NULL;
148
149                 if (rte_mempool_get(qp->sess_mp_priv,
150                                 (void **)&_sess_private_data))
151                         return NULL;
152
153                 sess = (struct kasumi_session *)_sess_private_data;
154
155                 if (unlikely(kasumi_set_session_parameters(qp->mgr, sess,
156                                 op->sym->xform) != 0)) {
157                         rte_mempool_put(qp->sess_mp, _sess);
158                         rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
159                         sess = NULL;
160                 }
161                 op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
162                 set_sym_session_private_data(op->sym->session,
163                                 cryptodev_driver_id, _sess_private_data);
164         }
165
166         if (unlikely(sess == NULL))
167                 op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
168
169         return sess;
170 }
171
172 /** Encrypt/decrypt mbufs with same cipher key. */
173 static uint8_t
174 process_kasumi_cipher_op(struct kasumi_qp *qp, struct rte_crypto_op **ops,
175                 struct kasumi_session *session, uint8_t num_ops)
176 {
177         unsigned i;
178         uint8_t processed_ops = 0;
179         const void *src[num_ops];
180         void *dst[num_ops];
181         uint8_t *iv_ptr;
182         uint64_t iv[num_ops];
183         uint32_t num_bytes[num_ops];
184
185         for (i = 0; i < num_ops; i++) {
186                 src[i] = rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
187                                 (ops[i]->sym->cipher.data.offset >> 3);
188                 dst[i] = ops[i]->sym->m_dst ?
189                         rte_pktmbuf_mtod(ops[i]->sym->m_dst, uint8_t *) +
190                                 (ops[i]->sym->cipher.data.offset >> 3) :
191                         rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
192                                 (ops[i]->sym->cipher.data.offset >> 3);
193                 iv_ptr = rte_crypto_op_ctod_offset(ops[i], uint8_t *,
194                                 session->cipher_iv_offset);
195                 iv[i] = *((uint64_t *)(iv_ptr));
196                 num_bytes[i] = ops[i]->sym->cipher.data.length >> 3;
197
198                 processed_ops++;
199         }
200
201         if (processed_ops != 0)
202                 IMB_KASUMI_F8_N_BUFFER(qp->mgr, &session->pKeySched_cipher, iv,
203                         src, dst, num_bytes, processed_ops);
204
205         return processed_ops;
206 }
207
208 /** Encrypt/decrypt mbuf (bit level function). */
209 static uint8_t
210 process_kasumi_cipher_op_bit(struct kasumi_qp *qp, struct rte_crypto_op *op,
211                 struct kasumi_session *session)
212 {
213         uint8_t *src, *dst;
214         uint8_t *iv_ptr;
215         uint64_t iv;
216         uint32_t length_in_bits, offset_in_bits;
217
218         offset_in_bits = op->sym->cipher.data.offset;
219         src = rte_pktmbuf_mtod(op->sym->m_src, uint8_t *);
220         if (op->sym->m_dst == NULL)
221                 dst = src;
222         else
223                 dst = rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *);
224         iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,
225                         session->cipher_iv_offset);
226         iv = *((uint64_t *)(iv_ptr));
227         length_in_bits = op->sym->cipher.data.length;
228
229         IMB_KASUMI_F8_1_BUFFER_BIT(qp->mgr, &session->pKeySched_cipher, iv,
230                         src, dst, length_in_bits, offset_in_bits);
231
232         return 1;
233 }
234
235 /** Generate/verify hash from mbufs with same hash key. */
236 static int
237 process_kasumi_hash_op(struct kasumi_qp *qp, struct rte_crypto_op **ops,
238                 struct kasumi_session *session,
239                 uint8_t num_ops)
240 {
241         unsigned i;
242         uint8_t processed_ops = 0;
243         uint8_t *src, *dst;
244         uint32_t length_in_bits;
245         uint32_t num_bytes;
246
247         for (i = 0; i < num_ops; i++) {
248                 /* Data must be byte aligned */
249                 if ((ops[i]->sym->auth.data.offset % BYTE_LEN) != 0) {
250                         ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
251                         KASUMI_LOG(ERR, "Invalid Offset");
252                         break;
253                 }
254
255                 length_in_bits = ops[i]->sym->auth.data.length;
256
257                 src = rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) +
258                                 (ops[i]->sym->auth.data.offset >> 3);
259                 /* Direction from next bit after end of message */
260                 num_bytes = length_in_bits >> 3;
261
262                 if (session->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) {
263                         dst = qp->temp_digest;
264                         IMB_KASUMI_F9_1_BUFFER(qp->mgr,
265                                         &session->pKeySched_hash, src,
266                                         num_bytes, dst);
267
268                         /* Verify digest. */
269                         if (memcmp(dst, ops[i]->sym->auth.digest.data,
270                                         KASUMI_DIGEST_LENGTH) != 0)
271                                 ops[i]->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
272                 } else  {
273                         dst = ops[i]->sym->auth.digest.data;
274
275                         IMB_KASUMI_F9_1_BUFFER(qp->mgr,
276                                         &session->pKeySched_hash, src,
277                                         num_bytes, dst);
278                 }
279                 processed_ops++;
280         }
281
282         return processed_ops;
283 }
284
285 /** Process a batch of crypto ops which shares the same session. */
286 static int
287 process_ops(struct rte_crypto_op **ops, struct kasumi_session *session,
288                 struct kasumi_qp *qp, uint8_t num_ops,
289                 uint16_t *accumulated_enqueued_ops)
290 {
291         unsigned i;
292         unsigned enqueued_ops, processed_ops;
293
294         switch (session->op) {
295         case KASUMI_OP_ONLY_CIPHER:
296                 processed_ops = process_kasumi_cipher_op(qp, ops,
297                                 session, num_ops);
298                 break;
299         case KASUMI_OP_ONLY_AUTH:
300                 processed_ops = process_kasumi_hash_op(qp, ops, session,
301                                 num_ops);
302                 break;
303         case KASUMI_OP_CIPHER_AUTH:
304                 processed_ops = process_kasumi_cipher_op(qp, ops, session,
305                                 num_ops);
306                 process_kasumi_hash_op(qp, ops, session, processed_ops);
307                 break;
308         case KASUMI_OP_AUTH_CIPHER:
309                 processed_ops = process_kasumi_hash_op(qp, ops, session,
310                                 num_ops);
311                 process_kasumi_cipher_op(qp, ops, session, processed_ops);
312                 break;
313         default:
314                 /* Operation not supported. */
315                 processed_ops = 0;
316         }
317
318         for (i = 0; i < num_ops; i++) {
319                 /*
320                  * If there was no error/authentication failure,
321                  * change status to successful.
322                  */
323                 if (ops[i]->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)
324                         ops[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
325                 /* Free session if a session-less crypto op. */
326                 if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
327                         memset(session, 0, sizeof(struct kasumi_session));
328                         memset(ops[i]->sym->session, 0,
329                         rte_cryptodev_sym_get_existing_header_session_size(
330                                         ops[i]->sym->session));
331                         rte_mempool_put(qp->sess_mp_priv, session);
332                         rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
333                         ops[i]->sym->session = NULL;
334                 }
335         }
336
337         enqueued_ops = rte_ring_enqueue_burst(qp->processed_ops,
338                                 (void **)ops, processed_ops, NULL);
339         qp->qp_stats.enqueued_count += enqueued_ops;
340         *accumulated_enqueued_ops += enqueued_ops;
341
342         return enqueued_ops;
343 }
344
345 /** Process a crypto op with length/offset in bits. */
346 static int
347 process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session,
348                 struct kasumi_qp *qp, uint16_t *accumulated_enqueued_ops)
349 {
350         unsigned enqueued_op, processed_op;
351
352         switch (session->op) {
353         case KASUMI_OP_ONLY_CIPHER:
354                 processed_op = process_kasumi_cipher_op_bit(qp, op,
355                                 session);
356                 break;
357         case KASUMI_OP_ONLY_AUTH:
358                 processed_op = process_kasumi_hash_op(qp, &op, session, 1);
359                 break;
360         case KASUMI_OP_CIPHER_AUTH:
361                 processed_op = process_kasumi_cipher_op_bit(qp, op, session);
362                 if (processed_op == 1)
363                         process_kasumi_hash_op(qp, &op, session, 1);
364                 break;
365         case KASUMI_OP_AUTH_CIPHER:
366                 processed_op = process_kasumi_hash_op(qp, &op, session, 1);
367                 if (processed_op == 1)
368                         process_kasumi_cipher_op_bit(qp, op, session);
369                 break;
370         default:
371                 /* Operation not supported. */
372                 processed_op = 0;
373         }
374
375         /*
376          * If there was no error/authentication failure,
377          * change status to successful.
378          */
379         if (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)
380                 op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
381
382         /* Free session if a session-less crypto op. */
383         if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
384                 memset(op->sym->session, 0, sizeof(struct kasumi_session));
385                 rte_cryptodev_sym_session_free(op->sym->session);
386                 op->sym->session = NULL;
387         }
388
389         enqueued_op = rte_ring_enqueue_burst(qp->processed_ops, (void **)&op,
390                                 processed_op, NULL);
391         qp->qp_stats.enqueued_count += enqueued_op;
392         *accumulated_enqueued_ops += enqueued_op;
393
394         return enqueued_op;
395 }
396
397 static uint16_t
398 kasumi_pmd_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops,
399                 uint16_t nb_ops)
400 {
401         struct rte_crypto_op *c_ops[nb_ops];
402         struct rte_crypto_op *curr_c_op;
403
404         struct kasumi_session *prev_sess = NULL, *curr_sess = NULL;
405         struct kasumi_qp *qp = queue_pair;
406         unsigned i;
407         uint8_t burst_size = 0;
408         uint16_t enqueued_ops = 0;
409         uint8_t processed_ops;
410
411         for (i = 0; i < nb_ops; i++) {
412                 curr_c_op = ops[i];
413
414 #ifdef RTE_LIBRTE_PMD_KASUMI_DEBUG
415                 if (!rte_pktmbuf_is_contiguous(curr_c_op->sym->m_src) ||
416                                 (curr_c_op->sym->m_dst != NULL &&
417                                 !rte_pktmbuf_is_contiguous(
418                                                 curr_c_op->sym->m_dst))) {
419                         KASUMI_LOG(ERR, "PMD supports only contiguous mbufs, "
420                                 "op (%p) provides noncontiguous mbuf as "
421                                 "source/destination buffer.", curr_c_op);
422                         curr_c_op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
423                         break;
424                 }
425 #endif
426
427                 /* Set status as enqueued (not processed yet) by default. */
428                 curr_c_op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
429
430                 curr_sess = kasumi_get_session(qp, curr_c_op);
431                 if (unlikely(curr_sess == NULL ||
432                                 curr_sess->op == KASUMI_OP_NOT_SUPPORTED)) {
433                         curr_c_op->status =
434                                         RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
435                         break;
436                 }
437
438                 /* If length/offset is at bit-level, process this buffer alone. */
439                 if (((curr_c_op->sym->cipher.data.length % BYTE_LEN) != 0)
440                                 || ((ops[i]->sym->cipher.data.offset
441                                         % BYTE_LEN) != 0)) {
442                         /* Process the ops of the previous session. */
443                         if (prev_sess != NULL) {
444                                 processed_ops = process_ops(c_ops, prev_sess,
445                                                 qp, burst_size, &enqueued_ops);
446                                 if (processed_ops < burst_size) {
447                                         burst_size = 0;
448                                         break;
449                                 }
450
451                                 burst_size = 0;
452                                 prev_sess = NULL;
453                         }
454
455                         processed_ops = process_op_bit(curr_c_op, curr_sess,
456                                                 qp, &enqueued_ops);
457                         if (processed_ops != 1)
458                                 break;
459
460                         continue;
461                 }
462
463                 /* Batch ops that share the same session. */
464                 if (prev_sess == NULL) {
465                         prev_sess = curr_sess;
466                         c_ops[burst_size++] = curr_c_op;
467                 } else if (curr_sess == prev_sess) {
468                         c_ops[burst_size++] = curr_c_op;
469                         /*
470                          * When there are enough ops to process in a batch,
471                          * process them, and start a new batch.
472                          */
473                         if (burst_size == KASUMI_MAX_BURST) {
474                                 processed_ops = process_ops(c_ops, prev_sess,
475                                                 qp, burst_size, &enqueued_ops);
476                                 if (processed_ops < burst_size) {
477                                         burst_size = 0;
478                                         break;
479                                 }
480
481                                 burst_size = 0;
482                                 prev_sess = NULL;
483                         }
484                 } else {
485                         /*
486                          * Different session, process the ops
487                          * of the previous session.
488                          */
489                         processed_ops = process_ops(c_ops, prev_sess,
490                                         qp, burst_size, &enqueued_ops);
491                         if (processed_ops < burst_size) {
492                                 burst_size = 0;
493                                 break;
494                         }
495
496                         burst_size = 0;
497                         prev_sess = curr_sess;
498
499                         c_ops[burst_size++] = curr_c_op;
500                 }
501         }
502
503         if (burst_size != 0) {
504                 /* Process the crypto ops of the last session. */
505                 processed_ops = process_ops(c_ops, prev_sess,
506                                 qp, burst_size, &enqueued_ops);
507         }
508
509         qp->qp_stats.enqueue_err_count += nb_ops - enqueued_ops;
510         return enqueued_ops;
511 }
512
513 static uint16_t
514 kasumi_pmd_dequeue_burst(void *queue_pair,
515                 struct rte_crypto_op **c_ops, uint16_t nb_ops)
516 {
517         struct kasumi_qp *qp = queue_pair;
518
519         unsigned nb_dequeued;
520
521         nb_dequeued = rte_ring_dequeue_burst(qp->processed_ops,
522                         (void **)c_ops, nb_ops, NULL);
523         qp->qp_stats.dequeued_count += nb_dequeued;
524
525         return nb_dequeued;
526 }
527
528 static int cryptodev_kasumi_remove(struct rte_vdev_device *vdev);
529
530 static int
531 cryptodev_kasumi_create(const char *name,
532                         struct rte_vdev_device *vdev,
533                         struct rte_cryptodev_pmd_init_params *init_params)
534 {
535         struct rte_cryptodev *dev;
536         struct kasumi_private *internals;
537         MB_MGR *mgr;
538
539         dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params);
540         if (dev == NULL) {
541                 KASUMI_LOG(ERR, "failed to create cryptodev vdev");
542                 goto init_error;
543         }
544
545         dev->driver_id = cryptodev_driver_id;
546         dev->dev_ops = rte_kasumi_pmd_ops;
547
548         /* Register RX/TX burst functions for data path. */
549         dev->dequeue_burst = kasumi_pmd_dequeue_burst;
550         dev->enqueue_burst = kasumi_pmd_enqueue_burst;
551
552         dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
553                         RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
554                         RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA |
555                         RTE_CRYPTODEV_FF_SYM_SESSIONLESS;
556
557         mgr = alloc_mb_mgr(0);
558         if (mgr == NULL)
559                 return -ENOMEM;
560
561         if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX)) {
562                 dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX;
563                 init_mb_mgr_avx(mgr);
564         } else {
565                 dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_SSE;
566                 init_mb_mgr_sse(mgr);
567         }
568
569         internals = dev->data->dev_private;
570
571         internals->max_nb_queue_pairs = init_params->max_nb_queue_pairs;
572         internals->mgr = mgr;
573
574         return 0;
575 init_error:
576         KASUMI_LOG(ERR, "driver %s: failed",
577                         init_params->name);
578
579         cryptodev_kasumi_remove(vdev);
580         return -EFAULT;
581 }
582
583 static int
584 cryptodev_kasumi_probe(struct rte_vdev_device *vdev)
585 {
586         struct rte_cryptodev_pmd_init_params init_params = {
587                 "",
588                 sizeof(struct kasumi_private),
589                 rte_socket_id(),
590                 RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS
591         };
592         const char *name;
593         const char *input_args;
594
595         name = rte_vdev_device_name(vdev);
596         if (name == NULL)
597                 return -EINVAL;
598         input_args = rte_vdev_device_args(vdev);
599
600         rte_cryptodev_pmd_parse_input_args(&init_params, input_args);
601
602         return cryptodev_kasumi_create(name, vdev, &init_params);
603 }
604
605 static int
606 cryptodev_kasumi_remove(struct rte_vdev_device *vdev)
607 {
608         struct rte_cryptodev *cryptodev;
609         const char *name;
610         struct kasumi_private *internals;
611
612         name = rte_vdev_device_name(vdev);
613         if (name == NULL)
614                 return -EINVAL;
615
616         cryptodev = rte_cryptodev_pmd_get_named_dev(name);
617         if (cryptodev == NULL)
618                 return -ENODEV;
619
620         internals = cryptodev->data->dev_private;
621
622         free_mb_mgr(internals->mgr);
623
624         return rte_cryptodev_pmd_destroy(cryptodev);
625 }
626
627 static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
628         .probe = cryptodev_kasumi_probe,
629         .remove = cryptodev_kasumi_remove
630 };
631
632 static struct cryptodev_driver kasumi_crypto_drv;
633
634 RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd_drv);
635 RTE_PMD_REGISTER_ALIAS(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd);
636 RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD,
637         "max_nb_queue_pairs=<int> "
638         "socket_id=<int>");
639 RTE_PMD_REGISTER_CRYPTO_DRIVER(kasumi_crypto_drv,
640                 cryptodev_kasumi_pmd_drv.driver, cryptodev_driver_id);
641
642 RTE_INIT(kasumi_init_log)
643 {
644         kasumi_logtype_driver = rte_log_register("pmd.crypto.kasumi");
645 }