Lines Matching refs:itn
83 struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, in ip_tunnel_lookup() argument
94 head = &itn->tunnels[hash]; in ip_tunnel_lookup()
127 head = &itn->tunnels[hash]; in ip_tunnel_lookup()
162 t = rcu_dereference(itn->collect_md_tun); in ip_tunnel_lookup()
166 ndev = READ_ONCE(itn->fb_tunnel_dev); in ip_tunnel_lookup()
174 static struct hlist_head *ip_bucket(struct ip_tunnel_net *itn, in ip_bucket() argument
190 return &itn->tunnels[h]; in ip_bucket()
193 static void ip_tunnel_add(struct ip_tunnel_net *itn, struct ip_tunnel *t) in ip_tunnel_add() argument
195 struct hlist_head *head = ip_bucket(itn, &t->parms); in ip_tunnel_add()
198 rcu_assign_pointer(itn->collect_md_tun, t); in ip_tunnel_add()
202 static void ip_tunnel_del(struct ip_tunnel_net *itn, struct ip_tunnel *t) in ip_tunnel_del() argument
205 rcu_assign_pointer(itn->collect_md_tun, NULL); in ip_tunnel_del()
209 static struct ip_tunnel *ip_tunnel_find(struct ip_tunnel_net *itn, in ip_tunnel_find() argument
219 struct hlist_head *head = ip_bucket(itn, parms); in ip_tunnel_find()
329 struct ip_tunnel_net *itn, in ip_tunnel_create() argument
338 dev = __ip_tunnel_create(net, itn->rtnl_link_ops, parms); in ip_tunnel_create()
354 ip_tunnel_add(itn, nt); in ip_tunnel_create()
827 static void ip_tunnel_update(struct ip_tunnel_net *itn, in ip_tunnel_update() argument
834 ip_tunnel_del(itn, t); in ip_tunnel_update()
843 ip_tunnel_add(itn, t); in ip_tunnel_update()
867 struct ip_tunnel_net *itn = net_generic(net, t->ip_tnl_net_id); in ip_tunnel_ctl() local
871 if (dev == itn->fb_tunnel_dev) { in ip_tunnel_ctl()
872 t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); in ip_tunnel_ctl()
893 t = ip_tunnel_find(itn, p, itn->type); in ip_tunnel_ctl()
897 t = ip_tunnel_create(net, itn, p); in ip_tunnel_ctl()
905 if (dev != itn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) { in ip_tunnel_ctl()
930 ip_tunnel_update(itn, t, dev, p, true, 0); in ip_tunnel_ctl()
941 if (dev == itn->fb_tunnel_dev) { in ip_tunnel_ctl()
943 t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); in ip_tunnel_ctl()
947 if (t == netdev_priv(itn->fb_tunnel_dev)) in ip_tunnel_ctl()
1021 struct ip_tunnel_net *itn; in ip_tunnel_dellink() local
1023 itn = net_generic(tunnel->net, tunnel->ip_tnl_net_id); in ip_tunnel_dellink()
1025 if (itn->fb_tunnel_dev != dev) { in ip_tunnel_dellink()
1026 ip_tunnel_del(itn, netdev_priv(dev)); in ip_tunnel_dellink()
1051 struct ip_tunnel_net *itn = net_generic(net, ip_tnl_net_id); in ip_tunnel_init_net() local
1055 itn->rtnl_link_ops = ops; in ip_tunnel_init_net()
1057 INIT_HLIST_HEAD(&itn->tunnels[i]); in ip_tunnel_init_net()
1063 itn->type = it_init_net->type; in ip_tunnel_init_net()
1064 itn->fb_tunnel_dev = NULL; in ip_tunnel_init_net()
1073 itn->fb_tunnel_dev = __ip_tunnel_create(net, ops, &parms); in ip_tunnel_init_net()
1077 if (!IS_ERR(itn->fb_tunnel_dev)) { in ip_tunnel_init_net()
1078 itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL; in ip_tunnel_init_net()
1079 itn->fb_tunnel_dev->mtu = ip_tunnel_bind_dev(itn->fb_tunnel_dev); in ip_tunnel_init_net()
1080 ip_tunnel_add(itn, netdev_priv(itn->fb_tunnel_dev)); in ip_tunnel_init_net()
1081 itn->type = itn->fb_tunnel_dev->type; in ip_tunnel_init_net()
1085 return PTR_ERR_OR_ZERO(itn->fb_tunnel_dev); in ip_tunnel_init_net()
1089 static void ip_tunnel_destroy(struct net *net, struct ip_tunnel_net *itn, in ip_tunnel_destroy() argument
1103 struct hlist_head *thead = &itn->tunnels[h]; in ip_tunnel_destroy()
1117 struct ip_tunnel_net *itn; in ip_tunnel_delete_nets() local
1123 itn = net_generic(net, id); in ip_tunnel_delete_nets()
1124 ip_tunnel_destroy(net, itn, &list, ops); in ip_tunnel_delete_nets()
1136 struct ip_tunnel_net *itn; in ip_tunnel_newlink() local
1141 itn = net_generic(net, nt->ip_tnl_net_id); in ip_tunnel_newlink()
1144 if (rtnl_dereference(itn->collect_md_tun)) in ip_tunnel_newlink()
1147 if (ip_tunnel_find(itn, p, dev->type)) in ip_tunnel_newlink()
1175 ip_tunnel_add(itn, nt); in ip_tunnel_newlink()
1191 struct ip_tunnel_net *itn = net_generic(net, tunnel->ip_tnl_net_id); in ip_tunnel_changelink() local
1193 if (dev == itn->fb_tunnel_dev) in ip_tunnel_changelink()
1196 t = ip_tunnel_find(itn, p, dev->type); in ip_tunnel_changelink()
1218 ip_tunnel_update(itn, t, dev, p, !tb[IFLA_MTU], fwmark); in ip_tunnel_changelink()
1264 struct ip_tunnel_net *itn; in ip_tunnel_uninit() local
1266 itn = net_generic(net, tunnel->ip_tnl_net_id); in ip_tunnel_uninit()
1267 ip_tunnel_del(itn, netdev_priv(dev)); in ip_tunnel_uninit()
1268 if (itn->fb_tunnel_dev == dev) in ip_tunnel_uninit()
1269 WRITE_ONCE(itn->fb_tunnel_dev, NULL); in ip_tunnel_uninit()