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