examples: add flush after stats printing
[dpdk.git] / examples / vhost / main.c
index 0961db0..312829e 100644 (file)
@@ -228,7 +228,14 @@ port_init(uint16_t port)
        uint16_t q;
 
        /* The max pool number from dev_info will be used to validate the pool number specified in cmd line */
-       rte_eth_dev_info_get (port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               RTE_LOG(ERR, VHOST_PORT,
+                       "Error during getting device (port %u) info: %s\n",
+                       port, strerror(-retval));
+
+               return retval;
+       }
 
        rxconf = &dev_info.default_rxconf;
        txconf = &dev_info.default_txconf;
@@ -329,10 +336,24 @@ port_init(uint16_t port)
                return retval;
        }
 
-       if (promiscuous)
-               rte_eth_promiscuous_enable(port);
+       if (promiscuous) {
+               retval = rte_eth_promiscuous_enable(port);
+               if (retval != 0) {
+                       RTE_LOG(ERR, VHOST_PORT,
+                               "Failed to enable promiscuous mode on port %u: %s\n",
+                               port, rte_strerror(-retval));
+                       return retval;
+               }
+       }
+
+       retval = rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
+       if (retval < 0) {
+               RTE_LOG(ERR, VHOST_PORT,
+                       "Failed to get MAC address on port %u: %s\n",
+                       port, rte_strerror(-retval));
+               return retval;
+       }
 
-       rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
        RTE_LOG(INFO, VHOST_PORT, "Max virtio devices supported: %u\n", num_devices);
        RTE_LOG(INFO, VHOST_PORT, "Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
                        " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
@@ -1313,6 +1334,8 @@ print_stats(__rte_unused void *arg)
                }
 
                printf("===================================================\n");
+
+               fflush(stdout);
        }
 
        return NULL;