From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Vivien Didelot <vivien.didelot@gmail.com>,
netdev@vger.kernel.org, olteanv@gmail.com,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC net] net: dsa: Add missing reference counting
Date: Thu, 7 May 2020 15:02:51 +0200 [thread overview]
Message-ID: <20200507130251.GL208718@lunn.ch> (raw)
In-Reply-To: <d681a82b-5d4b-457f-56de-3a439399cb3d@gmail.com>
On Wed, May 06, 2020 at 02:24:14PM -0700, Florian Fainelli wrote:
>
>
> On 5/5/2020 2:23 PM, Vivien Didelot wrote:
> > On Tue, 5 May 2020 14:02:53 -0700, Florian Fainelli <f.fainelli@gmail.com> wrote:
> >> If we are probed through platform_data we would be intentionally
> >> dropping the reference count on master after dev_to_net_device()
> >> incremented it. If we are probed through Device Tree,
> >> of_find_net_device() does not do a dev_hold() at all.
> >>
> >> Ensure that the DSA master device is properly reference counted by
> >> holding it as soon as the CPU port is successfully initialized and later
> >> released during dsa_switch_release_ports(). dsa_get_tag_protocol() does
> >> a short de-reference, so we hold and release the master at that time,
> >> too.
> >>
> >> Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation")
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> >
> > Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
> >
> Andrew, Vladimir, any thoughts on that?
Hi Florian
Have you looked at how other stacked drivers do this? bond/team, vlan,
bridge, BATMAN?
Do we maybe need to subscribe to the master devices notifier chain,
and do a tear down when the device is removed?
Andrew
prev parent reply other threads:[~2020-05-07 13:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 21:02 [RFC net] net: dsa: Add missing reference counting Florian Fainelli
2020-05-05 21:23 ` Vivien Didelot
2020-05-06 21:24 ` Florian Fainelli
2020-05-06 21:40 ` Vladimir Oltean
2020-05-06 22:45 ` Florian Fainelli
2020-05-06 23:32 ` Vladimir Oltean
2020-05-07 13:02 ` Andrew Lunn [this message]
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=20200507130251.GL208718@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@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.