aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2014-07-15 09:56:53 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-15 20:49:41 -0400
commite965f8049460569bab12fe7bb5381bb2279712e2 (patch)
tree2ec33b91922c261f24e56f8715c491a1e295330c /drivers/net/bonding
parent725b70185d6b4ae73dc563725a95a0c10e242df5 (diff)
bonding: get rid of bond_option_active_slave_get()
Only keep bond_option_active_slave_get_rcu() helper. bond_fill_info() uses a new bond_option_active_slave_get_ifindex() helper. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Veaceslav Falico <vfalico@gmail.com> Reviewed-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_netlink.c21
-rw-r--r--drivers/net/bonding/bond_options.c5
-rw-r--r--drivers/net/bonding/bonding.h1
3 files changed, 16 insertions, 11 deletions
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index 5ab3c1847e67..4d97e23eb497 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -398,20 +398,31 @@ static size_t bond_get_size(const struct net_device *bond_dev)
398 0; 398 0;
399} 399}
400 400
401static int bond_option_active_slave_get_ifindex(struct bonding *bond)
402{
403 const struct net_device *slave;
404 int ifindex;
405
406 rcu_read_lock();
407 slave = bond_option_active_slave_get_rcu(bond);
408 ifindex = slave ? slave->ifindex : 0;
409 rcu_read_unlock();
410 return ifindex;
411}
412
401static int bond_fill_info(struct sk_buff *skb, 413static int bond_fill_info(struct sk_buff *skb,
402 const struct net_device *bond_dev) 414 const struct net_device *bond_dev)
403{ 415{
404 struct bonding *bond = netdev_priv(bond_dev); 416 struct bonding *bond = netdev_priv(bond_dev);
405 struct net_device *slave_dev = bond_option_active_slave_get(bond);
406 struct nlattr *targets;
407 unsigned int packets_per_slave; 417 unsigned int packets_per_slave;
408 int i, targets_added; 418 int ifindex, i, targets_added;
419 struct nlattr *targets;
409 420
410 if (nla_put_u8(skb, IFLA_BOND_MODE, BOND_MODE(bond))) 421 if (nla_put_u8(skb, IFLA_BOND_MODE, BOND_MODE(bond)))
411 goto nla_put_failure; 422 goto nla_put_failure;
412 423
413 if (slave_dev && 424 ifindex = bond_option_active_slave_get_ifindex(bond);
414 nla_put_u32(skb, IFLA_BOND_ACTIVE_SLAVE, slave_dev->ifindex)) 425 if (ifindex && nla_put_u32(skb, IFLA_BOND_ACTIVE_SLAVE, ifindex))
415 goto nla_put_failure; 426 goto nla_put_failure;
416 427
417 if (nla_put_u32(skb, IFLA_BOND_MIIMON, bond->params.miimon)) 428 if (nla_put_u32(skb, IFLA_BOND_MIIMON, bond->params.miimon))
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 540e0167bf24..b26271fd7b09 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -704,11 +704,6 @@ struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond)
704 return __bond_option_active_slave_get(bond, slave); 704 return __bond_option_active_slave_get(bond, slave);
705} 705}
706 706
707struct net_device *bond_option_active_slave_get(struct bonding *bond)
708{
709 return __bond_option_active_slave_get(bond, bond->curr_active_slave);
710}
711
712static int bond_option_active_slave_set(struct bonding *bond, 707static int bond_option_active_slave_set(struct bonding *bond,
713 const struct bond_opt_value *newval) 708 const struct bond_opt_value *newval)
714{ 709{
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 0b4d9cde0b05..713e2a99c661 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -514,7 +514,6 @@ unsigned int bond_get_num_tx_queues(void);
514int bond_netlink_init(void); 514int bond_netlink_init(void);
515void bond_netlink_fini(void); 515void bond_netlink_fini(void);
516struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond); 516struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
517struct net_device *bond_option_active_slave_get(struct bonding *bond);
518const char *bond_slave_link_status(s8 link); 517const char *bond_slave_link_status(s8 link);
519bool bond_verify_device_path(struct net_device *start_dev, 518bool bond_verify_device_path(struct net_device *start_dev,
520 struct net_device *end_dev, 519 struct net_device *end_dev,