From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id 1B6A71BEA3 for ; Wed, 4 Jul 2018 00:15:59 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id t6-v6so3388244wrn.7 for ; Tue, 03 Jul 2018 15:15:59 -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=asEL7KDRrDSON5+PzJnFF6wFSrQ+kM9WHbufKyn5N6Q=; b=rCq690lVXajXY64YXDfa5z7TYQfMSzzlSfBwRBhpyRVIaf5ctd8muW2k1H9Rsf/6A/ ySSsZEyvFx/zIsxUIHjfld7PEcdmwIe3jpATS2fVwgJUuZwXeEtP30MNf766pkQ9NUQS 93uTkHNhVn+2VN9d2WjRVfOUVfWLFtD32MhuJmv7frYVbbVibrVEQqllU7s1+2pnRN7N 9fBib6Yq/Xzz/fQXz0SSObCbUhmcjJrPYzud3RB3RohvlbxbpJRjoMuydqLIb88tyL/P aXeLp4nLIbNFoq98aax0cqSjorKl6CIrhaup32qXbJFXX2Oxcn2+RXrjhww8MIbMVCiH 2fqg== 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=asEL7KDRrDSON5+PzJnFF6wFSrQ+kM9WHbufKyn5N6Q=; b=Yt7etfgRKDowxbBGDYC05Gk3sjAMpUlcuSWgK69grbtJkL/XiqsxYXkY0pvoTeO6PP LYnqplsCyZ0qLH4T84vBTDWvSTHIk6RYx9/QHJl3uyH9rGFmb5PQxEJj+V+iPmCkbQNj zZg498Wm9dYluLiVGWcuEzvpIbnO+63mm287DbbXpGNTAqK3FSTlB8qcdS74A8XTFiT9 1ICWyBsGTUhHhUb84Jo1xof4v5eefO8cqDtvQQOKz6D6ttGw+H06o83SwTG+uFQINMUZ QYCyFPqSxMNzI1ZoQ+7D+glZOUww2wOid0wnBZrXbbHzwssvhMNeavxlsiPy56J6L898 Ow4Q== X-Gm-Message-State: APt69E0zQlXbf/RqU6ENirXHw3CUI+7qPYfaRD2//7buzpnsm/oFEoKe Of0JEjcGFm9MKu6uw46GZ4Izmz1h X-Google-Smtp-Source: AAOMgpdVV6oZrGYMkrjQNMpnhBw/YTygnQ9Z5vBgal+vaX0xsLKn2XRDZm8v+jXPPVYstI+d/XJ2wQ== X-Received: by 2002:a5d:4e49:: with SMTP id r9-v6mr22765894wrt.27.1530656158518; Tue, 03 Jul 2018 15:15:58 -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 i190-v6sm3771084wmd.33.2018.07.03.15.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 15:15:57 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 4 Jul 2018 00:15:01 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v9 18/27] 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: Tue, 03 Jul 2018 22:15: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.11.0