net/vmxnet3: keep consistent link status

Bonding may examine the link properties to ensure that matching interfaces
are bound together.  If the link is going to have fixed properties,
these need to remain consistent regardless of the link_status or the
state of the adapter.

Signed-off-by: Chas Williams <chas3@att.com>
Acked-by: Shrikrishna Khare <skhare@vmware.com>
This commit is contained in:
Chas Williams 2018-01-17 10:04:57 -05:00 committed by Ferruh Yigit
parent 3e5810f31d
commit 7a3d20151d

View File

@ -267,6 +267,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
struct rte_pci_device *pci_dev;
struct vmxnet3_hw *hw = eth_dev->data->dev_private;
uint32_t mac_hi, mac_lo, ver;
struct rte_eth_link link;
PMD_INIT_FUNC_TRACE();
@ -369,6 +370,13 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev)
memset(hw->saved_tx_stats, 0, sizeof(hw->saved_tx_stats));
memset(hw->saved_rx_stats, 0, sizeof(hw->saved_rx_stats));
/* set the initial link status */
memset(&link, 0, sizeof(link));
link.link_duplex = ETH_LINK_FULL_DUPLEX;
link.link_speed = ETH_SPEED_NUM_10G;
link.link_autoneg = ETH_LINK_FIXED;
vmxnet3_dev_atomic_write_link_status(eth_dev, &link);
return 0;
}
@ -857,6 +865,9 @@ vmxnet3_dev_stop(struct rte_eth_dev *dev)
/* Clear recorded link status */
memset(&link, 0, sizeof(link));
link.link_duplex = ETH_LINK_FULL_DUPLEX;
link.link_speed = ETH_SPEED_NUM_10G;
link.link_autoneg = ETH_LINK_FIXED;
vmxnet3_dev_atomic_write_link_status(dev, &link);
}
@ -1145,12 +1156,11 @@ __vmxnet3_dev_link_update(struct rte_eth_dev *dev,
VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK);
ret = VMXNET3_READ_BAR1_REG(hw, VMXNET3_REG_CMD);
if (ret & 0x1) {
if (ret & 0x1)
link.link_status = ETH_LINK_UP;
link.link_duplex = ETH_LINK_FULL_DUPLEX;
link.link_speed = ETH_SPEED_NUM_10G;
link.link_autoneg = ETH_LINK_AUTONEG;
}
link.link_duplex = ETH_LINK_FULL_DUPLEX;
link.link_speed = ETH_SPEED_NUM_10G;
link.link_autoneg = ETH_LINK_AUTONEG;
vmxnet3_dev_atomic_write_link_status(dev, &link);