summaryrefslogtreecommitdiff
path: root/drivers/bus/fslmc
diff options
context:
space:
mode:
authorShreyansh Jain <shreyansh.jain@nxp.com>2018-04-27 22:50:57 +0530
committerThomas Monjalon <thomas@monjalon.net>2018-04-27 21:40:43 +0200
commit365fb925d3b39e10b781e0662c2b57e8303b2147 (patch)
treeb15777139c10bfab72251b99b3d1c60ad7a53e65 /drivers/bus/fslmc
parent95456e899b1f7ced13b0cd777f78df6fdb3970e4 (diff)
downloaddpdk-365fb925d3b39e10b781e0662c2b57e8303b2147.zip
dpdk-365fb925d3b39e10b781e0662c2b57e8303b2147.tar.gz
dpdk-365fb925d3b39e10b781e0662c2b57e8303b2147.tar.xz
bus/fslmc: optimize physical to virtual address search
With Hotplugging memory support, the order of memseg has been changed from physically contiguous to virtual contiguous. FSLMC bus and dpaa2 drivers depend on PA to VA address conversion when in Physical addressing mode. This patch creates a list of blocks requested to be pinned to the DPAA2 mempool. For searching physical addresses, it is expected that it would belong to this list (from hardware pool) and hence it is less expensive than memseg walks. Though, this has marginal impact on performance vis-a-vis legacy mode with physically contiguous memsegs. Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Diffstat (limited to 'drivers/bus/fslmc')
-rw-r--r--drivers/bus/fslmc/portal/dpaa2_hw_pvt.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index c76393d..e081afb 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -254,15 +254,38 @@ enum qbman_fd_format {
*/
#define DPAA2_EQ_RESP_ALWAYS 1
+/* Various structures representing contiguous memory maps */
+struct dpaa2_memseg {
+ TAILQ_ENTRY(dpaa2_memseg) next;
+ char *vaddr;
+ rte_iova_t iova;
+ size_t len;
+};
+
+TAILQ_HEAD(dpaa2_memseg_list, dpaa2_memseg);
+extern struct dpaa2_memseg_list rte_dpaa2_memsegs;
+
#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA
extern uint8_t dpaa2_virt_mode;
static void *dpaa2_mem_ptov(phys_addr_t paddr) __attribute__((unused));
/* todo - this is costly, need to write a fast coversion routine */
static void *dpaa2_mem_ptov(phys_addr_t paddr)
{
+ struct dpaa2_memseg *ms;
+
if (dpaa2_virt_mode)
return (void *)(size_t)paddr;
+ /* Check if the address is already part of the memseg list internally
+ * maintained by the dpaa2 driver.
+ */
+ TAILQ_FOREACH(ms, &rte_dpaa2_memsegs, next) {
+ if (paddr >= ms->iova && paddr <
+ ms->iova + ms->len)
+ return RTE_PTR_ADD(ms->vaddr, (uintptr_t)(paddr - ms->iova));
+ }
+
+ /* If not, Fallback to full memseg list searching */
return rte_mem_iova2virt(paddr);
}