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 C8DEFAAB7 for ; Tue, 27 Mar 2018 01:19:25 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id p53so12988526wrc.10 for ; Mon, 26 Mar 2018 16:19:25 -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=AiIn+tLBH1ivaHG3azXUUV4p4yl/FibWofOwhOshg6+I/Jhnnh8OhgJrrgI1a7RVr7 bC3oUboaCU40ETh1EiIcHijpxBevv+o84bKonS0kKLpOVl/Ghi+M3jSu7cwpCLZmR87t XwV6R9xqY07FDmlb+YVseeCmuhQzwgzv58vtD0CB4J1dCE9vhnU0X//+e8xofWOr4tdh WJdv9YLCRFZZ/GwfAg0M2f3IXKxH6KbP/wRFQGxvweg/SfjBqutwzgzIYMq2/1/plTXr EDtwPkc+zWnQywS36Y/4Ul0N4iuoz0an/jld91B0NTwEJAsx1m5Vh110Z7ozsZqJYkqn zZdA== 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=YydW4kH/2+lbZC9MD6WZp8ElxHAkIhtzh35RE/zTn3r0TQzTGpzrYHMGgmZtSWgZ3L ttyoLQ7/fEJD/z5KSM/FUghgvAZdGP1k3BKAAV5YCC/HlcmaGo4+RcpJMLKyrk/I3Qt6 0wKZnxAKl0xruebfHpThemtzs5bqyO4ilQCNdTjGxuLC7Lb1zKhCTaK0+HqnF9yUHhGH BVlmpVkpmYww7zs1rQV05GloSr6GeVcqX498dYX+phGRUYDMJUCWGWnEjZa39XkdBT87 VzxJIIedjp92WJSiUTqZ0cMdl1NITSwTM6p/5r9KLoCk4I0Z6IOOkoA5hoqSBc0xvKry 5Bkg== X-Gm-Message-State: AElRT7EX8iXNlvUIzbPGuFOMn0UvKu/RFGOJcqvjohMCnGfTEQopE6eq 85k+3dME6CsOpr6pb5Sm8rnall6W X-Google-Smtp-Source: AG47ELtK3S1E3LsD7uB6pK2PU6pEuOi6y4TGHtCjS+z8cb7PrA9RGcsJ7Af/2mLhZCk7pkDCzZnotw== X-Received: by 10.223.166.102 with SMTP id k93mr34319373wrc.231.1522106365165; Mon, 26 Mar 2018 16:19:25 -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 67sm343712wra.9.2018.03.26.16.19.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 16:19:24 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 27 Mar 2018 01:18:41 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 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: Mon, 26 Mar 2018 23:19:25 -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