aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@redhat.com>2013-09-25 03:20:32 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-26 16:02:08 -0400
commit5831d66e8097aedfa3bc35941cf265ada2352317 (patch)
treedc71bea5d018fdcc1f68af27ea8af52be02628e5 /drivers/net/bonding
parent842d67a7b34ea735155812ecf0671a481284f358 (diff)
net: create sysfs symlinks for neighbour devices
Also, remove the same functionality from bonding - it will be already done for any device that links to its lower/upper neighbour. The links will be created for dev's kobject, and will look like lower_eth0 for lower device eth0 and upper_bridge0 for upper device bridge0. CC: Jay Vosburgh <fubar@us.ibm.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: "David S. Miller" <davem@davemloft.net> CC: Eric Dumazet <edumazet@google.com> CC: Jiri Pirko <jiri@resnulli.us> CC: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c11
-rw-r--r--drivers/net/bonding/bond_sysfs.c21
-rw-r--r--drivers/net/bonding/bonding.h2
3 files changed, 1 insertions, 33 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index d49404509814..d5c3153226b7 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1612,15 +1612,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1612 1612
1613 read_unlock(&bond->lock); 1613 read_unlock(&bond->lock);
1614 1614
1615 res = bond_create_slave_symlinks(bond_dev, slave_dev);
1616 if (res)
1617 goto err_detach;
1618
1619 res = netdev_rx_handler_register(slave_dev, bond_handle_frame, 1615 res = netdev_rx_handler_register(slave_dev, bond_handle_frame,
1620 new_slave); 1616 new_slave);
1621 if (res) { 1617 if (res) {
1622 pr_debug("Error %d calling netdev_rx_handler_register\n", res); 1618 pr_debug("Error %d calling netdev_rx_handler_register\n", res);
1623 goto err_dest_symlinks; 1619 goto err_detach;
1624 } 1620 }
1625 1621
1626 res = bond_master_upper_dev_link(bond_dev, slave_dev, new_slave); 1622 res = bond_master_upper_dev_link(bond_dev, slave_dev, new_slave);
@@ -1642,9 +1638,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1642err_unregister: 1638err_unregister:
1643 netdev_rx_handler_unregister(slave_dev); 1639 netdev_rx_handler_unregister(slave_dev);
1644 1640
1645err_dest_symlinks:
1646 bond_destroy_slave_symlinks(bond_dev, slave_dev);
1647
1648err_detach: 1641err_detach:
1649 if (!USES_PRIMARY(bond->params.mode)) 1642 if (!USES_PRIMARY(bond->params.mode))
1650 bond_hw_addr_flush(bond_dev, slave_dev); 1643 bond_hw_addr_flush(bond_dev, slave_dev);
@@ -1842,8 +1835,6 @@ static int __bond_release_one(struct net_device *bond_dev,
1842 bond_dev->name, slave_dev->name, bond_dev->name); 1835 bond_dev->name, slave_dev->name, bond_dev->name);
1843 1836
1844 /* must do this from outside any spinlocks */ 1837 /* must do this from outside any spinlocks */
1845 bond_destroy_slave_symlinks(bond_dev, slave_dev);
1846
1847 vlan_vids_del_by_dev(slave_dev, bond_dev); 1838 vlan_vids_del_by_dev(slave_dev, bond_dev);
1848 1839
1849 /* If the mode USES_PRIMARY, then this cases was handled above by 1840 /* If the mode USES_PRIMARY, then this cases was handled above by
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 1c5724672204..e06c644470b1 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -168,27 +168,6 @@ static const struct class_attribute class_attr_bonding_masters = {
168 .namespace = bonding_namespace, 168 .namespace = bonding_namespace,
169}; 169};
170 170
171int bond_create_slave_symlinks(struct net_device *master,
172 struct net_device *slave)
173{
174 char linkname[IFNAMSIZ+7];
175
176 /* create a link from the master to the slave */
177 sprintf(linkname, "slave_%s", slave->name);
178 return sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj),
179 linkname);
180}
181
182void bond_destroy_slave_symlinks(struct net_device *master,
183 struct net_device *slave)
184{
185 char linkname[IFNAMSIZ+7];
186
187 sprintf(linkname, "slave_%s", slave->name);
188 sysfs_remove_link(&(master->dev.kobj), linkname);
189}
190
191
192/* 171/*
193 * Show the slaves in the current bond. 172 * Show the slaves in the current bond.
194 */ 173 */
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index e5c32a61dacc..5b71601666cd 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -436,8 +436,6 @@ int bond_create(struct net *net, const char *name);
436int bond_create_sysfs(struct bond_net *net); 436int bond_create_sysfs(struct bond_net *net);
437void bond_destroy_sysfs(struct bond_net *net); 437void bond_destroy_sysfs(struct bond_net *net);
438void bond_prepare_sysfs_group(struct bonding *bond); 438void bond_prepare_sysfs_group(struct bonding *bond);
439int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave);
440void bond_destroy_slave_symlinks(struct net_device *master, struct net_device *slave);
441int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); 439int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
442int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); 440int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
443void bond_mii_monitor(struct work_struct *); 441void bond_mii_monitor(struct work_struct *);