From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 82C491C089 for ; Fri, 13 Apr 2018 15:23:20 +0200 (CEST) Received: by mail-wr0-f193.google.com with SMTP id d1so8267924wrj.13 for ; Fri, 13 Apr 2018 06:23:20 -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=o1rvB/1J14GKS3TI2WvRKUJLuNWjJmGtCtmYdSo7kLk=; b=HSRCpVbi/y4ZlJzjH1FuHpUWc+/HZjCFtQACmKzgu0z0kj4m3/UFA5VQtWKmc629Sc 77AHaEZ9NXA5P1IsEjb2PAsXvxlOEolzaqYdoij1cX9QMLsmfSxaRH3aY2fr6Wt3qg4f KziqZra3y8auX3s4IZ0dpMrAvwHkJF/8rT186O7tAioQdr7JQPbxHmHI4/th60t5xLUF W3Zx2pve5DdU2Z0Sv0f1zPb1bweDnJvp4RAdar76JEl3ETs940HjV+FL+Sj9hISO0MM4 NQ2AiMox+YKzphOX4jDOPjzz6gpjhY8xJQ+SIT7Gbgb2Xw5QGJ2zuT1f0daQTXwrzs8X 6x4g== 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=o1rvB/1J14GKS3TI2WvRKUJLuNWjJmGtCtmYdSo7kLk=; b=Kbb/sn1mTukeAzZA5vpseQM3jByVkHqWohU83webSxn0icoWrCs98wrPX4EACAyJVO 7H68EazNMsTnU8LupRWQv0w+wCmiCmEl7OsKgo5MWDIpXmz6IrwN36Q+MNTHcKiEdtPZ nzwSZFMLSdmpbe8E9rQs/Mlq2PMFpK87Aisr+VoBT3fUkqHQu6EAG4VMNBpoGS8ehx9m piBiLVjp8nXIrA/VKe35QKPr+CzjQp5qwygpJemftX0wcz7wOB5OmHqyx5MXW5VxYgO4 pnzsIDhdJc/uMuWx8JEN3iZ7gYwQ+KLjN1tn0z64zGTdRw2N6fTjgRQG2Lp7qu11pmwU cfTA== X-Gm-Message-State: ALQs6tA+w8PZEu/RoaRrOjyZI5kZJwfxh5BsEBTBDjsSGY+xkpK4Em8p YgvwEAtvZ6qdoqbaILet8FYr/iYJ X-Google-Smtp-Source: AIpwx49iT+0ApH7uo2hRbGSKCtF34fqXFjJhr50op4A32w+TkhML3ht1H02qSn/2IxJyxnXpO42eEw== X-Received: by 10.223.170.4 with SMTP id p4mr3493029wrd.226.1523625799889; Fri, 13 Apr 2018 06:23:19 -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 r200sm2377244wmb.9.2018.04.13.06.23.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Apr 2018 06:23:19 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 13 Apr 2018 15:22:33 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v6 18/22] 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: Fri, 13 Apr 2018 13:23:20 -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 5bb87af28..84192d79b 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -389,10 +389,12 @@ vdev_unplug(struct rte_device *dev) } 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, }; @@ -401,9 +403,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