qat: fix physical address of content descriptor
authorArek Kusztal <arkadiuszx.kusztal@intel.com>
Wed, 1 Jun 2016 10:52:00 +0000 (11:52 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 7 Jun 2016 16:59:56 +0000 (18:59 +0200)
Fix an error with computation of physical address of
content descriptor in the symmetric operations session

Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
drivers/crypto/qat/qat_crypto.c
lib/librte_cryptodev/rte_cryptodev.c

index a084692..1ab3869 100644 (file)
@@ -808,12 +808,15 @@ static inline uint32_t adf_modulo(uint32_t data, uint32_t shift)
        return data - mult;
 }
 
-void qat_crypto_sym_session_init(struct rte_mempool *mp, void *priv_sess)
+void qat_crypto_sym_session_init(struct rte_mempool *mp, void *sym_sess)
 {
-       struct qat_session *s = priv_sess;
+       struct rte_cryptodev_sym_session *sess = sym_sess;
+       struct qat_session *s = (void *)sess->_private;
 
        PMD_INIT_FUNC_TRACE();
-       s->cd_paddr = rte_mempool_virt2phy(mp, &s->cd);
+       s->cd_paddr = rte_mempool_virt2phy(mp, sess) +
+               offsetof(struct qat_session, cd) +
+               offsetof(struct rte_cryptodev_sym_session, _private);
 }
 
 int qat_dev_config(__rte_unused struct rte_cryptodev *dev)
index aa4ea42..960e2d5 100644 (file)
@@ -956,7 +956,7 @@ rte_cryptodev_sym_session_init(struct rte_mempool *mp,
        sess->mp = mp;
 
        if (dev->dev_ops->session_initialize)
-               (*dev->dev_ops->session_initialize)(mp, sess->_private);
+               (*dev->dev_ops->session_initialize)(mp, sess);
 }
 
 static int