From: Florian Fainelli <f.fainelli@gmail.com>
To: Ansuel Smith <ansuelsmth@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: Re: [net-next RFC PATCH v4 04/15] net: dsa: replay master state events in dsa_tree_{setup,teardown}_master
Date: Sat, 11 Dec 2021 20:25:13 -0800 [thread overview]
Message-ID: <ad276128-fe13-3a0f-24e9-111d5fb4e174@gmail.com> (raw)
In-Reply-To: <20211211195758.28962-5-ansuelsmth@gmail.com>
On 12/11/2021 11:57 AM, Ansuel Smith wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
>
> In order for switch driver to be able to make simple and reliable use of
> the master tracking operations, they must also be notified of the
> initial state of the DSA master, not just of the changes. This is
> because they might enable certain features only during the time when
> they know that the DSA master is up and running.
>
> Therefore, this change explicitly checks the state of the DSA master
> under the same rtnl_mutex as we were holding during the
> dsa_master_setup() and dsa_master_teardown() call. The idea being that
> if the DSA master became operational in between the moment in which it
> became a DSA master (dsa_master_setup set dev->dsa_ptr) and the moment
> when we checked for the master being up, there is a chance that we
> would emit a ->master_state_change() call with no actual state change.
> We need to avoid that by serializing the concurrent netdevice event with
> us. If the netdevice event started before, we force it to finish before
> we begin, because we take rtnl_lock before making netdev_uses_dsa()
> return true. So we also handle that early event and do nothing on it.
> Similarly, if the dev_open() attempt is concurrent with us, it will
> attempt to take the rtnl_mutex, but we're holding it. We'll see that
> the master flag IFF_UP isn't set, then when we release the rtnl_mutex
> we'll process the NETDEV_UP notifier.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
With the caveat from patch #1 about qdisc_noop addressed:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
next prev parent reply other threads:[~2021-12-12 4:25 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-11 19:57 [net-next RFC PATCH v4 00/15] Add support for qca8k mdio rw in Ethernet packet Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 01/15] net: dsa: provide switch operations for tracking the master state Ansuel Smith
2021-12-12 4:22 ` Florian Fainelli
2021-12-12 18:19 ` Ansuel Smith
2021-12-12 18:19 ` Vladimir Oltean
2021-12-11 19:57 ` [net-next RFC PATCH v4 02/15] net: dsa: stop updating master MTU from master.c Ansuel Smith
2021-12-12 4:23 ` Florian Fainelli
2021-12-11 19:57 ` [net-next RFC PATCH v4 03/15] net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown} Ansuel Smith
2021-12-12 4:24 ` Florian Fainelli
2021-12-11 19:57 ` [net-next RFC PATCH v4 04/15] net: dsa: replay master state events in dsa_tree_{setup,teardown}_master Ansuel Smith
2021-12-12 4:25 ` Florian Fainelli [this message]
2021-12-11 19:57 ` [net-next RFC PATCH v4 05/15] net: dsa: tag_qca: convert to FIELD macro Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 06/15] net: dsa: tag_qca: move define to include linux/dsa Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 07/15] net: da: tag_qca: enable promisc_on_master flag Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 08/15] net: dsa: tag_qca: add define for handling mdio Ethernet packet Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 09/15] net: dsa: tag_qca: add define for handling MIB packet Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 10/15] net: dsa: tag_qca: add support for handling mdio Ethernet and " Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 11/15] net: dsa: qca8k: add tracking state of master port Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 12/15] net: dsa: qca8k: add support for mdio read/write in Ethernet packet Ansuel Smith
2021-12-12 4:12 ` Florian Fainelli
2021-12-12 17:41 ` Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 13/15] net: dsa: qca8k: add support for mib autocast " Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 14/15] net: dsa: qca8k: add support for phy read/write with mdio Ethernet Ansuel Smith
2021-12-11 19:57 ` [net-next RFC PATCH v4 15/15] net: dsa: qca8k: cache lo and hi for mdio write Ansuel Smith
2021-12-12 4:04 ` Florian Fainelli
2021-12-12 17:43 ` 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=ad276128-fe13-3a0f-24e9-111d5fb4e174@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.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).