| 297 | }; |
| 298 | |
| 299 | static int |
| 300 | test_toeplitz_hash_gfni_bulk(void) |
| 301 | { |
| 302 | uint32_t i, j; |
| 303 | union rte_thash_tuple tuple[2]; |
| 304 | uint8_t *tuples[2]; |
| 305 | uint32_t rss[2] = { 0 }; |
| 306 | uint64_t rss_key_matrixes[RTE_DIM(default_rss_key)]; |
| 307 | |
| 308 | if (!rte_thash_gfni_supported()) |
| 309 | return TEST_SKIPPED; |
| 310 | |
| 311 | /* Convert RSS key into matrixes */ |
| 312 | rte_thash_complete_matrix(rss_key_matrixes, default_rss_key, |
| 313 | RTE_DIM(default_rss_key)); |
| 314 | |
| 315 | for (i = 0; i < RTE_DIM(tuples); i++) { |
| 316 | /* allocate memory enough for a biggest tuple */ |
| 317 | tuples[i] = rte_zmalloc(NULL, RTE_THASH_V6_L4_LEN * 4, 0); |
| 318 | if (tuples[i] == NULL) |
| 319 | return -TEST_FAILED; |
| 320 | } |
| 321 | |
| 322 | for (i = 0; i < RTE_MIN(RTE_DIM(v4_tbl), RTE_DIM(v6_tbl)); i++) { |
| 323 | /*Load IPv4 headers and copy it into the corresponding tuple*/ |
| 324 | tuple[0].v4.src_addr = rte_cpu_to_be_32(v4_tbl[i].src_ip); |
| 325 | tuple[0].v4.dst_addr = rte_cpu_to_be_32(v4_tbl[i].dst_ip); |
| 326 | tuple[0].v4.sport = rte_cpu_to_be_16(v4_tbl[i].dst_port); |
| 327 | tuple[0].v4.dport = rte_cpu_to_be_16(v4_tbl[i].src_port); |
| 328 | rte_memcpy(tuples[0], &tuple[0], RTE_THASH_V4_L4_LEN * 4); |
| 329 | |
| 330 | /*Load IPv6 headers and copy it into the corresponding tuple*/ |
| 331 | for (j = 0; j < RTE_DIM(tuple[1].v6.src_addr); j++) |
| 332 | tuple[1].v6.src_addr[j] = v6_tbl[i].src_ip[j]; |
| 333 | for (j = 0; j < RTE_DIM(tuple[1].v6.dst_addr); j++) |
| 334 | tuple[1].v6.dst_addr[j] = v6_tbl[i].dst_ip[j]; |
| 335 | tuple[1].v6.sport = rte_cpu_to_be_16(v6_tbl[i].dst_port); |
| 336 | tuple[1].v6.dport = rte_cpu_to_be_16(v6_tbl[i].src_port); |
| 337 | rte_memcpy(tuples[1], &tuple[1], RTE_THASH_V6_L4_LEN * 4); |
| 338 | |
| 339 | rte_thash_gfni_bulk(rss_key_matrixes, RTE_THASH_V6_L4_LEN * 4, |
| 340 | tuples, rss, 2); |
| 341 | |
| 342 | if ((rss[RSS_V4_IDX] != v4_tbl[i].hash_l3l4) || |
| 343 | (rss[RSS_V6_IDX] != v6_tbl[i].hash_l3l4)) |
| 344 | return -TEST_FAILED; |
| 345 | } |
| 346 | |
| 347 | return TEST_SUCCESS; |
| 348 | } |
| 349 | |
| 350 | static int |
| 351 | test_big_tuple_gfni(void) |
nothing calls this directly
no test coverage detected