summaryrefslogtreecommitdiffstats
path: root/net/bridge/br_stp.c
diff options
context:
space:
mode:
authorScott Feldman <sfeldma@gmail.com>2015-10-09 04:23:19 +0200
committerDavid S. Miller <davem@davemloft.net>2015-10-12 14:20:20 +0200
commitc62987bbd8a1a1664f99e89e3959339350a6131e (patch)
tree3a7455b6ab6b25335c709662b078c2375b700900 /net/bridge/br_stp.c
parentswitchdev: skip over ports returning -EOPNOTSUPP when recursing ports (diff)
downloadlinux-c62987bbd8a1a1664f99e89e3959339350a6131e.tar.xz
linux-c62987bbd8a1a1664f99e89e3959339350a6131e.zip
bridge: push bridge setting ageing_time down to switchdev
Use SWITCHDEV_F_SKIP_EOPNOTSUPP to skip over ports in bridge that don't support setting ageing_time (or setting bridge attrs in general). If push fails, don't update ageing_time in bridge and return err to user. If push succeeds, update ageing_time in bridge and run gc_timer now to recalabrate when to run gc_timer next, based on new ageing_time. Signed-off-by: Scott Feldman <sfeldma@gmail.com> Signed-off-by: Jiri Pirko <jiri@resnulli.us> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_stp.c')
-rw-r--r--net/bridge/br_stp.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 3a982c02599a..db6d243defb2 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -566,6 +566,29 @@ int br_set_max_age(struct net_bridge *br, unsigned long val)
}
+int br_set_ageing_time(struct net_bridge *br, u32 ageing_time)
+{
+ struct switchdev_attr attr = {
+ .id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
+ .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP,
+ .u.ageing_time = ageing_time,
+ };
+ unsigned long t = clock_t_to_jiffies(ageing_time);
+ int err;
+
+ if (t < BR_MIN_AGEING_TIME || t > BR_MAX_AGEING_TIME)
+ return -ERANGE;
+
+ err = switchdev_port_attr_set(br->dev, &attr);
+ if (err)
+ return err;
+
+ br->ageing_time = t;
+ mod_timer(&br->gc_timer, jiffies);
+
+ return 0;
+}
+
void __br_set_forward_delay(struct net_bridge *br, unsigned long t)
{
br->bridge_forward_delay = t;