From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com [209.85.128.171]) by dpdk.org (Postfix) with ESMTP id A72661B873 for ; Tue, 15 May 2018 15:48:36 +0200 (CEST) Received: by mail-wr0-f171.google.com with SMTP id h5-v6so225495wrm.4 for ; Tue, 15 May 2018 06:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a13LnPVmor3zhRGsaZXE/KgoSbpHqxnJUxw12lczHyM=; b=bIkNP/YXpuTjEg9h8f2ydiTTruSzXnPcZKOYCr30NYUrnXqE5JEvEkLT7CCvjrlvGW tPYRfeMm1bV7dKrb8wqcO7tpCIniPrT/+shp/RX62lxHaLpT6gjEvRivrzj2xz7o+XpW VlXjT++wom6wwOm43W2yEMdb+qZ4fRdahzAz+RCh6Hddz/Zr6flS6Y9bNMrqfeMb+Rt5 l40LmZMqqH/LFszhzcC9RPZCBOKQ9PVDkgBhCXD5CP5xKoMNyAAVJmJiPPvrG3zDMvDu PtZ09/StilZGnXioCvvvSCkOdW24xepnWTq8jGVvWP4c262k+Fm5GCPt5ecgIiTWNiZ1 fpfw== 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; bh=a13LnPVmor3zhRGsaZXE/KgoSbpHqxnJUxw12lczHyM=; b=ghsHFD+UVzXI6yrQt8ywiksAnX80/scNOw/jm59r6oNqeaTs0VJZQdUpxBjw9rpTiL 4nwDZfzlaYWyUECxDd7W8dmdtbF/s2HMr3U1Nka27x8xxsd+l40L96l9tXlDjn6687B4 lVNfWvL27xT1Uoe9FOLP7VNZlpGgXdV0S17i5bxJ6xoeCc43bHrl9ecqPqmPiXfZIQ0X 7V7eBanpC4eE003QL4y2ldeQmDRgAqqMPPVO2H5du7/rdTEUWIUKCeI+2a6lXCwu23Hd rncLsj/Twya6RNfimiMXcNdaQWZ+z06Q4NPoPhbSIjQF1xb2LAo8DXaoR8a3tMfX1nce PDtw== X-Gm-Message-State: ALKqPwdUzXczVLWSkrQIF28qX/gWMjVh8zMYHIyXtdNfe7g/1b1yy/q8 ozAhCs6v5GlvKkv3canNb6fZ5wSjlbc= X-Google-Smtp-Source: AB8JxZpCxHRrYeM/6uewY/g0pAe1j1EFTB/qZtBi1tWTZKW6aOic1egEdC44vV88NKA+5IeTKsBo4Q== X-Received: by 2002:adf:94c1:: with SMTP id 59-v6mr10306614wrr.112.1526392116352; Tue, 15 May 2018 06:48:36 -0700 (PDT) Received: from localhost (slip139-92-244-193.lon.uk.prserv.net. [139.92.244.193]) by smtp.gmail.com with ESMTPSA id w31-v6sm101678wrb.93.2018.05.15.06.48.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 06:48:35 -0700 (PDT) From: luca.boccassi@gmail.com To: Matan Azrad Cc: dpdk stable Date: Tue, 15 May 2018 14:46:43 +0100 Message-Id: <20180515134731.9337-32-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180515134731.9337-1-luca.boccassi@gmail.com> References: <20180503110612.12146-2-luca.boccassi@gmail.com> <20180515134731.9337-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'app/testpmd: fix valid ports prints' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 May 2018 13:48:37 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/16/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 7ac687307edfa75901c7c09b2057db17f93d022a Mon Sep 17 00:00:00 2001 From: Matan Azrad Date: Thu, 3 May 2018 10:31:43 +0000 Subject: [PATCH] app/testpmd: fix valid ports prints [ upstream commit 8f3c4176fc11ed10dac9384a33ca470f3ef52c6a ] There are several cases of an invalid port data access that causes the printing of all the valid ports, for example, when the user asks to receive a port information of an invalid port. Wrongly, the port with id 0 is printed in all the above described cases, regardless of its validity. Print port 0 only if it is valid as done for the rest of the ports. Fixes: af75078fece3 ("first public release") Fixes: b6ea6408fbc7 ("ethdev: store numa_node per device") Fixes: edab33b1c01d ("app/testpmd: support port hotplug") Signed-off-by: Matan Azrad --- app/test-pmd/config.c | 36 +++++++++++++++--------------------- app/test-pmd/parameters.c | 12 ++---------- app/test-pmd/testpmd.h | 1 + 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index a8e511f5f..8707debab 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -121,15 +121,11 @@ nic_stats_display(portid_t port_id) struct rte_eth_stats stats; struct rte_port *port = &ports[port_id]; uint8_t i; - portid_t pid; static const char *nic_stats_border = "########################"; if (port_id_is_invalid(port_id, ENABLED_WARN)) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return; } rte_eth_stats_get(port_id, &stats); @@ -203,13 +199,8 @@ nic_stats_display(portid_t port_id) void nic_stats_clear(portid_t port_id) { - portid_t pid; - if (port_id_is_invalid(port_id, ENABLED_WARN)) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return; } rte_eth_stats_reset(port_id); @@ -286,15 +277,11 @@ nic_stats_mapping_display(portid_t port_id) { struct rte_port *port = &ports[port_id]; uint16_t i; - portid_t pid; static const char *nic_stats_mapping_border = "########################"; if (port_id_is_invalid(port_id, ENABLED_WARN)) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return; } @@ -405,14 +392,10 @@ port_infos_display(portid_t port_id) int vlan_offload; struct rte_mempool * mp; static const char *info_border = "*********************"; - portid_t pid; uint16_t mtu; if (port_id_is_invalid(port_id, ENABLED_WARN)) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return; } port = &ports[port_id]; @@ -742,6 +725,17 @@ port_id_is_invalid(portid_t port_id, enum print_warning warning) return 1; } +void print_valid_ports(void) +{ + portid_t pid; + + printf("The valid ports array is ["); + RTE_ETH_FOREACH_DEV(pid) { + printf(" %d", pid); + } + printf(" ]\n"); +} + static int vlan_id_is_invalid(uint16_t vlan_id) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 97d22b860..18506dc24 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -373,7 +373,6 @@ parse_portnuma_config(const char *q_arg) }; unsigned long int_fld[_NUM_FLD]; char *str_fld[_NUM_FLD]; - portid_t pid; /* reset from value set at definition */ while ((p = strchr(p0,'(')) != NULL) { @@ -397,10 +396,7 @@ parse_portnuma_config(const char *q_arg) port_id = (portid_t)int_fld[FLD_PORT]; if (port_id_is_invalid(port_id, ENABLED_WARN) || port_id == (portid_t)RTE_PORT_ALL) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return -1; } socket_id = (uint8_t)int_fld[FLD_SOCKET]; @@ -431,7 +427,6 @@ parse_ringnuma_config(const char *q_arg) }; unsigned long int_fld[_NUM_FLD]; char *str_fld[_NUM_FLD]; - portid_t pid; #define RX_RING_ONLY 0x1 #define TX_RING_ONLY 0x2 #define RXTX_RING 0x3 @@ -458,10 +453,7 @@ parse_ringnuma_config(const char *q_arg) port_id = (portid_t)int_fld[FLD_PORT]; if (port_id_is_invalid(port_id, ENABLED_WARN) || port_id == (portid_t)RTE_PORT_ALL) { - printf("Valid port range is [0"); - RTE_ETH_FOREACH_DEV(pid) - printf(", %d", pid); - printf("]\n"); + print_valid_ports(); return -1; } socket_id = (uint8_t)int_fld[FLD_SOCKET]; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 593ae2160..956a1bf98 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -694,6 +694,7 @@ enum print_warning { DISABLED_WARN }; int port_id_is_invalid(portid_t port_id, enum print_warning warning); +void print_valid_ports(void); int new_socket_id(unsigned int socket_id); queueid_t get_allowed_max_nb_rxq(portid_t *pid); -- 2.14.2