From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id 330CE1B667 for ; Sun, 15 Apr 2018 17:08:38 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id d1so19286124wrj.13 for ; Sun, 15 Apr 2018 08:08:38 -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=Cg1iYGWZTzeiGOofKh+ntHXfaUWEzew6P18d3n9szrTQQNiRNddZeotoa93uAYwnLR nMHVwUaVj0h3N0ovYhFdvAROcgbZD7es4p9MnNxGeNV87KB29PxDofvF9lwW3Ibn2VId 37ufh/9Njjo/KDUQY8W6WTdH27naFcj8yiihIlgjGdVTkjvKyFnEpnw4sUeKatGbM4qH hU4uToIWH4wdwENLtEJMhoBMJoiAyuROep6Z0/cVCBPnVdw2A7LXxQ3p8reu+ogF0A4y oDu0sVdZbqXq2VknTuK5+ZAZzsJhNElR1+oXZDGvvKg+2P3VIhCSYBQ6R1hJ3CHGIL+e 1IwA== 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=TtPWL48WvT10moarv5OcSo9CWa/mUFT67nOKoXRlgG64rl4PS68GsR4Lt4XWzu8w5Z 1NEElYoTjtu6iyEtuJ1AtQtKJPtXGMO0P2161cEhtvDf6G83M4WS3biiw+yv8yc4E3uG zSf0IyRPtPCzlWBOuT3kr4tNbdMM+XOqXo/AhnN6QxK3ybIIxFJ8aXt7qzoTiMHBMMGH O/21uZg/t2KV0PWGS7hzXnWAXULRT3EVcLY0ug/75hzjPEL8DiOB9qfyMRjCTdhrj+uL Ogut0goMl+CLtpAtPfrsSoP8QHvayb+8JEwRteB7No437bQ7NGNIPWtY0v6uc/6DPKMo 4iQA== X-Gm-Message-State: ALQs6tA2eb6s7QamYMS1UoSWYu8tGbAlRXAXIDwjODr1MRBQX0CqAAst /blyEO6DAUuluVDZqyRfbFjtwf34 X-Google-Smtp-Source: AIpwx4/eUHPbWnEwbYwVK4vegCFqSKewpuV1K9n/kLmoP2irrtA/aveQU6pl2YT47mBws6YqpbEXJg== X-Received: by 10.28.156.2 with SMTP id f2mr8033698wme.64.1523804917434; Sun, 15 Apr 2018 08:08:37 -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 r200sm13673438wmb.39.2018.04.15.08.08.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Apr 2018 08:08:36 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Sun, 15 Apr 2018 17:07:50 +0200 Message-Id: <27122cb25efbe5752b9877112ced5f14ceedaf00.1523804657.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 v7 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: Sun, 15 Apr 2018 15:08:38 -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