Lines Matching refs:newp
208 struct ip6addrlbl_entry *newp; in ip6addrlbl_alloc() local
233 newp = kmalloc(sizeof(*newp), GFP_KERNEL); in ip6addrlbl_alloc()
234 if (!newp) in ip6addrlbl_alloc()
237 ipv6_addr_prefix(&newp->prefix, prefix, prefixlen); in ip6addrlbl_alloc()
238 newp->prefixlen = prefixlen; in ip6addrlbl_alloc()
239 newp->ifindex = ifindex; in ip6addrlbl_alloc()
240 newp->addrtype = addrtype; in ip6addrlbl_alloc()
241 newp->label = label; in ip6addrlbl_alloc()
242 INIT_HLIST_NODE(&newp->list); in ip6addrlbl_alloc()
244 newp->lbl_net = hold_net(net); in ip6addrlbl_alloc()
246 atomic_set(&newp->refcnt, 1); in ip6addrlbl_alloc()
247 return newp; in ip6addrlbl_alloc()
251 static int __ip6addrlbl_add(struct ip6addrlbl_entry *newp, int replace) in __ip6addrlbl_add() argument
257 ADDRLABEL(KERN_DEBUG "%s(newp=%p, replace=%d)\n", __func__, newp, in __ip6addrlbl_add()
261 if (p->prefixlen == newp->prefixlen && in __ip6addrlbl_add()
262 net_eq(ip6addrlbl_net(p), ip6addrlbl_net(newp)) && in __ip6addrlbl_add()
263 p->ifindex == newp->ifindex && in __ip6addrlbl_add()
264 ipv6_addr_equal(&p->prefix, &newp->prefix)) { in __ip6addrlbl_add()
269 hlist_replace_rcu(&p->list, &newp->list); in __ip6addrlbl_add()
272 } else if ((p->prefixlen == newp->prefixlen && !p->ifindex) || in __ip6addrlbl_add()
273 (p->prefixlen < newp->prefixlen)) { in __ip6addrlbl_add()
274 hlist_add_before_rcu(&newp->list, &p->list); in __ip6addrlbl_add()
280 hlist_add_behind_rcu(&newp->list, &last->list); in __ip6addrlbl_add()
282 hlist_add_head_rcu(&newp->list, &ip6addrlbl_table.head); in __ip6addrlbl_add()
294 struct ip6addrlbl_entry *newp; in ip6addrlbl_add() local
301 newp = ip6addrlbl_alloc(net, prefix, prefixlen, ifindex, label); in ip6addrlbl_add()
302 if (IS_ERR(newp)) in ip6addrlbl_add()
303 return PTR_ERR(newp); in ip6addrlbl_add()
305 ret = __ip6addrlbl_add(newp, replace); in ip6addrlbl_add()
308 ip6addrlbl_free(newp); in ip6addrlbl_add()