From patchwork Thu Jun 1 10:08:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABtan_Rivet?= X-Patchwork-Id: 24950 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 195E07CD9; Thu, 1 Jun 2017 12:09:23 +0200 (CEST) Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id B9ACF6841 for ; Thu, 1 Jun 2017 12:09:14 +0200 (CEST) Received: by mail-wm0-f48.google.com with SMTP id 7so151349710wmo.1 for ; Thu, 01 Jun 2017 03:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=9h2fHJpvaKBIUmFtDBCO0FIEqqLt3wCpJXEiu5wdDgU=; b=sUDD1+Qc3uDLoiAyxyeZw5XzbDaKMHazMCVTrB372FKeLhilK2tEdWqzHtm2jnxDjt GbIWkn3kCBCQzm6yi067oTAqyCa7p3+SMkdZ4g9KemQckRDmBaFp5cuhoyRwupQvDeH7 Q+uU8a+aDrds69MI6LTlsPabGnjMT/j7QMlSfpunT0u8h+vpRVqxOzS01BaMQDJMIYpJ fcK/b76vVc7+8yZdenc/O51qdnNZJ68MoCpGl89h+GxkgZXI2ZTEIJQcUl28Vi4plAPe 3Rdo09U4sno36meTxvRc1z1wqRXPx5QXWCy9Gz7dKMepDqr7s3O2EgIvVWmAzdF5CpSu 5F5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=9h2fHJpvaKBIUmFtDBCO0FIEqqLt3wCpJXEiu5wdDgU=; b=hrZQwk8CP9BjC32dSfnikOzJf2DXry7nn/spuz3Ta1xgeCXx1aWRON/jV1ekKIayWu j5khUJquw58iWwzv3BqA4bwbdpic4DR5YZhRJ74RXFH0IZqMzMK5UBAHlHUUCcnhD6aa 15unrvmM9VnWqvL8JE8HeI05ONOqqKUkaouOwGRnkuwSWU4N8dXWed3L8CfJGZT8COR4 9LKmVveJ1GL2CMKRZMSx2q4KuPeboSQnWdwzpUI5cO6aggjVD6SLB7UuSRtJxCCBjh10 ccd1WrbxQWT0W9O1kiGL9+4qZQANG3qSPXfuIjy/tZw4ngwNiny/OFWyrKro/YSAHsHs A5aw== X-Gm-Message-State: AODbwcAoyvw9lM7S0BRYCJ/H017kGy8wAHTL8MQvuVl3mtabyHm+TGgb qXXu38ggmN7GTFJKnvE= X-Received: by 10.223.160.139 with SMTP id m11mr598451wrm.99.1496311754202; Thu, 01 Jun 2017 03:09:14 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id r10sm24305457wmd.9.2017.06.01.03.09.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Jun 2017 03:09:13 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 1 Jun 2017 12:08:55 +0200 Message-Id: <7e83c55647c850329e7785713d21c16eb7fed4df.1496311609.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 5/9] pci: implement parse bus operation 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_pci.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 2ab1d65..c698cf8 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -474,6 +474,24 @@ rte_pci_dump(FILE *f) } } +/* + * Parse a device entry + * typeof(addr): (struct rte_pci_addr *) + */ +static int +pci_parse(const char *name, void *addr) +{ + struct rte_pci_addr *out = addr; + struct rte_pci_addr pci_addr; + int parse; + + parse = (eal_parse_pci_BDF(name, &pci_addr) == 0 || + eal_parse_pci_DomBDF(name, &pci_addr) == 0); + if (parse && addr) + *out = pci_addr; + return !parse; +} + /* register a driver */ void rte_pci_register(struct rte_pci_driver *driver) @@ -529,6 +547,7 @@ struct rte_pci_bus rte_pci_bus = { .scan = rte_pci_scan, .probe = rte_pci_probe, .find_device = pci_find_device, + .parse = pci_parse, }, .device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list), .driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list),