]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net/bonding: Export bond_option_active_slave_get_rcu
authorMatan Barak <matanb@mellanox.com>
Thu, 30 Jul 2015 15:33:24 +0000 (18:33 +0300)
committerDoug Ledford <dledford@redhat.com>
Sun, 30 Aug 2015 22:08:50 +0000 (18:08 -0400)
Some consumers of the netdev events API would like to know who is the
active slave when a NETDEV_CHANGEUPPER or NETDEV_BONDING_FAILOVER
events occur. For example, when managing RoCE GIDs, GIDs based on the
bond's ips should only be set on the port which corresponds to active
slave netdevice.

Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/net/bonding/bond_options.c
include/net/bonding.h

index e9c624d54dd4cdf869d1cf04859dd0010c7c7f21..28bd005ab9e79da7880487ab1317c89044c6d2fd 100644 (file)
@@ -730,19 +730,6 @@ static int bond_option_mode_set(struct bonding *bond,
        return 0;
 }
 
-static struct net_device *__bond_option_active_slave_get(struct bonding *bond,
-                                                        struct slave *slave)
-{
-       return bond_uses_primary(bond) && 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);
-}
-
 static int bond_option_active_slave_set(struct bonding *bond,
                                        const struct bond_opt_value *newval)
 {
index 20defc0353d1353c02f1d778e3f53809cae6c0bb..c1740a2794a37bce9dc9d48739a766a93ff4f743 100644 (file)
@@ -310,6 +310,13 @@ static inline bool bond_uses_primary(struct bonding *bond)
        return bond_mode_uses_primary(BOND_MODE(bond));
 }
 
+static inline struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond)
+{
+       struct slave *slave = rcu_dereference(bond->curr_active_slave);
+
+       return bond_uses_primary(bond) && slave ? slave->dev : NULL;
+}
+
 static inline bool bond_slave_is_up(struct slave *slave)
 {
        return netif_running(slave->dev) && netif_carrier_ok(slave->dev);