diff options
-rw-r--r-- | drivers/net/bonding/bond_3ad.c | 13 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 5 | ||||
-rw-r--r-- | drivers/net/bonding/bond_procfs.c | 1 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 33 | ||||
-rw-r--r-- | drivers/net/bonding/bonding.h | 1 |
5 files changed, 51 insertions, 2 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 77da2e849623..a047eb973e3b 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2342,8 +2342,17 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) | |||
2342 | */ | 2342 | */ |
2343 | int bond_3ad_set_carrier(struct bonding *bond) | 2343 | int bond_3ad_set_carrier(struct bonding *bond) |
2344 | { | 2344 | { |
2345 | if (__get_active_agg(&(SLAVE_AD_INFO(bond->first_slave).aggregator))) { | 2345 | struct aggregator *active; |
2346 | if (!netif_carrier_ok(bond->dev)) { | 2346 | |
2347 | active = __get_active_agg(&(SLAVE_AD_INFO(bond->first_slave).aggregator)); | ||
2348 | if (active) { | ||
2349 | /* are enough slaves available to consider link up? */ | ||
2350 | if (active->num_of_ports < bond->params.min_links) { | ||
2351 | if (netif_carrier_ok(bond->dev)) { | ||
2352 | netif_carrier_off(bond->dev); | ||
2353 | return 1; | ||
2354 | } | ||
2355 | } else if (!netif_carrier_ok(bond->dev)) { | ||
2347 | netif_carrier_on(bond->dev); | 2356 | netif_carrier_on(bond->dev); |
2348 | return 1; | 2357 | return 1; |
2349 | } | 2358 | } |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index ebb1d219b45c..61265f74ed3d 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -98,6 +98,7 @@ static char *mode; | |||
98 | static char *primary; | 98 | static char *primary; |
99 | static char *primary_reselect; | 99 | static char *primary_reselect; |
100 | static char *lacp_rate; | 100 | static char *lacp_rate; |
101 | static int min_links; | ||
101 | static char *ad_select; | 102 | static char *ad_select; |
102 | static char *xmit_hash_policy; | 103 | static char *xmit_hash_policy; |
103 | static int arp_interval = BOND_LINK_ARP_INTERV; | 104 | static int arp_interval = BOND_LINK_ARP_INTERV; |
@@ -150,6 +151,9 @@ module_param(ad_select, charp, 0); | |||
150 | MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic; " | 151 | MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic; " |
151 | "0 for stable (default), 1 for bandwidth, " | 152 | "0 for stable (default), 1 for bandwidth, " |
152 | "2 for count"); | 153 | "2 for count"); |
154 | module_param(min_links, int, 0); | ||
155 | MODULE_PARM_DESC(min_links, "Minimum number of available links before turning on carrier"); | ||
156 | |||
153 | module_param(xmit_hash_policy, charp, 0); | 157 | module_param(xmit_hash_policy, charp, 0); |
154 | MODULE_PARM_DESC(xmit_hash_policy, "balance-xor and 802.3ad hashing method; " | 158 | MODULE_PARM_DESC(xmit_hash_policy, "balance-xor and 802.3ad hashing method; " |
155 | "0 for layer 2 (default), 1 for layer 3+4, " | 159 | "0 for layer 2 (default), 1 for layer 3+4, " |
@@ -4798,6 +4802,7 @@ static int bond_check_params(struct bond_params *params) | |||
4798 | params->tx_queues = tx_queues; | 4802 | params->tx_queues = tx_queues; |
4799 | params->all_slaves_active = all_slaves_active; | 4803 | params->all_slaves_active = all_slaves_active; |
4800 | params->resend_igmp = resend_igmp; | 4804 | params->resend_igmp = resend_igmp; |
4805 | params->min_links = min_links; | ||
4801 | 4806 | ||
4802 | if (primary) { | 4807 | if (primary) { |
4803 | strncpy(params->primary, primary, IFNAMSIZ); | 4808 | strncpy(params->primary, primary, IFNAMSIZ); |
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index c97307ddd1c9..95de93b90386 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
@@ -125,6 +125,7 @@ static void bond_info_show_master(struct seq_file *seq) | |||
125 | seq_puts(seq, "\n802.3ad info\n"); | 125 | seq_puts(seq, "\n802.3ad info\n"); |
126 | seq_printf(seq, "LACP rate: %s\n", | 126 | seq_printf(seq, "LACP rate: %s\n", |
127 | (bond->params.lacp_fast) ? "fast" : "slow"); | 127 | (bond->params.lacp_fast) ? "fast" : "slow"); |
128 | seq_printf(seq, "Min links: %d\n", bond->params.min_links); | ||
128 | seq_printf(seq, "Aggregator selection policy (ad_select): %s\n", | 129 | seq_printf(seq, "Aggregator selection policy (ad_select): %s\n", |
129 | ad_select_tbl[bond->params.ad_select].modename); | 130 | ad_select_tbl[bond->params.ad_select].modename); |
130 | 131 | ||
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 03d1196b844d..b60835f58650 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -819,6 +819,38 @@ out: | |||
819 | static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, | 819 | static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, |
820 | bonding_show_lacp, bonding_store_lacp); | 820 | bonding_show_lacp, bonding_store_lacp); |
821 | 821 | ||
822 | static ssize_t bonding_show_min_links(struct device *d, | ||
823 | struct device_attribute *attr, | ||
824 | char *buf) | ||
825 | { | ||
826 | struct bonding *bond = to_bond(d); | ||
827 | |||
828 | return sprintf(buf, "%d\n", bond->params.min_links); | ||
829 | } | ||
830 | |||
831 | static ssize_t bonding_store_min_links(struct device *d, | ||
832 | struct device_attribute *attr, | ||
833 | const char *buf, size_t count) | ||
834 | { | ||
835 | struct bonding *bond = to_bond(d); | ||
836 | int ret; | ||
837 | unsigned int new_value; | ||
838 | |||
839 | ret = kstrtouint(buf, 0, &new_value); | ||
840 | if (ret < 0) { | ||
841 | pr_err("%s: Ignoring invalid min links value %s.\n", | ||
842 | bond->dev->name, buf); | ||
843 | return ret; | ||
844 | } | ||
845 | |||
846 | pr_info("%s: Setting min links value to %u\n", | ||
847 | bond->dev->name, new_value); | ||
848 | bond->params.min_links = new_value; | ||
849 | return count; | ||
850 | } | ||
851 | static DEVICE_ATTR(min_links, S_IRUGO | S_IWUSR, | ||
852 | bonding_show_min_links, bonding_store_min_links); | ||
853 | |||
822 | static ssize_t bonding_show_ad_select(struct device *d, | 854 | static ssize_t bonding_show_ad_select(struct device *d, |
823 | struct device_attribute *attr, | 855 | struct device_attribute *attr, |
824 | char *buf) | 856 | char *buf) |
@@ -1601,6 +1633,7 @@ static struct attribute *per_bond_attrs[] = { | |||
1601 | &dev_attr_queue_id.attr, | 1633 | &dev_attr_queue_id.attr, |
1602 | &dev_attr_all_slaves_active.attr, | 1634 | &dev_attr_all_slaves_active.attr, |
1603 | &dev_attr_resend_igmp.attr, | 1635 | &dev_attr_resend_igmp.attr, |
1636 | &dev_attr_min_links.attr, | ||
1604 | NULL, | 1637 | NULL, |
1605 | }; | 1638 | }; |
1606 | 1639 | ||
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 382903f0562e..2936171f5332 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -147,6 +147,7 @@ struct bond_params { | |||
147 | int updelay; | 147 | int updelay; |
148 | int downdelay; | 148 | int downdelay; |
149 | int lacp_fast; | 149 | int lacp_fast; |
150 | unsigned int min_links; | ||
150 | int ad_select; | 151 | int ad_select; |
151 | char primary[IFNAMSIZ]; | 152 | char primary[IFNAMSIZ]; |
152 | int primary_reselect; | 153 | int primary_reselect; |