Lines Matching refs:p

73 void br_port_carrier_check(struct net_bridge_port *p, bool *notified)  in br_port_carrier_check()  argument
75 struct net_device *dev = p->dev; in br_port_carrier_check()
76 struct net_bridge *br = p->br; in br_port_carrier_check()
78 if (!(p->flags & BR_ADMIN_COST) && in br_port_carrier_check()
80 p->path_cost = port_cost(dev); in br_port_carrier_check()
88 if (p->state == BR_STATE_DISABLED) { in br_port_carrier_check()
89 br_stp_enable_port(p); in br_port_carrier_check()
93 if (p->state != BR_STATE_DISABLED) { in br_port_carrier_check()
94 br_stp_disable_port(p); in br_port_carrier_check()
101 static void br_port_set_promisc(struct net_bridge_port *p) in br_port_set_promisc() argument
105 if (br_promisc_port(p)) in br_port_set_promisc()
108 err = dev_set_promiscuity(p->dev, 1); in br_port_set_promisc()
112 br_fdb_unsync_static(p->br, p); in br_port_set_promisc()
113 p->flags |= BR_PROMISC; in br_port_set_promisc()
116 static void br_port_clear_promisc(struct net_bridge_port *p) in br_port_clear_promisc() argument
125 if (!br_promisc_port(p) || !(p->dev->priv_flags & IFF_UNICAST_FLT)) in br_port_clear_promisc()
131 err = br_fdb_sync_static(p->br, p); in br_port_clear_promisc()
135 dev_set_promiscuity(p->dev, -1); in br_port_clear_promisc()
136 p->flags &= ~BR_PROMISC; in br_port_clear_promisc()
146 struct net_bridge_port *p; in br_manage_promisc() local
155 list_for_each_entry(p, &br->port_list, list) { in br_manage_promisc()
157 br_port_set_promisc(p); in br_manage_promisc()
169 if ((p->dev->priv_flags & IFF_UNICAST_FLT) && in br_manage_promisc()
171 (br->auto_cnt == 1 && br_auto_port(p)))) in br_manage_promisc()
172 br_port_clear_promisc(p); in br_manage_promisc()
174 br_port_set_promisc(p); in br_manage_promisc()
179 int nbp_backup_change(struct net_bridge_port *p, in nbp_backup_change() argument
182 struct net_bridge_port *old_backup = rtnl_dereference(p->backup_port); in nbp_backup_change()
192 if (backup_p->br != p->br) in nbp_backup_change()
196 if (p == backup_p) in nbp_backup_change()
208 rcu_assign_pointer(p->backup_port, backup_p); in nbp_backup_change()
213 static void nbp_backup_clear(struct net_bridge_port *p) in nbp_backup_clear() argument
215 nbp_backup_change(p, NULL); in nbp_backup_clear()
216 if (p->backup_redirected_cnt) { in nbp_backup_clear()
219 list_for_each_entry(cur_p, &p->br->port_list, list) { in nbp_backup_clear()
223 if (backup_p == p) in nbp_backup_clear()
228 WARN_ON(rcu_access_pointer(p->backup_port) || p->backup_redirected_cnt); in nbp_backup_clear()
233 struct net_bridge_port *p; in nbp_update_port_count() local
236 list_for_each_entry(p, &br->port_list, list) { in nbp_update_port_count()
237 if (br_auto_port(p)) in nbp_update_port_count()
246 static void nbp_delete_promisc(struct net_bridge_port *p) in nbp_delete_promisc() argument
252 dev_set_allmulti(p->dev, -1); in nbp_delete_promisc()
253 if (br_promisc_port(p)) in nbp_delete_promisc()
254 dev_set_promiscuity(p->dev, -1); in nbp_delete_promisc()
256 br_fdb_unsync_static(p->br, p); in nbp_delete_promisc()
261 struct net_bridge_port *p in release_nbp() local
263 kfree(p); in release_nbp()
268 struct net_bridge_port *p = kobj_to_brport(kobj); in brport_get_ownership() local
270 net_ns_get_ownership(dev_net(p->dev), uid, gid); in brport_get_ownership()
281 static void destroy_nbp(struct net_bridge_port *p) in destroy_nbp() argument
283 struct net_device *dev = p->dev; in destroy_nbp()
285 p->br = NULL; in destroy_nbp()
286 p->dev = NULL; in destroy_nbp()
287 netdev_put(dev, &p->dev_tracker); in destroy_nbp()
289 kobject_put(&p->kobj); in destroy_nbp()
294 struct net_bridge_port *p = in destroy_nbp_rcu() local
296 destroy_nbp(p); in destroy_nbp_rcu()
302 struct net_bridge_port *p; in get_max_headroom() local
304 list_for_each_entry(p, &br->port_list, list) { in get_max_headroom()
305 unsigned dev_headroom = netdev_get_fwd_headroom(p->dev); in get_max_headroom()
316 struct net_bridge_port *p; in update_headroom() local
318 list_for_each_entry(p, &br->port_list, list) in update_headroom()
319 netdev_set_rx_headroom(p->dev, new_hr); in update_headroom()
333 static void del_nbp(struct net_bridge_port *p) in del_nbp() argument
335 struct net_bridge *br = p->br; in del_nbp()
336 struct net_device *dev = p->dev; in del_nbp()
338 sysfs_remove_link(br->ifobj, p->dev->name); in del_nbp()
340 nbp_delete_promisc(p); in del_nbp()
343 br_stp_disable_port(p); in del_nbp()
346 br_mrp_port_del(br, p); in del_nbp()
347 br_cfm_port_del(br, p); in del_nbp()
349 br_ifinfo_notify(RTM_DELLINK, NULL, p); in del_nbp()
351 list_del_rcu(&p->list); in del_nbp()
356 nbp_vlan_flush(p); in del_nbp()
357 br_fdb_delete_by_port(br, p, 0, 1); in del_nbp()
359 nbp_backup_clear(p); in del_nbp()
369 br_multicast_del_port(p); in del_nbp()
371 kobject_uevent(&p->kobj, KOBJ_REMOVE); in del_nbp()
372 kobject_del(&p->kobj); in del_nbp()
374 br_netpoll_disable(p); in del_nbp()
376 call_rcu(&p->rcu, destroy_nbp_rcu); in del_nbp()
383 struct net_bridge_port *p, *n; in br_dev_delete() local
385 list_for_each_entry_safe(p, n, &br->port_list, list) { in br_dev_delete()
386 del_nbp(p); in br_dev_delete()
403 struct net_bridge_port *p; in find_portno() local
411 list_for_each_entry(p, &br->port_list, list) in find_portno()
412 __set_bit(p->port_no, inuse); in find_portno()
424 struct net_bridge_port *p; in new_nbp() local
431 p = kzalloc(sizeof(*p), GFP_KERNEL); in new_nbp()
432 if (p == NULL) in new_nbp()
435 p->br = br; in new_nbp()
436 netdev_hold(dev, &p->dev_tracker, GFP_KERNEL); in new_nbp()
437 p->dev = dev; in new_nbp()
438 p->path_cost = port_cost(dev); in new_nbp()
439 p->priority = 0x8000 >> BR_PORT_BITS; in new_nbp()
440 p->port_no = index; in new_nbp()
441 p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD; in new_nbp()
442 br_init_port(p); in new_nbp()
443 br_set_state(p, BR_STATE_DISABLED); in new_nbp()
444 br_stp_port_timer_init(p); in new_nbp()
445 err = br_multicast_add_port(p); in new_nbp()
447 netdev_put(dev, &p->dev_tracker); in new_nbp()
448 kfree(p); in new_nbp()
449 p = ERR_PTR(err); in new_nbp()
452 return p; in new_nbp()
503 const struct net_bridge_port *p; in br_mtu_min() local
506 list_for_each_entry(p, &br->port_list, list) in br_mtu_min()
507 if (!ret_mtu || ret_mtu > p->dev->mtu) in br_mtu_min()
508 ret_mtu = p->dev->mtu; in br_mtu_min()
531 const struct net_bridge_port *p; in br_set_gso_limits() local
534 list_for_each_entry(p, &br->port_list, list) { in br_set_gso_limits()
535 tso_max_size = min(tso_max_size, p->dev->tso_max_size); in br_set_gso_limits()
536 tso_max_segs = min(tso_max_segs, p->dev->tso_max_segs); in br_set_gso_limits()
548 struct net_bridge_port *p; in br_features_recompute() local
557 list_for_each_entry(p, &br->port_list, list) { in br_features_recompute()
559 p->dev->features, mask); in br_features_recompute()
570 struct net_bridge_port *p; in br_add_if() local
599 p = new_nbp(br, dev); in br_add_if()
600 if (IS_ERR(p)) in br_add_if()
601 return PTR_ERR(p); in br_add_if()
607 br_multicast_del_port(p); in br_add_if()
608 netdev_put(dev, &p->dev_tracker); in br_add_if()
609 kfree(p); /* kobject not yet init'd, manually free */ in br_add_if()
613 err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj), in br_add_if()
618 err = br_sysfs_addif(p); in br_add_if()
622 err = br_netpoll_enable(p); in br_add_if()
626 err = netdev_rx_handler_register(dev, br_get_rx_handler(dev), p); in br_add_if()
638 list_add_rcu(&p->list, &br->port_list); in br_add_if()
641 if (!br_promisc_port(p) && (p->dev->priv_flags & IFF_UNICAST_FLT)) { in br_add_if()
650 fdb_synced = br_fdb_sync_static(br, p) == 0; in br_add_if()
664 if (br_fdb_add_local(br, p, dev->dev_addr, 0)) in br_add_if()
676 err = nbp_vlan_init(p, extack); in br_add_if()
687 br_stp_enable_port(p); in br_add_if()
690 br_ifinfo_notify(RTM_NEWLINK, NULL, p); in br_add_if()
698 kobject_uevent(&p->kobj, KOBJ_ADD); in br_add_if()
704 br_fdb_unsync_static(br, p); in br_add_if()
705 list_del_rcu(&p->list); in br_add_if()
706 br_fdb_delete_by_port(br, p, 0, 1); in br_add_if()
713 br_netpoll_disable(p); in br_add_if()
715 sysfs_remove_link(br->ifobj, p->dev->name); in br_add_if()
717 br_multicast_del_port(p); in br_add_if()
718 netdev_put(dev, &p->dev_tracker); in br_add_if()
719 kobject_put(&p->kobj); in br_add_if()
728 struct net_bridge_port *p; in br_del_if() local
731 p = br_port_get_rtnl(dev); in br_del_if()
732 if (!p || p->br != br) in br_del_if()
739 del_nbp(p); in br_del_if()
756 void br_port_flags_change(struct net_bridge_port *p, unsigned long mask) in br_port_flags_change() argument
758 struct net_bridge *br = p->br; in br_port_flags_change()
769 struct net_bridge_port *p; in br_port_flag_is_set() local
771 p = br_port_get_rtnl_rcu(dev); in br_port_flag_is_set()
772 if (!p) in br_port_flag_is_set()
775 return p->flags & flag; in br_port_flag_is_set()