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

Function acl_calc_wildness

dpdk/lib/acl/acl_bld.c:1072–1113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1070}
1071
1072static void
1073acl_calc_wildness(struct rte_acl_build_rule *head,
1074 const struct rte_acl_config *config)
1075{
1076 uint32_t n;
1077 struct rte_acl_build_rule *rule;
1078
1079 for (rule = head; rule != NULL; rule = rule->next) {
1080
1081 for (n = 0; n < config->num_fields; n++) {
1082
1083 double wild = 0;
1084 uint32_t bit_len = CHAR_BIT * config->defs[n].size;
1085 uint64_t msk_val = RTE_LEN2MASK(bit_len,
1086 typeof(msk_val));
1087 double size = bit_len;
1088 int field_index = config->defs[n].field_index;
1089 const struct rte_acl_field *fld = rule->f->field +
1090 field_index;
1091
1092 switch (rule->config->defs[n].type) {
1093 case RTE_ACL_FIELD_TYPE_BITMASK:
1094 wild = (size - rte_popcount64(
1095 fld->mask_range.u64 & msk_val)) /
1096 size;
1097 break;
1098
1099 case RTE_ACL_FIELD_TYPE_MASK:
1100 wild = (size - fld->mask_range.u32) / size;
1101 break;
1102
1103 case RTE_ACL_FIELD_TYPE_RANGE:
1104 wild = (fld->mask_range.u64 & msk_val) -
1105 (fld->value.u64 & msk_val);
1106 wild = wild / msk_val;
1107 break;
1108 }
1109
1110 rule->wildness[field_index] = (uint32_t)(wild * 100);
1111 }
1112 }
1113}
1114
1115static void
1116acl_rule_stats(struct rte_acl_build_rule *head, struct rte_acl_config *config)

Callers 1

acl_build_triesFunction · 0.85

Calls 1

rte_popcount64Function · 0.85

Tested by

no test coverage detected