diff options
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_3ad.c | 7 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 75 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 46 | ||||
-rw-r--r-- | drivers/net/bonding/bonding.h | 8 |
4 files changed, 68 insertions, 68 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 47b928ed08f8..b33c099d65a4 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -1135,13 +1135,6 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) __record_pdu(lacpdu, port); port->sm_rx_timer_counter = __ad_timer_to_ticks(AD_CURRENT_WHILE_TIMER, (u16)(port->actor_oper_port_state & AD_STATE_LACP_TIMEOUT)); port->actor_oper_port_state &= ~AD_STATE_EXPIRED; - // verify that if the aggregator is enabled, the port is enabled too. - //(because if the link goes down for a short time, the 802.3ad will not - // catch it, and the port will continue to be disabled) - if (port->aggregator - && port->aggregator->is_active - && !__port_is_enabled(port)) - __enable_port(port); break; default: //to silence the compiler break; diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index de3d351ccb6b..71efff323941 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -557,7 +557,7 @@ down: static int bond_update_speed_duplex(struct slave *slave) { struct net_device *slave_dev = slave->dev; - struct ethtool_cmd etool = { .cmd = ETHTOOL_GSET }; + struct ethtool_cmd ecmd; u32 slave_speed; int res; @@ -565,18 +565,15 @@ static int bond_update_speed_duplex(struct slave *slave) slave->speed = SPEED_100; slave->duplex = DUPLEX_FULL; - if (!slave_dev->ethtool_ops || !slave_dev->ethtool_ops->get_settings) - return -1; - - res = slave_dev->ethtool_ops->get_settings(slave_dev, &etool); + res = __ethtool_get_settings(slave_dev, &ecmd); if (res < 0) return -1; - slave_speed = ethtool_cmd_speed(&etool); + slave_speed = ethtool_cmd_speed(&ecmd); if (slave_speed == 0 || slave_speed == ((__u32) -1)) return -1; - switch (etool.duplex) { + switch (ecmd.duplex) { case DUPLEX_FULL: case DUPLEX_HALF: break; @@ -585,7 +582,7 @@ static int bond_update_speed_duplex(struct slave *slave) } slave->speed = slave_speed; - slave->duplex = etool.duplex; + slave->duplex = ecmd.duplex; return 0; } @@ -3710,44 +3707,27 @@ static bool bond_addr_in_mc_list(unsigned char *addr, return false; } -static void bond_set_multicast_list(struct net_device *bond_dev) +static void bond_change_rx_flags(struct net_device *bond_dev, int change) { struct bonding *bond = netdev_priv(bond_dev); - struct netdev_hw_addr *ha; - bool found; - /* - * Do promisc before checking multicast_mode - */ - if ((bond_dev->flags & IFF_PROMISC) && !(bond->flags & IFF_PROMISC)) - /* - * FIXME: Need to handle the error when one of the multi-slaves - * encounters error. - */ - bond_set_promiscuity(bond, 1); - - - if (!(bond_dev->flags & IFF_PROMISC) && (bond->flags & IFF_PROMISC)) - bond_set_promiscuity(bond, -1); - - - /* set allmulti flag to slaves */ - if ((bond_dev->flags & IFF_ALLMULTI) && !(bond->flags & IFF_ALLMULTI)) - /* - * FIXME: Need to handle the error when one of the multi-slaves - * encounters error. - */ - bond_set_allmulti(bond, 1); + if (change & IFF_PROMISC) + bond_set_promiscuity(bond, + bond_dev->flags & IFF_PROMISC ? 1 : -1); + if (change & IFF_ALLMULTI) + bond_set_allmulti(bond, + bond_dev->flags & IFF_ALLMULTI ? 1 : -1); +} - if (!(bond_dev->flags & IFF_ALLMULTI) && (bond->flags & IFF_ALLMULTI)) - bond_set_allmulti(bond, -1); - +static void bond_set_multicast_list(struct net_device *bond_dev) +{ + struct bonding *bond = netdev_priv(bond_dev); + struct netdev_hw_addr *ha; + bool found; read_lock(&bond->lock); - bond->flags = bond_dev->flags; - /* looking for addresses to add to slaves' mc list */ netdev_for_each_mc_addr(ha, bond_dev) { found = bond_addr_in_mc_list(ha->addr, &bond->mc_list, @@ -4306,7 +4286,8 @@ static const struct net_device_ops bond_netdev_ops = { .ndo_select_queue = bond_select_queue, .ndo_get_stats64 = bond_get_stats, .ndo_do_ioctl = bond_do_ioctl, - .ndo_set_multicast_list = bond_set_multicast_list, + .ndo_change_rx_flags = bond_change_rx_flags, + .ndo_set_rx_mode = bond_set_multicast_list, .ndo_change_mtu = bond_change_mtu, .ndo_set_mac_address = bond_set_mac_address, .ndo_neigh_setup = bond_neigh_setup, @@ -4852,11 +4833,20 @@ static int bond_validate(struct nlattr *tb[], struct nlattr *data[]) return 0; } +static int bond_get_tx_queues(struct net *net, struct nlattr *tb[], + unsigned int *num_queues, + unsigned int *real_num_queues) +{ + *num_queues = tx_queues; + return 0; +} + static struct rtnl_link_ops bond_link_ops __read_mostly = { .kind = "bond", .priv_size = sizeof(struct bonding), .setup = bond_setup, .validate = bond_validate, + .get_tx_queues = bond_get_tx_queues, }; /* Create a new bond based on the specified name and bonding parameters. @@ -4901,6 +4891,7 @@ static int __net_init bond_net_init(struct net *net) INIT_LIST_HEAD(&bn->dev_list); bond_create_proc_dir(bn); + bond_create_sysfs(bn); return 0; } @@ -4909,6 +4900,7 @@ static void __net_exit bond_net_exit(struct net *net) { struct bond_net *bn = net_generic(net, bond_net_id); + bond_destroy_sysfs(bn); bond_destroy_proc_dir(bn); } @@ -4946,10 +4938,6 @@ static int __init bonding_init(void) goto err; } - res = bond_create_sysfs(); - if (res) - goto err; - register_netdevice_notifier(&bond_netdev_notifier); register_inetaddr_notifier(&bond_inetaddr_notifier); out: @@ -4967,7 +4955,6 @@ static void __exit bonding_exit(void) unregister_netdevice_notifier(&bond_netdev_notifier); unregister_inetaddr_notifier(&bond_inetaddr_notifier); - bond_destroy_sysfs(); bond_destroy_debugfs(); rtnl_link_unregister(&bond_link_ops); diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 2dfb4bf90087..5a20804fdece 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -55,8 +55,8 @@ static ssize_t bonding_show_bonds(struct class *cls, struct class_attribute *attr, char *buf) { - struct net *net = current->nsproxy->net_ns; - struct bond_net *bn = net_generic(net, bond_net_id); + struct bond_net *bn = + container_of(attr, struct bond_net, class_attr_bonding_masters); int res = 0; struct bonding *bond; @@ -79,9 +79,8 @@ static ssize_t bonding_show_bonds(struct class *cls, return res; } -static struct net_device *bond_get_by_name(struct net *net, const char *ifname) +static struct net_device *bond_get_by_name(struct bond_net *bn, const char *ifname) { - struct bond_net *bn = net_generic(net, bond_net_id); struct bonding *bond; list_for_each_entry(bond, &bn->dev_list, bond_list) { @@ -103,7 +102,8 @@ static ssize_t bonding_store_bonds(struct class *cls, struct class_attribute *attr, const char *buffer, size_t count) { - struct net *net = current->nsproxy->net_ns; + struct bond_net *bn = + container_of(attr, struct bond_net, class_attr_bonding_masters); char command[IFNAMSIZ + 1] = {0, }; char *ifname; int rv, res = count; @@ -116,7 +116,7 @@ static ssize_t bonding_store_bonds(struct class *cls, if (command[0] == '+') { pr_info("%s is being created...\n", ifname); - rv = bond_create(net, ifname); + rv = bond_create(bn->net, ifname); if (rv) { if (rv == -EEXIST) pr_info("%s already exists.\n", ifname); @@ -128,7 +128,7 @@ static ssize_t bonding_store_bonds(struct class *cls, struct net_device *bond_dev; rtnl_lock(); - bond_dev = bond_get_by_name(net, ifname); + bond_dev = bond_get_by_name(bn, ifname); if (bond_dev) { pr_info("%s is being deleted...\n", ifname); unregister_netdevice(bond_dev); @@ -150,9 +150,24 @@ err_no_cmd: return -EPERM; } +static const void *bonding_namespace(struct class *cls, + const struct class_attribute *attr) +{ + const struct bond_net *bn = + container_of(attr, struct bond_net, class_attr_bonding_masters); + return bn->net; +} + /* class attribute for bond_masters file. This ends up in /sys/class/net */ -static CLASS_ATTR(bonding_masters, S_IWUSR | S_IRUGO, - bonding_show_bonds, bonding_store_bonds); +static const struct class_attribute class_attr_bonding_masters = { + .attr = { + .name = "bonding_masters", + .mode = S_IWUSR | S_IRUGO, + }, + .show = bonding_show_bonds, + .store = bonding_store_bonds, + .namespace = bonding_namespace, +}; int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave) @@ -1655,11 +1670,14 @@ static struct attribute_group bonding_group = { * Initialize sysfs. This sets up the bonding_masters file in * /sys/class/net. */ -int bond_create_sysfs(void) +int bond_create_sysfs(struct bond_net *bn) { int ret; - ret = netdev_class_create_file(&class_attr_bonding_masters); + bn->class_attr_bonding_masters = class_attr_bonding_masters; + sysfs_attr_init(&bn->class_attr_bonding_masters.attr); + + ret = netdev_class_create_file(&bn->class_attr_bonding_masters); /* * Permit multiple loads of the module by ignoring failures to * create the bonding_masters sysfs file. Bonding devices @@ -1673,7 +1691,7 @@ int bond_create_sysfs(void) */ if (ret == -EEXIST) { /* Is someone being kinky and naming a device bonding_master? */ - if (__dev_get_by_name(&init_net, + if (__dev_get_by_name(bn->net, class_attr_bonding_masters.attr.name)) pr_err("network device named %s already exists in sysfs", class_attr_bonding_masters.attr.name); @@ -1687,9 +1705,9 @@ int bond_create_sysfs(void) /* * Remove /sys/class/net/bonding_masters. */ -void bond_destroy_sysfs(void) +void bond_destroy_sysfs(struct bond_net *bn) { - netdev_class_remove_file(&class_attr_bonding_masters); + netdev_class_remove_file(&bn->class_attr_bonding_masters); } /* diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 43526a2d275c..82fec5fc75d7 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h @@ -234,7 +234,6 @@ struct bonding { struct netdev_hw_addr_list mc_list; int (*xmit_hash_policy)(struct sk_buff *, int); __be32 master_ip; - u16 flags; u16 rr_tx_counter; struct ad_bond_info ad_info; struct alb_bond_info alb_info; @@ -380,11 +379,13 @@ static inline bool bond_is_slave_inactive(struct slave *slave) return slave->inactive; } +struct bond_net; + struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr); int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); int bond_create(struct net *net, const char *name); -int bond_create_sysfs(void); -void bond_destroy_sysfs(void); +int bond_create_sysfs(struct bond_net *net); +void bond_destroy_sysfs(struct bond_net *net); void bond_prepare_sysfs_group(struct bonding *bond); int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave); void bond_destroy_slave_symlinks(struct net_device *master, struct net_device *slave); @@ -410,6 +411,7 @@ struct bond_net { #ifdef CONFIG_PROC_FS struct proc_dir_entry * proc_dir; #endif + struct class_attribute class_attr_bonding_masters; }; #ifdef CONFIG_PROC_FS |