- uint8_t count = 0;
- int is_port_up = 0;
- int max_check_time = 50;
- int check_interval = 100; // 100ms
- for (count = 0; count <= max_check_time; count++) {
- memset(plink, 0, sizeof(struct rte_eth_link));
- rte_eth_link_get_nowait(portid, plink);
- if (plink->link_status == ETH_LINK_UP)
- {
- is_port_up = 1;
- break;
- }else{
- rte_delay_ms(check_interval);
- }
- }
- return is_port_up;
+ // wait up to 9 seconds to get link status
+ rte_eth_link_get(portid, plink);
+ return plink->link_status == ETH_LINK_UP;