[4.19,17/52] net: bridge: use switchdev for port flags set through sysfs too
diff mbox series

Message ID 20210305120854.518613840@linuxfoundation.org
State New, archived
Headers show
  • Untitled series #487861
Related show

Commit Message

Greg Kroah-Hartman March 5, 2021, 12:21 p.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

commit 8043c845b63a2dd88daf2d2d268a33e1872800f0 upstream.

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


Fixes: 3922285d96e7 ("net: bridge: Add support for offloading port attributes")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 net/bridge/br_sysfs_if.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff mbox series

--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -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_
 		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);