From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by dpdk.org (Postfix) with ESMTP id A7E1637A0 for ; Wed, 21 Jun 2017 01:29:53 +0200 (CEST) Received: by mail-wr0-f179.google.com with SMTP id c11so55992977wrc.3 for ; Tue, 20 Jun 2017 16:29:53 -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=tjqI29ilY4kKBMG5nOy4tpYCC4CTfVaxuIKSf3JLPKU=; b=pzaEdjhXMfPdMOJ+zkGNAeh65dTUFn+mxLQ7sSKiTR1ftl3H97KQFmYR8z9siQ5Ucs aFjwGEmvukcHpdEnxKFeBAToDtQYRNxbUPbgIdKb0Z3fAMIEe0fFZCJWipfztTyv5yfq EJHypQHP189mqJASct9cKAX3E9zk4Y9Iz1r8VeY3wGV67EDRUIt1bTnXWjVhqOUcrPv5 GkBtvlQA6h13hsv0QyLVzOUDSwDenzAYLzyAnBn+y/FtYGPuuujAvFgaKdftSB9KTCfv 6QWwHilxs2cGv/nj6JmjAOJGqNhq1X+24dE207YQZiJo83nwXzCiL/hROCTuIs30qtLS AH1w== 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=tjqI29ilY4kKBMG5nOy4tpYCC4CTfVaxuIKSf3JLPKU=; b=C5tYOUdRsAG0YEcvWOz21lbWbMJM/tXbimKZRFm5kb4VCj+ac9UlksDiZyetBi4kOC H4q0F+1c1MrtfHEjZSaU8EDlh0S4GQsULilxrWo9sUfRTV50iPoaI0F0HDDdQOuSz/zp YVwTz47+/JMkbmOToRVE7GqQINj1G6tbCkbixZtLfMj2NaxZ1BbQyAvvcW7WxqVuXNVU cNG7eQo6YBgj3o9ZKOrIbcQRCJpB0CjxfuQJbcSpd8KCbWCQOgdbZCRk/ckS3LDu9cdr ZyaXTBgqgWkgSZZCnnkweH/Y4TmnoyaFK014wnxt/cNWVNzhkfpB6yT46f4K3QD0QcQB l8dQ== X-Gm-Message-State: AKS2vOyurJ9i9OZAV7jHgogp8dl6JSUU2F9nkCk4FfP7IVbFeWrpqRlk mzUndFwOGW5osFToBks= X-Received: by 10.223.175.37 with SMTP id z34mr21595021wrc.11.1498001392897; Tue, 20 Jun 2017 16:29:52 -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 l127sm8592248wml.26.2017.06.20.16.29.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 16:29:52 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck , Gaetan Rivet Date: Wed, 21 Jun 2017 01:29:27 +0200 Message-Id: <47816717179b87c54ad6064f19ecd9d5966ccaa6.1497999601.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 v4 6/9] vdev: 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: Tue, 20 Jun 2017 23:29:54 -0000 From: Jan Blunck Signed-off-by: Jan Blunck Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_vdev.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 0037a64..52528ef 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -338,9 +338,22 @@ vdev_probe(void) return 0; } +static struct rte_device * +vdev_find_device(rte_dev_cmp_t cmp, const void *data) +{ + struct rte_vdev_device *dev; + + TAILQ_FOREACH(dev, &vdev_device_list, next) { + if (cmp(&dev->device, data) == 0) + return &dev->device; + } + return NULL; +} + static struct rte_bus rte_vdev_bus = { .scan = vdev_scan, .probe = vdev_probe, + .find_device = vdev_find_device, }; RTE_INIT(rte_vdev_bus_register); -- 2.1.4