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 B1D26A0548; Wed, 15 Jul 2020 23:23:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4767B1BED2; Wed, 15 Jul 2020 23:22:50 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 6BAAA1BEA8 for ; Wed, 15 Jul 2020 23:22:46 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id b9so2923958plx.6 for ; Wed, 15 Jul 2020 14:22:46 -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=GOTx04kn4kl/sqSteU49fcx8GiOrIhe0gsAUDwIWhdk=; b=uhJdQfkISTV20gcJrXtOKRcKUliBPutpdat9WwXDJHh7QPIYlDu7jJu2iX9pbYUM7J ex8iyRuhe+zLHhkY0CX/ydWGyfa4SUPapbDrmg7+VgEw+k3Q5OQZ6/KF+PV7OBDjwxN0 pYtKbjismS2VzAz3RMTb1fWpal0nyPAe+Uw11FMFayiQXpK+fQgRfH42POtJ4bwA2n1k J9Seeu0SyIDLtWs4VDRH3t8UOlkXh6tFoMq/pwG+U41iAqLc3vwV6+d80btWo34ynMjX ycZRUClAG10/TyNGisVwWsCQMJMwSTSj8W+SeI7nzxjy3BGXJ0JvaX+1+BurK5pKlxna aBMQ== 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=GOTx04kn4kl/sqSteU49fcx8GiOrIhe0gsAUDwIWhdk=; b=NwBUuwFc7uAz57WkBgbtcyGuv63gC8oiSUsnWTwmuKqW3uHFbgUA9eUaHG/PGirDnL LBhGw9nRF5iXmcYRz+xxG7njQmDkdpBX0cRNT0enkR/0tlU5ssUFjHzRz8t+BUTKJQa9 fURsj6FP4o73Owlbo4tY4uPVKCeOAUZlsvhPmt9kf4s4+kj8yEqDfJKu/23kqsoF1y/7 erjAPSLiTrS00rCvCclrEKLKeVfg7H8kxce9By/8+UiJFN3EXIAgRFSdOJQPHYGQuNEZ AsaSq3V+8xhQ/ZtEbv/rX/iVrbAlGitoh2Ytrf5waBSnEbl4evjNlJTtPD8ng7bOBoFx k4tA== X-Gm-Message-State: AOAM531yMGOSKWKhPlw+Q18SQBNEqQc3fduPxr1AfkfqL4j6BOh01fUH jgykUP2Af+TUpcDg9Ks+Z29iSA== X-Google-Smtp-Source: ABdhPJyXyMiwkWvkiMHQc1gk0iX4ZkdHHldYIi+LqJm0NK6rDY4AXfOZdese3eKVmXw0sRWDtJCg3Q== X-Received: by 2002:a17:902:be0e:: with SMTP id r14mr1060810pls.309.1594848165588; Wed, 15 Jul 2020 14:22:45 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 14:22:44 -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:27 -0700 Message-Id: <20200715212228.28010-7-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 6/7] app/proc-info: provide way to request info on owned ports 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" There are cases where a port maybe owned by another (failsafe, netvsc, bond); but currently proc-info has no way to look at stats of those ports. This patch provides way for the user to explicitly ask for these ports. If no portmask is given the output is unchanged; it only shows the top level ports. If portmask requests a specific port it will be shown even if owned. The device owner is also a useful thing to show in port info. Signed-off-by: Stephen Hemminger Acked-by: Hemant Agrawal --- app/proc-info/Makefile | 3 ++ app/proc-info/main.c | 74 ++++++++++++++++++++++++++++-------------- 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/app/proc-info/Makefile b/app/proc-info/Makefile index 214f3f54a1e9..f777e037861f 100644 --- a/app/proc-info/Makefile +++ b/app/proc-info/Makefile @@ -5,7 +5,10 @@ include $(RTE_SDK)/mk/rte.vars.mk APP = dpdk-procinfo +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-deprecated-declarations # all source are stored in SRCS-y diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 5000724fcdd1..14c04f8367f1 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -676,19 +677,26 @@ eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n) static void show_port(void) { - uint16_t i = 0; - int ret = 0, j, k; + uint32_t port_mask = enabled_port_mask; + int i, ret, j, k; snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD "); STATS_BDR_STR(10, bdr_str); - RTE_ETH_FOREACH_DEV(i) { + for (port_mask = enabled_port_mask; port_mask != 0; + port_mask &= ~(1u << i)) { uint16_t mtu = 0; struct rte_eth_link link; struct rte_eth_dev_info dev_info; struct rte_eth_rss_conf rss_conf; struct rte_eth_fc_conf fc_conf; struct rte_ether_addr mac; + struct rte_eth_dev_owner owner; + + i = ffs(port_mask) - 1; + + if (!rte_eth_dev_is_valid_port(i)) + continue; memset(&rss_conf, 0, sizeof(rss_conf)); @@ -707,6 +715,11 @@ show_port(void) dev_info.driver_name, dev_info.device->name, rte_eth_dev_socket_id(i)); + ret = rte_eth_dev_owner_get(i, &owner); + if (ret == 0 && owner.id != RTE_ETH_DEV_NO_OWNER) + printf("\t -- owner %#"PRIx64":%s\n", + owner.id, owner.name); + ret = rte_eth_link_get(i, &link); if (ret < 0) { printf("Link get failed (port %u): %s\n", @@ -1351,6 +1364,7 @@ main(int argc, char **argv) char log_flag[] = "--log-level=6"; char *argp[argc + 4]; uint16_t nb_ports; + uint32_t port_mask; /* preparse app arguments */ ret = proc_info_preparse_args(argc, argv); @@ -1394,30 +1408,42 @@ main(int argc, char **argv) if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); - /* If no port mask was specified*/ - if (enabled_port_mask == 0) - enabled_port_mask = 0xffff; - - RTE_ETH_FOREACH_DEV(i) { - if (enabled_port_mask & (1 << i)) { - if (enable_stats) - nic_stats_display(i); - else if (enable_xstats) - nic_xstats_display(i); - else if (reset_stats) - nic_stats_clear(i); - else if (reset_xstats) - nic_xstats_clear(i); - else if (enable_xstats_name) - nic_xstats_by_name_display(i, xstats_name); - else if (nb_xstats_ids > 0) - nic_xstats_by_ids_display(i, xstats_ids, - nb_xstats_ids); - else if (enable_metrics) - metrics_display(i); + /* If no port mask was specified, one will be provided */ + if (enabled_port_mask == 0) { + RTE_ETH_FOREACH_DEV(i) { + enabled_port_mask |= 1u << i; } } + for (port_mask = enabled_port_mask; port_mask != 0; + port_mask &= ~(1u << i)) { + /* ffs() first bit is 1 not 0 */ + i = ffs(port_mask) - 1; + + if (i >= RTE_MAX_ETHPORTS) + break; + + if (!rte_eth_dev_is_valid_port(i)) + continue; + + if (enable_stats) + nic_stats_display(i); + else if (enable_xstats) + nic_xstats_display(i); + else if (reset_stats) + nic_stats_clear(i); + else if (reset_xstats) + nic_xstats_clear(i); + else if (enable_xstats_name) + nic_xstats_by_name_display(i, xstats_name); + else if (nb_xstats_ids > 0) + nic_xstats_by_ids_display(i, xstats_ids, + nb_xstats_ids); + else if (enable_metrics) + metrics_display(i); + + } + /* print port independent stats */ if (enable_metrics) metrics_display(RTE_METRICS_GLOBAL); -- 2.27.0