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 73429AAB9 for ; Tue, 27 Mar 2018 01:19:29 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id f14so20503378wre.8 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=KvTs/RBDIUErfPwslOaQUveBvHxTt/GdrWoF5Os/YMI=; b=UOnk3a5wuSIaus9I9twmd1rJGXGd0gZ43DfqdREbo+7WuGEcY3tQCLzY7zbqu8Wqte jl9dnKtj5tYAxKCjWk0f0kPwdC5p8A76OmnmV50EsSDXS8hecQKnY/lwZZ06Euo7FQ6V a68xJSbCo4P9XVL/jlEEThX0q8k6P+rMyVR0KdGTAxGO2mc8P/HIWS1zIkq4AQZcn/B+ UJ/MrOAada3Qx49YbT/edwCsGiHtxuX229l1powZkABCL5GSZ0GPQPQ5dWPbSjPlc5/O v/shp1euk/55yVaOq2nwA3aagV++zO+a+YGb0EYYq0u21VO3WW2l3TBNBEU07G+4pw48 ay0g== 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=KvTs/RBDIUErfPwslOaQUveBvHxTt/GdrWoF5Os/YMI=; b=IQYQCF2DePZsSCgwbP/qUdAIT0iPNcFlDGxkBiOghxm4/Eh3dxwmTO3QGfHgYdR7Vy ID3Y6v/keUlswjm5Io16zyRYWoifZW5zOJQ1dRBzUYgg/aWzkjl9lSE5WRzBsB00Y2S9 aTNYgk72kbFtUk0HgRPzvPPlkhHOa2yws3mA+oqvAjsakjYsMdbBpeDjEBkb6vMBz1mn FxwyVgxk40Pvv70uHkC25MUG34g3gh5Pn1UsL0OhN1tJ4wZq3fZyfgM4sw7WPvk81CM2 k2Y1zmeh+GFUTKDv8f7RsWJE+r/DU9SdqfvRcb3SmOd0vEV9oicikS+hV6JkBg0W+Ppa dB/A== X-Gm-Message-State: AElRT7GLV0JxAIKMFaTgNxMcaLGSs7hlNQ7Gc7m5wjJufV4Qg9CRDvU+ 2Z/ODnGp05ENF7M2Z2O22g3NuciQ X-Google-Smtp-Source: AG47ELt6hWFSifnrDZoaqvgh9kS+0gcHC/rmY5YL4mRvcz2upmJYB2FZDNlndNH0aTl6rMFnwUKqrQ== X-Received: by 10.223.199.10 with SMTP id k10mr31413840wrg.186.1522106368787; Mon, 26 Mar 2018 16:19:28 -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.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 16:19:27 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 27 Mar 2018 01:18:44 +0200 Message-Id: <44ab18eb5a6ef7988154f799f4c3aa4ffae59b22.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 20/20] 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: Mon, 26 Mar 2018 23:19:29 -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,driver=net_ring/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