Lines Matching refs:p
64 void br_port_carrier_check(struct net_bridge_port *p, bool *notified) in br_port_carrier_check() argument
66 struct net_device *dev = p->dev; in br_port_carrier_check()
67 struct net_bridge *br = p->br; in br_port_carrier_check()
69 if (!(p->flags & BR_ADMIN_COST) && in br_port_carrier_check()
71 p->path_cost = port_cost(dev); in br_port_carrier_check()
79 if (p->state == BR_STATE_DISABLED) { in br_port_carrier_check()
80 br_stp_enable_port(p); in br_port_carrier_check()
84 if (p->state != BR_STATE_DISABLED) { in br_port_carrier_check()
85 br_stp_disable_port(p); in br_port_carrier_check()
92 static void br_port_set_promisc(struct net_bridge_port *p) in br_port_set_promisc() argument
96 if (br_promisc_port(p)) in br_port_set_promisc()
99 err = dev_set_promiscuity(p->dev, 1); in br_port_set_promisc()
103 br_fdb_unsync_static(p->br, p); in br_port_set_promisc()
104 p->flags |= BR_PROMISC; in br_port_set_promisc()
107 static void br_port_clear_promisc(struct net_bridge_port *p) in br_port_clear_promisc() argument
116 if (!br_promisc_port(p) || !(p->dev->priv_flags & IFF_UNICAST_FLT)) in br_port_clear_promisc()
122 err = br_fdb_sync_static(p->br, p); in br_port_clear_promisc()
126 dev_set_promiscuity(p->dev, -1); in br_port_clear_promisc()
127 p->flags &= ~BR_PROMISC; in br_port_clear_promisc()
137 struct net_bridge_port *p; in br_manage_promisc() local
146 list_for_each_entry(p, &br->port_list, list) { in br_manage_promisc()
148 br_port_set_promisc(p); in br_manage_promisc()
161 (br->auto_cnt == 1 && br_auto_port(p))) in br_manage_promisc()
162 br_port_clear_promisc(p); in br_manage_promisc()
164 br_port_set_promisc(p); in br_manage_promisc()
169 int nbp_backup_change(struct net_bridge_port *p, in nbp_backup_change() argument
172 struct net_bridge_port *old_backup = rtnl_dereference(p->backup_port); in nbp_backup_change()
182 if (backup_p->br != p->br) in nbp_backup_change()
186 if (p == backup_p) in nbp_backup_change()
198 rcu_assign_pointer(p->backup_port, backup_p); in nbp_backup_change()
203 static void nbp_backup_clear(struct net_bridge_port *p) in nbp_backup_clear() argument
205 nbp_backup_change(p, NULL); in nbp_backup_clear()
206 if (p->backup_redirected_cnt) { in nbp_backup_clear()
209 list_for_each_entry(cur_p, &p->br->port_list, list) { in nbp_backup_clear()
213 if (backup_p == p) in nbp_backup_clear()
218 WARN_ON(rcu_access_pointer(p->backup_port) || p->backup_redirected_cnt); in nbp_backup_clear()
223 struct net_bridge_port *p; in nbp_update_port_count() local
226 list_for_each_entry(p, &br->port_list, list) { in nbp_update_port_count()
227 if (br_auto_port(p)) in nbp_update_port_count()
236 static void nbp_delete_promisc(struct net_bridge_port *p) in nbp_delete_promisc() argument
242 dev_set_allmulti(p->dev, -1); in nbp_delete_promisc()
243 if (br_promisc_port(p)) in nbp_delete_promisc()
244 dev_set_promiscuity(p->dev, -1); in nbp_delete_promisc()
246 br_fdb_unsync_static(p->br, p); in nbp_delete_promisc()
251 struct net_bridge_port *p in release_nbp() local
253 kfree(p); in release_nbp()
258 struct net_bridge_port *p = kobj_to_brport(kobj); in brport_get_ownership() local
260 net_ns_get_ownership(dev_net(p->dev), uid, gid); in brport_get_ownership()
271 static void destroy_nbp(struct net_bridge_port *p) in destroy_nbp() argument
273 struct net_device *dev = p->dev; in destroy_nbp()
275 p->br = NULL; in destroy_nbp()
276 p->dev = NULL; in destroy_nbp()
279 kobject_put(&p->kobj); in destroy_nbp()
284 struct net_bridge_port *p = in destroy_nbp_rcu() local
286 destroy_nbp(p); in destroy_nbp_rcu()
292 struct net_bridge_port *p; in get_max_headroom() local
294 list_for_each_entry(p, &br->port_list, list) { in get_max_headroom()
295 unsigned dev_headroom = netdev_get_fwd_headroom(p->dev); in get_max_headroom()
306 struct net_bridge_port *p; in update_headroom() local
308 list_for_each_entry(p, &br->port_list, list) in update_headroom()
309 netdev_set_rx_headroom(p->dev, new_hr); in update_headroom()
323 static void del_nbp(struct net_bridge_port *p) in del_nbp() argument
325 struct net_bridge *br = p->br; in del_nbp()
326 struct net_device *dev = p->dev; in del_nbp()
328 sysfs_remove_link(br->ifobj, p->dev->name); in del_nbp()
330 nbp_delete_promisc(p); in del_nbp()
333 br_stp_disable_port(p); in del_nbp()
336 br_mrp_port_del(br, p); in del_nbp()
337 br_cfm_port_del(br, p); in del_nbp()
339 br_ifinfo_notify(RTM_DELLINK, NULL, p); in del_nbp()
341 list_del_rcu(&p->list); in del_nbp()
346 nbp_vlan_flush(p); in del_nbp()
347 br_fdb_delete_by_port(br, p, 0, 1); in del_nbp()
349 nbp_backup_clear(p); in del_nbp()
359 br_multicast_del_port(p); in del_nbp()
361 kobject_uevent(&p->kobj, KOBJ_REMOVE); in del_nbp()
362 kobject_del(&p->kobj); in del_nbp()
364 br_netpoll_disable(p); in del_nbp()
366 call_rcu(&p->rcu, destroy_nbp_rcu); in del_nbp()
373 struct net_bridge_port *p, *n; in br_dev_delete() local
375 list_for_each_entry_safe(p, n, &br->port_list, list) { in br_dev_delete()
376 del_nbp(p); in br_dev_delete()
393 struct net_bridge_port *p; in find_portno() local
401 list_for_each_entry(p, &br->port_list, list) { in find_portno()
402 set_bit(p->port_no, inuse); in find_portno()
414 struct net_bridge_port *p; in new_nbp() local
421 p = kzalloc(sizeof(*p), GFP_KERNEL); in new_nbp()
422 if (p == NULL) in new_nbp()
425 p->br = br; in new_nbp()
427 p->dev = dev; in new_nbp()
428 p->path_cost = port_cost(dev); in new_nbp()
429 p->priority = 0x8000 >> BR_PORT_BITS; in new_nbp()
430 p->port_no = index; in new_nbp()
431 p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD; in new_nbp()
432 br_init_port(p); in new_nbp()
433 br_set_state(p, BR_STATE_DISABLED); in new_nbp()
434 br_stp_port_timer_init(p); in new_nbp()
435 err = br_multicast_add_port(p); in new_nbp()
438 kfree(p); in new_nbp()
439 p = ERR_PTR(err); in new_nbp()
442 return p; in new_nbp()
493 const struct net_bridge_port *p; in br_mtu_min() local
496 list_for_each_entry(p, &br->port_list, list) in br_mtu_min()
497 if (!ret_mtu || ret_mtu > p->dev->mtu) in br_mtu_min()
498 ret_mtu = p->dev->mtu; in br_mtu_min()
522 const struct net_bridge_port *p; in br_set_gso_limits() local
524 list_for_each_entry(p, &br->port_list, list) { in br_set_gso_limits()
525 gso_max_size = min(gso_max_size, p->dev->gso_max_size); in br_set_gso_limits()
526 gso_max_segs = min(gso_max_segs, p->dev->gso_max_segs); in br_set_gso_limits()
538 struct net_bridge_port *p; in br_features_recompute() local
547 list_for_each_entry(p, &br->port_list, list) { in br_features_recompute()
549 p->dev->features, mask); in br_features_recompute()
560 struct net_bridge_port *p; in br_add_if() local
582 list_for_each_entry(p, &br->port_list, list) { in br_add_if()
583 if (!netdev_port_same_parent_id(dev, p->dev)) { in br_add_if()
609 p = new_nbp(br, dev); in br_add_if()
610 if (IS_ERR(p)) in br_add_if()
611 return PTR_ERR(p); in br_add_if()
617 br_multicast_del_port(p); in br_add_if()
618 kfree(p); /* kobject not yet init'd, manually free */ in br_add_if()
622 err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj), in br_add_if()
627 err = br_sysfs_addif(p); in br_add_if()
631 err = br_netpoll_enable(p); in br_add_if()
635 err = netdev_rx_handler_register(dev, br_get_rx_handler(dev), p); in br_add_if()
647 list_add_rcu(&p->list, &br->port_list); in br_add_if()
650 if (!br_promisc_port(p) && (p->dev->priv_flags & IFF_UNICAST_FLT)) { in br_add_if()
659 fdb_synced = br_fdb_sync_static(br, p) == 0; in br_add_if()
673 if (br_fdb_add_local(br, p, dev->dev_addr, 0)) in br_add_if()
685 err = nbp_vlan_init(p, extack); in br_add_if()
696 br_stp_enable_port(p); in br_add_if()
699 br_ifinfo_notify(RTM_NEWLINK, NULL, p); in br_add_if()
707 kobject_uevent(&p->kobj, KOBJ_ADD); in br_add_if()
713 br_fdb_unsync_static(br, p); in br_add_if()
714 list_del_rcu(&p->list); in br_add_if()
715 br_fdb_delete_by_port(br, p, 0, 1); in br_add_if()
722 br_netpoll_disable(p); in br_add_if()
724 sysfs_remove_link(br->ifobj, p->dev->name); in br_add_if()
726 br_multicast_del_port(p); in br_add_if()
727 kobject_put(&p->kobj); in br_add_if()
737 struct net_bridge_port *p; in br_del_if() local
740 p = br_port_get_rtnl(dev); in br_del_if()
741 if (!p || p->br != br) in br_del_if()
748 del_nbp(p); in br_del_if()
765 void br_port_flags_change(struct net_bridge_port *p, unsigned long mask) in br_port_flags_change() argument
767 struct net_bridge *br = p->br; in br_port_flags_change()
778 struct net_bridge_port *p; in br_port_flag_is_set() local
780 p = br_port_get_rtnl_rcu(dev); in br_port_flag_is_set()
781 if (!p) in br_port_flag_is_set()
784 return p->flags & flag; in br_port_flag_is_set()