linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ansuel Smith <ansuelsmth@gmail.com>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [net-next RFC PATCH v2 0/8] Add support for qca8k mdio rw in Ethernet packet
Date: Wed, 8 Dec 2021 15:58:20 +0100	[thread overview]
Message-ID: <61b0c80e.1c69fb81.4b5cc.5f7e@mx.google.com> (raw)
In-Reply-To: <20211208145341.degqvm23bxc3vo7z@skbuf>

On Wed, Dec 08, 2021 at 04:53:41PM +0200, Vladimir Oltean wrote:
> On Wed, Dec 08, 2021 at 03:33:27PM +0100, Ansuel Smith wrote:
> > > But there are some problems with offering a "master_going_up/master_going_down"
> > > set of callbacks. Specifically, we could easily hook into the NETDEV_PRE_UP/
> > > NETDEV_GOING_DOWN netdev notifiers and transform these into DSA switch
> > > API calls. The goal would be for the qca8k tagger to mark the
> > > Ethernet-based register access method as available/unavailable, and in
> > > the regmap implementation, to use that or the other. DSA would then also
> > > be responsible for calling "master_going_up" when the switch ports and
> > > master are sufficiently initialized that traffic should be possible.
> > > But that first "master_going_up" notification is in fact the most
> > > problematic one, because we may not receive a NETDEV_PRE_UP event,
> > > because the DSA master may already be up when we probe our switch tree.
> > > This would be a bit finicky to get right. We may, for instance, hold
> > > rtnl_lock for the entirety of dsa_tree_setup_master(). This will block
> > > potentially concurrent netdevice notifiers handled by dsa_slave_nb.
> > > And while holding rtnl_lock() and immediately after each dsa_master_setup(),
> > > we may check whether master->flags & IFF_UP is true, and if it is,
> > > synthesize a call to ds->ops->master_going_up(). We also need to do the
> > > reverse in dsa_tree_teardown_master().
> > 
> > Should we care about holding the lock for that much time? Will do some
> > test hoping the IFF_UP is sufficient to make the Ethernet mdio work.
> 
> I'm certainly not smart enough to optimize things, so I'd rather hold
> the rtnl_lock for as long as I'm comfortable is enough to avoid races.
> The reason why we must hold rtnl_lock is because during
> dsa_master_setup(), the value of netdev_uses_dsa(dp->master) changes
> from false to true.
> The idea is that if IFF_UP isn't set right now, no problem, release the
> lock and we'll catch the NETDEV_UP notifier when that will appear.
> But we want to
> (a) replay the master up state if it was already up while it wasn't a
>     DSA master
> (b) avoid a potential race where the master does go up, we receive that
>     notification, but netdev_uses_dsa() doesn't yet return true for it.
> 
> The model would be similar to what we have for the NETDEV_GOING_DOWN
> handler.
> 
> Please wait for me to finish the sja1105 conversion. There are some
> issues I've noticed in your connect/disconnect implementation that I
> haven't had a chance to comment on, yet. I've tested ocelot-8021q plus
> the tagging protocol change and these appear fine.
> I'd like to post the changes I have, to make sure that what works for me
> works for you, and what works for you works for me. I may also have some
> patches laying around that track the master up/down state (I needed
> those for some RFC DSA master change patches). I'll build a mini patch
> series and post it soon-ish.

Sure no problem. In the meantime we can also wait if Andrew notice other
problem with this new implementation. (I will work on the mib handler as
it's still wip and on fixing the error on the last patch)

-- 
	Ansuel

  reply	other threads:[~2021-12-08 14:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08  3:40 [net-next RFC PATCH v2 0/8] Add support for qca8k mdio rw in Ethernet packet Ansuel Smith
2021-12-08  3:40 ` [net-next RFC PATCH v2 1/8] net: das: Introduce support for tagger private data control Ansuel Smith
2021-12-08  3:40 ` [net-next RFC PATCH v2 2/8] net: dsa: Permit dsa driver to configure additional tagger data Ansuel Smith
2021-12-08  3:40 ` [net-next RFC PATCH v2 3/8] net: dsa: tag_qca: convert to FIELD macro Ansuel Smith
2021-12-08  3:40 ` [net-next RFC PATCH v2 4/8] net: dsa: tag_qca: move define to include linux/dsa Ansuel Smith
2021-12-08  3:40 ` [net-next RFC PATCH v2 5/8] net: dsa: tag_qca: add define for mdio read/write in ethernet packet Ansuel Smith
2021-12-08  3:40 ` [net-next RFC PATCH v2 6/8] net: dsa: tag_qca: Add support for handling Ethernet mdio and MIB packet Ansuel Smith
2021-12-08  3:40 ` [net-next RFC PATCH v2 7/8] net: dsa: qca8k: Add support for mdio read/write in Ethernet packet Ansuel Smith
2021-12-08 12:18   ` Vladimir Oltean
2021-12-08 14:21     ` Ansuel Smith
2021-12-08 14:42       ` Vladimir Oltean
2021-12-08  3:40 ` [net-next RFC PATCH v2 8/8] net: dsa: qca8k: cache lo and hi for mdio write Ansuel Smith
2021-12-08 12:32 ` [net-next RFC PATCH v2 0/8] Add support for qca8k mdio rw in Ethernet packet Vladimir Oltean
2021-12-08 14:33   ` Ansuel Smith
2021-12-08 14:53     ` Vladimir Oltean
2021-12-08 14:58       ` Ansuel Smith [this message]
2021-12-09  2:59       ` Ansuel Smith

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=61b0c80e.1c69fb81.4b5cc.5f7e@mx.google.com \
    --to=ansuelsmth@gmail.com \
    --cc=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 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).