1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (C) 2019 Marvell International Ltd.
5 #include <rte_cryptodev_pmd.h>
7 #include "otx2_cryptodev.h"
8 #include "otx2_cryptodev_hw_access.h"
9 #include "otx2_cryptodev_mbox.h"
10 #include "otx2_cryptodev_ops.h"
11 #include "otx2_mbox.h"
13 #include "cpt_hw_types.h"
14 #include "cpt_pmd_logs.h"
19 otx2_cpt_dev_config(struct rte_cryptodev *dev,
20 struct rte_cryptodev_config *conf)
22 struct otx2_cpt_vf *vf = dev->data->dev_private;
25 if (conf->nb_queue_pairs > vf->max_queues) {
26 CPT_LOG_ERR("Invalid number of queue pairs requested");
30 dev->feature_flags &= ~conf->ff_disable;
32 /* Unregister error interrupts */
33 if (vf->err_intr_registered)
34 otx2_cpt_err_intr_unregister(dev);
38 ret = otx2_cpt_queues_detach(dev);
40 CPT_LOG_ERR("Could not detach CPT queues");
46 ret = otx2_cpt_queues_attach(dev, conf->nb_queue_pairs);
48 CPT_LOG_ERR("Could not attach CPT queues");
52 ret = otx2_cpt_msix_offsets_get(dev);
54 CPT_LOG_ERR("Could not get MSI-X offsets");
58 /* Register error interrupts */
59 ret = otx2_cpt_err_intr_register(dev);
61 CPT_LOG_ERR("Could not register error interrupts");
69 otx2_cpt_queues_detach(dev);
74 otx2_cpt_dev_start(struct rte_cryptodev *dev)
78 CPT_PMD_INIT_FUNC_TRACE();
84 otx2_cpt_dev_stop(struct rte_cryptodev *dev)
88 CPT_PMD_INIT_FUNC_TRACE();
92 otx2_cpt_dev_close(struct rte_cryptodev *dev)
94 struct otx2_cpt_vf *vf = dev->data->dev_private;
97 /* Unregister error interrupts */
98 if (vf->err_intr_registered)
99 otx2_cpt_err_intr_unregister(dev);
103 ret = otx2_cpt_queues_detach(dev);
105 CPT_LOG_ERR("Could not detach CPT queues");
112 otx2_cpt_dev_info_get(struct rte_cryptodev *dev,
113 struct rte_cryptodev_info *info)
115 struct otx2_cpt_vf *vf = dev->data->dev_private;
118 info->max_nb_queue_pairs = vf->max_queues;
119 info->feature_flags = dev->feature_flags;
120 info->capabilities = NULL;
121 info->sym.max_nb_sessions = 0;
122 info->driver_id = otx2_cryptodev_driver_id;
123 info->min_mbuf_headroom_req = OTX2_CPT_MIN_HEADROOM_REQ;
124 info->min_mbuf_tailroom_req = OTX2_CPT_MIN_TAILROOM_REQ;
128 struct rte_cryptodev_ops otx2_cpt_ops = {
129 /* Device control ops */
130 .dev_configure = otx2_cpt_dev_config,
131 .dev_start = otx2_cpt_dev_start,
132 .dev_stop = otx2_cpt_dev_stop,
133 .dev_close = otx2_cpt_dev_close,
134 .dev_infos_get = otx2_cpt_dev_info_get,
138 .queue_pair_setup = NULL,
139 .queue_pair_release = NULL,
140 .queue_pair_count = NULL,
142 /* Symmetric crypto ops */
143 .sym_session_get_size = NULL,
144 .sym_session_configure = NULL,
145 .sym_session_clear = NULL,