aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorMahesh Bandewar <maheshb@google.com>2015-03-05 00:57:52 -0500
committerDavid S. Miller <davem@davemloft.net>2015-03-06 14:40:42 -0500
commit616f45416ca0d726d6d3421a296ebc6e2bb82cde (patch)
treef23dea6ff2818919a347f6787860665a8068797d /drivers/net/bonding
parent8ea696384a1641048a17d1ed3cee4fabb0bf4e03 (diff)
bonding: implement bond_poll_controller()
This patches implements the poll_controller support for all bonding driver. If the slaves have poll_controller net_op defined, this implementation calls them. This is mode agnostic implementation and iterates through all slaves (based on mode) and calls respective handler. Signed-off-by: Mahesh Bandewar <maheshb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 675b082283d6..c026ce9cd7b6 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -928,6 +928,39 @@ static inline void slave_disable_netpoll(struct slave *slave)
928 928
929static void bond_poll_controller(struct net_device *bond_dev) 929static void bond_poll_controller(struct net_device *bond_dev)
930{ 930{
931 struct bonding *bond = netdev_priv(bond_dev);
932 struct slave *slave = NULL;
933 struct list_head *iter;
934 struct ad_info ad_info;
935 struct netpoll_info *ni;
936 const struct net_device_ops *ops;
937
938 if (BOND_MODE(bond) == BOND_MODE_8023AD)
939 if (bond_3ad_get_active_agg_info(bond, &ad_info))
940 return;
941
942 rcu_read_lock_bh();
943 bond_for_each_slave_rcu(bond, slave, iter) {
944 ops = slave->dev->netdev_ops;
945 if (!bond_slave_is_up(slave) || !ops->ndo_poll_controller)
946 continue;
947
948 if (BOND_MODE(bond) == BOND_MODE_8023AD) {
949 struct aggregator *agg =
950 SLAVE_AD_INFO(slave)->port.aggregator;
951
952 if (agg &&
953 agg->aggregator_identifier != ad_info.aggregator_id)
954 continue;
955 }
956
957 ni = rcu_dereference_bh(slave->dev->npinfo);
958 if (down_trylock(&ni->dev_lock))
959 continue;
960 ops->ndo_poll_controller(slave->dev);
961 up(&ni->dev_lock);
962 }
963 rcu_read_unlock_bh();
931} 964}
932 965
933static void bond_netpoll_cleanup(struct net_device *bond_dev) 966static void bond_netpoll_cleanup(struct net_device *bond_dev)