cryptodev: change attach session to queue pair API

Device id is going to be removed from session,
as the session will be device independent.
Therefore, the functions that attach/dettach a session
to a queue pair need to be updated, to accept the device id
as a parameter, apart from the queue pair id and the session.

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
This commit is contained in:
Slawomir Mrozowicz 2017-07-05 06:26:13 +01:00 committed by Pablo de Lara
parent 2c59bd32b7
commit cdeaf42ad2
5 changed files with 20 additions and 20 deletions

View File

@ -65,12 +65,6 @@ Deprecation Notices
- ``rte_cryptodev_sym_session_free`` - ``rte_cryptodev_sym_session_free``
- ``rte_cryptodev_sym_session_pool_create`` - ``rte_cryptodev_sym_session_pool_create``
While dev_id will not be stored in the ``struct rte_cryptodev_sym_session``,
directly, the change of followed API is required:
- ``rte_cryptodev_queue_pair_attach_sym_session``
- ``rte_cryptodev_queue_pair_detach_sym_session``
* librte_table: The ``key_mask`` parameter will be added to all the hash tables * librte_table: The ``key_mask`` parameter will be added to all the hash tables
that currently do not have it, as well as to the hash compute function prototype. that currently do not have it, as well as to the hash compute function prototype.
The non-"do-sig" versions of the hash tables will be removed The non-"do-sig" versions of the hash tables will be removed

View File

@ -219,6 +219,9 @@ API Changes
These names are not public anymore. These names are not public anymore.
* ``rte_cryptodev_configure()`` does not create the session mempool * ``rte_cryptodev_configure()`` does not create the session mempool
for the device anymore. for the device anymore.
* ``rte_cryptodev_queue_pair_attach_sym_session()`` and
``rte_cryptodev_queue_pair_dettach_sym_session()`` functions require
the new parameter ``device id``.
ABI Changes ABI Changes

View File

@ -77,6 +77,7 @@ create_session(struct ipsec_ctx *ipsec_ctx __rte_unused, struct ipsec_sa *sa)
rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id, &cdev_info); rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id, &cdev_info);
if (cdev_info.sym.max_nb_sessions_per_qp > 0) { if (cdev_info.sym.max_nb_sessions_per_qp > 0) {
ret = rte_cryptodev_queue_pair_attach_sym_session( ret = rte_cryptodev_queue_pair_attach_sym_session(
ipsec_ctx->tbl[cdev_id_qp].id,
ipsec_ctx->tbl[cdev_id_qp].qp, ipsec_ctx->tbl[cdev_id_qp].qp,
sa->crypto_session); sa->crypto_session);
if (ret < 0) { if (ret < 0) {

View File

@ -1136,23 +1136,23 @@ rte_cryptodev_sym_session_create(uint8_t dev_id,
} }
int int
rte_cryptodev_queue_pair_attach_sym_session(uint16_t qp_id, rte_cryptodev_queue_pair_attach_sym_session(uint8_t dev_id, uint16_t qp_id,
struct rte_cryptodev_sym_session *sess) struct rte_cryptodev_sym_session *sess)
{ {
struct rte_cryptodev *dev; struct rte_cryptodev *dev;
if (!rte_cryptodev_pmd_is_valid_dev(sess->dev_id)) { if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
CDEV_LOG_ERR("Invalid dev_id=%d", sess->dev_id); CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
return -EINVAL; return -EINVAL;
} }
dev = &rte_crypto_devices[sess->dev_id]; dev = &rte_crypto_devices[dev_id];
/* The API is optional, not returning error if driver do not suuport */ /* The API is optional, not returning error if driver do not suuport */
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->qp_attach_session, 0); RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->qp_attach_session, 0);
if (dev->dev_ops->qp_attach_session(dev, qp_id, sess->_private)) { if (dev->dev_ops->qp_attach_session(dev, qp_id, sess->_private)) {
CDEV_LOG_ERR("dev_id %d failed to attach qp: %d with session", CDEV_LOG_ERR("dev_id %d failed to attach qp: %d with session",
sess->dev_id, qp_id); dev_id, qp_id);
return -EPERM; return -EPERM;
} }
@ -1160,23 +1160,23 @@ rte_cryptodev_queue_pair_attach_sym_session(uint16_t qp_id,
} }
int int
rte_cryptodev_queue_pair_detach_sym_session(uint16_t qp_id, rte_cryptodev_queue_pair_detach_sym_session(uint8_t dev_id, uint16_t qp_id,
struct rte_cryptodev_sym_session *sess) struct rte_cryptodev_sym_session *sess)
{ {
struct rte_cryptodev *dev; struct rte_cryptodev *dev;
if (!rte_cryptodev_pmd_is_valid_dev(sess->dev_id)) { if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) {
CDEV_LOG_ERR("Invalid dev_id=%d", sess->dev_id); CDEV_LOG_ERR("Invalid dev_id=%d", dev_id);
return -EINVAL; return -EINVAL;
} }
dev = &rte_crypto_devices[sess->dev_id]; dev = &rte_crypto_devices[dev_id];
/* The API is optional, not returning error if driver do not suuport */ /* The API is optional, not returning error if driver do not suuport */
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->qp_detach_session, 0); RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->qp_detach_session, 0);
if (dev->dev_ops->qp_detach_session(dev, qp_id, sess->_private)) { if (dev->dev_ops->qp_detach_session(dev, qp_id, sess->_private)) {
CDEV_LOG_ERR("dev_id %d failed to detach qp: %d from session", CDEV_LOG_ERR("dev_id %d failed to detach qp: %d from session",
sess->dev_id, qp_id); dev_id, qp_id);
return -EPERM; return -EPERM;
} }

View File

@ -953,7 +953,8 @@ rte_cryptodev_get_private_session_size(uint8_t dev_id);
/** /**
* Attach queue pair with sym session. * Attach queue pair with sym session.
* *
* @param qp_id Queue pair to which session will be attached. * @param dev_id Device to which the session will be attached.
* @param qp_id Queue pair to which the session will be attached.
* @param session Session pointer previously allocated by * @param session Session pointer previously allocated by
* *rte_cryptodev_sym_session_create*. * *rte_cryptodev_sym_session_create*.
* *
@ -962,13 +963,14 @@ rte_cryptodev_get_private_session_size(uint8_t dev_id);
* - On failure, a negative value. * - On failure, a negative value.
*/ */
int int
rte_cryptodev_queue_pair_attach_sym_session(uint16_t qp_id, rte_cryptodev_queue_pair_attach_sym_session(uint8_t dev_id, uint16_t qp_id,
struct rte_cryptodev_sym_session *session); struct rte_cryptodev_sym_session *session);
/** /**
* Detach queue pair with sym session. * Detach queue pair with sym session.
* *
* @param qp_id Queue pair to which session is attached. * @param dev_id Device to which the session is attached.
* @param qp_id Queue pair to which the session is attached.
* @param session Session pointer previously allocated by * @param session Session pointer previously allocated by
* *rte_cryptodev_sym_session_create*. * *rte_cryptodev_sym_session_create*.
* *
@ -977,7 +979,7 @@ rte_cryptodev_queue_pair_attach_sym_session(uint16_t qp_id,
* - On failure, a negative value. * - On failure, a negative value.
*/ */
int int
rte_cryptodev_queue_pair_detach_sym_session(uint16_t qp_id, rte_cryptodev_queue_pair_detach_sym_session(uint8_t dev_id, uint16_t qp_id,
struct rte_cryptodev_sym_session *session); struct rte_cryptodev_sym_session *session);
/** /**