From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D070A052B; Tue, 28 Jul 2020 21:14:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 159111C0AC; Tue, 28 Jul 2020 21:13:53 +0200 (CEST) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id 1DEF41C00D for ; Tue, 28 Jul 2020 21:13:48 +0200 (CEST) Received: by mail-pj1-f67.google.com with SMTP id lx9so454424pjb.2 for ; Tue, 28 Jul 2020 12:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aqlSZ9jLKuxEHylb3JSTjYPwvQoT1r6AkVy+DoW0hBM=; b=F26NHpbckhfZEsUrSP5Za955Sjevs8dJMTQjoVf5PjFc6tRfmsKVQnqZ1WQA5Y7UXs fa4HkZ7nq3oSpmBAQCScwRDls397k78DW3z3yuWt66MNZnmK21zEckmIrxZjDbhNVGcK Eio472CE4DEGuMlPaVtMI1IVf+q+CnF/h8DQVp9ZnJk4yZhni/fHDFHfRK+4KWXSS/V8 1XOVsfpAA2T85CjgDkPJH6kjq3H7edYAXNLD+dSxm+iZXkj5Z841MB87GbtgAgq0e1ce y/iMC4Yz3eGe7hqhzyErZxqskfMk4fGyc5XJl4YSjcKcdUfsVwQzhgGSfqhGKYOnS1mk qgAw== 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:mime-version:content-transfer-encoding; bh=aqlSZ9jLKuxEHylb3JSTjYPwvQoT1r6AkVy+DoW0hBM=; b=DYa0G3ZN6WIV73MqOBoUArHwwy1ac6axgEsFWKP1qbqmpeSLFvcemqvswnCPwXZ8YR UwZgQN9bsEp6e/y0JKv+HbhuW8rJEgp4VTxAAJw34qagADz5GQwDvp8eY/WoKxlNgLWQ KYrFUGhIE+sRU3YlKXfCpccnJcK86khiS2M4RiTRXC9KpLewifS77Bd/hQeT4hExkvHn IlbkwS5WJ3Nl7uNzFQIZ7zHTG8uNCGlIwJ22eOO36Bu5tLZqIeRu8NqIFs1QSteRm2un JUKYJCiE5cdW5sRy5TTpa7+JU+A9kozra2TSLeE2jEHGYV52siEVpUjiMJMhPQ8smny4 p8pw== X-Gm-Message-State: AOAM532VslcEH0etHtlF2N0NPw52FECPF/qMclaoNWKSg/PGjaqWHrGb h3PUmsMgeUf+ff4RmIkFwupXh2EZqpC74A== X-Google-Smtp-Source: ABdhPJzO7giEyWS3vU38b30CiypG7h+L2t/SwoHInE5tkgvmF3QNrkJlz1Am7cq83dV4Lc8CVkDiEA== X-Received: by 2002:a17:90b:3713:: with SMTP id mg19mr5735503pjb.3.1595963626852; Tue, 28 Jul 2020 12:13:46 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id x66sm19045748pgb.12.2020.07.28.12.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 12:13:46 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Hemant Agrawal Date: Tue, 28 Jul 2020 12:13:26 -0700 Message-Id: <20200728191330.20864-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200728191330.20864-1-stephen@networkplumber.org> References: <20200506193741.24117-1-stephen@networkplumber.org> <20200728191330.20864-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 4/8] app/proc-info: add more info to show_ports 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Revise the display of port information to include more data and be more human friendly. * Display units for port speed, and decode link fields. * Show driver and device information * Show MAC address * Show flow control information * Combine lines if possible * Show all multicast mode * Show queue mempool name Signed-off-by: Stephen Hemminger Acked-by: Hemant Agrawal --- app/proc-info/main.c | 100 +++++++++++++++++++++++++++++++++---------- 1 file changed, 78 insertions(+), 22 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index e4914191bef9..28838be882b9 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -669,6 +669,8 @@ show_port(void) struct rte_eth_dev_info dev_info; struct rte_eth_rxq_info queue_info; struct rte_eth_rss_conf rss_conf; + struct rte_eth_fc_conf fc_conf; + struct rte_ether_addr mac; memset(&rss_conf, 0, sizeof(rss_conf)); @@ -676,32 +678,86 @@ show_port(void) STATS_BDR_STR(5, bdr_str); printf(" - generic config\n"); - printf("\t -- Socket %d\n", rte_eth_dev_socket_id(i)); + ret = rte_eth_dev_info_get(i, &dev_info); + if (ret != 0) { + printf("Error during getting device info: %s\n", + strerror(-ret)); + return; + } + + printf("\t -- driver %s device %s socket %d\n", + dev_info.driver_name, dev_info.device->name, + rte_eth_dev_socket_id(i)); + ret = rte_eth_link_get(i, &link); if (ret < 0) { printf("Link get failed (port %u): %s\n", i, rte_strerror(-ret)); } else { - printf("\t -- link speed %d duplex %d," - " auto neg %d status %d\n", - link.link_speed, - link.link_duplex, - link.link_autoneg, - link.link_status); + uint32_t speed = link.link_speed; + char suffix = 'M'; + const char *duplex, *autoneg, *status; + + if (speed > 1000) { + suffix = 'G'; + speed /= 1000; + } + + if (link.link_duplex == ETH_LINK_FULL_DUPLEX) + duplex = "full"; + else + duplex = "half"; + + if (link.link_autoneg == ETH_LINK_AUTONEG) + autoneg = "auto neg"; + else + autoneg = "fixed"; + + if (link.link_status == ETH_LINK_UP) + status = "up"; + else + status = "down"; + + printf("\t -- link speed %u%cbps (%s), duplex %s, %s\n", + speed, suffix, autoneg, duplex, status); + } + + ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf); + if (ret == 0 && fc_conf.mode != RTE_FC_NONE) { + printf("\t -- flow control mode %s%s high %u low %u pause %u%s%s\n", + fc_conf.mode == RTE_FC_RX_PAUSE ? "rx " : + fc_conf.mode == RTE_FC_TX_PAUSE ? "tx " : + fc_conf.mode == RTE_FC_FULL ? "full" : "???", + fc_conf.autoneg ? " auto" : "", + fc_conf.high_water, + fc_conf.low_water, + fc_conf.pause_time, + fc_conf.send_xon ? " xon" : "", + fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : ""); } - printf("\t -- promiscuous (%d)\n", - rte_eth_promiscuous_get(i)); + + ret = rte_eth_macaddr_get(i, &mac); + if (ret == 0) { + char ebuf[RTE_ETHER_ADDR_FMT_SIZE]; + rte_ether_format_addr(ebuf, sizeof(ebuf), &mac); + printf("\t -- mac %s\n", ebuf); + } + + + ret = rte_eth_promiscuous_get(i); + if (ret >= 0) + printf("\t -- promiscuous mode %s\n", + ret > 0 ? "enabled" : "disabled"); + + ret = rte_eth_allmulticast_get(i); + if (ret >= 0) + printf("\t -- all multicast mode %s\n", + ret > 0 ? "enabled" : "disabled"); + ret = rte_eth_dev_get_mtu(i, &mtu); if (ret == 0) printf("\t -- mtu (%d)\n", mtu); - ret = rte_eth_dev_info_get(i, &dev_info); - if (ret != 0) { - printf("Error during getting device (port %u) info: %s\n", - i, strerror(-ret)); - return; - } - printf(" - queue\n"); for (j = 0; j < dev_info.nb_rx_queues; j++) { ret = rte_eth_rx_queue_info_get(i, j, &queue_info); @@ -709,12 +765,12 @@ show_port(void) printf("\t -- queue %d rx scatter %d" " descriptors %d" " offloads 0x%"PRIx64 - " mempool socket %d\n", - j, - queue_info.scattered_rx, - queue_info.nb_desc, - queue_info.conf.offloads, - queue_info.mp->socket_id); + " mempool name %s socket %d\n", + j, queue_info.scattered_rx, + queue_info.nb_desc, + queue_info.conf.offloads, + queue_info.mp->name, + queue_info.mp->socket_id); } } -- 2.27.0