cryptodev: remove driver id from session
authorSlawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Wed, 5 Jul 2017 05:26:15 +0000 (06:26 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Thu, 6 Jul 2017 20:34:55 +0000 (22:34 +0200)
Since crypto session will not be attached to a specific
device or driver, the field driver_id is not required
anymore (only used to check that a session was being
handled by the right device).

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>
12 files changed:
doc/guides/rel_notes/release_17_08.rst
drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
drivers/crypto/armv8/rte_armv8_pmd.c
drivers/crypto/kasumi/rte_kasumi_pmd.c
drivers/crypto/null/null_crypto_pmd.c
drivers/crypto/openssl/rte_openssl_pmd.c
drivers/crypto/qat/qat_crypto.c
drivers/crypto/snow3g/rte_snow3g_pmd.c
drivers/crypto/zuc/rte_zuc_pmd.c
lib/librte_cryptodev/rte_cryptodev.c
lib/librte_cryptodev/rte_cryptodev.h

index 2bd2b26..b79d17e 100644 (file)
@@ -114,6 +114,7 @@ New Features
   been reorganized as follows:
 
   * ``dev_id`` field has been removed.
+  * ``driver_id`` field has been removed.
 
 * **Updated cryptodev library.**
 
index 1ef83fa..d226c23 100644 (file)
@@ -155,10 +155,6 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_op *op)
        struct rte_crypto_sym_op *sym_op = op->sym;
 
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
-               if (unlikely(sym_op->session->driver_id !=
-                               cryptodev_driver_id))
-                       return sess;
-
                sess = (struct aesni_gcm_session *)sym_op->session->_private;
        } else  {
                void *_sess;
index 4dab849..699779a 100644 (file)
@@ -354,14 +354,9 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op)
 {
        struct aesni_mb_session *sess = NULL;
 
-       if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
-               if (unlikely(op->sym->session->driver_id !=
-                               cryptodev_driver_id)) {
-                       return NULL;
-               }
-
+       if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
                sess = (struct aesni_mb_session *)op->sym->session->_private;
-       else  {
+       else  {
                void *_sess = NULL;
 
                if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
index 7cce09f..590803a 100644 (file)
@@ -555,9 +555,7 @@ get_session(struct armv8_crypto_qp *qp, struct rte_crypto_op *op)
 
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
                /* get existing session */
-               if (likely(op->sym->session != NULL &&
-                               op->sym->session->driver_id ==
-                               cryptodev_driver_id)) {
+               if (likely(op->sym->session != NULL)) {
                        sess = (struct armv8_crypto_session *)
                                op->sym->session->_private;
                }
index 37ca2cc..35afa99 100644 (file)
@@ -166,10 +166,6 @@ kasumi_get_session(struct kasumi_qp *qp, struct rte_crypto_op *op)
        struct kasumi_session *sess;
 
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
-               if (unlikely(op->sym->session->driver_id !=
-                               cryptodev_driver_id))
-                       return NULL;
-
                sess = (struct kasumi_session *)op->sym->session->_private;
        } else  {
                struct rte_cryptodev_sym_session *c_sess = NULL;
index da62592..27cb9a2 100644 (file)
@@ -98,9 +98,7 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_op *op)
        struct rte_crypto_sym_op *sym_op = op->sym;
 
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
-               if (unlikely(sym_op->session == NULL ||
-                               sym_op->session->driver_id !=
-                                       cryptodev_driver_id))
+               if (unlikely(sym_op->session == NULL))
                        return NULL;
 
                sess = (struct null_crypto_session *)sym_op->session->_private;
index d497a27..6f5937d 100644 (file)
@@ -558,9 +558,7 @@ get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
 
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
                /* get existing session */
-               if (likely(op->sym->session != NULL &&
-                               op->sym->session->driver_id ==
-                               cryptodev_driver_id))
+               if (likely(op->sym->session != NULL))
                        sess = (struct openssl_session *)
                                op->sym->session->_private;
        } else  {
index e2c8e43..d0638a2 100644 (file)
@@ -1072,12 +1072,6 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,
                return -EINVAL;
        }
 
-       if (unlikely(op->sym->session->driver_id !=
-                       cryptodev_qat_driver_id)) {
-               PMD_DRV_LOG(ERR, "Session was not created for this device");
-               return -EINVAL;
-       }
-
        ctx = (struct qat_session *)op->sym->session->_private;
        qat_req = (struct icp_qat_fw_la_bulk_req *)out_msg;
        rte_mov128((uint8_t *)qat_req, (const uint8_t *)&(ctx->fw_req));
index 0c65b2d..f28b8d6 100644 (file)
@@ -166,10 +166,6 @@ snow3g_get_session(struct snow3g_qp *qp, struct rte_crypto_op *op)
        struct snow3g_session *sess;
 
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
-               if (unlikely(op->sym->session->driver_id !=
-                               cryptodev_driver_id))
-                       return NULL;
-
                sess = (struct snow3g_session *)op->sym->session->_private;
        } else  {
                struct rte_cryptodev_sym_session *c_sess = NULL;
index 82710d3..951f1f4 100644 (file)
@@ -165,10 +165,6 @@ zuc_get_session(struct zuc_qp *qp, struct rte_crypto_op *op)
        struct zuc_session *sess;
 
        if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
-               if (unlikely(op->sym->session->driver_id !=
-                               cryptodev_driver_id))
-                       return NULL;
-
                sess = (struct zuc_session *)op->sym->session->_private;
        } else  {
                struct rte_cryptodev_sym_session *c_sess = NULL;
index cb773c7..c2123cd 100644 (file)
@@ -1087,7 +1087,6 @@ rte_cryptodev_sym_session_init(struct rte_mempool *mp,
 {
        memset(sess, 0, mp->elt_size);
 
-       sess->driver_id = dev->driver_id;
        sess->mp = mp;
 
        if (dev->dev_ops->session_initialize)
@@ -1194,10 +1193,6 @@ rte_cryptodev_sym_session_free(uint8_t dev_id,
 
        dev = &rte_crypto_devices[dev_id];
 
-       /* Check the session belongs to this device type */
-       if (sess->driver_id != dev->driver_id)
-               return sess;
-
        /* Let device implementation clear session material */
        RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->session_clear, sess);
        dev->dev_ops->session_clear(dev, (void *)sess->_private);
index d1e7c2f..0fb5608 100644 (file)
@@ -884,8 +884,6 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id,
 struct rte_cryptodev_sym_session {
        RTE_STD_C11
        struct {
-               uint8_t driver_id;
-               /** Crypto driver identifier session created on */
                struct rte_mempool *mp;
                /**< Mempool session allocated from */
        } __rte_aligned(8);