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

Function table_rule_add_bulk

dpdk/examples/ip_pipeline/pipeline.c:1024–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1022}
1023
1024void
1025table_rule_add_bulk(struct table *table,
1026 struct table_rule_list *list,
1027 uint32_t n_rules)
1028{
1029 uint32_t i;
1030
1031 for (i = 0; i < n_rules; i++) {
1032 struct table_rule *existing_rule, *new_rule;
1033
1034 new_rule = TAILQ_FIRST(list);
1035 if (new_rule == NULL)
1036 break;
1037
1038 TAILQ_REMOVE(list, new_rule, node);
1039
1040 existing_rule = table_rule_find(table, &new_rule->match);
1041 if (existing_rule == NULL)
1042 TAILQ_INSERT_TAIL(&table->rules, new_rule, node);
1043 else {
1044 TAILQ_INSERT_AFTER(&table->rules, existing_rule, new_rule, node);
1045 TAILQ_REMOVE(&table->rules, existing_rule, node);
1046 free(existing_rule);
1047 }
1048 }
1049}
1050
1051void
1052table_rule_delete(struct table *table,

Callers 1

Calls 2

table_rule_findFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected