Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273511
b: refs/heads/master
c: 98f41f6
h: refs/heads/master
i:
  273509: d903adf
  273507: 120681c
  273503: 53deb99
v: v3
  • Loading branch information
Weiping Pan authored and David S. Miller committed Nov 1, 2011
1 parent df05506 commit d6e0636
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: deede2fabe24e00bd7e246eb81cd5767dc6fcfc7
refs/heads/master: 98f41f694f46085fda475cdee8cc0b6d2c5e6f1f
37 changes: 12 additions & 25 deletions trunk/drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ static int bond_set_carrier(struct bonding *bond)
/*
* Get link speed and duplex from the slave's base driver
* using ethtool. If for some reason the call fails or the
* values are invalid, fake speed and duplex to 100/Full
* values are invalid, set speed and duplex to -1,
* and return error.
*/
static int bond_update_speed_duplex(struct slave *slave)
Expand All @@ -560,9 +560,8 @@ static int bond_update_speed_duplex(struct slave *slave)
u32 slave_speed;
int res;

/* Fake speed and duplex */
slave->speed = SPEED_100;
slave->duplex = DUPLEX_FULL;
slave->speed = -1;
slave->duplex = -1;

res = __ethtool_get_settings(slave_dev, &ecmd);
if (res < 0)
Expand Down Expand Up @@ -1751,16 +1750,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
new_slave->link = BOND_LINK_DOWN;
}

if (bond_update_speed_duplex(new_slave) &&
(new_slave->link != BOND_LINK_DOWN)) {
pr_warning("%s: Warning: failed to get speed and duplex from %s, assumed to be 100Mb/sec and Full.\n",
bond_dev->name, new_slave->dev->name);

if (bond->params.mode == BOND_MODE_8023AD) {
pr_warning("%s: Warning: Operation of 802.3ad mode requires ETHTOOL support in base driver for proper aggregator selection.\n",
bond_dev->name);
}
}
bond_update_speed_duplex(new_slave);

if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) {
/* if there is a primary slave, remember it */
Expand Down Expand Up @@ -3220,6 +3210,7 @@ static int bond_slave_netdev_event(unsigned long event,
{
struct net_device *bond_dev = slave_dev->master;
struct bonding *bond = netdev_priv(bond_dev);
struct slave *slave = NULL;

switch (event) {
case NETDEV_UNREGISTER:
Expand All @@ -3230,20 +3221,16 @@ static int bond_slave_netdev_event(unsigned long event,
bond_release(bond_dev, slave_dev);
}
break;
case NETDEV_UP:
case NETDEV_CHANGE:
if (bond->params.mode == BOND_MODE_8023AD || bond_is_lb(bond)) {
struct slave *slave;
slave = bond_get_slave_by_dev(bond, slave_dev);
if (slave) {
u32 old_speed = slave->speed;
u8 old_duplex = slave->duplex;

slave = bond_get_slave_by_dev(bond, slave_dev);
if (slave) {
u32 old_speed = slave->speed;
u8 old_duplex = slave->duplex;

bond_update_speed_duplex(slave);

if (bond_is_lb(bond))
break;
bond_update_speed_duplex(slave);

if (bond->params.mode == BOND_MODE_8023AD) {
if (old_speed != slave->speed)
bond_3ad_adapter_speed_changed(slave);
if (old_duplex != slave->duplex)
Expand Down
12 changes: 10 additions & 2 deletions trunk/drivers/net/bonding/bond_procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,16 @@ static void bond_info_show_slave(struct seq_file *seq,
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, "Speed: %d Mbps\n", slave->speed);
seq_printf(seq, "Duplex: %s\n", slave->duplex ? "full" : "half");
if (slave->speed == -1)
seq_printf(seq, "Speed: %s\n", "Unknown");
else
seq_printf(seq, "Speed: %d Mbps\n", slave->speed);

if (slave->duplex == -1)
seq_printf(seq, "Duplex: %s\n", "Unknown");
else
seq_printf(seq, "Duplex: %s\n", slave->duplex ? "full" : "half");

seq_printf(seq, "Link Failure Count: %u\n",
slave->link_failure_count);

Expand Down

0 comments on commit d6e0636

Please sign in to comment.