Skip to contentSkip to conversation

net: bridge: use switchdev for port flags set through sysfs too

PATCH Applied Vladimir Oltean 3 participants 3 messages Feb 7, 2021 – Feb 8, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: bridge: use switchdev for port flags set through sysfs too

From: Vladimir Oltean <[email protected]>

Looking through patchwork I don't see that there was any consensus to use switchdev notifiers only in case of netlink provided port flags but not sysfs (as a sort of deprecation, punishment or anything like that), so we should probably keep the user interface consistent in terms of functionality.

http://patchwork.ozlabs.org/project/netdev/patch/[email protected]/
http://patchwork.ozlabs.org/project/netdev/patch/[email protected]/

Fixes 3922285d96e7 ("net: bridge: Add support for offloading port attributes")
---
 net/bridge/br_sysfs_if.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
net/bridge/br_sysfs_if.c +6 -3
index 96ff63cde1be..5aea9427ffe1 100644
@@ -59,9 +59,8 @@ static BRPORT_ATTR(_name, 0644,					\
 static int store_flag(struct net_bridge_port *p, unsigned long v,
 		      unsigned long mask)
 {
-	unsigned long flags;
-
-	flags = p->flags;
+	unsigned long flags = p->flags;
+	int err;
 
 	if (v)
 		flags |= mask;
@@ -69,6 +68,10 @@ static int store_flag(struct net_bridge_port *p, unsigned long v,
 		flags &= ~mask;
 
 	if (flags != p->flags) {
+		err = br_switchdev_set_port_flag(p, flags, mask);
+		if (err)
+			return err;
+
 		p->flags = flags;
 		br_port_flags_change(p, mask);
 	}
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 35 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

Looking through patchwork I don't see that there was any consensus to use switchdev notifiers only in case of netlink provided port flags but not sysfs (as a sort of deprecation, punishment or anything like that), so we should probably keep the user interface consistent in terms of functionality.

http://patchwork.ozlabs.org/project/netdev/patch/[email protected]/
http://patchwork.ozlabs.org/project/netdev/patch/[email protected]/

Fixes 3922285d96e7 ("net: bridge: Add support for offloading port attributes")
---
 net/bridge/br_sysfs_if.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
net/bridge/br_sysfs_if.c +2 -3
index 96ff63cde1be..5aea9427ffe1 100644
@@ -59,9 +59,8 @@ static BRPORT_ATTR(_name, 0644,					\
 static int store_flag(struct net_bridge_port *p, unsigned long v,
 		      unsigned long mask)
 {
-	unsigned long flags;
-
-	flags = p->flags;
+	unsigned long flags = p->flags;
+	int err;
 
 	if (v)
 		flags |= mask;

net/bridge/br_sysfs_if.c static int store_flag(struct net_bridge_port *p, unsigned long v, · line 77

Quoted 10 lines
net/bridge/br_sysfs_if.c +4 -0
@@ -69,6 +68,10 @@ static int store_flag(struct net_bridge_port *p, unsigned long v,
 		flags &= ~mask;
 
 	if (flags != p->flags) {
+		err = br_switchdev_set_port_flag(p, flags, mask);
+		if (err)
+			return err;
+
 		p->flags = flags;
 		br_port_flags_change(p, mask);
 	}
#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 9 lines · On Sun, 7 Feb 2021 21:47:33 +0200 you wrote:

From: Vladimir Oltean <[email protected]>

Looking through patchwork I don't see that there was any consensus to use switchdev notifiers only in case of netlink provided port flags but not sysfs (as a sort of deprecation, punishment or anything like that), so we should probably keep the user interface consistent in terms of functionality.

[...]

Here is the summary with links:
- [net] net: bridge: use switchdev for port flags set through sysfs too

    https://git.kernel.org/netdev/net-next/c/8043c845b63a

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