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 84D78A034E; Wed, 6 May 2020 21:58:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB9241DABF; Wed, 6 May 2020 21:58:20 +0200 (CEST) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id 668491C139 for ; Wed, 6 May 2020 21:58:17 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id x15so1616334pfa.1 for ; Wed, 06 May 2020 12:58:17 -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=ADM+YFVYjHp1flPN/B5R03FdiM7inMB1bdW8e8R23Bg=; b=rYKMHHWS9SgKgPbmbyqbGJWmIgShV572jA9LrI1mIavM3jpjj1eeYiDL1aHU/Y74KG +H1Vt6l0WU2o2w2fg6ScdhqkbFsstpq/PHz3zRG0pqXa17CQSlg6I83gFtfAQcl7066O lNlf4qSCfz3wMZsQlVxD2uII4YTgasjfCPC0fT5vDol92Ms35/PGnxG6W3YcQeEFuMQZ 11djrbEImFAhRPF+wZ1Q4QNP7ugoFaXo8wl3wPYsCD4SuOCZ4XJZz8kXAW4i5w6z7YyH MXybZeiiUk1Fub3T5dcDt1gP+XUsh9vz6LGRyM9qgeFOtCKKXzxlz2MsiuVhIbtCJUhD JddQ== 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=ADM+YFVYjHp1flPN/B5R03FdiM7inMB1bdW8e8R23Bg=; b=bpUUdQQ6A/rTx0VYPBfLLuzz9BDUCeYNtftLg9RT4/k7XI16FhqvIEGy5AIUwM7rmU BFTUCpNGIJBSsX6Y2khK393OOJ0OKezdK82c6Zp3VBNHAbqyZ/GA4OgHH9ma/hIdZBKD 3wB2cI/fUXlRlumqH1aCUCVc559HLD66bdGaVgP0iRDU5lPkO7hfi0xeU6T9uF4UnNba pIrHS65naJNQgyFbsCCE6ycJ4nlwN7UEnWoXCm4mvIgiK7S08KPjpeqLn7QOUCIFTkdM CnP9Yqq6ZfSP1AQC6UPTWuc3iMKPe18GG6zvDfN0KuWmvvBgBZHQWdOeXm4ZH1/2fWjV oWUw== X-Gm-Message-State: AGi0PubjkMwlsOxnWzryfFWhIBJBu56yJBxxl4ZcJQk77N5stM+3sCzs A4NVqxaVMFivdTtgQ5+d8XxKDv8arMox8w== X-Google-Smtp-Source: APiQypJlOxBQucHrAsYy9IH/rF+rwBHEba1QUXbLej5t3pADqRjFQEZ5wFabRoRDuvxXnQnW+DM8hQ== X-Received: by 2002:a62:8001:: with SMTP id j1mr10219686pfd.202.1588795096035; Wed, 06 May 2020 12:58:16 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id w1sm2126238pgh.53.2020.05.06.12.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2020 12:58:15 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Maryam Tahhan , Reshma Pattan Date: Wed, 6 May 2020 12:57:57 -0700 Message-Id: <20200506195758.27057-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200506195758.27057-1-stephen@networkplumber.org> References: <20200506193741.24117-1-stephen@networkplumber.org> <20200506195758.27057-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 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 804c0fd63b3e..00e06c986e27 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