lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 6 Mar 2015 08:16:17 +0100
From:	Jiri Pirko <jiri@...nulli.us>
To:	Sridhar Samudrala <sridhar.samudrala@...el.com>
Cc:	davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH] team: add support to get speed via ethtool

Thu, Mar 05, 2015 at 10:48:35PM CET, sridhar.samudrala@...el.com wrote:
>With this patch ethtool <team> OR cat /sys/class/net/<team>/speed
>returns the speed of team based on member ports speed and state.
>
>Based on get speed support in bonding driver.
>
>Signed-off-by: Sridhar Samudrala <sridhar.samudrala@...el.com>
>---
> drivers/net/team/team.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index 9d3366f..e822803 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -1954,6 +1954,30 @@ static int team_change_carrier(struct net_device *dev, bool new_carrier)
> 	return 0;
> }
> 
>+static int team_ethtool_get_settings(struct net_device *dev,
>+				     struct ethtool_cmd *ecmd)
>+{
>+	struct team *team = netdev_priv(dev);
>+	struct team_port *port;
>+	unsigned long speed = 0;
>+
>+	ecmd->duplex = DUPLEX_UNKNOWN;
>+	ecmd->port = PORT_OTHER;
>+
>+	mutex_lock(&team->lock);
>+	list_for_each_entry(port, &team->port_list, list) {
>+		if (port->linkup)
>+			speed += port->state.speed;
>+		if (ecmd->duplex == DUPLEX_UNKNOWN &&
>+		    port->state.duplex != 0)
>+			ecmd->duplex = port->state.duplex;
>+	}
>+	ethtool_cmd_speed_set(ecmd, speed);
>+	mutex_unlock(&team->lock);
>+
>+	return 0;
>+}

Sridar, what exactly you are trying to achieve? I agree with DaveM that
this make no sense for soft devices. The fact bonding has it is a
mistake.


>+
> static const struct net_device_ops team_netdev_ops = {
> 	.ndo_init		= team_init,
> 	.ndo_uninit		= team_uninit,
>@@ -1995,6 +2019,7 @@ static void team_ethtool_get_drvinfo(struct net_device *dev,
> static const struct ethtool_ops team_ethtool_ops = {
> 	.get_drvinfo		= team_ethtool_get_drvinfo,
> 	.get_link		= ethtool_op_get_link,
>+	.get_settings		= team_ethtool_get_settings,
> };
> 
> /***********************
>-- 
>1.8.4.2
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ