From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 406BE1C319 for ; Fri, 13 Apr 2018 15:23:24 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id b21so4173478wme.4 for ; Fri, 13 Apr 2018 06:23:24 -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=wpFeQrZ/zVigHoMkQUIiEztAcdSI9IWcIvwLVn6tJcLAoMsBFMfwwKC7U7HOw2lPd/ gP5TvmacyA+uODZxd6/gW2ZlJsFb+dIXjk0NbWMXNjtya1G5sxsWnabmKTBIFusFbhMC tnsvusYFmaU+NcLQ9YvbszLFdVTs0ljd34AB6E8Yd3c9MblC83oEt45cpMNFeirdIBWU MnDX5fFuP+NG17lcPKritNPDBNr7u9md+zZhwhZyNAVpT1Ih3facI6541/d3h9naemaG 8y9bFsv04nZnAqcw97XiJi2M2s6PkbgmcMoRdQ+oHDwUfDnFqZEoNTaVTCJaMvwXsrCU NThg== 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=aDElILhNt/Vp9OU1VzFg+r5cnNfGuaeUuDFhPLowS00LFRS27hT53OyP/w7zTzaTHG VBc/dMrs3FEvoHYa9oha5yPek5hsX7xLEL2E7oZ/h9a47MO45ndEf9SN+WzaEYvtGw+X +T6/LBavwu4+YtxtDR4/VP3vHUWUG0r25yooOjaOozkG1QZoM/+WxR82KLy9dODd39SJ jf/ewja6+fdyrtpbYMwa77r16R1qt8rKDF8W8uDH6pCE2RxrvdIQ1iEwkdlu114IKFxm A1ROqZysSzYW2Km0KrNCMEDM8Ej6CHmjLAaI299MhK4KWKQldhSqmHuLZcPP7QTyzdju oF9w== X-Gm-Message-State: ALQs6tDVbi8V0tEROyDU1+1tKSFqBMUatL5GGQZL8OJz4+knX6RTWIJC 9EVs3f7IgjrpS/j3ZyxkuuspLBgx X-Google-Smtp-Source: AIpwx483oCFQvfwN+H/MAJoOb4B0kK/vtATZawL8Fttla5CT0gneas2nCTbHOqYJoFh1qwsWlbMz6g== X-Received: by 10.28.34.7 with SMTP id i7mr3462263wmi.97.1523625803572; Fri, 13 Apr 2018 06:23:23 -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 r200sm2377244wmb.9.2018.04.13.06.23.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Apr 2018 06:23:22 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 13 Apr 2018 15:22:36 +0200 Message-Id: <342f98fc51b00a3d8b12b49fd73e8eff77c27b0f.1523625525.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 v6 21/22] 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: Fri, 13 Apr 2018 13:23:24 -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