drivers/crypto/dpaa_sec: update DPAA iova table in dpaa_mem_vtop

Message ID b79535e160172543ad7b25e363d19420f84b6838.1568274261.git.thierry.herbelot@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series drivers/crypto/dpaa_sec: update DPAA iova table in dpaa_mem_vtop |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-dpdk_compile_ovs success Compile Testing PASS
ci/iol-dpdk_compile_spdk success Compile Testing PASS
ci/iol-dpdk_compile success Compile Testing PASS
ci/intel-Performance success Performance Testing PASS
ci/mellanox-Performance success Performance Testing PASS

Commit Message

Thierry Herbelot Sept. 12, 2019, 8:38 a.m. UTC
  dpaa_sec needs translations between physical and virtual addresses.
V to P translation is relatively fast, as memory is managed in
contiguous segments.

The result of each V to P translation is used to update the DPAA iova
table, which should be updated by a Mem event callback, but is not.
Then the DPAA iova table has entries for all needed memory ranges.

With this patch, dpaa_mem_ptov will always use dpaax_iova_table_get_va,
which ensures optimal performance.

Fixes: 5a7dbb934d75 ('dpaa: enable dpaax library')
Cc: stable@dpdk.org
Cc: akhil.goyal@nxp.com
Cc: hemant.agrawal@nxp.com

V2: use "ms->addr" instead of  "(void *)ms->addr_64" to fix
    compilation on 32bit (i686)

Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
---
 drivers/crypto/dpaa_sec/dpaa_sec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Hemant Agrawal Sept. 12, 2019, 8:39 a.m. UTC | #1
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
  
Akhil Goyal Sept. 19, 2019, 3:13 p.m. UTC | #2
> 
> dpaa_sec needs translations between physical and virtual addresses.
> V to P translation is relatively fast, as memory is managed in
> contiguous segments.
> 
> The result of each V to P translation is used to update the DPAA iova
> table, which should be updated by a Mem event callback, but is not.
> Then the DPAA iova table has entries for all needed memory ranges.
> 
> With this patch, dpaa_mem_ptov will always use dpaax_iova_table_get_va,
> which ensures optimal performance.
> 
> Fixes: 5a7dbb934d75 ('dpaa: enable dpaax library')
> Cc: stable@dpdk.org
> Cc: akhil.goyal@nxp.com
> Cc: hemant.agrawal@nxp.com
> 
> V2: use "ms->addr" instead of  "(void *)ms->addr_64" to fix
>     compilation on 32bit (i686)
Removed this line
> 
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
> ---
Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 122c80a072ff..b8d142107d2a 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -38,6 +38,7 @@ 
 #include <rte_dpaa_bus.h>
 #include <dpaa_sec.h>
 #include <dpaa_sec_log.h>
+#include <dpaax_iova_table.h>
 
 enum rta_sec_era rta_sec_era;
 
@@ -100,8 +101,10 @@  dpaa_mem_vtop(void *vaddr)
 	const struct rte_memseg *ms;
 
 	ms = rte_mem_virt2memseg(vaddr, NULL);
-	if (ms)
+	if (ms) {
+		dpaax_iova_table_update(ms->iova, ms->addr, ms->len);
 		return ms->iova + RTE_PTR_DIFF(vaddr, ms->addr);
+	}
 	return (size_t)NULL;
 }