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 8433D1BB07 for ; Wed, 11 Apr 2018 02:05:05 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id o3so40416wri.2 for ; Tue, 10 Apr 2018 17:05:05 -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=xV060LNVFaVee3lQSt98dilAonW+EOt9k3hlMJ3ARVY=; b=nE1gRdK5Ta3dEbAjVOfzgDaCx/cUMbZpRdGT7aHQqH1wRMlZdiQfRLURJx0qYJILif YYb/jAsagE7dnhhHnroDM73j1ur7x9UC5Xg0LCl0jASkc27qCEW5w10svlll4m3FtC8X cHcZ+LtlIBQF0+tF4lKMH7nxc0x7p4lfvXVbfrF/ShGEwWHNGq+muHitZYjJ70qoMfz1 Tys0/p8EV8K3I4kr1rf6v46VgSWBehDYov76gj2BkrVYgpcFPZaakLZvC4Qe22bOwk73 Ve9xPK4mWCf7Gz4ZiSVubsTQZR1Z09tqGiaUxE49VMe4TFWBbWPgIeiUdzIMoVaAKApy ABsA== 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=xV060LNVFaVee3lQSt98dilAonW+EOt9k3hlMJ3ARVY=; b=dWdSET+oI7+t9t0kGtiFrDKySpbLz7yXAvTBwvM/GmupICaz8vorHv7DcJAKdtqVxa odG9RljS8OCNJiX3Ko4j6h+LJdc1u5GXTtO86WBysHozOShVhmxmqmEpjFuUP02sG1Zo hWAdE1m1kjX0VcMcmsShvCJvmzN69sexXMD7G0d2Wff5YYXz6+8mYuBrKan/LtB9zPIR aYg429rZBQsb53LjKdx3kyuqdlUL5UDhuA3PhsAJvoACtRh9Ig10IstKojTc9L8Qzoa1 mwUF4W5JLB5G+jHThTFoRWKaxs04aegEuCHOp2xvQcMqHocLvnb3QQhufshl1Fqq/qxu uucQ== X-Gm-Message-State: ALQs6tB3ZI3D2aVPm3Mut+W4W+ySpysxV0UStqKKUA0WBEcoMZzPsjPo NYobBRHO9SyhhABD3ONNhitPm16w X-Google-Smtp-Source: AIpwx48xeHAQZxBrVZU189EWYf2F2pFyBh87dJoCsaGW81ZKYa7LR/ZiG1ad4EL+JEtW4lC2EfLusg== X-Received: by 10.223.154.182 with SMTP id a51mr1881543wrc.176.1523405104931; Tue, 10 Apr 2018 17:05:04 -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 39sm7626563wry.89.2018.04.10.17.05.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 17:05:03 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 11 Apr 2018 02:04:21 +0200 Message-Id: <0a964ee78dbf914f8853aa41fc4ef185ba60a7cc.1523404469.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 v5 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: Wed, 11 Apr 2018 00:05:06 -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_ether/rte_class_eth.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/librte_ether/rte_class_eth.c b/lib/librte_ether/rte_class_eth.c index 32c736d32..d8d8e8845 100644 --- a/lib/librte_ether/rte_class_eth.c +++ b/lib/librte_ether/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