From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com [209.85.128.171]) by dpdk.org (Postfix) with ESMTP id DBA1E7CD7 for ; Wed, 24 May 2017 17:05:37 +0200 (CEST) Received: by mail-wr0-f171.google.com with SMTP id z52so56848845wrc.2 for ; Wed, 24 May 2017 08:05:37 -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=kGUJ9J9Stc8O5TEFda4un7Z//c41Tq+52amZszMHaM0=; b=tC7vUD+y/KPmcjA8DGcH7JXcF7svklz6ZQ3rn17Vo5hJVnffVaEGePJoC4uUQdc8AC tQCpPw8zZ5h4Ipph0/1XS7By3MsnkQgnuJ0pB/3GjbwCzTlxzSkcNNEwI1D6sJXAKE25 gpY90hJQ09LLa7DAiORB4eKOwJ5utTd46nLesATqZlUFV/H/TbgKZQ1PlLoqczMy7suW VFFWnnqN8huf10TFsCmp5rvW6D8qfTZMPmTkxf3+WdiQr0Krfm92GRkERBctBg0GUMC3 3nFZjFT+VyHA7eO/qlOaqW51eeB2iy36MxYKbuMMYjBSZhRD7/2fKndEGh7VNxa1cjYa c/kw== 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=kGUJ9J9Stc8O5TEFda4un7Z//c41Tq+52amZszMHaM0=; b=K1nbIblm/4g1r3xlng7bIbUbheiqWyCrO72Cztfz2Gjz1gdTwRa49kg84bR8PF6Vz/ z4NVlPWzyTZqsy9vWbnfVmpGY/mej9tfFr7Y5igqEsY7e2g+N5065an1pAKKMvjGAOZ5 SilokPEvWO3z7Vhp4DJD5lKwy63z+WvQ1Vp97seAxCOOT6WhR5Y2r1osZ+jjAmYuVH3p 3dU8F4IpRhVO59pRgNqYgz34xlR2oKoHyoQ36K8I7v71SbVVSSFNwov6Kgm7wCpdIaSU 5TvPL4IeemJDjDOXDRXZovN8kdsYUBo3GmbWbQSN4r6gx7va6Lw91vUVzDe3xtvaA/Vb uX0Q== X-Gm-Message-State: AODbwcDOdSFWwdNzO9VwgsS+gJYW61KMQiYCkx88M7CqZkBBa/k+YDBP v1eYCPPLNAJsvkgm X-Received: by 10.223.176.37 with SMTP id f34mr19940291wra.93.1495638337623; Wed, 24 May 2017 08:05:37 -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 25sm4076017wrz.8.2017.05.24.08.05.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 May 2017 08:05:36 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck Date: Wed, 24 May 2017 17:04:54 +0200 Message-Id: <1265dd88039c4750a8ca7b22d32f578c8fd92fd2.1495637723.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 2/9] bus: add device iterator 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:05:38 -0000 From: Jan Blunck Signed-off-by: Jan Blunck --- lib/librte_eal/common/eal_common_bus.c | 1 + lib/librte_eal/common/include/rte_bus.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index 5e33129..41926fb 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -50,6 +50,7 @@ rte_bus_register(struct rte_bus *bus) /* A bus should mandatorily have the scan implemented */ RTE_VERIFY(bus->scan); RTE_VERIFY(bus->probe); + RTE_VERIFY(bus->find_device); TAILQ_INSERT_TAIL(&rte_bus_list, bus, next); RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name); diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index 66856bb..fe31f03 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -82,6 +82,13 @@ typedef int (*rte_bus_scan_t)(void); typedef int (*rte_bus_probe_t)(void); /** + * Device iterator to find a particular device on a bus. + */ +typedef struct rte_device * (*rte_bus_find_device_t)( + int (*match)(const struct rte_device *dev, const void *data), + const void *data); + +/** * A structure describing a generic bus. */ struct rte_bus { @@ -89,6 +96,7 @@ struct rte_bus { const char *name; /**< Name of the bus */ rte_bus_scan_t scan; /**< Scan for devices attached to bus */ rte_bus_probe_t probe; /**< Probe devices on bus */ + rte_bus_find_device_t find_device; /**< Find device on bus */ }; /** -- 2.1.4