Blame SOURCES/0004-net-nfp-check-hugepages-IOVAs-based-on-DMA-mask.patch

dd2e6b
From 1b0deb27e144107939d3ac1119723b4a0e51a191 Mon Sep 17 00:00:00 2001
dd2e6b
From: Alejandro Lucero <alejandro.lucero@netronome.com>
dd2e6b
Date: Tue, 10 Jul 2018 18:25:51 +0100
dd2e6b
Subject: [4/5] net/nfp: check hugepages IOVAs based on DMA mask
dd2e6b
dd2e6b
NFP devices can not handle DMA addresses requiring more than
dd2e6b
40 bits. This patch uses rte_dev_check_dma_mask with 40 bits
dd2e6b
and avoids device initialization if memory out of NFP range.
dd2e6b
dd2e6b
Applicable to v17.11.3 only.
dd2e6b
dd2e6b
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
dd2e6b
Acked-by: Eelco Chaudron <echaudro@redhat.com>
dd2e6b
---
dd2e6b
 drivers/net/nfp/nfp_net.c | 8 ++++++++
dd2e6b
 1 file changed, 8 insertions(+)
dd2e6b
dd2e6b
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
dd2e6b
index 96484d9..d2a240a 100644
dd2e6b
--- a/drivers/net/nfp/nfp_net.c
dd2e6b
+++ b/drivers/net/nfp/nfp_net.c
dd2e6b
@@ -2653,6 +2653,14 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
dd2e6b
 
dd2e6b
 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
dd2e6b
 
dd2e6b
+	/* NFP can not handle DMA addresses requiring more than 40 bits */
dd2e6b
+	if (rte_eal_check_dma_mask(40) < 0) {
dd2e6b
+		RTE_LOG(INFO, PMD, "device %s can not be used:",
dd2e6b
+				   pci_dev->device.name);
dd2e6b
+		RTE_LOG(INFO, PMD, "\trestricted dma mask to 40 bits!\n");
dd2e6b
+		return -ENODEV;
dd2e6b
+	};
dd2e6b
+
dd2e6b
 	if ((pci_dev->id.device_id == PCI_DEVICE_ID_NFP4000_PF_NIC) ||
dd2e6b
 	    (pci_dev->id.device_id == PCI_DEVICE_ID_NFP6000_PF_NIC)) {
dd2e6b
 		port = get_pf_port_number(eth_dev->data->name);
dd2e6b
-- 
dd2e6b
1.8.3.1
dd2e6b