From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by dpdk.org (Postfix) with ESMTP id 720FD5A81 for ; Sun, 1 Feb 2015 05:02:25 +0100 (CET) Received: by mail-pa0-f46.google.com with SMTP id lj1so68277184pab.5 for ; Sat, 31 Jan 2015 20:02:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M3kFGFQL5QSzS/BOo3w3nHlM9Sr4UsdZEIAqc/Rcepw=; b=hmVXzY0cB4xcX1xeC87bPVpOWwvqd+CCmfD+QlLsnfOZNzn4m3kPk5eShHLN6czmTq XkmO9JuhhIj6esEcZBNmMXIvREUPY8iebA30DVGL3hoZxbb3KmXPoa2BKhEw28qa1icY SkByrsuhIqafayvIHnZuFY1mN1B+fOlcSLTOhCgkdGcahUPtjGO2edWmLhwqpAd51XHo RzY0QgdyP8nMmlwpbNGYOl1LNL1D7Lo2g7JTkrA4xHrtwxUT9nDfcSSb9i4Lvr4g9mDg 8XetnbjJS9b0e/Bm2qQLPTNPw7etarqLHIpL2cy0INU//2BAzT2S6qLzQnrgF1Z9MYhC sBwA== X-Gm-Message-State: ALoCoQnlozW0qpaWYx4n9mu82xrR3NJWRcR6BvI51Q4PozqUUI+7DnsVL8yYabe3n4nXgv2hCBh2 X-Received: by 10.70.27.33 with SMTP id q1mr20216736pdg.84.1422763344864; Sat, 31 Jan 2015 20:02:24 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id hd4sm5369241pbc.86.2015.01.31.20.02.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 31 Jan 2015 20:02:24 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Sun, 1 Feb 2015 13:01:49 +0900 Message-Id: <1422763322-13742-3-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422763322-13742-1-git-send-email-mukawa@igel.co.jp> References: <1421664027-17971-9-git-send-email-mukawa@igel.co.jp> <1422763322-13742-1-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH v6 02/13] eal_pci: pci memory map work with driver type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Feb 2015 04:02:25 -0000 From: Michael Qiu With the driver type flag in struct rte_pci_dev, we do not need to always map uio devices with vfio related function when vfio enabled. Signed-off-by: Michael Qiu Signed-off-by: Tetsuya Mukawa --- lib/librte_eal/linuxapp/eal/eal_pci.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index bd3f77d..c0ca5a5 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -549,25 +549,29 @@ pci_config_space_set(struct rte_pci_device *dev) static int pci_map_device(struct rte_pci_device *dev) { - int ret, mapped = 0; + int ret = -1; /* try mapping the NIC resources using VFIO if it exists */ + switch (dev->pt_driver) { + case RTE_PT_VFIO: #ifdef VFIO_PRESENT - if (pci_vfio_is_enabled()) { - ret = pci_vfio_map_resource(dev); - if (ret == 0) - mapped = 1; - else if (ret < 0) - return ret; - } + if (pci_vfio_is_enabled()) + ret = pci_vfio_map_resource(dev); #endif - /* map resources for devices that use igb_uio */ - if (!mapped) { + break; + case RTE_PT_IGB_UIO: + case RTE_PT_UIO_GENERIC: + /* map resources for devices that use uio */ ret = pci_uio_map_resource(dev); - if (ret != 0) - return ret; + break; + default: + RTE_LOG(DEBUG, EAL, " Not managed by known pt driver," + " skipped\n"); + ret = 1; + break; } - return 0; + + return ret; } /* -- 1.9.1