Release 4.15 net/bridge/br_stp_timer.c
/*
* Spanning tree protocol; timer-related code
* Linux ethernet bridge
*
* Authors:
* Lennert Buytenhek <buytenh@gnu.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/kernel.h>
#include <linux/times.h>
#include "br_private.h"
#include "br_private_stp.h"
/* called under bridge lock */
static int br_is_designated_for_some_port(const struct net_bridge *br)
{
struct net_bridge_port *p;
list_for_each_entry(p, &br->port_list, list) {
if (p->state != BR_STATE_DISABLED &&
!memcmp(&p->designated_bridge, &br->bridge_id, 8))
return 1;
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 48 | 84.21% | 1 | 33.33% |
Stephen Hemminger | 9 | 15.79% | 2 | 66.67% |
Total | 57 | 100.00% | 3 | 100.00% |
static void br_hello_timer_expired(struct timer_list *t)
{
struct net_bridge *br = from_timer(br, t, hello_timer);
br_debug(br, "hello timer expired\n");
spin_lock(&br->lock);
if (br->dev->flags & IFF_UP) {
br_config_bpdu_generation(br);
if (br->stp_enabled == BR_KERNEL_STP)
mod_timer(&br->hello_timer,
round_jiffies(jiffies + br->hello_time));
}
spin_unlock(&br->lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stephen Hemminger | 53 | 58.89% | 6 | 60.00% |
Linus Torvalds (pre-git) | 17 | 18.89% | 1 | 10.00% |
Allen Pais | 12 | 13.33% | 1 | 10.00% |
Nikolay Aleksandrov | 6 | 6.67% | 1 | 10.00% |
Xin Long | 2 | 2.22% | 1 | 10.00% |
Total | 90 | 100.00% | 10 | 100.00% |
static void br_message_age_timer_expired(struct timer_list *t)
{
struct net_bridge_port *p = from_timer(p, t, message_age_timer);
struct net_bridge *br = p->br;
const bridge_id *id = &p->designated_bridge;
int was_root;
if (p->state == BR_STATE_DISABLED)
return;
br_info(br, "port %u(%s) neighbor %.2x%.2x.%pM lost\n",
(unsigned int) p->port_no, p->dev->name,
id->prio[0], id->prio[1], &id->addr);
/*
* According to the spec, the message age timer cannot be
* running when we are the root bridge. So.. this was_root
* check is redundant. I'm leaving it in for now, though.
*/
spin_lock(&br->lock);
if (p->state == BR_STATE_DISABLED)
goto unlock;
was_root = br_is_root_bridge(br);
br_become_designated_port(p);
br_configuration_update(br);
br_port_state_selection(br);
if (br_is_root_bridge(br) && !was_root)
br_become_root_bridge(br);
unlock:
spin_unlock(&br->lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stephen Hemminger | 86 | 52.76% | 5 | 55.56% |
Linus Torvalds (pre-git) | 64 | 39.26% | 2 | 22.22% |
Allen Pais | 12 | 7.36% | 1 | 11.11% |
Eric Dumazet | 1 | 0.61% | 1 | 11.11% |
Total | 163 | 100.00% | 9 | 100.00% |
static void br_forward_delay_timer_expired(struct timer_list *t)
{
struct net_bridge_port *p = from_timer(p, t, forward_delay_timer);
struct net_bridge *br = p->br;
br_debug(br, "port %u(%s) forward delay timer\n",
(unsigned int) p->port_no, p->dev->name);
spin_lock(&br->lock);
if (p->state == BR_STATE_LISTENING) {
br_set_state(p, BR_STATE_LEARNING);
mod_timer(&p->forward_delay_timer,
jiffies + br->forward_delay);
} else if (p->state == BR_STATE_LEARNING) {
br_set_state(p, BR_STATE_FORWARDING);
if (br_is_designated_for_some_port(br))
br_topology_change_detection(br);
netif_carrier_on(br->dev);
}
rcu_read_lock();
br_ifinfo_notify(RTM_NEWLINK, NULL, p);
rcu_read_unlock();
spin_unlock(&br->lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stephen Hemminger | 68 | 44.16% | 6 | 50.00% |
Linus Torvalds (pre-git) | 57 | 37.01% | 1 | 8.33% |
Allen Pais | 12 | 7.79% | 1 | 8.33% |
Florian Fainelli | 8 | 5.19% | 1 | 8.33% |
Eric Dumazet | 7 | 4.55% | 2 | 16.67% |
Nikolay Aleksandrov | 2 | 1.30% | 1 | 8.33% |
Total | 154 | 100.00% | 12 | 100.00% |
static void br_tcn_timer_expired(struct timer_list *t)
{
struct net_bridge *br = from_timer(br, t, tcn_timer);
br_debug(br, "tcn timer expired\n");
spin_lock(&br->lock);
if (!br_is_root_bridge(br) && (br->dev->flags & IFF_UP)) {
br_transmit_tcn(br);
mod_timer(&br->tcn_timer, jiffies + br->bridge_hello_time);
}
spin_unlock(&br->lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stephen Hemminger | 55 | 63.22% | 6 | 75.00% |
Linus Torvalds (pre-git) | 20 | 22.99% | 1 | 12.50% |
Allen Pais | 12 | 13.79% | 1 | 12.50% |
Total | 87 | 100.00% | 8 | 100.00% |
static void br_topology_change_timer_expired(struct timer_list *t)
{
struct net_bridge *br = from_timer(br, t, topology_change_timer);
br_debug(br, "topo change timer expired\n");
spin_lock(&br->lock);
br->topology_change_detected = 0;
__br_set_topology_change(br, 0);
spin_unlock(&br->lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stephen Hemminger | 27 | 44.26% | 3 | 50.00% |
Linus Torvalds (pre-git) | 18 | 29.51% | 1 | 16.67% |
Allen Pais | 12 | 19.67% | 1 | 16.67% |
Vivien Didelot | 4 | 6.56% | 1 | 16.67% |
Total | 61 | 100.00% | 6 | 100.00% |
static void br_hold_timer_expired(struct timer_list *t)
{
struct net_bridge_port *p = from_timer(p, t, hold_timer);
br_debug(p->br, "port %u(%s) hold timer expired\n",
(unsigned int) p->port_no, p->dev->name);
spin_lock(&p->br->lock);
if (p->config_pending)
br_transmit_config(p);
spin_unlock(&p->br->lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stephen Hemminger | 47 | 59.49% | 3 | 50.00% |
Linus Torvalds (pre-git) | 19 | 24.05% | 1 | 16.67% |
Allen Pais | 12 | 15.19% | 1 | 16.67% |
Eric Dumazet | 1 | 1.27% | 1 | 16.67% |
Total | 79 | 100.00% | 6 | 100.00% |
void br_stp_timer_init(struct net_bridge *br)
{
timer_setup(&br->hello_timer, br_hello_timer_expired, 0);
timer_setup(&br->tcn_timer, br_tcn_timer_expired, 0);
timer_setup(&br->topology_change_timer,
br_topology_change_timer_expired, 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 34 | 73.91% | 1 | 33.33% |
Allen Pais | 6 | 13.04% | 1 | 33.33% |
Stephen Hemminger | 6 | 13.04% | 1 | 33.33% |
Total | 46 | 100.00% | 3 | 100.00% |
void br_stp_port_timer_init(struct net_bridge_port *p)
{
timer_setup(&p->message_age_timer, br_message_age_timer_expired, 0);
timer_setup(&p->forward_delay_timer, br_forward_delay_timer_expired, 0);
timer_setup(&p->hold_timer, br_hold_timer_expired, 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stephen Hemminger | 20 | 43.48% | 1 | 33.33% |
Linus Torvalds (pre-git) | 20 | 43.48% | 1 | 33.33% |
Allen Pais | 6 | 13.04% | 1 | 33.33% |
Total | 46 | 100.00% | 3 | 100.00% |
/* Report ticks left (in USER_HZ) used for API */
unsigned long br_timer_value(const struct timer_list *timer)
{
return timer_pending(timer)
? jiffies_delta_to_clock_t(timer->expires - jiffies) : 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stephen Hemminger | 28 | 96.55% | 1 | 50.00% |
Eric Dumazet | 1 | 3.45% | 1 | 50.00% |
Total | 29 | 100.00% | 2 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Stephen Hemminger | 403 | 48.73% | 11 | 47.83% |
Linus Torvalds (pre-git) | 307 | 37.12% | 2 | 8.70% |
Allen Pais | 84 | 10.16% | 1 | 4.35% |
Eric Dumazet | 10 | 1.21% | 3 | 13.04% |
Florian Fainelli | 8 | 0.97% | 1 | 4.35% |
Nikolay Aleksandrov | 8 | 0.97% | 2 | 8.70% |
Vivien Didelot | 4 | 0.48% | 1 | 4.35% |
Xin Long | 2 | 0.24% | 1 | 4.35% |
Adrian Bunk | 1 | 0.12% | 1 | 4.35% |
Total | 827 | 100.00% | 23 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.