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 E5EF2A034E; Wed, 6 May 2020 21:38:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 90AB81DABF; Wed, 6 May 2020 21:38:04 +0200 (CEST) Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by dpdk.org (Postfix) with ESMTP id 4B08E1DAB7 for ; Wed, 6 May 2020 21:38:02 +0200 (CEST) Received: by mail-pj1-f66.google.com with SMTP id q24so1394337pjd.1 for ; Wed, 06 May 2020 12:38:02 -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=o2CMbHogHViUebrkgPJSBYa78OJtFT8GYhJoGmYV7pI=; b=wetMAMtvwJ1LdfViat7KcQ2a8jJcBI90PxFjZH5pcmWwuSB3+CkmEJRqhof+GH6MGg bko7nxOPmgduv/+5lXDCO3PnIciIUAdOmC7lSj6Q6Wa6AfGaQZuA7k1PJUK8jIoYuyFN Vl6/6uZNGlg1uC4MothRYy7L6DikS+M8vwr/4FMVeT0H38HbjBqHaskAA7muTant1OLy cXbY8UKNgRcyA7V6kltMD1tRd0xCKpUUemwd9t8TiBEP+vFYtZwvxNKzx058L+xLqULj aaPeGNxt1P7MWVOSp/nt7F9QXAREHXjaZyQ7SbCTV7LqRCNnfmgx5iZQg2Bz7zdImHgg dV0Q== 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=o2CMbHogHViUebrkgPJSBYa78OJtFT8GYhJoGmYV7pI=; b=j2ARPJ0bP+uvHd2V6SCVSDtfNJEYpfSr9Cqo2TaQXjHw3alwLiCCiOyAfKtMMTfD0k 1MMqosH27lKH8G0nKoZlIJUdsDrRS+vhYsRkLoMjcSLOxC91/WkQCppeF4fg3fz4a1aY OUKeUvXKdL5+o2GKJMXpdbLqLTp/5z4s6SJIseABxNeIdpyQpwq6RU/cgkqE6BgLk55p x9BCB03Gs5TqYzl22xMm0dUfOV5IZTXKPBKoBhEyC3+q55CigQzU9YBjLbo0EjWc4rl1 JQFft85080Ko/0A+L0JtdLQZHgUWKMeZRVDyRZvZ/aAoyHnNFW/w+49WAmCyKnB47lqs Rx8g== X-Gm-Message-State: AGi0PuYoHJPhtstIptqozyy3ZPaSW3tgqwpTSVBPXnScfrUiGGYYgtOU kKqUVbtcKSpOPBv51ujDg3tktiEhBVRueA== X-Google-Smtp-Source: APiQypIGVqOEgAMEoZ9oFzoNS/AkwpEIRN4ie6MZuTeQ2vZsvoPyICj0eYMXbyWhKwvLeaV47mDw1Q== X-Received: by 2002:a17:90a:fd89:: with SMTP id cx9mr11683605pjb.64.1588793881038; Wed, 06 May 2020 12:38:01 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j5sm1832971pjf.0.2020.05.06.12.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2020 12:38:00 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Maryam Tahhan , Reshma Pattan Date: Wed, 6 May 2020 12:37:40 -0700 Message-Id: <20200506193741.24117-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200506193741.24117-1-stephen@networkplumber.org> References: <20200506193741.24117-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 6/7] app/proc-info: dump rx and tx descriptor info 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" Many drivers will report per queue info for both rx and tx as well as how many descriptors are in use. Signed-off-by: Stephen Hemminger --- app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 13 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index bb0e0cbe9e6e..0b7ab1e78a9d 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -654,6 +654,25 @@ metrics_display(int port_id) rte_free(names); } +/* This could be replaced by an ethdev hook in future */ +static int +eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n) +{ + uint16_t offset; + int count = 0; + + for (offset = 0; offset < n; offset++) { + int status; + + status = rte_eth_tx_descriptor_status(port_id, queue_id, offset); + if (status < 0) + return status; + if (status == RTE_ETH_TX_DESC_DONE) + ++count; + } + return count; +} + static void show_port(void) { @@ -667,7 +686,6 @@ show_port(void) uint16_t mtu = 0; struct rte_eth_link link; 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; @@ -739,6 +757,7 @@ show_port(void) 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); } @@ -750,20 +769,54 @@ show_port(void) if (ret == 0) printf("\t -- mtu (%d)\n", mtu); - printf(" - queue\n"); for (j = 0; j < dev_info.nb_rx_queues; j++) { + struct rte_eth_rxq_info queue_info; + int count; + ret = rte_eth_rx_queue_info_get(i, j, &queue_info); - if (ret == 0) { - 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); - } + if (ret != 0) + break; + + if (j == 0) + printf(" - rx queue\n"); + + printf("\t -- %d descriptors ", j); + count = rte_eth_rx_queue_count(i, j); + if (count >= 0) + printf("%d/", count); + printf("%d", queue_info.nb_desc); + + if (queue_info.scattered_rx) + printf(" scattered_rx"); + + printf(" offloads %#"PRIx64" socket %d\n", + queue_info.conf.offloads, + queue_info.mp->socket_id); + } + + for (j = 0; j < dev_info.nb_tx_queues; j++) { + struct rte_eth_txq_info queue_info; + int count; + + ret = rte_eth_tx_queue_info_get(i, j, &queue_info); + if (ret != 0) + break; + + if (j == 0) + printf(" - tx queue\n"); + + printf("\t -- %d descriptors ", j); + + count = eth_tx_queue_available(i, j, queue_info.nb_desc); + if (count >= 0) + printf("%d/", count); + printf("%d", queue_info.nb_desc); + + if (queue_info.conf.tx_deferred_start) + printf(" deferred_start"); + + printf(" offloads %#"PRIx64"\n", + queue_info.conf.offloads); } ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf); -- 2.20.1