Lines Matching full:tree

166 static inline struct tcf_ematch *tcf_em_get_match(struct tcf_ematch_tree *tree,  in tcf_em_get_match()  argument
169 return &tree->matches[index]; in tcf_em_get_match()
286 * tcf_em_tree_validate - validate ematch config TLV and build ematch tree
289 * @nla: ematch tree configuration TLV
290 * @tree: destination ematch tree variable to store the resulting
291 * ematch tree.
294 * ematch tree in @tree. The resulting tree must later be copied into
296 * provide the ematch tree variable of the private classifier data directly,
302 struct tcf_ematch_tree *tree) in tcf_em_tree_validate() argument
310 memset(tree, 0, sizeof(*tree)); in tcf_em_tree_validate()
326 memcpy(&tree->hdr, tree_hdr, sizeof(*tree_hdr)); in tcf_em_tree_validate()
332 tree->matches = kzalloc(matches_len, GFP_KERNEL); in tcf_em_tree_validate()
333 if (tree->matches == NULL) in tcf_em_tree_validate()
357 em = tcf_em_get_match(tree, idx); in tcf_em_tree_validate()
381 tcf_em_tree_destroy(tp, tree); in tcf_em_tree_validate()
387 * tcf_em_tree_destroy - destroy an ematch tree
390 * @tree: ematch tree to be deleted
392 * This functions destroys an ematch tree previously created by
394 * the ematch tree is not in use before calling this function.
396 void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree) in tcf_em_tree_destroy() argument
400 if (tree->matches == NULL) in tcf_em_tree_destroy()
403 for (i = 0; i < tree->hdr.nmatches; i++) { in tcf_em_tree_destroy()
404 struct tcf_ematch *em = tcf_em_get_match(tree, i); in tcf_em_tree_destroy()
415 tree->hdr.nmatches = 0; in tcf_em_tree_destroy()
416 kfree(tree->matches); in tcf_em_tree_destroy()
417 tree->matches = NULL; in tcf_em_tree_destroy()
422 * tcf_em_tree_dump - dump ematch tree into a rtnl message
425 * @t: ematch tree to be dumped
426 * @tlv: TLV type to be used to encapsulate the tree
428 * This function dumps a ematch tree into a rtnl message. It is valid to
429 * call this function while the ematch tree is in use.
433 int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) in tcf_em_tree_dump() argument
444 NLA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr); in tcf_em_tree_dump()
451 for (i = 0; i < tree->hdr.nmatches; i++) { in tcf_em_tree_dump()
453 struct tcf_ematch *em = tcf_em_get_match(tree, i); in tcf_em_tree_dump()
494 int __tcf_em_tree_match(struct sk_buff *skb, struct tcf_ematch_tree *tree, in __tcf_em_tree_match() argument
502 while (match_idx < tree->hdr.nmatches) { in __tcf_em_tree_match()
503 cur_match = tcf_em_get_match(tree, match_idx); in __tcf_em_tree_match()
525 cur_match = tcf_em_get_match(tree, match_idx); in __tcf_em_tree_match()