From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from netronome.com (host-79-78-33-110.static.as9105.net [79.78.33.110]) by dpdk.org (Postfix) with ESMTP id 66EE94CBB; Thu, 30 Aug 2018 17:22:28 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id w7UFLZ1D021923; Thu, 30 Aug 2018 16:21:35 +0100 Received: (from alucero@localhost) by netronome.com (8.14.4/8.14.4/Submit) id w7UFLZF9021922; Thu, 30 Aug 2018 16:21:35 +0100 From: Alejandro Lucero To: dev@dpdk.org Cc: stable@dpdk.org Date: Thu, 30 Aug 2018 16:21:31 +0100 Message-Id: <1535642492-21831-5-git-send-email-alejandro.lucero@netronome.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1535642492-21831-1-git-send-email-alejandro.lucero@netronome.com> References: <1535642492-21831-1-git-send-email-alejandro.lucero@netronome.com> Subject: [dpdk-dev] [PATCH 4/5] net/nfp: check hugepages IOVAs based on DMA mask X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2018 15:22:28 -0000 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 --- drivers/net/nfp/nfp_net.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 6e5e305..aedca31 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2688,6 +2688,14 @@ uint32_t nfp_net_txq_full(struct nfp_net_txq *txq) 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) < 0) { + RTE_LOG(INFO, PMD, "device %s can not be used:", + pci_dev->device.name); + RTE_LOG(INFO, 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); -- 1.9.1