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 668F3AAB7 for ; Tue, 27 Mar 2018 01:19:29 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id z73so20539334wrb.0 for ; Mon, 26 Mar 2018 16:19:29 -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=UJbuIE17Mc3g0kzr8SDBPpS9RcmMY+sXWWzEXQzbpottPhgRXMHQ3y8JWvbAsVCm44 KTT8yMZ9xvgM79XRTa8z0fJdrEd+G5UvSwLdi0lkcUoHrMI4LvDijcN4PpqoftX4Wpqe j4rXDoaUKXWsmK0xKhxKpiVrCU7BEJcBdS2g1u+Sv5SQyurhcvfF5Mj8Y+XL1y19Te1p PL+RD+3OJEwTWjJsgK7KZ7Tg4fMQ03q7NKRMZSB8urhaZiWqeIMw0NRggdDjaODjPQ1s ftDnoAtp395saphLC1a4ZU/X5BRQ5tFTJmAnsBo3mSEE7nErum2QEXsCs0Lbv3senlSo PRlQ== 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=MduioLmP4kopDD+wNMwII//8Q+Nt27kwp0CuoOMtPCSv+CiItiFNu1gciAE2Er9ghl zy2pMaWkeAdCm6GTZdHIluk5UlMXTK1lzTC5kNP0dQXIYEEJMWrft8FtYCjFKiRHFyV4 Y173F14ZhTxVieOYbzCCAuzV/F3Px7k2qk9W5kffuPGPy4oGyUhTo30Wm5s7wGlJHtBz 8Ja3HRzJKV9sWC1VQiP8fDSN1VbNWCSD2L3ewyEFXsBSt6o8J+Z053EH7nKMlruB5mSz KoMMRPphMl3YJD+8pNKINO6taCeEDxom1sNbm2cGFutD0BYuHTae9hCWcBIdbdEqbJsC Jsrw== X-Gm-Message-State: AElRT7GeW+RPuXUp5YQwRnEETKBtVsmHt9Mtw0nx9aETfVvWLRM3wW2Q Fw/MgtrEdCwUnbgSjk9zQQI9VJJ4 X-Google-Smtp-Source: AG47ELt3zsyzsqCc1LNrdKT7fGIOVIFf0SoekglWKupKkxaz2hBoVv2Kb5Visriv/ol1Jq2kO6JejQ== X-Received: by 10.223.155.154 with SMTP id d26mr30855036wrc.8.1522106367654; Mon, 26 Mar 2018 16:19:27 -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 67sm343712wra.9.2018.03.26.16.19.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 16:19:26 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 27 Mar 2018 01:18:43 +0200 Message-Id: <449577f41e40048d2d243d1013e84f7b6b827ee3.1522105876.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 v3 19/20] 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: Mon, 26 Mar 2018 23:19:29 -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