From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 0B5A84CA5 for ; Thu, 30 Aug 2018 15:42:38 +0200 (CEST) Received: by mail-wr1-f66.google.com with SMTP id m27-v6so8131768wrf.3 for ; Thu, 30 Aug 2018 06:42:38 -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=BSwyRBaptRfxlqzjpH2rk2SZMzxR3hESl3qsAuIzBCNcqcZ5wEfgDuIj53ycgQO2rL LPzMa/zhUvyY6adSQOI9PtdjJoNDVqCrCj+m5+1JU9hRqb6g7bPRm+wvoOHtJUZGP31C zZxgPmlE8RyKiUdvr3m+tYZWtLNPn7aQLZncT2UICQPTOaIVY5t5U1VPBjrpc1D0GDsh Rh0vilkxGouSKBg/e1KsQ1knvpbUXtQ5gXuc6xOHSosQ2uhhVQy356MdG57TS9fA4WnH 6YG89uGHXc0dIsJHIp7MKMjFha7vNBMkgrem1NJblxdd1GbuIK06WPfKd56WzQOO1TLq ebaw== 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=OoZk9MA6sfo61c8sslmd77PmkBpt9+83rYHZ136sgIJewK1n7WIwGUQz6fMy4epLFG tb1nTYiy+yUd6ZGeBT7bKVTgkETniTKAin1XlkxH8vaMgS3PW0Z6PWwxRobycE7FJFQV X+j7cvTCmdfwk7IemmlRYr18kzQSDZZuPyrUHbJl1lgBL6EorDsiESkFiCoBIlSEY2Xz 8yCe+gM7fH95Tm/6qlq/yan/kR9bLIa3rD9wbLkzEfJqLRvmLV2MEFJvYvVMitt9EjXp 4xioCi+y//aunYF0+0jtn+V/lVl5+uUBIe9fvpyt7RC6Kz8BrYxcS8NR3pmt71Wu3lrN /j6w== X-Gm-Message-State: APzg51CkVPehwfGMeU1R//ff8ITLTIyD3IlwC7qLPJxkjEkR8M1/KOSP dAMZVdGbFDiG0UFdxPQK+HQ5KLnCcK0= X-Google-Smtp-Source: ANB0VdbhqIMinTzq1+SWarmZO0/syBOF0Jgx8TvnPZ/QIR8pF+0oOWXJztvEuAzeaiDnSdxbK4Uz4Q== X-Received: by 2002:a5d:490b:: with SMTP id x11-v6mr7272267wrq.114.1535636557408; Thu, 30 Aug 2018 06:42:37 -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 w10-v6sm5247731wrp.31.2018.08.30.06.42.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 06:42:36 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 30 Aug 2018 15:41:55 +0200 Message-Id: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v1 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: Thu, 30 Aug 2018 13:42:38 -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