From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 94CD21B5B8 for ; Wed, 11 Jul 2018 23:45:58 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id t6-v6so19592093wrn.7 for ; Wed, 11 Jul 2018 14:45:58 -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; bh=c4pvHB/dkgeBIxWKVss7FpOOVZCeyZrc/FE2WAjRLfo=; b=tLhv0Ctq9iwXhxp5xHgQj8ojkmoN1RNUOQasHIae38oh7uhcYGJuP63Nms4WdVx47s 3zkV2cdMsgqTcaVyA2DJh6LCccobD/OO0brEcZpO6m9fUYZegyTcaZEZnf9ISVXAbC7j 1ZDG+d4h/zIQV0NF2s7VRYvlgMi7ccB3RE6d6/A+wJfn/dAL4PLY6JgVh48HAOhCopVs ek4HProsqewZW/C0sMZBuMN5mXacfI7mvKd5c6FqBlGY0hfeRjoxxrjlISKzArQa4Ori py9B5vptuEaq3vywSBTxqSWmbe22DHhhfY0TT3NocCF+7YJjDPBl1JSJWbRhVsvzyFkz 0Rqw== 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; bh=c4pvHB/dkgeBIxWKVss7FpOOVZCeyZrc/FE2WAjRLfo=; b=umQFvgHS/eUP0Tpw7CwWw8BTBmx+jIjBSiXpvRFC2w2ukQUyEMxsJWd7cld84PLgMK nb/HxZd8CcLq2CmfI2Tnxlt+u2otABZdtbsW7rcKYoMRtAWTZ8/vLC9xLb83YMkzYgBr IEeNHWkcnywpCQTdZRbSZxuw/uGvgwQXruPOaEpNAO4Wq7jxn9DlUK2FmAihAHArdJ2f KXIGvC0PgjMyx/z8WbSSYgzGu1+3azBbZkvgSx8w5g0NSY9Tw05i/DHluCy7BCPoVQW5 +GL0no2MmA9FPX70fGvZ1DpzM3nNs2G5ZVC69zbzGsacLrbUHAbBWjqIgbj5syjJh26h wPaA== X-Gm-Message-State: AOUpUlFnW/Xzzl/9aHa1KdrPYCvzZtxL9YIxRpKe5TgJnl/eRD5fb8TY olODgdWgJCHBuB4C1XFL5wZrsaEF X-Google-Smtp-Source: AAOMgpd73knzCZ2QuR/xBq1JCFmHs/NOA/LPV3DBbttKjWkEkUsYXHHK9XYyB4isvYg7niwEwkhcmA== X-Received: by 2002:adf:cc0a:: with SMTP id x10-v6mr202051wrh.242.1531345557906; Wed, 11 Jul 2018 14:45:57 -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 h5-v6sm10550936wrr.19.2018.07.11.14.45.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 14:45:56 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 11 Jul 2018 23:45:06 +0200 Message-Id: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v11 16/25] bus/vdev: add device matching field driver 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, 11 Jul 2018 21:45:59 -0000 The vdev bus parses a field "driver", matching a vdev driver name with one passed as follows: "bus=vdev,driver=xxxx" Signed-off-by: Gaetan Rivet --- drivers/bus/vdev/vdev_params.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/bus/vdev/vdev_params.c b/drivers/bus/vdev/vdev_params.c index 842a4684e..2f55f451f 100644 --- a/drivers/bus/vdev/vdev_params.c +++ b/drivers/bus/vdev/vdev_params.c @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -11,10 +12,12 @@ #include "vdev_private.h" enum vdev_params { + RTE_VDEV_PARAMS_DRIVER, RTE_VDEV_PARAMS_MAX, }; static const char * const vdev_params_keys[] = { + [RTE_VDEV_PARAMS_DRIVER] = "driver", [RTE_VDEV_PARAMS_MAX] = NULL, }; @@ -23,9 +26,17 @@ vdev_dev_match(const struct rte_device *dev, const void *_kvlist) { const struct rte_kvargs *kvlist = _kvlist; + const struct rte_vdev_device *vdev; - (void) kvlist; - (void) dev; + if (kvlist == NULL) + /* Empty string matches everything. */ + return 0; + vdev = RTE_DEV_TO_VDEV_CONST(dev); + /* if any field does not match. */ + if (rte_kvargs_process(kvlist, "driver", + rte_kvargs_strcmp, + (void *)(intptr_t)vdev->device.driver->name)) + return -1; return 0; } -- 2.18.0