net/enetc: support physical addressing mode
authorGagandeep Singh <g.singh@nxp.com>
Fri, 12 Apr 2019 12:28:53 +0000 (12:28 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 19 Apr 2019 12:51:54 +0000 (14:51 +0200)
Support added for physical addressing mode and
change driver flags to don't care.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
doc/guides/rel_notes/release_19_05.rst
drivers/net/enetc/enetc_ethdev.c
drivers/net/enetc/enetc_rxtx.c

index b0928a6..0645e32 100644 (file)
@@ -142,6 +142,12 @@ New Features
   * Added support for VXLAN-GPE packet.
   * Added support for VXLAN-GPE classification.
 
+* **Updated the ENETC driver.**
+
+  New features:
+
+  * Added physical addressing mode support
+
 * **Updated the QuickAssist Technology PMD.**
 
   Added support for AES-XTS with 128 and 256 bit AES keys.
index 023fe75..7a9a97d 100644 (file)
@@ -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,
 };
index 631e243..a31a387 100644 (file)
@@ -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;