Skip to content

Commit df2bcc4

Browse files
Amerigo Wangdavem330
authored andcommitted
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>
1 parent 86a2f41 commit df2bcc4

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎drivers/net/bonding/bond_procfs.c‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,25 @@ static void bond_info_show_master(struct seq_file *seq)
150150
}
151151
}
152152

153+
static const char *bond_slave_link_status(s8 link)
154+
{
155+
static const char * const status[] = {
156+
[BOND_LINK_UP] = "up",
157+
[BOND_LINK_FAIL] = "going down",
158+
[BOND_LINK_DOWN] = "down",
159+
[BOND_LINK_BACK] = "going back",
160+
};
161+
162+
return status[link];
163+
}
164+
153165
static void bond_info_show_slave(struct seq_file *seq,
154166
const struct slave *slave)
155167
{
156168
struct bonding *bond = seq->private;
157169

158170
seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name);
159-
seq_printf(seq, "MII Status: %s\n",
160-
(slave->link == BOND_LINK_UP) ? "up" : "down");
171+
seq_printf(seq, "MII Status: %s\n", bond_slave_link_status(slave->link));
161172
if (slave->speed == SPEED_UNKNOWN)
162173
seq_printf(seq, "Speed: %s\n", "Unknown");
163174
else

0 commit comments

Comments
 (0)