From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gaetan Rivet Subject: [PATCH v3 19/20] ethdev: add device matching field name Date: Tue, 27 Mar 2018 01:18:43 +0200 Message-ID: <449577f41e40048d2d243d1013e84f7b6b827ee3.1522105876.git.gaetan.rivet@6wind.com> References: Cc: Gaetan Rivet To: dev@dpdk.org Return-path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id 668F3AAB7 for ; Tue, 27 Mar 2018 01:19:29 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id z73so20539334wrb.0 for ; Mon, 26 Mar 2018 16:19:29 -0700 (PDT) In-Reply-To: In-Reply-To: References: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The eth device class can now parse a field name, matching the eth_dev name with one passed as "class=eth,name=xxxxxx" Signed-off-by: Gaetan Rivet --- lib/librte_ether/rte_class_eth.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/librte_ether/rte_class_eth.c b/lib/librte_ether/rte_class_eth.c index 3f1537c2a..08f2b43cb 100644 --- a/lib/librte_ether/rte_class_eth.c +++ b/lib/librte_ether/rte_class_eth.c @@ -14,11 +14,25 @@ #include "rte_ethdev_core.h" static int +eth_dev_str_cmp(const char *key __rte_unused, + const char *value, + void *_str) +{ + const char *str = _str; + + return strcmp(str, value); +} + +static int eth_dev_match(struct rte_eth_dev *edev, struct rte_kvargs *kvlist) { - (void) kvlist; - (void) edev; + struct rte_eth_dev_data *data; + + data = edev->data; + if (rte_kvargs_process(kvlist, "name", + ð_dev_str_cmp, data->name)) + return 1; return 0; } -- 2.11.0