Lines Matching refs:ht
79 /* The 'ht' field MUST be the last field in structure to allow for
82 struct tc_u_knode __rcu *ht[];
111 struct tc_u_hnode *ht = rcu_dereference_bh(tp->root);
123 n = rcu_dereference_bh(ht->ht[sel]);
168 ht = rcu_dereference_bh(n->ht_down);
169 if (!ht) {
200 ht = rcu_dereference_bh(n->ht_down);
202 if (ht->divisor) {
209 sel = ht->divisor & u32_hash_fold(*data, &n->sel,
242 ht = rcu_dereference_bh(n->ht_up);
256 struct tc_u_hnode *ht;
258 for (ht = rtnl_dereference(tp_c->hlist);
259 ht;
260 ht = rtnl_dereference(ht->next))
261 if (ht->handle == handle)
264 return ht;
267 static struct tc_u_knode *u32_lookup_key(struct tc_u_hnode *ht, u32 handle)
273 if (sel > ht->divisor)
276 for (n = rtnl_dereference(ht->ht[sel]);
288 struct tc_u_hnode *ht;
292 ht = rtnl_dereference(tp->root);
294 ht = u32_lookup_ht(tp_c, TC_U32_HTID(handle));
296 if (!ht)
300 return ht;
302 return u32_lookup_key(ht, handle);
356 root_ht = kzalloc(struct_size(root_ht, ht, 1), GFP_KERNEL);
391 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down);
394 if (ht && --ht->refcnt == 0)
395 kfree(ht);
453 struct tc_u_hnode *ht = rtnl_dereference(key->ht_up);
455 if (ht) {
456 kp = &ht->ht[TC_U32_HASH(key->handle)];
464 idr_remove(&ht->handle_idr, key->handle);
536 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down);
557 cls_u32.knode.link_handle = ht->handle;
572 static void u32_clear_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht,
579 for (h = 0; h <= ht->divisor; h++) {
580 while ((n = rtnl_dereference(ht->ht[h])) != NULL) {
581 RCU_INIT_POINTER(ht->ht[h],
586 idr_remove(&ht->handle_idr, n->handle);
595 static int u32_destroy_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht,
602 WARN_ON(--ht->refcnt);
604 u32_clear_hnode(tp, ht, extack);
610 if (phn == ht) {
611 u32_clear_hw_hnode(tp, ht, extack);
612 idr_destroy(&ht->handle_idr);
613 idr_remove(&tp_c->handle_idr, ht->handle);
614 RCU_INIT_POINTER(*hn, ht->next);
615 kfree_rcu(ht, rcu);
635 struct tc_u_hnode *ht;
639 while ((ht = rtnl_dereference(tp_c->hlist)) != NULL) {
640 u32_clear_hnode(tp, ht, extack);
641 RCU_INIT_POINTER(tp_c->hlist, ht->next);
643 /* u32_destroy_key() will later free ht for us, if it's
646 if (--ht->refcnt == 0)
647 kfree_rcu(ht, rcu);
660 struct tc_u_hnode *ht = arg;
664 if (TC_U32_KEY(ht->handle)) {
665 u32_remove_hw_knode(tp, (struct tc_u_knode *)ht, extack);
666 ret = u32_delete_key(tp, (struct tc_u_knode *)ht);
670 if (ht->is_root) {
675 if (ht->refcnt == 1) {
676 u32_destroy_hnode(tp, ht, extack);
687 static u32 gen_new_kid(struct tc_u_hnode *ht, u32 htid)
692 if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max, GFP_KERNEL)) {
694 if (idr_alloc_u32(&ht->handle_idr, NULL, &index, max,
776 struct tc_u_hnode *ht;
779 ht = rtnl_dereference(tp->root);
781 ht = u32_lookup_ht(tp_c, TC_U32_HTID(n->handle));
783 ins = &ht->ht[TC_U32_HASH(n->handle)];
793 idr_replace(&ht->handle_idr, n, n->handle);
801 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down);
816 RCU_INIT_POINTER(new->ht_down, ht);
840 if (ht)
841 ht->refcnt++;
852 struct tc_u_hnode *ht;
941 ht = kzalloc(struct_size(ht, ht, divisor + 1), GFP_KERNEL);
942 if (ht == NULL)
945 handle = gen_new_htid(tp->data, ht);
947 kfree(ht);
951 err = idr_alloc_u32(&tp_c->handle_idr, ht, &handle,
954 kfree(ht);
958 ht->refcnt = 1;
959 ht->divisor = divisor;
960 ht->handle = handle;
961 ht->prio = tp->prio;
962 idr_init(&ht->handle_idr);
963 ht->flags = flags;
965 err = u32_replace_hw_hnode(tp, ht, flags, extack);
968 kfree(ht);
972 RCU_INIT_POINTER(ht->next, tp_c->hlist);
973 rcu_assign_pointer(tp_c->hlist, ht);
974 *arg = ht;
982 ht = rtnl_dereference(tp->root);
983 htid = ht->handle;
985 ht = u32_lookup_ht(tp->data, TC_U32_HTID(htid));
986 if (!ht) {
992 ht = rtnl_dereference(tp->root);
993 htid = ht->handle;
996 if (ht->divisor < TC_U32_HASH(htid)) {
1006 * At this point _we have the table(ht)_ in which we will insert this
1008 * Note that earlier code picked the ht selection either by a) the user
1010 * no such attribute is passed then the root ht, is default to at ID
1043 handle = gen_new_kid(ht, htid);
1046 err = idr_alloc_u32(&ht->handle_idr, NULL, &handle,
1055 handle = gen_new_kid(ht, htid);
1087 RCU_INIT_POINTER(n->ht_up, ht);
1125 ins = &ht->ht[TC_U32_HASH(handle)];
1151 idr_remove(&ht->handle_idr, handle);
1159 struct tc_u_hnode *ht;
1166 for (ht = rtnl_dereference(tp_c->hlist);
1167 ht;
1168 ht = rtnl_dereference(ht->next)) {
1169 if (ht->prio != tp->prio)
1172 if (arg->fn(tp, ht, arg) < 0) {
1178 for (h = 0; h <= ht->divisor; h++) {
1179 for (n = rtnl_dereference(ht->ht[h]);
1196 static int u32_reoffload_hnode(struct tcf_proto *tp, struct tc_u_hnode *ht,
1203 tc_cls_common_offload_init(&cls_u32.common, tp, ht->flags, extack);
1205 cls_u32.hnode.divisor = ht->divisor;
1206 cls_u32.hnode.handle = ht->handle;
1207 cls_u32.hnode.prio = ht->prio;
1210 if (err && add && tc_skip_sw(ht->flags))
1220 struct tc_u_hnode *ht = rtnl_dereference(n->ht_down);
1243 cls_u32.knode.link_handle = ht->handle;
1259 struct tc_u_hnode *ht;
1264 for (ht = rtnl_dereference(tp_c->hlist);
1265 ht;
1266 ht = rtnl_dereference(ht->next)) {
1267 if (ht->prio != tp->prio)
1274 if (add && !tc_skip_hw(ht->flags)) {
1275 err = u32_reoffload_hnode(tp, ht, add, cb, cb_priv,
1281 for (h = 0; h <= ht->divisor; h++) {
1282 for (n = rtnl_dereference(ht->ht[h]);
1295 if (!add && !tc_skip_hw(ht->flags))
1296 u32_reoffload_hnode(tp, ht, add, cb, cb_priv, extack);
1332 struct tc_u_hnode *ht = fh;
1333 u32 divisor = ht->divisor + 1;