Lines Matching refs:block
61 struct tcf_block *block = chain->block; in tcf_proto_signal_destroying() local
63 mutex_lock(&block->proto_destroy_lock); in tcf_proto_signal_destroying()
64 hash_add_rcu(block->proto_destroy_ht, &tp->destroy_ht_node, in tcf_proto_signal_destroying()
66 mutex_unlock(&block->proto_destroy_lock); in tcf_proto_signal_destroying()
85 hash_for_each_possible_rcu(chain->block->proto_destroy_ht, iter, in tcf_proto_exists_destroying()
100 struct tcf_block *block = chain->block; in tcf_proto_signal_destroyed() local
102 mutex_lock(&block->proto_destroy_lock); in tcf_proto_signal_destroyed()
105 mutex_unlock(&block->proto_destroy_lock); in tcf_proto_signal_destroyed()
339 #define ASSERT_BLOCK_LOCKED(block) \ argument
340 lockdep_assert_held(&(block)->lock)
348 static struct tcf_chain *tcf_chain_create(struct tcf_block *block, in tcf_chain_create() argument
353 ASSERT_BLOCK_LOCKED(block); in tcf_chain_create()
358 list_add_tail_rcu(&chain->list, &block->chain_list); in tcf_chain_create()
360 chain->block = block; in tcf_chain_create()
364 block->chain0.chain = chain; in tcf_chain_create()
379 struct tcf_block *block = chain->block; in tcf_chain0_head_change() local
384 mutex_lock(&block->lock); in tcf_chain0_head_change()
385 list_for_each_entry(item, &block->chain0.filter_chain_list, list) in tcf_chain0_head_change()
387 mutex_unlock(&block->lock); in tcf_chain0_head_change()
394 struct tcf_block *block = chain->block; in tcf_chain_detach() local
396 ASSERT_BLOCK_LOCKED(block); in tcf_chain_detach()
400 block->chain0.chain = NULL; in tcf_chain_detach()
402 if (list_empty(&block->chain_list) && in tcf_chain_detach()
403 refcount_read(&block->refcnt) == 0) in tcf_chain_detach()
409 static void tcf_block_destroy(struct tcf_block *block) in tcf_block_destroy() argument
411 mutex_destroy(&block->lock); in tcf_block_destroy()
412 mutex_destroy(&block->proto_destroy_lock); in tcf_block_destroy()
413 kfree_rcu(block, rcu); in tcf_block_destroy()
418 struct tcf_block *block = chain->block; in tcf_chain_destroy() local
423 tcf_block_destroy(block); in tcf_chain_destroy()
428 ASSERT_BLOCK_LOCKED(chain->block); in tcf_chain_hold()
435 ASSERT_BLOCK_LOCKED(chain->block); in tcf_chain_held_by_acts_only()
443 static struct tcf_chain *tcf_chain_lookup(struct tcf_block *block, in tcf_chain_lookup() argument
448 ASSERT_BLOCK_LOCKED(block); in tcf_chain_lookup()
450 list_for_each_entry(chain, &block->chain_list, list) { in tcf_chain_lookup()
458 static struct tcf_chain *tcf_chain_lookup_rcu(const struct tcf_block *block, in tcf_chain_lookup_rcu() argument
463 list_for_each_entry_rcu(chain, &block->chain_list, list) { in tcf_chain_lookup_rcu()
474 static struct tcf_chain *__tcf_chain_get(struct tcf_block *block, in __tcf_chain_get() argument
481 mutex_lock(&block->lock); in __tcf_chain_get()
482 chain = tcf_chain_lookup(block, chain_index); in __tcf_chain_get()
488 chain = tcf_chain_create(block, chain_index); in __tcf_chain_get()
496 mutex_unlock(&block->lock); in __tcf_chain_get()
510 mutex_unlock(&block->lock); in __tcf_chain_get()
514 static struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index, in tcf_chain_get() argument
517 return __tcf_chain_get(block, chain_index, create, false); in tcf_chain_get()
520 struct tcf_chain *tcf_chain_get_by_act(struct tcf_block *block, u32 chain_index) in tcf_chain_get_by_act() argument
522 return __tcf_chain_get(block, chain_index, true, true); in tcf_chain_get_by_act()
530 struct tcf_block *block, struct sk_buff *oskb,
536 struct tcf_block *block = chain->block; in __tcf_chain_put() local
542 mutex_lock(&block->lock); in __tcf_chain_put()
545 mutex_unlock(&block->lock); in __tcf_chain_put()
565 block, NULL, 0, 0, false); in __tcf_chain_put()
572 mutex_unlock(&block->lock); in __tcf_chain_put()
620 static int tcf_block_setup(struct tcf_block *block,
633 bo->block = flow_block; in tcf_block_offload_init()
641 static void tcf_block_unbind(struct tcf_block *block,
646 struct tcf_block *block = block_cb->indr.data; in tc_block_indr_cleanup() local
654 &block->flow_block, tcf_block_shared(block), in tc_block_indr_cleanup()
657 down_write(&block->cb_lock); in tc_block_indr_cleanup()
660 tcf_block_unbind(block, &bo); in tc_block_indr_cleanup()
661 up_write(&block->cb_lock); in tc_block_indr_cleanup()
665 static bool tcf_block_offload_in_use(struct tcf_block *block) in tcf_block_offload_in_use() argument
667 return atomic_read(&block->offloadcnt); in tcf_block_offload_in_use()
670 static int tcf_block_offload_cmd(struct tcf_block *block, in tcf_block_offload_cmd() argument
679 &block->flow_block, tcf_block_shared(block), in tcf_block_offload_cmd()
692 return tcf_block_setup(block, &bo); in tcf_block_offload_cmd()
695 flow_indr_dev_setup_offload(dev, sch, TC_SETUP_BLOCK, block, &bo, in tcf_block_offload_cmd()
697 tcf_block_setup(block, &bo); in tcf_block_offload_cmd()
702 static int tcf_block_offload_bind(struct tcf_block *block, struct Qdisc *q, in tcf_block_offload_bind() argument
709 down_write(&block->cb_lock); in tcf_block_offload_bind()
716 tcf_block_offload_in_use(block)) { in tcf_block_offload_bind()
722 err = tcf_block_offload_cmd(block, dev, q, ei, FLOW_BLOCK_BIND, extack); in tcf_block_offload_bind()
728 up_write(&block->cb_lock); in tcf_block_offload_bind()
732 if (tcf_block_offload_in_use(block)) in tcf_block_offload_bind()
736 block->nooffloaddevcnt++; in tcf_block_offload_bind()
738 up_write(&block->cb_lock); in tcf_block_offload_bind()
742 static void tcf_block_offload_unbind(struct tcf_block *block, struct Qdisc *q, in tcf_block_offload_unbind() argument
748 down_write(&block->cb_lock); in tcf_block_offload_unbind()
749 err = tcf_block_offload_cmd(block, dev, q, ei, FLOW_BLOCK_UNBIND, NULL); in tcf_block_offload_unbind()
752 up_write(&block->cb_lock); in tcf_block_offload_unbind()
756 WARN_ON(block->nooffloaddevcnt-- == 0); in tcf_block_offload_unbind()
757 up_write(&block->cb_lock); in tcf_block_offload_unbind()
761 tcf_chain0_head_change_cb_add(struct tcf_block *block, in tcf_chain0_head_change_cb_add() argument
776 mutex_lock(&block->lock); in tcf_chain0_head_change_cb_add()
777 chain0 = block->chain0.chain; in tcf_chain0_head_change_cb_add()
781 list_add(&item->list, &block->chain0.filter_chain_list); in tcf_chain0_head_change_cb_add()
782 mutex_unlock(&block->lock); in tcf_chain0_head_change_cb_add()
793 mutex_lock(&block->lock); in tcf_chain0_head_change_cb_add()
794 list_add(&item->list, &block->chain0.filter_chain_list); in tcf_chain0_head_change_cb_add()
795 mutex_unlock(&block->lock); in tcf_chain0_head_change_cb_add()
805 tcf_chain0_head_change_cb_del(struct tcf_block *block, in tcf_chain0_head_change_cb_del() argument
810 mutex_lock(&block->lock); in tcf_chain0_head_change_cb_del()
811 list_for_each_entry(item, &block->chain0.filter_chain_list, list) { in tcf_chain0_head_change_cb_del()
815 if (block->chain0.chain) in tcf_chain0_head_change_cb_del()
818 mutex_unlock(&block->lock); in tcf_chain0_head_change_cb_del()
824 mutex_unlock(&block->lock); in tcf_chain0_head_change_cb_del()
835 static int tcf_block_insert(struct tcf_block *block, struct net *net, in tcf_block_insert() argument
843 err = idr_alloc_u32(&tn->idr, block, &block->index, block->index, in tcf_block_insert()
851 static void tcf_block_remove(struct tcf_block *block, struct net *net) in tcf_block_remove() argument
856 idr_remove(&tn->idr, block->index); in tcf_block_remove()
864 struct tcf_block *block; in tcf_block_create() local
866 block = kzalloc(sizeof(*block), GFP_KERNEL); in tcf_block_create()
867 if (!block) { in tcf_block_create()
871 mutex_init(&block->lock); in tcf_block_create()
872 mutex_init(&block->proto_destroy_lock); in tcf_block_create()
873 init_rwsem(&block->cb_lock); in tcf_block_create()
874 flow_block_init(&block->flow_block); in tcf_block_create()
875 INIT_LIST_HEAD(&block->chain_list); in tcf_block_create()
876 INIT_LIST_HEAD(&block->owner_list); in tcf_block_create()
877 INIT_LIST_HEAD(&block->chain0.filter_chain_list); in tcf_block_create()
879 refcount_set(&block->refcnt, 1); in tcf_block_create()
880 block->net = net; in tcf_block_create()
881 block->index = block_index; in tcf_block_create()
884 if (!tcf_block_shared(block)) in tcf_block_create()
885 block->q = q; in tcf_block_create()
886 return block; in tcf_block_create()
898 struct tcf_block *block; in tcf_block_refcnt_get() local
901 block = tcf_block_lookup(net, block_index); in tcf_block_refcnt_get()
902 if (block && !refcount_inc_not_zero(&block->refcnt)) in tcf_block_refcnt_get()
903 block = NULL; in tcf_block_refcnt_get()
906 return block; in tcf_block_refcnt_get()
910 __tcf_get_next_chain(struct tcf_block *block, struct tcf_chain *chain) in __tcf_get_next_chain() argument
912 mutex_lock(&block->lock); in __tcf_get_next_chain()
914 chain = list_is_last(&chain->list, &block->chain_list) ? in __tcf_get_next_chain()
917 chain = list_first_entry_or_null(&block->chain_list, in __tcf_get_next_chain()
922 chain = list_is_last(&chain->list, &block->chain_list) ? in __tcf_get_next_chain()
927 mutex_unlock(&block->lock); in __tcf_get_next_chain()
942 tcf_get_next_chain(struct tcf_block *block, struct tcf_chain *chain) in tcf_get_next_chain() argument
944 struct tcf_chain *chain_next = __tcf_get_next_chain(block, chain); in tcf_get_next_chain()
1006 static void tcf_block_flush_all_chains(struct tcf_block *block, bool rtnl_held) in tcf_block_flush_all_chains() argument
1013 for (chain = tcf_get_next_chain(block, NULL); in tcf_block_flush_all_chains()
1015 chain = tcf_get_next_chain(block, chain)) { in tcf_block_flush_all_chains()
1125 struct tcf_block *block; in __tcf_block_find() local
1128 block = tcf_block_refcnt_get(net, block_index); in __tcf_block_find()
1129 if (!block) { in __tcf_block_find()
1136 block = cops->tcf_block(q, cl, extack); in __tcf_block_find()
1137 if (!block) in __tcf_block_find()
1140 if (tcf_block_shared(block)) { in __tcf_block_find()
1151 refcount_inc(&block->refcnt); in __tcf_block_find()
1154 return block; in __tcf_block_find()
1157 static void __tcf_block_put(struct tcf_block *block, struct Qdisc *q, in __tcf_block_put() argument
1160 if (refcount_dec_and_mutex_lock(&block->refcnt, &block->lock)) { in __tcf_block_put()
1167 bool free_block = list_empty(&block->chain_list); in __tcf_block_put()
1169 mutex_unlock(&block->lock); in __tcf_block_put()
1170 if (tcf_block_shared(block)) in __tcf_block_put()
1171 tcf_block_remove(block, block->net); in __tcf_block_put()
1174 tcf_block_offload_unbind(block, q, ei); in __tcf_block_put()
1177 tcf_block_destroy(block); in __tcf_block_put()
1179 tcf_block_flush_all_chains(block, rtnl_held); in __tcf_block_put()
1181 tcf_block_offload_unbind(block, q, ei); in __tcf_block_put()
1185 static void tcf_block_refcnt_put(struct tcf_block *block, bool rtnl_held) in tcf_block_refcnt_put() argument
1187 __tcf_block_put(block, NULL, NULL, rtnl_held); in tcf_block_refcnt_put()
1199 struct tcf_block *block; in tcf_block_find() local
1212 block = __tcf_block_find(net, *q, *cl, ifindex, block_index, extack); in tcf_block_find()
1213 if (IS_ERR(block)) { in tcf_block_find()
1214 err = PTR_ERR(block); in tcf_block_find()
1218 return block; in tcf_block_find()
1228 static void tcf_block_release(struct Qdisc *q, struct tcf_block *block, in tcf_block_release() argument
1231 if (!IS_ERR_OR_NULL(block)) in tcf_block_release()
1232 tcf_block_refcnt_put(block, rtnl_held); in tcf_block_release()
1249 tcf_block_owner_netif_keep_dst(struct tcf_block *block, in tcf_block_owner_netif_keep_dst() argument
1253 if (block->keep_dst && in tcf_block_owner_netif_keep_dst()
1259 void tcf_block_netif_keep_dst(struct tcf_block *block) in tcf_block_netif_keep_dst() argument
1263 block->keep_dst = true; in tcf_block_netif_keep_dst()
1264 list_for_each_entry(item, &block->owner_list, list) in tcf_block_netif_keep_dst()
1265 tcf_block_owner_netif_keep_dst(block, item->q, in tcf_block_netif_keep_dst()
1270 static int tcf_block_owner_add(struct tcf_block *block, in tcf_block_owner_add() argument
1281 list_add(&item->list, &block->owner_list); in tcf_block_owner_add()
1285 static void tcf_block_owner_del(struct tcf_block *block, in tcf_block_owner_del() argument
1291 list_for_each_entry(item, &block->owner_list, list) { in tcf_block_owner_del()
1306 struct tcf_block *block = NULL; in tcf_block_get_ext() local
1311 block = tcf_block_refcnt_get(net, ei->block_index); in tcf_block_get_ext()
1313 if (!block) { in tcf_block_get_ext()
1314 block = tcf_block_create(net, q, ei->block_index, extack); in tcf_block_get_ext()
1315 if (IS_ERR(block)) in tcf_block_get_ext()
1316 return PTR_ERR(block); in tcf_block_get_ext()
1317 if (tcf_block_shared(block)) { in tcf_block_get_ext()
1318 err = tcf_block_insert(block, net, extack); in tcf_block_get_ext()
1324 err = tcf_block_owner_add(block, q, ei->binder_type); in tcf_block_get_ext()
1328 tcf_block_owner_netif_keep_dst(block, q, ei->binder_type); in tcf_block_get_ext()
1330 err = tcf_chain0_head_change_cb_add(block, ei, extack); in tcf_block_get_ext()
1334 err = tcf_block_offload_bind(block, q, ei, extack); in tcf_block_get_ext()
1338 *p_block = block; in tcf_block_get_ext()
1342 tcf_chain0_head_change_cb_del(block, ei); in tcf_block_get_ext()
1344 tcf_block_owner_del(block, q, ei->binder_type); in tcf_block_get_ext()
1347 tcf_block_refcnt_put(block, true); in tcf_block_get_ext()
1376 void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q, in tcf_block_put_ext() argument
1379 if (!block) in tcf_block_put_ext()
1381 tcf_chain0_head_change_cb_del(block, ei); in tcf_block_put_ext()
1382 tcf_block_owner_del(block, q, ei->binder_type); in tcf_block_put_ext()
1384 __tcf_block_put(block, q, ei, true); in tcf_block_put_ext()
1388 void tcf_block_put(struct tcf_block *block) in tcf_block_put() argument
1392 if (!block) in tcf_block_put()
1394 tcf_block_put_ext(block, block->q, &ei); in tcf_block_put()
1400 tcf_block_playback_offloads(struct tcf_block *block, flow_setup_cb_t *cb, in tcf_block_playback_offloads() argument
1408 lockdep_assert_held(&block->cb_lock); in tcf_block_playback_offloads()
1410 for (chain = __tcf_get_next_chain(block, NULL); in tcf_block_playback_offloads()
1413 chain = __tcf_get_next_chain(block, chain), in tcf_block_playback_offloads()
1437 tcf_block_playback_offloads(block, cb, cb_priv, false, offload_in_use, in tcf_block_playback_offloads()
1442 static int tcf_block_bind(struct tcf_block *block, in tcf_block_bind() argument
1448 lockdep_assert_held(&block->cb_lock); in tcf_block_bind()
1451 err = tcf_block_playback_offloads(block, block_cb->cb, in tcf_block_bind()
1453 tcf_block_offload_in_use(block), in tcf_block_bind()
1458 block->lockeddevcnt++; in tcf_block_bind()
1462 list_splice(&bo->cb_list, &block->flow_block.cb_list); in tcf_block_bind()
1470 tcf_block_playback_offloads(block, block_cb->cb, in tcf_block_bind()
1472 tcf_block_offload_in_use(block), in tcf_block_bind()
1475 block->lockeddevcnt--; in tcf_block_bind()
1483 static void tcf_block_unbind(struct tcf_block *block, in tcf_block_unbind() argument
1488 lockdep_assert_held(&block->cb_lock); in tcf_block_unbind()
1491 tcf_block_playback_offloads(block, block_cb->cb, in tcf_block_unbind()
1493 tcf_block_offload_in_use(block), in tcf_block_unbind()
1498 block->lockeddevcnt--; in tcf_block_unbind()
1502 static int tcf_block_setup(struct tcf_block *block, in tcf_block_setup() argument
1509 err = tcf_block_bind(block, bo); in tcf_block_setup()
1513 tcf_block_unbind(block, bo); in tcf_block_setup()
1570 tp->chain->block->index, in __tcf_classify()
1582 const struct tcf_block *block, in tcf_classify() argument
1597 if (block) { in tcf_classify()
1603 fchain = tcf_chain_lookup_rcu(block, ext->chain); in tcf_classify()
1794 struct tcf_proto *tp, struct tcf_block *block, in tcf_fill_node() argument
1815 tcm->tcm_block_index = block->index; in tcf_fill_node()
1849 struct tcf_block *block, struct Qdisc *q, in tfilter_notify() argument
1861 if (tcf_fill_node(net, skb, tp, block, q, parent, fh, portid, in tfilter_notify()
1878 struct tcf_block *block, struct Qdisc *q, in tfilter_del_notify() argument
1890 if (tcf_fill_node(net, skb, tp, block, q, parent, fh, portid, in tfilter_del_notify()
1916 struct tcf_block *block, struct Qdisc *q, in tfilter_notify_chain() argument
1924 tfilter_notify(net, oskb, n, tp, block, in tfilter_notify_chain()
1949 struct tcf_block *block; in tc_new_tfilter() local
1976 block = NULL; in tc_new_tfilter()
2019 block = __tcf_block_find(net, q, cl, t->tcm_ifindex, t->tcm_block_index, in tc_new_tfilter()
2021 if (IS_ERR(block)) { in tc_new_tfilter()
2022 err = PTR_ERR(block); in tc_new_tfilter()
2025 block->classid = parent; in tc_new_tfilter()
2033 chain = tcf_chain_get(block, chain_index, true); in tc_new_tfilter()
2128 tfilter_notify(net, skb, n, tp, block, q, parent, fh, in tc_new_tfilter()
2146 tcf_block_release(q, block, rtnl_held); in tc_new_tfilter()
2180 struct tcf_block *block = NULL; in tc_del_tfilter() local
2231 block = __tcf_block_find(net, q, cl, t->tcm_ifindex, t->tcm_block_index, in tc_del_tfilter()
2233 if (IS_ERR(block)) { in tc_del_tfilter()
2234 err = PTR_ERR(block); in tc_del_tfilter()
2244 chain = tcf_chain_get(block, chain_index, false); in tc_del_tfilter()
2259 tfilter_notify_chain(net, skb, block, q, parent, n, in tc_del_tfilter()
2283 tfilter_notify(net, skb, n, tp, block, q, parent, fh, in tc_del_tfilter()
2298 err = tfilter_del_notify(net, skb, n, tp, block, in tc_del_tfilter()
2314 tcf_block_release(q, block, rtnl_held); in tc_del_tfilter()
2340 struct tcf_block *block = NULL; in tc_get_tfilter() local
2387 block = __tcf_block_find(net, q, cl, t->tcm_ifindex, t->tcm_block_index, in tc_get_tfilter()
2389 if (IS_ERR(block)) { in tc_get_tfilter()
2390 err = PTR_ERR(block); in tc_get_tfilter()
2400 chain = tcf_chain_get(block, chain_index, false); in tc_get_tfilter()
2427 err = tfilter_notify(net, skb, n, tp, block, q, parent, in tc_get_tfilter()
2440 tcf_block_release(q, block, rtnl_held); in tc_get_tfilter()
2452 struct tcf_block *block; member
2463 return tcf_fill_node(net, a->skb, tp, a->block, a->q, a->parent, in tcf_node_dump()
2474 struct tcf_block *block = chain->block; in tcf_chain_dump() local
2497 if (tcf_fill_node(net, skb, tp, block, q, parent, NULL, in tcf_chain_dump()
2509 arg.block = block; in tcf_chain_dump()
2541 struct tcf_block *block; in tc_dump_tfilter() local
2565 block = tcf_block_refcnt_get(net, tcm->tcm_block_index); in tc_dump_tfilter()
2566 if (!block) in tc_dump_tfilter()
2601 block = cops->tcf_block(q, cl, NULL); in tc_dump_tfilter()
2602 if (!block) in tc_dump_tfilter()
2604 parent = block->classid; in tc_dump_tfilter()
2605 if (tcf_block_shared(block)) in tc_dump_tfilter()
2612 for (chain = __tcf_get_next_chain(block, NULL); in tc_dump_tfilter()
2615 chain = __tcf_get_next_chain(block, chain), in tc_dump_tfilter()
2629 tcf_block_refcnt_put(block, true); in tc_dump_tfilter()
2642 struct tcf_block *block, in tc_chain_fill_node() argument
2662 if (block->q) { in tc_chain_fill_node()
2663 tcm->tcm_ifindex = qdisc_dev(block->q)->ifindex; in tc_chain_fill_node()
2664 tcm->tcm_parent = block->q->handle; in tc_chain_fill_node()
2667 tcm->tcm_block_index = block->index; in tc_chain_fill_node()
2693 struct tcf_block *block = chain->block; in tc_chain_notify() local
2694 struct net *net = block->net; in tc_chain_notify()
2703 chain->index, net, skb, block, portid, in tc_chain_notify()
2720 struct tcf_block *block, struct sk_buff *oskb, in tc_chain_notify_delete() argument
2724 struct net *net = block->net; in tc_chain_notify_delete()
2732 block, portid, seq, flags, RTM_DELCHAIN) <= 0) { in tc_chain_notify_delete()
2801 struct tcf_block *block; in tc_ctl_chain() local
2819 block = tcf_block_find(net, &q, &parent, &cl, in tc_ctl_chain()
2821 if (IS_ERR(block)) in tc_ctl_chain()
2822 return PTR_ERR(block); in tc_ctl_chain()
2831 mutex_lock(&block->lock); in tc_ctl_chain()
2832 chain = tcf_chain_lookup(block, chain_index); in tc_ctl_chain()
2851 chain = tcf_chain_create(block, chain_index); in tc_ctl_chain()
2876 mutex_unlock(&block->lock); in tc_ctl_chain()
2890 tfilter_notify_chain(net, skb, block, q, parent, n, in tc_ctl_chain()
2914 tcf_block_release(q, block, true); in tc_ctl_chain()
2921 mutex_unlock(&block->lock); in tc_ctl_chain()
2931 struct tcf_block *block; in tc_dump_chain() local
2947 block = tcf_block_refcnt_get(net, tcm->tcm_block_index); in tc_dump_chain()
2948 if (!block) in tc_dump_chain()
2976 block = cops->tcf_block(q, cl, NULL); in tc_dump_chain()
2977 if (!block) in tc_dump_chain()
2979 if (tcf_block_shared(block)) in tc_dump_chain()
2986 mutex_lock(&block->lock); in tc_dump_chain()
2987 list_for_each_entry(chain, &block->chain_list, list) { in tc_dump_chain()
2998 chain->index, net, skb, block, in tc_dump_chain()
3006 mutex_unlock(&block->lock); in tc_dump_chain()
3009 tcf_block_refcnt_put(block, true); in tc_dump_chain()
3184 static void tcf_block_offload_inc(struct tcf_block *block, u32 *flags) in tcf_block_offload_inc() argument
3189 atomic_inc(&block->offloadcnt); in tcf_block_offload_inc()
3192 static void tcf_block_offload_dec(struct tcf_block *block, u32 *flags) in tcf_block_offload_dec() argument
3197 atomic_dec(&block->offloadcnt); in tcf_block_offload_dec()
3200 static void tc_cls_offload_cnt_update(struct tcf_block *block, in tc_cls_offload_cnt_update() argument
3204 lockdep_assert_held(&block->cb_lock); in tc_cls_offload_cnt_update()
3209 tcf_block_offload_inc(block, flags); in tc_cls_offload_cnt_update()
3214 tcf_block_offload_dec(block, flags); in tc_cls_offload_cnt_update()
3220 tc_cls_offload_cnt_reset(struct tcf_block *block, struct tcf_proto *tp, in tc_cls_offload_cnt_reset() argument
3223 lockdep_assert_held(&block->cb_lock); in tc_cls_offload_cnt_reset()
3226 tcf_block_offload_dec(block, flags); in tc_cls_offload_cnt_reset()
3232 __tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type, in __tc_setup_cb_call() argument
3239 list_for_each_entry(block_cb, &block->flow_block.cb_list, list) { in __tc_setup_cb_call()
3251 int tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type, in tc_setup_cb_call() argument
3254 bool take_rtnl = READ_ONCE(block->lockeddevcnt) && !rtnl_held; in tc_setup_cb_call()
3260 down_read(&block->cb_lock); in tc_setup_cb_call()
3265 if (!rtnl_held && !take_rtnl && block->lockeddevcnt) { in tc_setup_cb_call()
3266 up_read(&block->cb_lock); in tc_setup_cb_call()
3271 ok_count = __tc_setup_cb_call(block, type, type_data, err_stop); in tc_setup_cb_call()
3273 up_read(&block->cb_lock); in tc_setup_cb_call()
3286 int tc_setup_cb_add(struct tcf_block *block, struct tcf_proto *tp, in tc_setup_cb_add() argument
3290 bool take_rtnl = READ_ONCE(block->lockeddevcnt) && !rtnl_held; in tc_setup_cb_add()
3296 down_read(&block->cb_lock); in tc_setup_cb_add()
3301 if (!rtnl_held && !take_rtnl && block->lockeddevcnt) { in tc_setup_cb_add()
3302 up_read(&block->cb_lock); in tc_setup_cb_add()
3308 if (block->nooffloaddevcnt && err_stop) { in tc_setup_cb_add()
3313 ok_count = __tc_setup_cb_call(block, type, type_data, err_stop); in tc_setup_cb_add()
3320 tc_cls_offload_cnt_update(block, tp, in_hw_count, flags, in tc_setup_cb_add()
3323 up_read(&block->cb_lock); in tc_setup_cb_add()
3336 int tc_setup_cb_replace(struct tcf_block *block, struct tcf_proto *tp, in tc_setup_cb_replace() argument
3342 bool take_rtnl = READ_ONCE(block->lockeddevcnt) && !rtnl_held; in tc_setup_cb_replace()
3348 down_read(&block->cb_lock); in tc_setup_cb_replace()
3353 if (!rtnl_held && !take_rtnl && block->lockeddevcnt) { in tc_setup_cb_replace()
3354 up_read(&block->cb_lock); in tc_setup_cb_replace()
3360 if (block->nooffloaddevcnt && err_stop) { in tc_setup_cb_replace()
3365 tc_cls_offload_cnt_reset(block, tp, old_in_hw_count, old_flags); in tc_setup_cb_replace()
3369 ok_count = __tc_setup_cb_call(block, type, type_data, err_stop); in tc_setup_cb_replace()
3376 tc_cls_offload_cnt_update(block, tp, new_in_hw_count, in tc_setup_cb_replace()
3379 up_read(&block->cb_lock); in tc_setup_cb_replace()
3390 int tc_setup_cb_destroy(struct tcf_block *block, struct tcf_proto *tp, in tc_setup_cb_destroy() argument
3394 bool take_rtnl = READ_ONCE(block->lockeddevcnt) && !rtnl_held; in tc_setup_cb_destroy()
3400 down_read(&block->cb_lock); in tc_setup_cb_destroy()
3405 if (!rtnl_held && !take_rtnl && block->lockeddevcnt) { in tc_setup_cb_destroy()
3406 up_read(&block->cb_lock); in tc_setup_cb_destroy()
3411 ok_count = __tc_setup_cb_call(block, type, type_data, err_stop); in tc_setup_cb_destroy()
3413 tc_cls_offload_cnt_reset(block, tp, in_hw_count, flags); in tc_setup_cb_destroy()
3417 up_read(&block->cb_lock); in tc_setup_cb_destroy()
3424 int tc_setup_cb_reoffload(struct tcf_block *block, struct tcf_proto *tp, in tc_setup_cb_reoffload() argument
3435 tc_cls_offload_cnt_update(block, tp, in_hw_count, flags, 1, in tc_setup_cb_reoffload()
3787 return tcf_block_get_ext(&qe->block, sch, &qe->info, extack); in tcf_qevent_init()
3794 tcf_block_put_ext(qe->block, sch, &qe->info); in tcf_qevent_destroy()