4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #include <rte_string_fns.h>
41 #include <rte_byteorder.h>
44 #include <rte_common.h>
48 #define LEN RTE_ACL_MAX_CATEGORIES
50 struct rte_acl_param acl_param = {
52 .socket_id = SOCKET_ID_ANY,
53 .rule_size = RTE_ACL_IPV4VLAN_RULE_SZ,
54 .max_rule_num = 0x30000,
57 struct rte_acl_ipv4vlan_rule acl_rule = {
58 .data = { .priority = 1, .category_mask = 0xff },
60 .src_port_high = UINT16_MAX,
62 .dst_port_high = UINT16_MAX,
65 /* byteswap to cpu or network order */
67 bswap_test_data(struct ipv4_7tuple *data, int len, int to_be)
71 for (i = 0; i < len; i++) {
74 /* swap all bytes so that they are in network order */
75 data[i].ip_dst = rte_cpu_to_be_32(data[i].ip_dst);
76 data[i].ip_src = rte_cpu_to_be_32(data[i].ip_src);
77 data[i].port_dst = rte_cpu_to_be_16(data[i].port_dst);
78 data[i].port_src = rte_cpu_to_be_16(data[i].port_src);
79 data[i].vlan = rte_cpu_to_be_16(data[i].vlan);
80 data[i].domain = rte_cpu_to_be_16(data[i].domain);
82 data[i].ip_dst = rte_be_to_cpu_32(data[i].ip_dst);
83 data[i].ip_src = rte_be_to_cpu_32(data[i].ip_src);
84 data[i].port_dst = rte_be_to_cpu_16(data[i].port_dst);
85 data[i].port_src = rte_be_to_cpu_16(data[i].port_src);
86 data[i].vlan = rte_be_to_cpu_16(data[i].vlan);
87 data[i].domain = rte_be_to_cpu_16(data[i].domain);
93 * Test scalar and SSE ACL lookup.
96 test_classify_run(struct rte_acl_ctx *acx)
99 uint32_t result, count;
100 uint32_t results[RTE_DIM(acl_test_data) * RTE_ACL_MAX_CATEGORIES];
101 const uint8_t *data[RTE_DIM(acl_test_data)];
103 /* swap all bytes in the data to network order */
104 bswap_test_data(acl_test_data, RTE_DIM(acl_test_data), 1);
106 /* store pointers to test data */
107 for (i = 0; i < (int) RTE_DIM(acl_test_data); i++)
108 data[i] = (uint8_t *)&acl_test_data[i];
111 * these will run quite a few times, it's necessary to test code paths
112 * from num=0 to num>8
114 for (count = 0; count <= RTE_DIM(acl_test_data); count++) {
115 ret = rte_acl_classify(acx, data, results,
116 count, RTE_ACL_MAX_CATEGORIES);
118 printf("Line %i: SSE classify failed!\n", __LINE__);
122 /* check if we allow everything we should allow */
123 for (i = 0; i < (int) count; i++) {
125 results[i * RTE_ACL_MAX_CATEGORIES + ACL_ALLOW];
126 if (result != acl_test_data[i].allow) {
127 printf("Line %i: Error in allow results at %i "
128 "(expected %"PRIu32" got %"PRIu32")!\n",
129 __LINE__, i, acl_test_data[i].allow,
136 /* check if we deny everything we should deny */
137 for (i = 0; i < (int) count; i++) {
138 result = results[i * RTE_ACL_MAX_CATEGORIES + ACL_DENY];
139 if (result != acl_test_data[i].deny) {
140 printf("Line %i: Error in deny results at %i "
141 "(expected %"PRIu32" got %"PRIu32")!\n",
142 __LINE__, i, acl_test_data[i].deny,
150 /* make a quick check for scalar */
151 ret = rte_acl_classify_alg(acx, data, results,
152 RTE_DIM(acl_test_data), RTE_ACL_MAX_CATEGORIES,
153 RTE_ACL_CLASSIFY_SCALAR);
155 printf("Line %i: scalar classify failed!\n", __LINE__);
159 /* check if we allow everything we should allow */
160 for (i = 0; i < (int) RTE_DIM(acl_test_data); i++) {
161 result = results[i * RTE_ACL_MAX_CATEGORIES + ACL_ALLOW];
162 if (result != acl_test_data[i].allow) {
163 printf("Line %i: Error in allow results at %i "
164 "(expected %"PRIu32" got %"PRIu32")!\n",
165 __LINE__, i, acl_test_data[i].allow,
172 /* check if we deny everything we should deny */
173 for (i = 0; i < (int) RTE_DIM(acl_test_data); i++) {
174 result = results[i * RTE_ACL_MAX_CATEGORIES + ACL_DENY];
175 if (result != acl_test_data[i].deny) {
176 printf("Line %i: Error in deny results at %i "
177 "(expected %"PRIu32" got %"PRIu32")!\n",
178 __LINE__, i, acl_test_data[i].deny,
188 /* swap data back to cpu order so that next time tests don't fail */
189 bswap_test_data(acl_test_data, RTE_DIM(acl_test_data), 0);
194 test_classify_buid(struct rte_acl_ctx *acx,
195 const struct rte_acl_ipv4vlan_rule *rules, uint32_t num)
198 const uint32_t layout[RTE_ACL_IPV4VLAN_NUM] = {
199 offsetof(struct ipv4_7tuple, proto),
200 offsetof(struct ipv4_7tuple, vlan),
201 offsetof(struct ipv4_7tuple, ip_src),
202 offsetof(struct ipv4_7tuple, ip_dst),
203 offsetof(struct ipv4_7tuple, port_src),
206 /* add rules to the context */
207 ret = rte_acl_ipv4vlan_add_rules(acx, rules, num);
209 printf("Line %i: Adding rules to ACL context failed!\n",
214 /* try building the context */
215 ret = rte_acl_ipv4vlan_build(acx, layout, RTE_ACL_MAX_CATEGORIES);
217 printf("Line %i: Building ACL context failed!\n", __LINE__);
224 #define TEST_CLASSIFY_ITER 4
227 * Test scalar and SSE ACL lookup.
232 struct rte_acl_ctx *acx;
235 acx = rte_acl_create(&acl_param);
237 printf("Line %i: Error creating ACL context!\n", __LINE__);
242 for (i = 0; i != TEST_CLASSIFY_ITER; i++) {
247 rte_acl_reset_rules(acx);
249 ret = test_classify_buid(acx, acl_test_rules,
250 RTE_DIM(acl_test_rules));
252 printf("Line %i, iter: %d: "
253 "Adding rules to ACL context failed!\n",
258 ret = test_classify_run(acx);
260 printf("Line %i, iter: %d: %s failed!\n",
261 __LINE__, i, __func__);
265 /* reset rules and make sure that classify still works ok. */
266 rte_acl_reset_rules(acx);
267 ret = test_classify_run(acx);
269 printf("Line %i, iter: %d: %s failed!\n",
270 __LINE__, i, __func__);
280 test_build_ports_range(void)
282 static const struct rte_acl_ipv4vlan_rule test_rules[] = {
284 /* match all packets. */
287 .category_mask = ACL_ALLOW_MASK,
291 .src_port_high = UINT16_MAX,
293 .dst_port_high = UINT16_MAX,
296 /* match all packets with dst ports [54-65280]. */
299 .category_mask = ACL_ALLOW_MASK,
303 .src_port_high = UINT16_MAX,
305 .dst_port_high = 65280,
308 /* match all packets with dst ports [0-52]. */
311 .category_mask = ACL_ALLOW_MASK,
315 .src_port_high = UINT16_MAX,
320 /* match all packets with dst ports [53]. */
323 .category_mask = ACL_ALLOW_MASK,
327 .src_port_high = UINT16_MAX,
332 /* match all packets with dst ports [65279-65535]. */
335 .category_mask = ACL_ALLOW_MASK,
339 .src_port_high = UINT16_MAX,
340 .dst_port_low = 65279,
341 .dst_port_high = UINT16_MAX,
345 static struct ipv4_7tuple test_data[] = {
348 .ip_src = IPv4(10, 1, 1, 1),
349 .ip_dst = IPv4(192, 168, 0, 33),
355 .ip_src = IPv4(127, 84, 33, 1),
356 .ip_dst = IPv4(1, 2, 3, 4),
362 struct rte_acl_ctx *acx;
364 uint32_t results[RTE_DIM(test_data)];
365 const uint8_t *data[RTE_DIM(test_data)];
367 acx = rte_acl_create(&acl_param);
369 printf("Line %i: Error creating ACL context!\n", __LINE__);
373 /* swap all bytes in the data to network order */
374 bswap_test_data(test_data, RTE_DIM(test_data), 1);
376 /* store pointers to test data */
377 for (i = 0; i != RTE_DIM(test_data); i++)
378 data[i] = (uint8_t *)&test_data[i];
380 for (i = 0; i != RTE_DIM(test_rules); i++) {
382 ret = test_classify_buid(acx, test_rules, i + 1);
384 printf("Line %i, iter: %d: "
385 "Adding rules to ACL context failed!\n",
389 ret = rte_acl_classify(acx, data, results,
392 printf("Line %i, iter: %d: classify failed!\n",
398 for (j = 0; j != RTE_DIM(results); j++) {
399 if (results[j] != test_data[j].allow) {
400 printf("Line %i: Error in allow results at %i "
401 "(expected %"PRIu32" got %"PRIu32")!\n",
402 __LINE__, j, test_data[j].allow,
409 bswap_test_data(test_data, RTE_DIM(test_data), 0);
416 * Test wrong layout behavior
417 * This test supplies the ACL context with invalid layout, which results in
418 * ACL matching the wrong stuff. However, it should match the wrong stuff
419 * the right way. We switch around source and destination addresses,
420 * source and destination ports, and protocol will point to first byte of
424 test_invalid_layout(void)
426 struct rte_acl_ctx *acx;
429 uint32_t results[RTE_DIM(invalid_layout_data)];
430 const uint8_t *data[RTE_DIM(invalid_layout_data)];
432 const uint32_t layout[RTE_ACL_IPV4VLAN_NUM] = {
433 /* proto points to destination port's first byte */
434 offsetof(struct ipv4_7tuple, port_dst),
436 0, /* VLAN not used */
438 /* src and dst addresses are swapped */
439 offsetof(struct ipv4_7tuple, ip_dst),
440 offsetof(struct ipv4_7tuple, ip_src),
443 * we can't swap ports here, so we will swap
446 offsetof(struct ipv4_7tuple, port_src),
449 acx = rte_acl_create(&acl_param);
451 printf("Line %i: Error creating ACL context!\n", __LINE__);
455 /* putting a lot of rules into the context results in greater
456 * coverage numbers. it doesn't matter if they are identical */
457 for (i = 0; i < 1000; i++) {
458 /* add rules to the context */
459 ret = rte_acl_ipv4vlan_add_rules(acx, invalid_layout_rules,
460 RTE_DIM(invalid_layout_rules));
462 printf("Line %i: Adding rules to ACL context failed!\n",
469 /* try building the context */
470 ret = rte_acl_ipv4vlan_build(acx, layout, 1);
472 printf("Line %i: Building ACL context failed!\n", __LINE__);
477 /* swap all bytes in the data to network order */
478 bswap_test_data(invalid_layout_data, RTE_DIM(invalid_layout_data), 1);
481 for (i = 0; i < (int) RTE_DIM(invalid_layout_data); i++) {
482 data[i] = (uint8_t *)&invalid_layout_data[i];
485 /* classify tuples */
486 ret = rte_acl_classify_alg(acx, data, results,
487 RTE_DIM(results), 1, RTE_ACL_CLASSIFY_SCALAR);
489 printf("Line %i: SSE classify failed!\n", __LINE__);
494 for (i = 0; i < (int) RTE_DIM(results); i++) {
495 if (results[i] != invalid_layout_data[i].allow) {
496 printf("Line %i: Wrong results at %i "
497 "(result=%u, should be %u)!\n",
498 __LINE__, i, results[i],
499 invalid_layout_data[i].allow);
504 /* classify tuples (scalar) */
505 ret = rte_acl_classify_alg(acx, data, results, RTE_DIM(results), 1,
506 RTE_ACL_CLASSIFY_SCALAR);
509 printf("Line %i: Scalar classify failed!\n", __LINE__);
514 for (i = 0; i < (int) RTE_DIM(results); i++) {
515 if (results[i] != invalid_layout_data[i].allow) {
516 printf("Line %i: Wrong results at %i "
517 "(result=%u, should be %u)!\n",
518 __LINE__, i, results[i],
519 invalid_layout_data[i].allow);
526 /* swap data back to cpu order so that next time tests don't fail */
527 bswap_test_data(invalid_layout_data, RTE_DIM(invalid_layout_data), 0);
532 /* swap data back to cpu order so that next time tests don't fail */
533 bswap_test_data(invalid_layout_data, RTE_DIM(invalid_layout_data), 0);
541 * Test creating and finding ACL contexts, and adding rules
544 test_create_find_add(void)
546 struct rte_acl_param param;
547 struct rte_acl_ctx *acx, *acx2, *tmp;
548 struct rte_acl_ipv4vlan_rule rules[LEN];
550 const uint32_t layout[RTE_ACL_IPV4VLAN_NUM] = {0};
552 const char *acx_name = "acx";
553 const char *acx2_name = "acx2";
556 /* create two contexts */
557 memcpy(¶m, &acl_param, sizeof(param));
558 param.max_rule_num = 2;
560 param.name = acx_name;
561 acx = rte_acl_create(¶m);
563 printf("Line %i: Error creating %s!\n", __LINE__, acx_name);
567 param.name = acx2_name;
568 acx2 = rte_acl_create(¶m);
569 if (acx2 == NULL || acx2 == acx) {
570 printf("Line %i: Error creating %s!\n", __LINE__, acx2_name);
575 /* try to create third one, with an existing name */
576 param.name = acx_name;
577 tmp = rte_acl_create(¶m);
579 printf("Line %i: Creating context with existing name "
587 param.name = acx2_name;
588 tmp = rte_acl_create(¶m);
590 printf("Line %i: Creating context with existing "
591 "name test 2 failed!\n",
598 /* try to find existing ACL contexts */
599 tmp = rte_acl_find_existing(acx_name);
601 printf("Line %i: Finding %s failed!\n", __LINE__, acx_name);
607 tmp = rte_acl_find_existing(acx2_name);
609 printf("Line %i: Finding %s failed!\n", __LINE__, acx2_name);
615 /* try to find non-existing context */
616 tmp = rte_acl_find_existing("invalid");
618 printf("Line %i: Non-existent ACL context found!\n", __LINE__);
626 /* create valid (but severely limited) acx */
627 memcpy(¶m, &acl_param, sizeof(param));
628 param.max_rule_num = LEN;
630 acx = rte_acl_create(¶m);
632 printf("Line %i: Error creating %s!\n", __LINE__, param.name);
636 /* create dummy acl */
637 for (i = 0; i < LEN; i++) {
638 memcpy(&rules[i], &acl_rule,
639 sizeof(struct rte_acl_ipv4vlan_rule));
641 rules[i].data.userdata = i + 1;
642 /* one rule per category */
643 rules[i].data.category_mask = 1 << i;
646 /* try filling up the context */
647 ret = rte_acl_ipv4vlan_add_rules(acx, rules, LEN);
649 printf("Line %i: Adding %i rules to ACL context failed!\n",
654 /* try adding to a (supposedly) full context */
655 ret = rte_acl_ipv4vlan_add_rules(acx, rules, 1);
657 printf("Line %i: Adding rules to full ACL context should"
658 "have failed!\n", __LINE__);
662 /* try building the context */
663 ret = rte_acl_ipv4vlan_build(acx, layout, RTE_ACL_MAX_CATEGORIES);
665 printf("Line %i: Building ACL context failed!\n", __LINE__);
680 * test various invalid rules
683 test_invalid_rules(void)
685 struct rte_acl_ctx *acx;
688 struct rte_acl_ipv4vlan_rule rule;
690 acx = rte_acl_create(&acl_param);
692 printf("Line %i: Error creating ACL context!\n", __LINE__);
696 /* test inverted high/low source and destination ports.
697 * originally, there was a problem with memory consumption when using
700 /* create dummy acl */
701 memcpy(&rule, &acl_rule, sizeof(struct rte_acl_ipv4vlan_rule));
702 rule.data.userdata = 1;
703 rule.dst_port_low = 0xfff0;
704 rule.dst_port_high = 0x0010;
706 /* add rules to context and try to build it */
707 ret = rte_acl_ipv4vlan_add_rules(acx, &rule, 1);
709 printf("Line %i: Adding rules to ACL context "
710 "should have failed!\n", __LINE__);
714 rule.dst_port_low = 0x0;
715 rule.dst_port_high = 0xffff;
716 rule.src_port_low = 0xfff0;
717 rule.src_port_high = 0x0010;
719 /* add rules to context and try to build it */
720 ret = rte_acl_ipv4vlan_add_rules(acx, &rule, 1);
722 printf("Line %i: Adding rules to ACL context "
723 "should have failed!\n", __LINE__);
727 rule.dst_port_low = 0x0;
728 rule.dst_port_high = 0xffff;
729 rule.src_port_low = 0x0;
730 rule.src_port_high = 0xffff;
732 rule.dst_mask_len = 33;
734 /* add rules to context and try to build it */
735 ret = rte_acl_ipv4vlan_add_rules(acx, &rule, 1);
737 printf("Line %i: Adding rules to ACL context "
738 "should have failed!\n", __LINE__);
742 rule.dst_mask_len = 0;
743 rule.src_mask_len = 33;
745 /* add rules to context and try to build it */
746 ret = rte_acl_ipv4vlan_add_rules(acx, &rule, 1);
748 printf("Line %i: Adding rules to ACL context "
749 "should have failed!\n", __LINE__);
753 rule.dst_mask_len = 0;
754 rule.src_mask_len = 0;
755 rule.data.userdata = 0;
757 /* try adding this rule (it should fail because userdata is invalid) */
758 ret = rte_acl_ipv4vlan_add_rules(acx, &rule, 1);
760 printf("Line %i: Adding a rule with invalid user data "
761 "should have failed!\n", __LINE__);
777 * test functions by passing invalid or
778 * non-workable parameters.
780 * we do very limited testing of classify functions here
781 * because those are performance-critical and
782 * thus don't do much parameter checking.
785 test_invalid_parameters(void)
787 struct rte_acl_param param;
788 struct rte_acl_ctx *acx;
789 struct rte_acl_ipv4vlan_rule rule;
792 uint32_t layout[RTE_ACL_IPV4VLAN_NUM] = {0};
800 acx = rte_acl_create(NULL);
802 printf("Line %i: ACL context creation with NULL param "
803 "should have failed!\n", __LINE__);
809 memcpy(¶m, &acl_param, sizeof(param));
812 acx = rte_acl_create(¶m);
814 printf("Line %i: ACL context creation with zero rule len "
815 "failed!\n", __LINE__);
820 /* zero max rule num */
821 memcpy(¶m, &acl_param, sizeof(param));
822 param.max_rule_num = 0;
824 acx = rte_acl_create(¶m);
826 printf("Line %i: ACL context creation with zero rule num "
827 "failed!\n", __LINE__);
832 /* invalid NUMA node */
833 memcpy(¶m, &acl_param, sizeof(param));
834 param.socket_id = RTE_MAX_NUMA_NODES + 1;
836 acx = rte_acl_create(¶m);
838 printf("Line %i: ACL context creation with invalid NUMA "
839 "should have failed!\n", __LINE__);
845 memcpy(¶m, &acl_param, sizeof(param));
848 acx = rte_acl_create(¶m);
850 printf("Line %i: ACL context creation with NULL name "
851 "should have failed!\n", __LINE__);
857 * rte_acl_find_existing
860 acx = rte_acl_find_existing(NULL);
862 printf("Line %i: NULL ACL context found!\n", __LINE__);
868 * rte_acl_ipv4vlan_add_rules
871 /* initialize everything */
872 memcpy(¶m, &acl_param, sizeof(param));
873 acx = rte_acl_create(¶m);
875 printf("Line %i: ACL context creation failed!\n", __LINE__);
879 memcpy(&rule, &acl_rule, sizeof(rule));
882 result = rte_acl_ipv4vlan_add_rules(NULL, &rule, 1);
884 printf("Line %i: Adding rules with NULL ACL context "
885 "should have failed!\n", __LINE__);
891 result = rte_acl_ipv4vlan_add_rules(acx, NULL, 1);
893 printf("Line %i: Adding NULL rule to ACL context "
894 "should have failed!\n", __LINE__);
899 /* zero count (should succeed) */
900 result = rte_acl_ipv4vlan_add_rules(acx, &rule, 0);
902 printf("Line %i: Adding 0 rules to ACL context failed!\n",
908 /* free ACL context */
911 /* set wrong rule_size so that adding any rules would fail */
912 param.rule_size = RTE_ACL_IPV4VLAN_RULE_SZ + 4;
913 acx = rte_acl_create(¶m);
915 printf("Line %i: ACL context creation failed!\n", __LINE__);
919 /* try adding a rule with size different from context rule_size */
920 result = rte_acl_ipv4vlan_add_rules(acx, &rule, 1);
922 printf("Line %i: Adding an invalid sized rule "
923 "should have failed!\n", __LINE__);
928 /* free ACL context */
933 * rte_acl_ipv4vlan_build
936 /* reinitialize context */
937 memcpy(¶m, &acl_param, sizeof(param));
938 acx = rte_acl_create(¶m);
940 printf("Line %i: ACL context creation failed!\n", __LINE__);
945 result = rte_acl_ipv4vlan_build(NULL, layout, 1);
947 printf("Line %i: Building with NULL context "
948 "should have failed!\n", __LINE__);
954 result = rte_acl_ipv4vlan_build(acx, NULL, 1);
956 printf("Line %i: Building with NULL layout "
957 "should have failed!\n", __LINE__);
962 /* zero categories (should not fail) */
963 result = rte_acl_ipv4vlan_build(acx, layout, 0);
965 printf("Line %i: Building with 0 categories should fail!\n",
971 /* SSE classify test */
973 /* cover zero categories in classify (should not fail) */
974 result = rte_acl_classify(acx, NULL, NULL, 0, 0);
976 printf("Line %i: SSE classify with zero categories "
977 "failed!\n", __LINE__);
982 /* cover invalid but positive categories in classify */
983 result = rte_acl_classify(acx, NULL, NULL, 0, 3);
985 printf("Line %i: SSE classify with 3 categories "
986 "should have failed!\n", __LINE__);
991 /* scalar classify test */
993 /* cover zero categories in classify (should not fail) */
994 result = rte_acl_classify_alg(acx, NULL, NULL, 0, 0,
995 RTE_ACL_CLASSIFY_SCALAR);
997 printf("Line %i: Scalar classify with zero categories "
998 "failed!\n", __LINE__);
1003 /* cover invalid but positive categories in classify */
1004 result = rte_acl_classify(acx, NULL, NULL, 0, 3);
1006 printf("Line %i: Scalar classify with 3 categories "
1007 "should have failed!\n", __LINE__);
1012 /* free ACL context */
1017 * make sure void functions don't crash with NULL parameters
1028 * Various tests that don't test much but improve coverage
1033 struct rte_acl_param param;
1034 struct rte_acl_ctx *acx;
1036 /* create context */
1037 memcpy(¶m, &acl_param, sizeof(param));
1039 acx = rte_acl_create(¶m);
1041 printf("Line %i: Error creating ACL context!\n", __LINE__);
1045 /* dump context with rules - useful for coverage */
1046 rte_acl_list_dump();
1058 if (test_invalid_parameters() < 0)
1060 if (test_invalid_rules() < 0)
1062 if (test_create_find_add() < 0)
1064 if (test_invalid_layout() < 0)
1066 if (test_misc() < 0)
1068 if (test_classify() < 0)
1070 if (test_build_ports_range() < 0)
1076 static struct test_command acl_cmd = {
1077 .command = "acl_autotest",
1078 .callback = test_acl,
1080 REGISTER_TEST_COMMAND(acl_cmd);