xref: /dpdk/drivers/crypto/ipsec_mb/pmd_chacha_poly.c (revision 796de0616c326c4b6e9a9fd6b0a00584b366460d)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2021 Intel Corporation
3  */
4 
5 #include "pmd_chacha_poly_priv.h"
6 #include "pmd_aesni_mb_priv.h"
7 
8 struct rte_cryptodev_ops chacha20_poly1305_pmd_ops = {
9 	.dev_configure = ipsec_mb_config,
10 	.dev_start = ipsec_mb_start,
11 	.dev_stop = ipsec_mb_stop,
12 	.dev_close = ipsec_mb_close,
13 
14 	.stats_get = ipsec_mb_stats_get,
15 	.stats_reset = ipsec_mb_stats_reset,
16 
17 	.dev_infos_get = ipsec_mb_info_get,
18 
19 	.queue_pair_setup = ipsec_mb_qp_setup,
20 	.queue_pair_release = ipsec_mb_qp_release,
21 
22 	.sym_session_get_size = ipsec_mb_sym_session_get_size,
23 	.sym_session_configure = ipsec_mb_sym_session_configure,
24 	.sym_session_clear = ipsec_mb_sym_session_clear
25 };
26 
27 struct rte_cryptodev_ops *rte_chacha20_poly1305_pmd_ops =
28 						&chacha20_poly1305_pmd_ops;
29 
30 static int
chacha20_poly1305_probe(struct rte_vdev_device * vdev)31 chacha20_poly1305_probe(struct rte_vdev_device *vdev)
32 {
33 	return ipsec_mb_create(vdev, IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305);
34 }
35 
36 static struct rte_vdev_driver cryptodev_chacha20_poly1305_pmd_drv = {
37 	.probe = chacha20_poly1305_probe,
38 	.remove = ipsec_mb_remove
39 };
40 
41 static struct cryptodev_driver chacha20_poly1305_crypto_drv;
42 
43 RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_CHACHA20_POLY1305_PMD,
44 					cryptodev_chacha20_poly1305_pmd_drv);
45 RTE_PMD_REGISTER_ALIAS(CRYPTODEV_NAME_CHACHA20_POLY1305_PMD,
46 					cryptodev_chacha20_poly1305_pmd);
47 RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CHACHA20_POLY1305_PMD,
48 			       "max_nb_queue_pairs=<int> socket_id=<int>");
49 RTE_PMD_REGISTER_CRYPTO_DRIVER(chacha20_poly1305_crypto_drv,
50 				cryptodev_chacha20_poly1305_pmd_drv.driver,
51 				pmd_driver_id_chacha20_poly1305);
52 
53 /* Constructor function to register chacha20_poly1305 PMD */
RTE_INIT(ipsec_mb_register_chacha20_poly1305)54 RTE_INIT(ipsec_mb_register_chacha20_poly1305)
55 {
56 	struct ipsec_mb_internals *chacha_poly_data
57 		= &ipsec_mb_pmds[IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305];
58 
59 	chacha_poly_data->caps = chacha20_poly1305_capabilities;
60 	chacha_poly_data->dequeue_burst = aesni_mb_dequeue_burst;
61 	chacha_poly_data->feature_flags =
62 		RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
63 		RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
64 		RTE_CRYPTODEV_FF_IN_PLACE_SGL |
65 		RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
66 		RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT |
67 		RTE_CRYPTODEV_FF_SYM_CPU_CRYPTO |
68 		RTE_CRYPTODEV_FF_SYM_SESSIONLESS;
69 	chacha_poly_data->internals_priv_size = 0;
70 	chacha_poly_data->ops = &chacha20_poly1305_pmd_ops;
71 	chacha_poly_data->qp_priv_size = sizeof(struct aesni_mb_qp_data);
72 	chacha_poly_data->session_configure = aesni_mb_session_configure;
73 	chacha_poly_data->session_priv_size = sizeof(struct aesni_mb_session);
74 }
75