From patchwork Wed Jun 7 23:56:05 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: 25129 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 726955583; Thu, 8 Jun 2017 01:56:43 +0200 (CEST) Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com [209.85.128.173]) by dpdk.org (Postfix) with ESMTP id 9398D2BB8 for ; Thu, 8 Jun 2017 01:56:27 +0200 (CEST) Received: by mail-wr0-f173.google.com with SMTP id q97so12018649wrb.2 for ; Wed, 07 Jun 2017 16:56:27 -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=5TWWN7Kd5qrUIKRFDGyk78Uz9W5wUZzPbCpC/pead+g=; b=D662Medey8LfnKZXxbhgZEx7YPG1n0+pGnpq98qcKJ9K65hcUGuHVojdYIhFEx6m3t iPj19a5QBxCas4VdxnboYcnNApsS5UtNUsT5X7l7Ow5tnXgcXhD13IGU79blA+MUrNcz UOnfewp+h919uerqYYxnzddy41Uv0HsdOaJy9MuYx7bDut+Cz2ZzY1J9GlZ9xhPFFq/Z KAS8P86S1JQV4TZgr6kxVzmzaCFlclFxDLwKDzHhvokm+LJ8xmuaymCBzIbRNtw/QKgZ ooH7WESO7+9ktRoVHMs7VHBvteN9ewmgTb514ohyTXuRlZJFgWCOKOFMwdA8BCycIVI1 BrGw== 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=5TWWN7Kd5qrUIKRFDGyk78Uz9W5wUZzPbCpC/pead+g=; b=E1gItBVx7PfpTccYAciza1x7vTftwG7hiW1PQUJ9SBtI26jblpdr8r31tf8aBpCxRX 91cqrnrj0f5Xvo3IcCr3z3CHN7C+L1dQgAcpp6AzUppKJG+HFvHlh8gOsGN6UiFZpHw0 n0M+q5cPC/ELGNznACH1aVYraH8j810RCC/yFxQA6YHJe1rV9HDxDFQik4ZREdx2o5KS oix5CIT7rySyDrRd2GrexzsrP07uAX6jC2wM6f6h1ZNXmNsx1mKPlDhDC4akI6+H8Puw wfoYqn8rBKgJdGoXV2NL4jAwkHhTOqQ9ZIMyDHzApd6VDJ+35WQf+V7LVXhOhW+nKRp7 EAjQ== X-Gm-Message-State: AODbwcCmuK0bfiK2t+Kdtjp+03WjniiUozE0QpnZs99QgLxo2a6X4AmO o8z55LFvH3gQcGiTsf0= X-Received: by 10.223.155.214 with SMTP id e22mr22376104wrc.33.1496879787099; Wed, 07 Jun 2017 16:56:27 -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 m40sm2624808wrm.4.2017.06.07.16.56.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jun 2017 16:56:26 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 8 Jun 2017 01:56:05 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 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 5a8478c..3075eee 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -445,6 +445,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) @@ -500,6 +518,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),