| 906 | } |
| 907 | |
| 908 | static int |
| 909 | test_convert_rules(const char *desc, |
| 910 | void (*config)(struct rte_acl_config *), |
| 911 | void (*convert)(const struct rte_acl_ipv4vlan_rule *, |
| 912 | struct acl_ipv4vlan_rule *)) |
| 913 | { |
| 914 | struct rte_acl_ctx *acx; |
| 915 | int32_t rc; |
| 916 | uint32_t i; |
| 917 | static const size_t mem_sizes[] = {0, -1}; |
| 918 | |
| 919 | printf("running %s(%s)\n", __func__, desc); |
| 920 | |
| 921 | acx = rte_acl_create(&acl_param); |
| 922 | if (acx == NULL) { |
| 923 | printf("Line %i: Error creating ACL context!\n", __LINE__); |
| 924 | return -1; |
| 925 | } |
| 926 | |
| 927 | rc = convert_rules(acx, convert, acl_test_rules, |
| 928 | RTE_DIM(acl_test_rules)); |
| 929 | if (rc != 0) |
| 930 | printf("Line %i: Error converting ACL rules!\n", __LINE__); |
| 931 | |
| 932 | for (i = 0; rc == 0 && i != RTE_DIM(mem_sizes); i++) { |
| 933 | |
| 934 | rc = build_convert_rules(acx, config, mem_sizes[i]); |
| 935 | if (rc != 0) { |
| 936 | printf("Line %i: Error @ build_convert_rules(%zu)!\n", |
| 937 | __LINE__, mem_sizes[i]); |
| 938 | break; |
| 939 | } |
| 940 | |
| 941 | rc = test_classify_run(acx, acl_test_data, |
| 942 | RTE_DIM(acl_test_data)); |
| 943 | if (rc != 0) |
| 944 | printf("%s failed at line %i, max_size=%zu\n", |
| 945 | __func__, __LINE__, mem_sizes[i]); |
| 946 | } |
| 947 | |
| 948 | rte_acl_free(acx); |
| 949 | return rc; |
| 950 | } |
| 951 | |
| 952 | static int |
| 953 | test_convert(void) |
no test coverage detected