summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHangbin Liu <liuhangbin@gmail.com>2019-06-17 04:32:55 +0300
committerDavid S. Miller <davem@davemloft.net>2019-06-17 23:23:12 +0300
commit9ed68ca0d90b53ba00745cb61ef105599532226f (patch)
tree43d518aa152ee93318f4d146523bb2c9b79a0fc2
parentf464100f576610aa4702dd9e168c80d6c661958a (diff)
downloadlinux-9ed68ca0d90b53ba00745cb61ef105599532226f.tar.xz
team: add ethtool get_link_ksettings
Like bond, add ethtool get_link_ksettings to show the total speed. v2: no update, just repost. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/team/team.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index b48006e7fa2f..f3422f85f604 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -2054,9 +2054,34 @@ static void team_ethtool_get_drvinfo(struct net_device *dev,
strlcpy(drvinfo->version, UTS_RELEASE, sizeof(drvinfo->version));
}
+static int team_ethtool_get_link_ksettings(struct net_device *dev,
+ struct ethtool_link_ksettings *cmd)
+{
+ struct team *team= netdev_priv(dev);
+ unsigned long speed = 0;
+ struct team_port *port;
+
+ cmd->base.duplex = DUPLEX_UNKNOWN;
+ cmd->base.port = PORT_OTHER;
+
+ list_for_each_entry(port, &team->port_list, list) {
+ if (team_port_txable(port)) {
+ if (port->state.speed != SPEED_UNKNOWN)
+ speed += port->state.speed;
+ if (cmd->base.duplex == DUPLEX_UNKNOWN &&
+ port->state.duplex != DUPLEX_UNKNOWN)
+ cmd->base.duplex = port->state.duplex;
+ }
+ }
+ cmd->base.speed = speed ? : SPEED_UNKNOWN;
+
+ return 0;
+}
+
static const struct ethtool_ops team_ethtool_ops = {
.get_drvinfo = team_ethtool_get_drvinfo,
.get_link = ethtool_op_get_link,
+ .get_link_ksettings = team_ethtool_get_link_ksettings,
};
/***********************