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

Function rule_delete

dpdk/lib/lpm/rte_lpm.c:441–462  ·  view source on GitHub ↗

* Delete a rule from the rule table. * NOTE: Valid range for depth parameter is 1 .. 32 inclusive. */

Source from the content-addressed store, hash-verified

439 * NOTE: Valid range for depth parameter is 1 .. 32 inclusive.
440 */
441static void
442rule_delete(struct __rte_lpm *i_lpm, int32_t rule_index, uint8_t depth)
443{
444 int i;
445
446 VERIFY_DEPTH(depth);
447
448 i_lpm->rules_tbl[rule_index] =
449 i_lpm->rules_tbl[i_lpm->rule_info[depth - 1].first_rule
450 + i_lpm->rule_info[depth - 1].used_rules - 1];
451
452 for (i = depth; i < RTE_LPM_MAX_DEPTH; i++) {
453 if (i_lpm->rule_info[i].used_rules > 0) {
454 i_lpm->rules_tbl[i_lpm->rule_info[i].first_rule - 1] =
455 i_lpm->rules_tbl[i_lpm->rule_info[i].first_rule
456 + i_lpm->rule_info[i].used_rules - 1];
457 i_lpm->rule_info[i].first_rule--;
458 }
459 }
460
461 i_lpm->rule_info[depth - 1].used_rules--;
462}
463
464/*
465 * Finds a rule in rule table.

Callers 2

rte_lpm_addFunction · 0.70
rte_lpm_deleteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected