netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: netdev@vger.kernel.org, Jay Vosburgh <j.vosburgh@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Jonathan Toppins <jtoppins@redhat.com>,
	Paolo Abeni <pabeni@redhat.com>, Liang Li <liali@redhat.com>,
	Miroslav Lichvar <mlichvar@redhat.com>
Subject: Re: [PATCHv2 net-next] bonding: add software tx timestamping support
Date: Mon, 10 Apr 2023 15:55:00 +0800	[thread overview]
Message-ID: <ZDPA1GG7Rgfhu/DP@Laptop-X1> (raw)
In-Reply-To: <CANn89iL_7CYs1kAY8SsUJLFoSZXe1rXAd3HJY-9dziehTfTkaQ@mail.gmail.com>

On Fri, Apr 07, 2023 at 11:34:23AM +0200, Eric Dumazet wrote:
> > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > index 00646aa315c3..994efc777a77 100644
> > --- a/drivers/net/bonding/bond_main.c
> > +++ b/drivers/net/bonding/bond_main.c
> > @@ -5686,9 +5686,13 @@ static int bond_ethtool_get_ts_info(struct net_device *bond_dev,
> >                                     struct ethtool_ts_info *info)
> >  {
> >         struct bonding *bond = netdev_priv(bond_dev);
> > +       struct ethtool_ts_info ts_info;
> >         const struct ethtool_ops *ops;
> >         struct net_device *real_dev;
> >         struct phy_device *phydev;
> > +       bool soft_support = false;
> > +       struct list_head *iter;
> > +       struct slave *slave;
> >         int ret = 0;
> >
> >         rcu_read_lock();
> > @@ -5707,10 +5711,41 @@ static int bond_ethtool_get_ts_info(struct net_device *bond_dev,
> >                         ret = ops->get_ts_info(real_dev, info);
> >                         goto out;
> >                 }
> > +       } else {
> > +               /* Check if all slaves support software rx/tx timestamping */
> > +               rcu_read_lock();
> > +               bond_for_each_slave_rcu(bond, slave, iter) {
> > +                       ret = -1;
> > +                       dev_hold(slave->dev);
> 
> You are holding rcu_read_lock() during the loop, so there is no need
> for this dev_hold() / dev_put() dance.

Thanks, I will remove this part.

> 
> And if this was needed, we kindly ask for new dev_hold()/dev_put()
> added in networking code to
> instead use netdev_hold / netdev_put(), we have spent enough time
> tracking hold/put bugs.

I saw dev_hold has called netdev_hold. Is there a need to convert the
old dev_hold to netdev_hold in driver code?

Thanks
Hangbin

  reply	other threads:[~2023-04-10  7:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07  6:12 [PATCHv2 net-next] bonding: add software tx timestamping support Hangbin Liu
2023-04-07  9:34 ` Eric Dumazet
2023-04-10  7:55   ` Hangbin Liu [this message]
2023-04-07 15:31 ` Simon Horman

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=ZDPA1GG7Rgfhu/DP@Laptop-X1 \
    --to=liuhangbin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=j.vosburgh@gmail.com \
    --cc=jtoppins@redhat.com \
    --cc=kuba@kernel.org \
    --cc=liali@redhat.com \
    --cc=mlichvar@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 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).