aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f00dd45b0308..df85cec3e5d9 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -466,6 +466,22 @@ static void bond_update_speed_duplex(struct slave *slave)
466 return; 466 return;
467} 467}
468 468
469const char *bond_slave_link_status(s8 link)
470{
471 switch (link) {
472 case BOND_LINK_UP:
473 return "up";
474 case BOND_LINK_FAIL:
475 return "going down";
476 case BOND_LINK_DOWN:
477 return "down";
478 case BOND_LINK_BACK:
479 return "going back";
480 default:
481 return "unknown";
482 }
483}
484
469/* 485/*
470 * if <dev> supports MII link status reporting, check its link status. 486 * if <dev> supports MII link status reporting, check its link status.
471 * 487 *
@@ -1576,6 +1592,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1576 goto err_unregister; 1592 goto err_unregister;
1577 } 1593 }
1578 1594
1595 res = bond_sysfs_slave_add(new_slave);
1596 if (res) {
1597 pr_debug("Error %d calling bond_sysfs_slave_add\n", res);
1598 goto err_upper_unlink;
1599 }
1600
1579 bond->slave_cnt++; 1601 bond->slave_cnt++;
1580 bond_compute_features(bond); 1602 bond_compute_features(bond);
1581 bond_set_carrier(bond); 1603 bond_set_carrier(bond);
@@ -1595,6 +1617,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1595 return 0; 1617 return 0;
1596 1618
1597/* Undo stages on error */ 1619/* Undo stages on error */
1620err_upper_unlink:
1621 bond_upper_dev_unlink(bond_dev, slave_dev);
1622
1598err_unregister: 1623err_unregister:
1599 netdev_rx_handler_unregister(slave_dev); 1624 netdev_rx_handler_unregister(slave_dev);
1600 1625
@@ -1687,6 +1712,8 @@ static int __bond_release_one(struct net_device *bond_dev,
1687 /* release the slave from its bond */ 1712 /* release the slave from its bond */
1688 bond->slave_cnt--; 1713 bond->slave_cnt--;
1689 1714
1715 bond_sysfs_slave_del(slave);
1716
1690 bond_upper_dev_unlink(bond_dev, slave_dev); 1717 bond_upper_dev_unlink(bond_dev, slave_dev);
1691 /* unregister rx_handler early so bond_handle_frame wouldn't be called 1718 /* unregister rx_handler early so bond_handle_frame wouldn't be called
1692 * for this slave anymore. 1719 * for this slave anymore.