[dpdk-dev] qat: fix phys address of content descriptor

Message ID 1464611916-17061-1-git-send-email-arkadiuszx.kusztal@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Arkadiusz Kusztal May 30, 2016, 12:38 p.m. UTC
  From: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>

this patch fixes an error with computation of physical address of
content descriptor in the symmetric operations session

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
---
 drivers/crypto/qat/qat_crypto.c      | 9 ++++++---
 lib/librte_cryptodev/rte_cryptodev.c | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
  

Comments

De Lara Guarch, Pablo May 30, 2016, 3:29 p.m. UTC | #1
Hi Arek,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Arek Kusztal
> Sent: Monday, May 30, 2016 1:39 PM
> To: dev@dpdk.org
> Cc: Trahe, Fiona; Griffin, John; Jain, Deepak K; olivier.matz@6wind.com;
> thomas.monjalon@6wind.com; Kusztal, ArkadiuszX
> Subject: [dpdk-dev] [PATCH] qat: fix phys address of content descriptor
> 
> From: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
> 
> this patch fixes an error with computation of physical address of
> content descriptor in the symmetric operations session
> 
> Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>

You forgot to include the "Fixes" line. Also you could reword the commit message like:
"Fixes wrong computation of physical address..."
  

Patch

diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c
index 495ea1c..abe0511 100644
--- a/drivers/crypto/qat/qat_crypto.c
+++ b/drivers/crypto/qat/qat_crypto.c
@@ -807,12 +807,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 aa4ea42..960e2d5 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