| 196 | } |
| 197 | |
| 198 | static int |
| 199 | test_hash_readwrite_functional(int use_htm, int use_rw_lf, int use_ext) |
| 200 | { |
| 201 | unsigned int i; |
| 202 | const void *next_key; |
| 203 | void *next_data; |
| 204 | uint32_t iter = 0; |
| 205 | |
| 206 | uint32_t duplicated_keys = 0; |
| 207 | uint32_t lost_keys = 0; |
| 208 | int use_jhash = 1; |
| 209 | int worker_cnt = rte_lcore_count() - 1; |
| 210 | uint32_t tot_insert = 0; |
| 211 | |
| 212 | __atomic_store_n(&gcycles, 0, __ATOMIC_RELAXED); |
| 213 | __atomic_store_n(&ginsertions, 0, __ATOMIC_RELAXED); |
| 214 | |
| 215 | if (init_params(use_ext, use_htm, use_rw_lf, use_jhash) != 0) |
| 216 | goto err; |
| 217 | |
| 218 | if (use_ext) |
| 219 | tot_insert = TOTAL_INSERT_EXT; |
| 220 | else |
| 221 | tot_insert = TOTAL_INSERT; |
| 222 | |
| 223 | tbl_rw_test_param.num_insert = |
| 224 | tot_insert / worker_cnt; |
| 225 | |
| 226 | tbl_rw_test_param.rounded_tot_insert = |
| 227 | tbl_rw_test_param.num_insert * worker_cnt; |
| 228 | |
| 229 | printf("\nHTM = %d, RW-LF = %d, EXT-Table = %d\n", |
| 230 | use_htm, use_rw_lf, use_ext); |
| 231 | printf("++++++++Start function tests:+++++++++\n"); |
| 232 | |
| 233 | /* Fire all threads. */ |
| 234 | rte_eal_mp_remote_launch(test_hash_readwrite_worker, |
| 235 | NULL, SKIP_MAIN); |
| 236 | rte_eal_mp_wait_lcore(); |
| 237 | |
| 238 | while (rte_hash_iterate(tbl_rw_test_param.h, &next_key, |
| 239 | &next_data, &iter) >= 0) { |
| 240 | /* Search for the key in the list of keys added .*/ |
| 241 | i = *(const uint32_t *)next_key; |
| 242 | tbl_rw_test_param.found[i]++; |
| 243 | } |
| 244 | |
| 245 | for (i = 0; i < tbl_rw_test_param.rounded_tot_insert; i++) { |
| 246 | if (tbl_rw_test_param.keys[i] != RTE_RWTEST_FAIL) { |
| 247 | if (tbl_rw_test_param.found[i] > 1) { |
| 248 | duplicated_keys++; |
| 249 | break; |
| 250 | } |
| 251 | if (tbl_rw_test_param.found[i] == 0) { |
| 252 | lost_keys++; |
| 253 | printf("key %d is lost\n", i); |
| 254 | break; |
| 255 | } |
no test coverage detected