From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id 99785568A for ; Wed, 19 Sep 2018 18:04:09 +0200 (CEST) Received: by mail-wm1-f68.google.com with SMTP id s12-v6so6885140wmc.0 for ; Wed, 19 Sep 2018 09:04:09 -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=hjh5Svg/mVFN0UZsG0DDMra8FK6VkGqTqzg3Pwn+Jq5S6DvfPNH9Ytv5uvX9Vm/Pl5 g4dbo8Dz7OpHIdY7qgC5nK/ceiK39k/qm+vFerCGJTScDT0iMBHnzmqNZyq0L2/4pGZa s60wAsNCOxcirkQ3yPlYU4AgQ0PjmZRgWRwYLJVZVcz0Qrsojv4P94hCEsMINYSm7ndJ HuoKrI2EpTT6hO6j5SfGOfZAAxmIoUba76fM2UN86ckOgz/Go6FdLbn4TbAaNi8oImjm A3YxjHi882ZKHyD47jXiltX11Lmf/ro6dAKMreL89q2UJVwY5OnIHBf/E0/goyjcMBoE ZY1Q== 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=B75RUFwO045wrSml1vPI3qbHJK6onLFMrnOtjjK45NkiNUyUNs+pncsL7uUiW/9alN vX4FBSDVTCBEsMt7U9pKtLv3Z+Sy4RkI1q7GgKGelkiLmC49OPD0F8Ea3dFtMDOp3E0S pn0M0FwDYdcX/nfHd4Ml8bW+S2yiqZ6bB2Vl42cJ+roBy3piSFIe9HV8ZU552qqKj59E H+dZgwqyMgf6bZqFSrFxHdy9eZLF9BaGEQwK4D77FgCQprfKuP8hrM5y4hmgj7sYZCVa sOgAEk1fh60mOdi5I/lHdkMVDPjGQ1DZJSwfBfqmvx4octwR7a3ghyaVRlck09pk9L9+ AYfw== X-Gm-Message-State: APzg51DuzkguGDL67RNtmljPEzQX7YfaHEiJ8l+iwTnREk3GgIBv/IH9 2l1Z4GGhYv1MZ+Hyq4bRtmiCW5joZ78= X-Google-Smtp-Source: ANB0VdbBk14/5MadXpyBSR5r9x55INLWvWgsosmK2g2McKxCBAnlIQaV5l8BDS7u2+uN7LNCooZ44Q== X-Received: by 2002:a1c:398b:: with SMTP id g133-v6mr22756116wma.5.1537373048801; Wed, 19 Sep 2018 09:04:08 -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 x24-v6sm34983671wrd.13.2018.09.19.09.04.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Sep 2018 09:04:08 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 19 Sep 2018 18:03:34 +0200 Message-Id: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 04/13] 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, 19 Sep 2018 16:04:10 -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