From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id 8F3715A44 for ; Wed, 19 Sep 2018 18:04:12 +0200 (CEST) Received: by mail-wm1-f68.google.com with SMTP id j25-v6so9860093wmc.1 for ; Wed, 19 Sep 2018 09:04:12 -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; bh=0Zv5l7PXCySeYUwhJPdTgL4+3k78WVHfIXDGUz/z6dI=; b=Uc0W3mo52fRanh7V9PFcUGuYFln8873RkfbW0zhSzG0Xy3KLYkJUgsGzwDhcQtsPWq 1bY9bDpsRzzO/U1LjgKtFjV8Qn50tHIRRsQFumz9daN06R4p5wpWUF9X2oIq2FYyt4FI fwp+gbJDhrxZqhM84wWacXYbEO7V1j9EInOppk4urbq9af1k2AvAwqW1uH4RbsSPtuYz YQuAz6FpUrcXoV7PpHWDYqE9qnrAxMRtGWsLDG9GcsNZBhwSGo74uGGp2Cf8ukqmEnNn C9z3tMUBOhwGU/bBWn+LGPJ8HXXQRMc8U9c9u7jhnU8QWZ9eF7xW6Y4GPHWyoaSQxg28 3UwQ== 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; bh=0Zv5l7PXCySeYUwhJPdTgL4+3k78WVHfIXDGUz/z6dI=; b=C82QSNANjPAJMFgdhG1PAJ4Pz/azFzBUteikpTh83e9XwX1gvG+4KRDUgG0OZL6xgt i4Pl36sUtjfCpH+rkj2PwvR+j1xE9xRQn8VeumvgwGFITbPNoCJkNnSby5ilcFVCVE5m kHYxhd0iML5WQPdpFclgwkFk3V2kdYlFDdM4Vj12l1TroiHFfOFQMFb7SCwZbNTbAveP dSmf07yrTfNavz4+39CE+F/260EZbLrQD0LI4zJaj02tsivMKmJuDAa9TVkuaKeS/0el NpgdLoJ4hz08KbqMQjQFf6iX+eK2CBQ89L3EZVH+xgi3P4nUGvm+IDQ+GfJRLPqR+Ngd Vquw== X-Gm-Message-State: APzg51C86aFqo8tW2u2Tt7IBjXhbD+dpEUDHq5IsTmRlKVUBA8h4paiJ a9gRjJswlb1QR9DzQPRyExvf/TdmLLQ= X-Google-Smtp-Source: ANB0VdbolUcw2lqkkt5LhLoIqeJWWVCvSnj5BgXnG2wdJ/CXLii+llGdpVJCjCsxuI82gknC9Niqxg== X-Received: by 2002:a1c:cbc1:: with SMTP id b184-v6mr21665054wmg.149.1537373051712; Wed, 19 Sep 2018 09:04:11 -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 x24-v6sm34983671wrd.13.2018.09.19.09.04.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Sep 2018 09:04:11 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 19 Sep 2018 18:03:37 +0200 Message-Id: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 07/13] 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, 19 Sep 2018 16:04:13 -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 Acked-by: Andrew Rybchenko --- 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 b6557db97..66fd48dc2 100644 --- a/lib/librte_ethdev/rte_class_eth.c +++ b/lib/librte_ethdev/rte_class_eth.c @@ -15,10 +15,12 @@ #include "ethdev_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.18.0