Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Amerigo Wang and committed by
David S. Miller
df2bcc4a 86a2f415

+13 -2
+13 -2
drivers/net/bonding/bond_procfs.c
··· 150 150 } 151 151 } 152 152 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 + 153 165 static void bond_info_show_slave(struct seq_file *seq, 154 166 const struct slave *slave) 155 167 { 156 168 struct bonding *bond = seq->private; 157 169 158 170 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)); 161 172 if (slave->speed == SPEED_UNKNOWN) 162 173 seq_printf(seq, "Speed: %s\n", "Unknown"); 163 174 else