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
123 struct tc_u_hnode *ht = rcu_dereference_bh(tp->root); in u32_classify() local
135 n = rcu_dereference_bh(ht->ht[sel]); in u32_classify()
180 ht = rcu_dereference_bh(n->ht_down); in u32_classify()
181 if (!ht) { in u32_classify()
212 ht = rcu_dereference_bh(n->ht_down); in u32_classify()
214 if (ht->divisor) { in u32_classify()
221 sel = ht->divisor & u32_hash_fold(*data, &n->sel, in u32_classify()
254 ht = rcu_dereference_bh(n->ht_up); in u32_classify()
268 struct tc_u_hnode *ht; in u32_lookup_ht() local
270 for (ht = rtnl_dereference(tp_c->hlist); in u32_lookup_ht()
271 ht; in u32_lookup_ht()
272 ht = rtnl_dereference(ht->next)) in u32_lookup_ht()
273 if (ht->handle == handle) in u32_lookup_ht()
276 return ht; in u32_lookup_ht()
279 static struct tc_u_knode *u32_lookup_key(struct tc_u_hnode *ht, u32 handle) in u32_lookup_key() argument
285 if (sel > ht->divisor) in u32_lookup_key()
288 for (n = rtnl_dereference(ht->ht[sel]); in u32_lookup_key()
300 struct tc_u_hnode *ht; in u32_get() local
304 ht = rtnl_dereference(tp->root); in u32_get()
306 ht = u32_lookup_ht(tp_c, TC_U32_HTID(handle)); in u32_get()
308 if (!ht) in u32_get()
312 return ht; in u32_get()
314 return u32_lookup_key(ht, handle); in u32_get()
368 root_ht = kzalloc(struct_size(root_ht, ht, 1), GFP_KERNEL); in u32_init()
405 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down); in __u32_destroy_key() local
408 if (ht && refcount_dec_and_test(&ht->refcnt)) in __u32_destroy_key()
409 kfree(ht); in __u32_destroy_key()
467 struct tc_u_hnode *ht = rtnl_dereference(key->ht_up); in u32_delete_key() local
469 if (ht) { in u32_delete_key()
470 kp = &ht->ht[TC_U32_HASH(key->handle)]; in u32_delete_key()
478 idr_remove(&ht->handle_idr, key->handle); in u32_delete_key()
550 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down); in u32_replace_hw_knode() local
571 cls_u32.knode.link_handle = ht->handle; in u32_replace_hw_knode()
586 static void u32_clear_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht, in u32_clear_hnode() argument
593 for (h = 0; h <= ht->divisor; h++) { in u32_clear_hnode()
594 while ((n = rtnl_dereference(ht->ht[h])) != NULL) { in u32_clear_hnode()
595 RCU_INIT_POINTER(ht->ht[h], in u32_clear_hnode()
600 idr_remove(&ht->handle_idr, n->handle); in u32_clear_hnode()
609 static int u32_destroy_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht, in u32_destroy_hnode() argument
616 u32_clear_hnode(tp, ht, extack); in u32_destroy_hnode()
622 if (phn == ht) { in u32_destroy_hnode()
623 u32_clear_hw_hnode(tp, ht, extack); in u32_destroy_hnode()
624 idr_destroy(&ht->handle_idr); in u32_destroy_hnode()
625 idr_remove(&tp_c->handle_idr, handle2id(ht->handle)); in u32_destroy_hnode()
626 RCU_INIT_POINTER(*hn, ht->next); in u32_destroy_hnode()
627 kfree_rcu(ht, rcu); in u32_destroy_hnode()
647 struct tc_u_hnode *ht; in u32_destroy() local
651 while ((ht = rtnl_dereference(tp_c->hlist)) != NULL) { in u32_destroy()
652 u32_clear_hnode(tp, ht, extack); in u32_destroy()
653 RCU_INIT_POINTER(tp_c->hlist, ht->next); in u32_destroy()
655 /* u32_destroy_key() will later free ht for us, if it's in u32_destroy()
658 if (refcount_dec_and_test(&ht->refcnt)) in u32_destroy()
659 kfree_rcu(ht, rcu); in u32_destroy()
672 struct tc_u_hnode *ht = arg; in u32_delete() local
676 if (TC_U32_KEY(ht->handle)) { in u32_delete()
677 u32_remove_hw_knode(tp, (struct tc_u_knode *)ht, extack); in u32_delete()
678 ret = u32_delete_key(tp, (struct tc_u_knode *)ht); in u32_delete()
682 if (ht->is_root) { in u32_delete()
687 if (refcount_dec_if_one(&ht->refcnt)) { in u32_delete()
688 u32_destroy_hnode(tp, ht, extack); in u32_delete()
699 static u32 gen_new_kid(struct tc_u_hnode *ht, u32 htid) in gen_new_kid() argument
704 if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max, GFP_KERNEL)) { in gen_new_kid()
706 if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max, in gen_new_kid()
800 struct tc_u_hnode *ht; in u32_replace_knode() local
803 ht = rtnl_dereference(tp->root); in u32_replace_knode()
805 ht = u32_lookup_ht(tp_c, TC_U32_HTID(n->handle)); in u32_replace_knode()
807 ins = &ht->ht[TC_U32_HASH(n->handle)]; in u32_replace_knode()
817 idr_replace(&ht->handle_idr, n, n->handle); in u32_replace_knode()
825 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down); in u32_init_knode() local
840 RCU_INIT_POINTER(new->ht_down, ht); in u32_init_knode()
864 if (ht) in u32_init_knode()
865 refcount_inc(&ht->refcnt); in u32_init_knode()
876 struct tc_u_hnode *ht; in u32_change() local
978 ht = kzalloc(struct_size(ht, ht, divisor + 1), GFP_KERNEL); in u32_change()
979 if (ht == NULL) in u32_change()
982 handle = gen_new_htid(tp->data, ht); in u32_change()
984 kfree(ht); in u32_change()
988 err = idr_alloc_u32(&tp_c->handle_idr, ht, &handle, in u32_change()
991 kfree(ht); in u32_change()
995 refcount_set(&ht->refcnt, 1); in u32_change()
996 ht->divisor = divisor; in u32_change()
997 ht->handle = handle; in u32_change()
998 ht->prio = tp->prio; in u32_change()
999 idr_init(&ht->handle_idr); in u32_change()
1000 ht->flags = userflags; in u32_change()
1002 err = u32_replace_hw_hnode(tp, ht, userflags, extack); in u32_change()
1005 kfree(ht); in u32_change()
1009 RCU_INIT_POINTER(ht->next, tp_c->hlist); in u32_change()
1010 rcu_assign_pointer(tp_c->hlist, ht); in u32_change()
1011 *arg = ht; in u32_change()
1019 ht = rtnl_dereference(tp->root); in u32_change()
1020 htid = ht->handle; in u32_change()
1022 ht = u32_lookup_ht(tp->data, TC_U32_HTID(htid)); in u32_change()
1023 if (!ht) { in u32_change()
1029 ht = rtnl_dereference(tp->root); in u32_change()
1030 htid = ht->handle; in u32_change()
1033 if (ht->divisor < TC_U32_HASH(htid)) { in u32_change()
1043 * At this point _we have the table(ht)_ in which we will insert this in u32_change()
1045 * Note that earlier code picked the ht selection either by a) the user in u32_change()
1047 * no such attribute is passed then the root ht, is default to at ID in u32_change()
1080 handle = gen_new_kid(ht, htid); in u32_change()
1083 err = idr_alloc_u32(&ht->handle_idr, NULL, &handle, in u32_change()
1092 handle = gen_new_kid(ht, htid); in u32_change()
1128 RCU_INIT_POINTER(n->ht_up, ht); in u32_change()
1171 ins = &ht->ht[TC_U32_HASH(handle)]; in u32_change()
1199 idr_remove(&ht->handle_idr, handle); in u32_change()
1207 struct tc_u_hnode *ht; in u32_walk() local
1214 for (ht = rtnl_dereference(tp_c->hlist); in u32_walk()
1215 ht; in u32_walk()
1216 ht = rtnl_dereference(ht->next)) { in u32_walk()
1217 if (ht->prio != tp->prio) in u32_walk()
1220 if (!tc_cls_stats_dump(tp, arg, ht)) in u32_walk()
1223 for (h = 0; h <= ht->divisor; h++) { in u32_walk()
1224 for (n = rtnl_dereference(ht->ht[h]); in u32_walk()
1234 static int u32_reoffload_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht, in u32_reoffload_hnode() argument
1241 tc_cls_common_offload_init(&cls_u32.common, tp, ht->flags, extack); in u32_reoffload_hnode()
1243 cls_u32.hnode.divisor = ht->divisor; in u32_reoffload_hnode()
1244 cls_u32.hnode.handle = ht->handle; in u32_reoffload_hnode()
1245 cls_u32.hnode.prio = ht->prio; in u32_reoffload_hnode()
1248 if (err && add && tc_skip_sw(ht->flags)) in u32_reoffload_hnode()
1258 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down); in u32_reoffload_knode() local
1280 cls_u32.knode.link_handle = ht->handle; in u32_reoffload_knode()
1292 struct tc_u_hnode *ht; in u32_reoffload() local
1297 for (ht = rtnl_dereference(tp_c->hlist); in u32_reoffload()
1298 ht; in u32_reoffload()
1299 ht = rtnl_dereference(ht->next)) { in u32_reoffload()
1300 if (ht->prio != tp->prio) in u32_reoffload()
1307 if (add && !tc_skip_hw(ht->flags)) { in u32_reoffload()
1308 err = u32_reoffload_hnode(tp, ht, add, cb, cb_priv, in u32_reoffload()
1314 for (h = 0; h <= ht->divisor; h++) { in u32_reoffload()
1315 for (n = rtnl_dereference(ht->ht[h]); in u32_reoffload()
1328 if (!add && !tc_skip_hw(ht->flags)) in u32_reoffload()
1329 u32_reoffload_hnode(tp, ht, add, cb, cb_priv, extack); in u32_reoffload()
1360 struct tc_u_hnode *ht = fh; in u32_dump() local
1361 u32 divisor = ht->divisor + 1; in u32_dump()