[v4,01/13] net/enetc: support physical addressing mode
diff mbox series

Message ID 20190412122840.1908-2-g.singh@nxp.com
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • ENETC PMD basic features and bug fixes
Related show

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Gagandeep Singh April 12, 2019, 12:28 p.m. UTC
Support added for physical addressing mode and
change driver flags to don't care.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/enetc_ethdev.c | 22 ++++++++++++----------
 drivers/net/enetc/enetc_rxtx.c   |  6 +++---
 2 files changed, 15 insertions(+), 13 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 023fe7517..7a9a97deb 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -1,5 +1,5 @@ 
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #include <stdbool.h>
@@ -334,14 +334,15 @@  static void
 enetc_setup_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring)
 {
 	int idx = tx_ring->index;
-	uintptr_t base_addr;
 	uint32_t tbmr;
+	phys_addr_t bd_address;
 
-	base_addr = (uintptr_t)tx_ring->bd_base;
+	bd_address = (phys_addr_t)
+		     rte_mem_virt2iova((const void *)tx_ring->bd_base);
 	enetc_txbdr_wr(hw, idx, ENETC_TBBAR0,
-		       lower_32_bits((uint64_t)base_addr));
+		       lower_32_bits((uint64_t)bd_address));
 	enetc_txbdr_wr(hw, idx, ENETC_TBBAR1,
-		       upper_32_bits((uint64_t)base_addr));
+		       upper_32_bits((uint64_t)bd_address));
 	enetc_txbdr_wr(hw, idx, ENETC_TBLENR,
 		       ENETC_RTBLENR_LEN(tx_ring->bd_count));
 
@@ -478,14 +479,15 @@  enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring,
 		  struct rte_mempool *mb_pool)
 {
 	int idx = rx_ring->index;
-	uintptr_t base_addr;
 	uint16_t buf_size;
+	phys_addr_t bd_address;
 
-	base_addr = (uintptr_t)rx_ring->bd_base;
+	bd_address = (phys_addr_t)
+		     rte_mem_virt2iova((const void *)rx_ring->bd_base);
 	enetc_rxbdr_wr(hw, idx, ENETC_RBBAR0,
-		       lower_32_bits((uint64_t)base_addr));
+		       lower_32_bits((uint64_t)bd_address));
 	enetc_rxbdr_wr(hw, idx, ENETC_RBBAR1,
-		       upper_32_bits((uint64_t)base_addr));
+		       upper_32_bits((uint64_t)bd_address));
 	enetc_rxbdr_wr(hw, idx, ENETC_RBLENR,
 		       ENETC_RTBLENR_LEN(rx_ring->bd_count));
 
@@ -612,7 +614,7 @@  enetc_pci_remove(struct rte_pci_device *pci_dev)
 
 static struct rte_pci_driver rte_enetc_pmd = {
 	.id_table = pci_id_enetc_map,
-	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_IOVA_AS_VA,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING,
 	.probe = enetc_pci_probe,
 	.remove = enetc_pci_remove,
 };
diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c
index 631e2430d..a31a38725 100644
--- a/drivers/net/enetc/enetc_rxtx.c
+++ b/drivers/net/enetc/enetc_rxtx.c
@@ -1,5 +1,5 @@ 
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2019 NXP
  */
 
 #include <stdbool.h>
@@ -64,7 +64,7 @@  enetc_xmit_pkts(void *tx_queue,
 		txbd->buf_len = txbd->frm_len;
 		txbd->flags = rte_cpu_to_le_16(ENETC_TXBD_FLAGS_F);
 		txbd->addr = (uint64_t)(uintptr_t)
-		rte_cpu_to_le_64((size_t)tx_swbd->buffer_addr->buf_addr +
+		rte_cpu_to_le_64((size_t)tx_swbd->buffer_addr->buf_iova +
 				 tx_swbd->buffer_addr->data_off);
 		i++;
 		start++;
@@ -91,7 +91,7 @@  enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt)
 		rx_swbd->buffer_addr =
 			rte_cpu_to_le_64(rte_mbuf_raw_alloc(rx_ring->mb_pool));
 		rxbd->w.addr = (uint64_t)(uintptr_t)
-			       rx_swbd->buffer_addr->buf_addr +
+			       rx_swbd->buffer_addr->buf_iova +
 			       rx_swbd->buffer_addr->data_off;
 		/* clear 'R" as well */
 		rxbd->r.lstatus = 0;