Skip to contentSkip to conversation

i40e: support xen domain0

PATCH In review Helin Zhang 4 participants 4 messages Aug 14, 2014 – Aug 25, 2014 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40e: support xen domain0

i40e was failing to run in XEN domain0, as the physical memory for adminq DMA should be allocated and translated in a different way for XEN domain0. So rte_memzone_reserve_bounded() should be used for DMA memory allocation, and rte_mem_phy2mch() should be used for DMA memory address translation to support running i40e PMD in XEN domain0.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)
lib/librte_pmd_i40e/i40e_ethdev.c +9 -0
index 9ed31b5..7a823a0 100644
@@ -1515,14 +1515,23 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
 
 	id++;
 	snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
+#ifdef RTE_LIBRTE_XEN_DOM0
+	mz = rte_memzone_reserve_bounded(z_name, size, 0, 0, alignment,
+							RTE_PGSIZE_2M);
+#else
 	mz = rte_memzone_reserve_aligned(z_name, size, 0, 0, alignment);
+#endif
 	if (!mz)
 		return I40E_ERR_NO_MEMORY;
 
 	mem->id = id;
 	mem->size = size;
 	mem->va = mz->addr;
+#ifdef RTE_LIBRTE_XEN_DOM0
+	mem->pa = rte_mem_phy2mch(mz->memseg_id, mz->phys_addr);
+#else
 	mem->pa = mz->phys_addr;
+#endif
 
 	return I40E_SUCCESS;
 }
Signature · 1 line
1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1407996773-7055-1-git-send-email-helin.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

Tested-by
#2 lore raw
Quoted 10 lines

i40e was failing to run in XEN domain0, as the physical memory for adminq DMA should be allocated and translated in a different way for XEN domain0. So rte_memzone_reserve_bounded() should be used for DMA memory allocation, and rte_mem_phy2mch() should be used for DMA memory address translation to support running i40e PMD in XEN domain0.

This patch updates i40e to support xen domain0, testpmd can works OK with it. It is ready to be integrated to dpdk.org.

Acked-by
#3 lore raw
In reply to a message not in the archive
Quoted 49 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Helin Zhang
Sent: Thursday, August 14, 2014 2:13 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] i40e: support xen domain0

i40e was failing to run in XEN domain0, as the physical memory for adminq DMA should be allocated and translated in a different way for XEN domain0. So
rte_memzone_reserve_bounded() should be used for DMA memory allocation, and rte_mem_phy2mch() should be used for DMA memory address translation to support running i40e PMD in XEN domain0.

---
 lib/librte_pmd_i40e/i40e_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)
lib/librte_pmd_i40e/i40e_ethdev.c +8 -1
index 9ed31b5..7a823a0 100644
@@ -1515,14 +1515,23 @@
 i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
 
 	id++;
 	snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
+#ifdef RTE_LIBRTE_XEN_DOM0
+	mz = rte_memzone_reserve_bounded(z_name, size, 0, 0, alignment,
+							RTE_PGSIZE_2M);
+#else
 	mz = rte_memzone_reserve_aligned(z_name, size, 0, 0, alignment);
+#endif
 	if (!mz)
 		return I40E_ERR_NO_MEMORY;
 
 	mem->id = id;
 	mem->size = size;
 	mem->va = mz->addr;
+#ifdef RTE_LIBRTE_XEN_DOM0
+	mem->pa = rte_mem_phy2mch(mz->memseg_id, mz->phys_addr); #else
 	mem->pa = mz->phys_addr;
+#endif
 
 	return I40E_SUCCESS;
 }
--

1.8.1.4

A message that is not in the archive (sent off-list or not yet received): 1ED644BD7E0A5F4091CF203DAFB8E4CC01D61B74-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org

#5 lore raw
Quoted 10 lines
Quoted 8 lines

i40e was failing to run in XEN domain0, as the physical memory for adminq DMA should be allocated and translated in a different way for XEN domain0. So
rte_memzone_reserve_bounded() should be used for DMA memory allocation, and rte_mem_phy2mch() should be used for DMA memory address translation to support running i40e PMD in XEN domain0.

Applied for version 1.7.1.

Thanks

Signature · 1 line
Thomas