From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id AA2EE1BE75 for ; Wed, 4 Jul 2018 00:16:03 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id b8-v6so3392624wro.6 for ; Tue, 03 Jul 2018 15:16:03 -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=Dt6pDwToAEmEMC70bgVWDk+6/mJnB7Hk5qWQMPTLbflR6xcEBouwWJRXDxkiOxk1j+ DBGnjzjHGGof/sGCoRXuYJusGfz6BsyUT/b63P49QouVt3UkDNcR7gviDY86i6bnHPj4 HZUD4M9jYzvhlLJBm2FcFgLmglNLuUizIqn5cNlVAWn1T+DxIYTj1PnOC6FnlTKfmt/p wgmqOzPV+NgVbFtdGVJu+GLf9lt5AFx+W9yCaykJkQeIoJvHXjU5q4R63B26Om95ljW7 QCV/mMtbQ8tsg96Om3e/WDNjUxjel/AeSREymAwKi1ctOfb9pkf7LPsPBNYzVL5s88qm rgrA== 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=Z7UDBrdQaT6NoTiBHf5IG+ydwc6LsKv8h/rr65N0ZesSIR7dVT75WvhWXP3qccWKRn smI4S1u+gl69LtwsDJX51VxTs8M0wU6zFV69lEeQtI3+U8zq02Pz2e69xGUhDDiJM2Rk sxd4/zH7slDF3G54CNaLK0zaeHJExj82CuXv0BpkJjVztYesDboRgC67CQ1xgBBVc2u0 7lVOXPaCFw3V9Ahzhk7hf3C+ZeP8HG4Uba6BshoCPDgj6Sh2EXo8npWbsbGbKt0bve3Z n7BV9VXelXxRnOIfdHQ3Hh+Ro9McRltRG/qsKDAqygaN+Nxd9EciKnSm65zC9GrrPvMz R95A== X-Gm-Message-State: APt69E2vsvYJEsh/Be9WCT/KrZbslGaJMutN4qDxtBx/8BdmdmNhAm5X 23PquvuWwTaC1/pNWvOfike/9Fc1 X-Google-Smtp-Source: AAOMgpdlp9Y7nhcqlLS9Jmzd8fowPrf6JN4AN6otgG7TVkeqAhUMqK1DnfbUBxcRgOaUCzZAD5X3VA== X-Received: by 2002:adf:e6d0:: with SMTP id y16-v6mr25290412wrm.35.1530656163116; Tue, 03 Jul 2018 15:16:03 -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 i190-v6sm3771084wmd.33.2018.07.03.15.16.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 15:16:01 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 4 Jul 2018 00:15:04 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v9 21/27] 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, 03 Jul 2018 22:16:04 -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