diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-06-12 19:02:48 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-13 23:28:57 -0700 |
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 2fc3561e099..ea6b9043a5e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -51,10 +51,10 @@ #include <linux/ctype.h> #include <linux/inet.h> #include <linux/bitops.h> +#include <linux/io.h> #include <asm/system.h> -#include <asm/io.h> #include <asm/dma.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/errno.h> #include <linux/netdevice.h> #include <linux/inetdevice.h> @@ -89,18 +89,18 @@ static int max_bonds = BOND_DEFAULT_MAX_BONDS; static int num_grat_arp = 1; static int num_unsol_na = 1; static int miimon = BOND_LINK_MON_INTERV; -static int updelay = 0; -static int downdelay = 0; +static int updelay; +static int downdelay; static int use_carrier = 1; -static char *mode = NULL; -static char *primary = NULL; -static char *lacp_rate = NULL; -static char *ad_select = NULL; -static char *xmit_hash_policy = NULL; +static char *mode; +static char *primary; +static char *lacp_rate; +static char *ad_select; +static char *xmit_hash_policy; static int arp_interval = BOND_LINK_ARP_INTERV; -static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, }; -static char *arp_validate = NULL; -static char *fail_over_mac = NULL; +static char *arp_ip_target[BOND_MAX_ARP_TARGETS]; +static char *arp_validate; +static char *fail_over_mac; static struct bond_params bonding_defaults; module_param(max_bonds, int, 0); @@ -151,14 +151,14 @@ static const char * const version = LIST_HEAD(bond_dev_list); #ifdef CONFIG_PROC_FS -static struct proc_dir_entry *bond_proc_dir = NULL; +static struct proc_dir_entry *bond_proc_dir; #endif -static __be32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ; -static int arp_ip_count = 0; +static __be32 arp_target[BOND_MAX_ARP_TARGETS]; +static int arp_ip_count; static int bond_mode = BOND_MODE_ROUNDROBIN; -static int xmit_hashtype= BOND_XMIT_POLICY_LAYER2; -static int lacp_fast = 0; +static int xmit_hashtype = BOND_XMIT_POLICY_LAYER2; +static int lacp_fast; const struct bond_parm_tbl bond_lacp_tbl[] = { @@ -221,7 +221,7 @@ static const char *bond_mode_name(int mode) [BOND_MODE_ACTIVEBACKUP] = "fault-tolerance (active-backup)", [BOND_MODE_XOR] = "load balancing (xor)", [BOND_MODE_BROADCAST] = "fault-tolerance (broadcast)", - [BOND_MODE_8023AD]= "IEEE 802.3ad Dynamic link aggregation", + [BOND_MODE_8023AD] = "IEEE 802.3ad Dynamic link aggregation", [BOND_MODE_TLB] = "transmit load balancing", [BOND_MODE_ALB] = "adaptive load balancing", }; @@ -246,12 +246,11 @@ static int bond_add_vlan(struct bonding *bond, unsigned short vlan_id) struct vlan_entry *vlan; pr_debug("bond: %s, vlan id %d\n", - (bond ? bond->dev->name: "None"), vlan_id); + (bond ? bond->dev->name : "None"), vlan_id); vlan = kzalloc(sizeof(struct vlan_entry), GFP_KERNEL); - if (!vlan) { + if (!vlan) return -ENOMEM; - } INIT_LIST_HEAD(&vlan->vlan_list); vlan->vlan_id = vlan_id; @@ -351,16 +350,15 @@ static int bond_has_challenged_slaves(struct bonding *bond) * * Returns %NULL if list is empty, bond->next_vlan if @curr is %NULL, * or @curr->next otherwise (even if it is @curr itself again). - * + * * Caller must hold bond->lock */ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) { struct vlan_entry *next, *last; - if (list_empty(&bond->vlan_list)) { + if (list_empty(&bond->vlan_list)) return NULL; - } if (!curr) { next = list_entry(bond->vlan_list.next, @@ -382,11 +380,11 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) /** * bond_dev_queue_xmit - Prepare skb for xmit. - * + * * @bond: bond device that got this skb for tx. * @skb: hw accel VLAN tagged skb to transmit * @slave_dev: slave that is supposed to xmit this skbuff - * + * * When the bond gets an skb to transmit that is * already hardware accelerated VLAN tagged, and it * 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) * i.e. strip the hwaccel tag and re-insert it as part * of the payload. */ -int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev) +int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, + struct net_device *slave_dev) { unsigned short uninitialized_var(vlan_id); @@ -428,7 +427,7 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_de * b. The operation is protected by the RTNL semaphore in the 8021q code, * c. Holding a lock with BH disabled while directly calling a base driver * entry point is generally a BAD idea. - * + * * The design of synchronization/protection for this operation in the 8021q * module is good for one or more VLAN devices over a single physical device * 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 * @bond_dev: bonding net device that got called * @grp: vlan group being registered */ -static void bond_vlan_rx_register(struct net_device *bond_dev, struct vlan_group *grp) +static void bond_vlan_rx_register(struct net_device *bond_dev, + struct vlan_group *grp) { struct bonding *bond = netdev_priv(bond_dev); struct slave *slave; @@ -485,7 +485,7 @@ static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid) res = bond_add_vlan(bond, vid); if (res) { - printk(KERN_ERR DRV_NAME + pr_err(DRV_NAME ": %s: Error: Failed to add vlan id %d\n", bond_dev->name, vid); } @@ -520,7 +520,7 @@ static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid) res = bond_del_vlan(bond, vid); if (res) { - printk(KERN_ERR DRV_NAME + pr_err(DRV_NAME ": %s: Error: Failed to remove vlan id %d\n", bond_dev->name, vid); } @@ -551,7 +551,8 @@ out: write_unlock_bh(&bond->lock); } -static void bond_del_vlans_from_slave(struct bonding *bond, struct net_device *slave_dev) +static void bond_del_vlans_from_slave(struct bonding *bond, + struct net_device *slave_dev) { const struct net_device_ops *slave_ops = slave_dev->netdev_ops; struct vlan_entry *vlan; @@ -673,7 +674,7 @@ static int bond_update_speed_duplex(struct slave *slave) * if <dev> supports MII link status reporting, check its link status. * * We either do MII/ETHTOOL ioctls, or check netif_carrier_ok(), - * depening upon the setting of the use_carrier parameter. + * depending upon the setting of the use_carrier parameter. * * Return either BMSR_LSTATUS, meaning that the link is up (or we * 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) * It'd be nice if there was a good way to tell if a driver supports * netif_carrier, but there really isn't. */ -static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_dev, int reporting) +static int bond_check_dev_link(struct bonding *bond, + struct net_device *slave_dev, int reporting) { const struct net_device_ops *slave_ops = slave_dev->netdev_ops; - static int (* ioctl)(struct net_device *, struct ifreq *, int); + static int (*ioctl)(struct net_device *, struct ifreq *, int); struct ifreq ifr; struct mii_ioctl_data *mii; @@ -706,7 +708,7 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de } } - /* Ethtool can't be used, fallback to MII ioclts. */ + /* Ethtool can't be used, fallback to MII ioctls. */ ioctl = slave_ops->ndo_do_ioctl; if (ioctl) { /* 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 mii = if_mii(&ifr); if (IOCTL(slave_dev, &ifr, SIOCGMIIPHY) == 0) { mii->reg_num = MII_BMSR; - if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0) { - return (mii->val_out & BMSR_LSTATUS); - } + if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0) + return mii->val_out & BMSR_LSTATUS; } } @@ -738,7 +739,7 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de * cannot report link status). If not reporting, pretend * we're ok. */ - return (reporting ? -1 : BMSR_LSTATUS); + return reporting ? -1 : BMSR_LSTATUS; } /*----------------------------- Multicast list ------------------------------*/ @@ -746,7 +747,8 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de /* * Returns 0 if dmi1 and dmi2 are the same, non-0 otherwise */ -static inline int bond_is_dmi_same(struct dev_mc_list *dmi1, struct dev_mc_list *dmi2) +static inline int bond_is_dmi_same(const struct dev_mc_list *dmi1, + const struct dev_mc_list *dmi2) { return memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0 && 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 /* * returns dmi entry if found, NULL otherwise */ -static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi, struct dev_mc_list *mc_list) +static struct dev_mc_list *bond_mc_list_find_dmi(struct dev_mc_list *dmi, + struct dev_mc_list *mc_list) { struct dev_mc_list *idmi; for (idmi = mc_list; idmi; idmi = idmi->next) { - if (bond_is_dmi_same(dmi, idmi)) { + if (bond_is_dmi_same(dmi, idmi)) return idmi; - } } return NULL; @@ -824,15 +826,14 @@ static void bond_mc_add(struct bonding *bond, void *addr, int alen) { if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ - if (bond->curr_active_slave) { + if (bond->curr_active_slave) dev_mc_add(bond->curr_active_slave->dev, addr, alen, 0); - } } else { struct slave *slave; int i; - bond_for_each_slave(bond, slave, i) { + + bond_for_each_slave(bond, slave, i) dev_mc_add(slave->dev, addr, alen, 0); - } } } @@ -844,9 +845,9 @@ static void bond_mc_delete(struct bonding *bond, void *addr, int alen) { if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ - if (bond->curr_active_slave) { - dev_mc_delete(bond->curr_active_slave->dev, addr, alen, 0); - } + if (bond->curr_active_slave) + dev_mc_delete(bond->curr_active_slave->dev, addr, + alen, 0); } else { struct slave *slave; int i; @@ -870,9 +871,8 @@ static void bond_resend_igmp_join_requests(struct bonding *bond) rcu_read_lock(); in_dev = __in_dev_get_rcu(bond->dev); if (in_dev) { - for (im = in_dev->mc_list; im; im = im->next) { + for (im = in_dev->mc_list; im; im = im->next) ip_mc_rejoin_group(im); - } } rcu_read_unlock(); @@ -891,7 +891,8 @@ static void bond_mc_list_destroy(struct bonding *bond) kfree(dmi); dmi = bond->mc_list; } - bond->mc_list = NULL; + + bond->mc_list = NULL; } /* @@ -924,14 +925,14 @@ static int bond_mc_list_copy(struct dev_mc_list *mc_list, struct bonding *bond, /* * flush all members of flush->mc_list from device dev->mc_list */ -static void bond_mc_list_flush(struct net_device *bond_dev, struct net_device *slave_dev) +static void bond_mc_list_flush(struct net_device *bond_dev, + struct net_device *slave_dev) { struct bonding *bond = netdev_priv(bond_dev); struct dev_mc_list *dmi; - for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { + for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) dev_mc_delete(slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); - } if (bond->params.mode == BOND_MODE_8023AD) { /* 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 * old active slaves (if any) according to the multicast mode, and * promiscuous flags unconditionally. */ -static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct slave *old_active) +static void bond_mc_swap(struct bonding *bond, struct slave *new_active, + struct slave *old_active) { struct dev_mc_list *dmi; - if (!USES_PRIMARY(bond->params.mode)) { + if (!USES_PRIMARY(bond->params.mode)) /* nothing to do - mc list is already up-to-date on * all slaves */ return; - } if (old_active) { - if (bond->dev->flags & IFF_PROMISC) { + if (bond->dev->flags & IFF_PROMISC) dev_set_promiscuity(old_active->dev, -1); - } - if (bond->dev->flags & IFF_ALLMULTI) { + if (bond->dev->flags & IFF_ALLMULTI) dev_set_allmulti(old_active->dev, -1); - } - for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next) { - dev_mc_delete(old_active->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); - } + for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next) + dev_mc_delete(old_active->dev, dmi->dmi_addr, + dmi->dmi_addrlen, 0); } if (new_active) { /* FIXME: Signal errors upstream. */ - if (bond->dev->flags & IFF_PROMISC) { + if (bond->dev->flags & IFF_PROMISC) dev_set_promiscuity(new_active->dev, 1); - } - if (bond->dev->flags & IFF_ALLMULTI) { + if (bond->dev->flags & IFF_ALLMULTI) dev_set_allmulti(new_active->dev, 1); - } - for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next) { - dev_mc_add(new_active->dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); - } + for (dmi = bond->dev->mc_list; dmi; dmi = dmi->next) + dev_mc_add(new_active->dev, dmi->dmi_addr, + dmi->dmi_addrlen, 0); bond_resend_igmp_join_requests(bond); } } @@ -1039,7 +1036,7 @@ static void bond_do_fail_over_mac(struct bonding *bond, rv = dev_set_mac_address(new_active->dev, &saddr); if (rv) { - printk(KERN_ERR DRV_NAME + pr_err(DRV_NAME ": %s: Error %d setting MAC of slave %s\n", bond->dev->name, -rv, new_active->dev->name); goto out; @@ -1053,7 +1050,7 @@ static void bond_do_fail_over_mac(struct bonding *bond, rv = dev_set_mac_address(old_active->dev, &saddr); if (rv) - printk(KERN_ERR DRV_NAME + pr_err(DRV_NAME ": %s: Error %d setting MAC of slave %s\n", bond->dev->name, -rv, new_active->dev->name); out: @@ -1061,7 +1058,7 @@ out: write_lock_bh(&bond->curr_slave_lock); break; default: - printk(KERN_ERR DRV_NAME + pr_err(DRV_NAME ": %s: bond_do_fail_over_mac impossible: bad policy %d\n", bond->dev->name, bond->params.fail_over_mac); break; @@ -1086,17 +1083,17 @@ static struct slave *bond_find_best_slave(struct bonding *bond) new_active = old_active = bond->curr_active_slave; if (!new_active) { /* there were no active slaves left */ - if (bond->slave_cnt > 0) { /* found one slave */ + if (bond->slave_cnt > 0) /* found one slave */ new_active = bond->first_slave; - } else { + else return NULL; /* still no slave, return NULL */ - } } - /* first try the primary link; if arping, a link must tx/rx traffic - * before it can be considered the curr_active_slave - also, we would skip - * slaves between the curr_active_slave and primary_slave that may be up - * and able to arp + /* + * first try the primary link; if arping, a link must tx/rx + * traffic before it can be considered the curr_active_slave. + * also, we would skip slaves between the curr_active_slave + * and primary_slave that may be up and able to arp */ if ((bond->primary_slave) && (!bond->params.arp_interval) && @@ -1144,16 +1141,15 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) { struct slave *old_active = bond->curr_active_slave; - if (old_active == new_active) { + if (old_active == new_active) return; - } if (new_active) { new_active->jiffies = jiffies; if (new_active->link == BOND_LINK_BACK) { if (USES_PRIMARY(bond->params.mode)) { - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: making interface %s the new " "active one %d ms earlier.\n", bond->dev->name, new_active->dev->name, @@ -1163,15 +1159,14 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) new_active->delay = 0; new_active->link = BOND_LINK_UP; - if (bond->params.mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) bond_3ad_handle_link_change(new_active, BOND_LINK_UP); - } if (bond_is_lb(bond)) bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); } else { if (USES_PRIMARY(bond->params.mode)) { - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: making interface %s the new " "active one.\n", bond->dev->name, new_active->dev->name); @@ -1179,9 +1174,8 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) } } - if (USES_PRIMARY(bond->params.mode)) { + if (USES_PRIMARY(bond->params.mode)) bond_mc_swap(bond, new_active, old_active); - } if (bond_is_lb(bond)) { bond_alb_handle_active_change(bond, new_active); @@ -1194,9 +1188,8 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) } if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { - if (old_active) { + if (old_active) bond_set_slave_inactive_flags(old_active); - } if (new_active) { bond_set_slave_active_flags(new_active); @@ -1226,7 +1219,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) * bond_select_active_slave - select a new active slave, if needed * @bond: our bonding struct * - * This functions shoud be called when one of the following occurs: + * This functions should be called when one of the following occurs: * - The old curr_active_slave has been released or lost its link. * - The primary_slave has got its link back. * - 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) return; if (netif_carrier_ok(bond->dev)) { - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: first active interface up!\n", bond->dev->name); } else { - printk(KERN_INFO DRV_NAME ": %s: " + pr_info(DRV_NAME ": %s: " "now running without any active interface !\n", bond->dev->name); } @@ -1292,13 +1285,11 @@ static void bond_attach_slave(struct bonding *bond, struct slave *new_slave) */ static void bond_detach_slave(struct bonding *bond, struct slave *slave) { - if (slave->next) { + if (slave->next) slave->next->prev = slave->prev; - } - if (slave->prev) { + if (slave->prev) slave->prev->next = slave->next; - } if (bond->first_slave == slave) { /* slave is the first slave */ if (bond->slave_cnt > 1) { /* there are more slave */ @@ -1329,7 +1320,7 @@ static int bond_sethwaddr(struct net_device *bond_dev, (NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | \ NETIF_F_HW_VLAN_FILTER) -/* +/* * Compute the common dev->feature set available to all slaves. Some * feature bits are managed elsewhere, so preserve those feature bits * on the master device. @@ -1397,14 +1388,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL && slave_ops->ndo_do_ioctl == NULL) { - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: Warning: no link monitoring support for %s\n", bond_dev->name, slave_dev->name); } /* bond must be initialized by bond_open() before enslaving */ if (!(bond_dev->flags & IFF_UP)) { - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME " %s: master_dev is not up in bond_enslave\n", bond_dev->name); } @@ -1420,14 +1411,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); if (!list_empty(&bond->vlan_list)) { - printk(KERN_ERR DRV_NAME + pr_err(DRV_NAME ": %s: Error: cannot enslave VLAN " "challenged slave %s on VLAN enabled " "bond %s\n", bond_dev->name, slave_dev->name, bond_dev->name); return -EPERM; } else { - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: Warning: enslaved VLAN challenged " "slave %s. Adding VLANs will be blocked as " "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) /* * Old ifenslave binaries are no longer supported. These can - * be identified with moderate accurary by the state of the slave: + * be identified with moderate accuracy by the state of the slave: * the current ifenslave will set the interface down prior to * enslaving it; the old ifenslave will not. */ if ((slave_dev->flags & IFF_UP)) { - printk(KERN_ERR DRV_NAME ": %s is up. " + pr_err(DRV_NAME ": %s is up. " "This may be due to an out of date ifenslave.\n", slave_dev->name); res = -EPERM; @@ -1470,7 +1461,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) if (slave_dev->type != ARPHRD_ETHER) bond_setup_by_slave(bond_dev, slave_dev); } else if (bond_dev->type != slave_dev->type) { - printk(KERN_ERR DRV_NAME ": %s ether type (%d) is different " + pr_err(DRV_NAME ": %s ether type (%d) is different " "from other slaves (%d), can not enslave it.\n", slave_dev->name, slave_dev->type, bond_dev->type); @@ -1480,14 +1471,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) if (slave_ops->ndo_set_mac_address == NULL) { if (bond->slave_cnt == 0) { - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: Warning: The first slave device " "specified does not support setting the MAC " "address. Setting fail_over_mac to active.", bond_dev->name); bond->params.fail_over_mac = BOND_FOM_ACTIVE; } else if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { - printk(KERN_ERR DRV_NAME + pr_err(DRV_NAME ": %s: Error: The slave device specified " "does not support setting the MAC address, " "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) /* open the slave since the application closed it */ res = dev_open(slave_dev); if (res) { - pr_debug("Openning slave %s failed\n", slave_dev->name); + pr_debug("Opening slave %s failed\n", slave_dev->name); goto err_unset_master; } @@ -1549,9 +1540,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) * it might fail and we do not want to have to undo everything */ res = bond_alb_init_slave(bond, new_slave); - if (res) { + if (res) goto err_close; - } } /* 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) netif_addr_lock_bh(bond_dev); /* upload master's mc_list to new slave */ - for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { - dev_mc_add (slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); - } + for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) + dev_mc_add(slave_dev, dmi->dmi_addr, + dmi->dmi_addrlen, 0); netif_addr_unlock_bh(bond_dev); } @@ -1619,7 +1609,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) * supported); thus, we don't need to change * the messages for netif_carrier. */ - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: Warning: MII and ETHTOOL support not " "available for interface %s, and " "arp_interval/arp_ip_target module parameters " @@ -1628,7 +1618,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) bond_dev->name, slave_dev->name); } else if (link_reporting == -1) { /* unable get link status using mii/ethtool */ - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: Warning: can't get link status from " "interface %s; the network driver associated " "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) if (bond_update_speed_duplex(new_slave) && (new_slave->link != BOND_LINK_DOWN)) { - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: Warning: failed to get speed and duplex from %s, " "assumed to be 100Mb/sec and Full.\n", bond_dev->name, new_slave->dev->name); if (bond->params.mode == BOND_MODE_8023AD) { - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: Warning: Operation of 802.3ad mode requires ETHTOOL " "support in base driver for proper aggregator " "selection.\n", bond_dev->name); @@ -1675,9 +1665,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { /* if there is a primary slave, remember it */ - if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { + if (strcmp(bond->params.primary, new_slave->dev->name) == 0) bond->primary_slave = new_slave; - } } write_lock_bh(&bond->curr_slave_lock); @@ -1724,9 +1713,9 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) * anyway (it holds no special properties of the bond device), * so we can change it without calling change_active_interface() */ - if (!bond->curr_active_slave) { + if (!bond->curr_active_slave) bond->curr_active_slave = new_slave; - } + break; } /* switch(bond_mode) */ @@ -1740,7 +1729,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) if (res) goto err_close; - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: enslaving %s as a%s interface with a%s link.\n", bond_dev->name, slave_dev->name, new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup", @@ -1772,7 +1761,7 @@ err_free: err_undo_flags: bond_dev->features = old_features; - + return res; } @@ -1797,7 +1786,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) /* slave is not a slave or master is not master of this slave */ if (!(slave_dev->flags & IFF_SLAVE) || (slave_dev->master != bond_dev)) { - printk(KERN_ERR DRV_NAME + pr_err(DRV_NAME ": %s: Error: cannot release %s.\n", bond_dev->name, slave_dev->name); return -EINVAL; @@ -1808,7 +1797,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) slave = bond_get_slave_by_dev(bond, slave_dev); if (!slave) { /* not a slave of this bond */ - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: %s not enslaved\n", bond_dev->name, slave_dev->name); write_unlock_bh(&bond->lock); @@ -1819,7 +1808,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) mac_addr_differ = memcmp(bond_dev->dev_addr, slave->perm_hwaddr, ETH_ALEN); if (!mac_addr_differ && (bond->slave_cnt > 1)) - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: Warning: the permanent HWaddr of %s - " "%pM - is still in use by %s. " "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) bond_3ad_unbind_slave(slave); } - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: releasing %s interface %s\n", bond_dev->name, (slave->state == BOND_STATE_ACTIVE) @@ -1853,13 +1842,11 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) bond_compute_features(bond); - if (bond->primary_slave == slave) { + if (bond->primary_slave == slave) bond->primary_slave = NULL; - } - if (oldcurrent == slave) { + if (oldcurrent == slave) bond_change_active_slave(bond, NULL); - } if (bond_is_lb(bond)) { /* 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) if (list_empty(&bond->vlan_list)) { bond_dev->features |= NETIF_F_VLAN_CHALLENGED; } else { - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: Warning: clearing HW address of %s while it " "still has VLANs.\n", bond_dev->name, bond_dev->name); - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: When re-adding slaves, make sure the bond's " "HW address matches its VLANs'.\n", bond_dev->name); } } else if ((bond_dev->features & NETIF_F_VLAN_CHALLENGED) && !bond_has_challenged_slaves(bond)) { - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: last VLAN challenged slave %s " "left bond %s. VLAN blocking is removed\n", 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) */ if (!USES_PRIMARY(bond->params.mode)) { /* unset promiscuity level from slave */ - if (bond_dev->flags & IFF_PROMISC) { + if (bond_dev->flags & IFF_PROMISC) dev_set_promiscuity(slave_dev, -1); - } /* unset allmulti level from slave */ - if (bond_dev->flags & IFF_ALLMULTI) { + if (bond_dev->flags & IFF_ALLMULTI) dev_set_allmulti(slave_dev, -1); - } /* flush master's mc_list from slave */ netif_addr_lock_bh(bond_dev); @@ -1988,17 +1973,18 @@ static void bond_uninit(struct net_device *bond_dev) } /* -* First release a slave and than destroy the bond if no more slaves iare left. +* First release a slave and than destroy the bond if no more slaves are left. * Must be under rtnl_lock when this function is called. */ -int bond_release_and_destroy(struct net_device *bond_dev, struct net_device *slave_dev) +int bond_release_and_destroy(struct net_device *bond_dev, + struct net_device *slave_dev) { struct bonding *bond = netdev_priv(bond_dev); int ret; ret = bond_release(bond_dev, slave_dev); if ((ret == 0) && (bond->slave_cnt == 0)) { - printk(KERN_INFO DRV_NAME ": %s: destroying bond %s.\n", + pr_info(DRV_NAME ": %s: destroying bond %s.\n", bond_dev->name, bond_dev->name); unregister_netdevice(bond_dev); } @@ -2019,9 +2005,8 @@ static int bond_release_all(struct net_device *bond_dev) netif_carrier_off(bond_dev); - if (bond->slave_cnt == 0) { + if (bond->slave_cnt == 0) goto out; - } bond->current_arp_slave = NULL; bond->primary_slave = NULL; @@ -2031,9 +2016,8 @@ static int bond_release_all(struct net_device *bond_dev) /* Inform AD package of unbinding of slave * before slave is detached from the list. */ - if (bond->params.mode == BOND_MODE_8023AD) { + if (bond->params.mode == BOND_MODE_8023AD) bond_3ad_unbind_slave(slave); - } slave_dev = slave->dev; bond_detach_slave(bond, slave); @@ -2062,14 +2046,12 @@ static int bond_release_all(struct net_device *bond_dev) */ if (!USES_PRIMARY(bond->params.mode)) { /* unset promiscuity level from slave */ - if (bond_dev->flags & IFF_PROMISC) { + if (bond_dev->flags & IFF_PROMISC) dev_set_promiscuity(slave_dev, -1); - } /* unset allmulti level from slave */ - if (bond_dev->flags & IFF_ALLMULTI) { + if (bond_dev->flags & IFF_ALLMULTI) dev_set_allmulti(slave_dev, -1); - } /* flush master's mc_list from slave */ netif_addr_lock_bh(bond_dev); @@ -2104,20 +2086,20 @@ static int bond_release_all(struct net_device *bond_dev) */ memset(bond_dev->dev_addr, 0, bond_dev->addr_len); - if (list_empty(&bond->vlan_list)) { + if (list_empty(&bond->vlan_list)) bond_dev->features |= NETIF_F_VLAN_CHALLENGED; - } else { - printk(KERN_WARNING DRV_NAME + else { + pr_warning(DRV_NAME ": %s: Warning: clearing HW address of %s while it " "still has VLANs.\n", bond_dev->name, bond_dev->name); - printk(KERN_WARNING DRV_NAME + pr_warning(DRV_NAME ": %s: When re-adding slaves, make sure the bond's " "HW address matches its VLANs'.\n", bond_dev->name); } - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: released all slaves\n", bond_dev->name); @@ -2135,8 +2117,8 @@ out: * - <slave_dev> is already active. * - The link state of <slave_dev> is not BOND_LINK_UP. * - <slave_dev> is not running. - * In these cases, this fuction does nothing. - * In the other cases, currnt_slave pointer is changed and 0 is returned. + * In these cases, this function does nothing. + * In the other cases, current_slave pointer is changed and 0 is returned. */ static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_device *slave_dev) { @@ -2145,15 +2127,12 @@ static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_devi struct slave *new_active = NULL; int res = 0; - if (!USES_PRIMARY(bond->params.mode)) { + if (!USES_PRIMARY(bond->params.mode)) return -EINVAL; - } /* Verify that master_dev is indeed the master of slave_dev */ - if (!(slave_dev->flags & IFF_SLAVE) || - (slave_dev->master != bond_dev)) { + if (!(slave_dev->flags & IFF_SLAVE) || (slave_dev->master != bond_dev)) return -EINVAL; - } read_lock(&bond->lock); @@ -2178,9 +2157,8 @@ static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_devi write_lock_bh(&bond->curr_slave_lock); bond_change_active_slave(bond, new_active); write_unlock_bh(&bond->curr_slave_lock); - } else { + } else res = -EINVAL; - } read_unlock(&bond->lock); @@ -2249,7 +2227,7 @@ static int bond_miimon_inspect(struct bonding *bond) slave->link = BOND_LINK_FAIL; slave->delay = bond->params.downdelay; if (slave->delay) { - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: link status down for %s" "interface %s, disabling it in %d ms.\n", bond->dev->name, @@ -2268,7 +2246,7 @@ static int bond_miimon_inspect(struct bonding *bond) */ slave->link = BOND_LINK_UP; slave->jiffies = jiffies; - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: link status up again after %d " "ms for interface %s.\n", bond->dev->name, @@ -2295,7 +2273,7 @@ static int bond_miimon_inspect(struct bonding *bond) slave->delay = bond->params.updelay; if (slave->delay) { - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: link status up for " "interface %s, enabling it in %d ms.\n", bond->dev->name, slave->dev->name, @@ -2307,7 +2285,7 @@ static int bond_miimon_inspect(struct bonding *bond) case BOND_LINK_BACK: if (!link_state) { slave->link = BOND_LINK_DOWN; - printk(KERN_INFO DRV_NAME + pr_info(DRV_NAME ": %s: link status down again after %d " "ms for interface %s.\n", bond->dev->name, @@ -2361,7 +2339,7 @@ |