Lines Matching refs:p
60 tcindex_lookup(struct tcindex_data *p, u16 key) in tcindex_lookup() argument
62 if (p->perfect) { in tcindex_lookup()
63 struct tcindex_filter_result *f = p->perfect + key; in tcindex_lookup()
66 } else if (p->h) { in tcindex_lookup()
70 fp = &p->h[key % p->hash]; in tcindex_lookup()
85 struct tcindex_data *p = rcu_dereference_bh(tp->root); in tcindex_classify() local
87 int key = (skb->tc_index & p->mask) >> p->shift; in tcindex_classify()
90 skb, tp, res, p); in tcindex_classify()
92 f = tcindex_lookup(p, key); in tcindex_classify()
94 if (!p->fall_through) in tcindex_classify()
110 struct tcindex_data *p = rtnl_dereference(tp->root); in tcindex_get() local
114 if (p->perfect && handle >= p->alloc_hash) in tcindex_get()
116 r = tcindex_lookup(p, handle); in tcindex_get()
122 struct tcindex_data *p; in tcindex_init() local
125 p = kzalloc(sizeof(struct tcindex_data), GFP_KERNEL); in tcindex_init()
126 if (!p) in tcindex_init()
129 p->mask = 0xffff; in tcindex_init()
130 p->hash = DEFAULT_HASH_SIZE; in tcindex_init()
131 p->fall_through = 1; in tcindex_init()
133 rcu_assign_pointer(tp->root, p); in tcindex_init()
155 struct tcindex_data *p = rtnl_dereference(tp->root); in tcindex_delete() local
160 pr_debug("tcindex_delete(tp %p,arg 0x%lx),p %p\n", tp, arg, p); in tcindex_delete()
161 if (p->perfect) { in tcindex_delete()
167 for (i = 0; i < p->hash; i++) { in tcindex_delete()
168 walk = p->h + i; in tcindex_delete()
201 struct tcindex_data *p = container_of(head, struct tcindex_data, rcu); in __tcindex_destroy() local
203 kfree(p->perfect); in __tcindex_destroy()
204 kfree(p->h); in __tcindex_destroy()
205 kfree(p); in __tcindex_destroy()
209 valid_perfect_hash(struct tcindex_data *p) in valid_perfect_hash() argument
211 return p->hash > (p->mask >> p->shift); in valid_perfect_hash()
230 struct tcindex_data *p = container_of(head, struct tcindex_data, rcu); in __tcindex_partial_destroy() local
232 kfree(p->perfect); in __tcindex_partial_destroy()
233 kfree(p); in __tcindex_partial_destroy()
238 u32 handle, struct tcindex_data *p, in tcindex_set_parms() argument
263 cp->mask = p->mask; in tcindex_set_parms()
264 cp->shift = p->shift; in tcindex_set_parms()
265 cp->hash = p->hash; in tcindex_set_parms()
266 cp->alloc_hash = p->alloc_hash; in tcindex_set_parms()
267 cp->fall_through = p->fall_through; in tcindex_set_parms()
293 if (p->perfect) { in tcindex_set_parms()
296 cp->perfect = kmemdup(p->perfect, in tcindex_set_parms()
301 for (i = 0; i < min(cp->hash, p->hash); i++) in tcindex_set_parms()
306 cp->h = p->h; in tcindex_set_parms()
393 oldp = p; in tcindex_set_parms()
437 struct tcindex_data *p = rtnl_dereference(tp->root); in tcindex_change() local
443 tp, handle, tca, arg, opt, p, r, arg ? *arg : 0L); in tcindex_change()
452 return tcindex_set_parms(net, tp, base, handle, p, r, tb, in tcindex_change()
458 struct tcindex_data *p = rtnl_dereference(tp->root); in tcindex_walk() local
462 pr_debug("tcindex_walk(tp %p,walker %p),p %p\n", tp, walker, p); in tcindex_walk()
463 if (p->perfect) { in tcindex_walk()
464 for (i = 0; i < p->hash; i++) { in tcindex_walk()
465 if (!p->perfect[i].res.class) in tcindex_walk()
469 (unsigned long) (p->perfect+i), walker) in tcindex_walk()
478 if (!p->h) in tcindex_walk()
480 for (i = 0; i < p->hash; i++) { in tcindex_walk()
481 for (f = rtnl_dereference(p->h[i]); f; f = next) { in tcindex_walk()
497 struct tcindex_data *p = rtnl_dereference(tp->root); in tcindex_destroy() local
503 pr_debug("tcindex_destroy(tp %p),p %p\n", tp, p); in tcindex_destroy()
509 call_rcu(&p->rcu, __tcindex_destroy); in tcindex_destroy()
517 struct tcindex_data *p = rtnl_dereference(tp->root); in tcindex_dump() local
522 tp, fh, skb, t, p, r); in tcindex_dump()
523 pr_debug("p->perfect %p p->h %p\n", p->perfect, p->h); in tcindex_dump()
531 if (nla_put_u32(skb, TCA_TCINDEX_HASH, p->hash) || in tcindex_dump()
532 nla_put_u16(skb, TCA_TCINDEX_MASK, p->mask) || in tcindex_dump()
533 nla_put_u32(skb, TCA_TCINDEX_SHIFT, p->shift) || in tcindex_dump()
534 nla_put_u32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through)) in tcindex_dump()
538 if (p->perfect) { in tcindex_dump()
539 t->tcm_handle = r - p->perfect; in tcindex_dump()
546 for (i = 0; !t->tcm_handle && i < p->hash; i++) { in tcindex_dump()
547 fp = &p->h[i]; in tcindex_dump()