From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 542A7548B for ; Wed, 5 Jul 2017 01:55:43 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id i127so150649912wma.0 for ; Tue, 04 Jul 2017 16:55:43 -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=mAwNyxPR51KcNP5fy6arkfyER8ElJhnEtSqBqqtN3aY=; b=RxvlvPeAMHiD7ZvjdowQTIe4+gSNupKOV40+bre+QCvHcm1wPUxgOh/9gqnry8S+aa d0OJkDlMm0Mq8KrTksSFWNboclVQJNPdbIfMkYfRrIDjP2iwjvHm00Jj6MDafc9Ef1pJ JIaP4U1tip3E52oZRhEq0QxcUhSQ4/hASzacNWQSC7xYsd38pEzlLAxhFEyHEKIjl5oC RIF9IFJyteGS79su6ak3iSSSbihhUJAtaKIZKmv427bflTEXUmrNr0n3D1J3gqhD4Bwo khJonBGm1Ru8mjGSANxQsv5Tt6Qku+tdbH11fo3ill8hLXqVN8DJaKgKyo8bPShyqKPL ah8w== 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=mAwNyxPR51KcNP5fy6arkfyER8ElJhnEtSqBqqtN3aY=; b=TxH4wZ0PAwOeOXIL/fuEoMrWkTg7/aNSBRwoH1LKxPkABPot73k+GWJMMhnu8VTYCb e1cAc20GLvg2hQ9JfwdZHQUPLitmn110am+Tv1T7DFTNgiydz9iNKu5nqmHpt1akB3Dw +8PetYtEEiR7UtuUT1LPbEyzdSOmLtlwWcPp7xpHba8ZfBWdWTUAC/y/K8PwDFHkj0pq umD6aAIiWrYUU1YFS+nxl/vRVQUBFadx724PJ9/iJsJaVJSaJU0kA8XphVGm1GF1jKOV 0WYDj7dUIhdb4NnkZUdXFcqRrZqClyxM2iQKUyUm42BnMgX4sT1MmRzX9TlqZN0oH/yA deag== X-Gm-Message-State: AIVw110AgUVQ3glTpX6AD+IcN/YB0if3T/5HdQkvlG+3SpejWHZWSXMY CAd7CYG9zBI9gBBFTvQ= X-Received: by 10.28.10.131 with SMTP id 125mr10014580wmk.28.1499212542716; Tue, 04 Jul 2017 16:55:42 -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 19sm23406533wrx.26.2017.07.04.16.55.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Jul 2017 16:55:42 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 5 Jul 2017 01:55:21 +0200 Message-Id: <640ec833915d1d4ef5f4199025b4db813fc4d363.1499211317.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 v7 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 23:55:43 -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 2c99049..d7e2fb4 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