Lines Matching refs:itn

79 struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
90 head = &itn->tunnels[hash];
122 head = &itn->tunnels[hash];
158 t = rcu_dereference(itn->collect_md_tun);
162 ndev = READ_ONCE(itn->fb_tunnel_dev);
170 static struct hlist_head *ip_bucket(struct ip_tunnel_net *itn,
187 return &itn->tunnels[h];
190 static void ip_tunnel_add(struct ip_tunnel_net *itn, struct ip_tunnel *t)
192 struct hlist_head *head = ip_bucket(itn, &t->parms);
195 rcu_assign_pointer(itn->collect_md_tun, t);
199 static void ip_tunnel_del(struct ip_tunnel_net *itn, struct ip_tunnel *t)
202 rcu_assign_pointer(itn->collect_md_tun, NULL);
206 static struct ip_tunnel *ip_tunnel_find(struct ip_tunnel_net *itn,
216 struct hlist_head *head = ip_bucket(itn, parms);
328 struct ip_tunnel_net *itn,
337 dev = __ip_tunnel_create(net, itn->rtnl_link_ops, parms);
353 ip_tunnel_add(itn, nt);
871 static void ip_tunnel_update(struct ip_tunnel_net *itn,
878 ip_tunnel_del(itn, t);
887 ip_tunnel_add(itn, t);
912 struct ip_tunnel_net *itn = net_generic(net, t->ip_tnl_net_id);
916 if (dev == itn->fb_tunnel_dev) {
917 t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type);
938 t = ip_tunnel_find(itn, p, itn->type);
942 t = ip_tunnel_create(net, itn, p);
950 if (dev != itn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) {
975 ip_tunnel_update(itn, t, dev, p, true, 0);
986 if (dev == itn->fb_tunnel_dev) {
988 t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type);
992 if (t == netdev_priv(itn->fb_tunnel_dev))
1108 struct ip_tunnel_net *itn;
1110 itn = net_generic(tunnel->net, tunnel->ip_tnl_net_id);
1112 if (itn->fb_tunnel_dev != dev) {
1113 ip_tunnel_del(itn, netdev_priv(dev));
1138 struct ip_tunnel_net *itn = net_generic(net, ip_tnl_net_id);
1142 itn->rtnl_link_ops = ops;
1144 INIT_HLIST_HEAD(&itn->tunnels[i]);
1150 itn->type = it_init_net->type;
1151 itn->fb_tunnel_dev = NULL;
1160 itn->fb_tunnel_dev = __ip_tunnel_create(net, ops, &parms);
1164 if (!IS_ERR(itn->fb_tunnel_dev)) {
1165 itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
1166 itn->fb_tunnel_dev->mtu = ip_tunnel_bind_dev(itn->fb_tunnel_dev);
1167 ip_tunnel_add(itn, netdev_priv(itn->fb_tunnel_dev));
1168 itn->type = itn->fb_tunnel_dev->type;
1172 return PTR_ERR_OR_ZERO(itn->fb_tunnel_dev);
1176 static void ip_tunnel_destroy(struct net *net, struct ip_tunnel_net *itn,
1190 struct hlist_head *thead = &itn->tunnels[h];
1205 struct ip_tunnel_net *itn;
1210 itn = net_generic(net, id);
1211 ip_tunnel_destroy(net, itn, dev_to_kill, ops);
1221 struct ip_tunnel_net *itn;
1226 itn = net_generic(net, nt->ip_tnl_net_id);
1229 if (rtnl_dereference(itn->collect_md_tun))
1232 if (ip_tunnel_find(itn, p, dev->type))
1260 ip_tunnel_add(itn, nt);
1276 struct ip_tunnel_net *itn = net_generic(net, tunnel->ip_tnl_net_id);
1278 if (dev == itn->fb_tunnel_dev)
1281 t = ip_tunnel_find(itn, p, dev->type);
1303 ip_tunnel_update(itn, t, dev, p, !tb[IFLA_MTU], fwmark);
1350 struct ip_tunnel_net *itn;
1352 itn = net_generic(net, tunnel->ip_tnl_net_id);
1353 ip_tunnel_del(itn, netdev_priv(dev));
1354 if (itn->fb_tunnel_dev == dev)
1355 WRITE_ONCE(itn->fb_tunnel_dev, NULL);