Lines Matching full:chain
54 const struct tcf_chain *chain; member
91 n->chain_index = tp->chain->index; in tcf_exts_miss_cookie_base_alloc()
92 n->chain = tp->chain; in tcf_exts_miss_cookie_base_alloc()
174 return jhash_3words(tp->chain->index, tp->prio, in destroy_obj_hashfn()
178 static void tcf_proto_signal_destroying(struct tcf_chain *chain, in tcf_proto_signal_destroying() argument
181 struct tcf_block *block = chain->block; in tcf_proto_signal_destroying()
192 return tp1->chain->index == tp2->chain->index && in tcf_proto_cmp()
197 static bool tcf_proto_exists_destroying(struct tcf_chain *chain, in tcf_proto_exists_destroying() argument
205 hash_for_each_possible_rcu(chain->block->proto_destroy_ht, iter, in tcf_proto_exists_destroying()
218 tcf_proto_signal_destroyed(struct tcf_chain *chain, struct tcf_proto *tp) in tcf_proto_signal_destroyed() argument
220 struct tcf_block *block = chain->block; in tcf_proto_signal_destroyed()
373 u32 prio, struct tcf_chain *chain, in tcf_proto_create() argument
392 tp->chain = chain; in tcf_proto_create()
413 static void tcf_chain_put(struct tcf_chain *chain);
420 tcf_proto_signal_destroyed(tp->chain, tp); in tcf_proto_destroy()
421 tcf_chain_put(tp->chain); in tcf_proto_destroy()
472 struct tcf_chain *chain; in tcf_chain_create() local
476 chain = kzalloc(sizeof(*chain), GFP_KERNEL); in tcf_chain_create()
477 if (!chain) in tcf_chain_create()
479 list_add_tail_rcu(&chain->list, &block->chain_list); in tcf_chain_create()
480 mutex_init(&chain->filter_chain_lock); in tcf_chain_create()
481 chain->block = block; in tcf_chain_create()
482 chain->index = chain_index; in tcf_chain_create()
483 chain->refcnt = 1; in tcf_chain_create()
484 if (!chain->index) in tcf_chain_create()
485 block->chain0.chain = chain; in tcf_chain_create()
486 return chain; in tcf_chain_create()
496 static void tcf_chain0_head_change(struct tcf_chain *chain, in tcf_chain0_head_change() argument
500 struct tcf_block *block = chain->block; in tcf_chain0_head_change()
502 if (chain->index) in tcf_chain0_head_change()
513 static bool tcf_chain_detach(struct tcf_chain *chain) in tcf_chain_detach() argument
515 struct tcf_block *block = chain->block; in tcf_chain_detach()
519 list_del_rcu(&chain->list); in tcf_chain_detach()
520 if (!chain->index) in tcf_chain_detach()
521 block->chain0.chain = NULL; in tcf_chain_detach()
538 static void tcf_chain_destroy(struct tcf_chain *chain, bool free_block) in tcf_chain_destroy() argument
540 struct tcf_block *block = chain->block; in tcf_chain_destroy()
542 mutex_destroy(&chain->filter_chain_lock); in tcf_chain_destroy()
543 kfree_rcu(chain, rcu); in tcf_chain_destroy()
548 static void tcf_chain_hold(struct tcf_chain *chain) in tcf_chain_hold() argument
550 ASSERT_BLOCK_LOCKED(chain->block); in tcf_chain_hold()
552 ++chain->refcnt; in tcf_chain_hold()
555 static bool tcf_chain_held_by_acts_only(struct tcf_chain *chain) in tcf_chain_held_by_acts_only() argument
557 ASSERT_BLOCK_LOCKED(chain->block); in tcf_chain_held_by_acts_only()
560 * chain should not be shown to the user. in tcf_chain_held_by_acts_only()
562 return chain->refcnt == chain->action_refcnt; in tcf_chain_held_by_acts_only()
568 struct tcf_chain *chain; in tcf_chain_lookup() local
572 list_for_each_entry(chain, &block->chain_list, list) { in tcf_chain_lookup()
573 if (chain->index == chain_index) in tcf_chain_lookup()
574 return chain; in tcf_chain_lookup()
583 struct tcf_chain *chain; in tcf_chain_lookup_rcu() local
585 list_for_each_entry_rcu(chain, &block->chain_list, list) { in tcf_chain_lookup_rcu()
586 if (chain->index == chain_index) in tcf_chain_lookup_rcu()
587 return chain; in tcf_chain_lookup_rcu()
593 static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
601 struct tcf_chain *chain = NULL; in __tcf_chain_get() local
605 chain = tcf_chain_lookup(block, chain_index); in __tcf_chain_get()
606 if (chain) { in __tcf_chain_get()
607 tcf_chain_hold(chain); in __tcf_chain_get()
611 chain = tcf_chain_create(block, chain_index); in __tcf_chain_get()
612 if (!chain) in __tcf_chain_get()
617 ++chain->action_refcnt; in __tcf_chain_get()
618 is_first_reference = chain->refcnt - chain->action_refcnt == 1; in __tcf_chain_get()
622 * non-action reference. Until then, the chain acts only as in __tcf_chain_get()
627 tc_chain_notify(chain, NULL, 0, NLM_F_CREATE | NLM_F_EXCL, in __tcf_chain_get()
630 return chain; in __tcf_chain_get()
634 return chain; in __tcf_chain_get()
656 static void __tcf_chain_put(struct tcf_chain *chain, bool by_act, in __tcf_chain_put() argument
659 struct tcf_block *block = chain->block; in __tcf_chain_put()
667 if (!chain->explicitly_created) { in __tcf_chain_put()
671 chain->explicitly_created = false; in __tcf_chain_put()
675 chain->action_refcnt--; in __tcf_chain_put()
678 * However, when block is unlocked chain can be changed concurrently, so in __tcf_chain_put()
681 refcnt = --chain->refcnt; in __tcf_chain_put()
682 non_act_refcnt = refcnt - chain->action_refcnt; in __tcf_chain_put()
683 tmplt_ops = chain->tmplt_ops; in __tcf_chain_put()
684 tmplt_priv = chain->tmplt_priv; in __tcf_chain_put()
686 if (non_act_refcnt == chain->explicitly_created && !by_act) { in __tcf_chain_put()
689 chain->index, block, NULL, 0, 0); in __tcf_chain_put()
690 /* Last reference to chain, no need to lock. */ in __tcf_chain_put()
691 chain->flushing = false; in __tcf_chain_put()
695 free_block = tcf_chain_detach(chain); in __tcf_chain_put()
700 tcf_chain_destroy(chain, free_block); in __tcf_chain_put()
704 static void tcf_chain_put(struct tcf_chain *chain) in tcf_chain_put() argument
706 __tcf_chain_put(chain, false, false); in tcf_chain_put()
709 void tcf_chain_put_by_act(struct tcf_chain *chain) in tcf_chain_put_by_act() argument
711 __tcf_chain_put(chain, true, false); in tcf_chain_put_by_act()
715 static void tcf_chain_put_explicitly_created(struct tcf_chain *chain) in tcf_chain_put_explicitly_created() argument
717 __tcf_chain_put(chain, false, true); in tcf_chain_put_explicitly_created()
720 static void tcf_chain_flush(struct tcf_chain *chain, bool rtnl_held) in tcf_chain_flush() argument
724 mutex_lock(&chain->filter_chain_lock); in tcf_chain_flush()
725 tp = tcf_chain_dereference(chain->filter_chain, chain); in tcf_chain_flush()
728 tcf_proto_signal_destroying(chain, tp); in tcf_chain_flush()
731 tp = tcf_chain_dereference(chain->filter_chain, chain); in tcf_chain_flush()
732 RCU_INIT_POINTER(chain->filter_chain, NULL); in tcf_chain_flush()
733 tcf_chain0_head_change(chain, NULL); in tcf_chain_flush()
734 chain->flushing = true; in tcf_chain_flush()
735 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_flush()
901 chain0 = block->chain0.chain; in tcf_chain0_head_change_cb_add()
939 if (block->chain0.chain) in tcf_chain0_head_change_cb_del()
1036 __tcf_get_next_chain(struct tcf_block *block, struct tcf_chain *chain) in __tcf_get_next_chain() argument
1039 if (chain) in __tcf_get_next_chain()
1040 chain = list_is_last(&chain->list, &block->chain_list) ? in __tcf_get_next_chain()
1041 NULL : list_next_entry(chain, list); in __tcf_get_next_chain()
1043 chain = list_first_entry_or_null(&block->chain_list, in __tcf_get_next_chain()
1047 while (chain && tcf_chain_held_by_acts_only(chain)) in __tcf_get_next_chain()
1048 chain = list_is_last(&chain->list, &block->chain_list) ? in __tcf_get_next_chain()
1049 NULL : list_next_entry(chain, list); in __tcf_get_next_chain()
1051 if (chain) in __tcf_get_next_chain()
1052 tcf_chain_hold(chain); in __tcf_get_next_chain()
1055 return chain; in __tcf_get_next_chain()
1059 * block. It properly obtains block->lock and takes reference to chain before
1060 * returning it. Users of this function must be tolerant to concurrent chain
1061 * insertion/deletion or ensure that no concurrent chain modification is
1068 tcf_get_next_chain(struct tcf_block *block, struct tcf_chain *chain) in tcf_get_next_chain() argument
1070 struct tcf_chain *chain_next = __tcf_get_next_chain(block, chain); in tcf_get_next_chain()
1072 if (chain) in tcf_get_next_chain()
1073 tcf_chain_put(chain); in tcf_get_next_chain()
1080 __tcf_get_next_proto(struct tcf_chain *chain, struct tcf_proto *tp) in __tcf_get_next_proto() argument
1085 mutex_lock(&chain->filter_chain_lock); in __tcf_get_next_proto()
1088 tp = tcf_chain_dereference(chain->filter_chain, chain); in __tcf_get_next_proto()
1090 /* 'deleting' flag is set and chain->filter_chain_lock was in __tcf_get_next_proto()
1095 tp = tcf_chain_dereference(chain->filter_chain, chain); in __tcf_get_next_proto()
1097 for (; tp; tp = tcf_chain_dereference(tp->next, chain)) in __tcf_get_next_proto()
1101 tp = tcf_chain_dereference(tp->next, chain); in __tcf_get_next_proto()
1107 mutex_unlock(&chain->filter_chain_lock); in __tcf_get_next_proto()
1113 * chain. Users of this function must be tolerant to concurrent tp
1114 * insertion/deletion or ensure that no concurrent chain modification is
1121 tcf_get_next_proto(struct tcf_chain *chain, struct tcf_proto *tp) in tcf_get_next_proto() argument
1123 struct tcf_proto *tp_next = __tcf_get_next_proto(chain, tp); in tcf_get_next_proto()
1134 struct tcf_chain *chain; in tcf_block_flush_all_chains() local
1139 for (chain = tcf_get_next_chain(block, NULL); in tcf_block_flush_all_chains()
1140 chain; in tcf_block_flush_all_chains()
1141 chain = tcf_get_next_chain(block, chain)) { in tcf_block_flush_all_chains()
1142 tcf_chain_put_explicitly_created(chain); in tcf_block_flush_all_chains()
1143 tcf_chain_flush(chain, rtnl_held); in tcf_block_flush_all_chains()
1288 * deallocated when last chain is freed. However, if chain_list in __tcf_block_put()
1517 /* XXX: Standalone actions are not allowed to jump to any chain, and bound
1552 struct tcf_chain *chain, *chain_prev; in tcf_block_playback_offloads() local
1558 for (chain = __tcf_get_next_chain(block, NULL); in tcf_block_playback_offloads()
1559 chain; in tcf_block_playback_offloads()
1560 chain_prev = chain, in tcf_block_playback_offloads()
1561 chain = __tcf_get_next_chain(block, chain), in tcf_block_playback_offloads()
1563 if (chain->tmplt_ops && add) in tcf_block_playback_offloads()
1564 chain->tmplt_ops->tmplt_reoffload(chain, true, cb, in tcf_block_playback_offloads()
1566 for (tp = __tcf_get_next_proto(chain, NULL); tp; in tcf_block_playback_offloads()
1568 tp = __tcf_get_next_proto(chain, tp), in tcf_block_playback_offloads()
1581 if (chain->tmplt_ops && !add) in tcf_block_playback_offloads()
1582 chain->tmplt_ops->tmplt_reoffload(chain, false, cb, in tcf_block_playback_offloads()
1590 tcf_chain_put(chain); in tcf_block_playback_offloads()
1678 /* Main classifier routine: scans classifier chain attached
1708 /* We re-lookup the tp and chain based on index instead in __tcf_classify()
1710 * check if any of tp,chain,exts was replaced by the in __tcf_classify()
1713 if (unlikely(n->tp != tp || n->tp->chain != n->chain || in __tcf_classify()
1739 *last_executed_chain = first_tp->chain->index; in __tcf_classify()
1762 tp->chain->block->index, in __tcf_classify()
1786 u32 last_executed_chain = tp ? tp->chain->index : 0; in tcf_classify()
1796 if (ext && (ext->chain || ext->act_miss)) { in tcf_classify()
1798 u32 chain; in tcf_classify()
1809 chain = n->chain_index; in tcf_classify()
1811 chain = ext->chain; in tcf_classify()
1814 fchain = tcf_chain_lookup_rcu(block, chain); in tcf_classify()
1834 /* If we missed on some chain */ in tcf_classify()
1843 ext->chain = last_executed_chain; in tcf_classify()
1862 static struct tcf_proto *tcf_chain_tp_prev(struct tcf_chain *chain, in tcf_chain_tp_prev() argument
1865 return tcf_chain_dereference(*chain_info->pprev, chain); in tcf_chain_tp_prev()
1868 static int tcf_chain_tp_insert(struct tcf_chain *chain, in tcf_chain_tp_insert() argument
1872 if (chain->flushing) in tcf_chain_tp_insert()
1875 RCU_INIT_POINTER(tp->next, tcf_chain_tp_prev(chain, chain_info)); in tcf_chain_tp_insert()
1876 if (*chain_info->pprev == chain->filter_chain) in tcf_chain_tp_insert()
1877 tcf_chain0_head_change(chain, tp); in tcf_chain_tp_insert()
1884 static void tcf_chain_tp_remove(struct tcf_chain *chain, in tcf_chain_tp_remove() argument
1888 struct tcf_proto *next = tcf_chain_dereference(chain_info->next, chain); in tcf_chain_tp_remove()
1891 if (tp == chain->filter_chain) in tcf_chain_tp_remove()
1892 tcf_chain0_head_change(chain, next); in tcf_chain_tp_remove()
1896 static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
1906 static struct tcf_proto *tcf_chain_tp_insert_unique(struct tcf_chain *chain, in tcf_chain_tp_insert_unique() argument
1915 mutex_lock(&chain->filter_chain_lock); in tcf_chain_tp_insert_unique()
1917 if (tcf_proto_exists_destroying(chain, tp_new)) { in tcf_chain_tp_insert_unique()
1918 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_insert_unique()
1923 tp = tcf_chain_tp_find(chain, &chain_info, in tcf_chain_tp_insert_unique()
1926 err = tcf_chain_tp_insert(chain, &chain_info, tp_new); in tcf_chain_tp_insert_unique()
1927 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_insert_unique()
1940 static void tcf_chain_tp_delete_empty(struct tcf_chain *chain, in tcf_chain_tp_delete_empty() argument
1949 mutex_lock(&chain->filter_chain_lock); in tcf_chain_tp_delete_empty()
1951 /* Atomically find and remove tp from chain. */ in tcf_chain_tp_delete_empty()
1952 for (pprev = &chain->filter_chain; in tcf_chain_tp_delete_empty()
1953 (tp_iter = tcf_chain_dereference(*pprev, chain)); in tcf_chain_tp_delete_empty()
1967 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_delete_empty()
1971 tcf_proto_signal_destroying(chain, tp); in tcf_chain_tp_delete_empty()
1972 next = tcf_chain_dereference(chain_info.next, chain); in tcf_chain_tp_delete_empty()
1973 if (tp == chain->filter_chain) in tcf_chain_tp_delete_empty()
1974 tcf_chain0_head_change(chain, next); in tcf_chain_tp_delete_empty()
1976 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_delete_empty()
1981 static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain, in tcf_chain_tp_find() argument
1989 /* Check the chain for existence of proto-tcf with this priority */ in tcf_chain_tp_find()
1990 for (pprev = &chain->filter_chain; in tcf_chain_tp_find()
1991 (tp = tcf_chain_dereference(*pprev, chain)); in tcf_chain_tp_find()
2042 if (nla_put_u32(skb, TCA_CHAIN, tp->chain->index)) in tcf_fill_node()
2149 struct tcf_chain *chain, int event, in tfilter_notify_chain() argument
2154 for (tp = tcf_get_next_proto(chain, NULL); in tfilter_notify_chain()
2155 tp; tp = tcf_get_next_proto(chain, tp)) in tfilter_notify_chain()
2185 struct tcf_chain *chain; in tc_new_tfilter() local
2212 chain = NULL; in tc_new_tfilter()
2228 /* Find head of filter chain. */ in tc_new_tfilter()
2265 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_new_tfilter()
2269 chain = tcf_chain_get(block, chain_index, true); in tc_new_tfilter()
2270 if (!chain) { in tc_new_tfilter()
2271 NL_SET_ERR_MSG(extack, "Cannot create specified filter chain"); in tc_new_tfilter()
2276 mutex_lock(&chain->filter_chain_lock); in tc_new_tfilter()
2277 tp = tcf_chain_tp_find(chain, &chain_info, protocol, in tc_new_tfilter()
2288 if (chain->flushing) { in tc_new_tfilter()
2308 prio = tcf_auto_prio(tcf_chain_tp_prev(chain, in tc_new_tfilter()
2311 mutex_unlock(&chain->filter_chain_lock); in tc_new_tfilter()
2312 tp_new = tcf_proto_create(name, protocol, prio, chain, in tc_new_tfilter()
2320 tp = tcf_chain_tp_insert_unique(chain, tp_new, protocol, prio, in tc_new_tfilter()
2327 mutex_unlock(&chain->filter_chain_lock); in tc_new_tfilter()
2351 if (chain->tmplt_ops && chain->tmplt_ops != tp->ops) { in tc_new_tfilter()
2353 NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind"); in tc_new_tfilter()
2377 tcf_chain_tp_delete_empty(chain, tp, rtnl_held, NULL); in tc_new_tfilter()
2379 if (chain) { in tc_new_tfilter()
2383 tcf_chain_put(chain); in tc_new_tfilter()
2392 * of target chain. in tc_new_tfilter()
2401 mutex_unlock(&chain->filter_chain_lock); in tc_new_tfilter()
2418 struct tcf_chain *chain = NULL; in tc_del_tfilter() local
2441 /* Find head of filter chain. */ in tc_del_tfilter()
2452 /* Take rtnl mutex if flushing whole chain, block is shared (no qdisc in tc_del_tfilter()
2476 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_del_tfilter()
2480 chain = tcf_chain_get(block, chain_index, false); in tc_del_tfilter()
2481 if (!chain) { in tc_del_tfilter()
2482 /* User requested flush on non-existent chain. Nothing to do, in tc_del_tfilter()
2489 NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); in tc_del_tfilter()
2496 chain, RTM_DELTFILTER, extack); in tc_del_tfilter()
2497 tcf_chain_flush(chain, rtnl_held); in tc_del_tfilter()
2502 mutex_lock(&chain->filter_chain_lock); in tc_del_tfilter()
2503 tp = tcf_chain_tp_find(chain, &chain_info, protocol, in tc_del_tfilter()
2514 tcf_proto_signal_destroying(chain, tp); in tc_del_tfilter()
2515 tcf_chain_tp_remove(chain, &chain_info, tp); in tc_del_tfilter()
2516 mutex_unlock(&chain->filter_chain_lock); in tc_del_tfilter()
2524 mutex_unlock(&chain->filter_chain_lock); in tc_del_tfilter()
2540 tcf_chain_tp_delete_empty(chain, tp, rtnl_held, extack); in tc_del_tfilter()
2544 if (chain) { in tc_del_tfilter()
2547 tcf_chain_put(chain); in tc_del_tfilter()
2557 mutex_unlock(&chain->filter_chain_lock); in tc_del_tfilter()
2574 struct tcf_chain *chain = NULL; in tc_get_tfilter() local
2597 /* Find head of filter chain. */ in tc_get_tfilter()
2631 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_get_tfilter()
2635 chain = tcf_chain_get(block, chain_index, false); in tc_get_tfilter()
2636 if (!chain) { in tc_get_tfilter()
2637 NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); in tc_get_tfilter()
2642 mutex_lock(&chain->filter_chain_lock); in tc_get_tfilter()
2643 tp = tcf_chain_tp_find(chain, &chain_info, protocol, in tc_get_tfilter()
2645 mutex_unlock(&chain->filter_chain_lock); in tc_get_tfilter()
2670 if (chain) { in tc_get_tfilter()
2673 tcf_chain_put(chain); in tc_get_tfilter()
2704 static bool tcf_chain_dump(struct tcf_chain *chain, struct Qdisc *q, u32 parent, in tcf_chain_dump() argument
2709 struct tcf_block *block = chain->block; in tcf_chain_dump()
2714 for (tp = __tcf_get_next_proto(chain, NULL); in tcf_chain_dump()
2717 tp = __tcf_get_next_proto(chain, tp), in tcf_chain_dump()
2773 struct tcf_chain *chain, *chain_prev; in tc_dump_tfilter() local
2848 for (chain = __tcf_get_next_chain(block, NULL); in tc_dump_tfilter()
2849 chain; in tc_dump_tfilter()
2850 chain_prev = chain, in tc_dump_tfilter()
2851 chain = __tcf_get_next_chain(block, chain), in tc_dump_tfilter()
2854 nla_get_u32(tca[TCA_CHAIN]) != chain->index) in tc_dump_tfilter()
2856 if (!tcf_chain_dump(chain, q, parent, skb, cb, in tc_dump_tfilter()
2858 tcf_chain_put(chain); in tc_dump_tfilter()
2931 static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb, in tc_chain_notify() argument
2936 struct tcf_block *block = chain->block; in tc_chain_notify()
2948 if (tc_chain_fill_node(chain->tmplt_ops, chain->tmplt_priv, in tc_chain_notify()
2949 chain->index, net, skb, block, portid, in tc_chain_notify()
2989 static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net, in tc_chain_tmplt_add() argument
3002 NL_SET_ERR_MSG(extack, "Specified TC chain template name too long"); in tc_chain_tmplt_add()
3011 NL_SET_ERR_MSG(extack, "Chain templates are not supported with specified classifier"); in tc_chain_tmplt_add()
3016 tmplt_priv = ops->tmplt_create(net, chain, tca, extack); in tc_chain_tmplt_add()
3021 chain->tmplt_ops = ops; in tc_chain_tmplt_add()
3022 chain->tmplt_priv = tmplt_priv; in tc_chain_tmplt_add()
3037 /* Add/delete/get a chain */
3048 struct tcf_chain *chain; in tc_ctl_chain() local
3071 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_ctl_chain()
3077 chain = tcf_chain_lookup(block, chain_index); in tc_ctl_chain()
3079 if (chain) { in tc_ctl_chain()
3080 if (tcf_chain_held_by_acts_only(chain)) { in tc_ctl_chain()
3081 /* The chain exists only because there is in tc_ctl_chain()
3084 tcf_chain_hold(chain); in tc_ctl_chain()
3086 NL_SET_ERR_MSG(extack, "Filter chain already exists"); in tc_ctl_chain()
3092 NL_SET_ERR_MSG(extack, "Need both RTM_NEWCHAIN and NLM_F_CREATE to create a new chain"); in tc_ctl_chain()
3096 chain = tcf_chain_create(block, chain_index); in tc_ctl_chain()
3097 if (!chain) { in tc_ctl_chain()
3098 NL_SET_ERR_MSG(extack, "Failed to create filter chain"); in tc_ctl_chain()
3104 if (!chain || tcf_chain_held_by_acts_only(chain)) { in tc_ctl_chain()
3105 NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); in tc_ctl_chain()
3109 tcf_chain_hold(chain); in tc_ctl_chain()
3113 /* Modifying chain requires holding parent block lock. In case in tc_ctl_chain()
3114 * the chain was successfully added, take a reference to the in tc_ctl_chain()
3115 * chain. This ensures that an empty chain does not disappear at in tc_ctl_chain()
3118 tcf_chain_hold(chain); in tc_ctl_chain()
3119 chain->explicitly_created = true; in tc_ctl_chain()
3125 err = tc_chain_tmplt_add(chain, net, tca, extack); in tc_ctl_chain()
3127 tcf_chain_put_explicitly_created(chain); in tc_ctl_chain()
3131 tc_chain_notify(chain, NULL, 0, NLM_F_CREATE | NLM_F_EXCL, in tc_ctl_chain()
3136 chain, RTM_DELTFILTER, extack); in tc_ctl_chain()
3137 /* Flush the chain first as the user requested chain removal. */ in tc_ctl_chain()
3138 tcf_chain_flush(chain, true); in tc_ctl_chain()
3139 /* In case the chain was successfully deleted, put a reference in tc_ctl_chain()
3140 * to the chain previously taken during addition. in tc_ctl_chain()
3142 tcf_chain_put_explicitly_created(chain); in tc_ctl_chain()
3145 err = tc_chain_notify(chain, skb, n->nlmsg_seq, in tc_ctl_chain()
3148 NL_SET_ERR_MSG(extack, "Failed to send chain notify message"); in tc_ctl_chain()
3157 tcf_chain_put(chain); in tc_ctl_chain()
3178 struct tcf_chain *chain; in tc_dump_chain() local
3232 list_for_each_entry(chain, &block->chain_list, list) { in tc_dump_chain()
3234 nla_get_u32(tca[TCA_CHAIN]) != chain->index)) in tc_dump_chain()
3240 if (tcf_chain_held_by_acts_only(chain)) in tc_dump_chain()
3242 err = tc_chain_fill_node(chain->tmplt_ops, chain->tmplt_priv, in tc_dump_chain()
3243 chain->index, net, skb, block, in tc_dump_chain()