From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id E75DE5B38 for ; Tue, 23 Oct 2018 10:28:45 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 91F3722035; Tue, 23 Oct 2018 04:28:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 23 Oct 2018 04:28:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mesmtp; bh=ET7Tz4LmbD1BVE9CWVNC8uTfisBGLDmprnxDCoWCzQw=; b=QYWkHPl5Gz5v ogAaS0l1Ui/k5QjRehLKcdcJDuwuOyzIVZkUtEyb0nhKnTjTITBVNCEDln+qzU/Q NofUac5Qkd9wWqmnpZ/hXnCMiPSQLwVeA/Sq/fnIE8HBOuKv+pviWvd8U2STbjQn lwc1zYjQE2QPfgdjuDI/I3/xy1vaI+s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=ET7Tz4LmbD1BVE9CWVNC8uTfisBGLDmprnxDCoWCz Qw=; b=zP1SqZXeLvcox2+8TVtxWKaCuuN+WtIgHcGXpw8+QgNCuW5UsBNF3uxwk D5tOhclj0M8sJ/OV6DbGTVna0HYUCZMv1BPcwr42Ynl9N+pz+PBBjOQJOQhUE9V7 59lDVOK7JQnFcr5nAJHMmGuuGn3Klyw3FNIT7vu07QiUteGfkuE0FEER9hj0j6lP 4rZS8GRL96h5udHvhFQ5CcncOkKD3K/zf/Lk8XPHq78lQG5SnsV1lnFaRysIGl72 JaReBPm4WtdMkIZLDvcN3HQ/Qf3vFrWLyaRUvESkqiPgvvPGGZAkwnBXrE7Zf8uz ge/SNaVOidWfj9c7bMolyiuxRIzBw== X-ME-Sender: X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 73421E491D; Tue, 23 Oct 2018 04:28:44 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: gaetan.rivet@6wind.com, ophirmu@mellanox.com, wisamm@mellanox.com, ferruh.yigit@intel.com, arybchenko@solarflare.com, bernard.iremonger@intel.com Date: Tue, 23 Oct 2018 10:28:36 +0200 Message-Id: <20181023082842.7963-2-thomas@monjalon.net> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181023082842.7963-1-thomas@monjalon.net> References: <20181007222554.4886-1-thomas@monjalon.net> <20181023082842.7963-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v7 1/7] bus/vdev: add iteration filter on name 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, 23 Oct 2018 08:28:46 -0000 A virtual device can be matched with following syntax: bus=vdev,name=X Signed-off-by: Thomas Monjalon Reviewed-by: Andrew Rybchenko --- drivers/bus/vdev/vdev_params.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c index da270f2ec..6f74704d1 100644 --- a/drivers/bus/vdev/vdev_params.c +++ b/drivers/bus/vdev/vdev_params.c @@ -2,6 +2,8 @@ * Copyright 2018 Gaƫtan Rivet */ +#include + #include #include #include @@ -11,10 +13,12 @@ #include "vdev_private.h" enum vdev_params { + RTE_VDEV_PARAM_NAME, RTE_VDEV_PARAM_MAX, }; static const char * const vdev_params_keys[] = { + [RTE_VDEV_PARAM_NAME] = "name", [RTE_VDEV_PARAM_MAX] = NULL, }; @@ -22,10 +26,21 @@ static int vdev_dev_match(const struct rte_device *dev, const void *_kvlist) { + int ret; const struct rte_kvargs *kvlist = _kvlist; + char *name; + + /* cannot pass const dev->name to rte_kvargs_process() */ + name = strdup(dev->name); + if (name == NULL) + return -1; + ret = rte_kvargs_process(kvlist, + vdev_params_keys[RTE_VDEV_PARAM_NAME], + rte_kvargs_strcmp, name); + free(name); + if (ret != 0) + return -1; - (void) kvlist; - (void) dev; return 0; } -- 2.19.0