From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id 29587AAA9 for ; Wed, 21 Mar 2018 18:16:19 +0100 (CET) Received: by mail-wr0-f196.google.com with SMTP id o8so5978604wra.1 for ; Wed, 21 Mar 2018 10:16:19 -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=67l8dj7WN+qsVZW4tmAaMPnHnRdzOO3kPVNXxF6gs8I=; b=VbbqmzE/7GDD5A4RujaS/XJcyf27qd354BEOxT+zhs1L+AOYCm2NQPEOKmDanEndDD oFohG50cMoSr2IUbhBGtH3ArMuvZCqsWJemqxLEr52ae6viGJMCFpc0qy3ikcUH7Gtmg 5Aru0paiBgA76wTOEkXV4BP7JEn6KN8xGdQm1frih5uXoX7SV01msH1+vj46Dy7x8Svt h56aWiykwx3zQ7BjsJDXNSNZ1xvF2jqqc/DDidZEK1Ab+SnQzAiJwCFxF12pe/tLF9y5 FgC5OgqUzfxCuz612QepN9hTvHePpZzOoRcrLRQo3GCCFGSTLVwtP09ReNR9EGYDrcdF 5eJQ== 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=67l8dj7WN+qsVZW4tmAaMPnHnRdzOO3kPVNXxF6gs8I=; b=qGbOHUno+cQLMw3br9a1UYUgnWFzeELSq76FjdT/hXsJMQ5w8S9onclm8d40tmPFZm L7Etyi6c3F0gfBD5FELJumaswZfcFIKiTHva2c3jeJAJSd3aEKmyswCennesAq+zRafR 7jpsJnREA5HNYdO/cirnziBpHsbNGmV/ekDLYadB+pF6aG0MWphmSE071vi+iE5FiB0F 5+u5T8Xud9zZM9USMywNeKY4fQU05CxFpqXCt/lFkMf/r3w8Q8Nu0kigdrrBcO5pxDjE pV7a+UASD9UhCD988R0ld1LCAhS+s4DfAUv1bADPS/PEqD0SuSMm/P+lPLo73XAh+ZDa 5RbQ== X-Gm-Message-State: AElRT7HGfROSBDddD/ze7sk6ddZ4PYKX7G1nIzYt4WNdMxW/+LvVgZik /z5QoBLpuXj3FnXfKFx3g+XqMfuJ X-Google-Smtp-Source: AG47ELv2+9fNNK97DNRhYiypG7rqW5fvkE0+C0ZtDi8ZTHtnP/7w3ZxLyk+Mg8zTrLk/VhwaP/v1+A== X-Received: by 10.223.175.201 with SMTP id y9mr16716733wrd.107.1521652578245; Wed, 21 Mar 2018 10:16:18 -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 l10sm4224101wrf.37.2018.03.21.10.16.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 10:16:17 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 21 Mar 2018 18:15:36 +0100 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 15/18] 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, 21 Mar 2018 17:16:19 -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.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index 699ce01e6..d1e712fe9 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -417,13 +417,31 @@ vdev_unplug(struct rte_device *dev) } static int +vdev_str_kv_cmp(const char *key __rte_unused, + const char *value, + void *_str) +{ + const char *str = _str; + + return strcmp(str, value); +} + +static int 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", + &vdev_str_kv_cmp, + (void *)(intptr_t)vdev->device.driver->name)) + return 1; return 0; } -- 2.11.0