From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id F384B532C for ; Fri, 30 Jun 2017 20:20:04 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id p204so9336067wmg.1 for ; Fri, 30 Jun 2017 11:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=fFxeWjGvNMKLLGpI5Z/uqTdAI0z3zePr5r0kodfGv54=; b=o366VOCKxrBTqEMyz89AebMUrk2VbpxpLaWsPayw1KO4gWGffK4mhuGpnQo6rUjmiZ D88+zuyjeZMJPMeqGbHiPNLhlrqp2aXl93QBivRdT1mET2oGRH+U6ZSt7Sd/CLzJ5fS3 pP6RU8Bcr2wz28Bqekwc4ciBbgkujQw3WHulj7/9npIoqF9p+Megma4FfM/Zp/zpsrgE TIf5+ZPVBwz9MIKHemF7BXImKDXT+O5x81D2UaPjAnPU2EX97pwLH7C+U8omrJpESNsp kJkAdhJZhkQKo8VJwTisSAswA6RDJ7BtvYfrbatr7zwjtRM2ihqZ8W3P+T625CCLLhtJ LjyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=fFxeWjGvNMKLLGpI5Z/uqTdAI0z3zePr5r0kodfGv54=; b=TJAbRS/0mvGtt2IuF5fuLcUPyWf/dhx3lahXHkodsPMlzO660VCPZuPU5K8SwCbXbx +F/kYvCMLQaGs6n8f8+t2PS0kIQRNMqEF2Y5eVD+JGKzR8HSCmsUAVwlcFGywiJo9m4f cXz9VzLNqBg5vLS9890l7yLNVAW7jc5txUOutxDXkayFbBnIrQ5gcR4jy/dw078LQYQZ KcUHxr19vGV+OO4oCf7LPqWInZW3yLkgc1RDmjelwIGEtr8tQ+Qp5XUDQTbTUFfvSCiV uM3DFdt45ixeXvBVlPnQHJ/HT4t7PFhm8o91xJ4Yb8SX6WrUeUYVEUxF4bAuiwSkrmPX V7SQ== X-Gm-Message-State: AKS2vOw05iFoWIfKgc/6uGsBBCCOo3h2sZAYVzUuOP9p+89AYORUxdVo xmhKsrcFIRkeDJor X-Received: by 10.80.204.214 with SMTP id b22mr6069704edj.16.1498846804606; Fri, 30 Jun 2017 11:20:04 -0700 (PDT) Received: from weierstrass.local ([91.200.110.13]) by smtp.gmail.com with ESMTPSA id r28sm2826940edd.33.2017.06.30.11.20.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 11:20:03 -0700 (PDT) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: gaetan.rivet@6wind.com, shreyansh.jain@nxp.com Date: Fri, 30 Jun 2017 20:19:32 +0200 Message-Id: <20170630181943.23929-4-jblunck@infradead.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170630181943.23929-1-jblunck@infradead.org> References: <20170629182206.1072-1-jblunck@infradead.org> <20170630181943.23929-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v8 03/14] 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: Fri, 30 Jun 2017 18:20:05 -0000 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 b4db2be..9bb7427 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -334,9 +335,29 @@ vdev_probe(void) return 0; } +static struct rte_device * +vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, + const void *data) +{ + struct rte_vdev_device *dev; + bool start_found = !start; + + 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_REGISTER_BUS(VIRTUAL_BUS_NAME, rte_vdev_bus); -- 2.9.4