From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 5C5B17D6F for ; Wed, 24 May 2017 18:16:09 +0200 (CEST) Received: by mail-wm0-f48.google.com with SMTP id e127so79908922wmg.1 for ; Wed, 24 May 2017 09:16:09 -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=DmahTndenVLZFUAk3J/X3AWGmokN/xP3Q6WEEEnP+OE=; b=KrRRyQyij+y6avZfypY3CExSXh31w9R0lqbm+FFsBEJOd8+E4bBYNssaWtY9Gdii4x nVuYLm0PDaWToI+Q//uHqizlPmJM3FkFd/rg5o5eU62QqbBXjpqnO+5Yux5LAt/duLg2 Dr4FWJFCCCrYz+bb/g46k64nqQvunRbmIHwtk/lMaOTuaOObYq/b5KrEce8+lOB5fgn7 4XKm0mdZIfri3TCy8IOpx23rnP88ojWH6stQV7bqKUKvjmETev/4lfvST1rt9cF9pAI9 fYhK6LZuDHO2ak2sTs9sbEwIT2vKtru31mLXyAlBQElnKk+a1GZmLZF5PdsVCTqo7lFu XkRA== 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=DmahTndenVLZFUAk3J/X3AWGmokN/xP3Q6WEEEnP+OE=; b=icb96UweGp4yQlILPz93hb1H2kuvyKG6NS0F41kv+L1V8gnGH+i49Xt0b7shJop03k vlWenLlqLwcuVl9uK0HPkRVrdFz+O1WyR8sG2+80sXWUWjFryQwp6SHI6kPK1PnddsbZ Am5FtDPiG6zpuAWo9CxmkGPM26jFHVGKa3XzhQzzOCD3C6bf6cH6xLziSV+C9k4MPwiM KT3xNUamfwCICHbRCeTGEYlESPMZhInsGCOw+6JpR5xfxhkPUOQfVU5STJNlEpDZWjlS Sedwl2RxPJF3ZQrikrIVFiUKhxftofq57Jag7zP16Mca+1Ec+uqdy9F6Wn91vIeZjpML c3tg== X-Gm-Message-State: AODbwcAaBCDA6pWE+CUNrfFfhn8LaAwxK2Zb+7kNqWREfGzyJFJ1nxBb pr7brkAgIgC3eG1y X-Received: by 10.28.167.72 with SMTP id q69mr6437349wme.73.1495642569007; Wed, 24 May 2017 09:16:09 -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 l7sm7783055wrc.52.2017.05.24.09.16.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 May 2017 09:16:08 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 24 May 2017 18:15:48 +0200 Message-Id: <5d0e6a44d713423fd5f90227eb7b4289e75bbad3.1495642202.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 v2 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: , X-List-Received-Date: Wed, 24 May 2017 16:16:09 -0000 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 8428006..44cfa3c 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) @@ -530,6 +548,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), -- 2.1.4