From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by dpdk.org (Postfix) with ESMTP id 8798DB4FA for ; Fri, 20 Feb 2015 07:40:06 +0100 (CET) Received: by pdjy10 with SMTP id y10so5470403pdj.13 for ; Thu, 19 Feb 2015 22:40:06 -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=n3lFWon+ntcaNR3t4KtSYNPlmitMcwWPMjxb14BpNNc=; b=RlmR2wFMujIwidzglGDAI7PAAk44x9uKsxaCv8Jgo8CpNuXRheKt9UQpaZ3sF1dZAb RtfsxTgycEy+uOe4+LXCIxJpeVkvIsVRRAjWyLVeNUtP/5nmxsFjdu68eXTCUGUARMis E7PuFgiKpWSJcVZFhNrDsk6DCCaH7lR/8H7rh7yQ4wm2w0qf29c2MieGlWC3Jcj/SQbX DH6/e7f/0aUjltv9140EF+iIaU11mEvOeN5kiWk86P+OqEkbnaeezczm4pfqbB3RiTWq 0KvHq2RpOTWiqU1n6GxXESC/YunmgD7OmIKhHYkbQ23ej8hV0oKyVEj3rr9cb7QqEtQx 7ekw== X-Gm-Message-State: ALoCoQn6LXVW/7MveKxlrJqHeA6ZxZmCAysucAekmwaAew4bc/vWm79kilKnMwiUrCoqw6hqyxDB X-Received: by 10.70.30.36 with SMTP id p4mr14224597pdh.164.1424414405969; Thu, 19 Feb 2015 22:40:05 -0800 (PST) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id g7sm13769979pdm.4.2015.02.19.22.40.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Feb 2015 22:40:05 -0800 (PST) From: Tetsuya Mukawa To: dev@dpdk.org Date: Fri, 20 Feb 2015 15:39:37 +0900 Message-Id: <1424414390-18509-4-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424414390-18509-1-git-send-email-mukawa@igel.co.jp> References: <1424060073-23484-2-git-send-email-mukawa@igel.co.jp> <1424414390-18509-1-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH v10 03/14] 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: Fri, 20 Feb 2015 06:40:07 -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 e760452..3c463b2 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -556,25 +556,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