check link status, return true if at least one port is up */
| 768 | |
| 769 | /* check link status, return true if at least one port is up */ |
| 770 | static int |
| 771 | check_link_status(uint32_t port_mask) |
| 772 | { |
| 773 | uint16_t portid; |
| 774 | struct rte_eth_link link; |
| 775 | int ret, link_status = 0; |
| 776 | char link_status_text[RTE_ETH_LINK_MAX_STR_LEN]; |
| 777 | |
| 778 | printf("\nChecking link status\n"); |
| 779 | RTE_ETH_FOREACH_DEV(portid) { |
| 780 | if ((port_mask & (1 << portid)) == 0) |
| 781 | continue; |
| 782 | |
| 783 | memset(&link, 0, sizeof(link)); |
| 784 | ret = rte_eth_link_get(portid, &link); |
| 785 | if (ret < 0) { |
| 786 | printf("Port %u link get failed: err=%d\n", |
| 787 | portid, ret); |
| 788 | continue; |
| 789 | } |
| 790 | |
| 791 | /* Print link status */ |
| 792 | rte_eth_link_to_str(link_status_text, |
| 793 | sizeof(link_status_text), &link); |
| 794 | printf("Port %d %s\n", portid, link_status_text); |
| 795 | |
| 796 | if (link.link_status) |
| 797 | link_status = 1; |
| 798 | } |
| 799 | return link_status; |
| 800 | } |
| 801 | |
| 802 | /* Configuration of device. 8< */ |
| 803 | static void |
no test coverage detected