From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id B7C091B658 for ; Sun, 15 Apr 2018 17:08:33 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id y7so19283297wrh.10 for ; Sun, 15 Apr 2018 08:08:33 -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=o1rvB/1J14GKS3TI2WvRKUJLuNWjJmGtCtmYdSo7kLk=; b=Awwv9K4a1J5aT9CIasUrD8DJMujaJMjBpjH1lRaM8JGVcMMyTPjEn3S0pJ9g9SVbAK C1x6NgYCNRAmI1XlQee3BVBNC8rHYWE0QcqC7xA8G9S/wXWO9w70WdvmlT16DpOTSrn1 9znXZ1VwN8UZGmQJkULLTFe1fBMA0PYra+ZDzm6P/7oy2TKKltxosurIF5gqBouMIKXz 7rCLsuViyNILc4mTM70PQKs8GeWx/cYqZIst+yGVTWKOxO971+76fk8IB7/B2PsCqpZn DRoR4jWbpS/PSP+HHhkhzvEN8H+P8R/6uEGSJ5r/rKNeVeRysDdBUF6ksHrGovlgOEfy q22w== 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=o1rvB/1J14GKS3TI2WvRKUJLuNWjJmGtCtmYdSo7kLk=; b=cTxIToFcdY2K0bfnmrDUEXMwW5OIO7DUL4eLuXMq0F/tRUg0pLWL9XXkVfUKIBMS6w 6c5ZnqnWLsjD5zGvffY6fopSicAyTEB8R9ZHd+gXE8FJUTLmMe6I8+LThnqtJP9I/DIM YDegoPutryRF+6hDcex+TKPZkxAKfYGOv0lA/hZFPQTKTfmposwDphjP3ZIQxupnRbDv 3Sa9x3wuhPYNck0F+y0M15UXiv+HM59NKlsMa1TYeQO5y1wqWlJbiZTIclJFYtPX+VzP 7gJSLFdtAw2GjctJf8DvtT1AKy0znXK79F8U+6EHQkv2+6QZhTu1COolyHZ9V0bKKXIa T/7A== X-Gm-Message-State: ALQs6tDuwp2ohRrKcinf7HzfG/y2HhJRz0B9QidxQu+6GjVnminrmp7s pCJRjCoKviFEgA463oKO2HwFl0P5 X-Google-Smtp-Source: AIpwx4+DOxirRIvR73fXKhEiCKd18VhOvsLnsp90wk9et+PBf9VpVXiKqmhXZn05M2cgHMajhRO/tg== X-Received: by 10.223.163.12 with SMTP id c12mr522057wrb.132.1523804913091; Sun, 15 Apr 2018 08:08:33 -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 r200sm13673438wmb.39.2018.04.15.08.08.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Apr 2018 08:08:32 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Sun, 15 Apr 2018 17:07:47 +0200 Message-Id: <18c5b0ddbcdc208a4f94d4d9179cbebd069c333c.1523804657.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 v7 18/22] 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: Sun, 15 Apr 2018 15:08:34 -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 5bb87af28..84192d79b 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -389,10 +389,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, }; @@ -401,9 +403,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