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 D31441B3B6 for ; Tue, 9 Oct 2018 02:16:23 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 515CA21FF3; Mon, 8 Oct 2018 20:16:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 08 Oct 2018 20:16:23 -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=7b3+5RaIiVMKnCv8hGqxXKa1Xbx8e/hyVUGhIfIeryY=; b=gqNJrlSqJZW3 te1QgzFfHwF/3si7TaRqQ+Cg1yBmc3UI+iuXXbMlxU849BfxNmusFyMByxt5/rT+ uKfZskgMPiY0E20xSzJ0Rcfv/eMxBubAlVIkXY7hrQZZziYw0T4hifnA9YNebmCS SOSHS7W774Ll8Umm2KwZUkVEqAIB+Fc= 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=fm3; bh=7b3+5RaIiVMKnCv8hGqxXKa1Xbx8e/hyVUGhIfIer yY=; b=UUKuJRY4C+nzYqhV7R5oIRZAFg63Cky/gtggSMs+8Y4hsMcyyQ6etFTK5 9Ft5BccEIvXlos71EiTeiH4pFRmXsQRC0GH1DVmqXu79Y+PtfhoVmdK0u5E1cnN3 5rLjvzAX5+INXSjRgZ0ro3I8pOXvoYyF0fltnm6yET29NK/GgxjmfHTxBBY/WxSo cPObAnYh1dIWyKFzZ4Q0JMBmkzsHK90QWSH0bcCdnVM9Rua1GSjIRzCkIj1eea3e UQlOCc0fYXerQdF+stXFlVUKiUzaTZgGL0qYhJbtTTGjY6diATVTWYuCpCqLLqAi 7oPgD/E0y2jYmHerEcT+Q5r4rDmdg== 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 4BA86102E2; Mon, 8 Oct 2018 20:16:22 -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 02:16:11 +0200 Message-Id: <20181009001616.10497-2-thomas@monjalon.net> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181009001616.10497-1-thomas@monjalon.net> References: <20181007222554.4886-1-thomas@monjalon.net> <20181009001616.10497-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 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 00:16:24 -0000 A virtual device can be matched with following syntax: bus=vdev,name=X Signed-off-by: Thomas Monjalon --- 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