From: Shaopeng He Date: Fri, 5 Feb 2016 04:57:49 +0000 (+0800) Subject: fm10k: make default VID available in initialization X-Git-Tag: spdx-start~7345 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8bd8bae9c389c1664d095424f5ad1549614cd29c;p=dpdk.git fm10k: make default VID available in initialization When the PF establishes a connection with Switch Manager(SM), it receives a logical port range from SM, and registers certain logical ports from that range. Then a default VID will be sent back from the SM. This whole transaction - finishing with the default VID being set - needs to be completed before dev_init returns. If not, the interrupt setting will subsequently be changed in dev_start according to the RX queue number, and that can cause this transaction to fail. Signed-off-by: Shaopeng He Acked-by: Jing Chen Acked-by: Michael Qiu --- diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 5850b57627..068a20c014 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -2818,6 +2818,21 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) fm10k_mbx_unlock(hw); + /* Make sure default VID is ready before going forward. */ + if (hw->mac.type == fm10k_mac_pf) { + for (i = 0; i < MAX_QUERY_SWITCH_STATE_TIMES; i++) { + if (hw->mac.default_vid) + break; + /* Delay some time to acquire async port VLAN info. */ + rte_delay_us(WAIT_SWITCH_MSG_US); + } + + if (!hw->mac.default_vid) { + PMD_INIT_LOG(ERR, "default VID is not ready"); + return -1; + } + } + /* Add default mac address */ fm10k_MAC_filter_set(dev, hw->mac.addr, true, MAIN_VSI_POOL_NUMBER);