• Home
  • Raw
  • Download

Lines Matching refs:br

46 	if (br_opt_get(p->br, BROPT_MST_ENABLED)) {  in br_set_state()
49 br_warn(p->br, "error setting MST state on port %u(%s)\n", in br_set_state()
54 br_warn(p->br, "error setting offload STP state on port %u(%s)\n", in br_set_state()
57 br_info(p->br, "port %u(%s) entered %s state\n", in br_set_state()
61 if (p->br->stp_enabled == BR_KERNEL_STP) { in br_set_state()
88 struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no) in br_get_port() argument
92 list_for_each_entry_rcu(p, &br->port_list, list, in br_get_port()
93 lockdep_is_held(&br->lock)) { in br_get_port()
105 struct net_bridge *br; in br_should_become_root_port() local
109 br = p->br; in br_should_become_root_port()
114 if (memcmp(&br->bridge_id, &p->designated_root, 8) <= 0) in br_should_become_root_port()
120 rp = br_get_port(br, root_port); in br_should_become_root_port()
152 static void br_root_port_block(const struct net_bridge *br, in br_root_port_block() argument
156 br_notice(br, "port %u(%s) tried to become root port (blocked)", in br_root_port_block()
162 if (br->forward_delay > 0) in br_root_port_block()
163 mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay); in br_root_port_block()
167 static void br_root_selection(struct net_bridge *br) in br_root_selection() argument
172 list_for_each_entry(p, &br->port_list, list) { in br_root_selection()
177 br_root_port_block(br, p); in br_root_selection()
182 br->root_port = root_port; in br_root_selection()
185 br->designated_root = br->bridge_id; in br_root_selection()
186 br->root_path_cost = 0; in br_root_selection()
188 p = br_get_port(br, root_port); in br_root_selection()
189 br->designated_root = p->designated_root; in br_root_selection()
190 br->root_path_cost = p->designated_cost + p->path_cost; in br_root_selection()
195 void br_become_root_bridge(struct net_bridge *br) in br_become_root_bridge() argument
197 br->max_age = br->bridge_max_age; in br_become_root_bridge()
198 br->hello_time = br->bridge_hello_time; in br_become_root_bridge()
199 br->forward_delay = br->bridge_forward_delay; in br_become_root_bridge()
200 br_topology_change_detection(br); in br_become_root_bridge()
201 del_timer(&br->tcn_timer); in br_become_root_bridge()
203 if (br->dev->flags & IFF_UP) { in br_become_root_bridge()
204 br_config_bpdu_generation(br); in br_become_root_bridge()
205 mod_timer(&br->hello_timer, jiffies + br->hello_time); in br_become_root_bridge()
213 struct net_bridge *br; in br_transmit_config() local
220 br = p->br; in br_transmit_config()
222 bpdu.topology_change = br->topology_change; in br_transmit_config()
224 bpdu.root = br->designated_root; in br_transmit_config()
225 bpdu.root_path_cost = br->root_path_cost; in br_transmit_config()
226 bpdu.bridge_id = br->bridge_id; in br_transmit_config()
228 if (br_is_root_bridge(br)) in br_transmit_config()
232 = br_get_port(br, br->root_port); in br_transmit_config()
236 bpdu.max_age = br->max_age; in br_transmit_config()
237 bpdu.hello_time = br->hello_time; in br_transmit_config()
238 bpdu.forward_delay = br->forward_delay; in br_transmit_config()
240 if (bpdu.message_age < br->max_age) { in br_transmit_config()
244 if (p->br->stp_enabled == BR_KERNEL_STP) in br_transmit_config()
265 static void br_record_config_timeout_values(struct net_bridge *br, in br_record_config_timeout_values() argument
268 br->max_age = bpdu->max_age; in br_record_config_timeout_values()
269 br->hello_time = bpdu->hello_time; in br_record_config_timeout_values()
270 br->forward_delay = bpdu->forward_delay; in br_record_config_timeout_values()
271 __br_set_topology_change(br, bpdu->topology_change); in br_record_config_timeout_values()
275 void br_transmit_tcn(struct net_bridge *br) in br_transmit_tcn() argument
279 p = br_get_port(br, br->root_port); in br_transmit_tcn()
283 br_notice(br, "root port %u not found for topology notice\n", in br_transmit_tcn()
284 br->root_port); in br_transmit_tcn()
290 struct net_bridge *br; in br_should_become_designated_port() local
293 br = p->br; in br_should_become_designated_port()
297 if (memcmp(&p->designated_root, &br->designated_root, 8)) in br_should_become_designated_port()
300 if (br->root_path_cost < p->designated_cost) in br_should_become_designated_port()
302 else if (br->root_path_cost > p->designated_cost) in br_should_become_designated_port()
305 t = memcmp(&br->bridge_id, &p->designated_bridge, 8); in br_should_become_designated_port()
318 static void br_designated_port_selection(struct net_bridge *br) in br_designated_port_selection() argument
322 list_for_each_entry(p, &br->port_list, list) { in br_designated_port_selection()
353 if (memcmp(&bpdu->bridge_id, &p->br->bridge_id, 8)) in br_supersedes_port_info()
363 static void br_topology_change_acknowledged(struct net_bridge *br) in br_topology_change_acknowledged() argument
365 br->topology_change_detected = 0; in br_topology_change_acknowledged()
366 del_timer(&br->tcn_timer); in br_topology_change_acknowledged()
370 void br_topology_change_detection(struct net_bridge *br) in br_topology_change_detection() argument
372 int isroot = br_is_root_bridge(br); in br_topology_change_detection()
374 if (br->stp_enabled != BR_KERNEL_STP) in br_topology_change_detection()
377 br_info(br, "topology change detected, %s\n", in br_topology_change_detection()
381 __br_set_topology_change(br, 1); in br_topology_change_detection()
382 mod_timer(&br->topology_change_timer, jiffies in br_topology_change_detection()
383 + br->bridge_forward_delay + br->bridge_max_age); in br_topology_change_detection()
384 } else if (!br->topology_change_detected) { in br_topology_change_detection()
385 br_transmit_tcn(br); in br_topology_change_detection()
386 mod_timer(&br->tcn_timer, jiffies + br->bridge_hello_time); in br_topology_change_detection()
389 br->topology_change_detected = 1; in br_topology_change_detection()
393 void br_config_bpdu_generation(struct net_bridge *br) in br_config_bpdu_generation() argument
397 list_for_each_entry(p, &br->port_list, list) { in br_config_bpdu_generation()
411 void br_configuration_update(struct net_bridge *br) in br_configuration_update() argument
413 br_root_selection(br); in br_configuration_update()
414 br_designated_port_selection(br); in br_configuration_update()
420 struct net_bridge *br; in br_become_designated_port() local
422 br = p->br; in br_become_designated_port()
423 p->designated_root = br->designated_root; in br_become_designated_port()
424 p->designated_cost = br->root_path_cost; in br_become_designated_port()
425 p->designated_bridge = br->bridge_id; in br_become_designated_port()
437 br_topology_change_detection(p->br); in br_make_blocking()
449 struct net_bridge *br = p->br; in br_make_forwarding() local
454 if (br->stp_enabled == BR_NO_STP || br->forward_delay == 0) { in br_make_forwarding()
456 br_topology_change_detection(br); in br_make_forwarding()
458 } else if (br->stp_enabled == BR_KERNEL_STP) in br_make_forwarding()
465 if (br->forward_delay != 0) in br_make_forwarding()
466 mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay); in br_make_forwarding()
470 void br_port_state_selection(struct net_bridge *br) in br_port_state_selection() argument
475 list_for_each_entry(p, &br->port_list, list) { in br_port_state_selection()
480 if (br->stp_enabled != BR_USER_STP) { in br_port_state_selection()
481 if (p->port_no == br->root_port) { in br_port_state_selection()
506 netif_carrier_off(br->dev); in br_port_state_selection()
508 netif_carrier_on(br->dev); in br_port_state_selection()
522 struct net_bridge *br; in br_received_config_bpdu() local
527 br = p->br; in br_received_config_bpdu()
528 was_root = br_is_root_bridge(br); in br_received_config_bpdu()
532 br_configuration_update(br); in br_received_config_bpdu()
533 br_port_state_selection(br); in br_received_config_bpdu()
535 if (!br_is_root_bridge(br) && was_root) { in br_received_config_bpdu()
536 del_timer(&br->hello_timer); in br_received_config_bpdu()
537 if (br->topology_change_detected) { in br_received_config_bpdu()
538 del_timer(&br->topology_change_timer); in br_received_config_bpdu()
539 br_transmit_tcn(br); in br_received_config_bpdu()
541 mod_timer(&br->tcn_timer, in br_received_config_bpdu()
542 jiffies + br->bridge_hello_time); in br_received_config_bpdu()
546 if (p->port_no == br->root_port) { in br_received_config_bpdu()
547 br_record_config_timeout_values(br, bpdu); in br_received_config_bpdu()
548 br_config_bpdu_generation(br); in br_received_config_bpdu()
550 br_topology_change_acknowledged(br); in br_received_config_bpdu()
563 br_info(p->br, "port %u(%s) received tcn bpdu\n", in br_received_tcn_bpdu()
566 br_topology_change_detection(p->br); in br_received_tcn_bpdu()
572 int br_set_hello_time(struct net_bridge *br, unsigned long val) in br_set_hello_time() argument
579 spin_lock_bh(&br->lock); in br_set_hello_time()
580 br->bridge_hello_time = t; in br_set_hello_time()
581 if (br_is_root_bridge(br)) in br_set_hello_time()
582 br->hello_time = br->bridge_hello_time; in br_set_hello_time()
583 spin_unlock_bh(&br->lock); in br_set_hello_time()
587 int br_set_max_age(struct net_bridge *br, unsigned long val) in br_set_max_age() argument
594 spin_lock_bh(&br->lock); in br_set_max_age()
595 br->bridge_max_age = t; in br_set_max_age()
596 if (br_is_root_bridge(br)) in br_set_max_age()
597 br->max_age = br->bridge_max_age; in br_set_max_age()
598 spin_unlock_bh(&br->lock); in br_set_max_age()
629 int br_set_ageing_time(struct net_bridge *br, clock_t ageing_time) in br_set_ageing_time() argument
634 err = __set_ageing_time(br->dev, t); in br_set_ageing_time()
638 spin_lock_bh(&br->lock); in br_set_ageing_time()
639 br->bridge_ageing_time = t; in br_set_ageing_time()
640 br->ageing_time = t; in br_set_ageing_time()
641 spin_unlock_bh(&br->lock); in br_set_ageing_time()
643 mod_delayed_work(system_long_wq, &br->gc_work, 0); in br_set_ageing_time()
650 const struct net_bridge *br; in br_get_ageing_time() local
655 br = netdev_priv(br_dev); in br_get_ageing_time()
657 return jiffies_to_clock_t(br->ageing_time); in br_get_ageing_time()
662 void __br_set_topology_change(struct net_bridge *br, unsigned char val) in __br_set_topology_change() argument
667 if (br->stp_enabled == BR_KERNEL_STP && br->topology_change != val) { in __br_set_topology_change()
673 t = 2 * br->forward_delay; in __br_set_topology_change()
674 br_debug(br, "decreasing ageing time to %lu\n", t); in __br_set_topology_change()
676 t = br->bridge_ageing_time; in __br_set_topology_change()
677 br_debug(br, "restoring ageing time to %lu\n", t); in __br_set_topology_change()
680 err = __set_ageing_time(br->dev, t); in __br_set_topology_change()
682 br_warn(br, "error offloading ageing time\n"); in __br_set_topology_change()
684 br->ageing_time = t; in __br_set_topology_change()
687 br->topology_change = val; in __br_set_topology_change()
690 void __br_set_forward_delay(struct net_bridge *br, unsigned long t) in __br_set_forward_delay() argument
692 br->bridge_forward_delay = t; in __br_set_forward_delay()
693 if (br_is_root_bridge(br)) in __br_set_forward_delay()
694 br->forward_delay = br->bridge_forward_delay; in __br_set_forward_delay()
697 int br_set_forward_delay(struct net_bridge *br, unsigned long val) in br_set_forward_delay() argument
702 spin_lock_bh(&br->lock); in br_set_forward_delay()
703 if (br->stp_enabled != BR_NO_STP && in br_set_forward_delay()
707 __br_set_forward_delay(br, t); in br_set_forward_delay()
711 spin_unlock_bh(&br->lock); in br_set_forward_delay()