MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_toeplitz_hash_gfni

Function test_toeplitz_hash_gfni

dpdk/app/test/test_thash.c:176–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176static int
177test_toeplitz_hash_gfni(void)
178{
179 uint32_t i, j;
180 union rte_thash_tuple tuple;
181 uint32_t rss_l3, rss_l3l4;
182 uint64_t rss_key_matrixes[RTE_DIM(default_rss_key)];
183
184 if (!rte_thash_gfni_supported())
185 return TEST_SKIPPED;
186
187 /* Convert RSS key into matrixes */
188 rte_thash_complete_matrix(rss_key_matrixes, default_rss_key,
189 RTE_DIM(default_rss_key));
190
191 for (i = 0; i < RTE_DIM(v4_tbl); i++) {
192 tuple.v4.src_addr = rte_cpu_to_be_32(v4_tbl[i].src_ip);
193 tuple.v4.dst_addr = rte_cpu_to_be_32(v4_tbl[i].dst_ip);
194 tuple.v4.sport = rte_cpu_to_be_16(v4_tbl[i].dst_port);
195 tuple.v4.dport = rte_cpu_to_be_16(v4_tbl[i].src_port);
196
197 rss_l3 = rte_thash_gfni(rss_key_matrixes, (uint8_t *)&tuple,
198 RTE_THASH_V4_L3_LEN * 4);
199 rss_l3l4 = rte_thash_gfni(rss_key_matrixes, (uint8_t *)&tuple,
200 RTE_THASH_V4_L4_LEN * 4);
201 if ((rss_l3 != v4_tbl[i].hash_l3) ||
202 (rss_l3l4 != v4_tbl[i].hash_l3l4))
203 return -TEST_FAILED;
204 }
205
206 for (i = 0; i < RTE_DIM(v6_tbl); i++) {
207 for (j = 0; j < RTE_DIM(tuple.v6.src_addr); j++)
208 tuple.v6.src_addr[j] = v6_tbl[i].src_ip[j];
209 for (j = 0; j < RTE_DIM(tuple.v6.dst_addr); j++)
210 tuple.v6.dst_addr[j] = v6_tbl[i].dst_ip[j];
211 tuple.v6.sport = rte_cpu_to_be_16(v6_tbl[i].dst_port);
212 tuple.v6.dport = rte_cpu_to_be_16(v6_tbl[i].src_port);
213 rss_l3 = rte_thash_gfni(rss_key_matrixes, (uint8_t *)&tuple,
214 RTE_THASH_V6_L3_LEN * 4);
215 rss_l3l4 = rte_thash_gfni(rss_key_matrixes, (uint8_t *)&tuple,
216 RTE_THASH_V6_L4_LEN * 4);
217 if ((rss_l3 != v6_tbl[i].hash_l3) ||
218 (rss_l3l4 != v6_tbl[i].hash_l3l4))
219 return -TEST_FAILED;
220 }
221
222 return TEST_SUCCESS;
223}
224
225#define DATA_SZ 4
226#define ITER 1000

Callers

nothing calls this directly

Calls 3

rte_thash_gfni_supportedFunction · 0.85
rte_thash_gfniFunction · 0.50

Tested by

no test coverage detected