cryptodev: add function to check queue pair status

This patch adds function that can check if queue pair
was already setup. This may be useful when dealing with
multi process approach in cryptodev.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
This commit is contained in:
Fiona Trahe 2020-06-24 16:26:53 +02:00 committed by Thomas Monjalon
parent 12e4f2b719
commit 21b6a35171
3 changed files with 49 additions and 0 deletions

View File

@ -1079,6 +1079,35 @@ rte_cryptodev_close(uint8_t dev_id)
return 0;
}
int
rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id)
{
struct rte_cryptodev *dev;
if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
return -EINVAL;
}
dev = &rte_crypto_devices[dev_id];
if (queue_pair_id >= dev->data->nb_queue_pairs) {
CDEV_LOG_ERR("Invalid queue_pair_id=%d", queue_pair_id);
return -EINVAL;
}
void **qps = dev->data->queue_pairs;
if (qps[queue_pair_id]) {
CDEV_LOG_DEBUG("qp %d on dev %d is initialised",
queue_pair_id, dev_id);
return 1;
}
CDEV_LOG_DEBUG("qp %d on dev %d is not initialised",
queue_pair_id, dev_id);
return 0;
}
int
rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id)

View File

@ -726,6 +726,23 @@ extern int
rte_cryptodev_queue_pair_setup(uint8_t dev_id, uint16_t queue_pair_id,
const struct rte_cryptodev_qp_conf *qp_conf, int socket_id);
/**
* Get the status of queue pairs setup on a specific crypto device
*
* @param dev_id Crypto device identifier.
* @param queue_pair_id The index of the queue pairs to set up. The
* value must be in the range [0, nb_queue_pair
* - 1] previously supplied to
* rte_cryptodev_configure().
* @return
* - 0: qp was not configured
* - 1: qp was configured
* - -EINVAL: device was not configured
*/
__rte_experimental
int
rte_cryptodev_get_qp_status(uint8_t dev_id, uint16_t queue_pair_id);
/**
* Get the number of queue pairs on a specific crypto device
*

View File

@ -103,4 +103,7 @@ EXPERIMENTAL {
__rte_cryptodev_trace_asym_session_clear;
__rte_cryptodev_trace_dequeue_burst;
__rte_cryptodev_trace_enqueue_burst;
# added in 20.08
rte_cryptodev_get_qp_status;
};