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 907B01AFFE for ; Thu, 15 Mar 2018 18:50:33 +0100 (CET) Received: by mail-wr0-f196.google.com with SMTP id d10so9213467wrf.3 for ; Thu, 15 Mar 2018 10:50: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=ji6Nnm4ghJHnsWYjlZZScR279rPkbhTOmscqOkeWvuE=; b=ueSiM2gdKnzt9BmzsgEdoVWkQfWXUAe2vSdNtGh/YL81UsYv0qQX4uGpUmxQLTTyuA UaNiBSW1EaOjeKgndP/vdGsQsuaGPWVbrBrxFa1GQU3Aa93AATqGC3mccZN+8jeldjxH 2SNdVNXQsQ/YwwmjN6H+iWkk2ggQe73JrC2P1o8Tw946W/y4nCoeLU2Vgv27ubthgvEn 3DUJ+an6V8htb/mbR32fsXDmH2THYeFun3OP0hMRgyPTXJ4HDmheT4QEGCb+usxKNXg5 WAgP7cTq1tPOHFC+nQpNpluf+n0qw1sBWSqsnubz+lybJSpVan+QcZBHFjy4kx2ZNRLE qbcw== 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=ji6Nnm4ghJHnsWYjlZZScR279rPkbhTOmscqOkeWvuE=; b=XUKwtZ0truF1/4BTxq2/tYfhPU0VKdK54PkA7Np2BBPuZXqivuJAuCqKydDJf0w02o VVhXjUwrSklpxZQfqH/PQfcg/hzf3LAX+adJKqtYl9U9IbNhlO0Qkj5PcmiUOzoFwheD d1b5LCt8yVKPQGPmTiq3LNtxuv9GMl1wBZN0vNp5sF5HI6VzIXiGSr3aB+ObtLJHPXaB BszWp6kjFKnY4tsD7nC2/hvTX0aiT03o6I7jg5+XIa7yQUYoh1YxfdrjI0mo4NDkiILN A+OuT9Cx4Tc4ofdih2eejSGBCqEw1bYUs40BGnlRZ5ZF0NUOjRgsiWHk30wzS0HVvbuR MPRA== X-Gm-Message-State: AElRT7Ew3uYpgsK2qcMT3OKAQ446xT7f4Wy37Em81/pEdW4uqnqlJ5sl t0XYzahtOo6W4sUBO8PcemMxZq2s X-Google-Smtp-Source: AG47ELuoLwoegp3669FM/mxCF6L3epPAPWspyu6RagNkSp4y+3cizOvTy+U0kFIIgTdCqqaANlEMVA== X-Received: by 10.223.145.67 with SMTP id j61mr8302866wrj.152.1521136232256; Thu, 15 Mar 2018 10:50:32 -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 69sm4756596wmp.36.2018.03.15.10.50.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 10:50:31 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 15 Mar 2018 18:49:47 +0100 Message-Id: <78cc3eff8c71d0ed8150938dfb58e0b0cedb016d.1521124599.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 v1 17/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: Thu, 15 Mar 2018 17:50:33 -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 d695bdf24..154d5e4bb 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