src/dpdk/drivers/net/thunderx/nicvf_ethdev.c
static int
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();

	if (wait_to_complete) {
		/* rte_eth_link_get() might need to wait up to 9 seconds */
		for (i = 0; i < MAX_CHECK_TIME; i++) {
			nicvf_link_status_update(nic, &link);
			if (link.link_status == ETH_LINK_UP)
				break;
			rte_delay_ms(CHECK_INTERVAL);
		}
	} else {
		nicvf_link_status_update(nic, &link);
	}

	return rte_eth_linkstatus_set(dev, &link);
}
/*
 * Return 0 means link status changed, -1 means not changed
 */
Return 0 means link status changed, -1 means not changed
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)
{
#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();
	if (wait_to_complete) {
		for (i = 0; i < MAX_CHECK_TIME; i++) {
			nicvf_link_status_update(nic, &link);
			if (link.link_status == ETH_LINK_UP)
				break;
			rte_delay_ms(CHECK_INTERVAL);
		}
	} else {
		nicvf_link_status_update(nic, &link);
	}
	return rte_eth_linkstatus_set(dev, &link);
}
static int 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 ( ) ; if ( wait_to_complete ) { for ( i = 0 ; i < MAX_CHECK_TIME ; i ++ ) { nicvf_link_status_update ( nic , & link ) ; if ( link . link_status == ETH_LINK_UP ) break ; rte_delay_ms ( CHECK_INTERVAL ) ; } } else { nicvf_link_status_update ( nic , & link ) ; } return rte_eth_linkstatus_set ( dev , & link ) ; }
Return 0 means link status changed, -1 means not changed
Return 0 means link status changed - 1 means not changed
/* rte_eth_link_get() might need to wait up to 9 seconds */