提交 916102c6 编写于 作者: L Lendacky, Thomas 提交者: David S. Miller

amd-xgbe: Clear all state during a device restart

When performing a device restart, like during an MTU change, sometimes
the device queues still have data and get hung up trying to flush
resulting in the device becoming unresponsive until brought down and
back up. To prevent this, always perform a device reset during a
restart.
Signed-off-by: NTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 03e50fd7
...@@ -2107,6 +2107,23 @@ static void xgbe_config_jumbo_enable(struct xgbe_prv_data *pdata) ...@@ -2107,6 +2107,23 @@ static void xgbe_config_jumbo_enable(struct xgbe_prv_data *pdata)
XGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val); XGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val);
} }
static void xgbe_config_mac_speed(struct xgbe_prv_data *pdata)
{
switch (pdata->phy_speed) {
case SPEED_10000:
xgbe_set_xgmii_speed(pdata);
break;
case SPEED_2500:
xgbe_set_gmii_2500_speed(pdata);
break;
case SPEED_1000:
xgbe_set_gmii_speed(pdata);
break;
}
}
static void xgbe_config_checksum_offload(struct xgbe_prv_data *pdata) static void xgbe_config_checksum_offload(struct xgbe_prv_data *pdata)
{ {
if (pdata->netdev->features & NETIF_F_RXCSUM) if (pdata->netdev->features & NETIF_F_RXCSUM)
...@@ -2757,6 +2774,7 @@ static int xgbe_init(struct xgbe_prv_data *pdata) ...@@ -2757,6 +2774,7 @@ static int xgbe_init(struct xgbe_prv_data *pdata)
xgbe_config_mac_address(pdata); xgbe_config_mac_address(pdata);
xgbe_config_jumbo_enable(pdata); xgbe_config_jumbo_enable(pdata);
xgbe_config_flow_control(pdata); xgbe_config_flow_control(pdata);
xgbe_config_mac_speed(pdata);
xgbe_config_checksum_offload(pdata); xgbe_config_checksum_offload(pdata);
xgbe_config_vlan_support(pdata); xgbe_config_vlan_support(pdata);
xgbe_config_mmc(pdata); xgbe_config_mmc(pdata);
......
...@@ -927,7 +927,7 @@ static void xgbe_stop(struct xgbe_prv_data *pdata) ...@@ -927,7 +927,7 @@ static void xgbe_stop(struct xgbe_prv_data *pdata)
DBGPR("<--xgbe_stop\n"); DBGPR("<--xgbe_stop\n");
} }
static void xgbe_restart_dev(struct xgbe_prv_data *pdata, unsigned int reset) static void xgbe_restart_dev(struct xgbe_prv_data *pdata)
{ {
struct xgbe_channel *channel; struct xgbe_channel *channel;
struct xgbe_hw_if *hw_if = &pdata->hw_if; struct xgbe_hw_if *hw_if = &pdata->hw_if;
...@@ -950,9 +950,8 @@ static void xgbe_restart_dev(struct xgbe_prv_data *pdata, unsigned int reset) ...@@ -950,9 +950,8 @@ static void xgbe_restart_dev(struct xgbe_prv_data *pdata, unsigned int reset)
xgbe_free_tx_data(pdata); xgbe_free_tx_data(pdata);
xgbe_free_rx_data(pdata); xgbe_free_rx_data(pdata);
/* Issue software reset to device if requested */ /* Issue software reset to device */
if (reset) hw_if->exit(pdata);
hw_if->exit(pdata);
xgbe_start(pdata); xgbe_start(pdata);
...@@ -967,7 +966,7 @@ static void xgbe_restart(struct work_struct *work) ...@@ -967,7 +966,7 @@ static void xgbe_restart(struct work_struct *work)
rtnl_lock(); rtnl_lock();
xgbe_restart_dev(pdata, 1); xgbe_restart_dev(pdata);
rtnl_unlock(); rtnl_unlock();
} }
...@@ -1587,7 +1586,7 @@ static int xgbe_change_mtu(struct net_device *netdev, int mtu) ...@@ -1587,7 +1586,7 @@ static int xgbe_change_mtu(struct net_device *netdev, int mtu)
pdata->rx_buf_size = ret; pdata->rx_buf_size = ret;
netdev->mtu = mtu; netdev->mtu = mtu;
xgbe_restart_dev(pdata, 0); xgbe_restart_dev(pdata);
DBGPR("<--xgbe_change_mtu\n"); DBGPR("<--xgbe_change_mtu\n");
......
...@@ -148,6 +148,7 @@ static void xgbe_default_config(struct xgbe_prv_data *pdata) ...@@ -148,6 +148,7 @@ static void xgbe_default_config(struct xgbe_prv_data *pdata)
pdata->pause_autoneg = 1; pdata->pause_autoneg = 1;
pdata->tx_pause = 1; pdata->tx_pause = 1;
pdata->rx_pause = 1; pdata->rx_pause = 1;
pdata->phy_speed = SPEED_UNKNOWN;
pdata->power_down = 0; pdata->power_down = 0;
pdata->default_autoneg = AUTONEG_ENABLE; pdata->default_autoneg = AUTONEG_ENABLE;
pdata->default_speed = SPEED_10000; pdata->default_speed = SPEED_10000;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册