X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvm_power_manager%2Fmain.c;h=44d2508b104ac6f3d2142297bccdcba1cfff507d;hb=0a65bf8d4124866678f3ddb816d36aae66f791eb;hp=77797b1e164c5f2a07e77df4aa8d7e57286b2988;hpb=95f648ff9eedc11f9c888f2cc331aadb95cb9b47;p=dpdk.git diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index 77797b1e16..44d2508b10 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -144,10 +144,7 @@ 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; } @@ -249,6 +246,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid, count, all_ports_up, print_flag = 0; struct rte_eth_link link; int ret; + char link_status_text[RTE_ETH_LINK_MAX_STR_LEN]; printf("\nChecking link status"); fflush(stdout); @@ -272,15 +270,10 @@ check_all_ports_link_status(uint32_t port_mask) } /* print link status if flag set */ if (print_flag == 1) { - if (link.link_status) - printf("Port %d Link Up - speed %u " - "Mbps - %s\n", (uint16_t)portid, - (unsigned int)link.link_speed, - (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? - ("full-duplex") : ("half-duplex")); - else - printf("Port %d Link Down\n", - (uint16_t)portid); + rte_eth_link_to_str(link_status_text, + sizeof(link_status_text), &link); + printf("Port %d %s\n", portid, + link_status_text); continue; } /* clear all_ports_up flag if any link down */