From 577ac94c12e04a46109689d2678e88bf96050671 Mon Sep 17 00:00:00 2001 From: Arek Kusztal Date: Wed, 1 Jun 2016 11:52:00 +0100 Subject: [PATCH] qat: fix physical address of content descriptor 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 Acked-by: Deepak Kumar Jain --- drivers/crypto/qat/qat_crypto.c | 9 ++++++--- lib/librte_cryptodev/rte_cryptodev.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index a0846926be..1ab3869d05 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -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) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index aa4ea42591..960e2d5aeb 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -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