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 DD41B1BF03 for ; Thu, 5 Jul 2018 13:49:20 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id 69-v6so10306440wmf.3 for ; Thu, 05 Jul 2018 04:49:20 -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=LGQgT3FUEzp9D33Je9oAZP8TSIn6ljHRaWvHHgpLxwLtTIPf/M14QzzH6SL0Xkladr Jhb7dIFkNmfZ4HNPDrUvpM9dV97T9I0B7zZqT/gniRqqLyL07C4pb/e16GYwfjrogyBc ORJ/Kk5Roy8a4Dzlwp12j8ipY9lyCdAcZTYTLL8udkVUjHowsya85Atv1lHujZjOTNq5 TCPuXUvi2xLOVwiwt4LTeYJCm4F+uJBJSzcXQgKTX8Fiw0UADtct3mntgCaQmoFlxd6L 37tgnMOWCHZNFElE9XTdPL2GlO0bfO9AigouZGZH9HYXAE3BtgKQ5j+nUchgcmVBVBmR KUBQ== 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=le6/cxukXzcO3X6a+uKJtIeRK4TMgsZmMr0o5iRiVylCJl67Pam1U3I44Uly3P+aE7 K7p9IlBufHr6Giubfx67Pewjocd2uKmdCP/UQRsUfjKdFtSv3SUWPennh2fizfO45BJF umcHqv8WrKRGdN3jswj28zg9RgdARst1op14PpeJEVozzbnBgREekn/NBnTMMH9hUvbG GyKsXa4pK+co30dFSsKXgK6bqEXjsl9gcsSoiDANkVk9JR6wzZ2s0h9kJreqK2xgcOSp wlCLoa4/8/NJegzsslO9l30oGRcBJ9pSssXFHkPZ29aJuf2usvc3yuWgDJ/b992ZCjmZ YGfA== X-Gm-Message-State: APt69E1XlJfF0CvDu7SpX6k8B+tVprNEQFHw59z5DmGA+FE75/n7CXcX CKsEwi3foEpwhUKSy5hnNklsPt3B X-Google-Smtp-Source: AAOMgpd8ytU6QI0AODw2/stgfMyo/SKQRP7xDc3VLyxk2AoG8UK5E9MTkTn8VmVqCJzxlIj2omg1+g== X-Received: by 2002:adf:a792:: with SMTP id j18-v6mr4565421wrc.187.1530791360215; Thu, 05 Jul 2018 04:49:20 -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 o42-v6sm15809183wrc.50.2018.07.05.04.49.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 04:49:19 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 5 Jul 2018 13:48:25 +0200 Message-Id: <59a151c1e58064d9b857b7c62364d0be11560ef1.1530791217.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v10 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: Thu, 05 Jul 2018 11:49:21 -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