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

Function sort_rules

dpdk/lib/acl/acl_bld.c:1273–1292  ·  view source on GitHub ↗

* Sort list of rules based on the rules wildness. * Use recursive mergesort algorithm. */

Source from the content-addressed store, hash-verified

1271 * Use recursive mergesort algorithm.
1272 */
1273static struct rte_acl_build_rule *
1274sort_rules(struct rte_acl_build_rule *head)
1275{
1276 struct rte_acl_build_rule *a;
1277 struct rte_acl_build_rule *b;
1278
1279 /* Base case -- length 0 or 1 */
1280 if (head == NULL || head->next == NULL)
1281 return head;
1282
1283 /* Split head into 'a' and 'b' sublists */
1284 rule_list_split(head, &a, &b);
1285
1286 /* Recursively sort the sublists */
1287 a = sort_rules(a);
1288 b = sort_rules(b);
1289
1290 /* answer = merge the two sorted lists together */
1291 return rule_list_sorted_merge(a, b);
1292}
1293
1294static uint32_t
1295acl_build_index(const struct rte_acl_config *config, uint32_t *data_index)

Callers 1

build_one_trieFunction · 0.85

Calls 2

rule_list_splitFunction · 0.85
rule_list_sorted_mergeFunction · 0.85

Tested by

no test coverage detected