-static int qat_asym_qp_release(struct rte_cryptodev *dev,
- uint16_t queue_pair_id)
-{
- struct qat_asym_dev_private *qat_private = dev->data->dev_private;
- enum qat_device_gen qat_dev_gen = qat_private->qat_dev->qat_dev_gen;
-
- QAT_LOG(DEBUG, "Release asym qp %u on device %d",
- queue_pair_id, dev->data->dev_id);
-
- qat_private->qat_dev->qps_in_use[QAT_SERVICE_ASYMMETRIC][queue_pair_id]
- = NULL;
-
- return qat_qp_release(qat_dev_gen, (struct qat_qp **)
- &(dev->data->queue_pairs[queue_pair_id]));
-}
-
-static int qat_asym_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
- const struct rte_cryptodev_qp_conf *qp_conf,
- int socket_id)
-{
- struct qat_qp_config qat_qp_conf;
- struct qat_qp *qp;
- int ret = 0;
- uint32_t i;
-
- struct qat_qp **qp_addr =
- (struct qat_qp **)&(dev->data->queue_pairs[qp_id]);
- struct qat_asym_dev_private *qat_private = dev->data->dev_private;
- struct qat_pci_device *qat_dev = qat_private->qat_dev;
- const struct qat_qp_hw_data *asym_hw_qps =
- qat_gen_config[qat_private->qat_dev->qat_dev_gen]
- .qp_hw_data[QAT_SERVICE_ASYMMETRIC];
- const struct qat_qp_hw_data *qp_hw_data = asym_hw_qps + qp_id;
-
- /* If qp is already in use free ring memory and qp metadata. */
- if (*qp_addr != NULL) {
- ret = qat_asym_qp_release(dev, qp_id);
- if (ret < 0)
- return ret;
- }
- if (qp_id >= qat_qps_per_service(qat_dev, QAT_SERVICE_ASYMMETRIC)) {
- QAT_LOG(ERR, "qp_id %u invalid for this device", qp_id);
- return -EINVAL;
- }
-
- qat_qp_conf.hw = qp_hw_data;
- qat_qp_conf.cookie_size = sizeof(struct qat_asym_op_cookie);
- qat_qp_conf.nb_descriptors = qp_conf->nb_descriptors;
- qat_qp_conf.socket_id = socket_id;
- qat_qp_conf.service_str = "asym";
-
- ret = qat_qp_setup(qat_private->qat_dev, qp_addr, qp_id, &qat_qp_conf);
- if (ret != 0)
- return ret;
-
- /* store a link to the qp in the qat_pci_device */
- qat_private->qat_dev->qps_in_use[QAT_SERVICE_ASYMMETRIC][qp_id]
- = *qp_addr;
-
- qp = (struct qat_qp *)*qp_addr;
- qp->min_enq_burst_threshold = qat_private->min_enq_burst_threshold;
-
- for (i = 0; i < qp->nb_descriptors; i++) {
- int j;
-
- struct qat_asym_op_cookie __rte_unused *cookie =
- qp->op_cookies[i];
- cookie->input_addr = rte_mempool_virt2iova(cookie) +