MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rule_find

Function rule_find

dpdk/lib/lpm/rte_lpm.c:468–487  ·  view source on GitHub ↗

* Finds a rule in rule table. * NOTE: Valid range for depth parameter is 1 .. 32 inclusive. */

Source from the content-addressed store, hash-verified

466 * NOTE: Valid range for depth parameter is 1 .. 32 inclusive.
467 */
468static int32_t
469rule_find(struct __rte_lpm *i_lpm, uint32_t ip_masked, uint8_t depth)
470{
471 uint32_t rule_gindex, last_rule, rule_index;
472
473 VERIFY_DEPTH(depth);
474
475 rule_gindex = i_lpm->rule_info[depth - 1].first_rule;
476 last_rule = rule_gindex + i_lpm->rule_info[depth - 1].used_rules;
477
478 /* Scan used rules at given depth to find rule. */
479 for (rule_index = rule_gindex; rule_index < last_rule; rule_index++) {
480 /* If rule is found return the rule index. */
481 if (i_lpm->rules_tbl[rule_index].ip == ip_masked)
482 return rule_index;
483 }
484
485 /* If rule is not found return -EINVAL. */
486 return -EINVAL;
487}
488
489/*
490 * Find, clean and allocate a tbl8.

Callers 3

rte_lpm_is_rule_presentFunction · 0.70
find_previous_ruleFunction · 0.70
rte_lpm_deleteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected