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

Commit 70739497 authored by David Decotigny's avatar David Decotigny Committed by David S. Miller
Browse files

ethtool: cosmetic: Use ethtool ethtool_cmd_speed API



This updates the network drivers so that they don't access the
ethtool_cmd::speed field directly, but use ethtool_cmd_speed()
instead.

For most of the drivers, these changes are purely cosmetic and don't
fix any problem, such as for those 1GbE/10GbE drivers that indirectly
call their own ethtool get_settings()/mii_ethtool_gset(). The changes
are meant to enforce code consistency and provide robustness with
future larger throughputs, at the expense of a few CPU cycles for each
ethtool operation.

All drivers compiled with make allyesconfig ion x86_64 have been
updated.

Tested: make allyesconfig on x86_64 + e1000e/bnx2x work
Signed-off-by: default avatarDavid Decotigny <decot@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 25db0338
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1493,7 +1493,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
	et_cmd->maxrxpkt = 511;

	if (nesadapter->OneG_Mode) {
		et_cmd->speed = SPEED_1000;
		ethtool_cmd_speed_set(et_cmd, SPEED_1000);
		if (phy_type == NES_PHY_TYPE_PUMA_1G) {
			et_cmd->supported   = SUPPORTED_1000baseT_Full;
			et_cmd->advertising = ADVERTISED_1000baseT_Full;
@@ -1532,7 +1532,7 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
		et_cmd->advertising = ADVERTISED_10000baseT_Full;
		et_cmd->phy_address = mac_index;
	}
	et_cmd->speed = SPEED_10000;
	ethtool_cmd_speed_set(et_cmd, SPEED_10000);
	et_cmd->autoneg = AUTONEG_DISABLE;
	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -1207,7 +1207,7 @@ el3_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
			ecmd->duplex = DUPLEX_FULL;
	}

	ecmd->speed = SPEED_10;
	ethtool_cmd_speed_set(ecmd, SPEED_10);
	EL3WINDOW(1);
	return 0;
}
+4 −4
Original line number Diff line number Diff line
@@ -2658,15 +2658,15 @@ static int ace_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)

	link = readl(&regs->GigLnkState);
	if (link & LNK_1000MB)
		ecmd->speed = SPEED_1000;
		ethtool_cmd_speed_set(ecmd, SPEED_1000);
	else {
		link = readl(&regs->FastLnkState);
		if (link & LNK_100MB)
			ecmd->speed = SPEED_100;
			ethtool_cmd_speed_set(ecmd, SPEED_100);
		else if (link & LNK_10MB)
			ecmd->speed = SPEED_10;
			ethtool_cmd_speed_set(ecmd, SPEED_10);
		else
			ecmd->speed = 0;
			ethtool_cmd_speed_set(ecmd, 0);
	}
	if (link & LNK_FULL_DUPLEX)
		ecmd->duplex = DUPLEX_FULL;
+3 −2
Original line number Diff line number Diff line
@@ -591,10 +591,11 @@ static void etherh_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i
static int etherh_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
	cmd->supported	= etherh_priv(dev)->supported;
	cmd->speed	= SPEED_10;
	ethtool_cmd_speed_set(cmd, SPEED_10);
	cmd->duplex	= DUPLEX_HALF;
	cmd->port	= dev->if_port == IF_PORT_10BASET ? PORT_TP : PORT_BNC;
	cmd->autoneg	= dev->flags & IFF_AUTOMEDIA ? AUTONEG_ENABLE : AUTONEG_DISABLE;
	cmd->autoneg	= (dev->flags & IFF_AUTOMEDIA ?
			   AUTONEG_ENABLE : AUTONEG_DISABLE);
	return 0;
}

+4 −3
Original line number Diff line number Diff line
@@ -891,15 +891,16 @@ ks8695_wan_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
			cmd->advertising |= ADVERTISED_Pause;
		cmd->autoneg = AUTONEG_ENABLE;

		cmd->speed = (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10;
		ethtool_cmd_speed_set(cmd,
				      (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10);
		cmd->duplex = (ctrl & WMC_WDS) ?
			DUPLEX_FULL : DUPLEX_HALF;
	} else {
		/* auto-negotiation is disabled */
		cmd->autoneg = AUTONEG_DISABLE;

		cmd->speed = (ctrl & WMC_WANF100) ?
			SPEED_100 : SPEED_10;
		ethtool_cmd_speed_set(cmd, ((ctrl & WMC_WANF100) ?
					    SPEED_100 : SPEED_10));
		cmd->duplex = (ctrl & WMC_WANFF) ?
			DUPLEX_FULL : DUPLEX_HALF;
	}
Loading