Lines Matching full:ht
80 /* The 'ht' field MUST be the last field in structure to allow for
83 struct tc_u_knode __rcu *ht[]; member
113 struct tc_u_hnode *ht = rcu_dereference_bh(tp->root); in u32_classify() local
125 n = rcu_dereference_bh(ht->ht[sel]); in u32_classify()
170 ht = rcu_dereference_bh(n->ht_down); in u32_classify()
171 if (!ht) { in u32_classify()
202 ht = rcu_dereference_bh(n->ht_down); in u32_classify()
204 if (ht->divisor) { in u32_classify()
211 sel = ht->divisor & u32_hash_fold(*data, &n->sel, in u32_classify()
244 ht = rcu_dereference_bh(n->ht_up); in u32_classify()
258 struct tc_u_hnode *ht; in u32_lookup_ht() local
260 for (ht = rtnl_dereference(tp_c->hlist); in u32_lookup_ht()
261 ht; in u32_lookup_ht()
262 ht = rtnl_dereference(ht->next)) in u32_lookup_ht()
263 if (ht->handle == handle) in u32_lookup_ht()
266 return ht; in u32_lookup_ht()
269 static struct tc_u_knode *u32_lookup_key(struct tc_u_hnode *ht, u32 handle) in u32_lookup_key() argument
275 if (sel > ht->divisor) in u32_lookup_key()
278 for (n = rtnl_dereference(ht->ht[sel]); in u32_lookup_key()
290 struct tc_u_hnode *ht; in u32_get() local
294 ht = rtnl_dereference(tp->root); in u32_get()
296 ht = u32_lookup_ht(tp_c, TC_U32_HTID(handle)); in u32_get()
298 if (!ht) in u32_get()
302 return ht; in u32_get()
304 return u32_lookup_key(ht, handle); in u32_get()
358 root_ht = kzalloc(struct_size(root_ht, ht, 1), GFP_KERNEL); in u32_init()
395 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down); in __u32_destroy_key() local
398 if (ht && refcount_dec_and_test(&ht->refcnt)) in __u32_destroy_key()
399 kfree(ht); in __u32_destroy_key()
457 struct tc_u_hnode *ht = rtnl_dereference(key->ht_up); in u32_delete_key() local
459 if (ht) { in u32_delete_key()
460 kp = &ht->ht[TC_U32_HASH(key->handle)]; in u32_delete_key()
468 idr_remove(&ht->handle_idr, key->handle); in u32_delete_key()
540 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down); in u32_replace_hw_knode() local
561 cls_u32.knode.link_handle = ht->handle; in u32_replace_hw_knode()
576 static void u32_clear_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht, in u32_clear_hnode() argument
583 for (h = 0; h <= ht->divisor; h++) { in u32_clear_hnode()
584 while ((n = rtnl_dereference(ht->ht[h])) != NULL) { in u32_clear_hnode()
585 RCU_INIT_POINTER(ht->ht[h], in u32_clear_hnode()
590 idr_remove(&ht->handle_idr, n->handle); in u32_clear_hnode()
599 static int u32_destroy_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht, in u32_destroy_hnode() argument
606 u32_clear_hnode(tp, ht, extack); in u32_destroy_hnode()
612 if (phn == ht) { in u32_destroy_hnode()
613 u32_clear_hw_hnode(tp, ht, extack); in u32_destroy_hnode()
614 idr_destroy(&ht->handle_idr); in u32_destroy_hnode()
615 idr_remove(&tp_c->handle_idr, ht->handle); in u32_destroy_hnode()
616 RCU_INIT_POINTER(*hn, ht->next); in u32_destroy_hnode()
617 kfree_rcu(ht, rcu); in u32_destroy_hnode()
637 struct tc_u_hnode *ht; in u32_destroy() local
641 while ((ht = rtnl_dereference(tp_c->hlist)) != NULL) { in u32_destroy()
642 u32_clear_hnode(tp, ht, extack); in u32_destroy()
643 RCU_INIT_POINTER(tp_c->hlist, ht->next); in u32_destroy()
645 /* u32_destroy_key() will later free ht for us, if it's in u32_destroy()
648 if (refcount_dec_and_test(&ht->refcnt)) in u32_destroy()
649 kfree_rcu(ht, rcu); in u32_destroy()
662 struct tc_u_hnode *ht = arg; in u32_delete() local
666 if (TC_U32_KEY(ht->handle)) { in u32_delete()
667 u32_remove_hw_knode(tp, (struct tc_u_knode *)ht, extack); in u32_delete()
668 ret = u32_delete_key(tp, (struct tc_u_knode *)ht); in u32_delete()
672 if (ht->is_root) { in u32_delete()
677 if (refcount_dec_if_one(&ht->refcnt)) { in u32_delete()
678 u32_destroy_hnode(tp, ht, extack); in u32_delete()
689 static u32 gen_new_kid(struct tc_u_hnode *ht, u32 htid) in gen_new_kid() argument
694 if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max, GFP_KERNEL)) { in gen_new_kid()
696 if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max, in gen_new_kid()
790 struct tc_u_hnode *ht; in u32_replace_knode() local
793 ht = rtnl_dereference(tp->root); in u32_replace_knode()
795 ht = u32_lookup_ht(tp_c, TC_U32_HTID(n->handle)); in u32_replace_knode()
797 ins = &ht->ht[TC_U32_HASH(n->handle)]; in u32_replace_knode()
807 idr_replace(&ht->handle_idr, n, n->handle); in u32_replace_knode()
815 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down); in u32_init_knode() local
830 RCU_INIT_POINTER(new->ht_down, ht); in u32_init_knode()
854 if (ht) in u32_init_knode()
855 refcount_inc(&ht->refcnt); in u32_init_knode()
866 struct tc_u_hnode *ht; in u32_change() local
966 ht = kzalloc(struct_size(ht, ht, divisor + 1), GFP_KERNEL); in u32_change()
967 if (ht == NULL) in u32_change()
970 handle = gen_new_htid(tp->data, ht); in u32_change()
972 kfree(ht); in u32_change()
976 err = idr_alloc_u32(&tp_c->handle_idr, ht, &handle, in u32_change()
979 kfree(ht); in u32_change()
983 refcount_set(&ht->refcnt, 1); in u32_change()
984 ht->divisor = divisor; in u32_change()
985 ht->handle = handle; in u32_change()
986 ht->prio = tp->prio; in u32_change()
987 idr_init(&ht->handle_idr); in u32_change()
988 ht->flags = userflags; in u32_change()
990 err = u32_replace_hw_hnode(tp, ht, userflags, extack); in u32_change()
993 kfree(ht); in u32_change()
997 RCU_INIT_POINTER(ht->next, tp_c->hlist); in u32_change()
998 rcu_assign_pointer(tp_c->hlist, ht); in u32_change()
999 *arg = ht; in u32_change()
1007 ht = rtnl_dereference(tp->root); in u32_change()
1008 htid = ht->handle; in u32_change()
1010 ht = u32_lookup_ht(tp->data, TC_U32_HTID(htid)); in u32_change()
1011 if (!ht) { in u32_change()
1017 ht = rtnl_dereference(tp->root); in u32_change()
1018 htid = ht->handle; in u32_change()
1021 if (ht->divisor < TC_U32_HASH(htid)) { in u32_change()
1031 * At this point _we have the table(ht)_ in which we will insert this in u32_change()
1033 * Note that earlier code picked the ht selection either by a) the user in u32_change()
1035 * no such attribute is passed then the root ht, is default to at ID in u32_change()
1068 handle = gen_new_kid(ht, htid); in u32_change()
1071 err = idr_alloc_u32(&ht->handle_idr, NULL, &handle, in u32_change()
1080 handle = gen_new_kid(ht, htid); in u32_change()
1116 RCU_INIT_POINTER(n->ht_up, ht); in u32_change()
1157 ins = &ht->ht[TC_U32_HASH(handle)]; in u32_change()
1185 idr_remove(&ht->handle_idr, handle); in u32_change()
1193 struct tc_u_hnode *ht; in u32_walk() local
1200 for (ht = rtnl_dereference(tp_c->hlist); in u32_walk()
1201 ht; in u32_walk()
1202 ht = rtnl_dereference(ht->next)) { in u32_walk()
1203 if (ht->prio != tp->prio) in u32_walk()
1206 if (!tc_cls_stats_dump(tp, arg, ht)) in u32_walk()
1209 for (h = 0; h <= ht->divisor; h++) { in u32_walk()
1210 for (n = rtnl_dereference(ht->ht[h]); in u32_walk()
1220 static int u32_reoffload_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht, in u32_reoffload_hnode() argument
1227 tc_cls_common_offload_init(&cls_u32.common, tp, ht->flags, extack); in u32_reoffload_hnode()
1229 cls_u32.hnode.divisor = ht->divisor; in u32_reoffload_hnode()
1230 cls_u32.hnode.handle = ht->handle; in u32_reoffload_hnode()
1231 cls_u32.hnode.prio = ht->prio; in u32_reoffload_hnode()
1234 if (err && add && tc_skip_sw(ht->flags)) in u32_reoffload_hnode()
1244 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down); in u32_reoffload_knode() local
1266 cls_u32.knode.link_handle = ht->handle; in u32_reoffload_knode()
1278 struct tc_u_hnode *ht; in u32_reoffload() local
1283 for (ht = rtnl_dereference(tp_c->hlist); in u32_reoffload()
1284 ht; in u32_reoffload()
1285 ht = rtnl_dereference(ht->next)) { in u32_reoffload()
1286 if (ht->prio != tp->prio) in u32_reoffload()
1293 if (add && !tc_skip_hw(ht->flags)) { in u32_reoffload()
1294 err = u32_reoffload_hnode(tp, ht, add, cb, cb_priv, in u32_reoffload()
1300 for (h = 0; h <= ht->divisor; h++) { in u32_reoffload()
1301 for (n = rtnl_dereference(ht->ht[h]); in u32_reoffload()
1314 if (!add && !tc_skip_hw(ht->flags)) in u32_reoffload()
1315 u32_reoffload_hnode(tp, ht, add, cb, cb_priv, extack); in u32_reoffload()
1346 struct tc_u_hnode *ht = fh; in u32_dump() local
1347 u32 divisor = ht->divisor + 1; in u32_dump()