diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-04-15 09:47:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-18 02:36:03 -0400 |
commit | 7c89943236750537d26421d9bbb6f6575e2d1e1b (patch) | |
tree | dfbc9b11ddcd20757388b03e9925363c1e1764f3 /drivers/net/bonding | |
parent | 99606477a5888b0ead0284fecb13417b1da8e3af (diff) |
bonding, ipv4, ipv6, vlan: Handle NETDEV_BONDING_FAILOVER like NETDEV_NOTIFY_PEERS
It is undesirable for the bonding driver to be poking into higher
level protocols, and notifiers provide a way to avoid that. This does
mean removing the ability to configure reptitition of gratuitous ARPs
and unsolicited NAs.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/Makefile | 3 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 94 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 80 | ||||
-rw-r--r-- | drivers/net/bonding/bonding.h | 29 |
4 files changed, 0 insertions, 206 deletions
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile index 3c5c014e82b2..4c21bf6b8b2f 100644 --- a/drivers/net/bonding/Makefile +++ b/drivers/net/bonding/Makefile | |||
@@ -9,6 +9,3 @@ bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o bond_debugfs.o | |||
9 | proc-$(CONFIG_PROC_FS) += bond_procfs.o | 9 | proc-$(CONFIG_PROC_FS) += bond_procfs.o |
10 | bonding-objs += $(proc-y) | 10 | bonding-objs += $(proc-y) |
11 | 11 | ||
12 | ipv6-$(subst m,y,$(CONFIG_IPV6)) += bond_ipv6.o | ||
13 | bonding-objs += $(ipv6-y) | ||
14 | |||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index fdf9215ada7d..4ce14bdf96dd 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -89,8 +89,6 @@ | |||
89 | 89 | ||
90 | static int max_bonds = BOND_DEFAULT_MAX_BONDS; | 90 | static int max_bonds = BOND_DEFAULT_MAX_BONDS; |
91 | static int tx_queues = BOND_DEFAULT_TX_QUEUES; | 91 | static int tx_queues = BOND_DEFAULT_TX_QUEUES; |
92 | static int num_grat_arp = 1; | ||
93 | static int num_unsol_na = 1; | ||
94 | static int miimon = BOND_LINK_MON_INTERV; | 92 | static int miimon = BOND_LINK_MON_INTERV; |
95 | static int updelay; | 93 | static int updelay; |
96 | static int downdelay; | 94 | static int downdelay; |
@@ -113,10 +111,6 @@ module_param(max_bonds, int, 0); | |||
113 | MODULE_PARM_DESC(max_bonds, "Max number of bonded devices"); | 111 | MODULE_PARM_DESC(max_bonds, "Max number of bonded devices"); |
114 | module_param(tx_queues, int, 0); | 112 | module_param(tx_queues, int, 0); |
115 | MODULE_PARM_DESC(tx_queues, "Max number of transmit queues (default = 16)"); | 113 | MODULE_PARM_DESC(tx_queues, "Max number of transmit queues (default = 16)"); |
116 | module_param(num_grat_arp, int, 0644); | ||
117 | MODULE_PARM_DESC(num_grat_arp, "Number of gratuitous ARP packets to send on failover event"); | ||
118 | module_param(num_unsol_na, int, 0644); | ||
119 | MODULE_PARM_DESC(num_unsol_na, "Number of unsolicited IPv6 Neighbor Advertisements packets to send on failover event"); | ||
120 | module_param(miimon, int, 0); | 114 | module_param(miimon, int, 0); |
121 | MODULE_PARM_DESC(miimon, "Link check interval in milliseconds"); | 115 | MODULE_PARM_DESC(miimon, "Link check interval in milliseconds"); |
122 | module_param(updelay, int, 0); | 116 | module_param(updelay, int, 0); |
@@ -234,7 +228,6 @@ struct bond_parm_tbl ad_select_tbl[] = { | |||
234 | 228 | ||
235 | /*-------------------------- Forward declarations ---------------------------*/ | 229 | /*-------------------------- Forward declarations ---------------------------*/ |
236 | 230 | ||
237 | static void bond_send_gratuitous_arp(struct bonding *bond); | ||
238 | static int bond_init(struct net_device *bond_dev); | 231 | static int bond_init(struct net_device *bond_dev); |
239 | static void bond_uninit(struct net_device *bond_dev); | 232 | static void bond_uninit(struct net_device *bond_dev); |
240 | 233 | ||
@@ -1162,14 +1155,6 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1162 | bond_do_fail_over_mac(bond, new_active, | 1155 | bond_do_fail_over_mac(bond, new_active, |
1163 | old_active); | 1156 | old_active); |
1164 | 1157 | ||
1165 | if (netif_running(bond->dev)) { | ||
1166 | bond->send_grat_arp = bond->params.num_grat_arp; | ||
1167 | bond_send_gratuitous_arp(bond); | ||
1168 | |||
1169 | bond->send_unsol_na = bond->params.num_unsol_na; | ||
1170 | bond_send_unsolicited_na(bond); | ||
1171 | } | ||
1172 | |||
1173 | write_unlock_bh(&bond->curr_slave_lock); | 1158 | write_unlock_bh(&bond->curr_slave_lock); |
1174 | read_unlock(&bond->lock); | 1159 | read_unlock(&bond->lock); |
1175 | 1160 | ||
@@ -2580,18 +2565,6 @@ void bond_mii_monitor(struct work_struct *work) | |||
2580 | if (bond->slave_cnt == 0) | 2565 | if (bond->slave_cnt == 0) |
2581 | goto re_arm; | 2566 | goto re_arm; |
2582 | 2567 | ||
2583 | if (bond->send_grat_arp) { | ||
2584 | read_lock(&bond->curr_slave_lock); | ||
2585 | bond_send_gratuitous_arp(bond); | ||
2586 | read_unlock(&bond->curr_slave_lock); | ||
2587 | } | ||
2588 | |||
2589 | if (bond->send_unsol_na) { | ||
2590 | read_lock(&bond->curr_slave_lock); | ||
2591 | bond_send_unsolicited_na(bond); | ||
2592 | read_unlock(&bond->curr_slave_lock); | ||
2593 | } | ||
2594 | |||
2595 | if (bond_miimon_inspect(bond)) { | 2568 | if (bond_miimon_inspect(bond)) { |
2596 | read_unlock(&bond->lock); | 2569 | read_unlock(&bond->lock); |
2597 | rtnl_lock(); | 2570 | rtnl_lock(); |
@@ -2753,42 +2726,6 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2753 | } | 2726 | } |
2754 | } | 2727 | } |
2755 | 2728 | ||
2756 | /* | ||
2757 | * Kick out a gratuitous ARP for an IP on the bonding master plus one | ||
2758 | * for each VLAN above us. | ||
2759 | * | ||
2760 | * Caller must hold curr_slave_lock for read or better | ||
2761 | */ | ||
2762 | static void bond_send_gratuitous_arp(struct bonding *bond) | ||
2763 | { | ||
2764 | struct slave *slave = bond->curr_active_slave; | ||
2765 | struct vlan_entry *vlan; | ||
2766 | |||
2767 | pr_debug("bond_send_grat_arp: bond %s slave %s\n", | ||
2768 | bond->dev->name, slave ? slave->dev->name : "NULL"); | ||
2769 | |||
2770 | if (!slave || !bond->send_grat_arp || | ||
2771 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) | ||
2772 | return; | ||
2773 | |||
2774 | bond->send_grat_arp--; | ||
2775 | |||
2776 | if (bond->master_ip) { | ||
2777 | bond_arp_send(slave->dev, ARPOP_REPLY, bond->master_ip, | ||
2778 | bond->master_ip, 0); | ||
2779 | } | ||
2780 | |||
2781 | if (!bond->vlgrp) | ||
2782 | return; | ||
2783 | |||
2784 | list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { | ||
2785 | if (vlan->vlan_ip) { | ||
2786 | bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip, | ||
2787 | vlan->vlan_ip, vlan->vlan_id); | ||
2788 | } | ||
2789 | } | ||
2790 | } | ||
2791 | |||
2792 | static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip) | 2729 | static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip) |
2793 | { | 2730 | { |
2794 | int i; | 2731 | int i; |
@@ -3255,18 +3192,6 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
3255 | if (bond->slave_cnt == 0) | 3192 | if (bond->slave_cnt == 0) |
3256 | goto re_arm; | 3193 | goto re_arm; |
3257 | 3194 | ||
3258 | if (bond->send_grat_arp) { | ||
3259 | read_lock(&bond->curr_slave_lock); | ||
3260 | bond_send_gratuitous_arp(bond); | ||
3261 | read_unlock(&bond->curr_slave_lock); | ||
3262 | } | ||
3263 | |||
3264 | if (bond->send_unsol_na) { | ||
3265 | read_lock(&bond->curr_slave_lock); | ||
3266 | bond_send_unsolicited_na(bond); | ||
3267 | read_unlock(&bond->curr_slave_lock); | ||
3268 | } | ||
3269 | |||
3270 | if (bond_ab_arp_inspect(bond, delta_in_ticks)) { | 3195 | if (bond_ab_arp_inspect(bond, delta_in_ticks)) { |
3271 | read_unlock(&bond->lock); | 3196 | read_unlock(&bond->lock); |
3272 | rtnl_lock(); | 3197 | rtnl_lock(); |
@@ -3645,9 +3570,6 @@ static int bond_close(struct net_device *bond_dev) | |||
3645 | 3570 | ||
3646 | write_lock_bh(&bond->lock); | 3571 | write_lock_bh(&bond->lock); |
3647 | 3572 | ||
3648 | bond->send_grat_arp = 0; | ||
3649 | bond->send_unsol_na = 0; | ||
3650 | |||
3651 | /* signal timers not to re-arm */ | 3573 | /* signal timers not to re-arm */ |
3652 | bond->kill_timers = 1; | 3574 | bond->kill_timers = 1; |
3653 | 3575 | ||
@@ -4724,18 +4646,6 @@ static int bond_check_params(struct bond_params *params) | |||
4724 | use_carrier = 1; | 4646 | use_carrier = 1; |
4725 | } | 4647 | } |
4726 | 4648 | ||
4727 | if (num_grat_arp < 0 || num_grat_arp > 255) { | ||
4728 | pr_warning("Warning: num_grat_arp (%d) not in range 0-255 so it was reset to 1\n", | ||
4729 | num_grat_arp); | ||
4730 | num_grat_arp = 1; | ||
4731 | } | ||
4732 | |||
4733 | if (num_unsol_na < 0 || num_unsol_na > 255) { | ||
4734 | pr_warning("Warning: num_unsol_na (%d) not in range 0-255 so it was reset to 1\n", | ||
4735 | num_unsol_na); | ||
4736 | num_unsol_na = 1; | ||
4737 | } | ||
4738 | |||
4739 | /* reset values for 802.3ad */ | 4649 | /* reset values for 802.3ad */ |
4740 | if (bond_mode == BOND_MODE_8023AD) { | 4650 | if (bond_mode == BOND_MODE_8023AD) { |
4741 | if (!miimon) { | 4651 | if (!miimon) { |
@@ -4925,8 +4835,6 @@ static int bond_check_params(struct bond_params *params) | |||
4925 | params->mode = bond_mode; | 4835 | params->mode = bond_mode; |
4926 | params->xmit_policy = xmit_hashtype; | 4836 | params->xmit_policy = xmit_hashtype; |
4927 | params->miimon = miimon; | 4837 | params->miimon = miimon; |
4928 | params->num_grat_arp = num_grat_arp; | ||
4929 | params->num_unsol_na = num_unsol_na; | ||
4930 | params->arp_interval = arp_interval; | 4838 | params->arp_interval = arp_interval; |
4931 | params->arp_validate = arp_validate_value; | 4839 | params->arp_validate = arp_validate_value; |
4932 | params->updelay = updelay; | 4840 | params->updelay = updelay; |
@@ -5121,7 +5029,6 @@ static int __init bonding_init(void) | |||
5121 | 5029 | ||
5122 | register_netdevice_notifier(&bond_netdev_notifier); | 5030 | register_netdevice_notifier(&bond_netdev_notifier); |
5123 | register_inetaddr_notifier(&bond_inetaddr_notifier); | 5031 | register_inetaddr_notifier(&bond_inetaddr_notifier); |
5124 | bond_register_ipv6_notifier(); | ||
5125 | out: | 5032 | out: |
5126 | return res; | 5033 | return res; |
5127 | err: | 5034 | err: |
@@ -5136,7 +5043,6 @@ static void __exit bonding_exit(void) | |||
5136 | { | 5043 | { |
5137 | unregister_netdevice_notifier(&bond_netdev_notifier); | 5044 | unregister_netdevice_notifier(&bond_netdev_notifier); |
5138 | unregister_inetaddr_notifier(&bond_inetaddr_notifier); | 5045 | unregister_inetaddr_notifier(&bond_inetaddr_notifier); |
5139 | bond_unregister_ipv6_notifier(); | ||
5140 | 5046 | ||
5141 | bond_destroy_sysfs(); | 5047 | bond_destroy_sysfs(); |
5142 | bond_destroy_debugfs(); | 5048 | bond_destroy_debugfs(); |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index de87aea6d01a..259ff32cd573 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -874,84 +874,6 @@ static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR, | |||
874 | bonding_show_ad_select, bonding_store_ad_select); | 874 | bonding_show_ad_select, bonding_store_ad_select); |
875 | 875 | ||
876 | /* | 876 | /* |
877 | * Show and set the number of grat ARP to send after a failover event. | ||
878 | */ | ||
879 | static ssize_t bonding_show_n_grat_arp(struct device *d, | ||
880 | struct device_attribute *attr, | ||
881 | char *buf) | ||
882 | { | ||
883 | struct bonding *bond = to_bond(d); | ||
884 | |||
885 | return sprintf(buf, "%d\n", bond->params.num_grat_arp); | ||
886 | } | ||
887 | |||
888 | static ssize_t bonding_store_n_grat_arp(struct device *d, | ||
889 | struct device_attribute *attr, | ||
890 | const char *buf, size_t count) | ||
891 | { | ||
892 | int new_value, ret = count; | ||
893 | struct bonding *bond = to_bond(d); | ||
894 | |||
895 | if (sscanf(buf, "%d", &new_value) != 1) { | ||
896 | pr_err("%s: no num_grat_arp value specified.\n", | ||
897 | bond->dev->name); | ||
898 | ret = -EINVAL; | ||
899 | goto out; | ||
900 | } | ||
901 | if (new_value < 0 || new_value > 255) { | ||
902 | pr_err("%s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n", | ||
903 | bond->dev->name, new_value); | ||
904 | ret = -EINVAL; | ||
905 | goto out; | ||
906 | } else { | ||
907 | bond->params.num_grat_arp = new_value; | ||
908 | } | ||
909 | out: | ||
910 | return ret; | ||
911 | } | ||
912 | static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR, | ||
913 | bonding_show_n_grat_arp, bonding_store_n_grat_arp); | ||
914 | |||
915 | /* | ||
916 | * Show and set the number of unsolicited NA's to send after a failover event. | ||
917 | */ | ||
918 | static ssize_t bonding_show_n_unsol_na(struct device *d, | ||
919 | struct device_attribute *attr, | ||
920 | char *buf) | ||
921 | { | ||
922 | struct bonding *bond = to_bond(d); | ||
923 | |||
924 | return sprintf(buf, "%d\n", bond->params.num_unsol_na); | ||
925 | } | ||
926 | |||
927 | static ssize_t bonding_store_n_unsol_na(struct device *d, | ||
928 | struct device_attribute *attr, | ||
929 | const char *buf, size_t count) | ||
930 | { | ||
931 | int new_value, ret = count; | ||
932 | struct bonding *bond = to_bond(d); | ||
933 | |||
934 | if (sscanf(buf, "%d", &new_value) != 1) { | ||
935 | pr_err("%s: no num_unsol_na value specified.\n", | ||
936 | bond->dev->name); | ||
937 | ret = -EINVAL; | ||
938 | goto out; | ||
939 | } | ||
940 | |||
941 | if (new_value < 0 || new_value > 255) { | ||
942 | pr_err("%s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n", | ||
943 | bond->dev->name, new_value); | ||
944 | ret = -EINVAL; | ||
945 | goto out; | ||
946 | } else | ||
947 | bond->params.num_unsol_na = new_value; | ||
948 | out: | ||
949 | return ret; | ||
950 | } | ||
951 | static DEVICE_ATTR(num_unsol_na, S_IRUGO | S_IWUSR, | ||
952 | bonding_show_n_unsol_na, bonding_store_n_unsol_na); | ||
953 | |||
954 | /* | ||
955 | * Show and set the MII monitor interval. There are two tricky bits | 877 | * Show and set the MII monitor interval. There are two tricky bits |
956 | * here. First, if MII monitoring is activated, then we must disable | 878 | * here. First, if MII monitoring is activated, then we must disable |
957 | * ARP monitoring. Second, if the timer isn't running, we must | 879 | * ARP monitoring. Second, if the timer isn't running, we must |
@@ -1650,8 +1572,6 @@ static struct attribute *per_bond_attrs[] = { | |||
1650 | &dev_attr_lacp_rate.attr, | 1572 | &dev_attr_lacp_rate.attr, |
1651 | &dev_attr_ad_select.attr, | 1573 | &dev_attr_ad_select.attr, |
1652 | &dev_attr_xmit_hash_policy.attr, | 1574 | &dev_attr_xmit_hash_policy.attr, |
1653 | &dev_attr_num_grat_arp.attr, | ||
1654 | &dev_attr_num_unsol_na.attr, | ||
1655 | &dev_attr_miimon.attr, | 1575 | &dev_attr_miimon.attr, |
1656 | &dev_attr_primary.attr, | 1576 | &dev_attr_primary.attr, |
1657 | &dev_attr_primary_reselect.attr, | 1577 | &dev_attr_primary_reselect.attr, |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 553c764f7407..6126c6a13a74 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -149,8 +149,6 @@ struct bond_params { | |||
149 | int mode; | 149 | int mode; |
150 | int xmit_policy; | 150 | int xmit_policy; |
151 | int miimon; | 151 | int miimon; |
152 | int num_grat_arp; | ||
153 | int num_unsol_na; | ||
154 | int arp_interval; | 152 | int arp_interval; |
155 | int arp_validate; | 153 | int arp_validate; |
156 | int use_carrier; | 154 | int use_carrier; |
@@ -178,9 +176,6 @@ struct vlan_entry { | |||
178 | struct list_head vlan_list; | 176 | struct list_head vlan_list; |
179 | __be32 vlan_ip; | 177 | __be32 vlan_ip; |
180 | unsigned short vlan_id; | 178 | unsigned short vlan_id; |
181 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
182 | struct in6_addr vlan_ipv6; | ||
183 | #endif | ||
184 | }; | 179 | }; |
185 | 180 | ||
186 | struct slave { | 181 | struct slave { |
@@ -234,8 +229,6 @@ struct bonding { | |||
234 | rwlock_t lock; | 229 | rwlock_t lock; |
235 | rwlock_t curr_slave_lock; | 230 | rwlock_t curr_slave_lock; |
236 | s8 kill_timers; | 231 | s8 kill_timers; |
237 | s8 send_grat_arp; | ||
238 | s8 send_unsol_na; | ||
239 | s8 setup_by_slave; | 232 | s8 setup_by_slave; |
240 | s8 igmp_retrans; | 233 | s8 igmp_retrans; |
241 | #ifdef CONFIG_PROC_FS | 234 | #ifdef CONFIG_PROC_FS |
@@ -260,9 +253,6 @@ struct bonding { | |||
260 | struct delayed_work alb_work; | 253 | struct delayed_work alb_work; |
261 | struct delayed_work ad_work; | 254 | struct delayed_work ad_work; |
262 | struct delayed_work mcast_work; | 255 | struct delayed_work mcast_work; |
263 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
264 | struct in6_addr master_ipv6; | ||
265 | #endif | ||
266 | #ifdef CONFIG_DEBUG_FS | 256 | #ifdef CONFIG_DEBUG_FS |
267 | /* debugging suport via debugfs */ | 257 | /* debugging suport via debugfs */ |
268 | struct dentry *debug_dir; | 258 | struct dentry *debug_dir; |
@@ -460,23 +450,4 @@ extern const struct bond_parm_tbl fail_over_mac_tbl[]; | |||
460 | extern const struct bond_parm_tbl pri_reselect_tbl[]; | 450 | extern const struct bond_parm_tbl pri_reselect_tbl[]; |
461 | extern struct bond_parm_tbl ad_select_tbl[]; | 451 | extern struct bond_parm_tbl ad_select_tbl[]; |
462 | 452 | ||
463 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
464 | void bond_send_unsolicited_na(struct bonding *bond); | ||
465 | void bond_register_ipv6_notifier(void); | ||
466 | void bond_unregister_ipv6_notifier(void); | ||
467 | #else | ||
468 | static inline void bond_send_unsolicited_na(struct bonding *bond) | ||
469 | { | ||
470 | return; | ||
471 | } | ||
472 | static inline void bond_register_ipv6_notifier(void) | ||
473 | { | ||
474 | return; | ||
475 | } | ||
476 | static inline void bond_unregister_ipv6_notifier(void) | ||
477 | { | ||
478 | return; | ||
479 | } | ||
480 | #endif | ||
481 | |||
482 | #endif /* _LINUX_BONDING_H */ | 453 | #endif /* _LINUX_BONDING_H */ |