aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c23
-rw-r--r--drivers/net/bonding/bond_sysfs.c15
-rw-r--r--drivers/net/bonding/bonding.h9
3 files changed, 37 insertions, 10 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6482aed4bb7c..d3801a00d3d5 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4704,6 +4704,7 @@ static int bond_check_params(struct bond_params *params)
4704static struct lock_class_key bonding_netdev_xmit_lock_key; 4704static struct lock_class_key bonding_netdev_xmit_lock_key;
4705 4705
4706/* Create a new bond based on the specified name and bonding parameters. 4706/* Create a new bond based on the specified name and bonding parameters.
4707 * If name is NULL, obtain a suitable "bond%d" name for us.
4707 * Caller must NOT hold rtnl_lock; we need to release it here before we 4708 * Caller must NOT hold rtnl_lock; we need to release it here before we
4708 * set up our sysfs entries. 4709 * set up our sysfs entries.
4709 */ 4710 */
@@ -4713,7 +4714,8 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
4713 int res; 4714 int res;
4714 4715
4715 rtnl_lock(); 4716 rtnl_lock();
4716 bond_dev = alloc_netdev(sizeof(struct bonding), name, ether_setup); 4717 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
4718 ether_setup);
4717 if (!bond_dev) { 4719 if (!bond_dev) {
4718 printk(KERN_ERR DRV_NAME 4720 printk(KERN_ERR DRV_NAME
4719 ": %s: eek! can't alloc netdev!\n", 4721 ": %s: eek! can't alloc netdev!\n",
@@ -4722,6 +4724,12 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
4722 goto out_rtnl; 4724 goto out_rtnl;
4723 } 4725 }
4724 4726
4727 if (!name) {
4728 res = dev_alloc_name(bond_dev, "bond%d");
4729 if (res < 0)
4730 goto out_netdev;
4731 }
4732
4725 /* bond_init() must be called after dev_alloc_name() (for the 4733 /* bond_init() must be called after dev_alloc_name() (for the
4726 * /proc files), but before register_netdevice(), because we 4734 * /proc files), but before register_netdevice(), because we
4727 * need to set function pointers. 4735 * need to set function pointers.
@@ -4748,14 +4756,19 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
4748 4756
4749 rtnl_unlock(); /* allows sysfs registration of net device */ 4757 rtnl_unlock(); /* allows sysfs registration of net device */
4750 res = bond_create_sysfs_entry(bond_dev->priv); 4758 res = bond_create_sysfs_entry(bond_dev->priv);
4751 goto done; 4759 if (res < 0) {
4760 rtnl_lock();
4761 goto out_bond;
4762 }
4763
4764 return 0;
4765
4752out_bond: 4766out_bond:
4753 bond_deinit(bond_dev); 4767 bond_deinit(bond_dev);
4754out_netdev: 4768out_netdev:
4755 free_netdev(bond_dev); 4769 free_netdev(bond_dev);
4756out_rtnl: 4770out_rtnl:
4757 rtnl_unlock(); 4771 rtnl_unlock();
4758done:
4759 return res; 4772 return res;
4760} 4773}
4761 4774
@@ -4763,7 +4776,6 @@ static int __init bonding_init(void)
4763{ 4776{
4764 int i; 4777 int i;
4765 int res; 4778 int res;
4766 char new_bond_name[8]; /* Enough room for 999 bonds at init. */
4767 4779
4768 printk(KERN_INFO "%s", version); 4780 printk(KERN_INFO "%s", version);
4769 4781
@@ -4776,8 +4788,7 @@ static int __init bonding_init(void)
4776 bond_create_proc_dir(); 4788 bond_create_proc_dir();
4777#endif 4789#endif
4778 for (i = 0; i < max_bonds; i++) { 4790 for (i = 0; i < max_bonds; i++) {
4779 sprintf(new_bond_name, "bond%d",i); 4791 res = bond_create(NULL, &bonding_defaults, NULL);
4780 res = bond_create(new_bond_name,&bonding_defaults, NULL);
4781 if (res) 4792 if (res)
4782 goto err; 4793 goto err;
4783 } 4794 }
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 0e610aa1fdf9..878f7aabeeac 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1433,6 +1433,21 @@ int bond_create_sysfs(void)
1433 return -ENODEV; 1433 return -ENODEV;
1434 1434
1435 ret = class_create_file(netdev_class, &class_attr_bonding_masters); 1435 ret = class_create_file(netdev_class, &class_attr_bonding_masters);
1436 /*
1437 * Permit multiple loads of the module by ignoring failures to
1438 * create the bonding_masters sysfs file. Bonding devices
1439 * created by second or subsequent loads of the module will
1440 * not be listed in, or controllable by, bonding_masters, but
1441 * will have the usual "bonding" sysfs directory.
1442 *
1443 * This is done to preserve backwards compatibility for
1444 * initscripts/sysconfig, which load bonding multiple times to
1445 * configure multiple bonding devices.
1446 */
1447 if (ret == -EEXIST) {
1448 netdev_class = NULL;
1449 return 0;
1450 }
1436 1451
1437 return ret; 1452 return ret;
1438 1453
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 0978c9ac6d2b..41aa78bf1f78 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -22,8 +22,8 @@
22#include "bond_3ad.h" 22#include "bond_3ad.h"
23#include "bond_alb.h" 23#include "bond_alb.h"
24 24
25#define DRV_VERSION "3.1.1" 25#define DRV_VERSION "3.1.2"
26#define DRV_RELDATE "September 26, 2006" 26#define DRV_RELDATE "January 20, 2007"
27#define DRV_NAME "bonding" 27#define DRV_NAME "bonding"
28#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" 28#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
29 29
@@ -237,12 +237,13 @@ static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
237#define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ 237#define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \
238 BOND_ARP_VALIDATE_BACKUP) 238 BOND_ARP_VALIDATE_BACKUP)
239 239
240extern inline int slave_do_arp_validate(struct bonding *bond, struct slave *slave) 240static inline int slave_do_arp_validate(struct bonding *bond,
241 struct slave *slave)
241{ 242{
242 return bond->params.arp_validate & (1 << slave->state); 243 return bond->params.arp_validate & (1 << slave->state);
243} 244}
244 245
245extern inline unsigned long slave_last_rx(struct bonding *bond, 246static inline unsigned long slave_last_rx(struct bonding *bond,
246 struct slave *slave) 247 struct slave *slave)
247{ 248{
248 if (slave_do_arp_validate(bond, slave)) 249 if (slave_do_arp_validate(bond, slave))