X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvm_power_manager%2Fmain.c;h=273bfec2999f3da8d52597b8b7f7c817596394f9;hb=fa19eb20d2126d8bc63acc8f336a353dfaf8c354;hp=3778b538c8173d8894ee4acac1945bfbdf434b4b;hpb=f430bbcecf3eed93916f45654f51dd19d6955aa2;p=dpdk.git diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index 3778b538c8..273bfec299 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -112,7 +112,13 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) /* Display the port MAC address. */ struct rte_ether_addr addr; - rte_eth_macaddr_get(port, &addr); + retval = rte_eth_macaddr_get(port, &addr); + if (retval != 0) { + printf("Failed to get device (port %u) MAC address: %s\n", + port, rte_strerror(-retval)); + return retval; + } + printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", (unsigned int)port, @@ -237,6 +243,7 @@ check_all_ports_link_status(uint32_t port_mask) #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */ uint16_t portid, count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -250,7 +257,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) @@ -258,7 +272,7 @@ check_all_ports_link_status(uint32_t port_mask) "Mbps - %s\n", (uint16_t)portid, (unsigned int)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", (uint16_t)portid); @@ -288,7 +302,7 @@ check_all_ports_link_status(uint32_t port_mask) } } static int -run_monitor(__attribute__((unused)) void *arg) +run_monitor(__rte_unused void *arg) { if (channel_monitor_init() < 0) { printf("Unable to initialize channel monitor\n"); @@ -299,7 +313,7 @@ run_monitor(__attribute__((unused)) void *arg) } static int -run_core_monitor(__attribute__((unused)) void *arg) +run_core_monitor(__rte_unused void *arg) { if (branch_monitor_init() < 0) { printf("Unable to initialize core monitor\n");