From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f181.google.com (mail-wr0-f181.google.com [209.85.128.181]) by dpdk.org (Postfix) with ESMTP id C3A1E2C72 for ; Tue, 4 Jul 2017 02:58:51 +0200 (CEST) Received: by mail-wr0-f181.google.com with SMTP id r103so241500645wrb.0 for ; Mon, 03 Jul 2017 17:58:51 -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=jIntWGdzF/xnUIDFfoJmyb/UOFt8aPsxKlTPaZNwWNM=; b=PkzC3WPRSWWXu+IOYkaCAIPWsZQVFeMtfMEITXH1hYCW+4+iXrZTZLCUmobNqI5xWN cUTpEE/zvJPlHg3IpnEt7IQnwbWc4garcrrwYRY7jx1IzxjfYtr/x06BIohU6loT/ozq B4XNlkCqw/xBqraEHFJ1IkDx3ZN7ncjvYL1yb94MpBCZ+RfZYAayeKADoEg/0o0NRiLI YuYRmouTuQcpNUqF53Hm5S+OlZTGmypbCoK4WWuaCBXY2/YDpzjCB8Ww/cxKami+YCBi SgtaENELx8WQaS3QS9ozwN+JdjTrNPo2n7rkWvqVJE8aTUeCGzk4D3pu1aE2o2CVAsVT 6n7Q== 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=jIntWGdzF/xnUIDFfoJmyb/UOFt8aPsxKlTPaZNwWNM=; b=qCLE3NfynOOFhrSmYLagJQPzkqD7sZhpp2LBnX0y1SdmJDKrtGTSML+qmKTJWXFGsk 71EU16rshXjbjZteqQBi7WuhbcBq6l6BuoAPmzuIMy7RVcWcV7ipNiHMulR/1l/th34H TrbqjViT+YyP5IooWngNYQtc0VG8IP+xcT4nfiDLYxGIQkn3KF5iam5KgQcy78zfveXP T3omJrdij/b4lvUI0YQ+z060G19rWOE2qPB49u3CVtlVJMG85JUSe9Z6RCAhbohHtZOI Lqz1Sa+dCUott0jr/kdts+2xXm+JnZWGEbA1aVEkeUP6K68pLP5GKTYwvr+ocW1jOaBs ZBZQ== X-Gm-Message-State: AKS2vOxsn6vDFDWtwUxc2NLj09ylqow88NMjVzyIcWod2cZZeC+NEY3f b3ln1S5UsSonm2HWbjo= X-Received: by 10.223.174.194 with SMTP id y60mr38427628wrc.19.1499129931210; Mon, 03 Jul 2017 17:58:51 -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 n189sm15162731wmd.0.2017.07.03.17.58.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Jul 2017 17:58:50 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 4 Jul 2017 02:58:31 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v6 4/6] 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: Tue, 04 Jul 2017 00:58:52 -0000 Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_pci.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 5ee100e..9549e92 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -448,6 +448,20 @@ rte_pci_dump(FILE *f) } } +static int +pci_parse(const char *name, void *addr) +{ + struct rte_pci_addr *out = addr; + struct rte_pci_addr pci_addr; + bool parse; + + parse = (eal_parse_pci_BDF(name, &pci_addr) == 0 || + eal_parse_pci_DomBDF(name, &pci_addr) == 0); + if (parse && addr != NULL) + *out = pci_addr; + return parse == false; +} + /* register a driver */ void rte_pci_register(struct rte_pci_driver *driver) @@ -544,6 +558,7 @@ struct rte_pci_bus rte_pci_bus = { .find_device = pci_find_device, .plug = pci_plug, .unplug = pci_unplug, + .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