Skip to contentSkip to conversation

net: dsa: fix SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING getting ignored

PATCH Applied Vladimir Oltean 3 participants 3 messages Feb 2, 2021 – Feb 4, 2021

Subsystems (3)
lore
Share & tools
lore

Vladimir Oltean

author maintainer
#0 lore raw

PATCH 1/1 net: dsa: fix SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING getting ignored

From: Vladimir Oltean <[email protected]>

The bridge emits VLAN filtering events and quite a few others via switchdev with orig_dev = br->dev. After the blamed commit, these events started getting ignored.

The point of the patch was to not offload switchdev objects for ports that didn't go through dsa_port_bridge_join, because the configuration is unsupported:
- ports that offload a bonding/team interface go through dsa_port_bridge_join when that bonding/team interface is later bridged with another switch port or LAG
- ports that don't offload LAG don't get notified of the bridge that is on top of that LAG.

Sadly, a check is missing, which is that the orig_dev is equal to the bridge device. This check is compatible with the original intention, because ports that don't offload bridging because they use a software LAG don't have dp->bridge_dev set.

On a semi-related note, we should not offload switchdev objects or populate dp->bridge_dev if the driver doesn't implement .port_bridge_join either. However there is no regression associated with that, so it can be done separately.

Fixes 5696c8aedfcc ("net: dsa: Don't offload port attributes on standalone ports")
---
 net/dsa/dsa_priv.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
net/dsa/dsa_priv.h +9 -1
index 2ce46bb87703..1c4ee741b4b8 100644
@@ -182,7 +182,15 @@ static inline bool dsa_port_offloads_netdev(struct dsa_port *dp,
 	/* Switchdev offloading can be configured on: */
 
 	if (dev == dp->slave)
-		/* DSA ports directly connected to a bridge. */
+		/* DSA ports directly connected to a bridge, and event
+		 * was emitted for the ports themselves.
+		 */
+		return true;
+
+	if (dp->bridge_dev == dev)
+		/* DSA ports connected to a bridge, and event was emitted
+		 * for the bridge.
+		 */
 		return true;
 
 	if (dp->lag_dev == dev)
Signature · 1 line
2.25.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 20 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The bridge emits VLAN filtering events and quite a few others via switchdev with orig_dev = br->dev. After the blamed commit, these events started getting ignored.

The point of the patch was to not offload switchdev objects for ports that didn't go through dsa_port_bridge_join, because the configuration is unsupported:
- ports that offload a bonding/team interface go through dsa_port_bridge_join when that bonding/team interface is later bridged with another switch port or LAG
- ports that don't offload LAG don't get notified of the bridge that is on top of that LAG.

Sadly, a check is missing, which is that the orig_dev is equal to the bridge device. This check is compatible with the original intention, because ports that don't offload bridging because they use a software LAG don't have dp->bridge_dev set.

Quoted 8 lines

On a semi-related note, we should not offload switchdev objects or populate dp->bridge_dev if the driver doesn't implement .port_bridge_join either. However there is no regression associated with that, so it can be done separately.

Fixes 5696c8aedfcc ("net: dsa: Don't offload port attributes on standalone ports")

---

Quoted 26 lines
 net/dsa/dsa_priv.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
net/dsa/dsa_priv.h +9 -1
index 2ce46bb87703..1c4ee741b4b8 100644
@@ -182,7 +182,15 @@ static inline bool dsa_port_offloads_netdev(struct dsa_port *dp,
 	/* Switchdev offloading can be configured on: */
 
 	if (dev == dp->slave)
-		/* DSA ports directly connected to a bridge. */
+		/* DSA ports directly connected to a bridge, and event
+		 * was emitted for the ports themselves.
+		 */
+		return true;
+
+	if (dp->bridge_dev == dev)
+		/* DSA ports connected to a bridge, and event was emitted
+		 * for the bridge.
+		 */
 		return true;
 
 	if (dp->lag_dev == dev)
Signature · 1 line
2.25.1
#2 lore raw
In reply to Vladimir Oltean
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 15 lines · On Wed, 3 Feb 2021 01:31:09 +0200 you wrote:

From: Vladimir Oltean <[email protected]>

The bridge emits VLAN filtering events and quite a few others via switchdev with orig_dev = br->dev. After the blamed commit, these events started getting ignored.

The point of the patch was to not offload switchdev objects for ports that didn't go through dsa_port_bridge_join, because the configuration is unsupported:
- ports that offload a bonding/team interface go through dsa_port_bridge_join when that bonding/team interface is later bridged with another switch port or LAG
- ports that don't offload LAG don't get notified of the bridge that is on top of that LAG.

Quoted 1 line

[...]

Here is the summary with links:
- [net-next] net: dsa: fix SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING getting ignored

    https://git.kernel.org/netdev/net-next/c/99b8202b179f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html