* [Patch] bonding: show all the link status of slaves
@ 2012-06-15 8:39 Cong Wang
2012-06-17 23:24 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2012-06-15 8:39 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Jay Vosburgh, Andy Gospodarek, Cong Wang
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>
---
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index ad284ba..3cea38d 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] bonding: show all the link status of slaves
2012-06-15 8:39 [Patch] bonding: show all the link status of slaves Cong Wang
@ 2012-06-17 23:24 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-06-17 23:24 UTC (permalink / raw)
To: amwang; +Cc: netdev, fubar, andy
From: Cong Wang <amwang@redhat.com>
Date: Fri, 15 Jun 2012 16:39:27 +0800
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-17 23:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-15 8:39 [Patch] bonding: show all the link status of slaves Cong Wang
2012-06-17 23:24 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.