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 BE6193254 for ; Fri, 7 Jul 2017 02:03:45 +0200 (CEST) Received: by mail-wr0-f181.google.com with SMTP id k67so24090127wrc.2 for ; Thu, 06 Jul 2017 17:03:45 -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=iKQuMV00YwTyPqwAi+2G1t4M/gfe9s6xXO/G11FsBkc=; b=JqrtOvoyiSDWrmphp1/d2BIH+yhgl2NikI8lAdzm7HLuoaSY012w5hSWPukN5O5unb i0YDZfLJ38VT3nrpzrQto31GTsW0/TofZ9UgpdIFr5/+N2jnG+QabULvOrhZK2+WAezl 4S+cTpaXxlNtbgy8x2M+iqtRevQDtvU/Ehd9XBL4vsdXMo4jEUMQmSWpCdUBqMkaDBWa evZ3uJPCXvo8YRBdbKN+etBZbbRd/7VbjL7uYBTxkmq2+8Lfh0zY3yNHDcb6WNxLi261 GCTJg4ihKPbnb2bcKZGy+6/ttohuep1brETBGYgrOskhWuKnaTfMM70KZUdul5IvVXHt MPQw== 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=iKQuMV00YwTyPqwAi+2G1t4M/gfe9s6xXO/G11FsBkc=; b=uc/RHrndJ1941K4FTfVAMD/eLymnl50OT3iW2/2ELlolSY9N14TixAAsPV39fbr67q 160n73IYCcRluRAc4C4nscEkDh6jcpog92UxfLMYm3LiW4NUI3C/hSRcH8zgqpNEeoEO 1GHXop7EOAYnMOM+ZXG0g1QtjMR6S64BnLNQY9WQd368sez+cDY/OkhpcdHRCS7j9zv5 L+AEeydE8NJaEcADM7C+qMwCzzfOfZsbrorhYDbATOGTF4IiRyjx3u3NshHPk0Lt6nYH I3nVWlnClW1RsLwtMUJmyRlAfcftc9145h1wk5ViifRzeqjVagKaVDO8t9OqrgAK/bVc w+ww== X-Gm-Message-State: AKS2vOzvLottUU3Ev8vOYkurG0VCVL8NL8ykzjgmDFvrGk5oy0JRajSU iWXIuu1BcX2oeLHZpsY= X-Received: by 10.223.161.89 with SMTP id r25mr49724088wrr.162.1499385825003; Thu, 06 Jul 2017 17:03:45 -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 p7sm2364921wmf.11.2017.07.06.17.03.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jul 2017 17:03:44 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 7 Jul 2017 02:03:10 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v8 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: Fri, 07 Jul 2017 00:03:46 -0000 Signed-off-by: Gaetan Rivet Acked-by: Bruce Richardson --- 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