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 85808A0548; Wed, 15 Jul 2020 23:23:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 773E61BEAA; Wed, 15 Jul 2020 23:22:47 +0200 (CEST) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id 4E22E1BE0C for ; Wed, 15 Jul 2020 23:22:44 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id t6so2923573plo.3 for ; Wed, 15 Jul 2020 14:22:44 -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=Ycfr1krCrOiHD4LOmL+qhnZ/LybeBBnpZvDhhnSqKL0=; b=GtkBP6o2mDc7QppM+WdM77YMY758ZBl42R61zXRIcw0OuaZevpJZBASmMPRwg28SPh xzWd0A7KLKv6Mo/Oxd+bFsXVp+tdet1DE+r6+fMgljf2Z9KTJqpZfhY4NUwWQ1HDLa2f VlQa8ET4AeGg5drA5DNeU3IJ1lUew1QHBcDUHvnbVOj4lpMevTCQsxpoOb3gXaOl2okU JG72QeeJW2UHLtWoBq8sGJkfMT49ZzoW4x7obkwmqienrIb9cwKFO+lwASU5NAYlE/Id qOGQf891Rm4Rv/uLR/O4fpUHqFnjOITIpRVr1Xs8DylkFDXbwnQ6PSWMuvlTkyBOleOL 3rLQ== 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=Ycfr1krCrOiHD4LOmL+qhnZ/LybeBBnpZvDhhnSqKL0=; b=CY+pqIzj8esYYelZ9oLSzKXFJ+pWnbfQ60wjHI3w+a5yxwNm2l3IrSoNQ+YCClnxgo 6sQzCqkZdpObGR3/f9eR9I0XoWP86PrLWz2jXlIx2xFX9EcSZ9uDcC64r/8ouZ5EyOiP EE9Kj8Xbf7fU9RVUPCcP+WYSKZePJLRbw2CBqb8/CI39DEE9f22oisVi9jjH+vdaDdcs +M/gR9DlbfV1hFBfNtY5dcLw8ic2yQr5sSw85AQi7baDWQm5jZhdXmOonQsG+1OKPxMk YHCACNlusIfT57Y8Y6XgRGn39PQTsZlzSufz4rRvxZTp+CxqH9WFph4R9WSHswFPnzB3 E7qQ== X-Gm-Message-State: AOAM5331QsQ6nkqtVF7NnHahOFytosNfjI7EmyFC5+kH0uoi0TkKb+l0 L2sZ78a7UDziKDV2F+wJIVCQeA== X-Google-Smtp-Source: ABdhPJxbzIw60daoKO9+1QT+mZ2Tlgf15nwrqqR84lh+fSAjZycP1rObrqGotvOxYhBoVXAqJ9qqdg== X-Received: by 2002:a17:90b:1b52:: with SMTP id nv18mr1703075pjb.129.1594848163602; Wed, 15 Jul 2020 14:22:43 -0700 (PDT) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id s89sm2932600pjj.28.2020.07.15.14.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 14:22:42 -0700 (PDT) From: Stephen Hemminger To: maryam.tahhan@intel.com, reshma.pattan@intel.com, hemant.agrawal@nxp.com Cc: dev@dpdk.org, Stephen Hemminger Date: Wed, 15 Jul 2020 14:22:26 -0700 Message-Id: <20200715212228.28010-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200715212228.28010-1-stephen@networkplumber.org> References: <20200506193741.24117-1-stephen@networkplumber.org> <20200715212228.28010-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 5/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 Acked-by: Hemant Agrawal --- 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 7c1276b7fbc1..5000724fcdd1 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); } @@ -758,20 +777,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.27.0