aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_sysfs.c
diff options
context:
space:
mode:
authorJay Vosburgh <fubar@us.ibm.com>2008-11-04 20:51:16 -0500
committerJeff Garzik <jgarzik@redhat.com>2008-11-06 00:49:47 -0500
commitfd989c83325cb34795bc4d4aa6b13c06f90eac99 (patch)
treeba6a0589847a45cd558cf2273dae423a4ab78dcc /drivers/net/bonding/bond_sysfs.c
parent6146b1a4da98377e4abddc91ba5856bef8f23f1e (diff)
bonding: alternate agg selection policies for 802.3ad
This patch implements alternative aggregator selection policies for 802.3ad. The existing policy, now termed "stable," selects the active aggregator by greatest bandwidth, and only reselects a new aggregator if the active aggregator is entirely disabled (no more ports or all ports down). This patch adds two new policies: bandwidth and count, selecting the active aggregator by total bandwidth (like the stable policy) or by the number of ports in the aggregator, respectively. These two policies also differ from the stable policy in that they will reselect the active aggregator when availability-related changes occur in the bond (e.g., link state change). This permits "gang failover" within 802.3ad, allowing redundant aggregators along parallel paths to always maintain the "best" aggregator as the active aggregator (rather than having to wait for the active to entirely fail). This patch also updates the driver version to 3.5.0. Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r--drivers/net/bonding/bond_sysfs.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 8788e3e33852..aaf2927b5c38 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -48,6 +48,7 @@ extern struct list_head bond_dev_list;
48extern struct bond_params bonding_defaults; 48extern struct bond_params bonding_defaults;
49extern struct bond_parm_tbl bond_mode_tbl[]; 49extern struct bond_parm_tbl bond_mode_tbl[];
50extern struct bond_parm_tbl bond_lacp_tbl[]; 50extern struct bond_parm_tbl bond_lacp_tbl[];
51extern struct bond_parm_tbl ad_select_tbl[];
51extern struct bond_parm_tbl xmit_hashtype_tbl[]; 52extern struct bond_parm_tbl xmit_hashtype_tbl[];
52extern struct bond_parm_tbl arp_validate_tbl[]; 53extern struct bond_parm_tbl arp_validate_tbl[];
53extern struct bond_parm_tbl fail_over_mac_tbl[]; 54extern struct bond_parm_tbl fail_over_mac_tbl[];
@@ -944,6 +945,53 @@ out:
944} 945}
945static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, bonding_show_lacp, bonding_store_lacp); 946static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, bonding_show_lacp, bonding_store_lacp);
946 947
948static ssize_t bonding_show_ad_select(struct device *d,
949 struct device_attribute *attr,
950 char *buf)
951{
952 struct bonding *bond = to_bond(d);
953
954 return sprintf(buf, "%s %d\n",
955 ad_select_tbl[bond->params.ad_select].modename,
956 bond->params.ad_select);
957}
958
959
960static ssize_t bonding_store_ad_select(struct device *d,
961 struct device_attribute *attr,
962 const char *buf, size_t count)
963{
964 int new_value, ret = count;
965 struct bonding *bond = to_bond(d);
966
967 if (bond->dev->flags & IFF_UP) {
968 printk(KERN_ERR DRV_NAME
969 ": %s: Unable to update ad_select because interface "
970 "is up.\n", bond->dev->name);
971 ret = -EPERM;
972 goto out;
973 }
974
975 new_value = bond_parse_parm(buf, ad_select_tbl);
976
977 if (new_value != -1) {
978 bond->params.ad_select = new_value;
979 printk(KERN_INFO DRV_NAME
980 ": %s: Setting ad_select to %s (%d).\n",
981 bond->dev->name, ad_select_tbl[new_value].modename,
982 new_value);
983 } else {
984 printk(KERN_ERR DRV_NAME
985 ": %s: Ignoring invalid ad_select value %.*s.\n",
986 bond->dev->name, (int)strlen(buf) - 1, buf);
987 ret = -EINVAL;
988 }
989out:
990 return ret;
991}
992
993static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR, bonding_show_ad_select, bonding_store_ad_select);
994
947/* 995/*
948 * Show and set the number of grat ARP to send after a failover event. 996 * Show and set the number of grat ARP to send after a failover event.
949 */ 997 */
@@ -1459,6 +1507,7 @@ static struct attribute *per_bond_attrs[] = {
1459 &dev_attr_downdelay.attr, 1507 &dev_attr_downdelay.attr,
1460 &dev_attr_updelay.attr, 1508 &dev_attr_updelay.attr,
1461 &dev_attr_lacp_rate.attr, 1509 &dev_attr_lacp_rate.attr,
1510 &dev_attr_ad_select.attr,
1462 &dev_attr_xmit_hash_policy.attr, 1511 &dev_attr_xmit_hash_policy.attr,
1463 &dev_attr_num_grat_arp.attr, 1512 &dev_attr_num_grat_arp.attr,
1464 &dev_attr_num_unsol_na.attr, 1513 &dev_attr_num_unsol_na.attr,