examples: fix port mask parsing failure handling
[dpdk.git] / examples / l2fwd-jobstats / main.c
index c1ca100..29d5705 100644 (file)
@@ -329,6 +329,9 @@ show_stats_cb(__rte_unused void *param)
        }
 
        printf("\n====================================================\n");
+
+       fflush(stdout);
+
        rte_eal_alarm_set(timer_period * US_PER_S, show_stats_cb, NULL);
 }
 
@@ -562,10 +565,7 @@ l2fwd_parse_portmask(const char *portmask)
        /* parse hexadecimal string */
        pm = strtoul(portmask, &end, 16);
        if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0'))
-               return -1;
-
-       if (pm == 0)
-               return -1;
+               return 0;
 
        return pm;
 }
@@ -710,7 +710,7 @@ check_all_ports_link_status(uint32_t port_mask)
                                        "Port%d Link Up. Speed %u Mbps - %s\n",
                                                portid, link.link_speed,
                                (link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
-                                       ("full-duplex") : ("half-duplex\n"));
+                                       ("full-duplex") : ("half-duplex"));
                                else
                                        printf("Port %d Link Down\n", portid);
                                continue;