From patchwork Tue Jul 28 19:13:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 74960 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 41EC9A052B; Tue, 28 Jul 2020 21:14:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4CD4A1C0BE; Tue, 28 Jul 2020 21:14:00 +0200 (CEST) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id 1EED41C027 for ; Tue, 28 Jul 2020 21:13:51 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id o13so12604068pgf.0 for ; Tue, 28 Jul 2020 12:13:51 -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=7637U8yBp2t87COCx24Gi+DXcnULS9DvOuhNOvJL/jc=; b=obqzdGFq3qTDgzcNHH9jJ5zpW9cRZP8D3FdDgqtcw2XcNU2gEkOnV5vmzY5AmytBax vX1jnKaAVa1IMmpvDNyV++Wl4gEfOw/4JFYKJ2stq3Nb8PmaYE1jwGvJvPVTb2dWtDf0 OGFrU2pSWRaAZrKxNKGoLK/9VC+foy12L5kn6N6qQK556+nS8MJg5pcgpGPB0099WMoQ OTPONzedbECkmGsHiL7+H5xootaONK1MV30sP2EmemWfl7pIIRobS4Pye345ObO54KBg Mpcc+7VoE1b5HzxompYLOt8HNucrIvLfj6+GHomTFGb9QmAhvs26b2XBK2WYKK2kn7wl mgDg== 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=7637U8yBp2t87COCx24Gi+DXcnULS9DvOuhNOvJL/jc=; b=RnkIbZUyRdr4eRrhxL3YMwOl3ssxd3qX2UxobuQCoN1j0mZrQuHsXazL0lHPlNSSwh 4WmllKyPp/HoH8qJayJ7vEcQXvb3hhY2lLv3f8Yu1pSrnQc/tk4x+c7CNsdP1J1PY7MV BUlJTB96qtv8L9XEjO48/5cgIZ2UjwNHBIwNx3X5yjUdIHBh8MneWOwBrbDPSzaa4ECU wsFc2XcrbHO+ewV0rspOROadnfduKQW9cajsuHgJFy+H6MIKXczL20ByatYsWQZOvI6l oT95DrG9Rg9aKFPqpfx2BbtFp25r4A4/RmAPT5Q0KIR5shtnE/Ts5qEXxz6Lu4m73xk7 YzXQ== X-Gm-Message-State: AOAM532oLovNclb8VgVSywD5QxUqeRLEsgK/hsmSFwje1D10T5araFvH 81y9UB925NQMgd9KFBzcwnDRuume30jNjA== X-Google-Smtp-Source: ABdhPJyiOCMZTjmKm1WGvyKeqwMOa0/I4bXF3k0m+fVuCAIgKvWVoe+v6QP1WkVaU5Pqeq6nq2cZMg== X-Received: by 2002:aa7:8096:: with SMTP id v22mr27214866pff.132.1595963629901; Tue, 28 Jul 2020 12:13:49 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 12:13:48 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Hemant Agrawal Date: Tue, 28 Jul 2020 12:13:28 -0700 Message-Id: <20200728191330.20864-7-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 Subject: [dpdk-dev] [PATCH v5 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 | 80 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index b2011c448577..4e2e647498ff 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,55 @@ 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 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); - } + 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" mempool %s socket %d\n", + queue_info.conf.offloads, + queue_info.mp->name, + 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);