From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 54FADAAD0 for ; Thu, 15 Mar 2018 18:50:25 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id o8so9238136wra.1 for ; Thu, 15 Mar 2018 10:50:25 -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=1RCXgqOrsCHtMXuALdGYCxYsoKzJMar5okwhggFNZ78=; b=VtZkAniLSNuHtOFAjEs84od2+K4fNRZ0TQS1kgIBrF9lqkTGl/b5MH34fviLMlsFfe uTN03ym6mzThTLujE1hUeWCWhxIz7bkTtiaiaKdoYhXWYMc1NfOk39GQGqE6nD9/z9dU bjd4oXmwt8MlU+3eD3Wi/XCG6mSu9kA57SNj+BKrbRaTFEHi5vxALyo3EIkwBp5zCVTt zqRf5eJiPcxw9E/kTOSQFc3HZ/DWul/5nvyu3NsQGtMZV/91EagO+rkXdqVO9fhD4BNH vurtRfOiijvSUmFiXgB/sbV8vDVmY99085OuvY61Ejrd5/72zjo4iC9Bh0ufRdouonHs PBog== 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=1RCXgqOrsCHtMXuALdGYCxYsoKzJMar5okwhggFNZ78=; b=afnDD6PHNRVs3gBYbZfTXztbOGAb79x3NMfMS9I+LVz6rCEW/5CLypRn840ngXXsBC zVygD4ZcivCqG+rJVdGlRr0EDcFHiGejyo/suUsu6v9if2nhXMWdcq+32gl7XdVyPf9d KYbHnUiKDwpWO2WuIf73ss0QaXmMCWlAycBLGK0utgaLAlmbcKNlMITH50fc7eSV9z0A nVHJvYKFw7aDf7khJeBAO7i05d6E7AoIEy5TogGKvE43gfki2F7UIeJMuTDo3eJ0w2+5 NUgU1nL2vs3Y3h8k6uWwXBymXZ5Xy3UugbvsUQ+L9c4APvbh3Imwizwj6mSPV9a5/8C/ juyQ== X-Gm-Message-State: AElRT7GxTZWMtQQW4Y8tj1A79M/H5BoLU5Vea/AZcZOHlrKN4xE3hx6L 2kwAzycxeBEnnBYFOmKIaFZChskK X-Google-Smtp-Source: AG47ELsyO1tV9r5RvbT82fWnKYP/APJSkOXDevNyMbyM7CVJ9XQD82p2f5fnGDr8bbf7Iasnkf18mw== X-Received: by 10.223.136.13 with SMTP id d13mr6076860wrd.271.1521136224527; Thu, 15 Mar 2018 10:50:24 -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 69sm4756596wmp.36.2018.03.15.10.50.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 10:50:23 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 15 Mar 2018 18:49:41 +0100 Message-Id: <9b203729de19bdcf406102627694227b4dc6c624.1521124599.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 v1 11/18] 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: Thu, 15 Mar 2018 17:50:25 -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 | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/librte_ether/rte_class_eth.c b/lib/librte_ether/rte_class_eth.c index bfa821d09..2f362ebcc 100644 --- a/lib/librte_ether/rte_class_eth.c +++ b/lib/librte_ether/rte_class_eth.c @@ -14,11 +14,25 @@ #include "rte_ethdev_core.h" static int +eth_dev_str_cmp(const char *key __rte_unused, + const char *value, + void *_str) +{ + const char *str = _str; + + return strcmp(str, value); +} + +static int eth_dev_match(struct rte_eth_dev *edev, struct rte_kvargs *kvlist) { - (void) kvlist; - (void) edev; + struct rte_eth_dev_data *data; + + data = edev->data; + if (rte_kvargs_process(kvlist, "name", + ð_dev_str_cmp, data->name)) + return 1; return 0; } -- 2.11.0