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 BB900A499 for ; Thu, 29 Mar 2018 23:24:41 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id h76so12998260wme.4 for ; Thu, 29 Mar 2018 14:24:41 -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=+ceTu8fpQ1a09gCfcz2DnFuInkTnedMyqt2l0pOU0cw=; b=u3fstgwICoj2CXNA8TOw7YcYCD8DlbEhJUNjsLnQpf/Ysa7QclTZ/lBG/zr7gRz1li q/ItVrFqLObE4G10mj0JGv/BYNbBdRTArVVghPBiQSAhTm6n1t5dTl9BXcu3GyoewSBL Ttxie+7VdDugCqUeYT43WM3MRhFSaM/i4ty7DScQliTSyxx4kRH3IFuDCyJpFMosIU62 HvhQSYSew1P7V3eYeX+1jSBYG5RoBC1kQz3HBWNvrsoxD+R/NNdA2nmLaT49d2lwc1m5 PB/ymaHk6BkkzGX7dFMuQVXTPDziY3Zi5zOwAU68bXmbbplDikcydv32Tp3G9nYb3AFy D4Bg== 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=+ceTu8fpQ1a09gCfcz2DnFuInkTnedMyqt2l0pOU0cw=; b=ZOwWfV9efYuy1B/4HrOFRNLOZBZR2GHsEMpy/ppuh0srtqsDM9RhyKwRgKsYqylwvT 9btGpctD1QAG++bQUC5ohzUuux/TLojLq7yvvKbc67/9yMu9+Z8/G7r3RXjJsfSxDDc2 vMmBbQLByG9PkxTJz0N5POLmlkGpiCq4t/4HTYL3tCuZWhH0s0dEk4dQOH4KPIW/U0ZX NoYqkK5OPTPDw7JGh8BXMpI4N7QciA4zRFi3pcY6Uf9kwkU7eUGZmuN8k8JHkwuWhSOD RDwwW0WoQeBQZQsg4ayDxOmpAccGOvs3tgnoOkyc3tumWMWmRp5raGqhmBfHPqNTQVzi R8/g== X-Gm-Message-State: ALQs6tAtuqJ4+CB5LFxNJll5mcRJ2WL850NaR8mK1a3Df2s2D+WRpg8Q /MB5+aGA1zb2tBQUVc/NSf6nAR3o X-Google-Smtp-Source: AIpwx48WoQMVdbzxN4VLZb2+ibRnqApOEcVn/oWPlDvpsr4TUroyLR2qfncgfdavtbg4bqlU2w605Q== X-Received: by 10.28.48.76 with SMTP id w73mr41917wmw.156.1522358680119; Thu, 29 Mar 2018 14:24:40 -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 m35sm11907457wrm.59.2018.03.29.14.24.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 14:24:32 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 29 Mar 2018 23:23:41 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 17/20] 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, 29 Mar 2018 21:24:42 -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 5d77cc369..d0ba1965f 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 *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