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 754291B529 for ; Tue, 9 Oct 2018 15:34:58 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 16FA62205E; Tue, 9 Oct 2018 09:34:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 09 Oct 2018 09:34:58 -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=Wm8F8rJCw8Qh zUgD5ZDHcMwQmZD0dQ/FC49Nxrk58PhYuZKKPX5xEgJToRQZPpzpW+71SEbs0fzJ PQL106OT8nG3OLQc8JmTDW0qmF1XBDpT2Fo9DuU5Vav/bYTfpDiLsxjp85Rj6jrd J0OmL2dOxr3oaA4Uan+7Y29c4vf9S18= 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=p8sGrf6Ztpzz9GmN/JSMm/cB64cHi6tmvz6NQUYEvkv2XJ0yDe2A3NBRx /4kLxVR9KiSYD6bz4xv0i/AF6H/i94x9qAcamSJX1mFYL4IR6vKdsIrd5ZFBvG4w 5WixmFj/mbaC9BwGJDLuYKVhSDlWJ7pKEQKNjv/0UFolnggJvASYX9OyyN0jw3dU asrOkY5OvifNi0FC5h4aq8cqbBhXpOBBc989G0ZvnGWukJsV1MYnbXOuN9vDm6UB 6ywM4gyl+3GmEMPHIui2o64dvWnxeb0jLUssU+CEApdvQRrX/k08gA51aH5lo3Tf 9jUpN1aG64Wl4E8Q31ydLBnknEkMA== 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 07E8E102F0; Tue, 9 Oct 2018 09:34:56 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: gaetan.rivet@6wind.com, ophirmu@mellanox.com, ferruh.yigit@intel.com, arybchenko@solarflare.com Date: Tue, 9 Oct 2018 15:34:45 +0200 Message-Id: <20181009133450.19112-2-thomas@monjalon.net> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181009133450.19112-1-thomas@monjalon.net> References: <20181007222554.4886-1-thomas@monjalon.net> <20181009133450.19112-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 1/6] 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, 09 Oct 2018 13:34:58 -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