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

Function populate_hash_table

dpdk/examples/server_node_efd/efd_node/node.c:219–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219static void
220populate_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/*

Callers 1

mainFunction · 0.85

Calls 3

rte_hash_add_keyFunction · 0.85
rte_exitFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected