From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id DD5B41BE39 for ; Tue, 26 Jun 2018 18:57:13 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id 69-v6so2579693wmf.3 for ; Tue, 26 Jun 2018 09:57:13 -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=N8pglJplSF4S0X8rw3UoOegpceBZmwP70wqd8qfib7vT5Wf10faeQmCIO5fdRXZeZ3 RtKn0pZ4XqWKi3p1hpVicw5vyG4e4BaaeVtJrbcHeeLr1vCqmR7qIy4aB61Ag9decbeU c62NgCl4l4VvuANMXOw8Ml8CGkVzk7bpby+2ziHvhyUhj7dOiOVEJ6afzJ4ldySgnO44 tFVLbiHrbhcM0Y8yxpdMu4YRUqIhkrIpwvB5WMRiaBEnfdHB24vIzbab27bvjzEncB6b PqeRcnuqiH2sRO61EauaDgHJA2iI9jsXoPQU4lk4i4HmPdWl7dXQ6q8DHGfvnleLjzE9 CBUw== 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=uBalPHzxAGXTXSJUoFIH0zMuflfxatdf7ooNKFNCseKBggTwqp4V8u6btZyHgfizBK bNr/Wo86ESV6GJNMIIKZwC/6K3VcbfP6HzpMlTUsJ8xlsaFbNgLtF58UIKahQqYesMVU 5mPYCwf45dEpyIZY/rCKnthqSjApqPOsh1INdkfhkO7lR9+zf1cdVRFm56cWIStR+aiv Vtkfmdqg+6c3yEmaElImSvNOmgVS8z7UJkioFf27Qwkyj+tKilv5cxnirulHp0k8cgSe zII+AOsAbm5jYfR4NRbILgJwFBJRWDY3EkjKs4PxqLea4scvgV145wmzdMuestTCBp2T JbCQ== X-Gm-Message-State: APt69E019Z2TrobkLXnoIdtz7bhfqtXvOLGNYb4TosaThqTiooF6SXHM 9wck5UedJ3majT6yKFFZhG21JwPY X-Google-Smtp-Source: AAOMgpffx4woH8SrnnNQ3C0pdgtgmjZzglV2wPWCQjcUYm5HbY7c+m0LS3D7pAAN7RzLC6GVxMRcow== X-Received: by 2002:a1c:2489:: with SMTP id k131-v6mr2397342wmk.114.1530032233158; Tue, 26 Jun 2018 09:57:13 -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 p5-v6sm2680880wre.83.2018.06.26.09.57.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 09:57:11 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 26 Jun 2018 18:56:20 +0200 Message-Id: <9f28896afeadb352e2ab8ccc0e59d47769ebba08.1530031921.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v8 17/21] 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, 26 Jun 2018 16:57:14 -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