net: bridge: add helper to set topology change
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Sat, 10 Dec 2016 18:44:28 +0000 (13:44 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sun, 11 Dec 2016 02:27:23 +0000 (21:27 -0500)
Add a __br_set_topology_change helper to set the topology change value.

This can be later extended to add actions when the topology change flag
is set or cleared.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_private_stp.h
net/bridge/br_stp.c
net/bridge/br_stp_if.c
net/bridge/br_stp_timer.c

index 2fe910c4e1700776c33275f0ae277d354e348f6c..3f7543a29b7629ae20d0fbfc1cf40202114d4a5b 100644 (file)
@@ -61,6 +61,7 @@ void br_received_tcn_bpdu(struct net_bridge_port *p);
 void br_transmit_config(struct net_bridge_port *p);
 void br_transmit_tcn(struct net_bridge *br);
 void br_topology_change_detection(struct net_bridge *br);
+void __br_set_topology_change(struct net_bridge *br, unsigned char val);
 
 /* br_stp_bpdu.c */
 void br_send_config_bpdu(struct net_bridge_port *, struct br_config_bpdu *);
index 6ebe2a021e3ca86fbc67a96f07bb1bff54ad44e4..8d7b4c7a1d54f823add50d390195c118de5922ce 100644 (file)
@@ -234,7 +234,7 @@ static void br_record_config_timeout_values(struct net_bridge *br,
        br->max_age = bpdu->max_age;
        br->hello_time = bpdu->hello_time;
        br->forward_delay = bpdu->forward_delay;
-       br->topology_change = bpdu->topology_change;
+       __br_set_topology_change(br, bpdu->topology_change);
 }
 
 /* called under bridge lock */
@@ -344,7 +344,7 @@ void br_topology_change_detection(struct net_bridge *br)
                isroot ? "propagating" : "sending tcn bpdu");
 
        if (isroot) {
-               br->topology_change = 1;
+               __br_set_topology_change(br, 1);
                mod_timer(&br->topology_change_timer, jiffies
                          + br->bridge_forward_delay + br->bridge_max_age);
        } else if (!br->topology_change_detected) {
@@ -603,6 +603,12 @@ int br_set_ageing_time(struct net_bridge *br, clock_t ageing_time)
        return 0;
 }
 
+/* called under bridge lock */
+void __br_set_topology_change(struct net_bridge *br, unsigned char val)
+{
+       br->topology_change = val;
+}
+
 void __br_set_forward_delay(struct net_bridge *br, unsigned long t)
 {
        br->bridge_forward_delay = t;
index 2efbba549195e2e84090ecb22ddcfa8d85751261..6c1e214111250ea69199d40080f96af730d78934 100644 (file)
@@ -81,7 +81,7 @@ void br_stp_disable_bridge(struct net_bridge *br)
 
        }
 
-       br->topology_change = 0;
+       __br_set_topology_change(br, 0);
        br->topology_change_detected = 0;
        spin_unlock_bh(&br->lock);
 
index da058b85aa2260c6148034917e96944eefd85e28..7ddb38e0a06ea2d67f156a25eb50277a9cfc3898 100644 (file)
@@ -125,7 +125,7 @@ static void br_topology_change_timer_expired(unsigned long arg)
        br_debug(br, "topo change timer expired\n");
        spin_lock(&br->lock);
        br->topology_change_detected = 0;
-       br->topology_change = 0;
+       __br_set_topology_change(br, 0);
        spin_unlock(&br->lock);
 }