Skip to contentSkip to conversation

Allow setting max_bonds to zero

PATCH New Phil Oester 1 participant 1 message Feb 29, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow setting max_bonds to zero

commit fc78750341ab174a16f865625b24377670e92e50

Author: Phil Oester <[email protected]>
Date:   Fri Feb 29 13:43:34 2008 -0500

If the bonding driver is compiled into the kernel, it will create a "bond0" device by default. The patch below allows max_bonds to be set to 0 to prevent any devices from being created.

Phil

drivers/net/bonding/bond_main.c +8 -6
index 64597d8..2bef4b4 100644
@@ -4624,11 +4624,11 @@ static int bond_check_params(struct bond_params *params)
 		}
 	}
 
-	if (max_bonds < 1 || max_bonds > INT_MAX) {
+	if (max_bonds > INT_MAX) {
 		printk(KERN_WARNING DRV_NAME
-		       ": Warning: max_bonds (%d) not in range %d-%d, so it "
+		       ": Warning: max_bonds (%d) not in range 0-%d, so it "
 		       "was reset to BOND_DEFAULT_MAX_BONDS (%d)\n",
-		       max_bonds, 1, INT_MAX, BOND_DEFAULT_MAX_BONDS);
+		       max_bonds, INT_MAX, BOND_DEFAULT_MAX_BONDS);
 		max_bonds = BOND_DEFAULT_MAX_BONDS;
 	}
 
@@ -4982,9 +4982,11 @@ static int __init bonding_init(void)
 			goto err;
 	}
 
-	res = bond_create_sysfs();
-	if (res)
-		goto err;
+	if (max_bonds > 0) {
+		res = bond_create_sysfs();
+		if (res)
+			goto err;
+	}
 
 	register_netdevice_notifier(&bond_netdev_notifier);
 	register_inetaddr_notifier(&bond_inetaddr_notifier);