Lines Matching refs:block

78 	struct tcf_block *block = chain->block;  in tcf_proto_signal_destroying()  local
80 mutex_lock(&block->proto_destroy_lock); in tcf_proto_signal_destroying()
81 hash_add_rcu(block->proto_destroy_ht, &tp->destroy_ht_node, in tcf_proto_signal_destroying()
83 mutex_unlock(&block->proto_destroy_lock); in tcf_proto_signal_destroying()
102 hash_for_each_possible_rcu(chain->block->proto_destroy_ht, iter, in tcf_proto_exists_destroying()
117 struct tcf_block *block = chain->block; in tcf_proto_signal_destroyed() local
119 mutex_lock(&block->proto_destroy_lock); in tcf_proto_signal_destroyed()
122 mutex_unlock(&block->proto_destroy_lock); in tcf_proto_signal_destroyed()
357 #define ASSERT_BLOCK_LOCKED(block) \ argument
358 lockdep_assert_held(&(block)->lock)
366 static struct tcf_chain *tcf_chain_create(struct tcf_block *block, in tcf_chain_create() argument
371 ASSERT_BLOCK_LOCKED(block); in tcf_chain_create()
376 list_add_tail_rcu(&chain->list, &block->chain_list); in tcf_chain_create()
378 chain->block = block; in tcf_chain_create()
382 block->chain0.chain = chain; in tcf_chain_create()
397 struct tcf_block *block = chain->block; in tcf_chain0_head_change() local
402 mutex_lock(&block->lock); in tcf_chain0_head_change()
403 list_for_each_entry(item, &block->chain0.filter_chain_list, list) in tcf_chain0_head_change()
405 mutex_unlock(&block->lock); in tcf_chain0_head_change()
412 struct tcf_block *block = chain->block; in tcf_chain_detach() local
414 ASSERT_BLOCK_LOCKED(block); in tcf_chain_detach()
418 block->chain0.chain = NULL; in tcf_chain_detach()
420 if (list_empty(&block->chain_list) && in tcf_chain_detach()
421 refcount_read(&block->refcnt) == 0) in tcf_chain_detach()
427 static void tcf_block_destroy(struct tcf_block *block) in tcf_block_destroy() argument
429 mutex_destroy(&block->lock); in tcf_block_destroy()
430 mutex_destroy(&block->proto_destroy_lock); in tcf_block_destroy()
431 kfree_rcu(block, rcu); in tcf_block_destroy()
436 struct tcf_block *block = chain->block; in tcf_chain_destroy() local
441 tcf_block_destroy(block); in tcf_chain_destroy()
446 ASSERT_BLOCK_LOCKED(chain->block); in tcf_chain_hold()
453 ASSERT_BLOCK_LOCKED(chain->block); in tcf_chain_held_by_acts_only()
461 static struct tcf_chain *tcf_chain_lookup(struct tcf_block *block, in tcf_chain_lookup() argument
466 ASSERT_BLOCK_LOCKED(block); in tcf_chain_lookup()
468 list_for_each_entry(chain, &block->chain_list, list) { in tcf_chain_lookup()
476 static struct tcf_chain *tcf_chain_lookup_rcu(const struct tcf_block *block, in tcf_chain_lookup_rcu() argument
481 list_for_each_entry_rcu(chain, &block->chain_list, list) { in tcf_chain_lookup_rcu()
492 static struct tcf_chain *__tcf_chain_get(struct tcf_block *block, in __tcf_chain_get() argument
499 mutex_lock(&block->lock); in __tcf_chain_get()
500 chain = tcf_chain_lookup(block, chain_index); in __tcf_chain_get()
506 chain = tcf_chain_create(block, chain_index); in __tcf_chain_get()
514 mutex_unlock(&block->lock); in __tcf_chain_get()
528 mutex_unlock(&block->lock); in __tcf_chain_get()
532 static struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index, in tcf_chain_get() argument
535 return __tcf_chain_get(block, chain_index, create, false); in tcf_chain_get()
538 struct tcf_chain *tcf_chain_get_by_act(struct tcf_block *block, u32 chain_index) in tcf_chain_get_by_act() argument
540 return __tcf_chain_get(block, chain_index, true, true); in tcf_chain_get_by_act()
548 struct tcf_block *block, struct sk_buff *oskb,
554 struct tcf_block *block = chain->block; in __tcf_chain_put() local
560 mutex_lock(&block->lock); in __tcf_chain_put()
563 mutex_unlock(&block->lock); in __tcf_chain_put()
583 block, NULL, 0, 0, false); in __tcf_chain_put()
590 mutex_unlock(&block->lock); in __tcf_chain_put()
638 static int tcf_block_setup(struct tcf_block *block,
651 bo->block = flow_block; in tcf_block_offload_init()
659 static void tcf_block_unbind(struct tcf_block *block,
664 struct tcf_block *block = block_cb->indr.data; in tc_block_indr_cleanup() local
672 &block->flow_block, tcf_block_shared(block), in tc_block_indr_cleanup()
675 down_write(&block->cb_lock); in tc_block_indr_cleanup()
678 tcf_block_unbind(block, &bo); in tc_block_indr_cleanup()
679 up_write(&block->cb_lock); in tc_block_indr_cleanup()
683 static bool tcf_block_offload_in_use(struct tcf_block *block) in tcf_block_offload_in_use() argument
685 return atomic_read(&block->offloadcnt); in tcf_block_offload_in_use()
688 static int tcf_block_offload_cmd(struct tcf_block *block, in tcf_block_offload_cmd() argument
697 &block->flow_block, tcf_block_shared(block), in tcf_block_offload_cmd()
710 return tcf_block_setup(block, &bo); in tcf_block_offload_cmd()
713 flow_indr_dev_setup_offload(dev, sch, TC_SETUP_BLOCK, block, &bo, in tcf_block_offload_cmd()
715 tcf_block_setup(block, &bo); in tcf_block_offload_cmd()
720 static int tcf_block_offload_bind(struct tcf_block *block, struct Qdisc *q, in tcf_block_offload_bind() argument
727 down_write(&block->cb_lock); in tcf_block_offload_bind()
734 tcf_block_offload_in_use(block)) { in tcf_block_offload_bind()
740 err = tcf_block_offload_cmd(block, dev, q, ei, FLOW_BLOCK_BIND, extack); in tcf_block_offload_bind()
746 up_write(&block->cb_lock); in tcf_block_offload_bind()
750 if (tcf_block_offload_in_use(block)) in tcf_block_offload_bind()
754 block->nooffloaddevcnt++; in tcf_block_offload_bind()
756 up_write(&block->cb_lock); in tcf_block_offload_bind()
760 static void tcf_block_offload_unbind(struct tcf_block *block, struct Qdisc *q, in tcf_block_offload_unbind() argument
766 down_write(&block->cb_lock); in tcf_block_offload_unbind()
767 err = tcf_block_offload_cmd(block, dev, q, ei, FLOW_BLOCK_UNBIND, NULL); in tcf_block_offload_unbind()
770 up_write(&block->cb_lock); in tcf_block_offload_unbind()
774 WARN_ON(block->nooffloaddevcnt-- == 0); in tcf_block_offload_unbind()
775 up_write(&block->cb_lock); in tcf_block_offload_unbind()
779 tcf_chain0_head_change_cb_add(struct tcf_block *block, in tcf_chain0_head_change_cb_add() argument
794 mutex_lock(&block->lock); in tcf_chain0_head_change_cb_add()
795 chain0 = block->chain0.chain; in tcf_chain0_head_change_cb_add()
799 list_add(&item->list, &block->chain0.filter_chain_list); in tcf_chain0_head_change_cb_add()
800 mutex_unlock(&block->lock); in tcf_chain0_head_change_cb_add()
811 mutex_lock(&block->lock); in tcf_chain0_head_change_cb_add()
812 list_add(&item->list, &block->chain0.filter_chain_list); in tcf_chain0_head_change_cb_add()
813 mutex_unlock(&block->lock); in tcf_chain0_head_change_cb_add()
823 tcf_chain0_head_change_cb_del(struct tcf_block *block, in tcf_chain0_head_change_cb_del() argument
828 mutex_lock(&block->lock); in tcf_chain0_head_change_cb_del()
829 list_for_each_entry(item, &block->chain0.filter_chain_list, list) { in tcf_chain0_head_change_cb_del()
833 if (block->chain0.chain) in tcf_chain0_head_change_cb_del()
836 mutex_unlock(&block->lock); in tcf_chain0_head_change_cb_del()
842 mutex_unlock(&block->lock); in tcf_chain0_head_change_cb_del()
853 static int tcf_block_insert(struct tcf_block *block, struct net *net, in tcf_block_insert() argument
861 err = idr_alloc_u32(&tn->idr, block, &block->index, block->index, in tcf_block_insert()
869 static void tcf_block_remove(struct tcf_block *block, struct net *net) in tcf_block_remove() argument
874 idr_remove(&tn->idr, block->index); in tcf_block_remove()
882 struct tcf_block *block; in tcf_block_create() local
884 block = kzalloc(sizeof(*block), GFP_KERNEL); in tcf_block_create()
885 if (!block) { in tcf_block_create()
889 mutex_init(&block->lock); in tcf_block_create()
890 mutex_init(&block->proto_destroy_lock); in tcf_block_create()
891 init_rwsem(&block->cb_lock); in tcf_block_create()
892 flow_block_init(&block->flow_block); in tcf_block_create()
893 INIT_LIST_HEAD(&block->chain_list); in tcf_block_create()
894 INIT_LIST_HEAD(&block->owner_list); in tcf_block_create()
895 INIT_LIST_HEAD(&block->chain0.filter_chain_list); in tcf_block_create()
897 refcount_set(&block->refcnt, 1); in tcf_block_create()
898 block->net = net; in tcf_block_create()
899 block->index = block_index; in tcf_block_create()
902 if (!tcf_block_shared(block)) in tcf_block_create()
903 block->q = q; in tcf_block_create()
904 return block; in tcf_block_create()
916 struct tcf_block *block; in tcf_block_refcnt_get() local
919 block = tcf_block_lookup(net, block_index); in tcf_block_refcnt_get()
920 if (block && !refcount_inc_not_zero(&block->refcnt)) in tcf_block_refcnt_get()
921 block = NULL; in tcf_block_refcnt_get()
924 return block; in tcf_block_refcnt_get()
928 __tcf_get_next_chain(struct tcf_block *block, struct tcf_chain *chain) in __tcf_get_next_chain() argument
930 mutex_lock(&block->lock); in __tcf_get_next_chain()
932 chain = list_is_last(&chain->list, &block->chain_list) ? in __tcf_get_next_chain()
935 chain = list_first_entry_or_null(&block->chain_list, in __tcf_get_next_chain()
940 chain = list_is_last(&chain->list, &block->chain_list) ? in __tcf_get_next_chain()
945 mutex_unlock(&block->lock); in __tcf_get_next_chain()
960 tcf_get_next_chain(struct tcf_block *block, struct tcf_chain *chain) in tcf_get_next_chain() argument
962 struct tcf_chain *chain_next = __tcf_get_next_chain(block, chain); in tcf_get_next_chain()
1024 static void tcf_block_flush_all_chains(struct tcf_block *block, bool rtnl_held) in tcf_block_flush_all_chains() argument
1031 for (chain = tcf_get_next_chain(block, NULL); in tcf_block_flush_all_chains()
1033 chain = tcf_get_next_chain(block, chain)) { in tcf_block_flush_all_chains()
1143 struct tcf_block *block; in __tcf_block_find() local
1146 block = tcf_block_refcnt_get(net, block_index); in __tcf_block_find()
1147 if (!block) { in __tcf_block_find()
1154 block = cops->tcf_block(q, cl, extack); in __tcf_block_find()
1155 if (!block) in __tcf_block_find()
1158 if (tcf_block_shared(block)) { in __tcf_block_find()
1169 refcount_inc(&block->refcnt); in __tcf_block_find()
1172 return block; in __tcf_block_find()
1175 static void __tcf_block_put(struct tcf_block *block, struct Qdisc *q, in __tcf_block_put() argument
1178 if (refcount_dec_and_mutex_lock(&block->refcnt, &block->lock)) { in __tcf_block_put()
1185 bool free_block = list_empty(&block->chain_list); in __tcf_block_put()
1187 mutex_unlock(&block->lock); in __tcf_block_put()
1188 if (tcf_block_shared(block)) in __tcf_block_put()
1189 tcf_block_remove(block, block->net); in __tcf_block_put()
1192 tcf_block_offload_unbind(block, q, ei); in __tcf_block_put()
1195 tcf_block_destroy(block); in __tcf_block_put()
1197 tcf_block_flush_all_chains(block, rtnl_held); in __tcf_block_put()
1199 tcf_block_offload_unbind(block, q, ei); in __tcf_block_put()
1203 static void tcf_block_refcnt_put(struct tcf_block *block, bool rtnl_held) in tcf_block_refcnt_put() argument
1205 __tcf_block_put(block, NULL, NULL, rtnl_held); in tcf_block_refcnt_put()
1217 struct tcf_block *block; in tcf_block_find() local
1230 block = __tcf_block_find(net, *q, *cl, ifindex, block_index, extack); in tcf_block_find()
1231 if (IS_ERR(block)) { in tcf_block_find()
1232 err = PTR_ERR(block); in tcf_block_find()
1236 return block; in tcf_block_find()
1246 static void tcf_block_release(struct Qdisc *q, struct tcf_block *block, in tcf_block_release() argument
1249 if (!IS_ERR_OR_NULL(block)) in tcf_block_release()
1250 tcf_block_refcnt_put(block, rtnl_held); in tcf_block_release()
1267 tcf_block_owner_netif_keep_dst(struct tcf_block *block, in tcf_block_owner_netif_keep_dst() argument
1271 if (block->keep_dst && in tcf_block_owner_netif_keep_dst()
1277 void tcf_block_netif_keep_dst(struct tcf_block *block) in tcf_block_netif_keep_dst() argument
1281 block->keep_dst = true; in tcf_block_netif_keep_dst()
1282 list_for_each_entry(item, &block->owner_list, list) in tcf_block_netif_keep_dst()
1283 tcf_block_owner_netif_keep_dst(block, item->q, in tcf_block_netif_keep_dst()
1288 static int tcf_block_owner_add(struct tcf_block *block, in tcf_block_owner_add() argument
1299 list_add(&item->list, &block->owner_list); in tcf_block_owner_add()
1303 static void tcf_block_owner_del(struct tcf_block *block, in tcf_block_owner_del() argument
1309 list_for_each_entry(item, &block->owner_list, list) { in tcf_block_owner_del()
1324 struct tcf_block *block = NULL; in tcf_block_get_ext() local
1329 block = tcf_block_refcnt_get(net, ei->block_index); in tcf_block_get_ext()
1331 if (!block) { in tcf_block_get_ext()
1332 block = tcf_block_create(net, q, ei->block_index, extack); in tcf_block_get_ext()
1333 if (IS_ERR(block)) in tcf_block_get_ext()
1334 return PTR_ERR(block); in tcf_block_get_ext()
1335 if (tcf_block_shared(block)) { in tcf_block_get_ext()
1336 err = tcf_block_insert(block, net, extack); in tcf_block_get_ext()
1342 err = tcf_block_owner_add(block, q, ei->binder_type); in tcf_block_get_ext()
1346 tcf_block_owner_netif_keep_dst(block, q, ei->binder_type); in tcf_block_get_ext()
1348 err = tcf_chain0_head_change_cb_add(block, ei, extack); in tcf_block_get_ext()
1352 err = tcf_block_offload_bind(block, q, ei, extack); in tcf_block_get_ext()
1356 *p_block = block; in tcf_block_get_ext()
1360 tcf_chain0_head_change_cb_del(block, ei); in tcf_block_get_ext()
1362 tcf_block_owner_del(block, q, ei->binder_type); in tcf_block_get_ext()
1365 tcf_block_refcnt_put(block, true); in tcf_block_get_ext()
1394 void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q, in tcf_block_put_ext() argument
1397 if (!block) in tcf_block_put_ext()
1399 tcf_chain0_head_change_cb_del(block, ei); in tcf_block_put_ext()
1400 tcf_block_owner_del(block, q, ei->binder_type); in tcf_block_put_ext()
1402 __tcf_block_put(block, q, ei, true); in tcf_block_put_ext()
1406 void tcf_block_put(struct tcf_block *block) in tcf_block_put() argument
1410 if (!block) in tcf_block_put()
1412 tcf_block_put_ext(block, block->q, &ei); in tcf_block_put()
1418 tcf_block_playback_offloads(struct tcf_block *block, flow_setup_cb_t *cb, in tcf_block_playback_offloads() argument
1426 lockdep_assert_held(&block->cb_lock); in tcf_block_playback_offloads()
1428 for (chain = __tcf_get_next_chain(block, NULL); in tcf_block_playback_offloads()
1431 chain = __tcf_get_next_chain(block, chain), in tcf_block_playback_offloads()
1455 tcf_block_playback_offloads(block, cb, cb_priv, false, offload_in_use, in tcf_block_playback_offloads()
1460 static int tcf_block_bind(struct tcf_block *block, in tcf_block_bind() argument
1466 lockdep_assert_held(&block->cb_lock); in tcf_block_bind()
1469 err = tcf_block_playback_offloads(block, block_cb->cb, in tcf_block_bind()
1471 tcf_block_offload_in_use(block), in tcf_block_bind()
1476 block->lockeddevcnt++; in tcf_block_bind()
1480 list_splice(&bo->cb_list, &block->flow_block.cb_list); in tcf_block_bind()
1488 tcf_block_playback_offloads(block, block_cb->cb, in tcf_block_bind()
1490 tcf_block_offload_in_use(block), in tcf_block_bind()
1493 block->lockeddevcnt--; in tcf_block_bind()
1501 static void tcf_block_unbind(struct tcf_block *block, in tcf_block_unbind() argument
1506 lockdep_assert_held(&block->cb_lock); in tcf_block_unbind()
1509 tcf_block_playback_offloads(block, block_cb->cb, in tcf_block_unbind()
1511 tcf_block_offload_in_use(block), in tcf_block_unbind()
1516 block->lockeddevcnt--; in tcf_block_unbind()
1520 static int tcf_block_setup(struct tcf_block *block, in tcf_block_setup() argument
1527 err = tcf_block_bind(block, bo); in tcf_block_setup()
1531 tcf_block_unbind(block, bo); in tcf_block_setup()
1588 tp->chain->block->index, in __tcf_classify()
1600 const struct tcf_block *block, in tcf_classify() argument
1615 if (block) { in tcf_classify()
1621 fchain = tcf_chain_lookup_rcu(block, ext->chain); in tcf_classify()
1816 struct tcf_proto *tp, struct tcf_block *block, in tcf_fill_node() argument
1837 tcm->tcm_block_index = block->index; in tcf_fill_node()
1871 struct tcf_block *block, struct Qdisc *q, in tfilter_notify() argument
1883 if (tcf_fill_node(net, skb, tp, block, q, parent, fh, portid, in tfilter_notify()
1900 struct tcf_block *block, struct Qdisc *q, in tfilter_del_notify() argument
1912 if (tcf_fill_node(net, skb, tp, block, q, parent, fh, portid, in tfilter_del_notify()
1938 struct tcf_block *block, struct Qdisc *q, in tfilter_notify_chain() argument
1946 tfilter_notify(net, oskb, n, tp, block, in tfilter_notify_chain()
1971 struct tcf_block *block; in tc_new_tfilter() local
1995 block = NULL; in tc_new_tfilter()
2040 block = __tcf_block_find(net, q, cl, t->tcm_ifindex, t->tcm_block_index, in tc_new_tfilter()
2042 if (IS_ERR(block)) { in tc_new_tfilter()
2043 err = PTR_ERR(block); in tc_new_tfilter()
2046 block->classid = parent; in tc_new_tfilter()
2054 chain = tcf_chain_get(block, chain_index, true); in tc_new_tfilter()
2150 tfilter_notify(net, skb, n, tp, block, q, parent, fh, in tc_new_tfilter()
2168 tcf_block_release(q, block, rtnl_held); in tc_new_tfilter()
2202 struct tcf_block *block = NULL; in tc_del_tfilter() local
2250 block = __tcf_block_find(net, q, cl, t->tcm_ifindex, t->tcm_block_index, in tc_del_tfilter()
2252 if (IS_ERR(block)) { in tc_del_tfilter()
2253 err = PTR_ERR(block); in tc_del_tfilter()
2263 chain = tcf_chain_get(block, chain_index, false); in tc_del_tfilter()
2278 tfilter_notify_chain(net, skb, block, q, parent, n, in tc_del_tfilter()
2302 tfilter_notify(net, skb, n, tp, block, q, parent, fh, in tc_del_tfilter()
2317 err = tfilter_del_notify(net, skb, n, tp, block, in tc_del_tfilter()
2333 tcf_block_release(q, block, rtnl_held); in tc_del_tfilter()
2359 struct tcf_block *block = NULL; in tc_get_tfilter() local
2406 block = __tcf_block_find(net, q, cl, t->tcm_ifindex, t->tcm_block_index, in tc_get_tfilter()
2408 if (IS_ERR(block)) { in tc_get_tfilter()
2409 err = PTR_ERR(block); in tc_get_tfilter()
2419 chain = tcf_chain_get(block, chain_index, false); in tc_get_tfilter()
2446 err = tfilter_notify(net, skb, n, tp, block, q, parent, in tc_get_tfilter()
2459 tcf_block_release(q, block, rtnl_held); in tc_get_tfilter()
2471 struct tcf_block *block; member
2482 return tcf_fill_node(net, a->skb, tp, a->block, a->q, a->parent, in tcf_node_dump()
2493 struct tcf_block *block = chain->block; in tcf_chain_dump() local
2516 if (tcf_fill_node(net, skb, tp, block, q, parent, NULL, in tcf_chain_dump()
2528 arg.block = block; in tcf_chain_dump()
2560 struct tcf_block *block; in tc_dump_tfilter() local
2584 block = tcf_block_refcnt_get(net, tcm->tcm_block_index); in tc_dump_tfilter()
2585 if (!block) in tc_dump_tfilter()
2620 block = cops->tcf_block(q, cl, NULL); in tc_dump_tfilter()
2621 if (!block) in tc_dump_tfilter()
2623 parent = block->classid; in tc_dump_tfilter()
2624 if (tcf_block_shared(block)) in tc_dump_tfilter()
2631 for (chain = __tcf_get_next_chain(block, NULL); in tc_dump_tfilter()
2634 chain = __tcf_get_next_chain(block, chain), in tc_dump_tfilter()
2648 tcf_block_refcnt_put(block, true); in tc_dump_tfilter()
2661 struct tcf_block *block, in tc_chain_fill_node() argument
2681 if (block->q) { in tc_chain_fill_node()
2682 tcm->tcm_ifindex = qdisc_dev(block->q)->ifindex; in tc_chain_fill_node()
2683 tcm->tcm_parent = block->q->handle; in tc_chain_fill_node()
2686 tcm->tcm_block_index = block->index; in tc_chain_fill_node()
2712 struct tcf_block *block = chain->block; in tc_chain_notify() local
2713 struct net *net = block->net; in tc_chain_notify()
2722 chain->index, net, skb, block, portid, in tc_chain_notify()
2739 struct tcf_block *block, struct sk_buff *oskb, in tc_chain_notify_delete() argument
2743 struct net *net = block->net; in tc_chain_notify_delete()
2751 block, portid, seq, flags, RTM_DELCHAIN) <= 0) { in tc_chain_notify_delete()
2820 struct tcf_block *block; in tc_ctl_chain() local
2835 block = tcf_block_find(net, &q, &parent, &cl, in tc_ctl_chain()
2837 if (IS_ERR(block)) in tc_ctl_chain()
2838 return PTR_ERR(block); in tc_ctl_chain()
2847 mutex_lock(&block->lock); in tc_ctl_chain()
2848 chain = tcf_chain_lookup(block, chain_index); in tc_ctl_chain()
2867 chain = tcf_chain_create(block, chain_index); in tc_ctl_chain()
2892 mutex_unlock(&block->lock); in tc_ctl_chain()
2906 tfilter_notify_chain(net, skb, block, q, parent, n, in tc_ctl_chain()
2930 tcf_block_release(q, block, true); in tc_ctl_chain()
2937 mutex_unlock(&block->lock); in tc_ctl_chain()
2947 struct tcf_block *block; in tc_dump_chain() local
2963 block = tcf_block_refcnt_get(net, tcm->tcm_block_index); in tc_dump_chain()
2964 if (!block) in tc_dump_chain()
2992 block = cops->tcf_block(q, cl, NULL); in tc_dump_chain()
2993 if (!block) in tc_dump_chain()
2995 if (tcf_block_shared(block)) in tc_dump_chain()
3002 mutex_lock(&block->lock); in tc_dump_chain()
3003 list_for_each_entry(chain, &block->chain_list, list) { in tc_dump_chain()
3014 chain->index, net, skb, block, in tc_dump_chain()
3022 mutex_unlock(&block->lock); in tc_dump_chain()
3025 tcf_block_refcnt_put(block, true); in tc_dump_chain()
3210 static void tcf_block_offload_inc(struct tcf_block *block, u32 *flags) in tcf_block_offload_inc() argument
3215 atomic_inc(&block->offloadcnt); in tcf_block_offload_inc()
3218 static void tcf_block_offload_dec(struct tcf_block *block, u32 *flags) in tcf_block_offload_dec() argument
3223 atomic_dec(&block->offloadcnt); in tcf_block_offload_dec()
3226 static void tc_cls_offload_cnt_update(struct tcf_block *block, in tc_cls_offload_cnt_update() argument
3230 lockdep_assert_held(&block->cb_lock); in tc_cls_offload_cnt_update()
3235 tcf_block_offload_inc(block, flags); in tc_cls_offload_cnt_update()
3240 tcf_block_offload_dec(block, flags); in tc_cls_offload_cnt_update()
3246 tc_cls_offload_cnt_reset(struct tcf_block *block, struct tcf_proto *tp, in tc_cls_offload_cnt_reset() argument
3249 lockdep_assert_held(&block->cb_lock); in tc_cls_offload_cnt_reset()
3252 tcf_block_offload_dec(block, flags); in tc_cls_offload_cnt_reset()
3258 __tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type, in __tc_setup_cb_call() argument
3265 list_for_each_entry(block_cb, &block->flow_block.cb_list, list) { in __tc_setup_cb_call()
3277 int tc_setup_cb_call(struct tcf_block *block, enum tc_setup_type type, in tc_setup_cb_call() argument
3280 bool take_rtnl = READ_ONCE(block->lockeddevcnt) && !rtnl_held; in tc_setup_cb_call()
3286 down_read(&block->cb_lock); in tc_setup_cb_call()
3291 if (!rtnl_held && !take_rtnl && block->lockeddevcnt) { in tc_setup_cb_call()
3292 up_read(&block->cb_lock); in tc_setup_cb_call()
3297 ok_count = __tc_setup_cb_call(block, type, type_data, err_stop); in tc_setup_cb_call()
3299 up_read(&block->cb_lock); in tc_setup_cb_call()
3312 int tc_setup_cb_add(struct tcf_block *block, struct tcf_proto *tp, in tc_setup_cb_add() argument
3316 bool take_rtnl = READ_ONCE(block->lockeddevcnt) && !rtnl_held; in tc_setup_cb_add()
3322 down_read(&block->cb_lock); in tc_setup_cb_add()
3327 if (!rtnl_held && !take_rtnl && block->lockeddevcnt) { in tc_setup_cb_add()
3328 up_read(&block->cb_lock); in tc_setup_cb_add()
3334 if (block->nooffloaddevcnt && err_stop) { in tc_setup_cb_add()
3339 ok_count = __tc_setup_cb_call(block, type, type_data, err_stop); in tc_setup_cb_add()
3346 tc_cls_offload_cnt_update(block, tp, in_hw_count, flags, in tc_setup_cb_add()
3349 up_read(&block->cb_lock); in tc_setup_cb_add()
3362 int tc_setup_cb_replace(struct tcf_block *block, struct tcf_proto *tp, in tc_setup_cb_replace() argument
3368 bool take_rtnl = READ_ONCE(block->lockeddevcnt) && !rtnl_held; in tc_setup_cb_replace()
3374 down_read(&block->cb_lock); in tc_setup_cb_replace()
3379 if (!rtnl_held && !take_rtnl && block->lockeddevcnt) { in tc_setup_cb_replace()
3380 up_read(&block->cb_lock); in tc_setup_cb_replace()
3386 if (block->nooffloaddevcnt && err_stop) { in tc_setup_cb_replace()
3391 tc_cls_offload_cnt_reset(block, tp, old_in_hw_count, old_flags); in tc_setup_cb_replace()
3395 ok_count = __tc_setup_cb_call(block, type, type_data, err_stop); in tc_setup_cb_replace()
3402 tc_cls_offload_cnt_update(block, tp, new_in_hw_count, in tc_setup_cb_replace()
3405 up_read(&block->cb_lock); in tc_setup_cb_replace()
3416 int tc_setup_cb_destroy(struct tcf_block *block, struct tcf_proto *tp, in tc_setup_cb_destroy() argument
3420 bool take_rtnl = READ_ONCE(block->lockeddevcnt) && !rtnl_held; in tc_setup_cb_destroy()
3426 down_read(&block->cb_lock); in tc_setup_cb_destroy()
3431 if (!rtnl_held && !take_rtnl && block->lockeddevcnt) { in tc_setup_cb_destroy()
3432 up_read(&block->cb_lock); in tc_setup_cb_destroy()
3437 ok_count = __tc_setup_cb_call(block, type, type_data, err_stop); in tc_setup_cb_destroy()
3439 tc_cls_offload_cnt_reset(block, tp, in_hw_count, flags); in tc_setup_cb_destroy()
3443 up_read(&block->cb_lock); in tc_setup_cb_destroy()
3450 int tc_setup_cb_reoffload(struct tcf_block *block, struct tcf_proto *tp, in tc_setup_cb_reoffload() argument
3461 tc_cls_offload_cnt_update(block, tp, in_hw_count, flags, 1, in tc_setup_cb_reoffload()
3638 return tcf_block_get_ext(&qe->block, sch, &qe->info, extack); in tcf_qevent_init()
3645 tcf_block_put_ext(qe->block, sch, &qe->info); in tcf_qevent_destroy()