From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id AE9EB1BE05 for ; Tue, 26 Jun 2018 18:57:19 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id l14-v6so12902401wrq.13 for ; Tue, 26 Jun 2018 09:57: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=un2v2GEX2SYq994wd9ePKkFEbROYL9EMUomtxevCaA4=; b=lZPM6tVYOro6j/QpYPhUAGretwS//Ben/cdvcO4r10XGFGtxCGEn2SpGUVlOxU+DMP HsFyXhFeYW3/ZlY8bD7GJV5mRgqbpubBW3cR/CmhFqOsewCHbWauiItsBAbvN8EkMybh OjulAvNYGeiO8ZOuSadk4oPJApslR2cj72nLOGfr+e4437wu2lopFwEwC8Iun+v3t6db PMSg/Ez8LFV7BPCevjp77ttQZhfRGT6IAhOJ2USvRUjwf8K/wjD6NDib2uZFvFAR1s/q umzgywO+wvVzw3Upmag1vX/MqHzvX9QgaDhlH7AZ+FO2975CxadWrHmWCDSW4zKd1/i+ +UNg== 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=un2v2GEX2SYq994wd9ePKkFEbROYL9EMUomtxevCaA4=; b=uFrfkjyldmHu5eSKw0GF5Jmt6vgq05P0LlS6bwlW9PP3iXazh5jfEZLCtr0gHzXj+e +OzeJxA8n00MJfn2I8I1vJUOc4MJ3XYjhESyD8HYKd8Rc4RFqGy1Krt9AmDUh+Uxp81L wd/eVY+zYMUJcPtdkh91Hwv5Rf3HRwtiMCohdmLuELFk6QSu00zkDLkaBSAgfblL/+V3 KDi41xvpBzRFO4FdIfHbfv7zabiI4a5sP6FNPyDiNTOMz/yDwRiNYp89QQSOGieLZx0a TKuJnU9z1kQoVd/QhxGeP8qCjBPjSwnvlujX4EyYtktIYDDyvjE36GzeSDfakogH0TO3 X84Q== X-Gm-Message-State: APt69E3PG6C+2n3P3E2oWUo4ZP7nfKFYB5rSilacejS7O6pb3JnVfESz VPDmbjL/BBdE5WPJDB6/4nMtUsm/ X-Google-Smtp-Source: AAOMgpdXRotmZHJmhG8nWkjKkOTli48lFvMFOzOBemHzTWN020HHvpR6jRs+iNtLknmB7whsLD4yRg== X-Received: by 2002:adf:ea87:: with SMTP id s7-v6mr2085533wrm.150.1530032238946; Tue, 26 Jun 2018 09:57: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 p5-v6sm2680880wre.83.2018.06.26.09.57.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 09:57:17 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 26 Jun 2018 18:56:23 +0200 Message-Id: <0d4ff3bf642e7f3f2ade47fdd81d85560d5fee16.1530031921.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 v8 20/21] ethdev: add device matching field name 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: Tue, 26 Jun 2018 16:57:20 -0000 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_ethdev/rte_class_eth.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/librte_ethdev/rte_class_eth.c b/lib/librte_ethdev/rte_class_eth.c index 32c736d32..d8d8e8845 100644 --- a/lib/librte_ethdev/rte_class_eth.c +++ b/lib/librte_ethdev/rte_class_eth.c @@ -15,10 +15,12 @@ #include "eth_private.h" enum eth_params { + RTE_ETH_PARAMS_NAME, RTE_ETH_PARAMS_MAX, }; static const char * const eth_params_keys[] = { + [RTE_ETH_PARAMS_NAME] = "name", [RTE_ETH_PARAMS_MAX] = NULL, }; @@ -39,6 +41,7 @@ eth_dev_match(const struct rte_eth_dev *edev, { const struct eth_dev_match_arg *arg = _arg; const struct rte_kvargs *kvlist = arg->kvlist; + struct rte_eth_dev_data *data; if (edev->state == RTE_ETH_DEV_UNUSED) return -1; @@ -47,6 +50,10 @@ eth_dev_match(const struct rte_eth_dev *edev, if (kvlist == NULL) /* Empty string matches everything. */ return 0; + data = edev->data; + if (rte_kvargs_process(kvlist, "name", + rte_kvargs_strcmp, data->name)) + return -1; return 0; } -- 2.11.0