| 217 | } |
| 218 | |
| 219 | static void |
| 220 | populate_hash_table(const struct rte_hash *h, const struct shared_info *info) |
| 221 | { |
| 222 | unsigned int i; |
| 223 | int32_t ret; |
| 224 | uint32_t ip_dst; |
| 225 | uint32_t num_flows_node = 0; |
| 226 | uint64_t target_node; |
| 227 | |
| 228 | /* Add flows in table */ |
| 229 | for (i = 0; i < info->num_flows; i++) { |
| 230 | target_node = i % info->num_nodes; |
| 231 | if (target_node != node_id) |
| 232 | continue; |
| 233 | |
| 234 | ip_dst = rte_cpu_to_be_32(i); |
| 235 | |
| 236 | ret = rte_hash_add_key(h, (void *) &ip_dst); |
| 237 | if (ret < 0) |
| 238 | rte_exit(EXIT_FAILURE, "Unable to add entry %u " |
| 239 | "in hash table\n", i); |
| 240 | else |
| 241 | num_flows_node++; |
| 242 | |
| 243 | } |
| 244 | |
| 245 | printf("Hash table: Adding 0x%x keys\n", num_flows_node); |
| 246 | } |
| 247 | /* >8 End of creation of hash table. */ |
| 248 | |
| 249 | /* |
no test coverage detected