Skip to contentSkip to conversation

crypto/dpaa_sec: fix performance issue

PATCH In review Gagandeep Singh 2 participants 5 messages Jan 21, 2020 – Jan 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 crypto/dpaa_sec: fix performance issue

DPAA sec driver is using virtual to physical address translation in its data path and driver is using dpaax_iova_table_update() API in every address translation which is very costly.
This patch moves dpaax_iova_table_update() calling to rte_dpaa_mem_ptov(), only if it fails to found translation from DPAAX table.

Fixes 033968bdc28 ("drivers/crypto/dpaa_sec: update DPAA iova table in dpaa_mem_vtop")
---
 drivers/bus/dpaa/rte_dpaa_bus.h    |  18 ++++-
 drivers/crypto/dpaa_sec/dpaa_sec.c | 117 ++++++++++++-----------------
 2 files changed, 63 insertions(+), 72 deletions(-)
drivers/bus/dpaa/rte_dpaa_bus.h +17 -1
index 9bf2cd9d6..373aca978 100644
@@ -132,7 +132,23 @@ static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 	}
 
 	/* If not, Fallback to full memseg list searching */
-	return rte_mem_iova2virt(paddr);
+	va = rte_mem_iova2virt(paddr);
+
+	dpaax_iova_table_update(paddr, va, RTE_CACHE_LINE_SIZE);
+
+	return va;
+}
+
+static inline rte_iova_t
+rte_dpaa_mem_vtop(void *vaddr)
+{
+	const struct rte_memseg *ms;
+
+	ms = rte_mem_virt2memseg(vaddr, NULL);
+	if (ms)
+		return ms->iova + RTE_PTR_DIFF(vaddr, ms->addr);
+
+	return (size_t)NULL;
 }
 
 /**
drivers/crypto/dpaa_sec/dpaa_sec.c +46 -71

375 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 crypto/dpaa_sec: fix performance issue

DPAA sec driver is using virtual to physical address translation in its data path and driver is using dpaax_iova_table_update() API in every address translation which is very costly.
This patch moves dpaax_iova_table_update() calling to rte_dpaa_mem_ptov(), only if it fails to found translation from DPAAX table.

Fixes 033968bdc28 ("drivers/crypto/dpaa_sec: update DPAA iova table in dpaa_mem_vtop")
---
 drivers/bus/dpaa/rte_dpaa_bus.h     |  18 ++++-
 drivers/crypto/dpaa_sec/dpaa_sec.c  | 117 +++++++++++-----------------
 drivers/crypto/dpaa_sec/meson.build |   2 +-
 3 files changed, 64 insertions(+), 73 deletions(-)
drivers/bus/dpaa/rte_dpaa_bus.h +17 -1
index 9bf2cd9d6..373aca978 100644
@@ -132,7 +132,23 @@ static inline void *rte_dpaa_mem_ptov(phys_addr_t paddr)
 	}
 
 	/* If not, Fallback to full memseg list searching */
-	return rte_mem_iova2virt(paddr);
+	va = rte_mem_iova2virt(paddr);
+
+	dpaax_iova_table_update(paddr, va, RTE_CACHE_LINE_SIZE);
+
+	return va;
+}
+
+static inline rte_iova_t
+rte_dpaa_mem_vtop(void *vaddr)
+{
+	const struct rte_memseg *ms;
+
+	ms = rte_mem_virt2memseg(vaddr, NULL);
+	if (ms)
+		return ms->iova + RTE_PTR_DIFF(vaddr, ms->addr);
+
+	return (size_t)NULL;
 }
 
 /**
drivers/crypto/dpaa_sec/dpaa_sec.c +46 -71

375 lines not on this page · raw message

drivers/crypto/dpaa_sec/meson.build +1 -1
index 9f17d3a43..71de81940 100644
@@ -6,7 +6,7 @@ if not is_linux
 	reason = 'only supported on linux'
 endif
 
-deps += ['bus_dpaa', 'security']
+deps += ['bus_dpaa', 'mempool_dpaa', 'security']
 sources = files('dpaa_sec.c')
 
 allow_experimental_apis = true
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 crypto/dpaa_sec: reorganize structure members

This patch reorganize the members of a structure
used by driver in its data-path to improve
performance.

---
 drivers/crypto/dpaa_sec/dpaa_sec.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/dpaa_sec/dpaa_sec.h +4 -4
index 3ecc7eae5..2cd50cc8d 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016 NXP
+ *   Copyright 2016-2020 NXP
  *
  */
 
@@ -117,6 +117,9 @@ struct sec_pdcp_ctxt {
 };
 #endif
 typedef struct dpaa_sec_session_entry {
+	struct sec_cdb cdb;	/**< cmd block associated with qp */
+	struct dpaa_sec_qp *qp[MAX_DPAA_CORES];
+	struct qman_fq *inq[MAX_DPAA_CORES];
 	uint8_t dir;         /*!< Operation Direction */
 	uint8_t ctxt;	/*!< Session Context Type */
 	enum rte_crypto_cipher_algorithm cipher_alg; /*!< Cipher Algorithm*/
@@ -169,9 +172,6 @@ typedef struct dpaa_sec_session_entry {
 		struct sec_pdcp_ctxt pdcp;
 #endif
 	};
-	struct dpaa_sec_qp *qp[MAX_DPAA_CORES];
-	struct qman_fq *inq[MAX_DPAA_CORES];
-	struct sec_cdb cdb;	/**< cmd block associated with qp */
 } dpaa_sec_session;
 
 struct dpaa_sec_qp {
Signature · 1 line
2.17.1
Acked-by on v1 1/2
#3 lore raw
In reply to Gagandeep Singh
Quoted 8 lines

DPAA sec driver is using virtual to physical address translation in its data path and driver is using dpaax_iova_table_update() API in every address translation which is very costly.
This patch moves dpaax_iova_table_update() calling to rte_dpaa_mem_ptov(), only if it fails to found translation from DPAAX table.

Quoted 4 lines
Fixes 033968bdc28 ("drivers/crypto/dpaa_sec: update DPAA iova table in

dpaa_mem_vtop")

---

Series

From next time, please update the version of the updated patch in title And specify change log after '---'

Series applied to dpdk-next-crypto

Thanks.

#4 lore raw

PATCH 2/2 crypto/dpaa_sec: reorganize structure members

In reply to Gagandeep Singh

This patch reorganize the members of a structure
used by driver in its data-path to improve
performance.

---
 drivers/crypto/dpaa_sec/dpaa_sec.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/dpaa_sec/dpaa_sec.h +4 -4
index 3ecc7eae5..2cd50cc8d 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016 NXP
+ *   Copyright 2016-2020 NXP
  *
  */
 
@@ -117,6 +117,9 @@ struct sec_pdcp_ctxt {
 };
 #endif
 typedef struct dpaa_sec_session_entry {
+	struct sec_cdb cdb;	/**< cmd block associated with qp */
+	struct dpaa_sec_qp *qp[MAX_DPAA_CORES];
+	struct qman_fq *inq[MAX_DPAA_CORES];
 	uint8_t dir;         /*!< Operation Direction */
 	uint8_t ctxt;	/*!< Session Context Type */
 	enum rte_crypto_cipher_algorithm cipher_alg; /*!< Cipher Algorithm*/
@@ -169,9 +172,6 @@ typedef struct dpaa_sec_session_entry {
 		struct sec_pdcp_ctxt pdcp;
 #endif
 	};
-	struct dpaa_sec_qp *qp[MAX_DPAA_CORES];
-	struct qman_fq *inq[MAX_DPAA_CORES];
-	struct sec_cdb cdb;	/**< cmd block associated with qp */
 } dpaa_sec_session;
 
 struct dpaa_sec_qp {
Signature · 1 line
2.17.1