From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com [209.85.128.173]) by dpdk.org (Postfix) with ESMTP id A1B702BBD for ; Thu, 8 Jun 2017 01:54:59 +0200 (CEST) Received: by mail-wr0-f173.google.com with SMTP id g76so11973682wrd.1 for ; Wed, 07 Jun 2017 16:54:59 -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; bh=RtWnHuOOkt5sCNkgCBxevULLVaBHqD4so8R8Gafq1c0=; b=oUjFcUx9P9q8NvU/1Y6I1EL6xSIFVADw6NsoEFvija8wE33aThmmYNOWNVS5hFw1HX NXIk3in6Gy2D+heO2eBhwMITjd1mtMnr9NrrDgbAWYuXrPgyJDXW6IIbzLGMpuQMm684 CMTH2B9u3gXVue2M/WElfdv6DOv1PgfvFHXeenUt6ZINs2ukaCMYaJ57TWrOE6pKpZ16 tpbj2SsvFpMIbsQVlDiU0naK9xqBSLDxB3jiSFponLq3cEwUEWvZVsHwFPGtutDf1xzr 9WVLyR88cnMjrHLktMrvKT2RwEPae47oxKxRzDUt6B4WgqXaV9SKfkobQom6pS2Efm7d SMrA== 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; bh=RtWnHuOOkt5sCNkgCBxevULLVaBHqD4so8R8Gafq1c0=; b=FsJ1m3BkmfveYuwVWewt3ZNqtgt+u+tv9+nSNGkSlfMX20B3OL1+szVkZ/om9boRiF YdOgT3R7K0JKjKSgNrDsrvyCfD/t8x0hmszGESmwhMPDHRg63LFJ9l0Nf1hIxIxJMz0n V3FBzJBoslRXMZI4D/YsTk0Iyy1XwUoowpQPDvfm1wzfoc3GD0WyTawzyxqZh3sg6UM8 kuxxirwetD95ORQM14QGDfT2Og3RYvDo6zNlf69thmdIVuaC1bo6n/2b+OVCj3XXuwdu ZfhqQiUCJfULx1zvMC+2Zgu65FTancQtaktj9gZdeefb5gZ6Tbo2snrhP4rG/wngNk6D yjyw== X-Gm-Message-State: AODbwcAKEK9pqU+E+F9ebN04uAiDo8FvzWDO0ddEtU0VFTE1sS6G6LMk PyJwO6+tftDEQ98IUD0= X-Received: by 10.223.167.15 with SMTP id c15mr11948539wrd.79.1496879699171; Wed, 07 Jun 2017 16:54:59 -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 y19sm4341200wmh.21.2017.06.07.16.54.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jun 2017 16:54:58 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 8 Jun 2017 01:54:48 +0200 Message-Id: <29efa24a4f059c8ec7cf54297ef8ace7f8d5ef13.1496876748.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <9d79d06e063c1337233dac6ab978bb98f52f6375.1496309620.git.gaetan.rivet@6wind.com> References: <9d79d06e063c1337233dac6ab978bb98f52f6375.1496309620.git.gaetan.rivet@6wind.com> Subject: [dpdk-dev] [PATCH v3] pci: implement find_device 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, 07 Jun 2017 23:54:59 -0000 Signed-off-by: Gaetan Rivet --- This patch depends on: bus: attach / detach API http://dpdk.org/ml/archives/dev/2017-May/066330.html http://dpdk.org/dev/patchwork/patch/24489/ v1 --> v2 * Use the newly defined rte_dev_match_t type v2 --> v3 * Use new comparison behavior. --- lib/librte_eal/common/eal_common_pci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 5ae5201..5a8478c 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -483,10 +483,23 @@ rte_pci_remove_device(struct rte_pci_device *pci_dev) TAILQ_REMOVE(&rte_pci_bus.device_list, pci_dev, next); } +static struct rte_device * +pci_find_device(rte_dev_cmp_t cmp, const void *data) +{ + struct rte_pci_device *dev; + + FOREACH_DEVICE_ON_PCIBUS(dev) { + if (cmp(&dev->device, data) == 0) + return &dev->device; + } + return NULL; +} + struct rte_pci_bus rte_pci_bus = { .bus = { .scan = rte_pci_scan, .probe = rte_pci_probe, + .find_device = pci_find_device, }, .device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list), .driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list), -- 2.1.4