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 613C5A0526; Tue, 21 Jul 2020 20:23:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 47F0B1C0CA; Tue, 21 Jul 2020 20:23:06 +0200 (CEST) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id EF5F51C0AC for ; Tue, 21 Jul 2020 20:23:01 +0200 (CEST) Received: by mail-pj1-f68.google.com with SMTP id t15so2073266pjq.5 for ; Tue, 21 Jul 2020 11:23:01 -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=MS29TzAnF/7DvK6A99faG+GGupmWaNY81pGDtnmH55I=; b=yChB63YSyvdybRYlPK0ao2X9PqyST6NwSGpFHhDWFEtmOAUqM75jBbtCy3yE36xZhT gftv52zSMSsx6gB6RL2ZvGmGD/Hrmg2h8vqsGMyoU5Y+8bwvRwwfRGnwoqRxKoDmMbGZ sXglTlfHv17mKYfaQ7IuH8t5cPxmi9mzh9uLczT1s6KwnAavEfwf12PQLq7o/sq4x+MY D5vpteG0o7wlpMRqURVFJ1rNDNZVWJExYcbObxUeRE+qDo5RDif5xvgpt247D06KxWDP 8WxkBPRNHicsf4kwKXF5LYkFuN8Jkb7o5IqfNaXmgO4xCvyRnxSNeIuoGZl6XLYpEAB5 8+YQ== 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=MS29TzAnF/7DvK6A99faG+GGupmWaNY81pGDtnmH55I=; b=cKjkIzMePmM9AcJasbHcwmEaXv0Ew/MtflO3Dft4ZqTXswyEljsGeKW7dJM6PeuQuK yk2OjDhS7Pd+Y2Ac4jfF/CTOf9ofN57HnD3VZBBf1hX73SfqFbiLQoK5Yzv7UCbzcOlP o6cdZlBreQ4SCtEP+3XJltVbPVFdYsfmSzZXX9ZAvBcjxTI1xUPhfT8szVyDq5ejhGDs ZQAz/XGD33nphcHQOs+9BgMl3pXnlVwhCRB/Iqz7RVrrTZbxS6DhkOvJEkFp0i1sMb/w CcZv0xitQY9KyoBhKP9S5qbdmmC/uJicUv3kRbh9bevo5wXrXJN3wMZdjGVszljiQvfR wWCw== X-Gm-Message-State: AOAM530xpeLjybUlv4fuiHlHE2BQMwYI3eXrIfaTYiYts38qDUKVos4h fDxQUhf1sFjYsxrmp8cN6HRRBm+Kh7+VZw== X-Google-Smtp-Source: ABdhPJyaw/Lv+tJz8yAo+b0YkmOlRv4/AYFoO9LJH5Gz/c9YEYfjhOyUtl3g38Bdrmh4dPUZEZBTpQ== X-Received: by 2002:a17:90a:20e9:: with SMTP id f96mr6189859pjg.13.1595355780635; Tue, 21 Jul 2020 11:23:00 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 76sm21434031pfu.139.2020.07.21.11.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 11:22:59 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Hemant Agrawal Date: Tue, 21 Jul 2020 11:22:40 -0700 Message-Id: <20200721182242.5366-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200721182242.5366-1-stephen@networkplumber.org> References: <20200506193741.24117-1-stephen@networkplumber.org> <20200721182242.5366-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 6/8] 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 f3f83c0cea37..2ea554ab01f0 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