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 34F6FAAC2 for ; Wed, 21 Mar 2018 18:16:21 +0100 (CET) Received: by mail-wr0-f196.google.com with SMTP id 80so4891574wrb.2 for ; Wed, 21 Mar 2018 10:16:21 -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=tYGKZa9hgitSR9I2dvAcUeXdExGhAu2iDzR1YMhcIdU=; b=xADGSyH7oirDdzGbvnmxoLCtnxWc8Bp1SWQCVZd8xQd8eeXWeeX+znFMhDQc+HI7H+ H+G8EdLo3pB5cLxQzaSKUk5PxDM5bUG4FXoKc/BPPHxuf6xFancKqn2KU8CZXoee6I8M p+jnAUgmSXkl5rmZoXITaUqhlN5pdEgwiYbratsXeYLIRh8YfOH1tEHKAIvrc26cYORK 71s62gJC48sQbRFVetX7K24XxZsSJoXlomhaVEZc6W0zauOYGIDpzdd4JoFD6R0A/26o J2Uf9pUQjq4fclp+h9HKf/mpuPFDjCc7JqQmeT5J1ur+INEZuCjUjgPQuzqc7ycs2eLt npoA== 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=tYGKZa9hgitSR9I2dvAcUeXdExGhAu2iDzR1YMhcIdU=; b=Zgr4vtvoKY9EK7onlYH5B0lDTIYXcw8iOeuYRJ0DdV3jW97GGXUCMfpFK4VGrbSdkK K+Pe8tTjXtQ2aI89fWGOtoTeCD4Gyz8pV9aXB6tdW3LmLJ9G9oow5W0NVKbd7J1KjMDW wH4coBLnLdna9QibKIKLJsJ8yV2pXxK3LjW2jypt4NAcAWrXflZ3Di7THJ2f2pqVb6Gq SNW6Q4d5WUDYnYJ9DCcFhKlIk7Z45OyIRoBBDZWfOH9hM/PHZ+jZfd7tukZ+5HyEuEck 9EYDJU+DFTrgcPs3NOp7K6aVTuKYGEKqi5wqubkKcmYoWOYjDzO0NyEXQ7GU+tFg4tOt 75AA== X-Gm-Message-State: AElRT7E2UaDIW11Cr1hK7ZgYsn4I+eqazdmwRtwW4PH2APsgf9zmn2Zd wvqvM5solgIRKKVcnGypJXRHE5U1 X-Google-Smtp-Source: AG47ELupZCeTTXUs6CXvNcB9Bf7RcDMZFlajZBVFaLjKa8IqfmMBp9CbJmxu3oupZ2QYj7jExnJlbw== X-Received: by 10.223.172.236 with SMTP id o99mr12274563wrc.36.1521652580461; Wed, 21 Mar 2018 10:16:20 -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 l10sm4224101wrf.37.2018.03.21.10.16.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 10:16:19 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 21 Mar 2018 18:15:38 +0100 Message-Id: <8a7ba222332c33d28bfe8633d38ca8125aa05d16.1521652453.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 v2 17/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: Wed, 21 Mar 2018 17:16:21 -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 3f1537c2a..08f2b43cb 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