diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-10-18 17:43:37 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-19 18:58:45 -0400 |
commit | 752d48b52ec929c6fd6ccd7ea9728571830fdd49 (patch) | |
tree | 9cfca24ba271e1c6ba64fae7417437f729c166ea /drivers/net/bonding/bond_options.c | |
parent | 080a06e1a9a5d2c55884d5fba8755d0af838cd5c (diff) | |
download | blackbird-obmc-linux-752d48b52ec929c6fd6ccd7ea9728571830fdd49.tar.gz blackbird-obmc-linux-752d48b52ec929c6fd6ccd7ea9728571830fdd49.zip |
bonding: move active_slave getting into separate function
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_options.c')
-rw-r--r-- | drivers/net/bonding/bond_options.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 09af5d10d43a..9a5223c7b4d1 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -57,6 +57,24 @@ int bond_option_mode_set(struct bonding *bond, int mode) return 0; } +static struct net_device *__bond_option_active_slave_get(struct bonding *bond, + struct slave *slave) +{ + return USES_PRIMARY(bond->params.mode) && slave ? slave->dev : NULL; +} + +struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond) +{ + struct slave *slave = rcu_dereference(bond->curr_active_slave); + + return __bond_option_active_slave_get(bond, slave); +} + +struct net_device *bond_option_active_slave_get(struct bonding *bond) +{ + return __bond_option_active_slave_get(bond, bond->curr_active_slave); +} + int bond_option_active_slave_set(struct bonding *bond, struct net_device *slave_dev) { |