net/nfp: check hugepage IOVA based on DMA mask
authorAlejandro Lucero <alejandro.lucero@netronome.com>
Fri, 5 Oct 2018 12:45:26 +0000 (13:45 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 28 Oct 2018 21:06:51 +0000 (22:06 +0100)
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>
drivers/net/nfp/Makefile
drivers/net/nfp/meson.build
drivers/net/nfp/nfp_net.c

index ab4e0a7..d3fa569 100644 (file)
@@ -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
index a8f29f9..ba6a22e 100644 (file)
@@ -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
index 4d6a797..b5b98d6 100644 (file)
@@ -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);