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

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

Merge branch 'phy_ethtool_nway_reset'



Florian Fainelli says:

====================
net: phy: Centralize auto-negotation restart

This patch series centralizes how ethtool::nway_reset is implemented
by providing a PHYLIB function which calls into genphy_restart_aneg().

All drivers below are converted to use this new helper function. Some
other have specific requirements that make them not quite suitable for
a straight forward conversion.

There is another patch series which implements ethtool::nway_reset
using the helper function introduced that depends on this patch
series.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 8ebd115b 860ce4b4
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -1037,16 +1037,6 @@ static const struct net_device_ops nb8800_netdev_ops = {
	.ndo_validate_addr	= eth_validate_addr,
};

static int nb8800_nway_reset(struct net_device *dev)
{
	struct phy_device *phydev = dev->phydev;

	if (!phydev)
		return -ENODEV;

	return genphy_restart_aneg(phydev);
}

static void nb8800_get_pauseparam(struct net_device *dev,
				  struct ethtool_pauseparam *pp)
{
@@ -1165,7 +1155,7 @@ static void nb8800_get_ethtool_stats(struct net_device *dev,
}

static const struct ethtool_ops nb8800_ethtool_ops = {
	.nway_reset		= nb8800_nway_reset,
	.nway_reset		= phy_ethtool_nway_reset,
	.get_link		= ethtool_op_get_link,
	.get_pauseparam		= nb8800_get_pauseparam,
	.set_pauseparam		= nb8800_set_pauseparam,
+2 −5
Original line number Diff line number Diff line
@@ -1434,11 +1434,8 @@ static int bcm_enet_nway_reset(struct net_device *dev)
	struct bcm_enet_priv *priv;

	priv = netdev_priv(dev);
	if (priv->has_phy) {
		if (!dev->phydev)
			return -ENODEV;
		return genphy_restart_aneg(dev->phydev);
	}
	if (priv->has_phy)
		return phy_ethtool_nway_reset(dev),

	return -EOPNOTSUPP;
}
+1 −8
Original line number Diff line number Diff line
@@ -971,13 +971,6 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)
	return phy_ethtool_set_eee(priv->phydev, e);
}

static int bcmgenet_nway_reset(struct net_device *dev)
{
	struct bcmgenet_priv *priv = netdev_priv(dev);

	return genphy_restart_aneg(priv->phydev);
}

/* standard ethtool support functions. */
static const struct ethtool_ops bcmgenet_ethtool_ops = {
	.get_strings		= bcmgenet_get_strings,
@@ -991,7 +984,7 @@ static const struct ethtool_ops bcmgenet_ethtool_ops = {
	.set_wol		= bcmgenet_set_wol,
	.get_eee		= bcmgenet_get_eee,
	.set_eee		= bcmgenet_set_eee,
	.nway_reset		= bcmgenet_nway_reset,
	.nway_reset		= phy_ethtool_nway_reset,
	.get_coalesce		= bcmgenet_get_coalesce,
	.set_coalesce		= bcmgenet_set_coalesce,
	.get_link_ksettings	= bcmgenet_get_link_ksettings,
+1 −11
Original line number Diff line number Diff line
@@ -2344,16 +2344,6 @@ static int fec_enet_get_sset_count(struct net_device *dev, int sset)
}
#endif /* !defined(CONFIG_M5272) */

static int fec_enet_nway_reset(struct net_device *dev)
{
	struct phy_device *phydev = dev->phydev;

	if (!phydev)
		return -ENODEV;

	return genphy_restart_aneg(phydev);
}

/* ITR clock source is enet system clock (clk_ahb).
 * TCTT unit is cycle_ns * 64 cycle
 * So, the ICTT value = X us / (cycle_ns * 64)
@@ -2553,7 +2543,7 @@ static const struct ethtool_ops fec_enet_ethtool_ops = {
	.get_drvinfo		= fec_enet_get_drvinfo,
	.get_regs_len		= fec_enet_get_regs_len,
	.get_regs		= fec_enet_get_regs,
	.nway_reset		= fec_enet_nway_reset,
	.nway_reset		= phy_ethtool_nway_reset,
	.get_link		= ethtool_op_get_link,
	.get_coalesce		= fec_enet_get_coalesce,
	.set_coalesce		= fec_enet_set_coalesce,
+1 −6
Original line number Diff line number Diff line
@@ -807,11 +807,6 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs,
		regs->version = 0;
}

static int fs_nway_reset(struct net_device *dev)
{
	return 0;
}

static u32 fs_get_msglevel(struct net_device *dev)
{
	struct fs_enet_private *fep = netdev_priv(dev);
@@ -865,7 +860,7 @@ static int fs_set_tunable(struct net_device *dev,
static const struct ethtool_ops fs_ethtool_ops = {
	.get_drvinfo = fs_get_drvinfo,
	.get_regs_len = fs_get_regs_len,
	.nway_reset = fs_nway_reset,
	.nway_reset = phy_ethtool_nway_reset,
	.get_link = ethtool_op_get_link,
	.get_msglevel = fs_get_msglevel,
	.set_msglevel = fs_set_msglevel,
Loading