[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220105221150.3208247-2-vladimir.oltean@nxp.com>
Date: Thu, 6 Jan 2022 00:11:50 +0200
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>
Subject: [PATCH net-next 2/2] net: dsa: warn about dsa_port and dsa_switch bit fields being non atomic
As discussed during review here:
https://patchwork.kernel.org/project/netdevbpf/patch/20220105132141.2648876-3-vladimir.oltean@nxp.com/
we should inform developers about pitfalls of concurrent access to the
boolean properties of dsa_switch and dsa_port, now that they've been
converted to bit fields. No other measure than a comment needs to be
taken, since the code paths that update these bit fields are not
concurrent with each other.
Suggested-by: Florian Fainelli <f.fainelli@...il.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
include/net/dsa.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 63c7f553f938..57b3e4e7413b 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -265,6 +265,10 @@ struct dsa_port {
u8 stp_state;
+ /* Warning: the following bit fields are not atomic, and updating them
+ * can only be done from code paths where concurrency is not possible
+ * (probe time or under rtnl_lock).
+ */
u8 vlan_filtering:1;
/* Managed by DSA on user ports and by drivers on CPU and DSA ports */
@@ -333,6 +337,10 @@ struct dsa_switch {
struct dsa_switch_tree *dst;
unsigned int index;
+ /* Warning: the following bit fields are not atomic, and updating them
+ * can only be done from code paths where concurrency is not possible
+ * (probe time or under rtnl_lock).
+ */
u32 setup:1;
/* Disallow bridge core from requesting different VLAN awareness
--
2.25.1
Powered by blists - more mailing lists