Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a679dbbb authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'hns-fixes'



yankejian says:

====================
net: hns: fixes two bugs in hns driver

  This patchset fixes two bugs in hns driver.
  - fixes timeout when received pause frame from the connective ports
  - should be set by using ethtool -s when the devices are link down
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4639a3b5 90a505b9
Loading
Loading
Loading
Loading
+6 −7
Original line number Original line Diff line number Diff line
@@ -1315,16 +1315,15 @@ static void hns_nic_reset_subtask(struct hns_nic_priv *priv)
		return;
		return;


	hns_nic_dump(priv);
	hns_nic_dump(priv);
	netdev_err(priv->netdev, "Reset %s port\n",
	netdev_info(priv->netdev, "Reset %s port\n",
		    (type == HNAE_PORT_DEBUG ? "debug" : "business"));
		    (type == HNAE_PORT_DEBUG ? "debug" : "business"));


	rtnl_lock();
	rtnl_lock();
	if (type == HNAE_PORT_DEBUG) {
	/* put off any impending NetWatchDogTimeout */
	priv->netdev->trans_start = jiffies;

	if (type == HNAE_PORT_DEBUG)
		hns_nic_net_reinit(priv->netdev);
		hns_nic_net_reinit(priv->netdev);
	} else {
		hns_nic_net_down(priv->netdev);
		hns_nic_net_reset(priv->netdev);
	}
	rtnl_unlock();
	rtnl_unlock();
}
}


+12 −27
Original line number Original line Diff line number Diff line
@@ -194,9 +194,7 @@ static int hns_nic_set_settings(struct net_device *net_dev,
{
{
	struct hns_nic_priv *priv = netdev_priv(net_dev);
	struct hns_nic_priv *priv = netdev_priv(net_dev);
	struct hnae_handle *h;
	struct hnae_handle *h;
	int link_stat;
	u32 speed;
	u32 speed;
	u8 duplex, autoneg;


	if (!netif_running(net_dev))
	if (!netif_running(net_dev))
		return -ESRCH;
		return -ESRCH;
@@ -206,48 +204,35 @@ static int hns_nic_set_settings(struct net_device *net_dev,
		return -ENODEV;
		return -ENODEV;


	h = priv->ae_handle;
	h = priv->ae_handle;
	link_stat = hns_nic_get_link(net_dev);
	duplex = cmd->duplex;
	speed = ethtool_cmd_speed(cmd);
	speed = ethtool_cmd_speed(cmd);
	autoneg = cmd->autoneg;

	if (!link_stat) {
		if (duplex != (u8)DUPLEX_UNKNOWN || speed != (u32)SPEED_UNKNOWN)
			return -EINVAL;

		if (h->phy_if == PHY_INTERFACE_MODE_SGMII && h->phy_node) {
			priv->phy->autoneg = autoneg;
			return phy_start_aneg(priv->phy);
		}
	}


	if (h->phy_if == PHY_INTERFACE_MODE_XGMII) {
	if (h->phy_if == PHY_INTERFACE_MODE_XGMII) {
		if (autoneg != AUTONEG_DISABLE)
		if (cmd->autoneg == AUTONEG_ENABLE || speed != SPEED_10000 ||
			return -EINVAL;
		    cmd->duplex != DUPLEX_FULL)

		if (speed != SPEED_10000 || duplex != DUPLEX_FULL)
			return -EINVAL;
			return -EINVAL;
	} else if (h->phy_if == PHY_INTERFACE_MODE_SGMII) {
	} else if (h->phy_if == PHY_INTERFACE_MODE_SGMII) {
		if (!h->phy_node && autoneg != AUTONEG_DISABLE)
		if (!priv->phy && cmd->autoneg == AUTONEG_ENABLE)
			return -EINVAL;
			return -EINVAL;


		if (speed == SPEED_1000 && duplex == DUPLEX_HALF)
		if (speed == SPEED_1000 && cmd->duplex == DUPLEX_HALF)
			return -EINVAL;
			return -EINVAL;
		if (priv->phy)
			return phy_ethtool_sset(priv->phy, cmd);


		if (speed != SPEED_10 && speed != SPEED_100 &&
		if ((speed != SPEED_10 && speed != SPEED_100 &&
		    speed != SPEED_1000)
		     speed != SPEED_1000) || (cmd->duplex != DUPLEX_HALF &&
		     cmd->duplex != DUPLEX_FULL))
			return -EINVAL;
			return -EINVAL;
	} else {
	} else {
		netdev_err(net_dev, "Not supported!");
		netdev_err(net_dev, "Not supported!");
		return -ENOTSUPP;
		return -ENOTSUPP;
	}
	}


	if (priv->phy) {
	if (h->dev->ops->adjust_link) {
		return phy_ethtool_sset(priv->phy, cmd);
		h->dev->ops->adjust_link(h, (int)speed, cmd->duplex);
	} else if (h->dev->ops->adjust_link && link_stat) {
		h->dev->ops->adjust_link(h, speed, duplex);
		return 0;
		return 0;
	}
	}

	netdev_err(net_dev, "Not supported!");
	netdev_err(net_dev, "Not supported!");
	return -ENOTSUPP;
	return -ENOTSUPP;
}
}