From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id C09487CF8 for ; Wed, 24 May 2017 17:12:58 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id j27so3149854wre.1 for ; Wed, 24 May 2017 08:12:58 -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=B4aaMuszy4G5jBKGWrimat5iNaaFz2GTLdGLnUbnc4M=; b=Vrz4HTQzOTN45+KQvS29bMLMjiiEI8T7OEWmNpPYq1AA6QSAkwB9de7k/aTL99WfHe VyoJeKMO9c8VY9Vr4gB0lI6CS6sO6256iH0xctHdCUZrCQ/Fd2mBGSsquSoV2O4ixhFY 3VSjl8j2AOhM2xemWEt+NgqBhTdP87skDExjM4Ebe1Pb2eOInEas6hB1uztvwHTFgLP4 aMkQCqpLlXf/fZ/+kmX/uDd3t7KmU6rRJqxg/CAEes/nSMXA0T+CubhC1zIi1EMMfqTQ NbymdN0VUaOCrG+3Aa9YBM6XpNjrsceEnvV6h1LW1Ib7oyUL99Qtj8aAmzkvMwt7xajj s2Fg== 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=B4aaMuszy4G5jBKGWrimat5iNaaFz2GTLdGLnUbnc4M=; b=lCO//FMnXNAwO2lMPSFPAaTpgB/7+jntVmj8Ju5mHim01Aa3SRgN40NuMTeWLHzQY3 byrQTmVP8GWIjFQx9r8tx2KLNJXaHVUtgwdNEZiYGMVK1EgLVbj7UOR3UkVtN8H7tmm3 Quj4FqPR5VGG0NiY41xqSLzUMVU7Ji3r0x0tfB61OVCx4QTWS7tGGnLJnaZrxdpiyaiK 025meeo3ZRd72OfSPLlAbJsMNDKCw75QaFhduzPL3PMQF/Z8Sg6D1IzdCIrptWcuUH37 qdja8gHW67MZ4RSSsBhXzgEKqqOR8boOAgk97Y6netYVUogr1cg4750a1YOnHAy8zuEo WVOQ== X-Gm-Message-State: AODbwcBEcSwTPHzbIhp+lTkWd8SZrJrpNouh1iQG9hh2gbIQYCG7wSAC HFeZlCwzPGHVzyx8c8Y= X-Received: by 10.223.164.198 with SMTP id h6mr20344658wrb.44.1495638778255; Wed, 24 May 2017 08:12:58 -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 9sm5633351wmh.17.2017.05.24.08.12.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 May 2017 08:12:57 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet , Jan Blunck , Stephen Hemminger , Maxime Coquelin , Jerin Jacob , David Marchand Date: Wed, 24 May 2017 17:12:37 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 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 15:12:59 -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..0f171ec 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