Hi Fan,
> 
> Unfortunately the patches still cause seg-fault at QAT and SW PMDs.
> 
> - for qat it fails at rte_security_ops->session_size_get not implemented.
> - for sw pmds the queue pair's session private mempools are not set.
> 
Can you check if below change works for Kasumi. I will replicate for others.

diff --git a/drivers/crypto/kasumi/kasumi_pmd_private.h 
b/drivers/crypto/kasumi/kasumi_pmd_private.h
index abedcd616d..fe0e78e516 100644
--- a/drivers/crypto/kasumi/kasumi_pmd_private.h
+++ b/drivers/crypto/kasumi/kasumi_pmd_private.h
@@ -38,8 +38,6 @@ struct kasumi_qp {
        /**< Ring for placing processed ops */
        struct rte_mempool *sess_mp;
        /**< Session Mempool */
-       struct rte_mempool *sess_mp_priv;
-       /**< Session Private Data Mempool */
        struct rte_cryptodev_stats qp_stats;
        /**< Queue pair statistics */
        uint8_t temp_digest[KASUMI_DIGEST_LENGTH];
diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c 
b/drivers/crypto/kasumi/rte_kasumi_pmd.c
index d6f927417a..1fc59c8b8a 100644
--- a/drivers/crypto/kasumi/rte_kasumi_pmd.c
+++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c
@@ -139,27 +139,24 @@ kasumi_get_session(struct kasumi_qp *qp, struct 
rte_crypto_op *op)
                                        op->sym->session,
                                        cryptodev_driver_id);
        } else {
-               void *_sess = NULL;
-               void *_sess_private_data = NULL;
+               struct rte_cryptodev_sym_session *_sess = NULL;

-               if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
+               /* Create temporary session */
+               _sess = rte_cryptodev_sym_session_create(qp->sess_mp);
+               if (_sess == NULL)
                        return NULL;

-               if (rte_mempool_get(qp->sess_mp_priv,
-                               (void **)&_sess_private_data))
-                       return NULL;
-
-               sess = (struct kasumi_session *)_sess_private_data;
-
+               _sess->sess_data[cryptodev_driver_id].data =
+                               (void *)((uint8_t *)_sess +
+                               rte_cryptodev_sym_get_header_session_size() +
+                               (cryptodev_driver_id * _sess->priv_sz));
+               sess = _sess->sess_data[cryptodev_driver_id].data;
                if (unlikely(kasumi_set_session_parameters(qp->mgr, sess,
                                op->sym->xform) != 0)) {
                        rte_mempool_put(qp->sess_mp, _sess);
-                       rte_mempool_put(qp->sess_mp_priv, _sess_private_data);
                        sess = NULL;
                }
                op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
-               set_sym_session_private_data(op->sym->session,
-                               cryptodev_driver_id, _sess_private_data);
        }

        if (unlikely(sess == NULL))
@@ -327,7 +324,6 @@ process_ops(struct rte_crypto_op **ops, struct 
kasumi_session *session,
                        memset(ops[i]->sym->session, 0,
                        rte_cryptodev_sym_get_existing_header_session_size(
                                        ops[i]->sym->session));
-                       rte_mempool_put(qp->sess_mp_priv, session);
                        rte_mempool_put(qp->sess_mp, ops[i]->sym->session);
                        ops[i]->sym->session = NULL;
                }

Reply via email to