feat: add link status check after DPDK port initialization
Wait up to 1s for PHY auto-negotiation after rte_eth_dev_start. Reports link speed or 'link DOWN (no carrier)' to help diagnose physical connectivity issues. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+14
-1
@@ -888,5 +888,18 @@ void ng_init_port(struct rte_mempool *mbuf_pool)
|
||||
|
||||
rte_eth_promiscuous_enable(gDpdkPortId);
|
||||
|
||||
printf("[DPDK] Port %d initialized\n", gDpdkPortId);
|
||||
/* Wait for link up — PHY auto-negotiation takes 1-3 seconds */
|
||||
struct rte_eth_link link;
|
||||
int link_retries = 10;
|
||||
while (link_retries-- > 0) {
|
||||
memset(&link, 0, sizeof(link));
|
||||
rte_eth_link_get(gDpdkPortId, &link);
|
||||
if (link.link_status) break;
|
||||
rte_delay_ms(100);
|
||||
}
|
||||
if (link.link_status)
|
||||
printf("[DPDK] Port %d initialized, link %u Mbps\n",
|
||||
gDpdkPortId, link.link_speed);
|
||||
else
|
||||
printf("[DPDK] Port %d initialized, link DOWN (no carrier)\n", gDpdkPortId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user