From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by dpdk.org (Postfix) with ESMTP id 4A91AADCE for ; Tue, 24 Feb 2015 05:50:13 +0100 (CET) Received: by pabrd3 with SMTP id rd3so33136676pab.1 for ; Mon, 23 Feb 2015 20:50:12 -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=0WnCoZ6L33KVpvk9iqgRfMd5PRn9rSedYBGq48WDkNg=; b=GTkvX63ZUcb2avd1Qb8R1Fsq6TodLj6wwQypdoArvXO2Yhs2N0070vHzXUkL1IbEyM 6wECh7hS9KzT/gS6QJkA64prdo1H/AiA7+ElXU9e7kH3pGyyVOdplRrYlvOGnefMrJdI azqPyH2gGKiFMY/PTPOUCaMgtM4W9KxEsfLUbeM8tsFPR3YJJKjW6LuMxeMnmj5TYPaT 15lsDMVBvkVvaouOoOcZR5p8ZUgCpi47S5iq1wJwUClODW2vYbzK/A9CSXwLep5Pl9Nh U1KIx3P0RwIg0CcCPTTzyX5+O+WXDdu8/BwM4adzjGBUO84F4s/MOQyjlgSTT7EnJSZa L3gA== X-Gm-Message-State: ALoCoQlua462nivo6iJiQ6cpOXehCQp7JhAhCcom7rhePGUfCFmF44hiLR7RMBoeL/oD+Tomxid5 X-Received: by 10.66.66.133 with SMTP id f5mr25544309pat.20.1424753412525; Mon, 23 Feb 2015 20:50:12 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id r5sm26736146pdd.60.2015.02.23.20.50.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Feb 2015 20:50:11 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Tue, 24 Feb 2015 13:49:37 +0900 Message-Id: <1424753389-29864-4-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424753389-29864-1-git-send-email-mukawa@igel.co.jp> References: <1424060073-23484-2-git-send-email-mukawa@igel.co.jp> <1424753389-29864-1-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH v13 03/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: Tue, 24 Feb 2015 04:50:14 -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 4615756..3291c68 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -555,25 +555,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 uio_pci_generic or 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