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 38E185689 for ; Thu, 29 Jun 2017 20:22:30 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id y5so4063732wmh.3 for ; Thu, 29 Jun 2017 11:22:30 -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=g+EDDit5k44YaBmeWoIx+OpZQJyYd7SBFnWzgBnpGcdsMUt35qDeUHGK8Op4AtEL83 Rdfd48VK1omqtpLHsGdpsfD5trCvvw+pGbx2AiWfh4WOQ9ooIkti2MQN4zMSMP0ao6je J7hCqDSjb0SYk6TmNpe0Sn39YjGOhZJDtF9PZEU54Vxgjh3rhngT3RrBBUakc33BRm5Z JWMzjzJYE9deYtNrS+1WDOOpO9EeB61HopgTIF5PFffltXNn3cZ0nAqZaELQ22hwscOo C0TJM/g4xYyxY/tqUNjSg6wpHlDBdiqk4+xDeLtbBQd4C4o+jslLjIxZuL3OVJ3In0ye Jx8A== 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=RjD225BbLnxhjoFE3FpkailkZJJzMV28JZFkXKgRONOtkJAjRlxU+izyC85Xd7VsgR fRllhtvCc9c77foWuLyzNESlMXQuBzGh1HF/K9KkyfCBFqNc1eHatO4TK5YnxAF6fnmG NzmWrYgwqV7jFUhfLXJVffJu0aw12W7fFQRtufrSdxxoaGlvxQF/5s+Fku3/hfVI2VeP AlYpvPxOIo+4l2Lnd+CUCzB7ajfiqeR3raxO2v3J4TjKUakvDxJTvTVCFaCyJDk8rC/r F3de1+MMBze2XXAmKDIGqVYPK6LOUnBMuJV/k5WwIoCntfRHfjUGV2ru+AnRU+zpmMsy FT9g== X-Gm-Message-State: AKS2vOy2bb7aDTAOqz1kovN39G+QZOiUTbhjiMLJNdOEwdXbQ0BjKpTt Z7Dv0HXNSUEqcdv9 X-Received: by 10.80.179.209 with SMTP id t17mr2700803edd.62.1498760549767; Thu, 29 Jun 2017 11:22:29 -0700 (PDT) Received: from weierstrass.local ([91.200.110.13]) by smtp.gmail.com with ESMTPSA id e28sm1446366ede.14.2017.06.29.11.22.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jun 2017 11:22:28 -0700 (PDT) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: gaetan.rivet@6wind.com, shreyansh.jain@nxp.com Date: Thu, 29 Jun 2017 20:21:54 +0200 Message-Id: <20170629182206.1072-4-jblunck@infradead.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170629182206.1072-1-jblunck@infradead.org> References: <20170629182206.1072-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v7 03/15] 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: Thu, 29 Jun 2017 18:22:30 -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