From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 49DE11B5C1 for ; Wed, 11 Jul 2018 23:46:02 +0200 (CEST) Received: by mail-wr1-f66.google.com with SMTP id h9-v6so19609835wro.3 for ; Wed, 11 Jul 2018 14:46:02 -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=IHVbPwTSTQaAHXkciYMdEqxygXilHaYNt1PzQ3kYkLo=; b=wTdPwUZ76fAydDz6ZhWuZeGAsnEtTlak4+UTgMq5IcyPukdWGRufzh8DudjiPL0/zd 7RazJ97XUYmbHIPeq/sbSp+bK74p1hMbGdRe8WJ9tjv0r7uT+CwaqJIxhy6CQDIhmLuQ los8FhqvQAtY+yyiCe8txAtZ4rllQIcWPbBnWsuS/2cxxJUlXb6/ioHhMerkrA5FK1XD e/u+Py32h3aaJkj6+9oFIMqQXo82PyHkjz3RUvZZx37c0RPMSKnnSUpjzqP+EhE6FZKC a3W5bQcL6a2wPjUCkmHncqWwLnaiWDufQxrfseb8knESlLWxpecQS7aH+PXRNbeB7en1 c2cA== 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=IHVbPwTSTQaAHXkciYMdEqxygXilHaYNt1PzQ3kYkLo=; b=ZnmaSqWGjjOYTIc0wJa7ZVenBraMVOgUjWE7PE91TNVJO6ayZyPWeueJXhpXM6/gDn MXJgWTKDVXwbNZB2MI4II3ydcflzoNONxHgXYr61AegusL5hLwazko8WEePYlkGRJMZk qJa3d7mGAvjtzGk1UzmEA+uS5LPJWu99EjMfQ74lyyRjDnNwf77mQSfgT2WOMW5EmLB6 D4fAJqhcImhVBoDsDIay0ukDtOuSYEMkVxAJEbpWzeiUF2txeG35Jp8ZcsTTUA2AdNST KJojvzV/c1I753TO12kX2z/Lnqpp6VjpyAaggrSBKLr1jTQ6WMJVCe3mNcSpjH4Tz+DN pxPw== X-Gm-Message-State: AOUpUlHbvfwNeuii5lvksdELj+91ntD+KgytI5hzmH+H8cTXNN9kvxuV p1DFqqn7xaDM/SMzf7tpshwXrFkP X-Google-Smtp-Source: AAOMgpclmNr4GOMA6Xv5IqvHCa4h1eiFNG7olSsJHT62ARGVdlEWnz477vXXI0HadQ0WtcpQd778pg== X-Received: by 2002:adf:8e10:: with SMTP id n16-v6mr230553wrb.100.1531345561614; Wed, 11 Jul 2018 14:46:01 -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 h5-v6sm10550936wrr.19.2018.07.11.14.46.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 14:46:00 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 11 Jul 2018 23:45:09 +0200 Message-Id: <21bab8412f529dd2e1dec14073cf10346d468dd1.1531345404.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v11 19/25] 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 Jul 2018 21:46:02 -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.18.0