summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlejandro Lucero <alejandro.lucero@netronome.com>2018-10-05 13:45:26 +0100
committerThomas Monjalon <thomas@monjalon.net>2018-10-28 22:06:51 +0100
commit388022d5d09416f1bef27e1704a59c8047a1f5a6 (patch)
treec35e8cb38572be9c1531e0dc15aa3ffb9faed105 /drivers
parentfe822eb8c5651d00ef5b8eeed6f8511e7a86560f (diff)
downloaddpdk-388022d5d09416f1bef27e1704a59c8047a1f5a6.zip
dpdk-388022d5d09416f1bef27e1704a59c8047a1f5a6.tar.gz
dpdk-388022d5d09416f1bef27e1704a59c8047a1f5a6.tar.xz
net/nfp: check hugepage IOVA based on DMA mask
NFP devices can not handle DMA addresses requiring more than 40 bits. This patch uses rte_dev_check_dma_mask with 40 bits and avoids device initialization if memory out of NFP range. Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/nfp/Makefile1
-rw-r--r--drivers/net/nfp/meson.build2
-rw-r--r--drivers/net/nfp/nfp_net.c8
3 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/nfp/Makefile b/drivers/net/nfp/Makefile
index ab4e0a7..d3fa569 100644
--- a/drivers/net/nfp/Makefile
+++ b/drivers/net/nfp/Makefile
@@ -10,6 +10,7 @@ LIB = librte_pmd_nfp.a
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
LDLIBS += -lm
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
diff --git a/drivers/net/nfp/meson.build b/drivers/net/nfp/meson.build
index a8f29f9..ba6a22e 100644
--- a/drivers/net/nfp/meson.build
+++ b/drivers/net/nfp/meson.build
@@ -17,3 +17,5 @@ sources = files('nfpcore/nfp_cpp_pcie_ops.c',
'nfpcore/nfp_nsp_eth.c',
'nfpcore/nfp_hwinfo.c',
'nfp_net.c')
+
+allow_experimental_apis = true
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 4d6a797..b5b98d6 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -2702,6 +2702,14 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+ /* NFP can not handle DMA addresses requiring more than 40 bits */
+ if (rte_eal_check_dma_mask(40)) {
+ RTE_LOG(ERR, PMD, "device %s can not be used:",
+ pci_dev->device.name);
+ RTE_LOG(ERR, PMD, "\trestricted dma mask to 40 bits!\n");
+ return -ENODEV;
+ };
+
if ((pci_dev->id.device_id == PCI_DEVICE_ID_NFP4000_PF_NIC) ||
(pci_dev->id.device_id == PCI_DEVICE_ID_NFP6000_PF_NIC)) {
port = get_pf_port_number(eth_dev->data->name);