summaryrefslogtreecommitdiffstats
path: root/app/test-pmd/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/test-pmd/config.c')
-rw-r--r--app/test-pmd/config.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 69fa04be..130ff148 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -163,15 +163,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");
- FOREACH_PORT(pid, ports)
- printf(", %d", pid);
- printf("]\n");
+ print_valid_ports();
return;
}
rte_eth_stats_get(port_id, &stats);
@@ -245,13 +241,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");
- FOREACH_PORT(pid, ports)
- printf(", %d", pid);
- printf("]\n");
+ print_valid_ports();
return;
}
rte_eth_stats_reset(port_id);
@@ -325,15 +316,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");
- FOREACH_PORT(pid, ports)
- printf(", %d", pid);
- printf("]\n");
+ print_valid_ports();
return;
}
@@ -445,13 +432,9 @@ port_infos_display(portid_t port_id)
int vlan_offload;
struct rte_mempool * mp;
static const char *info_border = "*********************";
- portid_t pid;
if (port_id_is_invalid(port_id, ENABLED_WARN)) {
- printf("Valid port range is [0");
- FOREACH_PORT(pid, ports)
- printf(", %d", pid);
- printf("]\n");
+ print_valid_ports();
return;
}
port = &ports[port_id];
@@ -554,6 +537,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 [");
+ FOREACH_PORT(pid, ports) {
+ printf(" %d", pid);
+ }
+ printf(" ]\n");
+}
+
static int
vlan_id_is_invalid(uint16_t vlan_id)
{