diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-06-12 15:02:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-14 02:28:57 -0400 |
commit | 3d632c3f28e69f0d6d44aa09c4df708d63a91a7c (patch) | |
tree | 8782d6b6e56a4c7f425331744584b778ca5a5255 /drivers | |
parent | 9e71626c1c23ec69372c43c6fe66c1171032bf42 (diff) |
bonding: fix style issues
Resolve some of the complaints from checkpatch, and remove "magic emacs format"
comments, and useless MODULE_SUPPORTED_DEVICE(). But should not
change actual code.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 633 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 324 |
2 files changed, 460 insertions, 497 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 2fc3561e099d..ea6b9043a5e7 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -51,10 +51,10 @@ | |||
51 | #include <linux/ctype.h> | 51 | #include <linux/ctype.h> |
52 | #include <linux/inet.h> | 52 | #include <linux/inet.h> |
53 | #include <linux/bitops.h> | 53 | #include <linux/bitops.h> |
54 | #include <linux/io.h> | ||
54 | #include <asm/system.h> | 55 | #include <asm/system.h> |
55 | #include <asm/io.h> | ||
56 | #include <asm/dma.h> | 56 | #include <asm/dma.h> |
57 | #include <asm/uaccess.h> | 57 | #include <linux/uaccess.h> |
58 | #include <linux/errno.h> | 58 | #include <linux/errno.h> |
59 | #include <linux/netdevice.h> | 59 | #include <linux/netdevice.h> |
60 | #include <linux/inetdevice.h> | 60 | #include <linux/inetdevice.h> |
@@ -89,18 +89,18 @@ static int max_bonds = BOND_DEFAULT_MAX_BONDS; | |||
89 | static int num_grat_arp = 1; | 89 | static int num_grat_arp = 1; |
90 | static int num_unsol_na = 1; | 90 | static int num_unsol_na = 1; |
91 | static int miimon = BOND_LINK_MON_INTERV; | 91 | static int miimon = BOND_LINK_MON_INTERV; |
92 | static int updelay = 0; | 92 | static int updelay; |
93 | static int downdelay = 0; | 93 | static int downdelay; |
94 | static int use_carrier = 1; | 94 | static int use_carrier = 1; |
95 | static char *mode = NULL; | 95 | static char *mode; |
96 | static char *primary = NULL; | 96 | static char *primary; |
97 | static char *lacp_rate = NULL; | 97 | static char *lacp_rate; |
98 | static char *ad_select = NULL; | 98 | static char *ad_select; |
99 | static char *xmit_hash_policy = NULL; | 99 | static char *xmit_hash_policy; |
100 | static int arp_interval = BOND_LINK_ARP_INTERV; | 100 | static int arp_interval = BOND_LINK_ARP_INTERV; |
101 | static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, }; | 101 | static char *arp_ip_target[BOND_MAX_ARP_TARGETS]; |
102 | static char *arp_validate = NULL; | 102 | static char *arp_validate; |
103 | static char *fail_over_mac = NULL; | 103 | static char *fail_over_mac; |
104 | static struct bond_params bonding_defaults; | 104 | static struct bond_params bonding_defaults; |
105 | 105 | ||
106 | module_param(max_bonds, int, 0); | 106 | module_param(max_bonds, int, 0); |
@@ -151,14 +151,14 @@ static const char * const version = | |||
151 | LIST_HEAD(bond_dev_list); | 151 | LIST_HEAD(bond_dev_list); |
152 | 152 | ||
153 | #ifdef CONFIG_PROC_FS | 153 | #ifdef CONFIG_PROC_FS |
154 | static struct proc_dir_entry *bond_proc_dir = NULL; | 154 | static struct proc_dir_entry *bond_proc_dir; |
155 | #endif | 155 | #endif |
156 | 156 | ||
157 | static __be32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; | 157 | static __be32 arp_target[BOND_MAX_ARP_TARGETS]; |
158 | static int arp_ip_count = 0; | 158 | static int arp_ip_count; |
159 | static int bond_mode = BOND_MODE_ROUNDROBIN; | 159 | static int bond_mode = BOND_MODE_ROUNDROBIN; |
160 | static int xmit_hashtype= BOND_XMIT_POLICY_LAYER2; | 160 | static int xmit_hashtype = BOND_XMIT_POLICY_LAYER2; |
161 | static int lacp_fast = 0; | 161 | static int lacp_fast; |
162 | 162 | ||
163 | 163 | ||
164 | const struct bond_parm_tbl bond_lacp_tbl[] = { | 164 | const struct bond_parm_tbl bond_lacp_tbl[] = { |
@@ -221,7 +221,7 @@ static const char *bond_mode_name(int mode) | |||
221 | [BOND_MODE_ACTIVEBACKUP] = "fault-tolerance (active-backup)", | 221 | [BOND_MODE_ACTIVEBACKUP] = "fault-tolerance (active-backup)", |
222 | [BOND_MODE_XOR] = "load balancing (xor)", | 222 | [BOND_MODE_XOR] = "load balancing (xor)", |
223 | [BOND_MODE_BROADCAST] = "fault-tolerance (broadcast)", | 223 | [BOND_MODE_BROADCAST] = "fault-tolerance (broadcast)", |
224 | [BOND_MODE_8023AD]= "IEEE 802.3ad Dynamic link aggregation", | 224 | [BOND_MODE_8023AD] = "IEEE 802.3ad Dynamic link aggregation", |
225 | [BOND_MODE_TLB] = "transmit load balancing", | 225 | [BOND_MODE_TLB] = "transmit load balancing", |
226 | [BOND_MODE_ALB] = "adaptive load balancing", | 226 | [BOND_MODE_ALB] = "adaptive load balancing", |
227 | }; | 227 | }; |
@@ -246,12 +246,11 @@ static int bond_add_vlan(struct bonding *bond, unsigned short vlan_id) | |||
246 | struct vlan_entry *vlan; | 246 | struct vlan_entry *vlan; |
247 | 247 | ||
248 | pr_debug("bond: %s, vlan id %d\n", | 248 | pr_debug("bond: %s, vlan id %d\n", |
249 | (bond ? bond->dev->name: "None"), vlan_id); | 249 | (bond ? bond->dev->name : "None"), vlan_id); |
250 | 250 | ||
251 | vlan = kzalloc(sizeof(struct vlan_entry), GFP_KERNEL); | 251 | vlan = kzalloc(sizeof(struct vlan_entry), GFP_KERNEL); |
252 | if (!vlan) { | 252 | if (!vlan) |
253 | return -ENOMEM; | 253 | return -ENOMEM; |
254 | } | ||
255 | 254 | ||
256 | INIT_LIST_HEAD(&vlan->vlan_list); | 255 | INIT_LIST_HEAD(&vlan->vlan_list); |
257 | vlan->vlan_id = vlan_id; | 256 | vlan->vlan_id = vlan_id; |
@@ -351,16 +350,15 @@ static int bond_has_challenged_slaves(struct bonding *bond) | |||
351 | * | 350 | * |
352 | * Returns %NULL if list is empty, bond->next_vlan if @curr is %NULL, | 351 | * Returns %NULL if list is empty, bond->next_vlan if @curr is %NULL, |
353 | * or @curr->next otherwise (even if it is @curr itself again). | 352 | * or @curr->next otherwise (even if it is @curr itself again). |
354 | * | 353 | * |
355 | * Caller must hold bond->lock | 354 | * Caller must hold bond->lock |
356 | */ | 355 | */ |
357 | struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) | 356 | struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) |
358 | { | 357 | { |
359 | struct vlan_entry *next, *last; | 358 | struct vlan_entry *next, *last; |
360 | 359 | ||
361 | if (list_empty(&bond->vlan_list)) { | 360 | if (list_empty(&bond->vlan_list)) |
362 | return NULL; | 361 | return NULL; |
363 | } | ||
364 | 362 | ||
365 | if (!curr) { | 363 | if (!curr) { |
366 | next = list_entry(bond->vlan_list.next, | 364 | next = list_entry(bond->vlan_list.next, |
@@ -382,11 +380,11 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) | |||
382 | 380 | ||
383 | /** | 381 | /** |
384 | * bond_dev_queue_xmit - Prepare skb for xmit. | 382 | * bond_dev_queue_xmit - Prepare skb for xmit. |
385 | * | 383 | * |
386 | * @bond: bond device that got this skb for tx. | 384 | * @bond: bond device that got this skb for tx. |
387 | * @skb: hw accel VLAN tagged skb to transmit | 385 | * @skb: hw accel VLAN tagged skb to transmit |
388 | * @slave_dev: slave that is supposed to xmit this skbuff | 386 | * @slave_dev: slave that is supposed to xmit this skbuff |
389 | * | 387 | * |
390 | * When the bond gets an skb to transmit that is | 388 | * When the bond gets an skb to transmit that is |
391 | * already hardware accelerated VLAN tagged, and it | 389 | * already hardware accelerated VLAN tagged, and it |
392 | * needs to relay this skb to a slave that is not | 390 | * needs to relay this skb to a slave that is not |
@@ -394,7 +392,8 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) | |||
394 | * i.e. strip the hwaccel tag and re-insert it as part | 392 | * i.e. strip the hwaccel tag and re-insert it as part |
395 | * of the payload. | 393 | * of the payload. |
396 | */ | 394 | */ |
397 | int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev) | 395 | int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, |
396 | struct net_device *slave_dev) | ||
398 | { | 397 | { |
399 | unsigned short uninitialized_var(vlan_id); | 398 | unsigned short uninitialized_var(vlan_id); |
400 | 399 | ||
@@ -428,7 +427,7 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_de | |||
428 | * b. The operation is protected by the RTNL semaphore in the 8021q code, | 427 | * b. The operation is protected by the RTNL semaphore in the 8021q code, |
429 | * c. Holding a lock with BH disabled while directly calling a base driver | 428 | * c. Holding a lock with BH disabled while directly calling a base driver |
430 | * entry point is generally a BAD idea. | 429 | * entry point is generally a BAD idea. |
431 | * | 430 | * |
432 | * The design of synchronization/protection for this operation in the 8021q | 431 | * The design of synchronization/protection for this operation in the 8021q |
433 | * module is good for one or more VLAN devices over a single physical device | 432 | * module is good for one or more VLAN devices over a single physical device |
434 | * and cannot be extended for a teaming solution like bonding, so there is a | 433 | * and cannot be extended for a teaming solution like bonding, so there is a |
@@ -443,7 +442,8 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_de | |||
443 | * @bond_dev: bonding net device that got called | 442 | * @bond_dev: bonding net device that got called |
444 | * @grp: vlan group being registered | 443 | * @grp: vlan group being registered |
445 | */ | 444 | */ |
446 | static void bond_vlan_rx_register(struct net_device *bond_dev, struct vlan_group *grp) | 445 | static void bond_vlan_rx_register(struct net_device *bond_dev, |
446 | struct vlan_group *grp) | ||
447 | { | 447 | { |
448 | struct bonding *bond = netdev_priv(bond_dev); | 448 | struct bonding *bond = netdev_priv(bond_dev); |
449 | struct slave *slave; | 449 | struct slave *slave; |
@@ -485,7 +485,7 @@ static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid) | |||
485 | 485 | ||
486 | res = bond_add_vlan(bond, vid); | 486 | res = bond_add_vlan(bond, vid); |
487 | if (res) { | 487 | if (res) { |
488 | printk(KERN_ERR DRV_NAME | 488 | pr_err(DRV_NAME |
489 | ": %s: Error: Failed to add vlan id %d\n", | 489 | ": %s: Error: Failed to add vlan id %d\n", |
490 | bond_dev->name, vid); | 490 | bond_dev->name, vid); |
491 | } | 491 | } |
@@ -520,7 +520,7 @@ static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid) | |||
520 | 520 | ||
521 | res = bond_del_vlan(bond, vid); | 521 | res = bond_del_vlan(bond, vid); |
522 | if (res) { | 522 | if (res) { |
523 | printk(KERN_ERR DRV_NAME | 523 | pr_err(DRV_NAME |
524 | ": %s: Error: Failed to remove vlan id %d\n", | 524 | ": %s: Error: Failed to remove vlan id %d\n", |
525 | bond_dev->name, vid); | 525 | bond_dev->name, vid); |
526 | } | 526 | } |
@@ -551,7 +551,8 @@ out: | |||
551 | write_unlock_bh(&bond->lock); | 551 | write_unlock_bh(&bond->lock); |
552 | } | 552 | } |
553 | 553 | ||
554 | static void bond_del_vlans_from_slave(struct bonding *bond, struct net_device *slave_dev) | 554 | static void bond_del_vlans_from_slave(struct bonding *bond, |
555 | struct net_device *slave_dev) | ||
555 | { | 556 | { |
556 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; | 557 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; |
557 | struct vlan_entry *vlan; | 558 | struct vlan_entry *vlan; |
@@ -673,7 +674,7 @@ static int bond_update_speed_duplex(struct slave *slave) | |||
673 | * if <dev> supports MII link status reporting, check its link status. | 674 | * if <dev> supports MII link status reporting, check its link status. |
674 | * | 675 | * |
675 | * We either do MII/ETHTOOL ioctls, or check netif_carrier_ok(), | 676 | * We either do MII/ETHTOOL ioctls, or check netif_carrier_ok(), |
676 | * depening upon the setting of the use_carrier parameter. | 677 | * depending upon the setting of the use_carrier parameter. |
677 | * | 678 | * |
678 | * Return either BMSR_LSTATUS, meaning that the link is up (or we | 679 | * Return either BMSR_LSTATUS, meaning that the link is up (or we |
679 | * can't tell and just pretend it is), or 0, meaning that the link is | 680 | * can't tell and just pretend it is), or 0, meaning that the link is |
@@ -685,10 +686,11 @@ static int bond_update_speed_duplex(struct slave *slave) | |||
685 | * It'd be nice if there was a good way to tell if a driver supports | 686 | * It'd be nice if there was a good way to tell if a driver supports |
686 | * netif_carrier, but there really isn't. | 687 | * netif_carrier, but there really isn't. |
687 | */ | 688 | */ |
688 | static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_dev, int reporting) | 689 | static int bond_check_dev_link(struct bonding *bond, |
690 | struct net_device *slave_dev, int reporting) | ||
689 | { | 691 | { |
690 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; | 692 | const struct net_device_ops *slave_ops = slave_dev->netdev_ops; |
691 | static int (* ioctl)(struct net_device *, struct ifreq *, int); | 693 | static int (*ioctl)(struct net_device *, struct ifreq *, int); |
692 | struct ifreq ifr; | 694 | struct ifreq ifr; |
693 | struct mii_ioctl_data *mii; | 695 | struct mii_ioctl_data *mii; |
694 | 696 | ||
@@ -706,7 +708,7 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de | |||
706 | } | 708 | } |
707 | } | 709 | } |
708 | 710 | ||
709 | /* Ethtool can't be used, fallback to MII ioclts. */ | 711 | /* Ethtool can't be used, fallback to MII ioctls. */ |
710 | ioctl = slave_ops->ndo_do_ioctl; | 712 | ioctl = slave_ops->ndo_do_ioctl; |
711 | if (ioctl) { | 713 | if (ioctl) { |
712 | /* TODO: set pointer to correct ioctl on a per team member */ | 714 | /* TODO: set pointer to correct ioctl on a per team member */ |
@@ -726,9 +728,8 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de | |||
726 | mii = if_mii(&ifr); | 728 | mii = if_mii(&ifr); |
727 | if (IOCTL(slave_dev, &ifr, SIOCGMIIPHY) == 0) { | 729 | if (IOCTL(slave_dev, &ifr, SIOCGMIIPHY) == 0) { |
728 | mii->reg_num = MII_BMSR; | 730 | mii->reg_num = MII_BMSR; |
729 | if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0) { | 731 | if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0) |
730 | return (mii->val_out & BMSR_LSTATUS); | 732 | return mii->val_out & BMSR_LSTATUS; |
731 | } | ||
732 | } | 733 | } |
733 | } | 734 | } |
734 | 735 | ||
@@ -738,7 +739,7 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de | |||
738 | * cannot report link status). If not reporting, pretend | 739 | * cannot report link status). If not reporting, pretend |
739 | * we're ok. | 740 | * we're ok. |
740 | */ | 741 | */ |
741 | return (reporting ? -1 : BMSR_LSTATUS); | 742 | return reporting ? -1 : BMSR_LSTATUS; |
742 | } | 743 | } |
743 | 744 | ||
744 | /*----------------------------- Multicast list ------------------------------*/ | 745 | /*----------------------------- Multicast list ------------------------------*/ |
@@ -746,7 +747,8 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de | |||
746 | /* | 747 | /* |
747 | * Returns 0 if dmi1 and dmi2 are the same, non-0 otherwise | 748 | * Returns 0 if dmi1 and dmi2 are the same, non-0 otherwise |
748 | */ | 749 | */ |
749 | static inline int bond_is_dmi_same(struct dev_mc_list *dmi1, struct dev_mc_list *dmi2) | 750 | static inline int bond_is_dmi_same(const struct dev_mc_list *dmi1, |
751 | const struct dev_mc_list *dmi2) | ||
750 | { | 752 | { |
751 | return memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0 && | 753 | return memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0 && |
752 | dmi1->dmi_addrlen == dmi2->dmi_addrlen; | 754 | dmi1->dmi_addrlen == dmi2->dmi_addrlen; |
@@ -755,14 +757,14 @@ static inline int bond_is_dmi_same(struct dev_mc_list *dmi1, struct dev_mc_list | |||
755 | /* | 757 | /* |
756 | * returns dmi entry if found, NULL otherwise | 758 | * returns dmi entry if found, NULL otherwise |
757 | */ | 759 | */ |
758 | static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi, struct dev_mc_list *mc_list) | 760 | static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi, |
761 | struct dev_mc_list *mc_list) | ||
759 | { | 762 | { |
760 | struct dev_mc_list *idmi; | 763 | struct dev_mc_list *idmi; |
761 | 764 | ||
762 | for (idmi = mc_list; idmi; idmi = idmi->next) { | 765 | for (idmi = mc_list; idmi; idmi = idmi->next) { |
763 | if (bond_is_dmi_same(dmi, idmi)) { | 766 | if (bond_is_dmi_same(dmi, idmi)) |
764 | return idmi; | 767 | return idmi; |
765 | } | ||
766 | } | 768 | } |
767 | 769 | ||
768 | return NULL; | 770 | return NULL; |
@@ -824,15 +826,14 @@ static void bond_mc_add(struct bonding *bond, void *addr, int alen) | |||
824 | { | 826 | { |
825 | if (USES_PRIMARY(bond->params.mode)) { | 827 | if (USES_PRIMARY(bond->params.mode)) { |
826 | /* write lock already acquired */ | 828 | /* write lock already acquired */ |
827 | if (bond->curr_active_slave) { | 829 | if (bond->curr_active_slave) |
828 | dev_mc_add(bond->curr_active_slave->dev, addr, alen, 0); | 830 | dev_mc_add(bond->curr_active_slave->dev, addr, alen, 0); |
829 | } | ||
830 | } else { | 831 | } else { |
831 | struct slave *slave; | 832 | struct slave *slave; |
832 | int i; | 833 | int i; |
833 | bond_for_each_slave(bond, slave, i) { | 834 | |
835 | bond_for_each_slave(bond, slave, i) | ||
834 | dev_mc_add(slave->dev, addr, alen, 0); | 836 | dev_mc_add(slave->dev, addr, alen, 0); |
835 | } | ||
836 | } | 837 | } |
837 | } | 838 | } |
838 | 839 | ||
@@ -844,9 +845,9 @@ static void bond_mc_delete(struct bonding *bond, void *addr, int alen) | |||
844 | { | 845 | { |
845 | if (USES_PRIMARY(bond->params.mode)) { | 846 | if (USES_PRIMARY(bond->params.mode)) { |
846 | /* write lock already acquired */ | 847 | /* write lock already acquired */ |
847 | if (bond->curr_active_slave) { | 848 | if (bond->curr_active_slave) |
848 | dev_mc_delete(bond->curr_active_slave->dev, addr, alen, 0); | 849 | dev_mc_delete(bond->curr_active_slave->dev, addr, |
849 | } | 850 | alen, 0); |
850 | } else { | 851 | } else { |
851 | struct slave *slave; | 852 | struct slave *slave; |
852 | int i; | 853 | int i; |
@@ -870,9 +871,8 @@ static void bond_resend_igmp_join_requests(struct bonding *bond) | |||
870 | rcu_read_lock(); | 871 | rcu_read_lock(); |
871 | in_dev = __in_dev_get_rcu(bond->dev); | 872 | in_dev = __in_dev_get_rcu(bond->dev); |
872 | if (in_dev) { | 873 | if (in_dev) { |
873 | for (im = in_dev->mc_list; im; im = im->next) { | 874 | for (im = in_dev->mc_list; im; im = im->next) |
874 | ip_mc_rejoin_group(im); | 875 | ip_mc_rejoin_group(im); |
875 | } | ||
876 | } | 876 | } |
877 | 877 | ||
878 | rcu_read_unlock(); | 878 | rcu_read_unlock(); |
@@ -891,7 +891,8 @@ static void bond_mc_list_destroy(struct bonding *bond) | |||
891 | kfree(dmi); | 891 | kfree(dmi); |
892 | dmi = bond->mc_list; | 892 | dmi = bond->mc_list; |
893 | } | 893 | } |
894 | bond->mc_list = NULL; | 894 | |
895 | bond->mc_list = NULL; | ||
895 | } | 896 | } |
896 | 897 | ||
897 | /* | 898 | /* |
@@ -924,14 +925,14 @@ static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond, | |||
924 | /* | 925 | /* |
925 | * flush all members of flush->mc_list from device dev->mc_list | 926 | * flush all members of flush->mc_list from device dev->mc_list |
926 | */ | 927 | */ |
927 | static void bond_mc_list_flush(struct net_device *bond_dev, struct net_device *slave_dev) | 928 | static void bond_mc_list_flush(struct net_device *bond_dev, |
929 | struct net_device *slave_dev) | ||
928 | { | 930 | { |
929 | struct bonding *bond = netdev_priv(bond_dev); | 931 | struct bonding *bond = netdev_priv(bond_dev); |
930 | struct dev_mc_list *dmi; | 932 | struct dev_mc_list *dmi; |
931 | 933 | ||
932 | for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { | 934 | for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) |
933 | dev_mc_delete(slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); | 935 | dev_mc_delete(slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); |
934 | } | ||
935 | 936 | ||
936 | if (bond->params.mode == BOND_MODE_8023AD) { | 937 | if (bond->params.mode == BOND_MODE_8023AD) { |
937 | /* del lacpdu mc addr from mc list */ | 938 | /* del lacpdu mc addr from mc list */ |
@@ -948,44 +949,40 @@ static void bond_mc_list_flush(struct net_device *bond_dev, struct net_device *s | |||
948 | * old active slaves (if any) according to the multicast mode, and | 949 | * old active slaves (if any) according to the multicast mode, and |
949 | * promiscuous flags unconditionally. | 950 | * promiscuous flags unconditionally. |
950 | */ | 951 | */ |
951 | static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct slave *old_active) | 952 | static void bond_mc_swap(struct bonding *bond, struct slave *new_active, |
953 | struct slave *old_active) | ||
952 | { | 954 | { |
953 | struct dev_mc_list *dmi; | 955 | struct dev_mc_list *dmi; |
954 | 956 | ||
955 | if (!USES_PRIMARY(bond->params.mode)) { | 957 | if (!USES_PRIMARY(bond->params.mode)) |
956 | /* nothing to do - mc list is already up-to-date on | 958 | /* nothing to do - mc list is already up-to-date on |
957 | * all slaves | 959 | * all slaves |
958 | */ | 960 | */ |
959 | return; | 961 | return; |
960 | } | ||
961 | 962 | ||
962 | if (old_active) { | 963 | if (old_active) { |
963 | if (bond->dev->flags & IFF_PROMISC) { | 964 | if (bond->dev->flags & IFF_PROMISC) |
964 | dev_set_promiscuity(old_active->dev, -1); | 965 | dev_set_promiscuity(old_active->dev, -1); |
965 | } | ||
966 | 966 | ||
967 | if (bond->dev->flags & IFF_ALLMULTI) { | 967 | if (bond->dev->flags & IFF_ALLMULTI) |
968 | dev_set_allmulti(old_active->dev, -1); | 968 | dev_set_allmulti(old_active->dev, -1); |
969 | } | ||
970 | 969 | ||
971 | for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next) { | 970 | for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next) |
972 | dev_mc_delete(old_active->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); | 971 | dev_mc_delete(old_active->dev, dmi->dmi_addr, |
973 | } | 972 | dmi->dmi_addrlen, 0); |
974 | } | 973 | } |
975 | 974 | ||
976 | if (new_active) { | 975 | if (new_active) { |
977 | /* FIXME: Signal errors upstream. */ | 976 | /* FIXME: Signal errors upstream. */ |
978 | if (bond->dev->flags & IFF_PROMISC) { | 977 | if (bond->dev->flags & IFF_PROMISC) |
979 | dev_set_promiscuity(new_active->dev, 1); | 978 | dev_set_promiscuity(new_active->dev, 1); |
980 | } | ||
981 | 979 | ||
982 | if (bond->dev->flags & IFF_ALLMULTI) { | 980 | if (bond->dev->flags & IFF_ALLMULTI) |
983 | dev_set_allmulti(new_active->dev, 1); | 981 | dev_set_allmulti(new_active->dev, 1); |
984 | } | ||
985 | 982 | ||
986 | for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next) { | 983 | for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next) |
987 | dev_mc_add(new_active->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); | 984 | dev_mc_add(new_active->dev, dmi->dmi_addr, |
988 | } | 985 | dmi->dmi_addrlen, 0); |
989 | bond_resend_igmp_join_requests(bond); | 986 | bond_resend_igmp_join_requests(bond); |
990 | } | 987 | } |
991 | } | 988 | } |
@@ -1039,7 +1036,7 @@ static void bond_do_fail_over_mac(struct bonding *bond, | |||
1039 | 1036 | ||
1040 | rv = dev_set_mac_address(new_active->dev, &saddr); | 1037 | rv = dev_set_mac_address(new_active->dev, &saddr); |
1041 | if (rv) { | 1038 | if (rv) { |
1042 | printk(KERN_ERR DRV_NAME | 1039 | pr_err(DRV_NAME |
1043 | ": %s: Error %d setting MAC of slave %s\n", | 1040 | ": %s: Error %d setting MAC of slave %s\n", |
1044 | bond->dev->name, -rv, new_active->dev->name); | 1041 | bond->dev->name, -rv, new_active->dev->name); |
1045 | goto out; | 1042 | goto out; |
@@ -1053,7 +1050,7 @@ static void bond_do_fail_over_mac(struct bonding *bond, | |||
1053 | 1050 | ||
1054 | rv = dev_set_mac_address(old_active->dev, &saddr); | 1051 | rv = dev_set_mac_address(old_active->dev, &saddr); |
1055 | if (rv) | 1052 | if (rv) |
1056 | printk(KERN_ERR DRV_NAME | 1053 | pr_err(DRV_NAME |
1057 | ": %s: Error %d setting MAC of slave %s\n", | 1054 | ": %s: Error %d setting MAC of slave %s\n", |
1058 | bond->dev->name, -rv, new_active->dev->name); | 1055 | bond->dev->name, -rv, new_active->dev->name); |
1059 | out: | 1056 | out: |
@@ -1061,7 +1058,7 @@ out: | |||
1061 | write_lock_bh(&bond->curr_slave_lock); | 1058 | write_lock_bh(&bond->curr_slave_lock); |
1062 | break; | 1059 | break; |
1063 | default: | 1060 | default: |
1064 | printk(KERN_ERR DRV_NAME | 1061 | pr_err(DRV_NAME |
1065 | ": %s: bond_do_fail_over_mac impossible: bad policy %d\n", | 1062 | ": %s: bond_do_fail_over_mac impossible: bad policy %d\n", |
1066 | bond->dev->name, bond->params.fail_over_mac); | 1063 | bond->dev->name, bond->params.fail_over_mac); |
1067 | break; | 1064 | break; |
@@ -1086,17 +1083,17 @@ static struct slave *bond_find_best_slave(struct bonding *bond) | |||
1086 | new_active = old_active = bond->curr_active_slave; | 1083 | new_active = old_active = bond->curr_active_slave; |
1087 | 1084 | ||
1088 | if (!new_active) { /* there were no active slaves left */ | 1085 | if (!new_active) { /* there were no active slaves left */ |
1089 | if (bond->slave_cnt > 0) { /* found one slave */ | 1086 | if (bond->slave_cnt > 0) /* found one slave */ |
1090 | new_active = bond->first_slave; | 1087 | new_active = bond->first_slave; |
1091 | } else { | 1088 | else |
1092 | return NULL; /* still no slave, return NULL */ | 1089 | return NULL; /* still no slave, return NULL */ |
1093 | } | ||
1094 | } | 1090 | } |
1095 | 1091 | ||
1096 | /* first try the primary link; if arping, a link must tx/rx traffic | 1092 | /* |
1097 | * before it can be considered the curr_active_slave - also, we would skip | 1093 | * first try the primary link; if arping, a link must tx/rx |
1098 | * slaves between the curr_active_slave and primary_slave that may be up | 1094 | * traffic before it can be considered the curr_active_slave. |
1099 | * and able to arp | 1095 | * also, we would skip slaves between the curr_active_slave |
1096 | * and primary_slave that may be up and able to arp | ||
1100 | */ | 1097 | */ |
1101 | if ((bond->primary_slave) && | 1098 | if ((bond->primary_slave) && |
1102 | (!bond->params.arp_interval) && | 1099 | (!bond->params.arp_interval) && |
@@ -1144,16 +1141,15 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1144 | { | 1141 | { |
1145 | struct slave *old_active = bond->curr_active_slave; | 1142 | struct slave *old_active = bond->curr_active_slave; |
1146 | 1143 | ||
1147 | if (old_active == new_active) { | 1144 | if (old_active == new_active) |
1148 | return; | 1145 | return; |
1149 | } | ||
1150 | 1146 | ||
1151 | if (new_active) { | 1147 | if (new_active) { |
1152 | new_active->jiffies = jiffies; | 1148 | new_active->jiffies = jiffies; |
1153 | 1149 | ||
1154 | if (new_active->link == BOND_LINK_BACK) { | 1150 | if (new_active->link == BOND_LINK_BACK) { |
1155 | if (USES_PRIMARY(bond->params.mode)) { | 1151 | if (USES_PRIMARY(bond->params.mode)) { |
1156 | printk(KERN_INFO DRV_NAME | 1152 | pr_info(DRV_NAME |
1157 | ": %s: making interface %s the new " | 1153 | ": %s: making interface %s the new " |
1158 | "active one %d ms earlier.\n", | 1154 | "active one %d ms earlier.\n", |
1159 | bond->dev->name, new_active->dev->name, | 1155 | bond->dev->name, new_active->dev->name, |
@@ -1163,15 +1159,14 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1163 | new_active->delay = 0; | 1159 | new_active->delay = 0; |
1164 | new_active->link = BOND_LINK_UP; | 1160 | new_active->link = BOND_LINK_UP; |
1165 | 1161 | ||
1166 | if (bond->params.mode == BOND_MODE_8023AD) { | 1162 | if (bond->params.mode == BOND_MODE_8023AD) |
1167 | bond_3ad_handle_link_change(new_active, BOND_LINK_UP); | 1163 | bond_3ad_handle_link_change(new_active, BOND_LINK_UP); |
1168 | } | ||
1169 | 1164 | ||
1170 | if (bond_is_lb(bond)) | 1165 | if (bond_is_lb(bond)) |
1171 | bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); | 1166 | bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); |
1172 | } else { | 1167 | } else { |
1173 | if (USES_PRIMARY(bond->params.mode)) { | 1168 | if (USES_PRIMARY(bond->params.mode)) { |
1174 | printk(KERN_INFO DRV_NAME | 1169 | pr_info(DRV_NAME |
1175 | ": %s: making interface %s the new " | 1170 | ": %s: making interface %s the new " |
1176 | "active one.\n", | 1171 | "active one.\n", |
1177 | bond->dev->name, new_active->dev->name); | 1172 | bond->dev->name, new_active->dev->name); |
@@ -1179,9 +1174,8 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1179 | } | 1174 | } |
1180 | } | 1175 | } |
1181 | 1176 | ||
1182 | if (USES_PRIMARY(bond->params.mode)) { | 1177 | if (USES_PRIMARY(bond->params.mode)) |
1183 | bond_mc_swap(bond, new_active, old_active); | 1178 | bond_mc_swap(bond, new_active, old_active); |
1184 | } | ||
1185 | 1179 | ||
1186 | if (bond_is_lb(bond)) { | 1180 | if (bond_is_lb(bond)) { |
1187 | bond_alb_handle_active_change(bond, new_active); | 1181 | bond_alb_handle_active_change(bond, new_active); |
@@ -1194,9 +1188,8 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1194 | } | 1188 | } |
1195 | 1189 | ||
1196 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { | 1190 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { |
1197 | if (old_active) { | 1191 | if (old_active) |
1198 | bond_set_slave_inactive_flags(old_active); | 1192 | bond_set_slave_inactive_flags(old_active); |
1199 | } | ||
1200 | 1193 | ||
1201 | if (new_active) { | 1194 | if (new_active) { |
1202 | bond_set_slave_active_flags(new_active); | 1195 | bond_set_slave_active_flags(new_active); |
@@ -1226,7 +1219,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1226 | * bond_select_active_slave - select a new active slave, if needed | 1219 | * bond_select_active_slave - select a new active slave, if needed |
1227 | * @bond: our bonding struct | 1220 | * @bond: our bonding struct |
1228 | * | 1221 | * |
1229 | * This functions shoud be called when one of the following occurs: | 1222 | * This functions should be called when one of the following occurs: |
1230 | * - The old curr_active_slave has been released or lost its link. | 1223 | * - The old curr_active_slave has been released or lost its link. |
1231 | * - The primary_slave has got its link back. | 1224 | * - The primary_slave has got its link back. |
1232 | * - A slave has got its link back and there's no old curr_active_slave. | 1225 | * - A slave has got its link back and there's no old curr_active_slave. |
@@ -1246,11 +1239,11 @@ void bond_select_active_slave(struct bonding *bond) | |||
1246 | return; | 1239 | return; |
1247 | 1240 | ||
1248 | if (netif_carrier_ok(bond->dev)) { | 1241 | if (netif_carrier_ok(bond->dev)) { |
1249 | printk(KERN_INFO DRV_NAME | 1242 | pr_info(DRV_NAME |
1250 | ": %s: first active interface up!\n", | 1243 | ": %s: first active interface up!\n", |
1251 | bond->dev->name); | 1244 | bond->dev->name); |
1252 | } else { | 1245 | } else { |
1253 | printk(KERN_INFO DRV_NAME ": %s: " | 1246 | pr_info(DRV_NAME ": %s: " |
1254 | "now running without any active interface !\n", | 1247 | "now running without any active interface !\n", |
1255 | bond->dev->name); | 1248 | bond->dev->name); |
1256 | } | 1249 | } |
@@ -1292,13 +1285,11 @@ static void bond_attach_slave(struct bonding *bond, struct slave *new_slave) | |||
1292 | */ | 1285 | */ |
1293 | static void bond_detach_slave(struct bonding *bond, struct slave *slave) | 1286 | static void bond_detach_slave(struct bonding *bond, struct slave *slave) |
1294 | { | 1287 | { |
1295 | if (slave->next) { | 1288 | if (slave->next) |
1296 | slave->next->prev = slave->prev; | 1289 | slave->next->prev = slave->prev; |
1297 | } | ||
1298 | 1290 | ||
1299 | if (slave->prev) { | 1291 | if (slave->prev) |
1300 | slave->prev->next = slave->next; | 1292 | slave->prev->next = slave->next; |
1301 | } | ||
1302 | 1293 | ||
1303 | if (bond->first_slave == slave) { /* slave is the first slave */ | 1294 | if (bond->first_slave == slave) { /* slave is the first slave */ |
1304 | if (bond->slave_cnt > 1) { /* there are more slave */ | 1295 | if (bond->slave_cnt > 1) { /* there are more slave */ |
@@ -1329,7 +1320,7 @@ static int bond_sethwaddr(struct net_device *bond_dev, | |||
1329 | (NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | \ | 1320 | (NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | \ |
1330 | NETIF_F_HW_VLAN_FILTER) | 1321 | NETIF_F_HW_VLAN_FILTER) |
1331 | 1322 | ||
1332 | /* | 1323 | /* |
1333 | * Compute the common dev->feature set available to all slaves. Some | 1324 | * Compute the common dev->feature set available to all slaves. Some |
1334 | * feature bits are managed elsewhere, so preserve those feature bits | 1325 | * feature bits are managed elsewhere, so preserve those feature bits |
1335 | * on the master device. | 1326 | * on the master device. |
@@ -1397,14 +1388,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1397 | 1388 | ||
1398 | if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL && | 1389 | if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL && |
1399 | slave_ops->ndo_do_ioctl == NULL) { | 1390 | slave_ops->ndo_do_ioctl == NULL) { |
1400 | printk(KERN_WARNING DRV_NAME | 1391 | pr_warning(DRV_NAME |
1401 | ": %s: Warning: no link monitoring support for %s\n", | 1392 | ": %s: Warning: no link monitoring support for %s\n", |
1402 | bond_dev->name, slave_dev->name); | 1393 | bond_dev->name, slave_dev->name); |
1403 | } | 1394 | } |
1404 | 1395 | ||
1405 | /* bond must be initialized by bond_open() before enslaving */ | 1396 | /* bond must be initialized by bond_open() before enslaving */ |
1406 | if (!(bond_dev->flags & IFF_UP)) { | 1397 | if (!(bond_dev->flags & IFF_UP)) { |
1407 | printk(KERN_WARNING DRV_NAME | 1398 | pr_warning(DRV_NAME |
1408 | " %s: master_dev is not up in bond_enslave\n", | 1399 | " %s: master_dev is not up in bond_enslave\n", |
1409 | bond_dev->name); | 1400 | bond_dev->name); |
1410 | } | 1401 | } |
@@ -1420,14 +1411,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1420 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { | 1411 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { |
1421 | pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); | 1412 | pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); |
1422 | if (!list_empty(&bond->vlan_list)) { | 1413 | if (!list_empty(&bond->vlan_list)) { |
1423 | printk(KERN_ERR DRV_NAME | 1414 | pr_err(DRV_NAME |
1424 | ": %s: Error: cannot enslave VLAN " | 1415 | ": %s: Error: cannot enslave VLAN " |
1425 | "challenged slave %s on VLAN enabled " | 1416 | "challenged slave %s on VLAN enabled " |
1426 | "bond %s\n", bond_dev->name, slave_dev->name, | 1417 | "bond %s\n", bond_dev->name, slave_dev->name, |
1427 | bond_dev->name); | 1418 | bond_dev->name); |
1428 | return -EPERM; | 1419 | return -EPERM; |
1429 | } else { | 1420 | } else { |
1430 | printk(KERN_WARNING DRV_NAME | 1421 | pr_warning(DRV_NAME |
1431 | ": %s: Warning: enslaved VLAN challenged " | 1422 | ": %s: Warning: enslaved VLAN challenged " |
1432 | "slave %s. Adding VLANs will be blocked as " | 1423 | "slave %s. Adding VLANs will be blocked as " |
1433 | "long as %s is part of bond %s\n", | 1424 | "long as %s is part of bond %s\n", |
@@ -1447,12 +1438,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1447 | 1438 | ||
1448 | /* | 1439 | /* |
1449 | * Old ifenslave binaries are no longer supported. These can | 1440 | * Old ifenslave binaries are no longer supported. These can |
1450 | * be identified with moderate accurary by the state of the slave: | 1441 | * be identified with moderate accuracy by the state of the slave: |
1451 | * the current ifenslave will set the interface down prior to | 1442 | * the current ifenslave will set the interface down prior to |
1452 | * enslaving it; the old ifenslave will not. | 1443 | * enslaving it; the old ifenslave will not. |
1453 | */ | 1444 | */ |
1454 | if ((slave_dev->flags & IFF_UP)) { | 1445 | if ((slave_dev->flags & IFF_UP)) { |
1455 | printk(KERN_ERR DRV_NAME ": %s is up. " | 1446 | pr_err(DRV_NAME ": %s is up. " |
1456 | "This may be due to an out of date ifenslave.\n", | 1447 | "This may be due to an out of date ifenslave.\n", |
1457 | slave_dev->name); | 1448 | slave_dev->name); |
1458 | res = -EPERM; | 1449 | res = -EPERM; |
@@ -1470,7 +1461,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1470 | if (slave_dev->type != ARPHRD_ETHER) | 1461 | if (slave_dev->type != ARPHRD_ETHER) |
1471 | bond_setup_by_slave(bond_dev, slave_dev); | 1462 | bond_setup_by_slave(bond_dev, slave_dev); |
1472 | } else if (bond_dev->type != slave_dev->type) { | 1463 | } else if (bond_dev->type != slave_dev->type) { |
1473 | printk(KERN_ERR DRV_NAME ": %s ether type (%d) is different " | 1464 | pr_err(DRV_NAME ": %s ether type (%d) is different " |
1474 | "from other slaves (%d), can not enslave it.\n", | 1465 | "from other slaves (%d), can not enslave it.\n", |
1475 | slave_dev->name, | 1466 | slave_dev->name, |
1476 | slave_dev->type, bond_dev->type); | 1467 | slave_dev->type, bond_dev->type); |
@@ -1480,14 +1471,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1480 | 1471 | ||
1481 | if (slave_ops->ndo_set_mac_address == NULL) { | 1472 | if (slave_ops->ndo_set_mac_address == NULL) { |
1482 | if (bond->slave_cnt == 0) { | 1473 | if (bond->slave_cnt == 0) { |
1483 | printk(KERN_WARNING DRV_NAME | 1474 | pr_warning(DRV_NAME |
1484 | ": %s: Warning: The first slave device " | 1475 | ": %s: Warning: The first slave device " |
1485 | "specified does not support setting the MAC " | 1476 | "specified does not support setting the MAC " |
1486 | "address. Setting fail_over_mac to active.", | 1477 | "address. Setting fail_over_mac to active.", |
1487 | bond_dev->name); | 1478 | bond_dev->name); |
1488 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; | 1479 | bond->params.fail_over_mac = BOND_FOM_ACTIVE; |
1489 | } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { | 1480 | } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { |
1490 | printk(KERN_ERR DRV_NAME | 1481 | pr_err(DRV_NAME |
1491 | ": %s: Error: The slave device specified " | 1482 | ": %s: Error: The slave device specified " |
1492 | "does not support setting the MAC address, " | 1483 | "does not support setting the MAC address, " |
1493 | "but fail_over_mac is not set to active.\n" | 1484 | "but fail_over_mac is not set to active.\n" |
@@ -1537,7 +1528,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1537 | /* open the slave since the application closed it */ | 1528 | /* open the slave since the application closed it */ |
1538 | res = dev_open(slave_dev); | 1529 | res = dev_open(slave_dev); |
1539 | if (res) { | 1530 | if (res) { |
1540 | pr_debug("Openning slave %s failed\n", slave_dev->name); | 1531 | pr_debug("Opening slave %s failed\n", slave_dev->name); |
1541 | goto err_unset_master; | 1532 | goto err_unset_master; |
1542 | } | 1533 | } |
1543 | 1534 | ||
@@ -1549,9 +1540,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1549 | * it might fail and we do not want to have to undo everything | 1540 | * it might fail and we do not want to have to undo everything |
1550 | */ | 1541 | */ |
1551 | res = bond_alb_init_slave(bond, new_slave); | 1542 | res = bond_alb_init_slave(bond, new_slave); |
1552 | if (res) { | 1543 | if (res) |
1553 | goto err_close; | 1544 | goto err_close; |
1554 | } | ||
1555 | } | 1545 | } |
1556 | 1546 | ||
1557 | /* If the mode USES_PRIMARY, then the new slave gets the | 1547 | /* If the mode USES_PRIMARY, then the new slave gets the |
@@ -1576,9 +1566,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1576 | 1566 | ||
1577 | netif_addr_lock_bh(bond_dev); | 1567 | netif_addr_lock_bh(bond_dev); |
1578 | /* upload master's mc_list to new slave */ | 1568 | /* upload master's mc_list to new slave */ |
1579 | for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { | 1569 | for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) |
1580 | dev_mc_add (slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); | 1570 | dev_mc_add(slave_dev, dmi->dmi_addr, |
1581 | } | 1571 | dmi->dmi_addrlen, 0); |
1582 | netif_addr_unlock_bh(bond_dev); | 1572 | netif_addr_unlock_bh(bond_dev); |
1583 | } | 1573 | } |
1584 | 1574 | ||
@@ -1619,7 +1609,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1619 | * supported); thus, we don't need to change | 1609 | * supported); thus, we don't need to change |
1620 | * the messages for netif_carrier. | 1610 | * the messages for netif_carrier. |
1621 | */ | 1611 | */ |
1622 | printk(KERN_WARNING DRV_NAME | 1612 | pr_warning(DRV_NAME |
1623 | ": %s: Warning: MII and ETHTOOL support not " | 1613 | ": %s: Warning: MII and ETHTOOL support not " |
1624 | "available for interface %s, and " | 1614 | "available for interface %s, and " |
1625 | "arp_interval/arp_ip_target module parameters " | 1615 | "arp_interval/arp_ip_target module parameters " |
@@ -1628,7 +1618,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1628 | bond_dev->name, slave_dev->name); | 1618 | bond_dev->name, slave_dev->name); |
1629 | } else if (link_reporting == -1) { | 1619 | } else if (link_reporting == -1) { |
1630 | /* unable get link status using mii/ethtool */ | 1620 | /* unable get link status using mii/ethtool */ |
1631 | printk(KERN_WARNING DRV_NAME | 1621 | pr_warning(DRV_NAME |
1632 | ": %s: Warning: can't get link status from " | 1622 | ": %s: Warning: can't get link status from " |
1633 | "interface %s; the network driver associated " | 1623 | "interface %s; the network driver associated " |
1634 | "with this interface does not support MII or " | 1624 | "with this interface does not support MII or " |
@@ -1660,13 +1650,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1660 | 1650 | ||
1661 | if (bond_update_speed_duplex(new_slave) && | 1651 | if (bond_update_speed_duplex(new_slave) && |
1662 | (new_slave->link != BOND_LINK_DOWN)) { | 1652 | (new_slave->link != BOND_LINK_DOWN)) { |
1663 | printk(KERN_WARNING DRV_NAME | 1653 | pr_warning(DRV_NAME |
1664 | ": %s: Warning: failed to get speed and duplex from %s, " | 1654 | ": %s: Warning: failed to get speed and duplex from %s, " |
1665 | "assumed to be 100Mb/sec and Full.\n", | 1655 | "assumed to be 100Mb/sec and Full.\n", |
1666 | bond_dev->name, new_slave->dev->name); | 1656 | bond_dev->name, new_slave->dev->name); |
1667 | 1657 | ||
1668 | if (bond->params.mode == BOND_MODE_8023AD) { | 1658 | if (bond->params.mode == BOND_MODE_8023AD) { |
1669 | printk(KERN_WARNING DRV_NAME | 1659 | pr_warning(DRV_NAME |
1670 | ": %s: Warning: Operation of 802.3ad mode requires ETHTOOL " | 1660 | ": %s: Warning: Operation of 802.3ad mode requires ETHTOOL " |
1671 | "support in base driver for proper aggregator " | 1661 | "support in base driver for proper aggregator " |
1672 | "selection.\n", bond_dev->name); | 1662 | "selection.\n", bond_dev->name); |
@@ -1675,9 +1665,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1675 | 1665 | ||
1676 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { | 1666 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { |
1677 | /* if there is a primary slave, remember it */ | 1667 | /* if there is a primary slave, remember it */ |
1678 | if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { | 1668 | if (strcmp(bond->params.primary, new_slave->dev->name) == 0) |
1679 | bond->primary_slave = new_slave; | 1669 | bond->primary_slave = new_slave; |
1680 | } | ||
1681 | } | 1670 | } |
1682 | 1671 | ||
1683 | write_lock_bh(&bond->curr_slave_lock); | 1672 | write_lock_bh(&bond->curr_slave_lock); |
@@ -1724,9 +1713,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1724 | * anyway (it holds no special properties of the bond device), | 1713 | * anyway (it holds no special properties of the bond device), |
1725 | * so we can change it without calling change_active_interface() | 1714 | * so we can change it without calling change_active_interface() |
1726 | */ | 1715 | */ |
1727 | if (!bond->curr_active_slave) { | 1716 | if (!bond->curr_active_slave) |
1728 | bond->curr_active_slave = new_slave; | 1717 | bond->curr_active_slave = new_slave; |
1729 | } | 1718 | |
1730 | break; | 1719 | break; |
1731 | } /* switch(bond_mode) */ | 1720 | } /* switch(bond_mode) */ |
1732 | 1721 | ||
@@ -1740,7 +1729,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1740 | if (res) | 1729 | if (res) |
1741 | goto err_close; | 1730 | goto err_close; |
1742 | 1731 | ||
1743 | printk(KERN_INFO DRV_NAME | 1732 | pr_info(DRV_NAME |
1744 | ": %s: enslaving %s as a%s interface with a%s link.\n", | 1733 | ": %s: enslaving %s as a%s interface with a%s link.\n", |
1745 | bond_dev->name, slave_dev->name, | 1734 | bond_dev->name, slave_dev->name, |
1746 | new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup", | 1735 | new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup", |
@@ -1772,7 +1761,7 @@ err_free: | |||
1772 | 1761 | ||
1773 | err_undo_flags: | 1762 | err_undo_flags: |
1774 | bond_dev->features = old_features; | 1763 | bond_dev->features = old_features; |
1775 | 1764 | ||
1776 | return res; | 1765 | return res; |
1777 | } | 1766 | } |
1778 | 1767 | ||
@@ -1797,7 +1786,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1797 | /* slave is not a slave or master is not master of this slave */ | 1786 | /* slave is not a slave or master is not master of this slave */ |
1798 | if (!(slave_dev->flags & IFF_SLAVE) || | 1787 | if (!(slave_dev->flags & IFF_SLAVE) || |
1799 | (slave_dev->master != bond_dev)) { | 1788 | (slave_dev->master != bond_dev)) { |
1800 | printk(KERN_ERR DRV_NAME | 1789 | pr_err(DRV_NAME |
1801 | ": %s: Error: cannot release %s.\n", | 1790 | ": %s: Error: cannot release %s.\n", |
1802 | bond_dev->name, slave_dev->name); | 1791 | bond_dev->name, slave_dev->name); |
1803 | return -EINVAL; | 1792 | return -EINVAL; |
@@ -1808,7 +1797,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1808 | slave = bond_get_slave_by_dev(bond, slave_dev); | 1797 | slave = bond_get_slave_by_dev(bond, slave_dev); |
1809 | if (!slave) { | 1798 | if (!slave) { |
1810 | /* not a slave of this bond */ | 1799 | /* not a slave of this bond */ |
1811 | printk(KERN_INFO DRV_NAME | 1800 | pr_info(DRV_NAME |
1812 | ": %s: %s not enslaved\n", | 1801 | ": %s: %s not enslaved\n", |
1813 | bond_dev->name, slave_dev->name); | 1802 | bond_dev->name, slave_dev->name); |
1814 | write_unlock_bh(&bond->lock); | 1803 | write_unlock_bh(&bond->lock); |
@@ -1819,7 +1808,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1819 | mac_addr_differ = memcmp(bond_dev->dev_addr, slave->perm_hwaddr, | 1808 | mac_addr_differ = memcmp(bond_dev->dev_addr, slave->perm_hwaddr, |
1820 | ETH_ALEN); | 1809 | ETH_ALEN); |
1821 | if (!mac_addr_differ && (bond->slave_cnt > 1)) | 1810 | if (!mac_addr_differ && (bond->slave_cnt > 1)) |
1822 | printk(KERN_WARNING DRV_NAME | 1811 | pr_warning(DRV_NAME |
1823 | ": %s: Warning: the permanent HWaddr of %s - " | 1812 | ": %s: Warning: the permanent HWaddr of %s - " |
1824 | "%pM - is still in use by %s. " | 1813 | "%pM - is still in use by %s. " |
1825 | "Set the HWaddr of %s to a different address " | 1814 | "Set the HWaddr of %s to a different address " |
@@ -1837,7 +1826,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1837 | bond_3ad_unbind_slave(slave); | 1826 | bond_3ad_unbind_slave(slave); |
1838 | } | 1827 | } |
1839 | 1828 | ||
1840 | printk(KERN_INFO DRV_NAME | 1829 | pr_info(DRV_NAME |
1841 | ": %s: releasing %s interface %s\n", | 1830 | ": %s: releasing %s interface %s\n", |
1842 | bond_dev->name, | 1831 | bond_dev->name, |
1843 | (slave->state == BOND_STATE_ACTIVE) | 1832 | (slave->state == BOND_STATE_ACTIVE) |
@@ -1853,13 +1842,11 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1853 | 1842 | ||
1854 | bond_compute_features(bond); | 1843 | bond_compute_features(bond); |
1855 | 1844 | ||
1856 | if (bond->primary_slave == slave) { | 1845 | if (bond->primary_slave == slave) |
1857 | bond->primary_slave = NULL; | 1846 | bond->primary_slave = NULL; |
1858 | } | ||
1859 | 1847 | ||
1860 | if (oldcurrent == slave) { | 1848 | if (oldcurrent == slave) |
1861 | bond_change_active_slave(bond, NULL); | 1849 | bond_change_active_slave(bond, NULL); |
1862 | } | ||
1863 | 1850 | ||
1864 | if (bond_is_lb(bond)) { | 1851 | if (bond_is_lb(bond)) { |
1865 | /* Must be called only after the slave has been | 1852 | /* Must be called only after the slave has been |
@@ -1901,18 +1888,18 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1901 | if (list_empty(&bond->vlan_list)) { | 1888 | if (list_empty(&bond->vlan_list)) { |
1902 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; | 1889 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; |
1903 | } else { | 1890 | } else { |
1904 | printk(KERN_WARNING DRV_NAME | 1891 | pr_warning(DRV_NAME |
1905 | ": %s: Warning: clearing HW address of %s while it " | 1892 | ": %s: Warning: clearing HW address of %s while it " |
1906 | "still has VLANs.\n", | 1893 | "still has VLANs.\n", |
1907 | bond_dev->name, bond_dev->name); | 1894 | bond_dev->name, bond_dev->name); |
1908 | printk(KERN_WARNING DRV_NAME | 1895 | pr_warning(DRV_NAME |
1909 | ": %s: When re-adding slaves, make sure the bond's " | 1896 | ": %s: When re-adding slaves, make sure the bond's " |
1910 | "HW address matches its VLANs'.\n", | 1897 | "HW address matches its VLANs'.\n", |
1911 | bond_dev->name); | 1898 | bond_dev->name); |
1912 | } | 1899 | } |
1913 | } else if ((bond_dev->features & NETIF_F_VLAN_CHALLENGED) && | 1900 | } else if ((bond_dev->features & NETIF_F_VLAN_CHALLENGED) && |
1914 | !bond_has_challenged_slaves(bond)) { | 1901 | !bond_has_challenged_slaves(bond)) { |
1915 | printk(KERN_INFO DRV_NAME | 1902 | pr_info(DRV_NAME |
1916 | ": %s: last VLAN challenged slave %s " | 1903 | ": %s: last VLAN challenged slave %s " |
1917 | "left bond %s. VLAN blocking is removed\n", | 1904 | "left bond %s. VLAN blocking is removed\n", |
1918 | bond_dev->name, slave_dev->name, bond_dev->name); | 1905 | bond_dev->name, slave_dev->name, bond_dev->name); |
@@ -1932,14 +1919,12 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1932 | */ | 1919 | */ |
1933 | if (!USES_PRIMARY(bond->params.mode)) { | 1920 | if (!USES_PRIMARY(bond->params.mode)) { |
1934 | /* unset promiscuity level from slave */ | 1921 | /* unset promiscuity level from slave */ |
1935 | if (bond_dev->flags & IFF_PROMISC) { | 1922 | if (bond_dev->flags & IFF_PROMISC) |
1936 | dev_set_promiscuity(slave_dev, -1); | 1923 | dev_set_promiscuity(slave_dev, -1); |
1937 | } | ||
1938 | 1924 | ||
1939 | /* unset allmulti level from slave */ | 1925 | /* unset allmulti level from slave */ |
1940 | if (bond_dev->flags & IFF_ALLMULTI) { | 1926 | if (bond_dev->flags & IFF_ALLMULTI) |
1941 | dev_set_allmulti(slave_dev, -1); | 1927 | dev_set_allmulti(slave_dev, -1); |
1942 | } | ||
1943 | 1928 | ||
1944 | /* flush master's mc_list from slave */ | 1929 | /* flush master's mc_list from slave */ |
1945 | netif_addr_lock_bh(bond_dev); | 1930 | netif_addr_lock_bh(bond_dev); |
@@ -1988,17 +1973,18 @@ static void bond_uninit(struct net_device *bond_dev) | |||
1988 | } | 1973 | } |
1989 | 1974 | ||
1990 | /* | 1975 | /* |
1991 | * First release a slave and than destroy the bond if no more slaves iare left. | 1976 | * First release a slave and than destroy the bond if no more slaves are left. |
1992 | * Must be under rtnl_lock when this function is called. | 1977 | * Must be under rtnl_lock when this function is called. |
1993 | */ | 1978 | */ |
1994 | int bond_release_and_destroy(struct net_device *bond_dev, struct net_device *slave_dev) | 1979 | int bond_release_and_destroy(struct net_device *bond_dev, |
1980 | struct net_device *slave_dev) | ||
1995 | { | 1981 | { |
1996 | struct bonding *bond = netdev_priv(bond_dev); | 1982 | struct bonding *bond = netdev_priv(bond_dev); |
1997 | int ret; | 1983 | int ret; |
1998 | 1984 | ||
1999 | ret = bond_release(bond_dev, slave_dev); | 1985 | ret = bond_release(bond_dev, slave_dev); |
2000 | if ((ret == 0) && (bond->slave_cnt == 0)) { | 1986 | if ((ret == 0) && (bond->slave_cnt == 0)) { |
2001 | printk(KERN_INFO DRV_NAME ": %s: destroying bond %s.\n", | 1987 | pr_info(DRV_NAME ": %s: destroying bond %s.\n", |
2002 | bond_dev->name, bond_dev->name); | 1988 | bond_dev->name, bond_dev->name); |
2003 | unregister_netdevice(bond_dev); | 1989 | unregister_netdevice(bond_dev); |
2004 | } | 1990 | } |
@@ -2019,9 +2005,8 @@ static int bond_release_all(struct net_device *bond_dev) | |||
2019 | 2005 | ||
2020 | netif_carrier_off(bond_dev); | 2006 | netif_carrier_off(bond_dev); |
2021 | 2007 | ||
2022 | if (bond->slave_cnt == 0) { | 2008 | if (bond->slave_cnt == 0) |
2023 | goto out; | 2009 | goto out; |
2024 | } | ||
2025 | 2010 | ||
2026 | bond->current_arp_slave = NULL; | 2011 | bond->current_arp_slave = NULL; |
2027 | bond->primary_slave = NULL; | 2012 | bond->primary_slave = NULL; |
@@ -2031,9 +2016,8 @@ static int bond_release_all(struct net_device *bond_dev) | |||
2031 | /* Inform AD package of unbinding of slave | 2016 | /* Inform AD package of unbinding of slave |
2032 | * before slave is detached from the list. | 2017 | * before slave is detached from the list. |
2033 | */ | 2018 | */ |
2034 | if (bond->params.mode == BOND_MODE_8023AD) { | 2019 | if (bond->params.mode == BOND_MODE_8023AD) |
2035 | bond_3ad_unbind_slave(slave); | 2020 | bond_3ad_unbind_slave(slave); |
2036 | } | ||
2037 | 2021 | ||
2038 | slave_dev = slave->dev; | 2022 | slave_dev = slave->dev; |
2039 | bond_detach_slave(bond, slave); | 2023 | bond_detach_slave(bond, slave); |
@@ -2062,14 +2046,12 @@ static int bond_release_all(struct net_device *bond_dev) | |||
2062 | */ | 2046 | */ |
2063 | if (!USES_PRIMARY(bond->params.mode)) { | 2047 | if (!USES_PRIMARY(bond->params.mode)) { |
2064 | /* unset promiscuity level from slave */ | 2048 | /* unset promiscuity level from slave */ |
2065 | if (bond_dev->flags & IFF_PROMISC) { | 2049 | if (bond_dev->flags & IFF_PROMISC) |
2066 | dev_set_promiscuity(slave_dev, -1); | 2050 | dev_set_promiscuity(slave_dev, -1); |
2067 | } | ||
2068 | 2051 | ||
2069 | /* unset allmulti level from slave */ | 2052 | /* unset allmulti level from slave */ |
2070 | if (bond_dev->flags & IFF_ALLMULTI) { | 2053 | if (bond_dev->flags & IFF_ALLMULTI) |
2071 | dev_set_allmulti(slave_dev, -1); | 2054 | dev_set_allmulti(slave_dev, -1); |
2072 | } | ||
2073 | 2055 | ||
2074 | /* flush master's mc_list from slave */ | 2056 | /* flush master's mc_list from slave */ |
2075 | netif_addr_lock_bh(bond_dev); | 2057 | netif_addr_lock_bh(bond_dev); |
@@ -2104,20 +2086,20 @@ static int bond_release_all(struct net_device *bond_dev) | |||
2104 | */ | 2086 | */ |
2105 | memset(bond_dev->dev_addr, 0, bond_dev->addr_len); | 2087 | memset(bond_dev->dev_addr, 0, bond_dev->addr_len); |
2106 | 2088 | ||
2107 | if (list_empty(&bond->vlan_list)) { | 2089 | if (list_empty(&bond->vlan_list)) |
2108 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; | 2090 | bond_dev->features |= NETIF_F_VLAN_CHALLENGED; |
2109 | } else { | 2091 | else { |
2110 | printk(KERN_WARNING DRV_NAME | 2092 | pr_warning(DRV_NAME |
2111 | ": %s: Warning: clearing HW address of %s while it " | 2093 | ": %s: Warning: clearing HW address of %s while it " |
2112 | "still has VLANs.\n", | 2094 | "still has VLANs.\n", |
2113 | bond_dev->name, bond_dev->name); | 2095 | bond_dev->name, bond_dev->name); |
2114 | printk(KERN_WARNING DRV_NAME | 2096 | pr_warning(DRV_NAME |
2115 | ": %s: When re-adding slaves, make sure the bond's " | 2097 | ": %s: When re-adding slaves, make sure the bond's " |
2116 | "HW address matches its VLANs'.\n", | 2098 | "HW address matches its VLANs'.\n", |
2117 | bond_dev->name); | 2099 | bond_dev->name); |
2118 | } | 2100 | } |
2119 | 2101 | ||
2120 | printk(KERN_INFO DRV_NAME | 2102 | pr_info(DRV_NAME |
2121 | ": %s: released all slaves\n", | 2103 | ": %s: released all slaves\n", |
2122 | bond_dev->name); | 2104 | bond_dev->name); |
2123 | 2105 | ||
@@ -2135,8 +2117,8 @@ out: | |||
2135 | * - <slave_dev> is already active. | 2117 | * - <slave_dev> is already active. |
2136 | * - The link state of <slave_dev> is not BOND_LINK_UP. | 2118 | * - The link state of <slave_dev> is not BOND_LINK_UP. |
2137 | * - <slave_dev> is not running. | 2119 | * - <slave_dev> is not running. |
2138 | * In these cases, this fuction does nothing. | 2120 | * In these cases, this function does nothing. |
2139 | * In the other cases, currnt_slave pointer is changed and 0 is returned. | 2121 | * In the other cases, current_slave pointer is changed and 0 is returned. |
2140 | */ | 2122 | */ |
2141 | static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_device *slave_dev) | 2123 | static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_device *slave_dev) |
2142 | { | 2124 | { |
@@ -2145,15 +2127,12 @@ static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_devi | |||
2145 | struct slave *new_active = NULL; | 2127 | struct slave *new_active = NULL; |
2146 | int res = 0; | 2128 | int res = 0; |
2147 | 2129 | ||
2148 | if (!USES_PRIMARY(bond->params.mode)) { | 2130 | if (!USES_PRIMARY(bond->params.mode)) |
2149 | return -EINVAL; | 2131 | return -EINVAL; |
2150 | } | ||
2151 | 2132 | ||
2152 | /* Verify that master_dev is indeed the master of slave_dev */ | 2133 | /* Verify that master_dev is indeed the master of slave_dev */ |
2153 | if (!(slave_dev->flags & IFF_SLAVE) || | 2134 | if (!(slave_dev->flags & IFF_SLAVE) || (slave_dev->master != bond_dev)) |
2154 | (slave_dev->master != bond_dev)) { | ||
2155 | return -EINVAL; | 2135 | return -EINVAL; |
2156 | } | ||
2157 | 2136 | ||
2158 | read_lock(&bond->lock); | 2137 | read_lock(&bond->lock); |
2159 | 2138 | ||
@@ -2178,9 +2157,8 @@ static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_devi | |||
2178 | write_lock_bh(&bond->curr_slave_lock); | 2157 | write_lock_bh(&bond->curr_slave_lock); |
2179 | bond_change_active_slave(bond, new_active); | 2158 | bond_change_active_slave(bond, new_active); |
2180 | write_unlock_bh(&bond->curr_slave_lock); | 2159 | write_unlock_bh(&bond->curr_slave_lock); |
2181 | } else { | 2160 | } else |
2182 | res = -EINVAL; | 2161 | res = -EINVAL; |
2183 | } | ||
2184 | 2162 | ||
2185 | read_unlock(&bond->lock); | 2163 | read_unlock(&bond->lock); |
2186 | 2164 | ||
@@ -2249,7 +2227,7 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
2249 | slave->link = BOND_LINK_FAIL; | 2227 | slave->link = BOND_LINK_FAIL; |
2250 | slave->delay = bond->params.downdelay; | 2228 | slave->delay = bond->params.downdelay; |
2251 | if (slave->delay) { | 2229 | if (slave->delay) { |
2252 | printk(KERN_INFO DRV_NAME | 2230 | pr_info(DRV_NAME |
2253 | ": %s: link status down for %s" | 2231 | ": %s: link status down for %s" |
2254 | "interface %s, disabling it in %d ms.\n", | 2232 | "interface %s, disabling it in %d ms.\n", |
2255 | bond->dev->name, | 2233 | bond->dev->name, |
@@ -2268,7 +2246,7 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
2268 | */ | 2246 | */ |
2269 | slave->link = BOND_LINK_UP; | 2247 | slave->link = BOND_LINK_UP; |
2270 | slave->jiffies = jiffies; | 2248 | slave->jiffies = jiffies; |
2271 | printk(KERN_INFO DRV_NAME | 2249 | pr_info(DRV_NAME |
2272 | ": %s: link status up again after %d " | 2250 | ": %s: link status up again after %d " |
2273 | "ms for interface %s.\n", | 2251 | "ms for interface %s.\n", |
2274 | bond->dev->name, | 2252 | bond->dev->name, |
@@ -2295,7 +2273,7 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
2295 | slave->delay = bond->params.updelay; | 2273 | slave->delay = bond->params.updelay; |
2296 | 2274 | ||
2297 | if (slave->delay) { | 2275 | if (slave->delay) { |
2298 | printk(KERN_INFO DRV_NAME | 2276 | pr_info(DRV_NAME |
2299 | ": %s: link status up for " | 2277 | ": %s: link status up for " |
2300 | "interface %s, enabling it in %d ms.\n", | 2278 | "interface %s, enabling it in %d ms.\n", |
2301 | bond->dev->name, slave->dev->name, | 2279 | bond->dev->name, slave->dev->name, |
@@ -2307,7 +2285,7 @@ static int bond_miimon_inspect(struct bonding *bond) | |||
2307 | case BOND_LINK_BACK: | 2285 | case BOND_LINK_BACK: |
2308 | if (!link_state) { | 2286 | if (!link_state) { |
2309 | slave->link = BOND_LINK_DOWN; | 2287 | slave->link = BOND_LINK_DOWN; |
2310 | printk(KERN_INFO DRV_NAME | 2288 | pr_info(DRV_NAME |
2311 | ": %s: link status down again after %d " | 2289 | ": %s: link status down again after %d " |
2312 | "ms for interface %s.\n", | 2290 | "ms for interface %s.\n", |
2313 | bond->dev->name, | 2291 | bond->dev->name, |
@@ -2361,7 +2339,7 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2361 | slave->state = BOND_STATE_BACKUP; | 2339 | slave->state = BOND_STATE_BACKUP; |
2362 | } | 2340 | } |
2363 | 2341 | ||
2364 | printk(KERN_INFO DRV_NAME | 2342 | pr_info(DRV_NAME |
2365 | ": %s: link status definitely " | 2343 | ": %s: link status definitely " |
2366 | "up for interface %s.\n", | 2344 | "up for interface %s.\n", |
2367 | bond->dev->name, slave->dev->name); | 2345 | bond->dev->name, slave->dev->name); |
@@ -2390,7 +2368,7 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2390 | bond->params.mode == BOND_MODE_8023AD) | 2368 | bond->params.mode == BOND_MODE_8023AD) |
2391 | bond_set_slave_inactive_flags(slave); | 2369 | bond_set_slave_inactive_flags(slave); |
2392 | 2370 | ||
2393 | printk(KERN_INFO DRV_NAME | 2371 | pr_info(DRV_NAME |
2394 | ": %s: link status definitely down for " | 2372 | ": %s: link status definitely down for " |
2395 | "interface %s, disabling it\n", | 2373 | "interface %s, disabling it\n", |
2396 | bond->dev->name, slave->dev->name); | 2374 | bond->dev->name, slave->dev->name); |
@@ -2409,7 +2387,7 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2409 | continue; | 2387 | continue; |
2410 | 2388 | ||
2411 | default: | 2389 | default: |
2412 | printk(KERN_ERR DRV_NAME | 2390 | pr_err(DRV_NAME |
2413 | ": %s: invalid new link %d on slave %s\n", | 2391 | ": %s: invalid new link %d on slave %s\n", |
2414 | bond->dev->name, slave->new_link, | 2392 | bond->dev->name, slave->new_link, |
2415 | slave->dev->name); | 2393 | slave->dev->name); |
@@ -2530,18 +2508,18 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op, __be32 dest_ | |||
2530 | 2508 | ||
2531 | pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, | 2509 | pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op, |
2532 | slave_dev->name, dest_ip, src_ip, vlan_id); | 2510 | slave_dev->name, dest_ip, src_ip, vlan_id); |
2533 | 2511 | ||
2534 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, | 2512 | skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip, |
2535 | NULL, slave_dev->dev_addr, NULL); | 2513 | NULL, slave_dev->dev_addr, NULL); |
2536 | 2514 | ||
2537 | if (!skb) { | 2515 | if (!skb) { |
2538 | printk(KERN_ERR DRV_NAME ": ARP packet allocation failed\n"); | 2516 | pr_err(DRV_NAME ": ARP packet allocation failed\n"); |
2539 | return; | 2517 | return; |
2540 | } | 2518 | } |
2541 | if (vlan_id) { | 2519 | if (vlan_id) { |
2542 | skb = vlan_put_tag(skb, vlan_id); | 2520 | skb = vlan_put_tag(skb, vlan_id); |
2543 | if (!skb) { | 2521 | if (!skb) { |
2544 | printk(KERN_ERR DRV_NAME ": failed to insert VLAN tag\n"); | 2522 | pr_err(DRV_NAME ": failed to insert VLAN tag\n"); |
2545 | return; | 2523 | return; |
2546 | } | 2524 | } |
2547 | } | 2525 | } |
@@ -2581,7 +2559,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2581 | rv = ip_route_output_key(&init_net, &rt, &fl); | 2559 | rv = ip_route_output_key(&init_net, &rt, &fl); |
2582 | if (rv) { | 2560 | if (rv) { |
2583 | if (net_ratelimit()) { | 2561 | if (net_ratelimit()) { |
2584 | printk(KERN_WARNING DRV_NAME | 2562 | pr_warning(DRV_NAME |
2585 | ": %s: no route to arp_ip_target %pI4\n", | 2563 | ": %s: no route to arp_ip_target %pI4\n", |
2586 | bond->dev->name, &fl.fl4_dst); | 2564 | bond->dev->name, &fl.fl4_dst); |
2587 | } | 2565 | } |
@@ -2618,7 +2596,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave) | |||
2618 | } | 2596 | } |
2619 | 2597 | ||
2620 | if (net_ratelimit()) { | 2598 | if (net_ratelimit()) { |
2621 | printk(KERN_WARNING DRV_NAME | 2599 | pr_warning(DRV_NAME |
2622 | ": %s: no path to arp_ip_target %pI4 via rt.dev %s\n", | 2600 | ": %s: no path to arp_ip_target %pI4 via rt.dev %s\n", |
2623 | bond->dev->name, &fl.fl4_dst, | 2601 | bond->dev->name, &fl.fl4_dst, |
2624 | rt->u.dst.dev ? rt->u.dst.dev->name : "NULL"); | 2602 | rt->u.dst.dev ? rt->u.dst.dev->name : "NULL"); |
@@ -2766,13 +2744,11 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2766 | 2744 | ||
2767 | delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); | 2745 | delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); |
2768 | 2746 | ||
2769 | if (bond->kill_timers) { | 2747 | if (bond->kill_timers) |
2770 | goto out; | 2748 | goto out; |
2771 | } | ||
2772 | 2749 | ||
2773 | if (bond->slave_cnt == 0) { | 2750 | if (bond->slave_cnt == 0) |
2774 | goto re_arm; | 2751 | goto re_arm; |
2775 | } | ||
2776 | 2752 | ||
2777 | read_lock(&bond->curr_slave_lock); | 2753 | read_lock(&bond->curr_slave_lock); |
2778 | oldcurrent = bond->curr_active_slave; | 2754 | oldcurrent = bond->curr_active_slave; |
@@ -2800,14 +2776,14 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2800 | * is closed. | 2776 | * is closed. |
2801 | */ | 2777 | */ |
2802 | if (!oldcurrent) { | 2778 | if (!oldcurrent) { |
2803 | printk(KERN_INFO DRV_NAME | 2779 | pr_info(DRV_NAME |
2804 | ": %s: link status definitely " | 2780 | ": %s: link status definitely " |
2805 | "up for interface %s, ", | 2781 | "up for interface %s, ", |
2806 | bond->dev->name, | 2782 | bond->dev->name, |
2807 | slave->dev->name); | 2783 | slave->dev->name); |
2808 | do_failover = 1; | 2784 | do_failover = 1; |
2809 | } else { | 2785 | } else { |
2810 | printk(KERN_INFO DRV_NAME | 2786 | pr_info(DRV_NAME |
2811 | ": %s: interface %s is now up\n", | 2787 | ": %s: interface %s is now up\n", |
2812 | bond->dev->name, | 2788 | bond->dev->name, |
2813 | slave->dev->name); | 2789 | slave->dev->name); |
@@ -2826,18 +2802,16 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2826 | slave->link = BOND_LINK_DOWN; | 2802 | slave->link = BOND_LINK_DOWN; |
2827 | slave->state = BOND_STATE_BACKUP; | 2803 | slave->state = BOND_STATE_BACKUP; |
2828 | 2804 | ||
2829 | if (slave->link_failure_count < UINT_MAX) { | 2805 | if (slave->link_failure_count < UINT_MAX) |
2830 | slave->link_failure_count++; | 2806 | slave->link_failure_count++; |
2831 | } | ||
2832 | 2807 | ||
2833 | printk(KERN_INFO DRV_NAME | 2808 | pr_info(DRV_NAME |
2834 | ": %s: interface %s is now down.\n", | 2809 | ": %s: interface %s is now down.\n", |
2835 | bond->dev->name, | 2810 | bond->dev->name, |
2836 | slave->dev->name); | 2811 | slave->dev->name); |
2837 | 2812 | ||
2838 | if (slave == oldcurrent) { | 2813 | if (slave == oldcurrent) |
2839 | do_failover = 1; | 2814 | do_failover = 1; |
2840 | } | ||
2841 | } | 2815 | } |
2842 | } | 2816 | } |
2843 | 2817 | ||
@@ -2848,9 +2822,8 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2848 | * do - all replies will be rx'ed on same link causing slaves | 2822 | * do - all replies will be rx'ed on same link causing slaves |
2849 | * to be unstable during low/no traffic periods | 2823 | * to be unstable during low/no traffic periods |
2850 | */ | 2824 | */ |
2851 | if (IS_UP(slave->dev)) { | 2825 | if (IS_UP(slave->dev)) |
2852 | bond_arp_send_all(bond, slave); | 2826 | bond_arp_send_all(bond, slave); |
2853 | } | ||
2854 | } | 2827 | } |
2855 | 2828 | ||
2856 | if (do_failover) { | 2829 | if (do_failover) { |
@@ -2981,7 +2954,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
2981 | bond_change_active_slave(bond, slave); | 2954 | bond_change_active_slave(bond, slave); |
2982 | bond->current_arp_slave = NULL; | 2955 | bond->current_arp_slave = NULL; |
2983 | 2956 | ||
2984 | printk(KERN_INFO DRV_NAME | 2957 | pr_info(DRV_NAME |
2985 | ": %s: %s is up and now the " | 2958 | ": %s: %s is up and now the " |
2986 | "active interface\n", | 2959 | "active interface\n", |
2987 | bond->dev->name, slave->dev->name); | 2960 | bond->dev->name, slave->dev->name); |
@@ -2997,7 +2970,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
2997 | bond_set_slave_inactive_flags(slave); | 2970 | bond_set_slave_inactive_flags(slave); |
2998 | bond->current_arp_slave = NULL; | 2971 | bond->current_arp_slave = NULL; |
2999 | 2972 | ||
3000 | printk(KERN_INFO DRV_NAME | 2973 | pr_info(DRV_NAME |
3001 | ": %s: backup interface %s is now up\n", | 2974 | ": %s: backup interface %s is now up\n", |
3002 | bond->dev->name, slave->dev->name); | 2975 | bond->dev->name, slave->dev->name); |
3003 | } | 2976 | } |
@@ -3013,7 +2986,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
3013 | slave->link = BOND_LINK_DOWN; | 2986 | slave->link = BOND_LINK_DOWN; |
3014 | 2987 | ||
3015 | if (slave == bond->curr_active_slave) { | 2988 | if (slave == bond->curr_active_slave) { |
3016 | printk(KERN_INFO DRV_NAME | 2989 | pr_info(DRV_NAME |
3017 | ": %s: link status down for active " | 2990 | ": %s: link status down for active " |
3018 | "interface %s, disabling it\n", | 2991 | "interface %s, disabling it\n", |
3019 | bond->dev->name, slave->dev->name); | 2992 | bond->dev->name, slave->dev->name); |
@@ -3032,7 +3005,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
3032 | bond->current_arp_slave = NULL; | 3005 | bond->current_arp_slave = NULL; |
3033 | 3006 | ||
3034 | } else if (slave->state == BOND_STATE_BACKUP) { | 3007 | } else if (slave->state == BOND_STATE_BACKUP) { |
3035 | printk(KERN_INFO DRV_NAME | 3008 | pr_info(DRV_NAME |
3036 | ": %s: backup interface %s is now down\n", | 3009 | ": %s: backup interface %s is now down\n", |
3037 | bond->dev->name, slave->dev->name); | 3010 | bond->dev->name, slave->dev->name); |
3038 | 3011 | ||
@@ -3041,7 +3014,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
3041 | break; | 3014 | break; |
3042 | 3015 | ||
3043 | default: | 3016 | default: |
3044 | printk(KERN_ERR DRV_NAME | 3017 | pr_err(DRV_NAME |
3045 | ": %s: impossible: new_link %d on slave %s\n", | 3018 | ": %s: impossible: new_link %d on slave %s\n", |
3046 | bond->dev->name, slave->new_link, | 3019 | bond->dev->name, slave->new_link, |
3047 | slave->dev->name); | 3020 | slave->dev->name); |
@@ -3075,7 +3048,7 @@ static void bond_ab_arp_probe(struct bonding *bond) | |||
3075 | read_lock(&bond->curr_slave_lock); | 3048 | read_lock(&bond->curr_slave_lock); |
3076 | 3049 | ||
3077 | if (bond->current_arp_slave && bond->curr_active_slave) | 3050 | if (bond->current_arp_slave && bond->curr_active_slave) |
3078 | printk("PROBE: c_arp %s && cas %s BAD\n", | 3051 | pr_info(DRV_NAME "PROBE: c_arp %s && cas %s BAD\n", |
3079 | bond->current_arp_slave->dev->name, | 3052 | bond->current_arp_slave->dev->name, |
3080 | bond->curr_active_slave->dev->name); | 3053 | bond->curr_active_slave->dev->name); |
3081 | 3054 | ||
@@ -3125,7 +3098,7 @@ static void bond_ab_arp_probe(struct bonding *bond) | |||
3125 | 3098 | ||
3126 | bond_set_slave_inactive_flags(slave); | 3099 | bond_set_slave_inactive_flags(slave); |
3127 | 3100 | ||
3128 | printk(KERN_INFO DRV_NAME | 3101 | pr_info(DRV_NAME |
3129 | ": %s: backup interface %s is now down.\n", | 3102 | ": %s: backup interface %s is now down.\n", |
3130 | bond->dev->name, slave->dev->name); | 3103 | bond->dev->name, slave->dev->name); |
3131 | } | 3104 | } |
@@ -3175,9 +3148,8 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
3175 | bond_ab_arp_probe(bond); | 3148 | bond_ab_arp_probe(bond); |
3176 | 3149 | ||
3177 | re_arm: | 3150 | re_arm: |
3178 | if (bond->params.arp_interval) { | 3151 | if (bond->params.arp_interval) |
3179 | queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); | 3152 | queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); |
3180 | } | ||
3181 | out: | 3153 | out: |
3182 | read_unlock(&bond->lock); | 3154 | read_unlock(&bond->lock); |
3183 | } | 3155 | } |
@@ -3199,14 +3171,12 @@ static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos) | |||
3199 | read_lock(&dev_base_lock); | 3171 | read_lock(&dev_base_lock); |
3200 | read_lock(&bond->lock); | 3172 | read_lock(&bond->lock); |
3201 | 3173 | ||
3202 | if (*pos == 0) { | 3174 | if (*pos == 0) |
3203 | return SEQ_START_TOKEN; | 3175 | return SEQ_START_TOKEN; |
3204 | } | ||
3205 | 3176 | ||
3206 | bond_for_each_slave(bond, slave, i) { | 3177 | bond_for_each_slave(bond, slave, i) { |
3207 | if (++off == *pos) { | 3178 | if (++off == *pos) |
3208 | return slave; | 3179 | return slave; |
3209 | } | ||
3210 | } | 3180 | } |
3211 | 3181 | ||
3212 | return NULL; | 3182 | return NULL; |
@@ -3218,9 +3188,8 @@ static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
3218 | struct slave *slave = v; | 3188 | struct slave *slave = v; |
3219 | 3189 | ||
3220 | ++*pos; | 3190 | ++*pos; |
3221 | if (v == SEQ_START_TOKEN) { | 3191 | if (v == SEQ_START_TOKEN) |
3222 | return bond->first_slave; | 3192 | return bond->first_slave; |
3223 | } | ||
3224 | 3193 | ||
3225 | slave = slave->next; | 3194 | slave = slave->next; |
3226 | 3195 | ||
@@ -3283,14 +3252,14 @@ static void bond_info_show_master(struct seq_file *seq) | |||
3283 | 3252 | ||
3284 | 3253 | ||
3285 | /* ARP information */ | 3254 | /* ARP information */ |
3286 | if(bond->params.arp_interval > 0) { | 3255 | if (bond->params.arp_interval > 0) { |
3287 | int printed=0; | 3256 | int printed = 0; |
3288 | seq_printf(seq, "ARP Polling Interval (ms): %d\n", | 3257 | seq_printf(seq, "ARP Polling Interval (ms): %d\n", |
3289 | bond->params.arp_interval); | 3258 | bond->params.arp_interval); |
3290 | 3259 | ||
3291 | seq_printf(seq, "ARP IP target/s (n.n.n.n form):"); | 3260 | seq_printf(seq, "ARP IP target/s (n.n.n.n form):"); |
3292 | 3261 | ||
3293 | for(i = 0; (i < BOND_MAX_ARP_TARGETS) ;i++) { | 3262 | for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) { |
3294 | if (!bond->params.arp_targets[i]) | 3263 | if (!bond->params.arp_targets[i]) |
3295 | break; | 3264 | break; |
3296 | if (printed) | 3265 | if (printed) |
@@ -3330,7 +3299,8 @@ static void bond_info_show_master(struct seq_file *seq) | |||
3330 | } | 3299 | } |
3331 | } | 3300 | } |
3332 | 3301 | ||
3333 | static void bond_info_show_slave(struct seq_file *seq, const struct slave *slave) | 3302 | static void bond_info_show_slave(struct seq_file *seq, |
3303 | const struct slave *slave) | ||
3334 | { | 3304 | { |
3335 | struct bonding *bond = seq->private; | 3305 | struct bonding *bond = seq->private; |
3336 | 3306 | ||
@@ -3346,12 +3316,11 @@ static void bond_info_show_slave(struct seq_file *seq, const struct slave *slave | |||
3346 | const struct aggregator *agg | 3316 | const struct aggregator *agg |
3347 | = SLAVE_AD_INFO(slave).port.aggregator; | 3317 | = SLAVE_AD_INFO(slave).port.aggregator; |
3348 | 3318 | ||
3349 | if (agg) { | 3319 | if (agg) |
3350 | seq_printf(seq, "Aggregator ID: %d\n", | 3320 | seq_printf(seq, "Aggregator ID: %d\n", |
3351 | agg->aggregator_identifier); | 3321 | agg->aggregator_identifier); |
3352 | } else { | 3322 | else |
3353 | seq_puts(seq, "Aggregator ID: N/A\n"); | 3323 | seq_puts(seq, "Aggregator ID: N/A\n"); |
3354 | } | ||
3355 | } | 3324 | } |
3356 | } | 3325 | } |
3357 | 3326 | ||
@@ -3360,9 +3329,8 @@ static int bond_info_seq_show(struct seq_file *seq, void *v) | |||
3360 | if (v == SEQ_START_TOKEN) { | 3329 | if (v == SEQ_START_TOKEN) { |
3361 | seq_printf(seq, "%s\n", version); | 3330 | seq_printf(seq, "%s\n", version); |
3362 | bond_info_show_master(seq); | 3331 | bond_info_show_master(seq); |
3363 | } else { | 3332 | } else |
3364 | bond_info_show_slave(seq, v); | 3333 | bond_info_show_slave(seq, v); |
3365 | } | ||
3366 | 3334 | ||
3367 | return 0; | 3335 | return 0; |
3368 | } | 3336 | } |
@@ -3407,13 +3375,12 @@ static int bond_create_proc_entry(struct bonding *bond) | |||
3407 | bond->proc_entry = proc_create_data(bond_dev->name, | 3375 | bond->proc_entry = proc_create_data(bond_dev->name, |
3408 | S_IRUGO, bond_proc_dir, | 3376 | S_IRUGO, bond_proc_dir, |
3409 | &bond_info_fops, bond); | 3377 | &bond_info_fops, bond); |
3410 | if (bond->proc_entry == NULL) { | 3378 | if (bond->proc_entry == NULL) |
3411 | printk(KERN_WARNING DRV_NAME | 3379 | pr_warning(DRV_NAME |
3412 | ": Warning: Cannot create /proc/net/%s/%s\n", | 3380 | ": Warning: Cannot create /proc/net/%s/%s\n", |
3413 | DRV_NAME, bond_dev->name); | 3381 | DRV_NAME, bond_dev->name); |
3414 | } else { | 3382 | else |
3415 | memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ); | 3383 | memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ); |
3416 | } | ||
3417 | } | 3384 | } |
3418 | 3385 | ||
3419 | return 0; | 3386 | return 0; |
@@ -3436,7 +3403,7 @@ static void bond_create_proc_dir(void) | |||
3436 | if (!bond_proc_dir) { | 3403 | if (!bond_proc_dir) { |
3437 | bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net); | 3404 | bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net); |
3438 | if (!bond_proc_dir) | 3405 | if (!bond_proc_dir) |
3439 | printk(KERN_WARNING DRV_NAME | 3406 | pr_warning(DRV_NAME |
3440 | ": Warning: cannot create /proc/net/%s\n", | 3407 | ": Warning: cannot create /proc/net/%s\n", |
3441 | DRV_NAME); | 3408 | DRV_NAME); |
3442 | } | 3409 | } |
@@ -3484,13 +3451,14 @@ static int bond_event_changename(struct bonding *bond) | |||
3484 | bond_remove_proc_entry(bond); | 3451 | bond_remove_proc_entry(bond); |
3485 | bond_create_proc_entry(bond); | 3452 | bond_create_proc_entry(bond); |
3486 | 3453 | ||
3487 | bond_destroy_sysfs_entry(bond); | 3454 | bond_destroy_sysfs_entry(bond); |
3488 | bond_create_sysfs_entry(bond); | 3455 | bond_create_sysfs_entry(bond); |
3489 | 3456 | ||
3490 | return NOTIFY_DONE; | 3457 | return NOTIFY_DONE; |
3491 | } | 3458 | } |
3492 | 3459 | ||
3493 | static int bond_master_netdev_event(unsigned long event, struct net_device *bond_dev) | 3460 | static int bond_master_netdev_event(unsigned long event, |
3461 | struct net_device *bond_dev) | ||
3494 | { | 3462 | { |
3495 | struct bonding *event_bond = netdev_priv(bond_dev); | 3463 | struct bonding *event_bond = netdev_priv(bond_dev); |
3496 | 3464 | ||
@@ -3507,7 +3475,8 @@ static int bond_master_netdev_event(unsigned long event, struct net_device *bond | |||
3507 | return NOTIFY_DONE; | 3475 | return NOTIFY_DONE; |
3508 | } | 3476 | } |
3509 | 3477 | ||
3510 | static int bond_slave_netdev_event(unsigned long event, struct net_device *slave_dev) | 3478 | static int bond_slave_netdev_event(unsigned long event, |
3479 | struct net_device *slave_dev) | ||
3511 | { | 3480 | { |
3512 | struct net_device *bond_dev = slave_dev->master; | 3481 | struct net_device *bond_dev = slave_dev->master; |
3513 | struct bonding *bond = netdev_priv(bond_dev); | 3482 | struct bonding *bond = netdev_priv(bond_dev); |
@@ -3585,7 +3554,8 @@ static int bond_slave_netdev_event(unsigned long event, struct net_device *slave | |||
3585 | * locks for us to safely manipulate the slave devices (RTNL lock, | 3554 | * locks for us to safely manipulate the slave devices (RTNL lock, |
3586 | * dev_probe_lock). | 3555 | * dev_probe_lock). |
3587 | */ | 3556 | */ |
3588 | static int bond_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) | 3557 | static int bond_netdev_event(struct notifier_block *this, |
3558 | unsigned long event, void *ptr) | ||
3589 | { | 3559 | { |
3590 | struct net_device *event_dev = (struct net_device *)ptr; | 3560 | struct net_device *event_dev = (struct net_device *)ptr; |
3591 | 3561 | ||
@@ -3940,9 +3910,9 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd | |||
3940 | switch (cmd) { | 3910 | switch (cmd) { |
3941 | case SIOCGMIIPHY: | 3911 | case SIOCGMIIPHY: |
3942 | mii = if_mii(ifr); | 3912 | mii = if_mii(ifr); |
3943 | if (!mii) { | 3913 | if (!mii) |
3944 | return -EINVAL; | 3914 | return -EINVAL; |
3945 | } | 3915 | |
3946 | mii->phy_id = 0; | 3916 | mii->phy_id = 0; |
3947 | /* Fall Through */ | 3917 | /* Fall Through */ |
3948 | case SIOCGMIIREG: | 3918 | case SIOCGMIIREG: |
@@ -3951,18 +3921,18 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd | |||
3951 | * instead of SIOCGMIIPHY. | 3921 | * instead of SIOCGMIIPHY. |
3952 | */ | 3922 | */ |
3953 | mii = if_mii(ifr); | 3923 | mii = if_mii(ifr); |
3954 | if (!mii) { | 3924 | if (!mii) |
3955 | return -EINVAL; | 3925 | return -EINVAL; |
3956 | } | 3926 | |
3957 | 3927 | ||
3958 | if (mii->reg_num == 1) { | 3928 | if (mii->reg_num == 1) { |
3959 | struct bonding *bond = netdev_priv(bond_dev); | 3929 | struct bonding *bond = netdev_priv(bond_dev); |
3960 | mii->val_out = 0; | 3930 | mii->val_out = 0; |
3961 | read_lock(&bond->lock); | 3931 | read_lock(&bond->lock); |
3962 | read_lock(&bond->curr_slave_lock); | 3932 | read_lock(&bond->curr_slave_lock); |
3963 | if (netif_carrier_ok(bond->dev)) { | 3933 | if (netif_carrier_ok(bond->dev)) |
3964 | mii->val_out = BMSR_LSTATUS; | 3934 | mii->val_out = BMSR_LSTATUS; |
3965 | } | 3935 | |
3966 | read_unlock(&bond->curr_slave_lock); | 3936 | read_unlock(&bond->curr_slave_lock); |
3967 | read_unlock(&bond->lock); | 3937 | read_unlock(&bond->lock); |
3968 | } | 3938 | } |
@@ -3972,32 +3942,26 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd | |||
3972 | case SIOCBONDINFOQUERY: | 3942 | case SIOCBONDINFOQUERY: |
3973 | u_binfo = (struct ifbond __user *)ifr->ifr_data; | 3943 | u_binfo = (struct ifbond __user *)ifr->ifr_data; |
3974 | 3944 | ||
3975 | if (copy_from_user(&k_binfo, u_binfo, sizeof(ifbond))) { | 3945 | if (copy_from_user(&k_binfo, u_binfo, sizeof(ifbond))) |
3976 | return -EFAULT; | 3946 | return -EFAULT; |
3977 | } | ||
3978 | 3947 | ||
3979 | res = bond_info_query(bond_dev, &k_binfo); | 3948 | res = bond_info_query(bond_dev, &k_binfo); |
3980 | if (res == 0) { | 3949 | if (res == 0 && |
3981 | if (copy_to_user(u_binfo, &k_binfo, sizeof(ifbond))) { | 3950 | copy_to_user(u_binfo, &k_binfo, sizeof(ifbond))) |
3982 | return -EFAULT; | 3951 | return -EFAULT; |
3983 | } | ||
3984 | } | ||
3985 | 3952 | ||
3986 | return res; | 3953 | return res; |
3987 | case BOND_SLAVE_INFO_QUERY_OLD: | 3954 | case BOND_SLAVE_INFO_QUERY_OLD: |
3988 | case SIOCBONDSLAVEINFOQUERY: | 3955 | case SIOCBONDSLAVEINFOQUERY: |
3989 | u_sinfo = (struct ifslave __user *)ifr->ifr_data; | 3956 | u_sinfo = (struct ifslave __user *)ifr->ifr_data; |
3990 | 3957 | ||
3991 | if (copy_from_user(&k_sinfo, u_sinfo, sizeof(ifslave))) { | 3958 | if (copy_from_user(&k_sinfo, u_sinfo, sizeof(ifslave))) |
3992 | return -EFAULT; | 3959 | return -EFAULT; |
3993 | } | ||
3994 | 3960 | ||
3995 | res = bond_slave_info_query(bond_dev, &k_sinfo); | 3961 | res = bond_slave_info_query(bond_dev, &k_sinfo); |
3996 | if (res == 0) { | 3962 | if (res == 0 && |
3997 | if (copy_to_user(u_sinfo, &k_sinfo, sizeof(ifslave))) { | 3963 | copy_to_user(u_sinfo, &k_sinfo, sizeof(ifslave))) |
3998 | return -EFAULT; | 3964 | return -EFAULT; |
3999 | } | ||
4000 | } | ||
4001 | 3965 | ||
4002 | return res; | 3966 | return res; |
4003 | default: | 3967 | default: |
@@ -4005,17 +3969,16 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd | |||
4005 | break; | 3969 | break; |
4006 | } | 3970 | } |
4007 | 3971 | ||
4008 | if (!capable(CAP_NET_ADMIN)) { | 3972 | if (!capable(CAP_NET_ADMIN)) |
4009 | return -EPERM; | 3973 | return -EPERM; |
4010 | } | ||
4011 | 3974 | ||
4012 | slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave); | 3975 | slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave); |
4013 | 3976 | ||
4014 | pr_debug("slave_dev=%p: \n", slave_dev); | 3977 | pr_debug("slave_dev=%p: \n", slave_dev); |
4015 | 3978 | ||
4016 | if (!slave_dev) { | 3979 | if (!slave_dev) |
4017 | res = -ENODEV; | 3980 | res = -ENODEV; |
4018 | } else { | 3981 | else { |
4019 | pr_debug("slave_dev->name=%s: \n", slave_dev->name); | 3982 | pr_debug("slave_dev->name=%s: \n", slave_dev->name); |
4020 | switch (cmd) { | 3983 | switch (cmd) { |
4021 | case BOND_ENSLAVE_OLD: | 3984 | case BOND_ENSLAVE_OLD: |
@@ -4052,30 +4015,30 @@ static void bond_set_multicast_list(struct net_device *bond_dev) | |||
4052 | /* | 4015 | /* |
4053 | * Do promisc before checking multicast_mode | 4016 | * Do promisc before checking multicast_mode |
4054 | */ | 4017 | */ |
4055 | if ((bond_dev->flags & IFF_PROMISC) && !(bond->flags & IFF_PROMISC)) { | 4018 | if ((bond_dev->flags & IFF_PROMISC) && !(bond->flags & IFF_PROMISC)) |
4056 | /* | 4019 | /* |
4057 | * FIXME: Need to handle the error when one of the multi-slaves | 4020 | * FIXME: Need to handle the error when one of the multi-slaves |
4058 | * encounters error. | 4021 | * encounters error. |
4059 | */ | 4022 | */ |
4060 | bond_set_promiscuity(bond, 1); | 4023 | bond_set_promiscuity(bond, 1); |
4061 | } | ||
4062 | 4024 | ||
4063 | if (!(bond_dev->flags & IFF_PROMISC) && (bond->flags & IFF_PROMISC)) { | 4025 | |
4026 | if (!(bond_dev->flags & IFF_PROMISC) && (bond->flags & IFF_PROMISC)) | ||
4064 | bond_set_promiscuity(bond, -1); | 4027 | bond_set_promiscuity(bond, -1); |
4065 | } | 4028 | |
4066 | 4029 | ||
4067 | /* set allmulti flag to slaves */ | 4030 | /* set allmulti flag to slaves */ |
4068 | if ((bond_dev->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI)) { | 4031 | if ((bond_dev->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI)) |
4069 | /* | 4032 | /* |
4070 | * FIXME: Need to handle the error when one of the multi-slaves | 4033 | * FIXME: Need to handle the error when one of the multi-slaves |
4071 | * encounters error. | 4034 | * encounters error. |
4072 | */ | 4035 | */ |
4073 | bond_set_allmulti(bond, 1); | 4036 | bond_set_allmulti(bond, 1); |
4074 | } | ||
4075 | 4037 | ||
4076 | if (!(bond_dev->flags & IFF_ALLMULTI) && (bond->flags & IFF_ALLMULTI)) { | 4038 | |
4039 | if (!(bond_dev->flags & IFF_ALLMULTI) && (bond->flags & IFF_ALLMULTI)) | ||
4077 | bond_set_allmulti(bond, -1); | 4040 | bond_set_allmulti(bond, -1); |
4078 | } | 4041 | |
4079 | 4042 | ||
4080 | read_lock(&bond->lock); | 4043 | read_lock(&bond->lock); |
4081 | 4044 | ||
@@ -4083,16 +4046,14 @@ static void bond_set_multicast_list(struct net_device *bond_dev) | |||
4083 | 4046 | ||
4084 | /* looking for addresses to add to slaves' mc list */ | 4047 | /* looking for addresses to add to slaves' mc list */ |
4085 | for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { | 4048 | for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { |
4086 | if (!bond_mc_list_find_dmi(dmi, bond->mc_list)) { | 4049 | if (!bond_mc_list_find_dmi(dmi, bond->mc_list)) |
4087 | bond_mc_add(bond, dmi->dmi_addr, dmi->dmi_addrlen); | 4050 | bond_mc_add(bond, dmi->dmi_addr, dmi->dmi_addrlen); |
4088 | } | ||
4089 | } | 4051 | } |
4090 | 4052 | ||
4091 | /* looking for addresses to delete from slaves' list */ | 4053 | /* looking for addresses to delete from slaves' list */ |
4092 | for (dmi = bond->mc_list; dmi; dmi = dmi->next) { | 4054 | for (dmi = bond->mc_list; dmi; dmi = dmi->next) { |
4093 | if (!bond_mc_list_find_dmi(dmi, bond_dev->mc_list)) { | 4055 | if (!bond_mc_list_find_dmi(dmi, bond_dev->mc_list)) |
4094 | bond_mc_delete(bond, dmi->dmi_addr, dmi->dmi_addrlen); | 4056 | bond_mc_delete(bond, dmi->dmi_addr, dmi->dmi_addrlen); |
4095 | } | ||
4096 | } | 4057 | } |
4097 | 4058 | ||
4098 | /* save master's multicast list */ | 4059 | /* save master's multicast list */ |
@@ -4212,9 +4173,8 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr) | |||
4212 | if (bond->params.fail_over_mac == BOND_FOM_ACTIVE) | 4173 | if (bond->params.fail_over_mac == BOND_FOM_ACTIVE) |
4213 | return 0; | 4174 | return 0; |
4214 | 4175 | ||
4215 | if (!is_valid_ether_addr(sa->sa_data)) { | 4176 | if (!is_valid_ether_addr(sa->sa_data)) |
4216 | return -EADDRNOTAVAIL; | 4177 | return -EADDRNOTAVAIL; |
4217 | } | ||
4218 | 4178 | ||
4219 | /* Can't hold bond->lock with bh disabled here since | 4179 | /* Can't hold bond->lock with bh disabled here since |
4220 | * some base drivers panic. On the other hand we can't | 4180 | * some base drivers panic. On the other hand we can't |
@@ -4285,9 +4245,8 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev | |||
4285 | 4245 | ||
4286 | read_lock(&bond->lock); | 4246 | read_lock(&bond->lock); |
4287 | 4247 | ||
4288 | if (!BOND_IS_OK(bond)) { | 4248 | if (!BOND_IS_OK(bond)) |
4289 | goto out; | 4249 | goto out; |
4290 | } | ||
4291 | 4250 | ||
4292 | /* | 4251 | /* |
4293 | * Concurrent TX may collide on rr_tx_counter; we accept that | 4252 | * Concurrent TX may collide on rr_tx_counter; we accept that |
@@ -4297,9 +4256,8 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev | |||
4297 | 4256 | ||
4298 | bond_for_each_slave(bond, slave, i) { | 4257 | bond_for_each_slave(bond, slave, i) { |
4299 | slave_no--; | 4258 | slave_no--; |
4300 | if (slave_no < 0) { | 4259 | if (slave_no < 0) |
4301 | break; | 4260 | break; |
4302 | } | ||
4303 | } | 4261 | } |
4304 | 4262 | ||
4305 | start_at = slave; | 4263 | start_at = slave; |
@@ -4334,9 +4292,8 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d | |||
4334 | read_lock(&bond->lock); | 4292 | read_lock(&bond->lock); |
4335 | read_lock(&bond->curr_slave_lock); | 4293 | read_lock(&bond->curr_slave_lock); |
4336 | 4294 | ||
4337 | if (!BOND_IS_OK(bond)) { | 4295 | if (!BOND_IS_OK(bond)) |
4338 | goto out; | 4296 | goto out; |
4339 | } | ||
4340 | 4297 | ||
4341 | if (!bond->curr_active_slave) | 4298 | if (!bond->curr_active_slave) |
4342 | goto out; | 4299 | goto out; |
@@ -4344,10 +4301,10 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d | |||
4344 | res = bond_dev_queue_xmit(bond, skb, bond->curr_active_slave->dev); | 4301 | res = bond_dev_queue_xmit(bond, skb, bond->curr_active_slave->dev); |
4345 | 4302 | ||
4346 | out: | 4303 | out: |
4347 | if (res) { | 4304 | if (res) |
4348 | /* no suitable interface, frame not sent */ | 4305 | /* no suitable interface, frame not sent */ |
4349 | dev_kfree_skb(skb); | 4306 | dev_kfree_skb(skb); |
4350 | } | 4307 | |
4351 | read_unlock(&bond->curr_slave_lock); | 4308 | read_unlock(&bond->curr_slave_lock); |
4352 | read_unlock(&bond->lock); | 4309 | read_unlock(&bond->lock); |
4353 | return 0; | 4310 | return 0; |
@@ -4368,17 +4325,15 @@ static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) | |||
4368 | 4325 | ||
4369 | read_lock(&bond->lock); | 4326 | read_lock(&bond->lock); |
4370 | 4327 | ||
4371 | if (!BOND_IS_OK(bond)) { | 4328 | if (!BOND_IS_OK(bond)) |
4372 | goto out; | 4329 | goto out; |
4373 | } | ||
4374 | 4330 | ||
4375 | slave_no = bond->xmit_hash_policy(skb, bond_dev, bond->slave_cnt); | 4331 | slave_no = bond->xmit_hash_policy(skb, bond_dev, bond->slave_cnt); |
4376 | 4332 | ||
4377 | bond_for_each_slave(bond, slave, i) { | 4333 | bond_for_each_slave(bond, slave, i) { |
4378 | slave_no--; | 4334 | slave_no--; |
4379 | if (slave_no < 0) { | 4335 | if (slave_no < 0) |
4380 | break; | 4336 | break; |
4381 | } | ||
4382 | } | 4337 | } |
4383 | 4338 | ||
4384 | start_at = slave; | 4339 | start_at = slave; |
@@ -4414,17 +4369,15 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) | |||
4414 | 4369 | ||
4415 | read_lock(&bond->lock); | 4370 | read_lock(&bond->lock); |
4416 | 4371 | ||
4417 | if (!BOND_IS_OK(bond)) { | 4372 | if (!BOND_IS_OK(bond)) |
4418 | goto out; | 4373 | goto out; |
4419 | } | ||
4420 | 4374 | ||
4421 | read_lock(&bond->curr_slave_lock); | 4375 | read_lock(&bond->curr_slave_lock); |
4422 | start_at = bond->curr_active_slave; | 4376 | start_at = bond->curr_active_slave; |
4423 | read_unlock(&bond->curr_slave_lock); | 4377 | read_unlock(&bond->curr_slave_lock); |
4424 | 4378 | ||
4425 | if (!start_at) { | 4379 | if (!start_at) |
4426 | goto out; | 4380 | goto out; |
4427 | } | ||
4428 | 4381 | ||
4429 | bond_for_each_slave_from(bond, slave, i, start_at) { | 4382 | bond_for_each_slave_from(bond, slave, i, start_at) { |
4430 | if (IS_UP(slave->dev) && | 4383 | if (IS_UP(slave->dev) && |
@@ -4433,7 +4386,7 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) | |||
4433 | if (tx_dev) { | 4386 | if (tx_dev) { |
4434 | struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); | 4387 | struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); |
4435 | if (!skb2) { | 4388 | if (!skb2) { |
4436 | printk(KERN_ERR DRV_NAME | 4389 | pr_err(DRV_NAME |
4437 | ": %s: Error: bond_xmit_broadcast(): " | 4390 | ": %s: Error: bond_xmit_broadcast(): " |
4438 | "skb_clone() failed\n", | 4391 | "skb_clone() failed\n", |
4439 | bond_dev->name); | 4392 | bond_dev->name); |
@@ -4450,15 +4403,14 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) | |||
4450 | } | 4403 | } |
4451 | } | 4404 | } |
4452 | 4405 | ||
4453 | if (tx_dev) { | 4406 | if (tx_dev) |
4454 | res = bond_dev_queue_xmit(bond, skb, tx_dev); | 4407 | res = bond_dev_queue_xmit(bond, skb, tx_dev); |
4455 | } | ||
4456 | 4408 | ||
4457 | out: | 4409 | out: |
4458 | if (res) { | 4410 | if (res) |
4459 | /* no suitable interface, frame not sent */ | 4411 | /* no suitable interface, frame not sent */ |
4460 | dev_kfree_skb(skb); | 4412 | dev_kfree_skb(skb); |
4461 | } | 4413 | |
4462 | /* frame sent to all suitable interfaces */ | 4414 | /* frame sent to all suitable interfaces */ |
4463 | read_unlock(&bond->lock); | 4415 | read_unlock(&bond->lock); |
4464 | return 0; | 4416 | return 0; |
@@ -4502,7 +4454,7 @@ static int bond_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4502 | return bond_alb_xmit(skb, dev); | 4454 | return bond_alb_xmit(skb, dev); |
4503 | default: | 4455 | default: |
4504 | /* Should never happen, mode already checked */ | 4456 | /* Should never happen, mode already checked */ |
4505 | printk(KERN_ERR DRV_NAME ": %s: Error: Unknown bonding mode %d\n", | 4457 | pr_err(DRV_NAME ": %s: Error: Unknown bonding mode %d\n", |
4506 | dev->name, bond->params.mode); | 4458 | dev->name, bond->params.mode); |
4507 | WARN_ON_ONCE(1); | 4459 | WARN_ON_ONCE(1); |
4508 | dev_kfree_skb(skb); | 4460 | dev_kfree_skb(skb); |
@@ -4539,7 +4491,7 @@ void bond_set_mode_ops(struct bonding *bond, int mode) | |||
4539 | break; | 4491 | break; |
4540 | default: | 4492 | default: |
4541 | /* Should never happen, mode already checked */ | 4493 | /* Should never happen, mode already checked */ |
4542 | printk(KERN_ERR DRV_NAME | 4494 | pr_err(DRV_NAME |
4543 | ": %s: Error: Unknown bonding mode %d\n", | 4495 | ": %s: Error: Unknown bonding mode %d\n", |
4544 | bond_dev->name, | 4496 | bond_dev->name, |
4545 | mode); | 4497 | mode); |
@@ -4752,7 +4704,7 @@ static int bond_check_params(struct bond_params *params) | |||
4752 | if (mode) { | 4704 | if (mode) { |
4753 | bond_mode = bond_parse_parm(mode, bond_mode_tbl); | 4705 | bond_mode = bond_parse_parm(mode, bond_mode_tbl); |
4754 | if (bond_mode == -1) { | 4706 | if (bond_mode == -1) { |
4755 | printk(KERN_ERR DRV_NAME | 4707 | pr_err(DRV_NAME |
4756 | ": Error: Invalid bonding mode \"%s\"\n", | 4708 | ": Error: Invalid bonding mode \"%s\"\n", |
4757 | mode == NULL ? "NULL" : mode); | 4709 | mode == NULL ? "NULL" : mode); |
4758 | return -EINVAL; | 4710 | return -EINVAL; |
@@ -4762,16 +4714,16 @@ static int bond_check_params(struct bond_params *params) | |||
4762 | if (xmit_hash_policy) { | 4714 | if (xmit_hash_policy) { |
4763 | if ((bond_mode != BOND_MODE_XOR) && | 4715 | if ((bond_mode != BOND_MODE_XOR) && |
4764 | (bond_mode != BOND_MODE_8023AD)) { | 4716 | (bond_mode != BOND_MODE_8023AD)) { |
4765 | printk(KERN_INFO DRV_NAME | 4717 | pr_info(DRV_NAME |
4766 | ": xor_mode param is irrelevant in mode %s\n", | 4718 | ": xor_mode param is irrelevant in mode %s\n", |
4767 | bond_mode_name(bond_mode)); | 4719 | bond_mode_name(bond_mode)); |
4768 | } else { | 4720 | } else { |
4769 | xmit_hashtype = bond_parse_parm(xmit_hash_policy, | 4721 | xmit_hashtype = bond_parse_parm(xmit_hash_policy, |
4770 | xmit_hashtype_tbl); | 4722 | xmit_hashtype_tbl); |
4771 | if (xmit_hashtype == -1) { | 4723 | if (xmit_hashtype == -1) { |
4772 | printk(KERN_ERR DRV_NAME | 4724 | pr_err(DRV_NAME |
4773 | ": Error: Invalid xmit_hash_policy \"%s\"\n", | 4725 | ": Error: Invalid xmit_hash_policy \"%s\"\n", |
4774 | xmit_hash_policy == NULL ? "NULL" : | 4726 | xmit_hash_policy == NULL ? "NULL" : |
4775 | xmit_hash_policy); | 4727 | xmit_hash_policy); |
4776 | return -EINVAL; | 4728 | return -EINVAL; |
4777 | } | 4729 | } |
@@ -4780,13 +4732,13 @@ static int bond_check_params(struct bond_params *params) | |||
4780 | 4732 | ||
4781 | if (lacp_rate) { | 4733 | if (lacp_rate) { |
4782 | if (bond_mode != BOND_MODE_8023AD) { | 4734 | if (bond_mode != BOND_MODE_8023AD) { |
4783 | printk(KERN_INFO DRV_NAME | 4735 | pr_info(DRV_NAME |
4784 | ": lacp_rate param is irrelevant in mode %s\n", | 4736 | ": lacp_rate param is irrelevant in mode %s\n", |
4785 | bond_mode_name(bond_mode)); | 4737 | bond_mode_name(bond_mode)); |
4786 | } else { | 4738 | } else { |
4787 | lacp_fast = bond_parse_parm(lacp_rate, bond_lacp_tbl); | 4739 | lacp_fast = bond_parse_parm(lacp_rate, bond_lacp_tbl); |
4788 | if (lacp_fast == -1) { | 4740 | if (lacp_fast == -1) { |
4789 | printk(KERN_ERR DRV_NAME | 4741 | pr_err(DRV_NAME |
4790 | ": Error: Invalid lacp rate \"%s\"\n", | 4742 | ": Error: Invalid lacp rate \"%s\"\n", |
4791 | lacp_rate == NULL ? "NULL" : lacp_rate); | 4743 | lacp_rate == NULL ? "NULL" : lacp_rate); |
4792 | return -EINVAL; | 4744 | return -EINVAL; |
@@ -4797,14 +4749,14 @@ static int bond_check_params(struct bond_params *params) | |||
4797 | if (ad_select) { | 4749 | if (ad_select) { |
4798 | params->ad_select = bond_parse_parm(ad_select, ad_select_tbl); | 4750 | params->ad_select = bond_parse_parm(ad_select, ad_select_tbl); |
4799 | if (params->ad_select == -1) { | 4751 | if (params->ad_select == -1) { |
4800 | printk(KERN_ERR DRV_NAME | 4752 | pr_err(DRV_NAME |
4801 | ": Error: Invalid ad_select \"%s\"\n", | 4753 | ": Error: Invalid ad_select \"%s\"\n", |
4802 | ad_select == NULL ? "NULL" : ad_select); | 4754 | ad_select == NULL ? "NULL" : ad_select); |
4803 | return -EINVAL; | 4755 | return -EINVAL; |
4804 | } | 4756 | } |
4805 | 4757 | ||
4806 | if (bond_mode != BOND_MODE_8023AD) { | 4758 | if (bond_mode != BOND_MODE_8023AD) { |
4807 | printk(KERN_WARNING DRV_NAME | 4759 | pr_warning(DRV_NAME |
4808 | ": ad_select param only affects 802.3ad mode\n"); | 4760 | ": ad_select param only affects 802.3ad mode\n"); |
4809 | } | 4761 | } |
4810 | } else { | 4762 | } else { |
@@ -4812,7 +4764,7 @@ static int bond_check_params(struct bond_params *params) | |||
4812 | } | 4764 | } |
4813 | 4765 | ||
4814 | if (max_bonds < 0 || max_bonds > INT_MAX) { | 4766 | if (max_bonds < 0 || max_bonds > INT_MAX) { |
4815 | printk(KERN_WARNING DRV_NAME | 4767 | pr_warning(DRV_NAME |
4816 | ": Warning: max_bonds (%d) not in range %d-%d, so it " | 4768 | ": Warning: max_bonds (%d) not in range %d-%d, so it " |
4817 | "was reset to BOND_DEFAULT_MAX_BONDS (%d)\n", | 4769 | "was reset to BOND_DEFAULT_MAX_BONDS (%d)\n", |
4818 | max_bonds, 0, INT_MAX, BOND_DEFAULT_MAX_BONDS); | 4770 | max_bonds, 0, INT_MAX, BOND_DEFAULT_MAX_BONDS); |
@@ -4820,7 +4772,7 @@ static int bond_check_params(struct bond_params *params) | |||
4820 | } | 4772 | } |
4821 | 4773 | ||
4822 | if (miimon < 0) { | 4774 | if (miimon < 0) { |
4823 | printk(KERN_WARNING DRV_NAME | 4775 | pr_warning(DRV_NAME |
4824 | ": Warning: miimon module parameter (%d), " | 4776 | ": Warning: miimon module parameter (%d), " |
4825 | "not in range 0-%d, so it was reset to %d\n", | 4777 | "not in range 0-%d, so it was reset to %d\n", |
4826 | miimon, INT_MAX, BOND_LINK_MON_INTERV); | 4778 | miimon, INT_MAX, BOND_LINK_MON_INTERV); |
@@ -4828,7 +4780,7 @@ static int bond_check_params(struct bond_params *params) | |||
4828 | } | 4780 | } |
4829 | 4781 | ||
4830 | if (updelay < 0) { | 4782 | if (updelay < 0) { |
4831 | printk(KERN_WARNING DRV_NAME | 4783 | pr_warning(DRV_NAME |
4832 | ": Warning: updelay module parameter (%d), " | 4784 | ": Warning: updelay module parameter (%d), " |
4833 | "not in range 0-%d, so it was reset to 0\n", | 4785 | "not in range 0-%d, so it was reset to 0\n", |
4834 | updelay, INT_MAX); | 4786 | updelay, INT_MAX); |
@@ -4836,7 +4788,7 @@ static int bond_check_params(struct bond_params *params) | |||
4836 | } | 4788 | } |
4837 | 4789 | ||
4838 | if (downdelay < 0) { | 4790 | if (downdelay < 0) { |
4839 | printk(KERN_WARNING DRV_NAME | 4791 | pr_warning(DRV_NAME |
4840 | ": Warning: downdelay module parameter (%d), " | 4792 | ": Warning: downdelay module parameter (%d), " |
4841 | "not in range 0-%d, so it was reset to 0\n", | 4793 | "not in range 0-%d, so it was reset to 0\n", |
4842 | downdelay, INT_MAX); | 4794 | downdelay, INT_MAX); |
@@ -4844,7 +4796,7 @@ static int bond_check_params(struct bond_params *params) | |||
4844 | } | 4796 | } |
4845 | 4797 | ||
4846 | if ((use_carrier != 0) && (use_carrier != 1)) { | 4798 | if ((use_carrier != 0) && (use_carrier != 1)) { |
4847 | printk(KERN_WARNING DRV_NAME | 4799 | pr_warning(DRV_NAME |
4848 | ": Warning: use_carrier module parameter (%d), " | 4800 | ": Warning: use_carrier module parameter (%d), " |
4849 | "not of valid value (0/1), so it was set to 1\n", | 4801 | "not of valid value (0/1), so it was set to 1\n", |
4850 | use_carrier); | 4802 | use_carrier); |
@@ -4852,14 +4804,14 @@ static int bond_check_params(struct bond_params *params) | |||
4852 | } | 4804 | } |
4853 | 4805 | ||
4854 | if (num_grat_arp < 0 || num_grat_arp > 255) { | 4806 | if (num_grat_arp < 0 || num_grat_arp > 255) { |
4855 | printk(KERN_WARNING DRV_NAME | 4807 | pr_warning(DRV_NAME |
4856 | ": Warning: num_grat_arp (%d) not in range 0-255 so it " | 4808 | ": Warning: num_grat_arp (%d) not in range 0-255 so it " |
4857 | "was reset to 1 \n", num_grat_arp); | 4809 | "was reset to 1 \n", num_grat_arp); |
4858 | num_grat_arp = 1; | 4810 | num_grat_arp = 1; |
4859 | } | 4811 | } |
4860 | 4812 | ||
4861 | if (num_unsol_na < 0 || num_unsol_na > 255) { | 4813 | if (num_unsol_na < 0 || num_unsol_na > 255) { |
4862 | printk(KERN_WARNING DRV_NAME | 4814 | pr_warning(DRV_NAME |
4863 | ": Warning: num_unsol_na (%d) not in range 0-255 so it " | 4815 | ": Warning: num_unsol_na (%d) not in range 0-255 so it " |
4864 | "was reset to 1 \n", num_unsol_na); | 4816 | "was reset to 1 \n", num_unsol_na); |
4865 | num_unsol_na = 1; | 4817 | num_unsol_na = 1; |
@@ -4868,12 +4820,12 @@ static int bond_check_params(struct bond_params *params) | |||
4868 | /* reset values for 802.3ad */ | 4820 | /* reset values for 802.3ad */ |
4869 | if (bond_mode == BOND_MODE_8023AD) { | 4821 | if (bond_mode == BOND_MODE_8023AD) { |
4870 | if (!miimon) { | 4822 | if (!miimon) { |
4871 | printk(KERN_WARNING DRV_NAME | 4823 | pr_warning(DRV_NAME |
4872 | ": Warning: miimon must be specified, " | 4824 | ": Warning: miimon must be specified, " |
4873 | "otherwise bonding will not detect link " | 4825 | "otherwise bonding will not detect link " |
4874 | "failure, speed and duplex which are " | 4826 | "failure, speed and duplex which are " |
4875 | "essential for 802.3ad operation\n"); | 4827 | "essential for 802.3ad operation\n"); |
4876 | printk(KERN_WARNING "Forcing miimon to 100msec\n"); | 4828 | pr_warning("Forcing miimon to 100msec\n"); |
4877 | miimon = 100; | 4829 | miimon = 100; |
4878 | } | 4830 | } |
4879 | } | 4831 | } |
@@ -4882,12 +4834,12 @@ static int bond_check_params(struct bond_params *params) | |||
4882 | if ((bond_mode == BOND_MODE_TLB) || | 4834 | if ((bond_mode == BOND_MODE_TLB) || |
4883 | (bond_mode == BOND_MODE_ALB)) { | 4835 | (bond_mode == BOND_MODE_ALB)) { |
4884 | if (!miimon) { | 4836 | if (!miimon) { |
4885 | printk(KERN_WARNING DRV_NAME | 4837 | pr_warning(DRV_NAME |
4886 | ": Warning: miimon must be specified, " | 4838 | ": Warning: miimon must be specified, " |
4887 | "otherwise bonding will not detect link " | 4839 | "otherwise bonding will not detect link " |
4888 | "failure and link speed which are essential " | 4840 | "failure and link speed which are essential " |
4889 | "for TLB/ALB load balancing\n"); | 4841 | "for TLB/ALB load balancing\n"); |
4890 | printk(KERN_WARNING "Forcing miimon to 100msec\n"); | 4842 | pr_warning("Forcing miimon to 100msec\n"); |
4891 | miimon = 100; | 4843 | miimon = 100; |
4892 | } | 4844 | } |
4893 | } | 4845 | } |
@@ -4907,7 +4859,7 @@ static int bond_check_params(struct bond_params *params) | |||
4907 | /* just warn the user the up/down delay will have | 4859 | /* just warn the user the up/down delay will have |
4908 | * no effect since miimon is zero... | 4860 | * no effect since miimon is zero... |
4909 | */ | 4861 | */ |
4910 | printk(KERN_WARNING DRV_NAME | 4862 | pr_warning(DRV_NAME |
4911 | ": Warning: miimon module parameter not set " | 4863 | ": Warning: miimon module parameter not set " |
4912 | "and updelay (%d) or downdelay (%d) module " | 4864 | "and updelay (%d) or downdelay (%d) module " |
4913 | "parameter is set; updelay and downdelay have " | 4865 | "parameter is set; updelay and downdelay have " |
@@ -4917,7 +4869,7 @@ static int bond_check_params(struct bond_params *params) | |||
4917 | } else { | 4869 | } else { |
4918 | /* don't allow arp monitoring */ | 4870 | /* don't allow arp monitoring */ |
4919 | if (arp_interval) { | 4871 | if (arp_interval) { |
4920 | printk(KERN_WARNING DRV_NAME | 4872 | pr_warning(DRV_NAME |
4921 | ": Warning: miimon (%d) and arp_interval (%d) " | 4873 | ": Warning: miimon (%d) and arp_interval (%d) " |
4922 | "can't be used simultaneously, disabling ARP " | 4874 | "can't be used simultaneously, disabling ARP " |
4923 | "monitoring\n", | 4875 | "monitoring\n", |
@@ -4926,7 +4878,7 @@ static int bond_check_params(struct bond_params *params) | |||
4926 | } | 4878 | } |
4927 | 4879 | ||
4928 | if ((updelay % miimon) != 0) { | 4880 | if ((updelay % miimon) != 0) { |
4929 | printk(KERN_WARNING DRV_NAME | 4881 | pr_warning(DRV_NAME |
4930 | ": Warning: updelay (%d) is not a multiple " | 4882 | ": Warning: updelay (%d) is not a multiple " |
4931 | "of miimon (%d), updelay rounded to %d ms\n", | 4883 | "of miimon (%d), updelay rounded to %d ms\n", |
4932 | updelay, miimon, (updelay / miimon) * miimon); | 4884 | updelay, miimon, (updelay / miimon) * miimon); |
@@ -4935,7 +4887,7 @@ static int bond_check_params(struct bond_params *params) | |||
4935 | updelay /= miimon; | 4887 | updelay /= miimon; |
4936 | 4888 | ||
4937 | if ((downdelay % miimon) != 0) { | 4889 | if ((downdelay % miimon) != 0) { |
4938 | printk(KERN_WARNING DRV_NAME | 4890 | pr_warning(DRV_NAME |
4939 | ": Warning: downdelay (%d) is not a multiple " | 4891 | ": Warning: downdelay (%d) is not a multiple " |
4940 | "of miimon (%d), downdelay rounded to %d ms\n", | 4892 | "of miimon (%d), downdelay rounded to %d ms\n", |
4941 | downdelay, miimon, | 4893 | downdelay, miimon, |
@@ -4946,7 +4898,7 @@ static int bond_check_params(struct bond_params *params) | |||
4946 | } | 4898 | } |
4947 | 4899 | ||
4948 | if (arp_interval < 0) { | 4900 | if (arp_interval < 0) { |
4949 | printk(KERN_WARNING DRV_NAME | 4901 | pr_warning(DRV_NAME |
4950 | ": Warning: arp_interval module parameter (%d) " | 4902 | ": Warning: arp_interval module parameter (%d) " |
4951 | ", not in range 0-%d, so it was reset to %d\n", | 4903 | ", not in range 0-%d, so it was reset to %d\n", |
4952 | arp_interval, INT_MAX, BOND_LINK_ARP_INTERV); | 4904 | arp_interval, INT_MAX, BOND_LINK_ARP_INTERV); |
@@ -4959,7 +4911,7 @@ static int bond_check_params(struct bond_params *params) | |||
4959 | /* not complete check, but should be good enough to | 4911 | /* not complete check, but should be good enough to |
4960 | catch mistakes */ | 4912 | catch mistakes */ |
4961 | if (!isdigit(arp_ip_target[arp_ip_count][0])) { | 4913 | if (!isdigit(arp_ip_target[arp_ip_count][0])) { |
4962 | printk(KERN_WARNING DRV_NAME | 4914 | pr_warning(DRV_NAME |
4963 | ": Warning: bad arp_ip_target module parameter " | 4915 | ": Warning: bad arp_ip_target module parameter " |
4964 | "(%s), ARP monitoring will not be performed\n", | 4916 | "(%s), ARP monitoring will not be performed\n", |
4965 | arp_ip_target[arp_ip_count]); | 4917 | arp_ip_target[arp_ip_count]); |
@@ -4972,7 +4924,7 @@ static int bond_check_params(struct bond_params *params) | |||
4972 | 4924 | ||
4973 | if (arp_interval && !arp_ip_count) { | 4925 | if (arp_interval && !arp_ip_count) { |
4974 | /* don't allow arping if no arp_ip_target given... */ | 4926 | /* don't allow arping if no arp_ip_target given... */ |
4975 | printk(KERN_WARNING DRV_NAME | 4927 | pr_warning(DRV_NAME |
4976 | ": Warning: arp_interval module parameter (%d) " | 4928 | ": Warning: arp_interval module parameter (%d) " |
4977 | "specified without providing an arp_ip_target " | 4929 | "specified without providing an arp_ip_target " |
4978 | "parameter, arp_interval was reset to 0\n", | 4930 | "parameter, arp_interval was reset to 0\n", |
@@ -4982,12 +4934,12 @@ static int bond_check_params(struct bond_params *params) | |||
4982 | 4934 | ||
4983 | if (arp_validate) { | 4935 | if (arp_validate) { |
4984 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) { | 4936 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) { |
4985 | printk(KERN_ERR DRV_NAME | 4937 | pr_err(DRV_NAME |
4986 | ": arp_validate only supported in active-backup mode\n"); | 4938 | ": arp_validate only supported in active-backup mode\n"); |
4987 | return -EINVAL; | 4939 | return -EINVAL; |
4988 | } | 4940 | } |
4989 | if (!arp_interval) { | 4941 | if (!arp_interval) { |
4990 | printk(KERN_ERR DRV_NAME | 4942 | pr_err(DRV_NAME |
4991 | ": arp_validate requires arp_interval\n"); | 4943 | ": arp_validate requires arp_interval\n"); |
4992 | return -EINVAL; | 4944 | return -EINVAL; |
4993 | } | 4945 | } |
@@ -4995,7 +4947,7 @@ static int bond_check_params(struct bond_params *params) | |||
4995 | arp_validate_value = bond_parse_parm(arp_validate, | 4947 | arp_validate_value = bond_parse_parm(arp_validate, |
4996 | arp_validate_tbl); | 4948 | arp_validate_tbl); |
4997 | if (arp_validate_value == -1) { | 4949 | if (arp_validate_value == -1) { |
4998 | printk(KERN_ERR DRV_NAME | 4950 | pr_err(DRV_NAME |
4999 | ": Error: invalid arp_validate \"%s\"\n", | 4951 | ": Error: invalid arp_validate \"%s\"\n", |
5000 | arp_validate == NULL ? "NULL" : arp_validate); | 4952 | arp_validate == NULL ? "NULL" : arp_validate); |
5001 | return -EINVAL; | 4953 | return -EINVAL; |
@@ -5004,20 +4956,20 @@ static int bond_check_params(struct bond_params *params) | |||
5004 | arp_validate_value = 0; | 4956 | arp_validate_value = 0; |
5005 | 4957 | ||
5006 | if (miimon) { | 4958 | if (miimon) { |
5007 | printk(KERN_INFO DRV_NAME | 4959 | pr_info(DRV_NAME |
5008 | ": MII link monitoring set to %d ms\n", | 4960 | ": MII link monitoring set to %d ms\n", |
5009 | miimon); | 4961 | miimon); |
5010 | } else if (arp_interval) { | 4962 | } else if (arp_interval) { |
5011 | int i; | 4963 | int i; |
5012 | 4964 | ||
5013 | printk(KERN_INFO DRV_NAME | 4965 | pr_info(DRV_NAME ": ARP monitoring set to %d ms," |
5014 | ": ARP monitoring set to %d ms, validate %s, with %d target(s):", | 4966 | " validate %s, with %d target(s):", |
5015 | arp_interval, | 4967 | arp_interval, |
5016 | arp_validate_tbl[arp_validate_value].modename, | 4968 | arp_validate_tbl[arp_validate_value].modename, |
5017 | arp_ip_count); | 4969 | arp_ip_count); |
5018 | 4970 | ||
5019 | for (i = 0; i < arp_ip_count; i++) | 4971 | for (i = 0; i < arp_ip_count; i++) |
5020 | printk (" %s", arp_ip_target[i]); | 4972 | printk(" %s", arp_ip_target[i]); |
5021 | 4973 | ||
5022 | printk("\n"); | 4974 | printk("\n"); |
5023 | 4975 | ||
@@ -5025,7 +4977,7 @@ static int bond_check_params(struct bond_params *params) | |||
5025 | /* miimon and arp_interval not set, we need one so things | 4977 | /* miimon and arp_interval not set, we need one so things |
5026 | * work as expected, see bonding.txt for details | 4978 | * work as expected, see bonding.txt for details |
5027 | */ | 4979 | */ |
5028 | printk(KERN_WARNING DRV_NAME | 4980 | pr_warning(DRV_NAME |
5029 | ": Warning: either miimon or arp_interval and " | 4981 | ": Warning: either miimon or arp_interval and " |
5030 | "arp_ip_target module parameters must be specified, " | 4982 | "arp_ip_target module parameters must be specified, " |
5031 | "otherwise bonding will not detect link failures! see " | 4983 | "otherwise bonding will not detect link failures! see " |
@@ -5036,7 +4988,7 @@ static int bond_check_params(struct bond_params *params) | |||
5036 | /* currently, using a primary only makes sense | 4988 | /* currently, using a primary only makes sense |
5037 | * in active backup, TLB or ALB modes | 4989 | * in active backup, TLB or ALB modes |
5038 | */ | 4990 | */ |
5039 | printk(KERN_WARNING DRV_NAME | 4991 | pr_warning(DRV_NAME |
5040 | ": Warning: %s primary device specified but has no " | 4992 | ": Warning: %s primary device specified but has no " |
5041 | "effect in %s mode\n", | 4993 | "effect in %s mode\n", |
5042 | primary, bond_mode_name(bond_mode)); | 4994 | primary, bond_mode_name(bond_mode)); |
@@ -5047,14 +4999,14 @@ static int bond_check_params(struct bond_params *params) | |||
5047 | fail_over_mac_value = bond_parse_parm(fail_over_mac, | 4999 | fail_over_mac_value = bond_parse_parm(fail_over_mac, |
5048 | fail_over_mac_tbl); | 5000 | fail_over_mac_tbl); |
5049 | if (fail_over_mac_value == -1) { | 5001 | if (fail_over_mac_value == -1) { |
5050 | printk(KERN_ERR DRV_NAME | 5002 | pr_err(DRV_NAME |
5051 | ": Error: invalid fail_over_mac \"%s\"\n", | 5003 | ": Error: invalid fail_over_mac \"%s\"\n", |
5052 | arp_validate == NULL ? "NULL" : arp_validate); | 5004 | arp_validate == NULL ? "NULL" : arp_validate); |
5053 | return -EINVAL; | 5005 | return -EINVAL; |
5054 | } | 5006 | } |
5055 | 5007 | ||
5056 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) | 5008 | if (bond_mode != BOND_MODE_ACTIVEBACKUP) |
5057 | printk(KERN_WARNING DRV_NAME | 5009 | pr_warning(DRV_NAME |
5058 | ": Warning: fail_over_mac only affects " | 5010 | ": Warning: fail_over_mac only affects " |
5059 | "active-backup mode.\n"); | 5011 | "active-backup mode.\n"); |
5060 | } else { | 5012 | } else { |
@@ -5120,9 +5072,8 @@ int bond_create(const char *name) | |||
5120 | if (name) { | 5072 | if (name) { |
5121 | list_for_each_entry(bond, &bond_dev_list, bond_list) | 5073 | list_for_each_entry(bond, &bond_dev_list, bond_list) |
5122 | if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) { | 5074 | if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) { |
5123 | printk(KERN_ERR DRV_NAME | 5075 | pr_err(DRV_NAME ": cannot add bond %s;" |
5124 | ": cannot add bond %s; it already exists\n", | 5076 | " it already exists\n", name); |
5125 | name); | ||
5126 | res = -EPERM; | 5077 | res = -EPERM; |
5127 | goto out_rtnl; | 5078 | goto out_rtnl; |
5128 | } | 5079 | } |
@@ -5131,8 +5082,7 @@ int bond_create(const char *name) | |||
5131 | bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", | 5082 | bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", |
5132 | ether_setup); | 5083 | ether_setup); |
5133 | if (!bond_dev) { | 5084 | if (!bond_dev) { |
5134 | printk(KERN_ERR DRV_NAME | 5085 | pr_err(DRV_NAME ": %s: eek! can't alloc netdev!\n", |
5135 | ": %s: eek! can't alloc netdev!\n", | ||
5136 | name); | 5086 | name); |
5137 | res = -ENOMEM; | 5087 | res = -ENOMEM; |
5138 | goto out_rtnl; | 5088 | goto out_rtnl; |
@@ -5151,18 +5101,16 @@ int bond_create(const char *name) | |||
5151 | */ | 5101 | */ |
5152 | 5102 | ||
5153 | res = bond_init(bond_dev); | 5103 | res = bond_init(bond_dev); |
5154 | if (res < 0) { | 5104 | if (res < 0) |
5155 | goto out_netdev; | 5105 | goto out_netdev; |
5156 | } | ||
5157 | 5106 | ||
5158 | bond_set_lockdep_class(bond_dev); | 5107 | bond_set_lockdep_class(bond_dev); |
5159 | 5108 | ||
5160 | netif_carrier_off(bond_dev); | 5109 | netif_carrier_off(bond_dev); |
5161 | 5110 | ||
5162 | res = register_netdevice(bond_dev); | 5111 | res = register_netdevice(bond_dev); |
5163 | if (res < 0) { | 5112 | if (res < 0) |
5164 | goto out_bond; | 5113 | goto out_bond; |
5165 | } | ||
5166 | 5114 | ||
5167 | res = bond_create_sysfs_entry(netdev_priv(bond_dev)); | 5115 | res = bond_create_sysfs_entry(netdev_priv(bond_dev)); |
5168 | if (res < 0) | 5116 | if (res < 0) |
@@ -5187,12 +5135,11 @@ static int __init bonding_init(void) | |||
5187 | int i; | 5135 | int i; |
5188 | int res; | 5136 | int res; |
5189 | 5137 | ||
5190 | printk(KERN_INFO "%s", version); | 5138 | pr_info("%s", version); |
5191 | 5139 | ||
5192 | res = bond_check_params(&bonding_defaults); | 5140 | res = bond_check_params(&bonding_defaults); |
5193 | if (res) { | 5141 | if (res) |
5194 | goto out; | 5142 | goto out; |
5195 | } | ||
5196 | 5143 | ||
5197 | bond_create_proc_dir(); | 5144 | bond_create_proc_dir(); |
5198 | 5145 | ||
@@ -5239,13 +5186,3 @@ MODULE_LICENSE("GPL"); | |||
5239 | MODULE_VERSION(DRV_VERSION); | 5186 | MODULE_VERSION(DRV_VERSION); |
5240 | MODULE_DESCRIPTION(DRV_DESCRIPTION ", v" DRV_VERSION); | 5187 | MODULE_DESCRIPTION(DRV_DESCRIPTION ", v" DRV_VERSION); |
5241 | MODULE_AUTHOR("Thomas Davis, tadavis@lbl.gov and many others"); | 5188 | MODULE_AUTHOR("Thomas Davis, tadavis@lbl.gov and many others"); |
5242 | MODULE_SUPPORTED_DEVICE("most ethernet devices"); | ||
5243 | |||
5244 | /* | ||
5245 | * Local variables: | ||
5246 | * c-indent-level: 8 | ||
5247 | * c-basic-offset: 8 | ||
5248 | * tab-width: 8 | ||
5249 | * End: | ||
5250 | */ | ||
5251 | |||
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 72357597fa1b..ecb20208f67c 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * Copyright(c) 2004-2005 Intel Corporation. All rights reserved. | 2 | * Copyright(c) 2004-2005 Intel Corporation. All rights reserved. |
4 | * | 3 | * |
@@ -38,7 +37,7 @@ | |||
38 | 37 | ||
39 | #include "bonding.h" | 38 | #include "bonding.h" |
40 | 39 | ||
41 | #define to_dev(obj) container_of(obj,struct device,kobj) | 40 | #define to_dev(obj) container_of(obj, struct device, kobj) |
42 | #define to_bond(cd) ((struct bonding *)(netdev_priv(to_net_dev(cd)))) | 41 | #define to_bond(cd) ((struct bonding *)(netdev_priv(to_net_dev(cd)))) |
43 | 42 | ||
44 | /*---------------------------- Declarations -------------------------------*/ | 43 | /*---------------------------- Declarations -------------------------------*/ |
@@ -83,7 +82,8 @@ static ssize_t bonding_show_bonds(struct class *cls, char *buf) | |||
83 | * | 82 | * |
84 | */ | 83 | */ |
85 | 84 | ||
86 | static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t count) | 85 | static ssize_t bonding_store_bonds(struct class *cls, |
86 | const char *buffer, size_t count) | ||
87 | { | 87 | { |
88 | char command[IFNAMSIZ + 1] = {0, }; | 88 | char command[IFNAMSIZ + 1] = {0, }; |
89 | char *ifname; | 89 | char *ifname; |
@@ -97,11 +97,11 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t | |||
97 | goto err_no_cmd; | 97 | goto err_no_cmd; |
98 | 98 | ||
99 | if (command[0] == '+') { | 99 | if (command[0] == '+') { |
100 | printk(KERN_INFO DRV_NAME | 100 | pr_info(DRV_NAME |
101 | ": %s is being created...\n", ifname); | 101 | ": %s is being created...\n", ifname); |
102 | rv = bond_create(ifname); | 102 | rv = bond_create(ifname); |
103 | if (rv) { | 103 | if (rv) { |
104 | printk(KERN_INFO DRV_NAME ": Bond creation failed.\n"); | 104 | pr_info(DRV_NAME ": Bond creation failed.\n"); |
105 | res = rv; | 105 | res = rv; |
106 | } | 106 | } |
107 | goto out; | 107 | goto out; |
@@ -118,28 +118,28 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t | |||
118 | */ | 118 | */ |
119 | if (atomic_read(&bond->dev->dev.kobj.kref.refcount) | 119 | if (atomic_read(&bond->dev->dev.kobj.kref.refcount) |
120 | > expected_refcount){ | 120 | > expected_refcount){ |
121 | printk(KERN_INFO DRV_NAME | 121 | pr_info(DRV_NAME |
122 | ": Unable remove bond %s due to open references.\n", | 122 | ": Unable remove bond %s due to open references.\n", |
123 | ifname); | 123 | ifname); |
124 | res = -EPERM; | 124 | res = -EPERM; |
125 | goto out_unlock; | 125 | goto out_unlock; |
126 | } | 126 | } |
127 | printk(KERN_INFO DRV_NAME | 127 | pr_info(DRV_NAME |
128 | ": %s is being deleted...\n", | 128 | ": %s is being deleted...\n", |
129 | bond->dev->name); | 129 | bond->dev->name); |
130 | unregister_netdevice(bond->dev); | 130 | unregister_netdevice(bond->dev); |
131 | goto out_unlock; | 131 | goto out_unlock; |
132 | } | 132 | } |
133 | 133 | ||
134 | printk(KERN_ERR DRV_NAME | 134 | pr_err(DRV_NAME |
135 | ": unable to delete non-existent bond %s\n", ifname); | 135 | ": unable to delete non-existent bond %s\n", ifname); |
136 | res = -ENODEV; | 136 | res = -ENODEV; |
137 | goto out_unlock; | 137 | goto out_unlock; |
138 | } | 138 | } |
139 | 139 | ||
140 | err_no_cmd: | 140 | err_no_cmd: |
141 | printk(KERN_ERR DRV_NAME | 141 | pr_err(DRV_NAME ": no command found in bonding_masters." |
142 | ": no command found in bonding_masters. Use +ifname or -ifname.\n"); | 142 | " Use +ifname or -ifname.\n"); |
143 | return -EPERM; | 143 | return -EPERM; |
144 | 144 | ||
145 | out_unlock: | 145 | out_unlock: |
@@ -155,7 +155,8 @@ out: | |||
155 | static CLASS_ATTR(bonding_masters, S_IWUSR | S_IRUGO, | 155 | static CLASS_ATTR(bonding_masters, S_IWUSR | S_IRUGO, |
156 | bonding_show_bonds, bonding_store_bonds); | 156 | bonding_show_bonds, bonding_store_bonds); |
157 | 157 | ||
158 | int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave) | 158 | int bond_create_slave_symlinks(struct net_device *master, |
159 | struct net_device *slave) | ||
159 | { | 160 | { |
160 | char linkname[IFNAMSIZ+7]; | 161 | char linkname[IFNAMSIZ+7]; |
161 | int ret = 0; | 162 | int ret = 0; |
@@ -166,19 +167,20 @@ int bond_create_slave_symlinks(struct net_device *master, struct net_device *sla | |||
166 | if (ret) | 167 | if (ret) |
167 | return ret; | 168 | return ret; |
168 | /* next, create a link from the master to the slave */ | 169 | /* next, create a link from the master to the slave */ |
169 | sprintf(linkname,"slave_%s",slave->name); | 170 | sprintf(linkname, "slave_%s", slave->name); |
170 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), | 171 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), |
171 | linkname); | 172 | linkname); |
172 | return ret; | 173 | return ret; |
173 | 174 | ||
174 | } | 175 | } |
175 | 176 | ||
176 | void bond_destroy_slave_symlinks(struct net_device *master, struct net_device *slave) | 177 | void bond_destroy_slave_symlinks(struct net_device *master, |
178 | struct net_device *slave) | ||
177 | { | 179 | { |
178 | char linkname[IFNAMSIZ+7]; | 180 | char linkname[IFNAMSIZ+7]; |
179 | 181 | ||
180 | sysfs_remove_link(&(slave->dev.kobj), "master"); | 182 | sysfs_remove_link(&(slave->dev.kobj), "master"); |
181 | sprintf(linkname,"slave_%s",slave->name); | 183 | sprintf(linkname, "slave_%s", slave->name); |
182 | sysfs_remove_link(&(master->dev.kobj), linkname); | 184 | sysfs_remove_link(&(master->dev.kobj), linkname); |
183 | } | 185 | } |
184 | 186 | ||
@@ -252,7 +254,7 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
252 | read_lock(&bond->lock); | 254 | read_lock(&bond->lock); |
253 | bond_for_each_slave(bond, slave, i) | 255 | bond_for_each_slave(bond, slave, i) |
254 | if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { | 256 | if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) { |
255 | printk(KERN_ERR DRV_NAME | 257 | pr_err(DRV_NAME |
256 | ": %s: Interface %s is already enslaved!\n", | 258 | ": %s: Interface %s is already enslaved!\n", |
257 | bond->dev->name, ifname); | 259 | bond->dev->name, ifname); |
258 | ret = -EPERM; | 260 | ret = -EPERM; |
@@ -261,21 +263,20 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
261 | } | 263 | } |
262 | 264 | ||
263 | read_unlock(&bond->lock); | 265 | read_unlock(&bond->lock); |
264 | printk(KERN_INFO DRV_NAME ": %s: Adding slave %s.\n", | 266 | pr_info(DRV_NAME ": %s: Adding slave %s.\n", |
265 | bond->dev->name, ifname); | 267 | bond->dev->name, ifname); |
266 | dev = dev_get_by_name(&init_net, ifname); | 268 | dev = dev_get_by_name(&init_net, ifname); |
267 | if (!dev) { | 269 | if (!dev) { |
268 | printk(KERN_INFO DRV_NAME | 270 | pr_info(DRV_NAME |
269 | ": %s: Interface %s does not exist!\n", | 271 | ": %s: Interface %s does not exist!\n", |
270 | bond->dev->name, ifname); | 272 | bond->dev->name, ifname); |
271 | ret = -EPERM; | 273 | ret = -EPERM; |
272 | goto out; | 274 | goto out; |
273 | } | 275 | } else |
274 | else | ||
275 | dev_put(dev); | 276 | dev_put(dev); |
276 | 277 | ||
277 | if (dev->flags & IFF_UP) { | 278 | if (dev->flags & IFF_UP) { |
278 | printk(KERN_ERR DRV_NAME | 279 | pr_err(DRV_NAME |
279 | ": %s: Error: Unable to enslave %s " | 280 | ": %s: Error: Unable to enslave %s " |
280 | "because it is already up.\n", | 281 | "because it is already up.\n", |
281 | bond->dev->name, dev->name); | 282 | bond->dev->name, dev->name); |
@@ -302,9 +303,9 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
302 | bond_for_each_slave(bond, slave, i) | 303 | bond_for_each_slave(bond, slave, i) |
303 | if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) | 304 | if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) |
304 | slave->original_mtu = original_mtu; | 305 | slave->original_mtu = original_mtu; |
305 | if (res) { | 306 | if (res) |
306 | ret = res; | 307 | ret = res; |
307 | } | 308 | |
308 | goto out; | 309 | goto out; |
309 | } | 310 | } |
310 | 311 | ||
@@ -318,7 +319,7 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
318 | break; | 319 | break; |
319 | } | 320 | } |
320 | if (dev) { | 321 | if (dev) { |
321 | printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n", | 322 | pr_info(DRV_NAME ": %s: Removing slave %s\n", |
322 | bond->dev->name, dev->name); | 323 | bond->dev->name, dev->name); |
323 | res = bond_release(bond->dev, dev); | 324 | res = bond_release(bond->dev, dev); |
324 | if (res) { | 325 | if (res) { |
@@ -327,9 +328,9 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
327 | } | 328 | } |
328 | /* set the slave MTU to the default */ | 329 | /* set the slave MTU to the default */ |
329 | dev_set_mtu(dev, original_mtu); | 330 | dev_set_mtu(dev, original_mtu); |
330 | } | 331 | } else { |
331 | else { | 332 | pr_err(DRV_NAME ": unable to remove non-existent" |
332 | printk(KERN_ERR DRV_NAME ": unable to remove non-existent slave %s for bond %s.\n", | 333 | " slave %s for bond %s.\n", |
333 | ifname, bond->dev->name); | 334 | ifname, bond->dev->name); |
334 | ret = -ENODEV; | 335 | ret = -ENODEV; |
335 | } | 336 | } |
@@ -337,7 +338,7 @@ static ssize_t bonding_store_slaves(struct device *d, | |||
337 | } | 338 | } |
338 | 339 | ||
339 | err_no_cmd: | 340 | err_no_cmd: |
340 | printk(KERN_ERR DRV_NAME ": no command found in slaves file for bond %s. Use +ifname or -ifname.\n", bond->dev->name); | 341 | pr_err(DRV_NAME ": no command found in slaves file for bond %s. Use +ifname or -ifname.\n", bond->dev->name); |
341 | ret = -EPERM; | 342 | ret = -EPERM; |
342 | 343 | ||
343 | out: | 344 | out: |
@@ -345,7 +346,8 @@ out: | |||
345 | return ret; | 346 | return ret; |
346 | } | 347 | } |
347 | 348 | ||
348 | static DEVICE_ATTR(slaves, S_IRUGO | S_IWUSR, bonding_show_slaves, bonding_store_slaves); | 349 | static DEVICE_ATTR(slaves, S_IRUGO | S_IWUSR, bonding_show_slaves, |
350 | bonding_store_slaves); | ||
349 | 351 | ||
350 | /* | 352 | /* |
351 | * Show and set the bonding mode. The bond interface must be down to | 353 | * Show and set the bonding mode. The bond interface must be down to |
@@ -369,16 +371,15 @@ static ssize_t bonding_store_mode(struct device *d, | |||
369 | struct bonding *bond = to_bond(d); | 371 | struct bonding *bond = to_bond(d); |
370 | 372 | ||
371 | if (bond->dev->flags & IFF_UP) { | 373 | if (bond->dev->flags & IFF_UP) { |
372 | printk(KERN_ERR DRV_NAME | 374 | pr_err(DRV_NAME ": unable to update mode of %s" |
373 | ": unable to update mode of %s because interface is up.\n", | 375 | " because interface is up.\n", bond->dev->name); |
374 | bond->dev->name); | ||
375 | ret = -EPERM; | 376 | ret = -EPERM; |
376 | goto out; | 377 | goto out; |
377 | } | 378 | } |
378 | 379 | ||
379 | new_value = bond_parse_parm(buf, bond_mode_tbl); | 380 | new_value = bond_parse_parm(buf, bond_mode_tbl); |
380 | if (new_value < 0) { | 381 | if (new_value < 0) { |
381 | printk(KERN_ERR DRV_NAME | 382 | pr_err(DRV_NAME |
382 | ": %s: Ignoring invalid mode value %.*s.\n", | 383 | ": %s: Ignoring invalid mode value %.*s.\n", |
383 | bond->dev->name, | 384 | bond->dev->name, |
384 | (int)strlen(buf) - 1, buf); | 385 | (int)strlen(buf) - 1, buf); |
@@ -393,17 +394,19 @@ static ssize_t bonding_store_mode(struct device *d, | |||
393 | 394 | ||
394 | bond->params.mode = new_value; | 395 | bond->params.mode = new_value; |
395 | bond_set_mode_ops(bond, bond->params.mode); | 396 | bond_set_mode_ops(bond, bond->params.mode); |
396 | printk(KERN_INFO DRV_NAME ": %s: setting mode to %s (%d).\n", | 397 | pr_info(DRV_NAME ": %s: setting mode to %s (%d).\n", |
397 | bond->dev->name, bond_mode_tbl[new_value].modename, new_value); | 398 | bond->dev->name, bond_mode_tbl[new_value].modename, |
399 | new_value); | ||
398 | } | 400 | } |
399 | out: | 401 | out: |
400 | return ret; | 402 | return ret; |
401 | } | 403 | } |
402 | static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, bonding_show_mode, bonding_store_mode); | 404 | static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, |
405 | bonding_show_mode, bonding_store_mode); | ||
403 | 406 | ||
404 | /* | 407 | /* |
405 | * Show and set the bonding transmit hash method. The bond interface must be down to | 408 | * Show and set the bonding transmit hash method. |
406 | * change the xmit hash policy. | 409 | * The bond interface must be down to change the xmit hash policy. |
407 | */ | 410 | */ |
408 | static ssize_t bonding_show_xmit_hash(struct device *d, | 411 | static ssize_t bonding_show_xmit_hash(struct device *d, |
409 | struct device_attribute *attr, | 412 | struct device_attribute *attr, |
@@ -424,7 +427,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
424 | struct bonding *bond = to_bond(d); | 427 | struct bonding *bond = to_bond(d); |
425 | 428 | ||
426 | if (bond->dev->flags & IFF_UP) { | 429 | if (bond->dev->flags & IFF_UP) { |
427 | printk(KERN_ERR DRV_NAME | 430 | pr_err(DRV_NAME |
428 | "%s: Interface is up. Unable to update xmit policy.\n", | 431 | "%s: Interface is up. Unable to update xmit policy.\n", |
429 | bond->dev->name); | 432 | bond->dev->name); |
430 | ret = -EPERM; | 433 | ret = -EPERM; |
@@ -433,7 +436,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
433 | 436 | ||
434 | new_value = bond_parse_parm(buf, xmit_hashtype_tbl); | 437 | new_value = bond_parse_parm(buf, xmit_hashtype_tbl); |
435 | if (new_value < 0) { | 438 | if (new_value < 0) { |
436 | printk(KERN_ERR DRV_NAME | 439 | pr_err(DRV_NAME |
437 | ": %s: Ignoring invalid xmit hash policy value %.*s.\n", | 440 | ": %s: Ignoring invalid xmit hash policy value %.*s.\n", |
438 | bond->dev->name, | 441 | bond->dev->name, |
439 | (int)strlen(buf) - 1, buf); | 442 | (int)strlen(buf) - 1, buf); |
@@ -442,13 +445,15 @@ static ssize_t bonding_store_xmit_hash(struct device *d, | |||
442 | } else { | 445 | } else { |
443 | bond->params.xmit_policy = new_value; | 446 | bond->params.xmit_policy = new_value; |
444 | bond_set_mode_ops(bond, bond->params.mode); | 447 | bond_set_mode_ops(bond, bond->params.mode); |
445 | printk(KERN_INFO DRV_NAME ": %s: setting xmit hash policy to %s (%d).\n", | 448 | pr_info(DRV_NAME ": %s: setting xmit hash policy to %s (%d).\n", |
446 | bond->dev->name, xmit_hashtype_tbl[new_value].modename, new_value); | 449 | bond->dev->name, |
450 | xmit_hashtype_tbl[new_value].modename, new_value); | ||
447 | } | 451 | } |
448 | out: | 452 | out: |
449 | return ret; | 453 | return ret; |
450 | } | 454 | } |
451 | static DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR, bonding_show_xmit_hash, bonding_store_xmit_hash); | 455 | static DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR, |
456 | bonding_show_xmit_hash, bonding_store_xmit_hash); | ||
452 | 457 | ||
453 | /* | 458 | /* |
454 | * Show and set arp_validate. | 459 | * Show and set arp_validate. |
@@ -473,39 +478,41 @@ static ssize_t bonding_store_arp_validate(struct device *d, | |||
473 | 478 | ||
474 | new_value = bond_parse_parm(buf, arp_validate_tbl); | 479 | new_value = bond_parse_parm(buf, arp_validate_tbl); |
475 | if (new_value < 0) { | 480 | if (new_value < 0) { |
476 | printk(KERN_ERR DRV_NAME | 481 | pr_err(DRV_NAME |
477 | ": %s: Ignoring invalid arp_validate value %s\n", | 482 | ": %s: Ignoring invalid arp_validate value %s\n", |
478 | bond->dev->name, buf); | 483 | bond->dev->name, buf); |
479 | return -EINVAL; | 484 | return -EINVAL; |
480 | } | 485 | } |
481 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { | 486 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { |
482 | printk(KERN_ERR DRV_NAME | 487 | pr_err(DRV_NAME |
483 | ": %s: arp_validate only supported in active-backup mode.\n", | 488 | ": %s: arp_validate only supported in active-backup mode.\n", |
484 | bond->dev->name); | 489 | bond->dev->name); |
485 | return -EINVAL; | 490 | return -EINVAL; |
486 | } | 491 | } |
487 | printk(KERN_INFO DRV_NAME ": %s: setting arp_validate to %s (%d).\n", | 492 | pr_info(DRV_NAME ": %s: setting arp_validate to %s (%d).\n", |
488 | bond->dev->name, arp_validate_tbl[new_value].modename, | 493 | bond->dev->name, arp_validate_tbl[new_value].modename, |
489 | new_value); | 494 | new_value); |
490 | 495 | ||
491 | if (!bond->params.arp_validate && new_value) { | 496 | if (!bond->params.arp_validate && new_value) |
492 | bond_register_arp(bond); | 497 | bond_register_arp(bond); |
493 | } else if (bond->params.arp_validate && !new_value) { | 498 | else if (bond->params.arp_validate && !new_value) |
494 | bond_unregister_arp(bond); | 499 | bond_unregister_arp(bond); |
495 | } | ||
496 | 500 | ||
497 | bond->params.arp_validate = new_value; | 501 | bond->params.arp_validate = new_value; |
498 | 502 | ||
499 | return count; | 503 | return count; |
500 | } | 504 | } |
501 | 505 | ||
502 | static DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate, bonding_store_arp_validate); | 506 | static DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate, |
507 | bonding_store_arp_validate); | ||
503 | 508 | ||
504 | /* | 509 | /* |
505 | * Show and store fail_over_mac. User only allowed to change the | 510 | * Show and store fail_over_mac. User only allowed to change the |
506 | * value when there are no slaves. | 511 | * value when there are no slaves. |
507 | */ | 512 | */ |
508 | static ssize_t bonding_show_fail_over_mac(struct device *d, struct device_attribute *attr, char *buf) | 513 | static ssize_t bonding_show_fail_over_mac(struct device *d, |
514 | struct device_attribute *attr, | ||
515 | char *buf) | ||
509 | { | 516 | { |
510 | struct bonding *bond = to_bond(d); | 517 | struct bonding *bond = to_bond(d); |
511 | 518 | ||
@@ -514,13 +521,15 @@ static ssize_t bonding_show_fail_over_mac(struct device *d, struct device_attrib | |||
514 | bond->params.fail_over_mac); | 521 | bond->params.fail_over_mac); |
515 | } | 522 | } |
516 | 523 | ||
517 | static ssize_t bonding_store_fail_over_mac(struct device *d, struct device_attribute *attr, const char *buf, size_t count) | 524 | static ssize_t bonding_store_fail_over_mac(struct device *d, |
525 | struct device_attribute *attr, | ||
526 | const char *buf, size_t count) | ||
518 | { | 527 | { |
519 | int new_value; | 528 | int new_value; |
520 | struct bonding *bond = to_bond(d); | 529 | struct bonding *bond = to_bond(d); |
521 | 530 | ||
522 | if (bond->slave_cnt != 0) { | 531 | if (bond->slave_cnt != 0) { |
523 | printk(KERN_ERR DRV_NAME | 532 | pr_err(DRV_NAME |
524 | ": %s: Can't alter fail_over_mac with slaves in bond.\n", | 533 | ": %s: Can't alter fail_over_mac with slaves in bond.\n", |
525 | bond->dev->name); | 534 | bond->dev->name); |
526 | return -EPERM; | 535 | return -EPERM; |
@@ -528,21 +537,22 @@ static ssize_t bonding_store_fail_over_mac(struct device *d, struct device_attri | |||
528 | 537 | ||
529 | new_value = bond_parse_parm(buf, fail_over_mac_tbl); | 538 | new_value = bond_parse_parm(buf, fail_over_mac_tbl); |
530 | if (new_value < 0) { | 539 | if (new_value < 0) { |
531 | printk(KERN_ERR DRV_NAME | 540 | pr_err(DRV_NAME |
532 | ": %s: Ignoring invalid fail_over_mac value %s.\n", | 541 | ": %s: Ignoring invalid fail_over_mac value %s.\n", |
533 | bond->dev->name, buf); | 542 | bond->dev->name, buf); |
534 | return -EINVAL; | 543 | return -EINVAL; |
535 | } | 544 | } |
536 | 545 | ||
537 | bond->params.fail_over_mac = new_value; | 546 | bond->params.fail_over_mac = new_value; |
538 | printk(KERN_INFO DRV_NAME ": %s: Setting fail_over_mac to %s (%d).\n", | 547 | pr_info(DRV_NAME ": %s: Setting fail_over_mac to %s (%d).\n", |
539 | bond->dev->name, fail_over_mac_tbl[new_value].modename, | 548 | bond->dev->name, fail_over_mac_tbl[new_value].modename, |
540 | new_value); | 549 | new_value); |
541 | 550 | ||
542 | return count; | 551 | return count; |
543 | } | 552 | } |
544 | 553 | ||
545 | static DEVICE_ATTR(fail_over_mac, S_IRUGO | S_IWUSR, bonding_show_fail_over_mac, bonding_store_fail_over_mac); | 554 | static DEVICE_ATTR(fail_over_mac, S_IRUGO | S_IWUSR, |
555 | bonding_show_fail_over_mac, bonding_store_fail_over_mac); | ||
546 | 556 | ||
547 | /* | 557 | /* |
548 | * Show and set the arp timer interval. There are two tricky bits | 558 | * Show and set the arp timer interval. There are two tricky bits |
@@ -567,28 +577,28 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
567 | struct bonding *bond = to_bond(d); | 577 | struct bonding *bond = to_bond(d); |
568 | 578 | ||
569 | if (sscanf(buf, "%d", &new_value) != 1) { | 579 | if (sscanf(buf, "%d", &new_value) != 1) { |
570 | printk(KERN_ERR DRV_NAME | 580 | pr_err(DRV_NAME |
571 | ": %s: no arp_interval value specified.\n", | 581 | ": %s: no arp_interval value specified.\n", |
572 | bond->dev->name); | 582 | bond->dev->name); |
573 | ret = -EINVAL; | 583 | ret = -EINVAL; |
574 | goto out; | 584 | goto out; |
575 | } | 585 | } |
576 | if (new_value < 0) { | 586 | if (new_value < 0) { |
577 | printk(KERN_ERR DRV_NAME | 587 | pr_err(DRV_NAME |
578 | ": %s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", | 588 | ": %s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", |
579 | bond->dev->name, new_value, INT_MAX); | 589 | bond->dev->name, new_value, INT_MAX); |
580 | ret = -EINVAL; | 590 | ret = -EINVAL; |
581 | goto out; | 591 | goto out; |
582 | } | 592 | } |
583 | 593 | ||
584 | printk(KERN_INFO DRV_NAME | 594 | pr_info(DRV_NAME |
585 | ": %s: Setting ARP monitoring interval to %d.\n", | 595 | ": %s: Setting ARP monitoring interval to %d.\n", |
586 | bond->dev->name, new_value); | 596 | bond->dev->name, new_value); |
587 | bond->params.arp_interval = new_value; | 597 | bond->params.arp_interval = new_value; |
588 | if (bond->params.arp_interval) | 598 | if (bond->params.arp_interval) |
589 | bond->dev->priv_flags |= IFF_MASTER_ARPMON; | 599 | bond->dev->priv_flags |= IFF_MASTER_ARPMON; |
590 | if (bond->params.miimon) { | 600 | if (bond->params.miimon) { |
591 | printk(KERN_INFO DRV_NAME | 601 | pr_info(DRV_NAME |
592 | ": %s: ARP monitoring cannot be used with MII monitoring. " | 602 | ": %s: ARP monitoring cannot be used with MII monitoring. " |
593 | "%s Disabling MII monitoring.\n", | 603 | "%s Disabling MII monitoring.\n", |
594 | bond->dev->name, bond->dev->name); | 604 | bond->dev->name, bond->dev->name); |
@@ -599,7 +609,7 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
599 | } | 609 | } |
600 | } | 610 | } |
601 | if (!bond->params.arp_targets[0]) { | 611 | if (!bond->params.arp_targets[0]) { |
602 | printk(KERN_INFO DRV_NAME | 612 | pr_info(DRV_NAME |
603 | ": %s: ARP monitoring has been set up, " | 613 | ": %s: ARP monitoring has been set up, " |
604 | "but no ARP targets have been specified.\n", | 614 | "but no ARP targets have been specified.\n", |
605 | bond->dev->name); | 615 | bond->dev->name); |
@@ -625,7 +635,8 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
625 | out: | 635 | out: |
626 | return ret; | 636 | return ret; |
627 | } | 637 | } |
628 | static DEVICE_ATTR(arp_interval, S_IRUGO | S_IWUSR , bonding_show_arp_interval, bonding_store_arp_interval); | 638 | static DEVICE_ATTR(arp_interval, S_IRUGO | S_IWUSR, |
639 | bonding_show_arp_interval, bonding_store_arp_interval); | ||
629 | 640 | ||
630 | /* | 641 | /* |
631 | * Show and set the arp targets. | 642 | * Show and set the arp targets. |
@@ -661,7 +672,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
661 | /* look for adds */ | 672 | /* look for adds */ |
662 | if (buf[0] == '+') { | 673 | if (buf[0] == '+') { |
663 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { | 674 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { |
664 | printk(KERN_ERR DRV_NAME | 675 | pr_err(DRV_NAME |
665 | ": %s: invalid ARP target %pI4 specified for addition\n", | 676 | ": %s: invalid ARP target %pI4 specified for addition\n", |
666 | bond->dev->name, &newtarget); | 677 | bond->dev->name, &newtarget); |
667 | ret = -EINVAL; | 678 | ret = -EINVAL; |
@@ -670,14 +681,14 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
670 | /* look for an empty slot to put the target in, and check for dupes */ | 681 | /* look for an empty slot to put the target in, and check for dupes */ |
671 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { | 682 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { |
672 | if (targets[i] == newtarget) { /* duplicate */ | 683 | if (targets[i] == newtarget) { /* duplicate */ |
673 | printk(KERN_ERR DRV_NAME | 684 | pr_err(DRV_NAME |
674 | ": %s: ARP target %pI4 is already present\n", | 685 | ": %s: ARP target %pI4 is already present\n", |
675 | bond->dev->name, &newtarget); | 686 | bond->dev->name, &newtarget); |
676 | ret = -EINVAL; | 687 | ret = -EINVAL; |
677 | goto out; | 688 | goto out; |
678 | } | 689 | } |
679 | if (targets[i] == 0) { | 690 | if (targets[i] == 0) { |
680 | printk(KERN_INFO DRV_NAME | 691 | pr_info(DRV_NAME |
681 | ": %s: adding ARP target %pI4.\n", | 692 | ": %s: adding ARP target %pI4.\n", |
682 | bond->dev->name, &newtarget); | 693 | bond->dev->name, &newtarget); |
683 | done = 1; | 694 | done = 1; |
@@ -685,17 +696,16 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
685 | } | 696 | } |
686 | } | 697 | } |
687 | if (!done) { | 698 | if (!done) { |
688 | printk(KERN_ERR DRV_NAME | 699 | pr_err(DRV_NAME |
689 | ": %s: ARP target table is full!\n", | 700 | ": %s: ARP target table is full!\n", |
690 | bond->dev->name); | 701 | bond->dev->name); |
691 | ret = -EINVAL; | 702 | ret = -EINVAL; |
692 | goto out; | 703 | goto out; |
693 | } | 704 | } |
694 | 705 | ||
695 | } | 706 | } else if (buf[0] == '-') { |
696 | else if (buf[0] == '-') { | ||
697 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { | 707 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { |
698 | printk(KERN_ERR DRV_NAME | 708 | pr_err(DRV_NAME |
699 | ": %s: invalid ARP target %pI4 specified for removal\n", | 709 | ": %s: invalid ARP target %pI4 specified for removal\n", |
700 | bond->dev->name, &newtarget); | 710 | bond->dev->name, &newtarget); |
701 | ret = -EINVAL; | 711 | ret = -EINVAL; |
@@ -705,7 +715,7 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
705 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { | 715 | for (i = 0; (i < BOND_MAX_ARP_TARGETS) && !done; i++) { |
706 | if (targets[i] == newtarget) { | 716 | if (targets[i] == newtarget) { |
707 | int j; | 717 | int j; |
708 | printk(KERN_INFO DRV_NAME | 718 | pr_info(DRV_NAME |
709 | ": %s: removing ARP target %pI4.\n", | 719 | ": %s: removing ARP target %pI4.\n", |
710 | bond->dev->name, &newtarget); | 720 | bond->dev->name, &newtarget); |
711 | for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++) | 721 | for (j = i; (j < (BOND_MAX_ARP_TARGETS-1)) && targets[j+1]; j++) |
@@ -716,15 +726,15 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
716 | } | 726 | } |
717 | } | 727 | } |
718 | if (!done) { | 728 | if (!done) { |
719 | printk(KERN_INFO DRV_NAME | 729 | pr_info(DRV_NAME |
720 | ": %s: unable to remove nonexistent ARP target %pI4.\n", | 730 | ": %s: unable to remove nonexistent ARP target %pI4.\n", |
721 | bond->dev->name, &newtarget); | 731 | bond->dev->name, &newtarget); |
722 | ret = -EINVAL; | 732 | ret = -EINVAL; |
723 | goto out; | 733 | goto out; |
724 | } | 734 | } |
725 | } | 735 | } else { |
726 | else { | 736 | pr_err(DRV_NAME ": no command found in arp_ip_targets file" |
727 | printk(KERN_ERR DRV_NAME ": no command found in arp_ip_targets file for bond %s. Use +<addr> or -<addr>.\n", | 737 | " for bond %s. Use +<addr> or -<addr>.\n", |
728 | bond->dev->name); | 738 | bond->dev->name); |
729 | ret = -EPERM; | 739 | ret = -EPERM; |
730 | goto out; | 740 | goto out; |
@@ -757,7 +767,7 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
757 | struct bonding *bond = to_bond(d); | 767 | struct bonding *bond = to_bond(d); |
758 | 768 | ||
759 | if (!(bond->params.miimon)) { | 769 | if (!(bond->params.miimon)) { |
760 | printk(KERN_ERR DRV_NAME | 770 | pr_err(DRV_NAME |
761 | ": %s: Unable to set down delay as MII monitoring is disabled\n", | 771 | ": %s: Unable to set down delay as MII monitoring is disabled\n", |
762 | bond->dev->name); | 772 | bond->dev->name); |
763 | ret = -EPERM; | 773 | ret = -EPERM; |
@@ -765,14 +775,14 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
765 | } | 775 | } |
766 | 776 | ||
767 | if (sscanf(buf, "%d", &new_value) != 1) { | 777 | if (sscanf(buf, "%d", &new_value) != 1) { |
768 | printk(KERN_ERR DRV_NAME | 778 | pr_err(DRV_NAME |
769 | ": %s: no down delay value specified.\n", | 779 | ": %s: no down delay value specified.\n", |
770 | bond->dev->name); | 780 | bond->dev->name); |
771 | ret = -EINVAL; | 781 | ret = -EINVAL; |
772 | goto out; | 782 | goto out; |
773 | } | 783 | } |
774 | if (new_value < 0) { | 784 | if (new_value < 0) { |
775 | printk(KERN_ERR DRV_NAME | 785 | pr_err(DRV_NAME |
776 | ": %s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 786 | ": %s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
777 | bond->dev->name, new_value, 1, INT_MAX); | 787 | bond->dev->name, new_value, 1, INT_MAX); |
778 | ret = -EINVAL; | 788 | ret = -EINVAL; |
@@ -787,15 +797,17 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
787 | bond->params.miimon); | 797 | bond->params.miimon); |
788 | } | 798 | } |
789 | bond->params.downdelay = new_value / bond->params.miimon; | 799 | bond->params.downdelay = new_value / bond->params.miimon; |
790 | printk(KERN_INFO DRV_NAME ": %s: Setting down delay to %d.\n", | 800 | pr_info(DRV_NAME ": %s: Setting down delay to %d.\n", |
791 | bond->dev->name, bond->params.downdelay * bond->params.miimon); | 801 | bond->dev->name, |
802 | bond->params.downdelay * bond->params.miimon); | ||
792 | 803 | ||
793 | } | 804 | } |
794 | 805 | ||
795 | out: | 806 | out: |
796 | return ret; | 807 | return ret; |
797 | } | 808 | } |
798 | static DEVICE_ATTR(downdelay, S_IRUGO | S_IWUSR , bonding_show_downdelay, bonding_store_downdelay); | 809 | static DEVICE_ATTR(downdelay, S_IRUGO | S_IWUSR, |
810 | bonding_show_downdelay, bonding_store_downdelay); | ||
799 | 811 | ||
800 | static ssize_t bonding_show_updelay(struct device *d, | 812 | static ssize_t bonding_show_updelay(struct device *d, |
801 | struct device_attribute *attr, | 813 | struct device_attribute *attr, |
@@ -815,7 +827,7 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
815 | struct bonding *bond = to_bond(d); | 827 | struct bonding *bond = to_bond(d); |
816 | 828 | ||
817 | if (!(bond->params.miimon)) { | 829 | if (!(bond->params.miimon)) { |
818 | printk(KERN_ERR DRV_NAME | 830 | pr_err(DRV_NAME |
819 | ": %s: Unable to set up delay as MII monitoring is disabled\n", | 831 | ": %s: Unable to set up delay as MII monitoring is disabled\n", |
820 | bond->dev->name); | 832 | bond->dev->name); |
821 | ret = -EPERM; | 833 | ret = -EPERM; |
@@ -823,14 +835,14 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
823 | } | 835 | } |
824 | 836 | ||
825 | if (sscanf(buf, "%d", &new_value) != 1) { | 837 | if (sscanf(buf, "%d", &new_value) != 1) { |
826 | printk(KERN_ERR DRV_NAME | 838 | pr_err(DRV_NAME |
827 | ": %s: no up delay value specified.\n", | 839 | ": %s: no up delay value specified.\n", |
828 | bond->dev->name); | 840 | bond->dev->name); |
829 | ret = -EINVAL; | 841 | ret = -EINVAL; |
830 | goto out; | 842 | goto out; |
831 | } | 843 | } |
832 | if (new_value < 0) { | 844 | if (new_value < 0) { |
833 | printk(KERN_ERR DRV_NAME | 845 | pr_err(DRV_NAME |
834 | ": %s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 846 | ": %s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
835 | bond->dev->name, new_value, 1, INT_MAX); | 847 | bond->dev->name, new_value, 1, INT_MAX); |
836 | ret = -EINVAL; | 848 | ret = -EINVAL; |
@@ -845,7 +857,7 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
845 | bond->params.miimon); | 857 | bond->params.miimon); |
846 | } | 858 | } |
847 | bond->params.updelay = new_value / bond->params.miimon; | 859 | bond->params.updelay = new_value / bond->params.miimon; |
848 | printk(KERN_INFO DRV_NAME ": %s: Setting up delay to %d.\n", | 860 | pr_info(DRV_NAME ": %s: Setting up delay to %d.\n", |
849 | bond->dev->name, bond->params.updelay * bond->params.miimon); | 861 | bond->dev->name, bond->params.updelay * bond->params.miimon); |
850 | 862 | ||
851 | } | 863 | } |
@@ -853,7 +865,8 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
853 | out: | 865 | out: |
854 | return ret; | 866 | return ret; |
855 | } | 867 | } |
856 | static DEVICE_ATTR(updelay, S_IRUGO | S_IWUSR , bonding_show_updelay, bonding_store_updelay); | 868 | static DEVICE_ATTR(updelay, S_IRUGO | S_IWUSR, |
869 | bonding_show_updelay, bonding_store_updelay); | ||
857 | 870 | ||
858 | /* | 871 | /* |
859 | * Show and set the LACP interval. Interface must be down, and the mode | 872 | * Show and set the LACP interval. Interface must be down, and the mode |
@@ -878,7 +891,7 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
878 | struct bonding *bond = to_bond(d); | 891 | struct bonding *bond = to_bond(d); |
879 | 892 | ||
880 | if (bond->dev->flags & IFF_UP) { | 893 | if (bond->dev->flags & IFF_UP) { |
881 | printk(KERN_ERR DRV_NAME | 894 | pr_err(DRV_NAME |
882 | ": %s: Unable to update LACP rate because interface is up.\n", | 895 | ": %s: Unable to update LACP rate because interface is up.\n", |
883 | bond->dev->name); | 896 | bond->dev->name); |
884 | ret = -EPERM; | 897 | ret = -EPERM; |
@@ -886,7 +899,7 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
886 | } | 899 | } |
887 | 900 | ||
888 | if (bond->params.mode != BOND_MODE_8023AD) { | 901 | if (bond->params.mode != BOND_MODE_8023AD) { |
889 | printk(KERN_ERR DRV_NAME | 902 | pr_err(DRV_NAME |
890 | ": %s: Unable to update LACP rate because bond is not in 802.3ad mode.\n", | 903 | ": %s: Unable to update LACP rate because bond is not in 802.3ad mode.\n", |
891 | bond->dev->name); | 904 | bond->dev->name); |
892 | ret = -EPERM; | 905 | ret = -EPERM; |
@@ -897,19 +910,20 @@ static ssize_t bonding_store_lacp(struct device *d, | |||
897 | 910 | ||
898 | if ((new_value == 1) || (new_value == 0)) { | 911 | if ((new_value == 1) || (new_value == 0)) { |
899 | bond->params.lacp_fast = new_value; | 912 | bond->params.lacp_fast = new_value; |
900 | printk(KERN_INFO DRV_NAME | 913 | pr_info(DRV_NAME ": %s: Setting LACP rate to %s (%d).\n", |
901 | ": %s: Setting LACP rate to %s (%d).\n", | 914 | bond->dev->name, bond_lacp_tbl[new_value].modename, |
902 | bond->dev->name, bond_lacp_tbl[new_value].modename, new_value); | 915 | new_value); |
903 | } else { | 916 | } else { |
904 | printk(KERN_ERR DRV_NAME | 917 | pr_err(DRV_NAME |
905 | ": %s: Ignoring invalid LACP rate value %.*s.\n", | 918 | ": %s: Ignoring invalid LACP rate value %.*s.\n", |
906 | bond->dev->name, (int)strlen(buf) - 1, buf); | 919 | bond->dev->name, (int)strlen(buf) - 1, buf); |
907 | ret = -EINVAL; | 920 | ret = -EINVAL; |
908 | } | 921 | } |
909 | out: | 922 | out: |
910 | return ret; | 923 | return ret; |
911 | } | 924 | } |
912 | static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, bonding_show_lacp, bonding_store_lacp); | 925 | static DEVICE_ATTR(lacp_rate, S_IRUGO | S_IWUSR, |
926 | bonding_show_lacp, bonding_store_lacp); | ||
913 | 927 | ||
914 | static ssize_t bonding_show_ad_select(struct device *d, | 928 | static ssize_t bonding_show_ad_select(struct device *d, |
915 | struct device_attribute *attr, | 929 | struct device_attribute *attr, |
@@ -931,7 +945,7 @@ static ssize_t bonding_store_ad_select(struct device *d, | |||
931 | struct bonding *bond = to_bond(d); | 945 | struct bonding *bond = to_bond(d); |
932 | 946 | ||
933 | if (bond->dev->flags & IFF_UP) { | 947 | if (bond->dev->flags & IFF_UP) { |
934 | printk(KERN_ERR DRV_NAME | 948 | pr_err(DRV_NAME |
935 | ": %s: Unable to update ad_select because interface " | 949 | ": %s: Unable to update ad_select because interface " |
936 | "is up.\n", bond->dev->name); | 950 | "is up.\n", bond->dev->name); |
937 | ret = -EPERM; | 951 | ret = -EPERM; |
@@ -942,12 +956,12 @@ static ssize_t bonding_store_ad_select(struct device *d, | |||
942 | 956 | ||
943 | if (new_value != -1) { | 957 | if (new_value != -1) { |
944 | bond->params.ad_select = new_value; | 958 | bond->params.ad_select = new_value; |
945 | printk(KERN_INFO DRV_NAME | 959 | pr_info(DRV_NAME |
946 | ": %s: Setting ad_select to %s (%d).\n", | 960 | ": %s: Setting ad_select to %s (%d).\n", |
947 | bond->dev->name, ad_select_tbl[new_value].modename, | 961 | bond->dev->name, ad_select_tbl[new_value].modename, |
948 | new_value); | 962 | new_value); |
949 | } else { | 963 | } else { |
950 | printk(KERN_ERR DRV_NAME | 964 | pr_err(DRV_NAME |
951 | ": %s: Ignoring invalid ad_select value %.*s.\n", | 965 | ": %s: Ignoring invalid ad_select value %.*s.\n", |
952 | bond->dev->name, (int)strlen(buf) - 1, buf); | 966 | bond->dev->name, (int)strlen(buf) - 1, buf); |
953 | ret = -EINVAL; | 967 | ret = -EINVAL; |
@@ -955,8 +969,8 @@ static ssize_t bonding_store_ad_select(struct device *d, | |||
955 | out: | 969 | out: |
956 | return ret; | 970 | return ret; |
957 | } | 971 | } |
958 | 972 | static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR, | |
959 | static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR, bonding_show_ad_select, bonding_store_ad_select); | 973 | bonding_show_ad_select, bonding_store_ad_select); |
960 | 974 | ||
961 | /* | 975 | /* |
962 | * Show and set the number of grat ARP to send after a failover event. | 976 | * Show and set the number of grat ARP to send after a failover event. |
@@ -978,14 +992,14 @@ static ssize_t bonding_store_n_grat_arp(struct device *d, | |||
978 | struct bonding *bond = to_bond(d); | 992 | struct bonding *bond = to_bond(d); |
979 | 993 | ||
980 | if (sscanf(buf, "%d", &new_value) != 1) { | 994 | if (sscanf(buf, "%d", &new_value) != 1) { |
981 | printk(KERN_ERR DRV_NAME | 995 | pr_err(DRV_NAME |
982 | ": %s: no num_grat_arp value specified.\n", | 996 | ": %s: no num_grat_arp value specified.\n", |
983 | bond->dev->name); | 997 | bond->dev->name); |
984 | ret = -EINVAL; | 998 | ret = -EINVAL; |
985 | goto out; | 999 | goto out; |
986 | } | 1000 | } |
987 | if (new_value < 0 || new_value > 255) { | 1001 | if (new_value < 0 || new_value > 255) { |
988 | printk(KERN_ERR DRV_NAME | 1002 | pr_err(DRV_NAME |
989 | ": %s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n", | 1003 | ": %s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n", |
990 | bond->dev->name, new_value); | 1004 | bond->dev->name, new_value); |
991 | ret = -EINVAL; | 1005 | ret = -EINVAL; |
@@ -996,10 +1010,11 @@ static ssize_t bonding_store_n_grat_arp(struct device *d, | |||
996 | out: | 1010 | out: |
997 | return ret; | 1011 | return ret; |
998 | } | 1012 | } |
999 | static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR, bonding_show_n_grat_arp, bonding_store_n_grat_arp); | 1013 | static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR, |
1014 | bonding_show_n_grat_arp, bonding_store_n_grat_arp); | ||
1000 | 1015 | ||
1001 | /* | 1016 | /* |
1002 | * Show and set the number of unsolicted NA's to send after a failover event. | 1017 | * Show and set the number of unsolicited NA's to send after a failover event. |
1003 | */ | 1018 | */ |
1004 | static ssize_t bonding_show_n_unsol_na(struct device *d, | 1019 | static ssize_t bonding_show_n_unsol_na(struct device *d, |
1005 | struct device_attribute *attr, | 1020 | struct device_attribute *attr, |
@@ -1018,25 +1033,26 @@ static ssize_t bonding_store_n_unsol_na(struct device *d, | |||
1018 | struct bonding *bond = to_bond(d); | 1033 | struct bonding *bond = to_bond(d); |
1019 | 1034 | ||
1020 | if (sscanf(buf, "%d", &new_value) != 1) { | 1035 | if (sscanf(buf, "%d", &new_value) != 1) { |
1021 | printk(KERN_ERR DRV_NAME | 1036 | pr_err(DRV_NAME |
1022 | ": %s: no num_unsol_na value specified.\n", | 1037 | ": %s: no num_unsol_na value specified.\n", |
1023 | bond->dev->name); | 1038 | bond->dev->name); |
1024 | ret = -EINVAL; | 1039 | ret = -EINVAL; |
1025 | goto out; | 1040 | goto out; |
1026 | } | 1041 | } |
1042 | |||
1027 | if (new_value < 0 || new_value > 255) { | 1043 | if (new_value < 0 || new_value > 255) { |
1028 | printk(KERN_ERR DRV_NAME | 1044 | pr_err(DRV_NAME |
1029 | ": %s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n", | 1045 | ": %s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n", |
1030 | bond->dev->name, new_value); | 1046 | bond->dev->name, new_value); |
1031 | ret = -EINVAL; | 1047 | ret = -EINVAL; |
1032 | goto out; | 1048 | goto out; |
1033 | } else { | 1049 | } else |
1034 | bond->params.num_unsol_na = new_value; | 1050 | bond->params.num_unsol_na = new_value; |
1035 | } | ||
1036 | out: | 1051 | out: |
1037 | return ret; | 1052 | return ret; |
1038 | } | 1053 | } |
1039 | static DEVICE_ATTR(num_unsol_na, S_IRUGO | S_IWUSR, bonding_show_n_unsol_na, bonding_store_n_unsol_na); | 1054 | static DEVICE_ATTR(num_unsol_na, S_IRUGO | S_IWUSR, |
1055 | bonding_show_n_unsol_na, bonding_store_n_unsol_na); | ||
1040 | 1056 | ||
1041 | /* | 1057 | /* |
1042 | * Show and set the MII monitor interval. There are two tricky bits | 1058 | * Show and set the MII monitor interval. There are two tricky bits |
@@ -1061,37 +1077,37 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
1061 | struct bonding *bond = to_bond(d); | 1077 | struct bonding *bond = to_bond(d); |
1062 | 1078 | ||
1063 | if (sscanf(buf, "%d", &new_value) != 1) { | 1079 | if (sscanf(buf, "%d", &new_value) != 1) { |
1064 | printk(KERN_ERR DRV_NAME | 1080 | pr_err(DRV_NAME |
1065 | ": %s: no miimon value specified.\n", | 1081 | ": %s: no miimon value specified.\n", |
1066 | bond->dev->name); | 1082 | bond->dev->name); |
1067 | ret = -EINVAL; | 1083 | ret = -EINVAL; |
1068 | goto out; | 1084 | goto out; |
1069 | } | 1085 | } |
1070 | if (new_value < 0) { | 1086 | if (new_value < 0) { |
1071 | printk(KERN_ERR DRV_NAME | 1087 | pr_err(DRV_NAME |
1072 | ": %s: Invalid miimon value %d not in range %d-%d; rejected.\n", | 1088 | ": %s: Invalid miimon value %d not in range %d-%d; rejected.\n", |
1073 | bond->dev->name, new_value, 1, INT_MAX); | 1089 | bond->dev->name, new_value, 1, INT_MAX); |
1074 | ret = -EINVAL; | 1090 | ret = -EINVAL; |
1075 | goto out; | 1091 | goto out; |
1076 | } else { | 1092 | } else { |
1077 | printk(KERN_INFO DRV_NAME | 1093 | pr_info(DRV_NAME |
1078 | ": %s: Setting MII monitoring interval to %d.\n", | 1094 | ": %s: Setting MII monitoring interval to %d.\n", |
1079 | bond->dev->name, new_value); | 1095 | bond->dev->name, new_value); |
1080 | bond->params.miimon = new_value; | 1096 | bond->params.miimon = new_value; |
1081 | if(bond->params.updelay) | 1097 | if (bond->params.updelay) |
1082 | printk(KERN_INFO DRV_NAME | 1098 | pr_info(DRV_NAME |
1083 | ": %s: Note: Updating updelay (to %d) " | 1099 | ": %s: Note: Updating updelay (to %d) " |
1084 | "since it is a multiple of the miimon value.\n", | 1100 | "since it is a multiple of the miimon value.\n", |
1085 | bond->dev->name, | 1101 | bond->dev->name, |
1086 | bond->params.updelay * bond->params.miimon); | 1102 | bond->params.updelay * bond->params.miimon); |
1087 | if(bond->params.downdelay) | 1103 | if (bond->params.downdelay) |
1088 | printk(KERN_INFO DRV_NAME | 1104 | pr_info(DRV_NAME |
1089 | ": %s: Note: Updating downdelay (to %d) " | 1105 | ": %s: Note: Updating downdelay (to %d) " |
1090 | "since it is a multiple of the miimon value.\n", | 1106 | "since it is a multiple of the miimon value.\n", |
1091 | bond->dev->name, | 1107 | bond->dev->name, |
1092 | bond->params.downdelay * bond->params.miimon); | 1108 | bond->params.downdelay * bond->params.miimon); |
1093 | if (bond->params.arp_interval) { | 1109 | if (bond->params.arp_interval) { |
1094 | printk(KERN_INFO DRV_NAME | 1110 | pr_info(DRV_NAME |
1095 | ": %s: MII monitoring cannot be used with " | 1111 | ": %s: MII monitoring cannot be used with " |
1096 | "ARP monitoring. Disabling ARP monitoring...\n", | 1112 | "ARP monitoring. Disabling ARP monitoring...\n", |
1097 | bond->dev->name); | 1113 | bond->dev->name); |
@@ -1125,7 +1141,8 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
1125 | out: | 1141 | out: |
1126 | return ret; | 1142 | return ret; |
1127 | } | 1143 | } |
1128 | static DEVICE_ATTR(miimon, S_IRUGO | S_IWUSR, bonding_show_miimon, bonding_store_miimon); | 1144 | static DEVICE_ATTR(miimon, S_IRUGO | S_IWUSR, |
1145 | bonding_show_miimon, bonding_store_miimon); | ||
1129 | 1146 | ||
1130 | /* | 1147 | /* |
1131 | * Show and set the primary slave. The store function is much | 1148 | * Show and set the primary slave. The store function is much |
@@ -1161,7 +1178,7 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1161 | write_lock_bh(&bond->curr_slave_lock); | 1178 | write_lock_bh(&bond->curr_slave_lock); |
1162 | 1179 | ||
1163 | if (!USES_PRIMARY(bond->params.mode)) { | 1180 | if (!USES_PRIMARY(bond->params.mode)) { |
1164 | printk(KERN_INFO DRV_NAME | 1181 | pr_info(DRV_NAME |
1165 | ": %s: Unable to set primary slave; %s is in mode %d\n", | 1182 | ": %s: Unable to set primary slave; %s is in mode %d\n", |
1166 | bond->dev->name, bond->dev->name, bond->params.mode); | 1183 | bond->dev->name, bond->dev->name, bond->params.mode); |
1167 | } else { | 1184 | } else { |
@@ -1169,7 +1186,7 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1169 | if (strnicmp | 1186 | if (strnicmp |
1170 | (slave->dev->name, buf, | 1187 | (slave->dev->name, buf, |
1171 | strlen(slave->dev->name)) == 0) { | 1188 | strlen(slave->dev->name)) == 0) { |
1172 | printk(KERN_INFO DRV_NAME | 1189 | pr_info(DRV_NAME |
1173 | ": %s: Setting %s as primary slave.\n", | 1190 | ": %s: Setting %s as primary slave.\n", |
1174 | bond->dev->name, slave->dev->name); | 1191 | bond->dev->name, slave->dev->name); |
1175 | bond->primary_slave = slave; | 1192 | bond->primary_slave = slave; |
@@ -1181,13 +1198,13 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1181 | /* if we got here, then we didn't match the name of any slave */ | 1198 | /* if we got here, then we didn't match the name of any slave */ |
1182 | 1199 | ||
1183 | if (strlen(buf) == 0 || buf[0] == '\n') { | 1200 | if (strlen(buf) == 0 || buf[0] == '\n') { |
1184 | printk(KERN_INFO DRV_NAME | 1201 | pr_info(DRV_NAME |
1185 | ": %s: Setting primary slave to None.\n", | 1202 | ": %s: Setting primary slave to None.\n", |
1186 | bond->dev->name); | 1203 | bond->dev->name); |
1187 | bond->primary_slave = NULL; | 1204 | bond->primary_slave = NULL; |
1188 | bond_select_active_slave(bond); | 1205 | bond_select_active_slave(bond); |
1189 | } else { | 1206 | } else { |
1190 | printk(KERN_INFO DRV_NAME | 1207 | pr_info(DRV_NAME |
1191 | ": %s: Unable to set %.*s as primary slave as it is not a slave.\n", | 1208 | ": %s: Unable to set %.*s as primary slave as it is not a slave.\n", |
1192 | bond->dev->name, (int)strlen(buf) - 1, buf); | 1209 | bond->dev->name, (int)strlen(buf) - 1, buf); |
1193 | } | 1210 | } |
@@ -1199,7 +1216,8 @@ out: | |||
1199 | 1216 | ||
1200 | return count; | 1217 | return count; |
1201 | } | 1218 | } |
1202 | static DEVICE_ATTR(primary, S_IRUGO | S_IWUSR, bonding_show_primary, bonding_store_primary); | 1219 | static DEVICE_ATTR(primary, S_IRUGO | S_IWUSR, |
1220 | bonding_show_primary, bonding_store_primary); | ||
1203 | 1221 | ||
1204 | /* | 1222 | /* |
1205 | * Show and set the use_carrier flag. | 1223 | * Show and set the use_carrier flag. |
@@ -1222,7 +1240,7 @@ static ssize_t bonding_store_carrier(struct device *d, | |||
1222 | 1240 | ||
1223 | 1241 | ||
1224 | if (sscanf(buf, "%d", &new_value) != 1) { | 1242 | if (sscanf(buf, "%d", &new_value) != 1) { |
1225 | printk(KERN_ERR DRV_NAME | 1243 | pr_err(DRV_NAME |
1226 | ": %s: no use_carrier value specified.\n", | 1244 | ": %s: no use_carrier value specified.\n", |
1227 | bond->dev->name); | 1245 | bond->dev->name); |
1228 | ret = -EINVAL; | 1246 | ret = -EINVAL; |
@@ -1230,17 +1248,18 @@ static ssize_t bonding_store_carrier(struct device *d, | |||
1230 | } | 1248 | } |
1231 | if ((new_value == 0) || (new_value == 1)) { | 1249 | if ((new_value == 0) || (new_value == 1)) { |
1232 | bond->params.use_carrier = new_value; | 1250 | bond->params.use_carrier = new_value; |
1233 | printk(KERN_INFO DRV_NAME ": %s: Setting use_carrier to %d.\n", | 1251 | pr_info(DRV_NAME ": %s: Setting use_carrier to %d.\n", |
1234 | bond->dev->name, new_value); | 1252 | bond->dev->name, new_value); |
1235 | } else { | 1253 | } else { |
1236 | printk(KERN_INFO DRV_NAME | 1254 | pr_info(DRV_NAME |
1237 | ": %s: Ignoring invalid use_carrier value %d.\n", | 1255 | ": %s: Ignoring invalid use_carrier value %d.\n", |
1238 | bond->dev->name, new_value); | 1256 | bond->dev->name, new_value); |
1239 | } | 1257 | } |
1240 | out: | 1258 | out: |
1241 | return count; | 1259 | return count; |
1242 | } | 1260 | } |
1243 | static DEVICE_ATTR(use_carrier, S_IRUGO | S_IWUSR, bonding_show_carrier, bonding_store_carrier); | 1261 | static DEVICE_ATTR(use_carrier, S_IRUGO | S_IWUSR, |
1262 | bonding_show_carrier, bonding_store_carrier); | ||
1244 | 1263 | ||
1245 | 1264 | ||
1246 | /* | 1265 | /* |
@@ -1269,8 +1288,8 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1269 | { | 1288 | { |
1270 | int i; | 1289 | int i; |
1271 | struct slave *slave; | 1290 | struct slave *slave; |
1272 | struct slave *old_active = NULL; | 1291 | struct slave *old_active = NULL; |
1273 | struct slave *new_active = NULL; | 1292 | struct slave *new_active = NULL; |
1274 | struct bonding *bond = to_bond(d); | 1293 | struct bonding *bond = to_bond(d); |
1275 | 1294 | ||
1276 | if (!rtnl_trylock()) | 1295 | if (!rtnl_trylock()) |
@@ -1278,11 +1297,11 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1278 | read_lock(&bond->lock); | 1297 | read_lock(&bond->lock); |
1279 | write_lock_bh(&bond->curr_slave_lock); | 1298 | write_lock_bh(&bond->curr_slave_lock); |
1280 | 1299 | ||
1281 | if (!USES_PRIMARY(bond->params.mode)) { | 1300 | if (!USES_PRIMARY(bond->params.mode)) |
1282 | printk(KERN_INFO DRV_NAME | 1301 | pr_info(DRV_NAME ": %s: Unable to change active slave;" |
1283 | ": %s: Unable to change active slave; %s is in mode %d\n", | 1302 | " %s is in mode %d\n", |
1284 | bond->dev->name, bond->dev->name, bond->params.mode); | 1303 | bond->dev->name, bond->dev->name, bond->params.mode); |
1285 | } else { | 1304 | else { |
1286 | bond_for_each_slave(bond, slave, i) { | 1305 | bond_for_each_slave(bond, slave, i) { |
1287 | if (strnicmp | 1306 | if (strnicmp |
1288 | (slave->dev->name, buf, | 1307 | (slave->dev->name, buf, |
@@ -1321,18 +1340,18 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1321 | /* if we got here, then we didn't match the name of any slave */ | 1340 | /* if we got here, then we didn't match the name of any slave */ |
1322 | 1341 | ||
1323 | if (strlen(buf) == 0 || buf[0] == '\n') { | 1342 | if (strlen(buf) == 0 || buf[0] == '\n') { |
1324 | printk(KERN_INFO DRV_NAME | 1343 | pr_info(DRV_NAME |
1325 | ": %s: Setting active slave to None.\n", | 1344 | ": %s: Setting active slave to None.\n", |
1326 | bond->dev->name); | 1345 | bond->dev->name); |
1327 | bond->primary_slave = NULL; | 1346 | bond->primary_slave = NULL; |
1328 | bond_select_active_slave(bond); | 1347 | bond_select_active_slave(bond); |
1329 | } else { | 1348 | } else { |
1330 | printk(KERN_INFO DRV_NAME | 1349 | pr_info(DRV_NAME ": %s: Unable to set %.*s" |
1331 | ": %s: Unable to set %.*s as active slave as it is not a slave.\n", | 1350 | " as active slave as it is not a slave.\n", |
1332 | bond->dev->name, (int)strlen(buf) - 1, buf); | 1351 | bond->dev->name, (int)strlen(buf) - 1, buf); |
1333 | } | 1352 | } |
1334 | } | 1353 | } |
1335 | out: | 1354 | out: |
1336 | write_unlock_bh(&bond->curr_slave_lock); | 1355 | write_unlock_bh(&bond->curr_slave_lock); |
1337 | read_unlock(&bond->lock); | 1356 | read_unlock(&bond->lock); |
1338 | rtnl_unlock(); | 1357 | rtnl_unlock(); |
@@ -1340,7 +1359,8 @@ out: | |||
1340 | return count; | 1359 | return count; |
1341 | 1360 | ||
1342 | } | 1361 | } |
1343 | static DEVICE_ATTR(active_slave, S_IRUGO | S_IWUSR, bonding_show_active_slave, bonding_store_active_slave); | 1362 | static DEVICE_ATTR(active_slave, S_IRUGO | S_IWUSR, |
1363 | bonding_show_active_slave, bonding_store_active_slave); | ||
1344 | 1364 | ||
1345 | 1365 | ||
1346 | /* | 1366 | /* |
@@ -1357,7 +1377,7 @@ static ssize_t bonding_show_mii_status(struct device *d, | |||
1357 | curr = bond->curr_active_slave; | 1377 | curr = bond->curr_active_slave; |
1358 | read_unlock(&bond->curr_slave_lock); | 1378 | read_unlock(&bond->curr_slave_lock); |
1359 | 1379 | ||
1360 | return sprintf(buf, "%s\n", (curr) ? "up" : "down"); | 1380 | return sprintf(buf, "%s\n", curr ? "up" : "down"); |
1361 | } | 1381 | } |
1362 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); | 1382 | static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); |
1363 | 1383 | ||
@@ -1374,7 +1394,9 @@ static ssize_t bonding_show_ad_aggregator(struct device *d, | |||
1374 | 1394 | ||
1375 | if (bond->params.mode == BOND_MODE_8023AD) { | 1395 | if (bond->params.mode == BOND_MODE_8023AD) { |
1376 | struct ad_info ad_info; | 1396 | struct ad_info ad_info; |
1377 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.aggregator_id); | 1397 | count = sprintf(buf, "%d\n", |
1398 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | ||
1399 | ? 0 : ad_info.aggregator_id); | ||
1378 | } | 1400 | } |
1379 | 1401 | ||
1380 | return count; | 1402 | return count; |
@@ -1394,7 +1416,9 @@ static ssize_t bonding_show_ad_num_ports(struct device *d, | |||
1394 | 1416 | ||
1395 | if (bond->params.mode == BOND_MODE_8023AD) { | 1417 | if (bond->params.mode == BOND_MODE_8023AD) { |
1396 | struct ad_info ad_info; | 1418 | struct ad_info ad_info; |
1397 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0: ad_info.ports); | 1419 | count = sprintf(buf, "%d\n", |
1420 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | ||
1421 | ? 0 : ad_info.ports); | ||
1398 | } | 1422 | } |
1399 | 1423 | ||
1400 | return count; | 1424 | return count; |
@@ -1414,7 +1438,9 @@ static ssize_t bonding_show_ad_actor_key(struct device *d, | |||
1414 | 1438 | ||
1415 | if (bond->params.mode == BOND_MODE_8023AD) { | 1439 | if (bond->params.mode == BOND_MODE_8023AD) { |
1416 | struct ad_info ad_info; | 1440 | struct ad_info ad_info; |
1417 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.actor_key); | 1441 | count = sprintf(buf, "%d\n", |
1442 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | ||
1443 | ? 0 : ad_info.actor_key); | ||
1418 | } | 1444 | } |
1419 | 1445 | ||
1420 | return count; | 1446 | return count; |
@@ -1434,7 +1460,9 @@ static ssize_t bonding_show_ad_partner_key(struct device *d, | |||
1434 | 1460 | ||
1435 | if (bond->params.mode == BOND_MODE_8023AD) { | 1461 | if (bond->params.mode == BOND_MODE_8023AD) { |
1436 | struct ad_info ad_info; | 1462 | struct ad_info ad_info; |
1437 | count = sprintf(buf, "%d\n", (bond_3ad_get_active_agg_info(bond, &ad_info)) ? 0 : ad_info.partner_key); | 1463 | count = sprintf(buf, "%d\n", |
1464 | (bond_3ad_get_active_agg_info(bond, &ad_info)) | ||
1465 | ? 0 : ad_info.partner_key); | ||
1438 | } | 1466 | } |
1439 | 1467 | ||
1440 | return count; | 1468 | return count; |
@@ -1454,9 +1482,8 @@ static ssize_t bonding_show_ad_partner_mac(struct device *d, | |||
1454 | 1482 | ||
1455 | if (bond->params.mode == BOND_MODE_8023AD) { | 1483 | if (bond->params.mode == BOND_MODE_8023AD) { |
1456 | struct ad_info ad_info; | 1484 | struct ad_info ad_info; |
1457 | if (!bond_3ad_get_active_agg_info(bond, &ad_info)) { | 1485 | if (!bond_3ad_get_active_agg_info(bond, &ad_info)) |
1458 | count = sprintf(buf, "%pM\n", ad_info.partner_system); | 1486 | count = sprintf(buf, "%pM\n", ad_info.partner_system); |
1459 | } | ||
1460 | } | 1487 | } |
1461 | 1488 | ||
1462 | return count; | 1489 | return count; |
@@ -1549,9 +1576,8 @@ int bond_create_sysfs_entry(struct bonding *bond) | |||
1549 | int err; | 1576 | int err; |
1550 | 1577 | ||
1551 | err = sysfs_create_group(&(dev->dev.kobj), &bonding_group); | 1578 | err = sysfs_create_group(&(dev->dev.kobj), &bonding_group); |
1552 | if (err) { | 1579 | if (err) |
1553 | printk(KERN_EMERG "eek! didn't create group!\n"); | 1580 | printk(KERN_EMERG "eek! didn't create group!\n"); |
1554 | } | ||
1555 | 1581 | ||
1556 | if (expected_refcount < 1) | 1582 | if (expected_refcount < 1) |
1557 | expected_refcount = atomic_read(&bond->dev->dev.kobj.kref.refcount); | 1583 | expected_refcount = atomic_read(&bond->dev->dev.kobj.kref.refcount); |