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 543E31BE06 for ; Tue, 26 Jun 2018 18:57:21 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id g18-v6so17971845wro.7 for ; Tue, 26 Jun 2018 09:57: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=6Va4VvRZm1pXP5GZA+tCZs8WXVQWe4r8P0STi+lICn0=; b=a1jUwuvDOVvwLw0RADX2OYvMhtTxEIa4bKW2dx+PoJP/ymrzuJjsA5UdyQHXbcjUJU /1VeMfQYk4C+Imdi1HGaJEUPT8juRNMD51j4nFZfuj3y/qZMqFcOosisMEuIzFUB5kyY Rz9BvJsoW4VnNMD7UHtmAX9QIoAQIzPADwX3gXJlBEVT0iPUewh3rbUrh8bA8IhYDDII S3i5ZCMUIhganL1XQGLIPSiCc11x0QtbDnW4bKxRGrreDWGP1EDKIjcoMcH8+sExQJwg 6sY8oCxsD9kTGB+tPCvAduAnS5LNP+0B4wiNGEct0IfEqOrsWyU1wRIz+Yrfw5LG7CFi TDCg== 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=6Va4VvRZm1pXP5GZA+tCZs8WXVQWe4r8P0STi+lICn0=; b=Yx4NAE1ivYsbyK7y+gmC+KZaN9ozGU9RQ5yrMx3PMbLOljWw42yTb1ZJxbdLEGFOIu UxO2nxho27grd89HG37ldZllhI0/P5/PI4oPGqxDGs66G8TPoqVjqhAArTEpqOBNT3Cp 7goVDG+cKFb/qkyyzZba5n0oEwqwfPuE+NmskGEW7WCx2hip7zZPc4roDyYTItrhLvQx m2xerZ/wrvyzDFS60DS84I9X8UFSFnbY7fwOzIJVsic45U1fI7Xep0E/an83owvPcv8+ 2WTfaDkqqxMDPWT4k31RzaZW2XMdmrAbchArSzUzt68vbmJ2l9QPg8PtOHa0NayjkfgT Bxyg== X-Gm-Message-State: APt69E0MsguyNe2u4IBD5uSqSH8h6wcrXU+kT7xBtam3Epb6AvCK1l6t eT4vf8PF/8uzjBYkCAYwye9cna8z X-Google-Smtp-Source: AAOMgpfeSc6j3dFgf4EnFdqOc7wxvTO/9XCE7zkUTQ6Ic71ua3Ol0I0Mqt2fViCGXYHmqtZRKFDv2w== X-Received: by 2002:adf:f783:: with SMTP id q3-v6mr1365937wrp.108.1530032240588; Tue, 26 Jun 2018 09:57: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 p5-v6sm2680880wre.83.2018.06.26.09.57.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 09:57:19 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 26 Jun 2018 18:56:24 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v8 21/21] 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: Tue, 26 Jun 2018 16:57:21 -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 | 51 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 24 ++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 27e2aa8c8..872492b88 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -7083,6 +7083,56 @@ 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; @@ -17262,6 +17312,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, diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 0d6fd50ca..4f1009a3a 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2628,6 +2628,30 @@ set the traffic management default hierarchy on the port:: testpmd> set port tm hierarchy default (port_id) +Device functions +---------------- + +Show devices +~~~~~~~~~~~~ + +Display any registered devices:: + + testpmd> show device + +where: + +* ``device_string``: Device description string, of the format + + layer[/layer[/layer]] + + where one layer is in the form + + layer_key=layer_name[,key1=value1[,...]] + + Valid layer keys are ``bus`` and ``class``. + Their respective values is defined by registered ``bus`` and ``class`` + drivers. + Filter Functions ---------------- -- 2.11.0