From 0cca56708d781b42561e382fcbcb1f1647b932b9 Mon Sep 17 00:00:00 2001 From: Andriy Berestovskyy Date: Fri, 31 Mar 2017 15:57:49 +0200 Subject: [PATCH] net/thunderx: wait to complete during link update Some DPDK applications/examples check link status on their start. NICVF does not wait for the link, so those apps fail. Wait up to 9 seconds for the link as other PMDs do in order to fix those apps/examples. Signed-off-by: Andriy Berestovskyy Acked-by: Jerin Jacob --- drivers/net/thunderx/nicvf_ethdev.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) Origin: http://dpdk.org/browse/dpdk/commit/?id=0cca56708d781b42561e382fcbcb1f1647b932b9 Original-Author: Andriy Berestovskyy Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691659 Author: Christian Ehrhardt Last-Update: 2017-05-18 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -145,16 +145,29 @@ * Return 0 means link status changed, -1 means not changed */ static int -nicvf_dev_link_update(struct rte_eth_dev *dev, - int wait_to_complete __rte_unused) +nicvf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) { +#define CHECK_INTERVAL 100 /* 100ms */ +#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */ struct rte_eth_link link; struct nicvf *nic = nicvf_pmd_priv(dev); + int i; PMD_INIT_FUNC_TRACE(); - memset(&link, 0, sizeof(link)); - nicvf_set_eth_link_status(nic, &link); + if (wait_to_complete) { + /* rte_eth_link_get() might need to wait up to 9 seconds */ + for (i = 0; i < MAX_CHECK_TIME; i++) { + memset(&link, 0, sizeof(link)); + nicvf_set_eth_link_status(nic, &link); + if (link.link_status) + break; + rte_delay_ms(CHECK_INTERVAL); + } + } else { + memset(&link, 0, sizeof(link)); + nicvf_set_eth_link_status(nic, &link); + } return nicvf_atomic_write_link_status(dev, &link); }