Lines Matching full:tree
162 static inline struct tcf_ematch *tcf_em_get_match(struct tcf_ematch_tree *tree, in tcf_em_get_match() argument
165 return &tree->matches[index]; in tcf_em_get_match()
288 * tcf_em_tree_validate - validate ematch config TLV and build ematch tree
291 * @nla: ematch tree configuration TLV
292 * @tree: destination ematch tree variable to store the resulting
293 * ematch tree.
296 * ematch tree in @tree. The resulting tree must later be copied into
298 * provide the ematch tree variable of the private classifier data directly,
304 struct tcf_ematch_tree *tree) in tcf_em_tree_validate() argument
312 memset(tree, 0, sizeof(*tree)); in tcf_em_tree_validate()
329 memcpy(&tree->hdr, tree_hdr, sizeof(*tree_hdr)); in tcf_em_tree_validate()
335 tree->matches = kzalloc(matches_len, GFP_KERNEL); in tcf_em_tree_validate()
336 if (tree->matches == NULL) in tcf_em_tree_validate()
360 em = tcf_em_get_match(tree, idx); in tcf_em_tree_validate()
384 tcf_em_tree_destroy(tree); in tcf_em_tree_validate()
390 * tcf_em_tree_destroy - destroy an ematch tree
392 * @tree: ematch tree to be deleted
394 * This functions destroys an ematch tree previously created by
396 * the ematch tree is not in use before calling this function.
398 void tcf_em_tree_destroy(struct tcf_ematch_tree *tree) in tcf_em_tree_destroy() argument
402 if (tree->matches == NULL) in tcf_em_tree_destroy()
405 for (i = 0; i < tree->hdr.nmatches; i++) { in tcf_em_tree_destroy()
406 struct tcf_ematch *em = tcf_em_get_match(tree, i); in tcf_em_tree_destroy()
417 tree->hdr.nmatches = 0; in tcf_em_tree_destroy()
418 kfree(tree->matches); in tcf_em_tree_destroy()
419 tree->matches = NULL; in tcf_em_tree_destroy()
424 * tcf_em_tree_dump - dump ematch tree into a rtnl message
427 * @tree: ematch tree to be dumped
428 * @tlv: TLV type to be used to encapsulate the tree
430 * This function dumps a ematch tree into a rtnl message. It is valid to
431 * call this function while the ematch tree is in use.
435 int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) in tcf_em_tree_dump() argument
446 if (nla_put(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr)) in tcf_em_tree_dump()
454 for (i = 0; i < tree->hdr.nmatches; i++) { in tcf_em_tree_dump()
456 struct tcf_ematch *em = tcf_em_get_match(tree, i); in tcf_em_tree_dump()
498 int __tcf_em_tree_match(struct sk_buff *skb, struct tcf_ematch_tree *tree, in __tcf_em_tree_match() argument
506 while (match_idx < tree->hdr.nmatches) { in __tcf_em_tree_match()
507 cur_match = tcf_em_get_match(tree, match_idx); in __tcf_em_tree_match()
529 cur_match = tcf_em_get_match(tree, match_idx); in __tcf_em_tree_match()