From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 84A0D4CC0 for ; Thu, 30 Aug 2018 15:42:41 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id j25-v6so954076wmc.1 for ; Thu, 30 Aug 2018 06:42:41 -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; bh=IHVbPwTSTQaAHXkciYMdEqxygXilHaYNt1PzQ3kYkLo=; b=ACHVSeYotKAmaAwxpUsufBrV6ydDDGajaWLQpQfEKE33gqOlRqjgU36UdOtNOSYXdL IMycC3ZvWqMk6soT4FlpqyVFb9EsoKudSi29I1PZXQgxhFsZA5kLkRcYX9YTZTwNLiRM nyP6U2qcgbVBjGcZG6QZWWUzVQDxpf2C0RUIHRH4y9N4vXqDOBZWQP8WnjV7+g6VPePv QmC7ciz5e3k4cQCjADfmunRxbwZmfwJgJXpMpNoWHXFlIQMRLW50LqTaSr5sn35XY3P8 998K36u0KfMzgKTfFT8TnqqnQMLmzA1F5l+dwpwyWuFMQpEnvVBjOg53eBALP2QxWAt/ 6vmw== 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; bh=IHVbPwTSTQaAHXkciYMdEqxygXilHaYNt1PzQ3kYkLo=; b=oZhvn1Tfy/vTLN2z4VXpgLEF1/2xf3WBfxsZjfk98qdRrKa8X3fZ5UToJyGqXre5VE ZVaqfdjyu7I/k1T0aZChCgRRPIGtQxhCJzCUk18TBKXOtykdaE94J5NrJqi+7Nzqr8+x kAB+9Mmxj7Te+NivpuHcYlYR5xF7RkkEx4CnBQ17EuVVD1T5uMnc/kOjs2L21KiNv0ot g7KdKI3sJswRO5WT5pJtEEt1iKywjtdtA8D+ZGgdZ0p/7v2LxftPz2jqcIscNHIcluhc Nl1hOM3GYbY+O4wWCYxVK1hdg20HbQMZmVHwQF1AAkk/vt7Z7wVffII5/NdMdCCBeYKt BJwA== X-Gm-Message-State: APzg51Cgjjaf4qrvIt1L6fNgeve8tgW81su65dLV2PwVn6CjBF8jYXqm xygaksYNQm2FfhUtw7TBMXPgw8MXkAE= X-Google-Smtp-Source: ANB0VdbG5a7oUIKPEnoWYGfeOUXSEdQNqpOfHF3T6BUvFtnhF4PBRmPXDBZC6oEFSmWCzR5geNTtjw== X-Received: by 2002:a1c:2e11:: with SMTP id u17-v6mr1856886wmu.102.1535636560943; Thu, 30 Aug 2018 06:42:40 -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 w10-v6sm5247731wrp.31.2018.08.30.06.42.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 06:42:40 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 30 Aug 2018 15:41:58 +0200 Message-Id: <96bc18c75198d6644f87f7e4e16f343fcbbc18ee.1535633784.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v1 07/13] 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, 30 Aug 2018 13:42:41 -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_ethdev/rte_class_eth.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/librte_ethdev/rte_class_eth.c b/lib/librte_ethdev/rte_class_eth.c index 32c736d32..d8d8e8845 100644 --- a/lib/librte_ethdev/rte_class_eth.c +++ b/lib/librte_ethdev/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.18.0