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()
290 * tcf_em_tree_validate - validate ematch config TLV and build ematch tree
293 * @nla: ematch tree configuration TLV
294 * @tree: destination ematch tree variable to store the resulting
295 * ematch tree.
298 * ematch tree in @tree. The resulting tree must later be copied into
300 * provide the ematch tree variable of the private classifier data directly,
306 struct tcf_ematch_tree *tree) in tcf_em_tree_validate() argument
314 memset(tree, 0, sizeof(*tree)); in tcf_em_tree_validate()
331 memcpy(&tree->hdr, tree_hdr, sizeof(*tree_hdr)); in tcf_em_tree_validate()
337 tree->matches = kzalloc(matches_len, GFP_KERNEL); in tcf_em_tree_validate()
338 if (tree->matches == NULL) in tcf_em_tree_validate()
362 em = tcf_em_get_match(tree, idx); in tcf_em_tree_validate()
386 tcf_em_tree_destroy(tree); in tcf_em_tree_validate()
392 * tcf_em_tree_destroy - destroy an ematch tree
394 * @tree: ematch tree to be deleted
396 * This functions destroys an ematch tree previously created by
398 * the ematch tree is not in use before calling this function.
400 void tcf_em_tree_destroy(struct tcf_ematch_tree *tree) in tcf_em_tree_destroy() argument
404 if (tree->matches == NULL) in tcf_em_tree_destroy()
407 for (i = 0; i < tree->hdr.nmatches; i++) { in tcf_em_tree_destroy()
408 struct tcf_ematch *em = tcf_em_get_match(tree, i); in tcf_em_tree_destroy()
419 tree->hdr.nmatches = 0; in tcf_em_tree_destroy()
420 kfree(tree->matches); in tcf_em_tree_destroy()
421 tree->matches = NULL; in tcf_em_tree_destroy()
426 * tcf_em_tree_dump - dump ematch tree into a rtnl message
429 * @tree: ematch tree to be dumped
430 * @tlv: TLV type to be used to encapsulate the tree
432 * This function dumps a ematch tree into a rtnl message. It is valid to
433 * call this function while the ematch tree is in use.
437 int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) in tcf_em_tree_dump() argument
448 if (nla_put(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr)) in tcf_em_tree_dump()
456 for (i = 0; i < tree->hdr.nmatches; i++) { in tcf_em_tree_dump()
458 struct tcf_ematch *em = tcf_em_get_match(tree, i); in tcf_em_tree_dump()
500 int __tcf_em_tree_match(struct sk_buff *skb, struct tcf_ematch_tree *tree, in __tcf_em_tree_match() argument
508 while (match_idx < tree->hdr.nmatches) { in __tcf_em_tree_match()
509 cur_match = tcf_em_get_match(tree, match_idx); in __tcf_em_tree_match()
531 cur_match = tcf_em_get_match(tree, match_idx); in __tcf_em_tree_match()