From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 334491BAF7 for ; Wed, 11 Apr 2018 02:05:02 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id u189so608829wmd.1 for ; Tue, 10 Apr 2018 17:05:02 -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=9KzhQvT58GsNU3x7Pc/LplpMyY9AcJY/q/IaUtYiqZg=; b=T31UmYpXYWXe/ms9evrbX3hDyxrLBjBmievV5WJTW5MFfFsfS5mr301IslGEDeMgEc rtpP4gGXQq/4ZiWwkGaOPZ2NBzg34wOxF/U1vPoNc6nHvFHavWT74SzQ5r09SXcDaggT +AfKgu9zuM591egHnR4jySTWUpChS+0AvzpZXiUOtI4DnrvLuhpTwH9z1CkE0f+N0iPH XdztCVuhtVUlfoYYoTs0XiGa6LBvFfqO0eXKM9VPPrP/OKeZlY48ut9HQHauD45SlqWj 5U+L+suWiedoE+rAsEmooK8rmhMon7F0tn/oR5R/X3C0PVgGIyA4pXznKaz9cdjqwQv0 qhxw== 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=9KzhQvT58GsNU3x7Pc/LplpMyY9AcJY/q/IaUtYiqZg=; b=ryctTWqUqZTWGY2tr6QMJG2P3HGfemJU2p7eead5WAzhVPF2kkCLgKKNqAh+cnba/S zDQf15O0tom+hYsAU4H+s7x/xrjQSBk1GWKS2IJ6SGtXgRCmq+VbecV9nhdcRFewmSgo tAsgkBegQ0lcUtKhxctUhJ6O7+sOOp/9dMO/9ffZk9GhRZ1phWX9MmKytFPeqwl8UOCi KTN5rXIegNiR1a+21qSwbcFp0xSy8kjjuf0tH5DMpTsX+bvG5Veed9Ix+xp2Ff+6rRV5 X1pQ/6TP6A1mFUY/h1SJqF0A3KRHUazpviic/Qt+Wd4De06BMJrG8BTPS6wGVT7k+pHh m+5g== X-Gm-Message-State: ALQs6tBDrnuwXVnvP9Evosnp0rOULqzOeve1li/PWa+508Q24F7QfCE4 wNd/c8veWz/l8tNhjx7DWqsk34U/ X-Google-Smtp-Source: AIpwx4+8k3W9IokUe0w59kTpbXC9WT1wBF+c1gJhQDr2cJFqJ0Zw+7DTeND2bG1IWxQB6+eDXo1bNw== X-Received: by 10.28.94.131 with SMTP id s125mr898606wmb.83.1523405101586; Tue, 10 Apr 2018 17:05:01 -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 39sm7626563wry.89.2018.04.10.17.05.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 17:05:00 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 11 Apr 2018 02:04:18 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v5 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: Wed, 11 Apr 2018 00:05:02 -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/Makefile | 1 + drivers/bus/vdev/vdev.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/bus/vdev/Makefile b/drivers/bus/vdev/Makefile index 52728833c..db6bee98a 100644 --- a/drivers/bus/vdev/Makefile +++ b/drivers/bus/vdev/Makefile @@ -10,6 +10,7 @@ LIB = librte_bus_vdev.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DALLOW_EXPERIMENTAL_API # versioning export map EXPORT_MAP := rte_bus_vdev_version.map diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index 1cc469da0..fae75d285 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -417,10 +417,12 @@ vdev_unplug(struct rte_device *dev) } 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, }; @@ -429,9 +431,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