From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 464771AFFE for ; Thu, 15 Mar 2018 18:50:34 +0100 (CET) Received: by mail-wm0-f67.google.com with SMTP id t6so12185060wmt.5 for ; Thu, 15 Mar 2018 10:50:34 -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=nu129GzX+6kSp03V4nfcOFqVU2e7/S31X0VGvbUVaGs=; b=jjS010f7YjIkwEEzqHjx9RhGRS9bt+evYovSfQxtrpPtTtZhlZeajcsb6AH8NeWD2M io5YmasR2hITtuwgg60OkRIuQoCjEeMw1IIzPP0+uC5z71DZpTXwnzyP0i2iFaKfmyoz Lf5y55wb1rw7iXtnxwHRgoZwHSOgob3r/IGyLev8r7uX8k3AR137lgF3F6cQCijnE8dx k1mFmkv8WBmqncopPGc6oYtiZVHETnBdb1f7m5S/oGyRQlxQu+4q5c9f/fNV88pnMSsU HBnmBz+xoGa3dr2QE/MoD4rRASL5JmA32RCmgvf9kNWX6BRvMk8C01xXeOcS1HiOByUx qh6Q== 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=nu129GzX+6kSp03V4nfcOFqVU2e7/S31X0VGvbUVaGs=; b=n7SNK2j589Op7BtDryvVGlaz5Y5nkZeyo8Hj9CDix2/xq4pu8LaxrYFJ2AeD1BBKeu 45f68/uSiRnm6shAWHMqAURep/fKuIzlrYuDGaOCUD7NsjPraUfgp2B7K4KO4CQQoSv9 LTKdWIJvN/CSkqhCdLCoSgrQVYi9e8EUeOFo7WGvy+llExQzKkueFxYILoBPQ2zCKKis lLO49tv+lvGYTM91kri4iGHWwK2L4WXferOkcxDvWvpdHhTVW7d3Sio/mmsFKHpWYaYi B4KoKl03W/wiKEFAWq3ig4JoDfgPgcYMSdbFUOeumUQEwxCCX3/urUlROYpdBsVgNFMn duQw== X-Gm-Message-State: AElRT7EB5UG9IPFpclgew/DdMnjInLWdKT+LUmCZtDnnO777u8vs7MiT 8Q+NHiH6vtXOL+BEq//YbCrMve4i X-Google-Smtp-Source: AG47ELs71gr4bvs6V5ZCZd+E8BaopDO3tT2rHNyZRXYKgV4GSsx6CRtdJ7QgFNJEgXc5W+PsHwHtwQ== X-Received: by 10.28.3.68 with SMTP id 65mr5461376wmd.63.1521136233553; Thu, 15 Mar 2018 10:50:33 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 10:50:32 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 15 Mar 2018 18:49:48 +0100 Message-Id: <5dc4c501bf56cfc5645acdd2e195afff2139daec.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 18/18] app/testpmd: add show device command 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:34 -0000 A new interactive command is offered: show device This commands lists all rte_device element matching the device description. e.g.: show device bus=pci show device bus=vdev show device bus=vdev,class=eth show device bus=vdev,class=eth,name=net_ring0 These devices may not be otherwise useful, some buses will spawn devices to keep track of their assets without having a driver to use them. Signed-off-by: Gaetan Rivet --- app/test-pmd/cmdline.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 40b31ad7e..8ac5fb3ca 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6701,6 +6701,57 @@ cmdline_parse_inst_t cmd_showportall = { }, }; +/* *** SHOW DEVICE INFO *** */ +struct cmd_showdevice_result { + cmdline_fixed_string_t show; + cmdline_fixed_string_t device; + cmdline_fixed_string_t filter; +}; + +static void +cmd_showdevice_dump_device(const struct rte_device *dev) +{ + const struct rte_driver *drv = dev->driver; + + printf("0x%p: %s:%s\n", (const void *)dev, dev->name, + drv ? drv->name : ""); +} + +static void cmd_showdevice_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_showdevice_result *res = parsed_result; + struct rte_dev_iterator it; + const struct rte_device *dev; + + RTE_DEV_FOREACH(dev, res->filter, &it) + cmd_showdevice_dump_device(dev); +} + +cmdline_parse_token_string_t cmd_showdevice_show = + TOKEN_STRING_INITIALIZER(struct cmd_showdevice_result, + show, "show"); +cmdline_parse_token_string_t cmd_showdevice_device = + TOKEN_STRING_INITIALIZER(struct cmd_showdevice_result, + device, "device"); +cmdline_parse_token_string_t cmd_showdevice_filter = + TOKEN_STRING_INITIALIZER(struct cmd_showdevice_result, + filter, NULL); + +cmdline_parse_inst_t cmd_showdevice = { + .f = cmd_showdevice_parsed, + .data = NULL, + .help_str = "show device " + "", + .tokens = { + (void *)&cmd_showdevice_show, + (void *)&cmd_showdevice_device, + (void *)&cmd_showdevice_filter, + NULL, + }, +}; + /* *** SHOW PORT INFO *** */ struct cmd_showport_result { cmdline_fixed_string_t show; @@ -16038,6 +16089,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_help_long, (cmdline_parse_inst_t *)&cmd_quit, (cmdline_parse_inst_t *)&cmd_load_from_file, + (cmdline_parse_inst_t *)&cmd_showdevice, (cmdline_parse_inst_t *)&cmd_showport, (cmdline_parse_inst_t *)&cmd_showqueue, (cmdline_parse_inst_t *)&cmd_showportall, -- 2.11.0