From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) by dpdk.org (Postfix) with ESMTP id 4CE2F4BFE for ; Wed, 20 Mar 2013 17:08:36 +0100 (CET) Received: by mail-wi0-f178.google.com with SMTP id hq4so2021510wib.11 for ; Wed, 20 Mar 2013 09:07:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-gm-message-state; bh=Z4sNbRu3MsGJlCWj7AnnZ7uMMVixK1EbePMDZSrAjYU=; b=YSSmysrQB03Pwmtrti922AQdpBbyRiv/afS7oygxW76q3KlGlTwlfRq8za464loIaE 68WfGBHrJAKz7cVCZcjUqAswVHNQHXKEfRW26nonOAt3eefWY44nFSAH8sN1CDLN3qVg s/1W/cvaQm45HPrCQQKK9NsJ+BcX34zOA96XbH81VRp4ec8lxQzwgxhn7JPstjNkvsZe S37HanfgFM92CzCZq47MAPRa3RzjINp8cNaZKNrlpOAEyzHkcofOGBMzlbvEx5B9mD4l T4PPNFJnPQFU1V9opJ/SKwd3YkMNuPmRjYkzpbSYCViwFfWtCtuTUgaSulERKsqvMAP2 2hMw== X-Received: by 10.180.78.168 with SMTP id c8mr11179202wix.27.1363795657132; Wed, 20 Mar 2013 09:07:37 -0700 (PDT) Received: from 6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPS id ej8sm7691840wib.9.2013.03.20.09.07.34 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 20 Mar 2013 09:07:36 -0700 (PDT) Received: by 6wind.com (sSMTP sendmail emulation); Wed, 20 Mar 2013 17:07:34 +0100 From: Thomas Monjalon To: dev@dpdk.org Date: Wed, 20 Mar 2013 17:05:07 +0100 Message-Id: <2a8ac043f295401533dd5b8ae0c1a5907becc6fd.1363795499.git.thomas.monjalon@6wind.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQkYZl1wHAsCHHVNDQdQeSvF2OYebhcKqMVpmoLqNr66VcanDPMRweZPBYrvYfJtJOvEbcmR Subject: [dpdk-dev] [PATCH 19/22] pci: reference driver structure for each device 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: Wed, 20 Mar 2013 16:08:36 -0000 From: Adrien Mazarguil Add a driver reference (if available) to every PCI devices, even when blacklisted. This information is made available in the global device_list variable so users know which network devices are managed or ignored. Acked-by: Ivan Boule Acked-by: Damien Millescamps Signed-off-by: Adrien Mazarguil --- lib/librte_eal/common/eal_common_pci.c | 3 +-- lib/librte_eal/common/include/rte_pci.h | 2 ++ lib/librte_eal/linuxapp/eal/eal_pci.c | 11 ++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index fe24265..73d8fb3 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -81,9 +81,8 @@ pci_probe_all_drivers(struct rte_pci_device *dev) { struct rte_pci_driver *dr = NULL; + dev->blacklisted = !!is_blacklisted(dev); TAILQ_FOREACH(dr, &driver_list, next) { - if (is_blacklisted(dev)) - return -1; if (rte_eal_pci_probe_one_driver(dr, dev) == 0) return 0; } diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index f2128b5..b465995 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -111,6 +111,8 @@ struct rte_pci_device { struct rte_pci_id id; /**< PCI ID. */ struct rte_pci_resource mem_resource; /**< PCI Memory Resource */ struct rte_intr_handle intr_handle; /**< Interrupt handle */ + const struct rte_pci_driver *driver; /**< Associated driver */ + unsigned int blacklisted:1; /**< Device is blacklisted */ }; /** Any PCI device identifier (vendor, device, ...) */ diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index 78687d6..86002bd 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -731,7 +731,8 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d dev->id.vendor_id, dev->id.device_id, dr->name); /* Unbind PCI devices if needed */ - if (module_name != NULL) { + if ((!dev->blacklisted) && + (module_name != NULL)) { if (rte_eal_process_type() == RTE_PROC_PRIMARY) { /* unbind current driver, bind ours */ if (pci_unbind_kernel_driver(dev) < 0) @@ -743,6 +744,14 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d if (pci_uio_map_resource(dev) < 0) return -1; } + + /* reference driver structure */ + dev->driver = dr; + + /* no initialization when blacklisted */ + if (dev->blacklisted) + return -1; + /* call the driver devinit() function */ return dr->devinit(dr, dev); -- 1.7.2.5