From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 3CC302B9B for ; Mon, 3 Apr 2017 18:49:04 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP; 03 Apr 2017 09:49:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,271,1486454400"; d="scan'208";a="83761143" Received: from sivswdev02.ir.intel.com ([10.237.217.46]) by fmsmga005.fm.intel.com with ESMTP; 03 Apr 2017 09:49:02 -0700 From: Ferruh Yigit To: Thomas Monjalon Cc: dev@dpdk.org, Ferruh Yigit Date: Mon, 3 Apr 2017 17:49:01 +0100 Message-Id: <20170403164901.13133-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.8.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] igb_uio: fix build error with kernel < 3.2 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: Mon, 03 Apr 2017 16:49:05 -0000 Recently added "dma_zalloc_coherent()" call is causing build error for Linux kernels < 3.2. compile error: .../build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c: In function ‘igbuio_pci_probe’: .../build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c:434:2: error: implicit declaration of function ‘dma_zalloc_coherent’ [-Werror=implicit-function-declaration] map_addr = dma_zalloc_coherent(&dev->dev, 1024, ^ dma_zalloc_coherent() introduced with Linux kernel 3.2, with commit Linux: 842fa69f3e0c ("include/linux/dma-mapping.h: add dma_zalloc_coherent()") Since it does not exist for older kernels, causing a build error. Swithched to dma_alloc_coherent() API to prevent build error. Fixes: d287e4d41be0 ("igb_uio: map dummy DMA forcing IOMMU domain attachment") Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c index 41bf6ea..192bd4a 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -431,8 +431,10 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) * the iommu identity mapping if kernel boots with iommu=pt. * Note this is not a problem if no IOMMU at all. */ - map_addr = dma_zalloc_coherent(&dev->dev, 1024, - &map_dma_addr, GFP_KERNEL); + map_addr = dma_alloc_coherent(&dev->dev, 1024, &map_dma_addr, + GFP_KERNEL); + if (map_addr) + memset(map_addr, 0, 1024); if (!map_addr) dev_info(&dev->dev, "dma mapping failed\n"); -- 2.9.3