* [PATCH next v4 2/6] bonding: implement bond_poll_controller()
@ 2015-02-18 7:17 Mahesh Bandewar
2015-02-18 12:35 ` Nikolay Aleksandrov
2015-02-18 13:40 ` Nikolay Aleksandrov
0 siblings, 2 replies; 3+ messages in thread
From: Mahesh Bandewar @ 2015-02-18 7:17 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
Nikolay Aleksandrov, David Miller
Cc: Mahesh Bandewar, Maciej Zenczykowski, netdev, Eric Dumazet
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>
---
v1:
Initial version
v2:
Eliminate bool variable.
v3:
Rebase
v4:
Removed 3AD port_operational check
drivers/net/bonding/bond_main.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b979c265fc51..f6bdaae7519d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -928,6 +928,37 @@ static inline void slave_disable_netpoll(struct slave *slave)
static void bond_poll_controller(struct net_device *bond_dev)
{
+ struct bonding *bond = netdev_priv(bond_dev);
+ struct slave *slave = NULL;
+ struct list_head *iter;
+ struct ad_info ad_info;
+ struct netpoll_info *ni;
+ const struct net_device_ops *ops;
+
+ if (BOND_MODE(bond) == BOND_MODE_8023AD)
+ if (bond_3ad_get_active_agg_info(bond, &ad_info))
+ return;
+
+ bond_for_each_slave(bond, slave, iter) {
+ ops = slave->dev->netdev_ops;
+ if (!bond_slave_is_up(slave) || !ops->ndo_poll_controller)
+ continue;
+
+ if (BOND_MODE(bond) == BOND_MODE_8023AD) {
+ struct aggregator *agg =
+ SLAVE_AD_INFO(slave)->port.aggregator;
+
+ if (agg && agg->aggregator_identifier !=
+ ad_info.aggregator_id)
+ continue;
+ }
+
+ ni = rcu_dereference_bh(slave->dev->npinfo);
+ if (down_trylock(&ni->dev_lock))
+ continue;
+ ops->ndo_poll_controller(slave->dev);
+ up(&ni->dev_lock);
+ }
}
static void bond_netpoll_cleanup(struct net_device *bond_dev)
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH next v4 2/6] bonding: implement bond_poll_controller()
2015-02-18 7:17 [PATCH next v4 2/6] bonding: implement bond_poll_controller() Mahesh Bandewar
@ 2015-02-18 12:35 ` Nikolay Aleksandrov
2015-02-18 13:40 ` Nikolay Aleksandrov
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2015-02-18 12:35 UTC (permalink / raw)
To: Mahesh Bandewar, Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
David Miller
Cc: Maciej Zenczykowski, netdev, Eric Dumazet
On 02/18/2015 08:17 AM, Mahesh Bandewar wrote:
> 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>
> ---
> v1:
> Initial version
> v2:
> Eliminate bool variable.
> v3:
> Rebase
> v4:
> Removed 3AD port_operational check
>
> drivers/net/bonding/bond_main.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index b979c265fc51..f6bdaae7519d 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -928,6 +928,37 @@ static inline void slave_disable_netpoll(struct slave *slave)
>
> static void bond_poll_controller(struct net_device *bond_dev)
> {
> + struct bonding *bond = netdev_priv(bond_dev);
> + struct slave *slave = NULL;
> + struct list_head *iter;
> + struct ad_info ad_info;
> + struct netpoll_info *ni;
> + const struct net_device_ops *ops;
> +
> + if (BOND_MODE(bond) == BOND_MODE_8023AD)
> + if (bond_3ad_get_active_agg_info(bond, &ad_info))
> + return;
> +
> + bond_for_each_slave(bond, slave, iter) {
^^^^^^^^^^
This version of bond_for_each_slave requires RTNL to be held.
> + ops = slave->dev->netdev_ops;
> + if (!bond_slave_is_up(slave) || !ops->ndo_poll_controller)
> + continue;
> +
> + if (BOND_MODE(bond) == BOND_MODE_8023AD) {
> + struct aggregator *agg =
> + SLAVE_AD_INFO(slave)->port.aggregator;
> +
> + if (agg && agg->aggregator_identifier !=
> + ad_info.aggregator_id)
> + continue;
> + }
> +
> + ni = rcu_dereference_bh(slave->dev->npinfo);
> + if (down_trylock(&ni->dev_lock))
> + continue;
> + ops->ndo_poll_controller(slave->dev);
> + up(&ni->dev_lock);
> + }
> }
>
> static void bond_netpoll_cleanup(struct net_device *bond_dev)
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH next v4 2/6] bonding: implement bond_poll_controller()
2015-02-18 7:17 [PATCH next v4 2/6] bonding: implement bond_poll_controller() Mahesh Bandewar
2015-02-18 12:35 ` Nikolay Aleksandrov
@ 2015-02-18 13:40 ` Nikolay Aleksandrov
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2015-02-18 13:40 UTC (permalink / raw)
To: Mahesh Bandewar, Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
David Miller
Cc: Maciej Zenczykowski, netdev, Eric Dumazet
On 02/18/2015 08:17 AM, Mahesh Bandewar wrote:
> 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>
> ---
> v1:
> Initial version
> v2:
> Eliminate bool variable.
> v3:
> Rebase
> v4:
> Removed 3AD port_operational check
>
> drivers/net/bonding/bond_main.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index b979c265fc51..f6bdaae7519d 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -928,6 +928,37 @@ static inline void slave_disable_netpoll(struct slave *slave)
>
> static void bond_poll_controller(struct net_device *bond_dev)
> {
> + struct bonding *bond = netdev_priv(bond_dev);
> + struct slave *slave = NULL;
> + struct list_head *iter;
> + struct ad_info ad_info;
> + struct netpoll_info *ni;
> + const struct net_device_ops *ops;
> +
> + if (BOND_MODE(bond) == BOND_MODE_8023AD)
> + if (bond_3ad_get_active_agg_info(bond, &ad_info))
> + return;
> +
> + bond_for_each_slave(bond, slave, iter) {
> + ops = slave->dev->netdev_ops;
> + if (!bond_slave_is_up(slave) || !ops->ndo_poll_controller)
> + continue;
> +
> + if (BOND_MODE(bond) == BOND_MODE_8023AD) {
> + struct aggregator *agg =
> + SLAVE_AD_INFO(slave)->port.aggregator;
> +
> + if (agg && agg->aggregator_identifier !=
> + ad_info.aggregator_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Please move the second half on its own line without breaking it like
this.
> + continue;
> + }
> +
> + ni = rcu_dereference_bh(slave->dev->npinfo);
> + if (down_trylock(&ni->dev_lock))
> + continue;
> + ops->ndo_poll_controller(slave->dev);
> + up(&ni->dev_lock);
> + }
> }
>
> static void bond_netpoll_cleanup(struct net_device *bond_dev)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-18 13:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-18 7:17 [PATCH next v4 2/6] bonding: implement bond_poll_controller() Mahesh Bandewar
2015-02-18 12:35 ` Nikolay Aleksandrov
2015-02-18 13:40 ` Nikolay Aleksandrov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).