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 if (chain->tmplt_ops && add) in tcf_block_playback_offloads()
1540 chain->tmplt_ops->tmplt_reoffload(chain, true, cb, in tcf_block_playback_offloads()
1542 for (tp = __tcf_get_next_proto(chain, NULL); tp; in tcf_block_playback_offloads()
1544 tp = __tcf_get_next_proto(chain, tp), in tcf_block_playback_offloads()
1557 if (chain->tmplt_ops && !add) in tcf_block_playback_offloads()
1558 chain->tmplt_ops->tmplt_reoffload(chain, false, cb, in tcf_block_playback_offloads()
1566 tcf_chain_put(chain); in tcf_block_playback_offloads()
1654 /* Main classifier routine: scans classifier chain attached
1684 /* We re-lookup the tp and chain based on index instead in __tcf_classify()
1686 * check if any of tp,chain,exts was replaced by the in __tcf_classify()
1689 if (unlikely(n->tp != tp || n->tp->chain != n->chain || in __tcf_classify()
1709 *last_executed_chain = first_tp->chain->index; in __tcf_classify()
1729 tp->chain->block->index, in __tcf_classify()
1751 u32 last_executed_chain = tp ? tp->chain->index : 0; in tcf_classify()
1761 if (ext && (ext->chain || ext->act_miss)) { in tcf_classify()
1763 u32 chain; in tcf_classify()
1771 chain = n->chain_index; in tcf_classify()
1773 chain = ext->chain; in tcf_classify()
1776 fchain = tcf_chain_lookup_rcu(block, chain); in tcf_classify()
1792 /* If we missed on some chain */ in tcf_classify()
1799 ext->chain = last_executed_chain; in tcf_classify()
1818 static struct tcf_proto *tcf_chain_tp_prev(struct tcf_chain *chain, in tcf_chain_tp_prev() argument
1821 return tcf_chain_dereference(*chain_info->pprev, chain); in tcf_chain_tp_prev()
1824 static int tcf_chain_tp_insert(struct tcf_chain *chain, in tcf_chain_tp_insert() argument
1828 if (chain->flushing) in tcf_chain_tp_insert()
1831 RCU_INIT_POINTER(tp->next, tcf_chain_tp_prev(chain, chain_info)); in tcf_chain_tp_insert()
1832 if (*chain_info->pprev == chain->filter_chain) in tcf_chain_tp_insert()
1833 tcf_chain0_head_change(chain, tp); in tcf_chain_tp_insert()
1840 static void tcf_chain_tp_remove(struct tcf_chain *chain, in tcf_chain_tp_remove() argument
1844 struct tcf_proto *next = tcf_chain_dereference(chain_info->next, chain); in tcf_chain_tp_remove()
1847 if (tp == chain->filter_chain) in tcf_chain_tp_remove()
1848 tcf_chain0_head_change(chain, next); in tcf_chain_tp_remove()
1852 static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
1862 static struct tcf_proto *tcf_chain_tp_insert_unique(struct tcf_chain *chain, in tcf_chain_tp_insert_unique() argument
1871 mutex_lock(&chain->filter_chain_lock); in tcf_chain_tp_insert_unique()
1873 if (tcf_proto_exists_destroying(chain, tp_new)) { in tcf_chain_tp_insert_unique()
1874 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_insert_unique()
1879 tp = tcf_chain_tp_find(chain, &chain_info, in tcf_chain_tp_insert_unique()
1882 err = tcf_chain_tp_insert(chain, &chain_info, tp_new); in tcf_chain_tp_insert_unique()
1883 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_insert_unique()
1896 static void tcf_chain_tp_delete_empty(struct tcf_chain *chain, in tcf_chain_tp_delete_empty() argument
1905 mutex_lock(&chain->filter_chain_lock); in tcf_chain_tp_delete_empty()
1907 /* Atomically find and remove tp from chain. */ in tcf_chain_tp_delete_empty()
1908 for (pprev = &chain->filter_chain; in tcf_chain_tp_delete_empty()
1909 (tp_iter = tcf_chain_dereference(*pprev, chain)); in tcf_chain_tp_delete_empty()
1923 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_delete_empty()
1927 tcf_proto_signal_destroying(chain, tp); in tcf_chain_tp_delete_empty()
1928 next = tcf_chain_dereference(chain_info.next, chain); in tcf_chain_tp_delete_empty()
1929 if (tp == chain->filter_chain) in tcf_chain_tp_delete_empty()
1930 tcf_chain0_head_change(chain, next); in tcf_chain_tp_delete_empty()
1932 mutex_unlock(&chain->filter_chain_lock); in tcf_chain_tp_delete_empty()
1937 static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain, in tcf_chain_tp_find() argument
1945 /* Check the chain for existence of proto-tcf with this priority */ in tcf_chain_tp_find()
1946 for (pprev = &chain->filter_chain; in tcf_chain_tp_find()
1947 (tp = tcf_chain_dereference(*pprev, chain)); in tcf_chain_tp_find()
1998 if (nla_put_u32(skb, TCA_CHAIN, tp->chain->index)) in tcf_fill_node()
2102 struct tcf_chain *chain, int event, in tfilter_notify_chain() argument
2107 for (tp = tcf_get_next_proto(chain, NULL); in tfilter_notify_chain()
2108 tp; tp = tcf_get_next_proto(chain, tp)) in tfilter_notify_chain()
2138 struct tcf_chain *chain; in tc_new_tfilter() local
2165 chain = NULL; in tc_new_tfilter()
2181 /* Find head of filter chain. */ in tc_new_tfilter()
2218 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_new_tfilter()
2222 chain = tcf_chain_get(block, chain_index, true); in tc_new_tfilter()
2223 if (!chain) { in tc_new_tfilter()
2224 NL_SET_ERR_MSG(extack, "Cannot create specified filter chain"); in tc_new_tfilter()
2229 mutex_lock(&chain->filter_chain_lock); in tc_new_tfilter()
2230 tp = tcf_chain_tp_find(chain, &chain_info, protocol, in tc_new_tfilter()
2241 if (chain->flushing) { in tc_new_tfilter()
2261 prio = tcf_auto_prio(tcf_chain_tp_prev(chain, in tc_new_tfilter()
2264 mutex_unlock(&chain->filter_chain_lock); in tc_new_tfilter()
2265 tp_new = tcf_proto_create(name, protocol, prio, chain, in tc_new_tfilter()
2273 tp = tcf_chain_tp_insert_unique(chain, tp_new, protocol, prio, in tc_new_tfilter()
2280 mutex_unlock(&chain->filter_chain_lock); in tc_new_tfilter()
2304 if (chain->tmplt_ops && chain->tmplt_ops != tp->ops) { in tc_new_tfilter()
2306 NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind"); in tc_new_tfilter()
2330 tcf_chain_tp_delete_empty(chain, tp, rtnl_held, NULL); in tc_new_tfilter()
2332 if (chain) { in tc_new_tfilter()
2336 tcf_chain_put(chain); in tc_new_tfilter()
2345 * of target chain. in tc_new_tfilter()
2354 mutex_unlock(&chain->filter_chain_lock); in tc_new_tfilter()
2371 struct tcf_chain *chain = NULL; in tc_del_tfilter() local
2394 /* Find head of filter chain. */ in tc_del_tfilter()
2405 /* Take rtnl mutex if flushing whole chain, block is shared (no qdisc in tc_del_tfilter()
2429 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_del_tfilter()
2433 chain = tcf_chain_get(block, chain_index, false); in tc_del_tfilter()
2434 if (!chain) { in tc_del_tfilter()
2435 /* User requested flush on non-existent chain. Nothing to do, in tc_del_tfilter()
2442 NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); in tc_del_tfilter()
2449 chain, RTM_DELTFILTER, extack); in tc_del_tfilter()
2450 tcf_chain_flush(chain, rtnl_held); in tc_del_tfilter()
2455 mutex_lock(&chain->filter_chain_lock); in tc_del_tfilter()
2456 tp = tcf_chain_tp_find(chain, &chain_info, protocol, in tc_del_tfilter()
2467 tcf_proto_signal_destroying(chain, tp); in tc_del_tfilter()
2468 tcf_chain_tp_remove(chain, &chain_info, tp); in tc_del_tfilter()
2469 mutex_unlock(&chain->filter_chain_lock); in tc_del_tfilter()
2477 mutex_unlock(&chain->filter_chain_lock); in tc_del_tfilter()
2494 tcf_chain_tp_delete_empty(chain, tp, rtnl_held, extack); in tc_del_tfilter()
2498 if (chain) { in tc_del_tfilter()
2501 tcf_chain_put(chain); in tc_del_tfilter()
2511 mutex_unlock(&chain->filter_chain_lock); in tc_del_tfilter()
2528 struct tcf_chain *chain = NULL; in tc_get_tfilter() local
2551 /* Find head of filter chain. */ in tc_get_tfilter()
2585 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_get_tfilter()
2589 chain = tcf_chain_get(block, chain_index, false); in tc_get_tfilter()
2590 if (!chain) { in tc_get_tfilter()
2591 NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); in tc_get_tfilter()
2596 mutex_lock(&chain->filter_chain_lock); in tc_get_tfilter()
2597 tp = tcf_chain_tp_find(chain, &chain_info, protocol, in tc_get_tfilter()
2599 mutex_unlock(&chain->filter_chain_lock); in tc_get_tfilter()
2624 if (chain) { in tc_get_tfilter()
2627 tcf_chain_put(chain); in tc_get_tfilter()
2658 static bool tcf_chain_dump(struct tcf_chain *chain, struct Qdisc *q, u32 parent, in tcf_chain_dump() argument
2663 struct tcf_block *block = chain->block; in tcf_chain_dump()
2668 for (tp = __tcf_get_next_proto(chain, NULL); in tcf_chain_dump()
2671 tp = __tcf_get_next_proto(chain, tp), in tcf_chain_dump()
2726 struct tcf_chain *chain, *chain_prev; in tc_dump_tfilter() local
2801 for (chain = __tcf_get_next_chain(block, NULL); in tc_dump_tfilter()
2802 chain; in tc_dump_tfilter()
2803 chain_prev = chain, in tc_dump_tfilter()
2804 chain = __tcf_get_next_chain(block, chain), in tc_dump_tfilter()
2807 nla_get_u32(tca[TCA_CHAIN]) != chain->index) in tc_dump_tfilter()
2809 if (!tcf_chain_dump(chain, q, parent, skb, cb, in tc_dump_tfilter()
2811 tcf_chain_put(chain); in tc_dump_tfilter()
2884 static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb, in tc_chain_notify() argument
2889 struct tcf_block *block = chain->block; in tc_chain_notify()
2898 if (tc_chain_fill_node(chain->tmplt_ops, chain->tmplt_priv, in tc_chain_notify()
2899 chain->index, net, skb, block, portid, in tc_chain_notify()
2939 static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net, in tc_chain_tmplt_add() argument
2952 NL_SET_ERR_MSG(extack, "Specified TC chain template name too long"); in tc_chain_tmplt_add()
2961 NL_SET_ERR_MSG(extack, "Chain templates are not supported with specified classifier"); in tc_chain_tmplt_add()
2966 tmplt_priv = ops->tmplt_create(net, chain, tca, extack); in tc_chain_tmplt_add()
2971 chain->tmplt_ops = ops; in tc_chain_tmplt_add()
2972 chain->tmplt_priv = tmplt_priv; in tc_chain_tmplt_add()
2987 /* Add/delete/get a chain */
2998 struct tcf_chain *chain; in tc_ctl_chain() local
3021 NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); in tc_ctl_chain()
3027 chain = tcf_chain_lookup(block, chain_index); in tc_ctl_chain()
3029 if (chain) { in tc_ctl_chain()
3030 if (tcf_chain_held_by_acts_only(chain)) { in tc_ctl_chain()
3031 /* The chain exists only because there is in tc_ctl_chain()
3034 tcf_chain_hold(chain); in tc_ctl_chain()
3036 NL_SET_ERR_MSG(extack, "Filter chain already exists"); in tc_ctl_chain()
3042 NL_SET_ERR_MSG(extack, "Need both RTM_NEWCHAIN and NLM_F_CREATE to create a new chain"); in tc_ctl_chain()
3046 chain = tcf_chain_create(block, chain_index); in tc_ctl_chain()
3047 if (!chain) { in tc_ctl_chain()
3048 NL_SET_ERR_MSG(extack, "Failed to create filter chain"); in tc_ctl_chain()
3054 if (!chain || tcf_chain_held_by_acts_only(chain)) { in tc_ctl_chain()
3055 NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); in tc_ctl_chain()
3059 tcf_chain_hold(chain); in tc_ctl_chain()
3063 /* Modifying chain requires holding parent block lock. In case in tc_ctl_chain()
3064 * the chain was successfully added, take a reference to the in tc_ctl_chain()
3065 * chain. This ensures that an empty chain does not disappear at in tc_ctl_chain()
3068 tcf_chain_hold(chain); in tc_ctl_chain()
3069 chain->explicitly_created = true; in tc_ctl_chain()
3075 err = tc_chain_tmplt_add(chain, net, tca, extack); in tc_ctl_chain()
3077 tcf_chain_put_explicitly_created(chain); in tc_ctl_chain()
3081 tc_chain_notify(chain, NULL, 0, NLM_F_CREATE | NLM_F_EXCL, in tc_ctl_chain()
3086 chain, RTM_DELTFILTER, extack); in tc_ctl_chain()
3087 /* Flush the chain first as the user requested chain removal. */ in tc_ctl_chain()
3088 tcf_chain_flush(chain, true); in tc_ctl_chain()
3089 /* In case the chain was successfully deleted, put a reference in tc_ctl_chain()
3090 * to the chain previously taken during addition. in tc_ctl_chain()
3092 tcf_chain_put_explicitly_created(chain); in tc_ctl_chain()
3095 err = tc_chain_notify(chain, skb, n->nlmsg_seq, in tc_ctl_chain()
3098 NL_SET_ERR_MSG(extack, "Failed to send chain notify message"); in tc_ctl_chain()
3107 tcf_chain_put(chain); in tc_ctl_chain()
3128 struct tcf_chain *chain; in tc_dump_chain() local
3182 list_for_each_entry(chain, &block->chain_list, list) { in tc_dump_chain()
3184 nla_get_u32(tca[TCA_CHAIN]) != chain->index)) in tc_dump_chain()
3190 if (tcf_chain_held_by_acts_only(chain)) in tc_dump_chain()
3192 err = tc_chain_fill_node(chain->tmplt_ops, chain->tmplt_priv, in tc_dump_chain()
3193 chain->index, net, skb, block, in tc_dump_chain()