cryptodev: change device configuration API

This patch changes the device configuration API for rte_cryptodev_ops
function prototype, and update all cryptodev PMDs for this change.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
This commit is contained in:
Fan Zhang 2017-02-17 12:01:00 +00:00 committed by Pablo de Lara
parent 807418f263
commit 60e686c223
14 changed files with 35 additions and 19 deletions

View File

@ -76,10 +76,6 @@ Deprecation Notices
Target release for removal of the legacy API will be defined once most
PMDs have switched to rte_flow.
* ABI changes are planned for 17.05 in the ``rte_cryptodev_ops`` structure.
A pointer to a rte_cryptodev_config structure will be added to the
function prototype ``cryptodev_configure_t``, as a new parameter.
* cryptodev: A new parameter ``max_nb_sessions_per_qp`` will be added to
``rte_cryptodev_info.sym``. Some drivers may support limited number of
sessions per queue_pair. With this new parameter application will know

View File

@ -114,7 +114,8 @@ static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = {
/** Configure device */
static int
aesni_gcm_pmd_config(__rte_unused struct rte_cryptodev *dev)
aesni_gcm_pmd_config(__rte_unused struct rte_cryptodev *dev,
__rte_unused struct rte_cryptodev_config *config)
{
return 0;
}

View File

@ -233,7 +233,8 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = {
/** Configure device */
static int
aesni_mb_pmd_config(__rte_unused struct rte_cryptodev *dev)
aesni_mb_pmd_config(__rte_unused struct rte_cryptodev *dev,
__rte_unused struct rte_cryptodev_config *config)
{
return 0;
}

View File

@ -111,7 +111,8 @@ static const struct rte_cryptodev_capabilities
/** Configure device */
static int
armv8_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev)
armv8_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev,
__rte_unused struct rte_cryptodev_config *config)
{
return 0;
}

View File

@ -89,7 +89,8 @@ static const struct rte_cryptodev_capabilities kasumi_pmd_capabilities[] = {
/** Configure device */
static int
kasumi_pmd_config(__rte_unused struct rte_cryptodev *dev)
kasumi_pmd_config(__rte_unused struct rte_cryptodev *dev,
__rte_unused struct rte_cryptodev_config *config)
{
return 0;
}

View File

@ -85,7 +85,8 @@ static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] =
/** Configure device */
static int
null_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev)
null_crypto_pmd_config(__rte_unused struct rte_cryptodev *dev,
__rte_unused struct rte_cryptodev_config *config)
{
return 0;
}

View File

@ -449,7 +449,8 @@ static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
/** Configure device */
static int
openssl_pmd_config(__rte_unused struct rte_cryptodev *dev)
openssl_pmd_config(__rte_unused struct rte_cryptodev *dev,
__rte_unused struct rte_cryptodev_config *config)
{
return 0;
}

View File

@ -1326,10 +1326,11 @@ void qat_crypto_sym_session_init(struct rte_mempool *mp, void *sym_sess)
offsetof(struct rte_cryptodev_sym_session, _private);
}
int qat_dev_config(__rte_unused struct rte_cryptodev *dev)
int qat_dev_config(__rte_unused struct rte_cryptodev *dev,
__rte_unused struct rte_cryptodev_config *config)
{
PMD_INIT_FUNC_TRACE();
return -ENOTSUP;
return 0;
}
int qat_dev_start(__rte_unused struct rte_cryptodev *dev)

View File

@ -85,7 +85,8 @@ struct qat_pmd_private {
/**< Max number of sessions supported by device */
};
int qat_dev_config(struct rte_cryptodev *dev);
int qat_dev_config(struct rte_cryptodev *dev,
struct rte_cryptodev_config *config);
int qat_dev_start(struct rte_cryptodev *dev);
void qat_dev_stop(struct rte_cryptodev *dev);
int qat_dev_close(struct rte_cryptodev *dev);

View File

@ -43,7 +43,8 @@
/** Configure device */
static int
scheduler_pmd_config(struct rte_cryptodev *dev)
scheduler_pmd_config(struct rte_cryptodev *dev,
struct rte_cryptodev_config *config)
{
struct scheduler_ctx *sched_ctx = dev->data->dev_private;
uint32_t i;
@ -54,7 +55,8 @@ scheduler_pmd_config(struct rte_cryptodev *dev)
struct rte_cryptodev *slave_dev =
rte_cryptodev_pmd_get_dev(slave_dev_id);
ret = (*slave_dev->dev_ops->dev_configure)(slave_dev);
ret = (*slave_dev->dev_ops->dev_configure)(slave_dev,
config);
if (ret < 0)
break;
}

View File

@ -89,7 +89,8 @@ static const struct rte_cryptodev_capabilities snow3g_pmd_capabilities[] = {
/** Configure device */
static int
snow3g_pmd_config(__rte_unused struct rte_cryptodev *dev)
snow3g_pmd_config(__rte_unused struct rte_cryptodev *dev,
__rte_unused struct rte_cryptodev_config *config)
{
return 0;
}

View File

@ -89,7 +89,8 @@ static const struct rte_cryptodev_capabilities zuc_pmd_capabilities[] = {
/** Configure device */
static int
zuc_pmd_config(__rte_unused struct rte_cryptodev *dev)
zuc_pmd_config(__rte_unused struct rte_cryptodev *dev,
__rte_unused struct rte_cryptodev_config *config)
{
return 0;
}

View File

@ -957,6 +957,8 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
return -EBUSY;
}
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
/* Setup new number of queue pairs and reconfigure device. */
diag = rte_cryptodev_queue_pairs_config(dev, config->nb_queue_pairs,
config->socket_id);
@ -967,10 +969,14 @@ rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)
}
/* Setup Session mempool for device */
return rte_cryptodev_sym_session_pool_create(dev,
diag = rte_cryptodev_sym_session_pool_create(dev,
config->session_mp.nb_objs,
config->session_mp.cache_size,
config->socket_id);
if (diag != 0)
return diag;
return (*dev->dev_ops->dev_configure)(dev, config);
}

View File

@ -201,10 +201,12 @@ extern struct rte_cryptodev *rte_cryptodevs;
* Function used to configure device.
*
* @param dev Crypto device pointer
* config Crypto device configurations
*
* @return Returns 0 on success
*/
typedef int (*cryptodev_configure_t)(struct rte_cryptodev *dev);
typedef int (*cryptodev_configure_t)(struct rte_cryptodev *dev,
struct rte_cryptodev_config *config);
/**
* Function used to start a configured device.