Lines Matching refs:ila

54 static inline int ila_cmp_wildcards(struct ila_map *ila,  in ila_cmp_wildcards()  argument
57 return (ila->xp.ifindex && ila->xp.ifindex != ifindex); in ila_cmp_wildcards()
60 static inline int ila_cmp_params(struct ila_map *ila, in ila_cmp_params() argument
63 return (ila->xp.ifindex != xp->ifindex); in ila_cmp_params()
69 const struct ila_map *ila = obj; in ila_cmpfn() local
71 return (ila->xp.ip.locator_match.v64 != *(__be64 *)arg->key); in ila_cmpfn()
74 static inline int ila_order(struct ila_map *ila) in ila_order() argument
78 if (ila->xp.ifindex) in ila_order()
130 struct ila_map *ila; in ila_lookup_wildcards() local
132 ila = rhashtable_lookup_fast(&ilan->xlat.rhash_table, &iaddr->loc, in ila_lookup_wildcards()
134 while (ila) { in ila_lookup_wildcards()
135 if (!ila_cmp_wildcards(ila, iaddr, ifindex)) in ila_lookup_wildcards()
136 return ila; in ila_lookup_wildcards()
137 ila = rcu_access_pointer(ila->next); in ila_lookup_wildcards()
147 struct ila_map *ila; in ila_lookup_by_params() local
149 ila = rhashtable_lookup_fast(&ilan->xlat.rhash_table, in ila_lookup_by_params()
152 while (ila) { in ila_lookup_by_params()
153 if (!ila_cmp_params(ila, xp)) in ila_lookup_by_params()
154 return ila; in ila_lookup_by_params()
155 ila = rcu_access_pointer(ila->next); in ila_lookup_by_params()
161 static inline void ila_release(struct ila_map *ila) in ila_release() argument
163 kfree_rcu(ila, rcu); in ila_release()
166 static void ila_free_node(struct ila_map *ila) in ila_free_node() argument
171 while (ila) { in ila_free_node()
172 next = rcu_access_pointer(ila->next); in ila_free_node()
173 ila_release(ila); in ila_free_node()
174 ila = next; in ila_free_node()
206 struct ila_map *ila, *head; in ila_add_mapping() local
222 ila = kzalloc(sizeof(*ila), GFP_KERNEL); in ila_add_mapping()
223 if (!ila) in ila_add_mapping()
228 ila->xp = *xp; in ila_add_mapping()
230 order = ila_order(ila); in ila_add_mapping()
240 &ila->node, rht_params); in ila_add_mapping()
260 RCU_INIT_POINTER(ila->next, tila); in ila_add_mapping()
261 rcu_assign_pointer(prev->next, ila); in ila_add_mapping()
264 RCU_INIT_POINTER(ila->next, head); in ila_add_mapping()
267 &ila->node, rht_params); in ila_add_mapping()
277 kfree(ila); in ila_add_mapping()
285 struct ila_map *ila, *head, *prev; in ila_del_mapping() local
293 ila = head; in ila_del_mapping()
297 while (ila) { in ila_del_mapping()
298 if (ila_cmp_params(ila, xp)) { in ila_del_mapping()
299 prev = ila; in ila_del_mapping()
300 ila = rcu_dereference_protected(ila->next, in ila_del_mapping()
309 rcu_assign_pointer(prev->next, ila->next); in ila_del_mapping()
314 head = rcu_dereference_protected(ila->next, in ila_del_mapping()
321 &ilan->xlat.rhash_table, &ila->node, in ila_del_mapping()
329 &ila->node, rht_params); in ila_del_mapping()
333 ila_release(ila); in ila_del_mapping()
373 struct ila_map *ila) in lock_from_ila_map() argument
375 return ila_get_lock(ilan, ila->xp.ip.locator_match); in lock_from_ila_map()
383 struct ila_map *ila; in ila_xlat_nl_cmd_flush() local
391 ila = rhashtable_walk_next(&iter); in ila_xlat_nl_cmd_flush()
393 if (IS_ERR(ila)) { in ila_xlat_nl_cmd_flush()
394 if (PTR_ERR(ila) == -EAGAIN) in ila_xlat_nl_cmd_flush()
396 ret = PTR_ERR(ila); in ila_xlat_nl_cmd_flush()
398 } else if (!ila) { in ila_xlat_nl_cmd_flush()
402 lock = lock_from_ila_map(ilan, ila); in ila_xlat_nl_cmd_flush()
407 &ila->node, rht_params); in ila_xlat_nl_cmd_flush()
409 ila_free_node(ila); in ila_xlat_nl_cmd_flush()
423 static int ila_fill_info(struct ila_map *ila, struct sk_buff *msg) in ila_fill_info() argument
426 (__force u64)ila->xp.ip.locator.v64, in ila_fill_info()
429 (__force u64)ila->xp.ip.locator_match.v64, in ila_fill_info()
431 nla_put_s32(msg, ILA_ATTR_IFINDEX, ila->xp.ifindex) || in ila_fill_info()
432 nla_put_u8(msg, ILA_ATTR_CSUM_MODE, ila->xp.ip.csum_mode) || in ila_fill_info()
433 nla_put_u8(msg, ILA_ATTR_IDENT_TYPE, ila->xp.ip.ident_type)) in ila_fill_info()
439 static int ila_dump_info(struct ila_map *ila, in ila_dump_info() argument
449 if (ila_fill_info(ila, skb) < 0) in ila_dump_info()
466 struct ila_map *ila; in ila_xlat_nl_cmd_get_mapping() local
480 ila = ila_lookup_by_params(&xp, ilan); in ila_xlat_nl_cmd_get_mapping()
481 if (ila) { in ila_xlat_nl_cmd_get_mapping()
482 ret = ila_dump_info(ila, in ila_xlat_nl_cmd_get_mapping()
539 struct ila_map *ila; in ila_xlat_nl_dump() local
545 ila = rhashtable_walk_peek(rhiter); in ila_xlat_nl_dump()
547 if (ila && !IS_ERR(ila) && skip) { in ila_xlat_nl_dump()
550 while (ila && skip) { in ila_xlat_nl_dump()
554 ila = rcu_access_pointer(ila->next); in ila_xlat_nl_dump()
562 if (IS_ERR(ila)) { in ila_xlat_nl_dump()
563 ret = PTR_ERR(ila); in ila_xlat_nl_dump()
575 } else if (!ila) { in ila_xlat_nl_dump()
580 while (ila) { in ila_xlat_nl_dump()
581 ret = ila_dump_info(ila, NETLINK_CB(cb->skb).portid, in ila_xlat_nl_dump()
588 ila = rcu_access_pointer(ila->next); in ila_xlat_nl_dump()
592 ila = rhashtable_walk_next(rhiter); in ila_xlat_nl_dump()
642 struct ila_map *ila; in ila_xlat_addr() local
657 ila = ila_lookup_wildcards(iaddr, skb->dev->ifindex, ilan); in ila_xlat_addr()
658 if (ila) in ila_xlat_addr()
659 ila_update_ipv6_locator(skb, &ila->xp.ip, sir2ila); in ila_xlat_addr()