• Home
  • Raw
  • Download

Lines Matching full:p

29 void br_set_state(struct net_bridge_port *p, unsigned int state)  in br_set_state()  argument
32 .orig_dev = p->dev, in br_set_state()
42 if (p->flags & BR_MRP_AWARE) in br_set_state()
45 p->state = state; in br_set_state()
46 err = switchdev_port_attr_set(p->dev, &attr); in br_set_state()
48 br_warn(p->br, "error setting offload STP state on port %u(%s)\n", in br_set_state()
49 (unsigned int) p->port_no, p->dev->name); in br_set_state()
51 br_info(p->br, "port %u(%s) entered %s state\n", in br_set_state()
52 (unsigned int) p->port_no, p->dev->name, in br_set_state()
53 br_port_state_names[p->state]); in br_set_state()
55 if (p->br->stp_enabled == BR_KERNEL_STP) { in br_set_state()
56 switch (p->state) { in br_set_state()
58 p->stp_xstats.transition_blk++; in br_set_state()
61 p->stp_xstats.transition_fwd++; in br_set_state()
70 struct net_bridge_port *p; in br_get_port() local
72 list_for_each_entry_rcu(p, &br->port_list, list, in br_get_port()
74 if (p->port_no == port_no) in br_get_port()
75 return p; in br_get_port()
82 static int br_should_become_root_port(const struct net_bridge_port *p, in br_should_become_root_port() argument
89 br = p->br; in br_should_become_root_port()
90 if (p->state == BR_STATE_DISABLED || in br_should_become_root_port()
91 br_is_designated_port(p)) in br_should_become_root_port()
94 if (memcmp(&br->bridge_id, &p->designated_root, 8) <= 0) in br_should_become_root_port()
102 t = memcmp(&p->designated_root, &rp->designated_root, 8); in br_should_become_root_port()
108 if (p->designated_cost + p->path_cost < in br_should_become_root_port()
111 else if (p->designated_cost + p->path_cost > in br_should_become_root_port()
115 t = memcmp(&p->designated_bridge, &rp->designated_bridge, 8); in br_should_become_root_port()
121 if (p->designated_port < rp->designated_port) in br_should_become_root_port()
123 else if (p->designated_port > rp->designated_port) in br_should_become_root_port()
126 if (p->port_id < rp->port_id) in br_should_become_root_port()
133 struct net_bridge_port *p) in br_root_port_block() argument
137 (unsigned int) p->port_no, p->dev->name); in br_root_port_block()
139 br_set_state(p, BR_STATE_LISTENING); in br_root_port_block()
140 br_ifinfo_notify(RTM_NEWLINK, NULL, p); in br_root_port_block()
143 mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay); in br_root_port_block()
149 struct net_bridge_port *p; in br_root_selection() local
152 list_for_each_entry(p, &br->port_list, list) { in br_root_selection()
153 if (!br_should_become_root_port(p, root_port)) in br_root_selection()
156 if (p->flags & BR_ROOT_BLOCK) in br_root_selection()
157 br_root_port_block(br, p); in br_root_selection()
159 root_port = p->port_no; in br_root_selection()
168 p = br_get_port(br, root_port); in br_root_selection()
169 br->designated_root = p->designated_root; in br_root_selection()
170 br->root_path_cost = p->designated_cost + p->path_cost; in br_root_selection()
190 void br_transmit_config(struct net_bridge_port *p) in br_transmit_config() argument
195 if (timer_pending(&p->hold_timer)) { in br_transmit_config()
196 p->config_pending = 1; in br_transmit_config()
200 br = p->br; in br_transmit_config()
203 bpdu.topology_change_ack = p->topology_change_ack; in br_transmit_config()
207 bpdu.port_id = p->port_id; in br_transmit_config()
221 br_send_config_bpdu(p, &bpdu); in br_transmit_config()
222 p->topology_change_ack = 0; in br_transmit_config()
223 p->config_pending = 0; in br_transmit_config()
224 if (p->br->stp_enabled == BR_KERNEL_STP) in br_transmit_config()
225 mod_timer(&p->hold_timer, in br_transmit_config()
231 static void br_record_config_information(struct net_bridge_port *p, in br_record_config_information() argument
234 p->designated_root = bpdu->root; in br_record_config_information()
235 p->designated_cost = bpdu->root_path_cost; in br_record_config_information()
236 p->designated_bridge = bpdu->bridge_id; in br_record_config_information()
237 p->designated_port = bpdu->port_id; in br_record_config_information()
238 p->designated_age = jiffies - bpdu->message_age; in br_record_config_information()
240 mod_timer(&p->message_age_timer, jiffies in br_record_config_information()
257 struct net_bridge_port *p; in br_transmit_tcn() local
259 p = br_get_port(br, br->root_port); in br_transmit_tcn()
260 if (p) in br_transmit_tcn()
261 br_send_tcn_bpdu(p); in br_transmit_tcn()
268 static int br_should_become_designated_port(const struct net_bridge_port *p) in br_should_become_designated_port() argument
273 br = p->br; in br_should_become_designated_port()
274 if (br_is_designated_port(p)) in br_should_become_designated_port()
277 if (memcmp(&p->designated_root, &br->designated_root, 8)) in br_should_become_designated_port()
280 if (br->root_path_cost < p->designated_cost) in br_should_become_designated_port()
282 else if (br->root_path_cost > p->designated_cost) in br_should_become_designated_port()
285 t = memcmp(&br->bridge_id, &p->designated_bridge, 8); in br_should_become_designated_port()
291 if (p->port_id < p->designated_port) in br_should_become_designated_port()
300 struct net_bridge_port *p; in br_designated_port_selection() local
302 list_for_each_entry(p, &br->port_list, list) { in br_designated_port_selection()
303 if (p->state != BR_STATE_DISABLED && in br_designated_port_selection()
304 br_should_become_designated_port(p)) in br_designated_port_selection()
305 br_become_designated_port(p); in br_designated_port_selection()
311 static int br_supersedes_port_info(const struct net_bridge_port *p, in br_supersedes_port_info() argument
316 t = memcmp(&bpdu->root, &p->designated_root, 8); in br_supersedes_port_info()
322 if (bpdu->root_path_cost < p->designated_cost) in br_supersedes_port_info()
324 else if (bpdu->root_path_cost > p->designated_cost) in br_supersedes_port_info()
327 t = memcmp(&bpdu->bridge_id, &p->designated_bridge, 8); in br_supersedes_port_info()
333 if (memcmp(&bpdu->bridge_id, &p->br->bridge_id, 8)) in br_supersedes_port_info()
336 if (bpdu->port_id <= p->designated_port) in br_supersedes_port_info()
375 struct net_bridge_port *p; in br_config_bpdu_generation() local
377 list_for_each_entry(p, &br->port_list, list) { in br_config_bpdu_generation()
378 if (p->state != BR_STATE_DISABLED && in br_config_bpdu_generation()
379 br_is_designated_port(p)) in br_config_bpdu_generation()
380 br_transmit_config(p); in br_config_bpdu_generation()
385 static void br_reply(struct net_bridge_port *p) in br_reply() argument
387 br_transmit_config(p); in br_reply()
398 void br_become_designated_port(struct net_bridge_port *p) in br_become_designated_port() argument
402 br = p->br; in br_become_designated_port()
403 p->designated_root = br->designated_root; in br_become_designated_port()
404 p->designated_cost = br->root_path_cost; in br_become_designated_port()
405 p->designated_bridge = br->bridge_id; in br_become_designated_port()
406 p->designated_port = p->port_id; in br_become_designated_port()
411 static void br_make_blocking(struct net_bridge_port *p) in br_make_blocking() argument
413 if (p->state != BR_STATE_DISABLED && in br_make_blocking()
414 p->state != BR_STATE_BLOCKING) { in br_make_blocking()
415 if (p->state == BR_STATE_FORWARDING || in br_make_blocking()
416 p->state == BR_STATE_LEARNING) in br_make_blocking()
417 br_topology_change_detection(p->br); in br_make_blocking()
419 br_set_state(p, BR_STATE_BLOCKING); in br_make_blocking()
420 br_ifinfo_notify(RTM_NEWLINK, NULL, p); in br_make_blocking()
422 del_timer(&p->forward_delay_timer); in br_make_blocking()
427 static void br_make_forwarding(struct net_bridge_port *p) in br_make_forwarding() argument
429 struct net_bridge *br = p->br; in br_make_forwarding()
431 if (p->state != BR_STATE_BLOCKING) in br_make_forwarding()
435 br_set_state(p, BR_STATE_FORWARDING); in br_make_forwarding()
437 del_timer(&p->forward_delay_timer); in br_make_forwarding()
439 br_set_state(p, BR_STATE_LISTENING); in br_make_forwarding()
441 br_set_state(p, BR_STATE_LEARNING); in br_make_forwarding()
443 br_ifinfo_notify(RTM_NEWLINK, NULL, p); in br_make_forwarding()
446 mod_timer(&p->forward_delay_timer, jiffies + br->forward_delay); in br_make_forwarding()
452 struct net_bridge_port *p; in br_port_state_selection() local
455 list_for_each_entry(p, &br->port_list, list) { in br_port_state_selection()
456 if (p->state == BR_STATE_DISABLED) in br_port_state_selection()
461 if (p->port_no == br->root_port) { in br_port_state_selection()
462 p->config_pending = 0; in br_port_state_selection()
463 p->topology_change_ack = 0; in br_port_state_selection()
464 br_make_forwarding(p); in br_port_state_selection()
465 } else if (br_is_designated_port(p)) { in br_port_state_selection()
466 del_timer(&p->message_age_timer); in br_port_state_selection()
467 br_make_forwarding(p); in br_port_state_selection()
469 p->config_pending = 0; in br_port_state_selection()
470 p->topology_change_ack = 0; in br_port_state_selection()
471 br_make_blocking(p); in br_port_state_selection()
475 if (p->state != BR_STATE_BLOCKING) in br_port_state_selection()
476 br_multicast_enable_port(p); in br_port_state_selection()
481 if (p->state == BR_STATE_FORWARDING) in br_port_state_selection()
492 static void br_topology_change_acknowledge(struct net_bridge_port *p) in br_topology_change_acknowledge() argument
494 p->topology_change_ack = 1; in br_topology_change_acknowledge()
495 br_transmit_config(p); in br_topology_change_acknowledge()
499 void br_received_config_bpdu(struct net_bridge_port *p, in br_received_config_bpdu() argument
505 p->stp_xstats.rx_bpdu++; in br_received_config_bpdu()
507 br = p->br; in br_received_config_bpdu()
510 if (br_supersedes_port_info(p, bpdu)) { in br_received_config_bpdu()
511 br_record_config_information(p, bpdu); in br_received_config_bpdu()
526 if (p->port_no == br->root_port) { in br_received_config_bpdu()
532 } else if (br_is_designated_port(p)) { in br_received_config_bpdu()
533 br_reply(p); in br_received_config_bpdu()
538 void br_received_tcn_bpdu(struct net_bridge_port *p) in br_received_tcn_bpdu() argument
540 p->stp_xstats.rx_tcn++; in br_received_tcn_bpdu()
542 if (br_is_designated_port(p)) { in br_received_tcn_bpdu()
543 br_info(p->br, "port %u(%s) received tcn bpdu\n", in br_received_tcn_bpdu()
544 (unsigned int) p->port_no, p->dev->name); in br_received_tcn_bpdu()
546 br_topology_change_detection(p->br); in br_received_tcn_bpdu()
547 br_topology_change_acknowledge(p); in br_received_tcn_bpdu()