From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id BA6237CE3 for ; Wed, 24 May 2017 17:05:42 +0200 (CEST) Received: by mail-wm0-f47.google.com with SMTP id e127so77958862wmg.1 for ; Wed, 24 May 2017 08:05:42 -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=AIvLlNU4v7jwPZsOZ237hHgiDgFqsan88s0Q2X83kEI=; b=l5s9Lip6lFlzdVNFqzk03y3J/oNXQ1PrMu1IGKqEAUeCuCbzM/ASUjd/3GOA3IRW8S nCxDSETN++Pc3DmEn7Sem72uuF7knPpNzvnAtLA/QXOVyRyeF+s8gNbHPZwssLB52wi1 NQZwlJno9FyFsxPzoJm0vH1wj0uzQ0aImz2OnzXl/p8pSQEz+k4sCDiCBlYm0UZDMAdo HgDVASlpOOzETbLZuBm3Af2ClsGCS+SpPK6zhTOXYVR8eQCiqKhJEuORSLt++DhATaBj 16Kwod1u9LBI7kc5J7RhXbfOXVkQStcwWt7iXugBqFxNNK4dzkZyPT9ZXKn7sR4jvYXP 0f1A== 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=AIvLlNU4v7jwPZsOZ237hHgiDgFqsan88s0Q2X83kEI=; b=Na7cECBgBI+77wi7bWdokXruAfT/xhkZ9iDLMMOLLX0eAaaF0btqGbu2DlsP9sB+rD 0TE17bXzYPb3PD0JQXj5JNNodiMJPuW7lHVcwZvx7c8m2sJJpE9yvGjWUsG5MI8xrZXa fNCJgw1SB0Kk+3ZrDo/m5tG2HjerFt43Vv2WBWrkIV3vl3+3APZTtSfqBrfWAxoqBMao Ptb/LKBWvec+WHw776H5b8fIB920hh2Jehp+DT4QM0fn+N3LRPQ7mCWrPUuSnuL/wq56 59RIFn9woFoZqCr/ZdQIRw0NBEe3c8WDgVw3dm4oRV8uKjFcID2CfOp0GeY7OL4YDhDj IYBw== X-Gm-Message-State: AODbwcDwgRZUULceQ2NMSookHu9PDPAu66cyk433Iv5+xIr+zdj6NLj6 CwK4fjnzqcuFEyJEdEg= X-Received: by 10.28.209.131 with SMTP id i125mr6224435wmg.57.1495638341980; Wed, 24 May 2017 08:05:41 -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.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 May 2017 08:05:41 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck Date: Wed, 24 May 2017 17:04:58 +0200 Message-Id: <7edb13ac85b3efa9082a39057a9d455ea7c30616.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 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: Wed, 24 May 2017 15:05:43 -0000 From: Jan Blunck Signed-off-by: Jan Blunck --- lib/librte_eal/common/eal_common_vdev.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 0037a64..5fc516f 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -338,9 +338,24 @@ vdev_probe(void) return 0; } +static struct rte_device * +vdev_find_device(int (*match)(const struct rte_device *dev, const void *data), + const void *data) +{ + struct rte_vdev_device *dev; + + TAILQ_FOREACH(dev, &vdev_device_list, next) { + if (match(&dev->device, data)) + 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