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()
537 static void tcf_chain_destroy(struct tcf_chain *chain, bool free_block) in tcf_chain_destroy() argument
539 struct tcf_block *block = chain->block; in tcf_chain_destroy()
541 mutex_destroy(&chain->filter_chain_lock); in tcf_chain_destroy()
542 kfree_rcu(chain, rcu); in tcf_chain_destroy()
547 static void tcf_chain_hold(struct tcf_chain *chain) in tcf_chain_hold() argument
549 ASSERT_BLOCK_LOCKED(chain->block); in tcf_chain_hold()
551 ++chain->refcnt; in tcf_chain_hold()
554 static bool tcf_chain_held_by_acts_only(struct tcf_chain *chain) in tcf_chain_held_by_acts_only() argument
556 ASSERT_BLOCK_LOCKED(chain->block); in tcf_chain_held_by_acts_only()
559 * chain should not be shown to the user. in tcf_chain_held_by_acts_only()
561 return chain->refcnt == chain->action_refcnt; in tcf_chain_held_by_acts_only()
567 struct tcf_chain *chain; in tcf_chain_lookup() local
571 list_for_each_entry(chain, &block->chain_list, list) { in tcf_chain_lookup()
572 if (chain->index == chain_index) in tcf_chain_lookup()
573 return chain; in tcf_chain_lookup()
582 struct tcf_chain *chain; in tcf_chain_lookup_rcu() local
584 list_for_each_entry_rcu(chain, &block->chain_list, list) { in tcf_chain_lookup_rcu()
585 if (chain->index == chain_index) in tcf_chain_lookup_rcu()
586 return chain; in tcf_chain_lookup_rcu()
592 static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
600 struct tcf_chain *chain = NULL; in __tcf_chain_get() local
604 chain = tcf_chain_lookup(block, chain_index); in __tcf_chain_get()
605 if (chain) { in __tcf_chain_get()
606 tcf_chain_hold(chain); in __tcf_chain_get()
610 chain = tcf_chain_create(block, chain_index); in __tcf_chain_get()
611 if (!chain) in __tcf_chain_get()
616 ++chain->action_refcnt; in __tcf_chain_get()
617 is_first_reference = chain->refcnt - chain->action_refcnt == 1; in __tcf_chain_get()
621 * non-action reference. Until then, the chain acts only as in __tcf_chain_get()
626 tc_chain_notify(chain, NULL, 0, NLM_F_CREATE | NLM_F_EXCL, in __tcf_chain_get()
629 return chain; in __tcf_chain_get()
633 return chain; in __tcf_chain_get()
655 static void __tcf_chain_put(struct tcf_chain *chain, bool by_act, in __tcf_chain_put() argument
658 struct tcf_block *block = chain->block; in __tcf_chain_put()
666 if (!chain->explicitly_created) { in __tcf_chain_put()
670 chain->explicitly_created = false; in __tcf_chain_put()
674 chain->action_refcnt--; in __tcf_chain_put()
677 * However, when block is unlocked chain can be changed concurrently, so in __tcf_chain_put()
680 refcnt = --chain->refcnt; in __tcf_chain_put()
681 non_act_refcnt = refcnt - chain->action_refcnt; in __tcf_chain_put()
682 tmplt_ops = chain->tmplt_ops; in __tcf_chain_put()
683 tmplt_priv = chain->tmplt_priv; in __tcf_chain_put()
685 if (non_act_refcnt == chain->explicitly_created && !by_act) { in __tcf_chain_put()
688 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()
1034 __tcf_get_next_chain(struct tcf_block *block, struct tcf_chain *chain) in __tcf_get_next_chain() argument
1037 if (chain) in __tcf_get_next_chain()
1038 chain = list_is_last(&chain->list, &block->chain_list) ? in __tcf_get_next_chain()
1039 NULL : list_next_entry(chain, list); in __tcf_get_next_chain()
1041 chain = list_first_entry_or_null(&block->chain_list, in __tcf_get_next_chain()
1045 while (chain && tcf_chain_held_by_acts_only(chain)) in __tcf_get_next_chain()
1046 chain = list_is_last(&chain->list, &block->chain_list) ? in __tcf_get_next_chain()
1047 NULL : list_next_entry(chain, list); in __tcf_get_next_chain()
1049 if (chain) in __tcf_get_next_chain()
1050 tcf_chain_hold(chain); in __tcf_get_next_chain()
1053 return chain; in __tcf_get_next_chain()
1057 * block. It properly obtains block->lock and takes reference to chain before
1058 * returning it. Users of this function must be tolerant to concurrent chain
1059 * insertion/deletion or ensure that no concurrent chain modification is
1066 tcf_get_next_chain(struct tcf_block *block, struct tcf_chain *chain) in tcf_get_next_chain() argument
1068 struct tcf_chain *chain_next = __tcf_get_next_chain(block, chain); in tcf_get_next_chain()
1070 if (chain) in tcf_get_next_chain()
1071 tcf_chain_put(chain); in tcf_get_next_chain()
1078 __tcf_get_next_proto(struct tcf_chain *chain, struct tcf_proto *tp) in __tcf_get_next_proto() argument
1083 mutex_lock(&chain->filter_chain_lock); in __tcf_get_next_proto()
1086 tp = tcf_chain_dereference(chain->filter_chain, chain); in __tcf_get_next_proto()
1088 /* 'deleting' flag is set and chain->filter_chain_lock was in __tcf_get_next_proto()
1093 tp = tcf_chain_dereference(chain->filter_chain, chain); in __tcf_get_next_proto()
1095 for (; tp; tp = tcf_chain_dereference(tp->next, chain)) in __tcf_get_next_proto()
1099 tp = tcf_chain_dereference(tp->next, chain); in __tcf_get_next_proto()
1105 mutex_unlock(&chain->filter_chain_lock); in __tcf_get_next_proto()
1111 * chain. Users of this function must be tolerant to concurrent tp
1112 * insertion/deletion or ensure that no concurrent chain modification is
1119 tcf_get_next_proto(struct tcf_chain *chain, struct tcf_proto *tp) in tcf_get_next_proto() argument
1121 struct tcf_proto *tp_next = __tcf_get_next_proto(chain, tp); in tcf_get_next_proto()
1132 struct tcf_chain *chain; in tcf_block_flush_all_chains() local
1137 for (chain = tcf_get_next_chain(block, NULL); in tcf_block_flush_all_chains()
1138 chain; in tcf_block_flush_all_chains()
1139 chain = tcf_get_next_chain(block, chain)) { in tcf_block_flush_all_chains()
1140 tcf_chain_put_explicitly_created(chain); in tcf_block_flush_all_chains()
1141 tcf_chain_flush(chain, rtnl_held); in tcf_block_flush_all_chains()
1286 * deallocated when last chain is freed. However, if chain_list in __tcf_block_put()
1497 /* XXX: Standalone actions are not allowed to jump to any chain, and bound
1528 struct tcf_chain *chain, *chain_prev; in tcf_block_playback_offloads() local
1534 for (chain = __tcf_get_next_chain(block, NULL); in tcf_block_playback_offloads()
1535 chain; in tcf_block_playback_offloads()
1536 chain_prev = chain, in tcf_block_playback_offloads()
1537 chain = __tcf_get_next_chain(block, chain), in tcf_block_playback_offloads()
1539 for (tp = __tcf_get_next_proto(chain, NULL); tp; in tcf_block_playback_offloads()
1541 tp = __tcf_get_next_proto(chain, tp), in tcf_block_playback_offloads()
1560 tcf_chain_put(chain); in tcf_block_playback_offloads()
1648 /* Main classifier routine: scans classifier chain attached
1678 /* We re-lookup the tp and chain based on index instead in __tcf_classify()
1680 * check if any of tp,chain,exts was replaced by the in __tcf_classify()
1683 if (unlikely(n->tp != tp || n->tp->chain != n->chain || in __tcf_classify()
1703 *last_executed_chain = first_tp->chain->index; in __tcf_classify()
1723 tp->chain->block->index, in __tcf_classify()
1745 u32 last_executed_chain = tp ? tp->chain->index : 0; in tcf_classify()
1755 if (ext && (ext->chain || ext->act_miss)) { in tcf_classify()
1757 u32 chain; in tcf_classify()
1765 chain = n->chain_index; in tcf_classify()
1767 chain = ext->chain; in tcf_classify()
1770 fchain = tcf_chain_lookup_rcu(block, chain); in tcf_classify()
1786 /* If we missed on some chain */ in tcf_classify()
1793 ext->chain = last_executed_chain; in tcf_classify()
1812 static struct tcf_proto *tcf_chain_tp_prev(struct tcf_chain *chain, in tcf_chain_tp_prev() argument
1815 return tcf_chain_dereference(*chain_info->pprev, chain); in tcf_chain_tp_prev()
1818 static int tcf_chain_tp_insert(struct tcf_chain *chain, in tcf_chain_tp_insert() argument
1822 if (chain->flushing) in tcf_chain_tp_insert()
1825 RCU_INIT_POINTER(tp->next, tcf_chain_tp_prev(chain, chain_info)); in tcf_chain_tp_insert()
1826 if (*chain_info->pprev == chain->filter_chain) in tcf_chain_tp_insert()
1827 tcf_chain0_head_change(chain, tp); in tcf_chain_tp_insert()
1834 static void tcf_chain_tp_remove(struct tcf_chain *chain, in tcf_chain_tp_remove() argument
1838 struct tcf_proto *next = tcf_chain_dereference(chain_info->next, chain); in tcf_chain_tp_remove()
1841 if (tp == chain->filter_chain) in tcf_chain_tp_remove()
1842 tcf_chain0_head_change(chain, next); in tcf_chain_tp_remove()
1846 static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
1856 static struct tcf_proto *tcf_chain_tp_insert_unique(struct tcf_chain *chain, in tcf_chain_tp_insert_unique() argument
1865 mutex_lock(&chain->filter_chain_lock); in tcf_chain_tp_insert_unique()
1867 if (tcf_proto_exists_destroying(chain, tp_new)) { in tcf_chain_tp_insert_unique()
1868 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_insert_unique()
1873 tp = tcf_chain_tp_find(chain, &chain_info, in tcf_chain_tp_insert_unique()
1876 err = tcf_chain_tp_insert(chain, &chain_info, tp_new); in tcf_chain_tp_insert_unique()
1877 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_insert_unique()
1890 static void tcf_chain_tp_delete_empty(struct tcf_chain *chain, in tcf_chain_tp_delete_empty() argument
1899 mutex_lock(&chain->filter_chain_lock); in tcf_chain_tp_delete_empty()
1901 /* Atomically find and remove tp from chain. */ in tcf_chain_tp_delete_empty()
1902 for (pprev = &chain->filter_chain; in tcf_chain_tp_delete_empty()
1903 (tp_iter = tcf_chain_dereference(*pprev, chain)); in tcf_chain_tp_delete_empty()
1917 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_delete_empty()
1921 tcf_proto_signal_destroying(chain, tp); in tcf_chain_tp_delete_empty()
1922 next = tcf_chain_dereference(chain_info.next, chain); in tcf_chain_tp_delete_empty()
1923 if (tp == chain->filter_chain) in tcf_chain_tp_delete_empty()
1924 tcf_chain0_head_change(chain, next); in tcf_chain_tp_delete_empty()
1926 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_delete_empty()
1931 static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain, in tcf_chain_tp_find() argument
1939 /* Check the chain for existence of proto-tcf with this priority */ in tcf_chain_tp_find()
1940 for (pprev = &chain->filter_chain; in tcf_chain_tp_find()
1941 (tp = tcf_chain_dereference(*pprev, chain)); in tcf_chain_tp_find()
1992 if (nla_put_u32(skb, TCA_CHAIN, tp->chain->index)) in tcf_fill_node()
2096 struct tcf_chain *chain, int event, in tfilter_notify_chain() argument
2101 for (tp = tcf_get_next_proto(chain, NULL); in tfilter_notify_chain()
2102 tp; tp = tcf_get_next_proto(chain, tp)) in tfilter_notify_chain()
2132 struct tcf_chain *chain; in tc_new_tfilter() local
2159 chain = NULL; in tc_new_tfilter()
2175 /* Find head of filter chain. */ in tc_new_tfilter()
2212 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_new_tfilter()
2216 chain = tcf_chain_get(block, chain_index, true); in tc_new_tfilter()
2217 if (!chain) { in tc_new_tfilter()
2218 NL_SET_ERR_MSG(extack, "Cannot create specified filter chain"); in tc_new_tfilter()
2223 mutex_lock(&chain->filter_chain_lock); in tc_new_tfilter()
2224 tp = tcf_chain_tp_find(chain, &chain_info, protocol, in tc_new_tfilter()
2235 if (chain->flushing) { in tc_new_tfilter()
2255 prio = tcf_auto_prio(tcf_chain_tp_prev(chain, in tc_new_tfilter()
2258 mutex_unlock(&chain->filter_chain_lock); in tc_new_tfilter()
2259 tp_new = tcf_proto_create(name, protocol, prio, chain, in tc_new_tfilter()
2267 tp = tcf_chain_tp_insert_unique(chain, tp_new, protocol, prio, in tc_new_tfilter()
2274 mutex_unlock(&chain->filter_chain_lock); in tc_new_tfilter()
2298 if (chain->tmplt_ops && chain->tmplt_ops != tp->ops) { in tc_new_tfilter()
2300 NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind"); in tc_new_tfilter()
2324 tcf_chain_tp_delete_empty(chain, tp, rtnl_held, NULL); in tc_new_tfilter()
2326 if (chain) { in tc_new_tfilter()
2330 tcf_chain_put(chain); in tc_new_tfilter()
2339 * of target chain. in tc_new_tfilter()
2348 mutex_unlock(&chain->filter_chain_lock); in tc_new_tfilter()
2365 struct tcf_chain *chain = NULL; in tc_del_tfilter() local
2388 /* Find head of filter chain. */ in tc_del_tfilter()
2399 /* Take rtnl mutex if flushing whole chain, block is shared (no qdisc in tc_del_tfilter()
2423 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_del_tfilter()
2427 chain = tcf_chain_get(block, chain_index, false); in tc_del_tfilter()
2428 if (!chain) { in tc_del_tfilter()
2429 /* User requested flush on non-existent chain. Nothing to do, in tc_del_tfilter()
2436 NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); in tc_del_tfilter()
2443 chain, RTM_DELTFILTER, extack); in tc_del_tfilter()
2444 tcf_chain_flush(chain, rtnl_held); in tc_del_tfilter()
2449 mutex_lock(&chain->filter_chain_lock); in tc_del_tfilter()
2450 tp = tcf_chain_tp_find(chain, &chain_info, protocol, in tc_del_tfilter()
2461 tcf_proto_signal_destroying(chain, tp); in tc_del_tfilter()
2462 tcf_chain_tp_remove(chain, &chain_info, tp); in tc_del_tfilter()
2463 mutex_unlock(&chain->filter_chain_lock); in tc_del_tfilter()
2471 mutex_unlock(&chain->filter_chain_lock); in tc_del_tfilter()
2488 tcf_chain_tp_delete_empty(chain, tp, rtnl_held, extack); in tc_del_tfilter()
2492 if (chain) { in tc_del_tfilter()
2495 tcf_chain_put(chain); in tc_del_tfilter()
2505 mutex_unlock(&chain->filter_chain_lock); in tc_del_tfilter()
2522 struct tcf_chain *chain = NULL; in tc_get_tfilter() local
2545 /* Find head of filter chain. */ in tc_get_tfilter()
2579 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_get_tfilter()
2583 chain = tcf_chain_get(block, chain_index, false); in tc_get_tfilter()
2584 if (!chain) { in tc_get_tfilter()
2585 NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); in tc_get_tfilter()
2590 mutex_lock(&chain->filter_chain_lock); in tc_get_tfilter()
2591 tp = tcf_chain_tp_find(chain, &chain_info, protocol, in tc_get_tfilter()
2593 mutex_unlock(&chain->filter_chain_lock); in tc_get_tfilter()
2618 if (chain) { in tc_get_tfilter()
2621 tcf_chain_put(chain); in tc_get_tfilter()
2652 static bool tcf_chain_dump(struct tcf_chain *chain, struct Qdisc *q, u32 parent, in tcf_chain_dump() argument
2657 struct tcf_block *block = chain->block; in tcf_chain_dump()
2662 for (tp = __tcf_get_next_proto(chain, NULL); in tcf_chain_dump()
2665 tp = __tcf_get_next_proto(chain, tp), in tcf_chain_dump()
2720 struct tcf_chain *chain, *chain_prev; in tc_dump_tfilter() local
2795 for (chain = __tcf_get_next_chain(block, NULL); in tc_dump_tfilter()
2796 chain; in tc_dump_tfilter()
2797 chain_prev = chain, in tc_dump_tfilter()
2798 chain = __tcf_get_next_chain(block, chain), in tc_dump_tfilter()
2801 nla_get_u32(tca[TCA_CHAIN]) != chain->index) in tc_dump_tfilter()
2803 if (!tcf_chain_dump(chain, q, parent, skb, cb, in tc_dump_tfilter()
2805 tcf_chain_put(chain); in tc_dump_tfilter()
2878 static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb, in tc_chain_notify() argument
2883 struct tcf_block *block = chain->block; in tc_chain_notify()
2892 if (tc_chain_fill_node(chain->tmplt_ops, chain->tmplt_priv, in tc_chain_notify()
2893 chain->index, net, skb, block, portid, in tc_chain_notify()
2933 static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net, in tc_chain_tmplt_add() argument
2946 NL_SET_ERR_MSG(extack, "Specified TC chain template name too long"); in tc_chain_tmplt_add()
2954 NL_SET_ERR_MSG(extack, "Chain templates are not supported with specified classifier"); in tc_chain_tmplt_add()
2959 tmplt_priv = ops->tmplt_create(net, chain, tca, extack); in tc_chain_tmplt_add()
2964 chain->tmplt_ops = ops; in tc_chain_tmplt_add()
2965 chain->tmplt_priv = tmplt_priv; in tc_chain_tmplt_add()
2980 /* Add/delete/get a chain */
2991 struct tcf_chain *chain; in tc_ctl_chain() local
3014 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_ctl_chain()
3020 chain = tcf_chain_lookup(block, chain_index); in tc_ctl_chain()
3022 if (chain) { in tc_ctl_chain()
3023 if (tcf_chain_held_by_acts_only(chain)) { in tc_ctl_chain()
3024 /* The chain exists only because there is in tc_ctl_chain()
3027 tcf_chain_hold(chain); in tc_ctl_chain()
3029 NL_SET_ERR_MSG(extack, "Filter chain already exists"); in tc_ctl_chain()
3035 NL_SET_ERR_MSG(extack, "Need both RTM_NEWCHAIN and NLM_F_CREATE to create a new chain"); in tc_ctl_chain()
3039 chain = tcf_chain_create(block, chain_index); in tc_ctl_chain()
3040 if (!chain) { in tc_ctl_chain()
3041 NL_SET_ERR_MSG(extack, "Failed to create filter chain"); in tc_ctl_chain()
3047 if (!chain || tcf_chain_held_by_acts_only(chain)) { in tc_ctl_chain()
3048 NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); in tc_ctl_chain()
3052 tcf_chain_hold(chain); in tc_ctl_chain()
3056 /* Modifying chain requires holding parent block lock. In case in tc_ctl_chain()
3057 * the chain was successfully added, take a reference to the in tc_ctl_chain()
3058 * chain. This ensures that an empty chain does not disappear at in tc_ctl_chain()
3061 tcf_chain_hold(chain); in tc_ctl_chain()
3062 chain->explicitly_created = true; in tc_ctl_chain()
3068 err = tc_chain_tmplt_add(chain, net, tca, extack); in tc_ctl_chain()
3070 tcf_chain_put_explicitly_created(chain); in tc_ctl_chain()
3074 tc_chain_notify(chain, NULL, 0, NLM_F_CREATE | NLM_F_EXCL, in tc_ctl_chain()
3079 chain, RTM_DELTFILTER, extack); in tc_ctl_chain()
3080 /* Flush the chain first as the user requested chain removal. */ in tc_ctl_chain()
3081 tcf_chain_flush(chain, true); in tc_ctl_chain()
3082 /* In case the chain was successfully deleted, put a reference in tc_ctl_chain()
3083 * to the chain previously taken during addition. in tc_ctl_chain()
3085 tcf_chain_put_explicitly_created(chain); in tc_ctl_chain()
3088 err = tc_chain_notify(chain, skb, n->nlmsg_seq, in tc_ctl_chain()
3091 NL_SET_ERR_MSG(extack, "Failed to send chain notify message"); in tc_ctl_chain()
3100 tcf_chain_put(chain); in tc_ctl_chain()
3121 struct tcf_chain *chain; in tc_dump_chain() local
3175 list_for_each_entry(chain, &block->chain_list, list) { in tc_dump_chain()
3177 nla_get_u32(tca[TCA_CHAIN]) != chain->index)) in tc_dump_chain()
3183 if (tcf_chain_held_by_acts_only(chain)) in tc_dump_chain()
3185 err = tc_chain_fill_node(chain->tmplt_ops, chain->tmplt_priv, in tc_dump_chain()
3186 chain->index, net, skb, block, in tc_dump_chain()