Lines Matching refs:br
35 p->br->dev->name, p->port_no, p->dev->name, in br_log_state()
41 struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no) in br_get_port() argument
45 list_for_each_entry_rcu(p, &br->port_list, list) { in br_get_port()
57 struct net_bridge *br; in br_should_become_root_port() local
61 br = p->br; in br_should_become_root_port()
66 if (memcmp(&br->bridge_id, &p->designated_root, 8) <= 0) in br_should_become_root_port()
72 rp = br_get_port(br, root_port); in br_should_become_root_port()
105 static void br_root_selection(struct net_bridge *br) in br_root_selection() argument
110 list_for_each_entry(p, &br->port_list, list) { in br_root_selection()
116 br->root_port = root_port; in br_root_selection()
119 br->designated_root = br->bridge_id; in br_root_selection()
120 br->root_path_cost = 0; in br_root_selection()
122 p = br_get_port(br, root_port); in br_root_selection()
123 br->designated_root = p->designated_root; in br_root_selection()
124 br->root_path_cost = p->designated_cost + p->path_cost; in br_root_selection()
129 void br_become_root_bridge(struct net_bridge *br) in br_become_root_bridge() argument
131 br->max_age = br->bridge_max_age; in br_become_root_bridge()
132 br->hello_time = br->bridge_hello_time; in br_become_root_bridge()
133 br->forward_delay = br->bridge_forward_delay; in br_become_root_bridge()
134 br_topology_change_detection(br); in br_become_root_bridge()
135 del_timer(&br->tcn_timer); in br_become_root_bridge()
137 if (br->dev->flags & IFF_UP) { in br_become_root_bridge()
138 br_config_bpdu_generation(br); in br_become_root_bridge()
139 mod_timer(&br->hello_timer, jiffies + br->hello_time); in br_become_root_bridge()
147 struct net_bridge *br; in br_transmit_config() local
155 br = p->br; in br_transmit_config()
157 bpdu.topology_change = br->topology_change; in br_transmit_config()
159 bpdu.root = br->designated_root; in br_transmit_config()
160 bpdu.root_path_cost = br->root_path_cost; in br_transmit_config()
161 bpdu.bridge_id = br->bridge_id; in br_transmit_config()
163 if (br_is_root_bridge(br)) in br_transmit_config()
167 = br_get_port(br, br->root_port); in br_transmit_config()
168 bpdu.message_age = br->max_age in br_transmit_config()
172 bpdu.max_age = br->max_age; in br_transmit_config()
173 bpdu.hello_time = br->hello_time; in br_transmit_config()
174 bpdu.forward_delay = br->forward_delay; in br_transmit_config()
176 if (bpdu.message_age < br->max_age) { in br_transmit_config()
195 + (p->br->max_age - bpdu->message_age)); in br_record_config_information()
199 static inline void br_record_config_timeout_values(struct net_bridge *br, in br_record_config_timeout_values() argument
202 br->max_age = bpdu->max_age; in br_record_config_timeout_values()
203 br->hello_time = bpdu->hello_time; in br_record_config_timeout_values()
204 br->forward_delay = bpdu->forward_delay; in br_record_config_timeout_values()
205 br->topology_change = bpdu->topology_change; in br_record_config_timeout_values()
209 void br_transmit_tcn(struct net_bridge *br) in br_transmit_tcn() argument
211 br_send_tcn_bpdu(br_get_port(br, br->root_port)); in br_transmit_tcn()
217 struct net_bridge *br; in br_should_become_designated_port() local
220 br = p->br; in br_should_become_designated_port()
224 if (memcmp(&p->designated_root, &br->designated_root, 8)) in br_should_become_designated_port()
227 if (br->root_path_cost < p->designated_cost) in br_should_become_designated_port()
229 else if (br->root_path_cost > p->designated_cost) in br_should_become_designated_port()
232 t = memcmp(&br->bridge_id, &p->designated_bridge, 8); in br_should_become_designated_port()
245 static void br_designated_port_selection(struct net_bridge *br) in br_designated_port_selection() argument
249 list_for_each_entry(p, &br->port_list, list) { in br_designated_port_selection()
279 if (memcmp(&bpdu->bridge_id, &p->br->bridge_id, 8)) in br_supersedes_port_info()
289 static inline void br_topology_change_acknowledged(struct net_bridge *br) in br_topology_change_acknowledged() argument
291 br->topology_change_detected = 0; in br_topology_change_acknowledged()
292 del_timer(&br->tcn_timer); in br_topology_change_acknowledged()
296 void br_topology_change_detection(struct net_bridge *br) in br_topology_change_detection() argument
298 int isroot = br_is_root_bridge(br); in br_topology_change_detection()
300 pr_info("%s: topology change detected, %s\n", br->dev->name, in br_topology_change_detection()
304 br->topology_change = 1; in br_topology_change_detection()
305 mod_timer(&br->topology_change_timer, jiffies in br_topology_change_detection()
306 + br->bridge_forward_delay + br->bridge_max_age); in br_topology_change_detection()
307 } else if (!br->topology_change_detected) { in br_topology_change_detection()
308 br_transmit_tcn(br); in br_topology_change_detection()
309 mod_timer(&br->tcn_timer, jiffies + br->bridge_hello_time); in br_topology_change_detection()
312 br->topology_change_detected = 1; in br_topology_change_detection()
316 void br_config_bpdu_generation(struct net_bridge *br) in br_config_bpdu_generation() argument
320 list_for_each_entry(p, &br->port_list, list) { in br_config_bpdu_generation()
334 void br_configuration_update(struct net_bridge *br) in br_configuration_update() argument
336 br_root_selection(br); in br_configuration_update()
337 br_designated_port_selection(br); in br_configuration_update()
343 struct net_bridge *br; in br_become_designated_port() local
345 br = p->br; in br_become_designated_port()
346 p->designated_root = br->designated_root; in br_become_designated_port()
347 p->designated_cost = br->root_path_cost; in br_become_designated_port()
348 p->designated_bridge = br->bridge_id; in br_become_designated_port()
360 br_topology_change_detection(p->br); in br_make_blocking()
371 struct net_bridge *br = p->br; in br_make_forwarding() local
376 if (br->forward_delay == 0) { in br_make_forwarding()
378 br_topology_change_detection(br); in br_make_forwarding()
381 else if (p->br->stp_enabled == BR_KERNEL_STP) in br_make_forwarding()
388 if (br->forward_delay != 0) in br_make_forwarding()
389 mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay); in br_make_forwarding()
393 void br_port_state_selection(struct net_bridge *br) in br_port_state_selection() argument
398 if (br->stp_enabled == BR_USER_STP) in br_port_state_selection()
401 list_for_each_entry(p, &br->port_list, list) { in br_port_state_selection()
403 if (p->port_no == br->root_port) { in br_port_state_selection()
430 struct net_bridge *br; in br_received_config_bpdu() local
433 br = p->br; in br_received_config_bpdu()
434 was_root = br_is_root_bridge(br); in br_received_config_bpdu()
438 br_configuration_update(br); in br_received_config_bpdu()
439 br_port_state_selection(br); in br_received_config_bpdu()
441 if (!br_is_root_bridge(br) && was_root) { in br_received_config_bpdu()
442 del_timer(&br->hello_timer); in br_received_config_bpdu()
443 if (br->topology_change_detected) { in br_received_config_bpdu()
444 del_timer(&br->topology_change_timer); in br_received_config_bpdu()
445 br_transmit_tcn(br); in br_received_config_bpdu()
447 mod_timer(&br->tcn_timer, in br_received_config_bpdu()
448 jiffies + br->bridge_hello_time); in br_received_config_bpdu()
452 if (p->port_no == br->root_port) { in br_received_config_bpdu()
453 br_record_config_timeout_values(br, bpdu); in br_received_config_bpdu()
454 br_config_bpdu_generation(br); in br_received_config_bpdu()
456 br_topology_change_acknowledged(br); in br_received_config_bpdu()
468 p->br->dev->name, p->port_no, p->dev->name); in br_received_tcn_bpdu()
470 br_topology_change_detection(p->br); in br_received_tcn_bpdu()