aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_procfs.c
diff options
context:
space:
mode:
authorAmerigo Wang <amwang@redhat.com>2012-06-14 22:39:27 +0000
committerDavid S. Miller <davem@davemloft.net>2012-06-17 16:23:54 -0700
commitdf2bcc4af2616b18efeaa3d044fe15ce891c5d21 (patch)
tree259e98cfa15e68a3bdf9b03e06b97214577a1c83 /drivers/net/bonding/bond_procfs.c
parentusbnet: sanitise overlong driver information strings (diff)
downloadlinux-dev-df2bcc4af2616b18efeaa3d044fe15ce891c5d21.tar.xz
linux-dev-df2bcc4af2616b18efeaa3d044fe15ce891c5d21.zip
bonding: show all the link status of slaves
There are four link statuses of a bonding slave, the procfs code shows a wrong status when using downdelay/updelay: (slave->link == BOND_LINK_UP) ? "up" : "down" It doesn't respect the rest two statuses. This patch fixes it. Cc: Jay Vosburgh <fubar@us.ibm.com> Cc: Andy Gospodarek <andy@greyhouse.net> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_procfs.c')
-rw-r--r--drivers/net/bonding/bond_procfs.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index ad284baafe87..3cea38d37344 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -150,14 +150,25 @@ static void bond_info_show_master(struct seq_file *seq)
}
}
+static const char *bond_slave_link_status(s8 link)
+{
+ static const char * const status[] = {
+ [BOND_LINK_UP] = "up",
+ [BOND_LINK_FAIL] = "going down",
+ [BOND_LINK_DOWN] = "down",
+ [BOND_LINK_BACK] = "going back",
+ };
+
+ return status[link];
+}
+
static void bond_info_show_slave(struct seq_file *seq,
const struct slave *slave)
{
struct bonding *bond = seq->private;
seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name);
- seq_printf(seq, "MII Status: %s\n",
- (slave->link == BOND_LINK_UP) ? "up" : "down");
+ seq_printf(seq, "MII Status: %s\n", bond_slave_link_status(slave->link));
if (slave->speed == SPEED_UNKNOWN)
seq_printf(seq, "Speed: %s\n", "Unknown");
else