Lines Matching refs:dev
90 bool mpls_output_possible(const struct net_device *dev) in mpls_output_possible() argument
92 return dev && (dev->flags & IFF_UP) && netif_carrier_ok(dev); in mpls_output_possible()
113 unsigned int mpls_dev_mtu(const struct net_device *dev) in mpls_dev_mtu() argument
116 return dev->mtu; in mpls_dev_mtu()
132 void mpls_stats_inc_outucastpkts(struct net_device *dev, in mpls_stats_inc_outucastpkts() argument
138 mdev = mpls_dev_get(dev); in mpls_stats_inc_outucastpkts()
144 IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUT, skb->len); in mpls_stats_inc_outucastpkts()
147 struct inet6_dev *in6dev = __in6_dev_get(dev); in mpls_stats_inc_outucastpkts()
150 IP6_UPD_PO_STATS(dev_net(dev), in6dev, in mpls_stats_inc_outucastpkts()
342 static int mpls_forward(struct sk_buff *skb, struct net_device *dev, in mpls_forward() argument
345 struct net *net = dev_net(dev); in mpls_forward()
360 mdev = mpls_dev_get(dev); in mpls_forward()
431 skb->dev = out_dev; in mpls_forward()
592 struct net_device *dev; in inet_fib_lookup_dev() local
601 dev = rt->dst.dev; in inet_fib_lookup_dev()
602 dev_hold(dev); in inet_fib_lookup_dev()
606 return dev; in inet_fib_lookup_dev()
620 struct net_device *dev; in inet6_fib_lookup_dev() local
633 dev = dst->dev; in inet6_fib_lookup_dev()
634 dev_hold(dev); in inet6_fib_lookup_dev()
637 return dev; in inet6_fib_lookup_dev()
651 struct net_device *dev = NULL; in find_outdev() local
656 dev = inet_fib_lookup_dev(net, mpls_nh_via(rt, nh)); in find_outdev()
659 dev = inet6_fib_lookup_dev(net, mpls_nh_via(rt, nh)); in find_outdev()
665 dev = dev_get_by_index(net, oif); in find_outdev()
668 if (!dev) in find_outdev()
671 if (IS_ERR(dev)) in find_outdev()
672 return dev; in find_outdev()
675 dev_put(dev); in find_outdev()
677 return dev; in find_outdev()
683 struct net_device *dev = NULL; in mpls_nh_assign_dev() local
686 dev = find_outdev(net, rt, nh, oif); in mpls_nh_assign_dev()
687 if (IS_ERR(dev)) { in mpls_nh_assign_dev()
688 err = PTR_ERR(dev); in mpls_nh_assign_dev()
689 dev = NULL; in mpls_nh_assign_dev()
695 if (!mpls_dev_get(dev)) in mpls_nh_assign_dev()
699 (dev->addr_len != nh->nh_via_alen)) in mpls_nh_assign_dev()
702 nh->nh_dev = dev; in mpls_nh_assign_dev()
704 if (!(dev->flags & IFF_UP)) { in mpls_nh_assign_dev()
709 flags = dev_get_flags(dev); in mpls_nh_assign_dev()
1100 const struct net_device *dev) in mpls_fill_stats_af() argument
1106 mdev = mpls_dev_get(dev); in mpls_fill_stats_af()
1122 static size_t mpls_get_stats_af_size(const struct net_device *dev) in mpls_get_stats_af_size() argument
1126 mdev = mpls_dev_get(dev); in mpls_get_stats_af_size()
1152 if (nla_put_s32(skb, NETCONFA_IFINDEX, mdev->dev->ifindex) < 0) in mpls_netconf_fill_devconf()
1258 struct net_device *dev; in mpls_netconf_get_devconf() local
1273 dev = __dev_get_by_index(net, ifindex); in mpls_netconf_get_devconf()
1274 if (!dev) in mpls_netconf_get_devconf()
1277 mdev = mpls_dev_get(dev); in mpls_netconf_get_devconf()
1309 struct net_device *dev; in mpls_netconf_dump_devconf() local
1329 for_each_netdev_dump(net, dev, ctx->ifindex) { in mpls_netconf_dump_devconf()
1330 mdev = mpls_dev_get(dev); in mpls_netconf_dump_devconf()
1383 static int mpls_dev_sysctl_register(struct net_device *dev, in mpls_dev_sysctl_register() argument
1387 struct net *net = dev_net(dev); in mpls_dev_sysctl_register()
1404 snprintf(path, sizeof(path), "net/mpls/conf/%s", dev->name); in mpls_dev_sysctl_register()
1421 static void mpls_dev_sysctl_unregister(struct net_device *dev, in mpls_dev_sysctl_unregister() argument
1424 struct net *net = dev_net(dev); in mpls_dev_sysctl_unregister()
1437 static struct mpls_dev *mpls_add_dev(struct net_device *dev) in mpls_add_dev() argument
1460 mdev->dev = dev; in mpls_add_dev()
1462 err = mpls_dev_sysctl_register(dev, mdev); in mpls_add_dev()
1466 rcu_assign_pointer(dev->mpls_ptr, mdev); in mpls_add_dev()
1484 static int mpls_ifdown(struct net_device *dev, int event) in mpls_ifdown() argument
1487 struct net *net = dev_net(dev); in mpls_ifdown()
1503 if (!nh->nh_dev || nh->nh_dev == dev) in mpls_ifdown()
1505 if (nh->nh_dev == dev) in mpls_ifdown()
1529 if (nh->nh_dev != dev) in mpls_ifdown()
1560 static void mpls_ifup(struct net_device *dev, unsigned int flags) in mpls_ifup() argument
1563 struct net *net = dev_net(dev); in mpls_ifup()
1582 if (nh->nh_dev != dev) in mpls_ifup()
1596 struct net_device *dev = netdev_notifier_info_to_dev(ptr); in mpls_dev_notify() local
1602 mdev = mpls_add_dev(dev); in mpls_dev_notify()
1609 mdev = mpls_dev_get(dev); in mpls_dev_notify()
1616 err = mpls_ifdown(dev, event); in mpls_dev_notify()
1621 flags = dev_get_flags(dev); in mpls_dev_notify()
1623 mpls_ifup(dev, RTNH_F_DEAD | RTNH_F_LINKDOWN); in mpls_dev_notify()
1625 mpls_ifup(dev, RTNH_F_DEAD); in mpls_dev_notify()
1628 flags = dev_get_flags(dev); in mpls_dev_notify()
1630 mpls_ifup(dev, RTNH_F_DEAD | RTNH_F_LINKDOWN); in mpls_dev_notify()
1632 err = mpls_ifdown(dev, event); in mpls_dev_notify()
1638 err = mpls_ifdown(dev, event); in mpls_dev_notify()
1641 mdev = mpls_dev_get(dev); in mpls_dev_notify()
1643 mpls_dev_sysctl_unregister(dev, mdev); in mpls_dev_notify()
1644 RCU_INIT_POINTER(dev->mpls_ptr, NULL); in mpls_dev_notify()
1649 mdev = mpls_dev_get(dev); in mpls_dev_notify()
1651 mpls_dev_sysctl_unregister(dev, mdev); in mpls_dev_notify()
1652 err = mpls_dev_sysctl_register(dev, mdev); in mpls_dev_notify()
1976 struct net_device *dev; in mpls_dump_route() local
2017 dev = nh->nh_dev; in mpls_dump_route()
2018 if (dev && nla_put_u32(skb, RTA_OIF, dev->ifindex)) in mpls_dump_route()
2035 dev = nh->nh_dev; in mpls_dump_route()
2036 if (!dev) in mpls_dump_route()
2043 rtnh->rtnh_ifindex = dev->ifindex; in mpls_dump_route()
2129 filter->dev = __dev_get_by_index(net, ifindex); in mpls_valid_fib_dump_req()
2130 if (!filter->dev) in mpls_valid_fib_dump_req()
2144 const struct net_device *dev) in mpls_rt_uses_dev() argument
2149 if (nh->nh_dev == dev) in mpls_rt_uses_dev()
2153 if (nh->nh_dev == dev) in mpls_rt_uses_dev()
2206 if ((filter.dev && !mpls_rt_uses_dev(rt, filter.dev)) || in mpls_dump_routes()
2353 struct net_device *dev; in mpls_getroute() local
2487 dev = nh->nh_dev; in mpls_getroute()
2488 if (dev && nla_put_u32(skb, RTA_OIF, dev->ifindex)) in mpls_getroute()