diff options
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index e400d7dfdfc8..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; | |||
48 | extern struct bond_params bonding_defaults; | 48 | extern struct bond_params bonding_defaults; |
49 | extern struct bond_parm_tbl bond_mode_tbl[]; | 49 | extern struct bond_parm_tbl bond_mode_tbl[]; |
50 | extern struct bond_parm_tbl bond_lacp_tbl[]; | 50 | extern struct bond_parm_tbl bond_lacp_tbl[]; |
51 | extern struct bond_parm_tbl ad_select_tbl[]; | ||
51 | extern struct bond_parm_tbl xmit_hashtype_tbl[]; | 52 | extern struct bond_parm_tbl xmit_hashtype_tbl[]; |
52 | extern struct bond_parm_tbl arp_validate_tbl[]; | 53 | extern struct bond_parm_tbl arp_validate_tbl[]; |
53 | extern struct bond_parm_tbl fail_over_mac_tbl[]; | 54 | extern struct bond_parm_tbl fail_over_mac_tbl[]; |
@@ -944,6 +945,53 @@ out: | |||
944 | } | 945 | } |
945 | static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, bonding_show_lacp, bonding_store_lacp); | 946 | static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, bonding_show_lacp, bonding_store_lacp); |
946 | 947 | ||
948 | static 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 | |||
960 | static 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 | } | ||
989 | out: | ||
990 | return ret; | ||
991 | } | ||
992 | |||
993 | static 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 | */ |
@@ -983,6 +1031,47 @@ out: | |||
983 | return ret; | 1031 | return ret; |
984 | } | 1032 | } |
985 | static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR, bonding_show_n_grat_arp, bonding_store_n_grat_arp); | 1033 | static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR, bonding_show_n_grat_arp, bonding_store_n_grat_arp); |
1034 | |||
1035 | /* | ||
1036 | * Show and set the number of unsolicted NA's to send after a failover event. | ||
1037 | */ | ||
1038 | static ssize_t bonding_show_n_unsol_na(struct device *d, | ||
1039 | struct device_attribute *attr, | ||
1040 | char *buf) | ||
1041 | { | ||
1042 | struct bonding *bond = to_bond(d); | ||
1043 | |||
1044 | return sprintf(buf, "%d\n", bond->params.num_unsol_na); | ||
1045 | } | ||
1046 | |||
1047 | static ssize_t bonding_store_n_unsol_na(struct device *d, | ||
1048 | struct device_attribute *attr, | ||
1049 | const char *buf, size_t count) | ||
1050 | { | ||
1051 | int new_value, ret = count; | ||
1052 | struct bonding *bond = to_bond(d); | ||
1053 | |||
1054 | if (sscanf(buf, "%d", &new_value) != 1) { | ||
1055 | printk(KERN_ERR DRV_NAME | ||
1056 | ": %s: no num_unsol_na value specified.\n", | ||
1057 | bond->dev->name); | ||
1058 | ret = -EINVAL; | ||
1059 | goto out; | ||
1060 | } | ||
1061 | if (new_value < 0 || new_value > 255) { | ||
1062 | printk(KERN_ERR DRV_NAME | ||
1063 | ": %s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n", | ||
1064 | bond->dev->name, new_value); | ||
1065 | ret = -EINVAL; | ||
1066 | goto out; | ||
1067 | } else { | ||
1068 | bond->params.num_unsol_na = new_value; | ||
1069 | } | ||
1070 | out: | ||
1071 | return ret; | ||
1072 | } | ||
1073 | static DEVICE_ATTR(num_unsol_na, S_IRUGO | S_IWUSR, bonding_show_n_unsol_na, bonding_store_n_unsol_na); | ||
1074 | |||
986 | /* | 1075 | /* |
987 | * Show and set the MII monitor interval. There are two tricky bits | 1076 | * Show and set the MII monitor interval. There are two tricky bits |
988 | * here. First, if MII monitoring is activated, then we must disable | 1077 | * here. First, if MII monitoring is activated, then we must disable |
@@ -1418,8 +1507,10 @@ static struct attribute *per_bond_attrs[] = { | |||
1418 | &dev_attr_downdelay.attr, | 1507 | &dev_attr_downdelay.attr, |
1419 | &dev_attr_updelay.attr, | 1508 | &dev_attr_updelay.attr, |
1420 | &dev_attr_lacp_rate.attr, | 1509 | &dev_attr_lacp_rate.attr, |
1510 | &dev_attr_ad_select.attr, | ||
1421 | &dev_attr_xmit_hash_policy.attr, | 1511 | &dev_attr_xmit_hash_policy.attr, |
1422 | &dev_attr_num_grat_arp.attr, | 1512 | &dev_attr_num_grat_arp.attr, |
1513 | &dev_attr_num_unsol_na.attr, | ||
1423 | &dev_attr_miimon.attr, | 1514 | &dev_attr_miimon.attr, |
1424 | &dev_attr_primary.attr, | 1515 | &dev_attr_primary.attr, |
1425 | &dev_attr_use_carrier.attr, | 1516 | &dev_attr_use_carrier.attr, |