[v5,4/4] net/enetc: enable dpaax library
diff mbox series

Message ID 20191023060602.32456-5-g.singh@nxp.com
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • enetc PMD specific changes
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed

Commit Message

Gagandeep Singh Oct. 23, 2019, 6:06 a.m. UTC
dpaaX is used to maintain a local copy of PA->VA translations.

Using the rte_mem_virt2iova or rte_mem_virt2phy is expensive. This
library is an attempt to reduce the overall cost associated with
this translation.

This patch enables this dpaaX library by populating a dpaaX's
table for PA to VA translation. This change will also help the
caam JR driver in PA to VA translation when used with enetc driver
over enetc supported SoCs.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/Makefile       | 2 ++
 drivers/net/enetc/enetc_ethdev.c | 8 ++++++++
 drivers/net/enetc/meson.build    | 1 +
 3 files changed, 11 insertions(+)

Patch
diff mbox series

diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile
index 312b37245..4498bc51f 100644
--- a/drivers/net/enetc/Makefile
+++ b/drivers/net/enetc/Makefile
@@ -10,6 +10,7 @@  LIB = librte_pmd_enetc.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax
 EXPORT_MAP := rte_pmd_enetc_version.map
 LIBABIVER := 1
 
@@ -19,5 +20,6 @@  SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
 LDLIBS += -lrte_ethdev -lrte_net
 LDLIBS += -lrte_bus_pci
+LDLIBS += -lrte_common_dpaax
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index c6099714e..20b77c006 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -5,6 +5,7 @@ 
 #include <stdbool.h>
 #include <rte_ethdev_pci.h>
 #include <rte_random.h>
+#include <dpaax_iova_table.h>
 
 #include "enetc_logs.h"
 #include "enetc.h"
@@ -896,6 +897,9 @@  enetc_dev_init(struct rte_eth_dev *eth_dev)
 	eth_dev->data->mtu = RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN -
 		RTE_ETHER_CRC_LEN;
 
+	if (rte_eal_iova_mode() == RTE_IOVA_PA)
+		dpaax_iova_table_populate();
+
 	ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x",
 			eth_dev->data->port_id, pci_dev->id.vendor_id,
 			pci_dev->id.device_id);
@@ -906,6 +910,10 @@  static int
 enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused)
 {
 	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_iova_mode() == RTE_IOVA_PA)
+		dpaax_iova_table_depopulate();
+
 	return 0;
 }
 
diff --git a/drivers/net/enetc/meson.build b/drivers/net/enetc/meson.build
index 3bc069844..bea54bea8 100644
--- a/drivers/net/enetc/meson.build
+++ b/drivers/net/enetc/meson.build
@@ -6,6 +6,7 @@  if not is_linux
 	reason = 'only supported on linux'
 endif
 
+deps += ['common_dpaax']
 sources = files('enetc_ethdev.c',
 		'enetc_rxtx.c')