1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (C) 2019 Marvell International Ltd.
4 #include <rte_cryptodev.h>
6 #include "otx2_cryptodev.h"
7 #include "otx2_cryptodev_mbox.h"
12 otx2_cpt_available_queues_get(const struct rte_cryptodev *dev,
15 struct otx2_cpt_vf *vf = dev->data->dev_private;
16 struct otx2_dev *otx2_dev = &vf->otx2_dev;
17 struct free_rsrcs_rsp *rsp;
20 otx2_mbox_alloc_msg_free_rsrc_cnt(otx2_dev->mbox);
22 ret = otx2_mbox_process_msg(otx2_dev->mbox, (void *)&rsp);
26 *nb_queues = rsp->cpt;
31 otx2_cpt_queues_attach(const struct rte_cryptodev *dev, uint8_t nb_queues)
33 struct otx2_cpt_vf *vf = dev->data->dev_private;
34 struct otx2_mbox *mbox = vf->otx2_dev.mbox;
35 struct rsrc_attach_req *req;
37 /* Ask AF to attach required LFs */
39 req = otx2_mbox_alloc_msg_attach_resources(mbox);
42 req->cptlfs = nb_queues;
44 if (otx2_mbox_process(mbox) < 0)
47 /* Update number of attached queues */
48 vf->nb_queues = nb_queues;
54 otx2_cpt_queues_detach(const struct rte_cryptodev *dev)
56 struct otx2_cpt_vf *vf = dev->data->dev_private;
57 struct otx2_mbox *mbox = vf->otx2_dev.mbox;
58 struct rsrc_detach_req *req;
60 req = otx2_mbox_alloc_msg_detach_resources(mbox);
63 if (otx2_mbox_process(mbox) < 0)
66 /* Queues have been detached */
73 otx2_cpt_msix_offsets_get(const struct rte_cryptodev *dev)
75 struct otx2_cpt_vf *vf = dev->data->dev_private;
76 struct otx2_mbox *mbox = vf->otx2_dev.mbox;
77 struct msix_offset_rsp *rsp;
80 /* Get CPT MSI-X vector offsets */
82 otx2_mbox_alloc_msg_msix_offset(mbox);
84 ret = otx2_mbox_process_msg(mbox, (void *)&rsp);
88 for (i = 0; i < vf->nb_queues; i++)
89 vf->lf_msixoff[i] = rsp->cptlf_msixoff[i];