From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) by dpdk.org (Postfix) with ESMTP id 6A18D4C57 for ; Tue, 27 Jun 2017 18:11:40 +0200 (CEST) Received: by mail-wr0-f172.google.com with SMTP id k67so161151386wrc.2 for ; Tue, 27 Jun 2017 09:11:40 -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=kCeulaYA+oggGx0uRPWTubKmW1r9djNVqUXv3VCg+Z8=; b=DZ6vSrYg54fdjPw3BgdmZO19JgwvyWWzGH0j03jtKOs+OJk5oBV1UzZROTc1WjGh62 /O0Y9TzOQj2Weq6NxyX/tJ54ESLZcBe61nwe26HdevmiwG/OCqh6TO4pFJ2coht8+Eei pEtMHSLLJqBZmFOxKmVA/SjpDm8uhGSuldwM3Noh39zD4cAPHnXaqpiP+4RndqcG0+6o gnCEZ1sSH8aG3fyC+pnEM1SQymXMF9cnSb45dy7WofUS+aOZe5eC7wWaIUp/9/+LgzrX ls+uP9fUvn/rhB9H9UsihhAh8XyXZRhDzA9Ffu0FcknpsXFU3DaEYQ+J2Aw7skF0o5mw 0tOg== 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=kCeulaYA+oggGx0uRPWTubKmW1r9djNVqUXv3VCg+Z8=; b=qFnMvLRcIPDC+3fmGQnvKfpx4p4wiHipVadEQxWTMiioC/aVdsWw0JFmk/ViUyMzAC MmX2WxCsVifwOVPl3HPN+WtJ2J7MFLzxzq/bdLqCFTRMgKRvlSTtcRx7g+zn5y5bdL1d O9wK4gSF83I/9oNUzdDLVlTh5GsrjB0BVCvcRgL6x6CgmSTcaf8RPtyfIUInanV2s7Ky 9DYnZeDLgwlI3Jd6bl21oz6U7eK2QQg3nTtJBuG5wqZkOM/OF0oq54E9LykYj3ub1D2j CGkMd8839DThlhR45SNaU/J1Bpo1uXxaX5uJkpV0F3uJHVZs5JqB7CnzeeHua0hKBSaR wr/A== X-Gm-Message-State: AKS2vOy7AupL6nmUYmqxFHSUjGj7fFt3Ph+22cT0xCyciXfsjpfsAgYV VnsQelPfqmqpvPQAoK4= X-Received: by 10.223.171.146 with SMTP id s18mr16589395wrc.38.1498579899891; Tue, 27 Jun 2017 09:11:39 -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 v13sm4080465wmd.5.2017.06.27.09.11.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Jun 2017 09:11:38 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck , Gaetan Rivet Date: Tue, 27 Jun 2017 18:11:13 +0200 Message-Id: <02488b63d455e192a7565f9a1f3ccf2ecb729df1.1498577192.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 v6 06/11] 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, 27 Jun 2017 16:11:40 -0000 From: Jan Blunck Signed-off-by: Jan Blunck Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_vdev.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 0037a64..625a8e2 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -338,9 +338,30 @@ vdev_probe(void) return 0; } +static struct rte_device * +vdev_find_device(rte_dev_cmp_t cmp, + const void *data, + const struct rte_device *start) +{ + struct rte_vdev_device *dev; + int start_found = !!(start == NULL); + + TAILQ_FOREACH(dev, &vdev_device_list, next) { + if (start_found == 0) { + if (&dev->device == start) + start_found = 1; + continue; + } + 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