Lines Matching refs:dev

35 static int port_cost(struct net_device *dev)  in port_cost()  argument
39 if (!__ethtool_get_link_ksettings(dev, &ecmd)) { in port_cost()
62 if (!strncmp(dev->name, "lec", 3)) in port_cost()
65 if (!strncmp(dev->name, "plip", 4)) in port_cost()
75 struct net_device *dev = p->dev; in br_port_carrier_check() local
79 netif_running(dev) && netif_oper_up(dev)) in br_port_carrier_check()
80 p->path_cost = port_cost(dev); in br_port_carrier_check()
83 if (!netif_running(br->dev)) in br_port_carrier_check()
87 if (netif_running(dev) && netif_oper_up(dev)) { in br_port_carrier_check()
108 err = dev_set_promiscuity(p->dev, 1); in br_port_set_promisc()
125 if (!br_promisc_port(p) || !(p->dev->priv_flags & IFF_UNICAST_FLT)) in br_port_clear_promisc()
135 dev_set_promiscuity(p->dev, -1); in br_port_clear_promisc()
152 if ((br->dev->flags & IFF_PROMISC) || !br_vlan_enabled(br->dev)) in br_manage_promisc()
169 if ((p->dev->priv_flags & IFF_UNICAST_FLT) && in br_manage_promisc()
252 dev_set_allmulti(p->dev, -1); in nbp_delete_promisc()
254 dev_set_promiscuity(p->dev, -1); in nbp_delete_promisc()
270 net_ns_get_ownership(dev_net(p->dev), uid, gid); in brport_get_ownership()
283 struct net_device *dev = p->dev; in destroy_nbp() local
286 p->dev = NULL; in destroy_nbp()
287 netdev_put(dev, &p->dev_tracker); in destroy_nbp()
305 unsigned dev_headroom = netdev_get_fwd_headroom(p->dev); in get_max_headroom()
319 netdev_set_rx_headroom(p->dev, new_hr); in update_headroom()
321 br->dev->needed_headroom = new_hr; in update_headroom()
336 struct net_device *dev = p->dev; in del_nbp() local
338 sysfs_remove_link(br->ifobj, p->dev->name); in del_nbp()
352 if (netdev_get_fwd_headroom(dev) == br->dev->needed_headroom) in del_nbp()
354 netdev_reset_rx_headroom(dev); in del_nbp()
363 netdev_upper_dev_unlink(dev, br->dev); in del_nbp()
365 dev->priv_flags &= ~IFF_BRIDGE_PORT; in del_nbp()
367 netdev_rx_handler_unregister(dev); in del_nbp()
380 void br_dev_delete(struct net_device *dev, struct list_head *head) in br_dev_delete() argument
382 struct net_bridge *br = netdev_priv(dev); in br_dev_delete()
395 br_sysfs_delbr(br->dev); in br_dev_delete()
396 unregister_netdevice_queue(br->dev, head); in br_dev_delete()
422 struct net_device *dev) in new_nbp() argument
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()
447 netdev_put(dev, &p->dev_tracker); in new_nbp()
457 struct net_device *dev; in br_add_bridge() local
460 dev = alloc_netdev(sizeof(struct net_bridge), name, NET_NAME_UNKNOWN, in br_add_bridge()
463 if (!dev) in br_add_bridge()
466 dev_net_set(dev, net); in br_add_bridge()
467 dev->rtnl_link_ops = &br_link_ops; in br_add_bridge()
469 res = register_netdevice(dev); in br_add_bridge()
471 free_netdev(dev); in br_add_bridge()
477 struct net_device *dev; in br_del_bridge() local
480 dev = __dev_get_by_name(net, name); in br_del_bridge()
481 if (dev == NULL) in br_del_bridge()
484 else if (!netif_is_bridge_master(dev)) { in br_del_bridge()
489 else if (dev->flags & IFF_UP) { in br_del_bridge()
495 br_dev_delete(dev, NULL); in br_del_bridge()
507 if (!ret_mtu || ret_mtu > p->dev->mtu) in br_mtu_min()
508 ret_mtu = p->dev->mtu; in br_mtu_min()
524 dev_set_mtu(br->dev, br_mtu_min(br)); in br_mtu_auto_adjust()
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()
538 netif_set_tso_max_size(br->dev, tso_max_size); in br_set_gso_limits()
539 netif_set_tso_max_segs(br->dev, tso_max_segs); in br_set_gso_limits()
559 p->dev->features, mask); in br_features_recompute()
567 int br_add_if(struct net_bridge *br, struct net_device *dev, in br_add_if() argument
576 if ((dev->flags & IFF_LOOPBACK) || in br_add_if()
577 dev->type != ARPHRD_ETHER || dev->addr_len != ETH_ALEN || in br_add_if()
578 !is_valid_ether_addr(dev->dev_addr)) in br_add_if()
582 if (dev->netdev_ops->ndo_start_xmit == br_dev_xmit) { in br_add_if()
589 if (netdev_master_upper_dev_get(dev)) in br_add_if()
593 if (dev->priv_flags & IFF_DONT_BRIDGE) { in br_add_if()
599 p = new_nbp(br, dev); in br_add_if()
603 call_netdevice_notifiers(NETDEV_JOIN, dev); in br_add_if()
605 err = dev_set_allmulti(dev, 1); in br_add_if()
608 netdev_put(dev, &p->dev_tracker); in br_add_if()
613 err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj), in br_add_if()
626 err = netdev_rx_handler_register(dev, br_get_rx_handler(dev), p); in br_add_if()
630 dev->priv_flags |= IFF_BRIDGE_PORT; in br_add_if()
632 err = netdev_master_upper_dev_link(dev, br->dev, NULL, NULL, extack); in br_add_if()
636 dev_disable_lro(dev); in br_add_if()
641 if (!br_promisc_port(p) && (p->dev->priv_flags & IFF_UNICAST_FLT)) { in br_add_if()
652 netdev_err(dev, "failed to sync bridge static fdb addresses to this port\n"); in br_add_if()
655 netdev_update_features(br->dev); in br_add_if()
657 br_hr = br->dev->needed_headroom; in br_add_if()
658 dev_hr = netdev_get_fwd_headroom(dev); in br_add_if()
662 netdev_set_rx_headroom(dev, br_hr); in br_add_if()
664 if (br_fdb_add_local(br, p, dev->dev_addr, 0)) in br_add_if()
665 netdev_err(dev, "failed insert local address bridge forwarding table\n"); in br_add_if()
667 if (br->dev->addr_assign_type != NET_ADDR_SET) { in br_add_if()
671 err = dev_pre_changeaddr_notify(br->dev, dev->dev_addr, extack); in br_add_if()
678 netdev_err(dev, "failed to initialize vlan filtering on this port\n"); in br_add_if()
685 if (netif_running(dev) && netif_oper_up(dev) && in br_add_if()
686 (br->dev->flags & IFF_UP)) in br_add_if()
693 call_netdevice_notifiers(NETDEV_CHANGEADDR, br->dev); in br_add_if()
708 netdev_upper_dev_unlink(dev, br->dev); in br_add_if()
710 dev->priv_flags &= ~IFF_BRIDGE_PORT; in br_add_if()
711 netdev_rx_handler_unregister(dev); in br_add_if()
715 sysfs_remove_link(br->ifobj, p->dev->name); in br_add_if()
718 netdev_put(dev, &p->dev_tracker); in br_add_if()
720 dev_set_allmulti(dev, -1); in br_add_if()
726 int br_del_if(struct net_bridge *br, struct net_device *dev) in br_del_if() argument
731 p = br_port_get_rtnl(dev); in br_del_if()
749 call_netdevice_notifiers(NETDEV_CHANGEADDR, br->dev); in br_del_if()
751 netdev_update_features(br->dev); in br_del_if()
767 bool br_port_flag_is_set(const struct net_device *dev, unsigned long flag) in br_port_flag_is_set() argument
771 p = br_port_get_rtnl_rcu(dev); in br_port_flag_is_set()