From: Nikolay Aleksandrov <nikolay@redhat.com>
To: Mahesh Bandewar <maheshb@google.com>,
Jay Vosburgh <j.vosburgh@gmail.com>,
Andy Gospodarek <andy@greyhouse.net>,
Veaceslav Falico <vfalico@gmail.com>,
David Miller <davem@davemloft.net>
Cc: Maciej Zenczykowski <maze@google.com>,
netdev <netdev@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH next v5 2/6] bonding: implement bond_poll_controller()
Date: Thu, 19 Feb 2015 01:10:14 +0100 [thread overview]
Message-ID: <54E529E6.609@redhat.com> (raw)
In-Reply-To: <1424298682-18227-1-git-send-email-maheshb@google.com>
On 02/18/2015 11:31 PM, 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
> v5:
> Added rtnl protection for bond_for_each_slave()
>
> drivers/net/bonding/bond_main.c | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
Hi Mahesh,
I should've explained more in my review, you cannot sleep in
bond_poll_controller() so you cannot acquire rtnl like that. I was thinking
more about using rcu and switching to the _rcu version of
bond_for_each_slave instead.
Cheers,
Nik
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index b979c265fc51..63e6c0dbe7b3 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)
>
> 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;
> +
> + rtnl_lock();
> + 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);
> + }
> + rtnl_unlock();
> }
>
> static void bond_netpoll_cleanup(struct net_device *bond_dev)
>
next prev parent reply other threads:[~2015-02-19 0:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-18 22:31 [PATCH next v5 2/6] bonding: implement bond_poll_controller() Mahesh Bandewar
2015-02-19 0:10 ` Nikolay Aleksandrov [this message]
2015-02-19 1:19 ` Mahesh Bandewar
2015-02-19 1:30 ` Mahesh Bandewar
2015-02-19 2:26 ` Maciej Żenczykowski
2015-02-19 5:06 ` Mahesh Bandewar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E529E6.609@redhat.com \
--to=nikolay@redhat.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=j.vosburgh@gmail.com \
--cc=maheshb@google.com \
--cc=maze@google.com \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.