+static int
+test_toeplitz_hash_gfni_bulk(void)
+{
+ uint32_t i, j;
+ union rte_thash_tuple tuple[2];
+ uint8_t *tuples[2];
+ uint32_t rss[2] = { 0 };
+ uint64_t rss_key_matrixes[RTE_DIM(default_rss_key)];
+
+ if (!rte_thash_gfni_supported())
+ return TEST_SKIPPED;
+
+ /* Convert RSS key into matrixes */
+ rte_thash_complete_matrix(rss_key_matrixes, default_rss_key,
+ RTE_DIM(default_rss_key));
+
+ for (i = 0; i < RTE_DIM(tuples); i++) {
+ /* allocate memory enough for a biggest tuple */
+ tuples[i] = rte_zmalloc(NULL, RTE_THASH_V6_L4_LEN * 4, 0);
+ if (tuples[i] == NULL)
+ return -TEST_FAILED;
+ }
+
+ for (i = 0; i < RTE_MIN(RTE_DIM(v4_tbl), RTE_DIM(v6_tbl)); i++) {
+ /*Load IPv4 headers and copy it into the corresponding tuple*/
+ tuple[0].v4.src_addr = rte_cpu_to_be_32(v4_tbl[i].src_ip);
+ tuple[0].v4.dst_addr = rte_cpu_to_be_32(v4_tbl[i].dst_ip);
+ tuple[0].v4.sport = rte_cpu_to_be_16(v4_tbl[i].dst_port);
+ tuple[0].v4.dport = rte_cpu_to_be_16(v4_tbl[i].src_port);
+ rte_memcpy(tuples[0], &tuple[0], RTE_THASH_V4_L4_LEN * 4);
+
+ /*Load IPv6 headers and copy it into the corresponding tuple*/
+ for (j = 0; j < RTE_DIM(tuple[1].v6.src_addr); j++)
+ tuple[1].v6.src_addr[j] = v6_tbl[i].src_ip[j];
+ for (j = 0; j < RTE_DIM(tuple[1].v6.dst_addr); j++)
+ tuple[1].v6.dst_addr[j] = v6_tbl[i].dst_ip[j];
+ tuple[1].v6.sport = rte_cpu_to_be_16(v6_tbl[i].dst_port);
+ tuple[1].v6.dport = rte_cpu_to_be_16(v6_tbl[i].src_port);
+ rte_memcpy(tuples[1], &tuple[1], RTE_THASH_V6_L4_LEN * 4);
+
+ rte_thash_gfni_bulk(rss_key_matrixes, RTE_THASH_V6_L4_LEN * 4,
+ tuples, rss, 2);
+
+ if ((rss[RSS_V4_IDX] != v4_tbl[i].hash_l3l4) ||
+ (rss[RSS_V6_IDX] != v6_tbl[i].hash_l3l4))
+ return -TEST_FAILED;
+ }
+
+ return TEST_SUCCESS;
+}
+