1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2016 Intel Corporation
6 #include "test_table_combined.h"
7 #include "test_table.h"
8 #include <rte_table_lpm_ipv6.h>
10 #define MAX_TEST_KEYS 128
13 enum check_table_result
{
15 CHECK_TABLE_PORT_CONFIG
,
16 CHECK_TABLE_PORT_ENABLE
,
17 CHECK_TABLE_TABLE_CONFIG
,
18 CHECK_TABLE_ENTRY_ADD
,
19 CHECK_TABLE_DEFAULT_ENTRY_ADD
,
21 CHECK_TABLE_MANAGE_ERROR
,
22 CHECK_TABLE_CONSISTENCY
,
23 CHECK_TABLE_NO_TRAFFIC
,
24 CHECK_TABLE_INVALID_PARAMETER
,
27 struct table_packets
{
28 uint32_t hit_packet
[MAX_TEST_KEYS
];
29 uint32_t miss_packet
[MAX_TEST_KEYS
];
30 uint32_t n_hit_packets
;
31 uint32_t n_miss_packets
;
34 combined_table_test table_tests_combined
[] = {
35 test_table_lpm_combined
,
36 test_table_lpm_ipv6_combined
,
43 test_table_hash_cuckoo_combined
,
46 unsigned n_table_tests_combined
= RTE_DIM(table_tests_combined
);
48 /* Generic port tester function */
50 test_table_type(struct rte_table_ops
*table_ops
, void *table_args
,
51 void *key
, struct table_packets
*table_packets
,
52 struct manage_ops
*manage_ops
, unsigned n_ops
)
54 uint32_t ring_in_id
, table_id
, ring_out_id
, ring_out_2_id
;
57 RTE_SET_USED(manage_ops
);
60 struct rte_pipeline_params pipeline_params
= {
65 struct rte_pipeline
*pipeline
= rte_pipeline_create(&pipeline_params
);
67 /* Create input ring */
68 struct rte_port_ring_reader_params ring_params_rx
= {
72 struct rte_port_ring_writer_params ring_params_tx
= {
74 .tx_burst_sz
= RTE_PORT_IN_BURST_SIZE_MAX
,
77 struct rte_pipeline_port_in_params ring_in_params
= {
78 .ops
= &rte_port_ring_reader_ops
,
79 .arg_create
= (void *)&ring_params_rx
,
81 .burst_size
= RTE_PORT_IN_BURST_SIZE_MAX
,
84 if (rte_pipeline_port_in_create(pipeline
, &ring_in_params
,
86 rte_pipeline_free(pipeline
);
87 return -CHECK_TABLE_PORT_CONFIG
;
91 struct rte_pipeline_table_params table_params
= {
93 .arg_create
= table_args
,
95 .f_action_miss
= NULL
,
97 .action_data_size
= 0,
100 if (rte_pipeline_table_create(pipeline
, &table_params
,
102 rte_pipeline_free(pipeline
);
103 return -CHECK_TABLE_TABLE_CONFIG
;
106 /* Create output ports */
107 ring_params_tx
.ring
= RING_TX
;
109 struct rte_pipeline_port_out_params ring_out_params
= {
110 .ops
= &rte_port_ring_writer_ops
,
111 .arg_create
= (void *)&ring_params_tx
,
115 if (rte_pipeline_port_out_create(pipeline
, &ring_out_params
,
116 &ring_out_id
) != 0) {
117 rte_pipeline_free(pipeline
);
118 return -CHECK_TABLE_PORT_CONFIG
;
121 ring_params_tx
.ring
= RING_TX_2
;
123 if (rte_pipeline_port_out_create(pipeline
, &ring_out_params
,
124 &ring_out_2_id
) != 0) {
125 rte_pipeline_free(pipeline
);
126 return -CHECK_TABLE_PORT_CONFIG
;
129 /* Add entry to the table */
130 struct rte_pipeline_table_entry default_entry
= {
131 .action
= RTE_PIPELINE_ACTION_DROP
,
132 {.table_id
= ring_out_id
},
135 struct rte_pipeline_table_entry table_entry
= {
136 .action
= RTE_PIPELINE_ACTION_PORT
,
137 {.table_id
= ring_out_id
},
140 struct rte_pipeline_table_entry
*default_entry_ptr
, *entry_ptr
;
144 if (rte_pipeline_table_default_entry_add(pipeline
, table_id
,
145 &default_entry
, &default_entry_ptr
) != 0) {
146 rte_pipeline_free(pipeline
);
147 return -CHECK_TABLE_DEFAULT_ENTRY_ADD
;
150 if (rte_pipeline_table_entry_add(pipeline
, table_id
,
151 key
? key
: &table_entry
, &table_entry
, &key_found
,
153 rte_pipeline_free(pipeline
);
154 return -CHECK_TABLE_ENTRY_ADD
;
157 /* Create connections and check consistency */
158 if (rte_pipeline_port_in_connect_to_table(pipeline
, ring_in_id
,
160 rte_pipeline_free(pipeline
);
161 return -CHECK_TABLE_CONNECT
;
164 if (rte_pipeline_port_in_enable(pipeline
, ring_in_id
) != 0) {
165 rte_pipeline_free(pipeline
);
166 return -CHECK_TABLE_PORT_ENABLE
;
169 if (rte_pipeline_check(pipeline
) != 0) {
170 rte_pipeline_free(pipeline
);
171 return -CHECK_TABLE_CONSISTENCY
;
176 /* Flow test - All hits */
177 if (table_packets
->n_hit_packets
) {
178 for (i
= 0; i
< table_packets
->n_hit_packets
; i
++)
179 RING_ENQUEUE(RING_RX
, table_packets
->hit_packet
[i
]);
181 RUN_PIPELINE(pipeline
);
183 VERIFY_TRAFFIC(RING_TX
, table_packets
->n_hit_packets
,
184 table_packets
->n_hit_packets
);
187 /* Flow test - All misses */
188 if (table_packets
->n_miss_packets
) {
189 for (i
= 0; i
< table_packets
->n_miss_packets
; i
++)
190 RING_ENQUEUE(RING_RX
, table_packets
->miss_packet
[i
]);
192 RUN_PIPELINE(pipeline
);
194 VERIFY_TRAFFIC(RING_TX
, table_packets
->n_miss_packets
, 0);
197 /* Flow test - Half hits, half misses */
198 if (table_packets
->n_hit_packets
&& table_packets
->n_miss_packets
) {
199 for (i
= 0; i
< (table_packets
->n_hit_packets
) / 2; i
++)
200 RING_ENQUEUE(RING_RX
, table_packets
->hit_packet
[i
]);
202 for (i
= 0; i
< (table_packets
->n_miss_packets
) / 2; i
++)
203 RING_ENQUEUE(RING_RX
, table_packets
->miss_packet
[i
]);
205 RUN_PIPELINE(pipeline
);
206 VERIFY_TRAFFIC(RING_TX
, table_packets
->n_hit_packets
,
207 table_packets
->n_hit_packets
/ 2);
210 /* Flow test - Single packet */
211 if (table_packets
->n_hit_packets
) {
212 RING_ENQUEUE(RING_RX
, table_packets
->hit_packet
[0]);
213 RUN_PIPELINE(pipeline
);
214 VERIFY_TRAFFIC(RING_TX
, table_packets
->n_hit_packets
, 1);
216 if (table_packets
->n_miss_packets
) {
217 RING_ENQUEUE(RING_RX
, table_packets
->miss_packet
[0]);
218 RUN_PIPELINE(pipeline
);
219 VERIFY_TRAFFIC(RING_TX
, table_packets
->n_miss_packets
, 0);
223 /* Change table entry action */
224 printf("Change entry action\n");
225 table_entry
.table_id
= ring_out_2_id
;
227 if (rte_pipeline_table_default_entry_add(pipeline
, table_id
,
228 &default_entry
, &default_entry_ptr
) != 0) {
229 rte_pipeline_free(pipeline
);
230 return -CHECK_TABLE_ENTRY_ADD
;
233 if (rte_pipeline_table_entry_add(pipeline
, table_id
,
234 key
? key
: &table_entry
, &table_entry
, &key_found
,
236 rte_pipeline_free(pipeline
);
237 return -CHECK_TABLE_ENTRY_ADD
;
240 /* Check that traffic destination has changed */
241 if (table_packets
->n_hit_packets
) {
242 for (i
= 0; i
< table_packets
->n_hit_packets
; i
++)
243 RING_ENQUEUE(RING_RX
, table_packets
->hit_packet
[i
]);
245 RUN_PIPELINE(pipeline
);
246 VERIFY_TRAFFIC(RING_TX
, table_packets
->n_hit_packets
, 0);
247 VERIFY_TRAFFIC(RING_TX_2
, table_packets
->n_hit_packets
,
248 table_packets
->n_hit_packets
);
251 printf("delete entry\n");
252 /* Delete table entry */
253 rte_pipeline_table_entry_delete(pipeline
, table_id
,
254 key
? key
: &table_entry
, &key_found
, NULL
);
256 rte_pipeline_free(pipeline
);
263 test_table_stub_combined(void)
266 struct table_packets table_packets
;
268 printf("--------------\n");
269 printf("RUNNING TEST - %s\n", __func__
);
270 printf("--------------\n");
271 for (i
= 0; i
< N_PACKETS
; i
++)
272 table_packets
.hit_packet
[i
] = i
;
274 table_packets
.n_hit_packets
= N_PACKETS
;
275 table_packets
.n_miss_packets
= 0;
277 status
= test_table_type(&rte_table_stub_ops
, NULL
, NULL
,
278 &table_packets
, NULL
, 1);
279 VERIFY(status
, CHECK_TABLE_OK
);
285 test_table_lpm_combined(void)
290 struct rte_table_lpm_params lpm_params
= {
293 .number_tbl8s
= 1 << 8,
295 .entry_unique_size
= 8,
296 .offset
= APP_METADATA_OFFSET(0),
299 struct rte_table_lpm_key lpm_key
= {
304 struct table_packets table_packets
;
306 printf("--------------\n");
307 printf("RUNNING TEST - %s\n", __func__
);
308 printf("--------------\n");
310 for (i
= 0; i
< N_PACKETS
; i
++)
311 table_packets
.hit_packet
[i
] = 0xadadadad;
313 for (i
= 0; i
< N_PACKETS
; i
++)
314 table_packets
.miss_packet
[i
] = 0xfefefefe;
316 table_packets
.n_hit_packets
= N_PACKETS
;
317 table_packets
.n_miss_packets
= N_PACKETS
;
319 status
= test_table_type(&rte_table_lpm_ops
, (void *)&lpm_params
,
320 (void *)&lpm_key
, &table_packets
, NULL
, 0);
321 VERIFY(status
, CHECK_TABLE_OK
);
323 /* Invalid parameters */
324 lpm_params
.n_rules
= 0;
326 status
= test_table_type(&rte_table_lpm_ops
, (void *)&lpm_params
,
327 (void *)&lpm_key
, &table_packets
, NULL
, 0);
328 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
330 lpm_params
.n_rules
= 1 << 24;
333 status
= test_table_type(&rte_table_lpm_ops
, (void *)&lpm_params
,
334 (void *)&lpm_key
, &table_packets
, NULL
, 0);
335 VERIFY(status
, CHECK_TABLE_ENTRY_ADD
);
339 status
= test_table_type(&rte_table_lpm_ops
, (void *)&lpm_params
,
340 (void *)&lpm_key
, &table_packets
, NULL
, 0);
341 VERIFY(status
, CHECK_TABLE_ENTRY_ADD
);
347 test_table_lpm_ipv6_combined(void)
352 struct rte_table_lpm_ipv6_params lpm_ipv6_params
= {
355 .number_tbl8s
= 1 << 13,
356 .entry_unique_size
= 8,
357 .offset
= APP_METADATA_OFFSET(32),
360 struct rte_table_lpm_ipv6_key lpm_ipv6_key
= {
363 memset(lpm_ipv6_key
.ip
, 0xad, 16);
365 struct table_packets table_packets
;
367 printf("--------------\n");
368 printf("RUNNING TEST - %s\n", __func__
);
369 printf("--------------\n");
370 for (i
= 0; i
< N_PACKETS
; i
++)
371 table_packets
.hit_packet
[i
] = 0xadadadad;
373 for (i
= 0; i
< N_PACKETS
; i
++)
374 table_packets
.miss_packet
[i
] = 0xadadadab;
376 table_packets
.n_hit_packets
= N_PACKETS
;
377 table_packets
.n_miss_packets
= N_PACKETS
;
379 status
= test_table_type(&rte_table_lpm_ipv6_ops
,
380 (void *)&lpm_ipv6_params
,
381 (void *)&lpm_ipv6_key
, &table_packets
, NULL
, 0);
382 VERIFY(status
, CHECK_TABLE_OK
);
384 /* Invalid parameters */
385 lpm_ipv6_params
.n_rules
= 0;
387 status
= test_table_type(&rte_table_lpm_ipv6_ops
,
388 (void *)&lpm_ipv6_params
,
389 (void *)&lpm_ipv6_key
, &table_packets
, NULL
, 0);
390 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
392 lpm_ipv6_params
.n_rules
= 1 << 24;
393 lpm_ipv6_key
.depth
= 0;
395 status
= test_table_type(&rte_table_lpm_ipv6_ops
,
396 (void *)&lpm_ipv6_params
,
397 (void *)&lpm_ipv6_key
, &table_packets
, NULL
, 0);
398 VERIFY(status
, CHECK_TABLE_ENTRY_ADD
);
400 lpm_ipv6_key
.depth
= 129;
401 status
= test_table_type(&rte_table_lpm_ipv6_ops
,
402 (void *)&lpm_ipv6_params
,
403 (void *)&lpm_ipv6_key
, &table_packets
, NULL
, 0);
404 VERIFY(status
, CHECK_TABLE_ENTRY_ADD
);
410 test_table_hash8lru(void)
415 struct rte_table_hash_params key8lru_params
= {
418 .key_offset
= APP_METADATA_OFFSET(32),
421 .n_buckets
= 1 << 16,
422 .f_hash
= pipeline_test_hash
,
427 uint32_t *k8lru
= (uint32_t *) key8lru
;
429 memset(key8lru
, 0, sizeof(key8lru
));
430 k8lru
[0] = 0xadadadad;
432 struct table_packets table_packets
;
434 printf("--------------\n");
435 printf("RUNNING TEST - %s\n", __func__
);
436 printf("--------------\n");
437 for (i
= 0; i
< 50; i
++)
438 table_packets
.hit_packet
[i
] = 0xadadadad;
440 for (i
= 0; i
< 50; i
++)
441 table_packets
.miss_packet
[i
] = 0xfefefefe;
443 table_packets
.n_hit_packets
= 50;
444 table_packets
.n_miss_packets
= 50;
446 status
= test_table_type(&rte_table_hash_key8_lru_ops
,
447 (void *)&key8lru_params
, (void *)key8lru
, &table_packets
,
449 VERIFY(status
, CHECK_TABLE_OK
);
451 /* Invalid parameters */
452 key8lru_params
.n_keys
= 0;
454 status
= test_table_type(&rte_table_hash_key8_lru_ops
,
455 (void *)&key8lru_params
, (void *)key8lru
, &table_packets
,
457 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
459 key8lru_params
.n_keys
= 1<<16;
460 key8lru_params
.f_hash
= NULL
;
462 status
= test_table_type(&rte_table_hash_key8_lru_ops
,
463 (void *)&key8lru_params
, (void *)key8lru
, &table_packets
,
465 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
471 test_table_hash16lru(void)
476 struct rte_table_hash_params key16lru_params
= {
479 .key_offset
= APP_METADATA_OFFSET(32),
482 .n_buckets
= 1 << 16,
483 .f_hash
= pipeline_test_hash
,
487 uint8_t key16lru
[16];
488 uint32_t *k16lru
= (uint32_t *) key16lru
;
490 memset(key16lru
, 0, sizeof(key16lru
));
491 k16lru
[0] = 0xadadadad;
493 struct table_packets table_packets
;
495 printf("--------------\n");
496 printf("RUNNING TEST - %s\n", __func__
);
497 printf("--------------\n");
498 for (i
= 0; i
< 50; i
++)
499 table_packets
.hit_packet
[i
] = 0xadadadad;
501 for (i
= 0; i
< 50; i
++)
502 table_packets
.miss_packet
[i
] = 0xfefefefe;
504 table_packets
.n_hit_packets
= 50;
505 table_packets
.n_miss_packets
= 50;
507 status
= test_table_type(&rte_table_hash_key16_lru_ops
,
508 (void *)&key16lru_params
, (void *)key16lru
, &table_packets
,
510 VERIFY(status
, CHECK_TABLE_OK
);
512 /* Invalid parameters */
513 key16lru_params
.n_keys
= 0;
515 status
= test_table_type(&rte_table_hash_key16_lru_ops
,
516 (void *)&key16lru_params
, (void *)key16lru
, &table_packets
,
518 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
520 key16lru_params
.n_keys
= 1<<16;
521 key16lru_params
.f_hash
= NULL
;
523 status
= test_table_type(&rte_table_hash_key16_lru_ops
,
524 (void *)&key16lru_params
, (void *)key16lru
, &table_packets
,
526 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
532 test_table_hash32lru(void)
537 struct rte_table_hash_params key32lru_params
= {
540 .key_offset
= APP_METADATA_OFFSET(32),
543 .n_buckets
= 1 << 16,
544 .f_hash
= pipeline_test_hash
,
548 uint8_t key32lru
[32];
549 uint32_t *k32lru
= (uint32_t *) key32lru
;
551 memset(key32lru
, 0, sizeof(key32lru
));
552 k32lru
[0] = 0xadadadad;
554 struct table_packets table_packets
;
556 printf("--------------\n");
557 printf("RUNNING TEST - %s\n", __func__
);
558 printf("--------------\n");
559 for (i
= 0; i
< 50; i
++)
560 table_packets
.hit_packet
[i
] = 0xadadadad;
562 for (i
= 0; i
< 50; i
++)
563 table_packets
.miss_packet
[i
] = 0xbdadadad;
565 table_packets
.n_hit_packets
= 50;
566 table_packets
.n_miss_packets
= 50;
568 status
= test_table_type(&rte_table_hash_key32_lru_ops
,
569 (void *)&key32lru_params
, (void *)key32lru
, &table_packets
,
571 VERIFY(status
, CHECK_TABLE_OK
);
573 /* Invalid parameters */
574 key32lru_params
.n_keys
= 0;
576 status
= test_table_type(&rte_table_hash_key32_lru_ops
,
577 (void *)&key32lru_params
, (void *)key32lru
, &table_packets
,
579 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
581 key32lru_params
.n_keys
= 1<<16;
582 key32lru_params
.f_hash
= NULL
;
584 status
= test_table_type(&rte_table_hash_key32_lru_ops
,
585 (void *)&key32lru_params
, (void *)key32lru
, &table_packets
,
587 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
593 test_table_hash8ext(void)
598 struct rte_table_hash_params key8ext_params
= {
601 .key_offset
= APP_METADATA_OFFSET(32),
604 .n_buckets
= 1 << 16,
605 .f_hash
= pipeline_test_hash
,
610 uint32_t *k8ext
= (uint32_t *) key8ext
;
612 memset(key8ext
, 0, sizeof(key8ext
));
613 k8ext
[0] = 0xadadadad;
615 struct table_packets table_packets
;
617 printf("--------------\n");
618 printf("RUNNING TEST - %s\n", __func__
);
619 printf("--------------\n");
620 for (i
= 0; i
< 50; i
++)
621 table_packets
.hit_packet
[i
] = 0xadadadad;
623 for (i
= 0; i
< 50; i
++)
624 table_packets
.miss_packet
[i
] = 0xbdadadad;
626 table_packets
.n_hit_packets
= 50;
627 table_packets
.n_miss_packets
= 50;
629 status
= test_table_type(&rte_table_hash_key8_ext_ops
,
630 (void *)&key8ext_params
, (void *)key8ext
, &table_packets
,
632 VERIFY(status
, CHECK_TABLE_OK
);
634 /* Invalid parameters */
635 key8ext_params
.n_keys
= 0;
637 status
= test_table_type(&rte_table_hash_key8_ext_ops
,
638 (void *)&key8ext_params
, (void *)key8ext
, &table_packets
,
640 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
642 key8ext_params
.n_keys
= 1<<16;
643 key8ext_params
.f_hash
= NULL
;
645 status
= test_table_type(&rte_table_hash_key8_ext_ops
,
646 (void *)&key8ext_params
, (void *)key8ext
, &table_packets
,
648 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
654 test_table_hash16ext(void)
659 struct rte_table_hash_params key16ext_params
= {
662 .key_offset
= APP_METADATA_OFFSET(32),
665 .n_buckets
= 1 << 16,
666 .f_hash
= pipeline_test_hash
,
670 uint8_t key16ext
[16];
671 uint32_t *k16ext
= (uint32_t *) key16ext
;
673 memset(key16ext
, 0, sizeof(key16ext
));
674 k16ext
[0] = 0xadadadad;
676 struct table_packets table_packets
;
678 printf("--------------\n");
679 printf("RUNNING TEST - %s\n", __func__
);
680 printf("--------------\n");
681 for (i
= 0; i
< 50; i
++)
682 table_packets
.hit_packet
[i
] = 0xadadadad;
684 for (i
= 0; i
< 50; i
++)
685 table_packets
.miss_packet
[i
] = 0xbdadadad;
687 table_packets
.n_hit_packets
= 50;
688 table_packets
.n_miss_packets
= 50;
690 status
= test_table_type(&rte_table_hash_key16_ext_ops
,
691 (void *)&key16ext_params
, (void *)key16ext
, &table_packets
,
693 VERIFY(status
, CHECK_TABLE_OK
);
695 /* Invalid parameters */
696 key16ext_params
.n_keys
= 0;
698 status
= test_table_type(&rte_table_hash_key16_ext_ops
,
699 (void *)&key16ext_params
, (void *)key16ext
, &table_packets
,
701 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
703 key16ext_params
.n_keys
= 1<<16;
704 key16ext_params
.f_hash
= NULL
;
706 status
= test_table_type(&rte_table_hash_key16_ext_ops
,
707 (void *)&key16ext_params
, (void *)key16ext
, &table_packets
,
709 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
715 test_table_hash32ext(void)
720 struct rte_table_hash_params key32ext_params
= {
723 .key_offset
= APP_METADATA_OFFSET(32),
726 .n_buckets
= 1 << 16,
727 .f_hash
= pipeline_test_hash
,
731 uint8_t key32ext
[32];
732 uint32_t *k32ext
= (uint32_t *) key32ext
;
734 memset(key32ext
, 0, sizeof(key32ext
));
735 k32ext
[0] = 0xadadadad;
737 struct table_packets table_packets
;
739 printf("--------------\n");
740 printf("RUNNING TEST - %s\n", __func__
);
741 printf("--------------\n");
742 for (i
= 0; i
< 50; i
++)
743 table_packets
.hit_packet
[i
] = 0xadadadad;
745 for (i
= 0; i
< 50; i
++)
746 table_packets
.miss_packet
[i
] = 0xbdadadad;
748 table_packets
.n_hit_packets
= 50;
749 table_packets
.n_miss_packets
= 50;
751 status
= test_table_type(&rte_table_hash_key32_ext_ops
,
752 (void *)&key32ext_params
, (void *)key32ext
, &table_packets
,
754 VERIFY(status
, CHECK_TABLE_OK
);
756 /* Invalid parameters */
757 key32ext_params
.n_keys
= 0;
759 status
= test_table_type(&rte_table_hash_key32_ext_ops
,
760 (void *)&key32ext_params
, (void *)key32ext
, &table_packets
,
762 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
764 key32ext_params
.n_keys
= 1<<16;
765 key32ext_params
.f_hash
= NULL
;
767 status
= test_table_type(&rte_table_hash_key32_ext_ops
,
768 (void *)&key32ext_params
, (void *)key32ext
, &table_packets
,
770 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
776 test_table_hash_cuckoo_combined(void)
781 struct rte_table_hash_cuckoo_params cuckoo_params
= {
784 .key_offset
= APP_METADATA_OFFSET(32),
787 .n_buckets
= 1 << 16,
788 .f_hash
= pipeline_test_hash_cuckoo
,
792 uint8_t key_cuckoo
[32];
793 uint32_t *kcuckoo
= (uint32_t *) key_cuckoo
;
795 memset(key_cuckoo
, 0, sizeof(key_cuckoo
));
796 kcuckoo
[0] = 0xadadadad;
798 struct table_packets table_packets
;
800 printf("--------------\n");
801 printf("RUNNING TEST - %s\n", __func__
);
802 printf("--------------\n");
803 for (i
= 0; i
< 50; i
++)
804 table_packets
.hit_packet
[i
] = 0xadadadad;
806 for (i
= 0; i
< 50; i
++)
807 table_packets
.miss_packet
[i
] = 0xbdadadad;
809 table_packets
.n_hit_packets
= 50;
810 table_packets
.n_miss_packets
= 50;
812 status
= test_table_type(&rte_table_hash_cuckoo_ops
,
813 (void *)&cuckoo_params
, (void *)key_cuckoo
, &table_packets
,
815 VERIFY(status
, CHECK_TABLE_OK
);
817 /* Invalid parameters */
818 cuckoo_params
.key_size
= 0;
820 status
= test_table_type(&rte_table_hash_cuckoo_ops
,
821 (void *)&cuckoo_params
, (void *)key_cuckoo
, &table_packets
,
823 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
825 cuckoo_params
.key_size
= 32;
826 cuckoo_params
.n_keys
= 0;
828 status
= test_table_type(&rte_table_hash_cuckoo_ops
,
829 (void *)&cuckoo_params
, (void *)key_cuckoo
, &table_packets
,
831 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);
833 cuckoo_params
.n_keys
= 1<<16;
834 cuckoo_params
.f_hash
= NULL
;
836 status
= test_table_type(&rte_table_hash_cuckoo_ops
,
837 (void *)&cuckoo_params
, (void *)key_cuckoo
, &table_packets
,
839 VERIFY(status
, CHECK_TABLE_TABLE_CONFIG
);