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

Function populate_ipv4_flow_into_table

dpdk/examples/l3fwd/l3fwd_em.c:369–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367#define BIT_8_TO_15 0x0000ff00
368
369static inline void
370populate_ipv4_flow_into_table(const struct rte_hash *h)
371{
372 int i;
373 int32_t ret;
374 struct rte_eth_dev_info dev_info;
375 char srcbuf[INET6_ADDRSTRLEN];
376 char dstbuf[INET6_ADDRSTRLEN];
377
378 mask0 = (rte_xmm_t){.u32 = {BIT_8_TO_15, ALL_32_BITS,
379 ALL_32_BITS, ALL_32_BITS} };
380
381 for (i = 0; i < route_num_v4; i++) {
382 struct em_rule *entry;
383 union ipv4_5tuple_host newkey;
384 struct in_addr src;
385 struct in_addr dst;
386
387 if ((1 << em_route_base_v4[i].if_out &
388 enabled_port_mask) == 0)
389 continue;
390
391 entry = &em_route_base_v4[i];
392 convert_ipv4_5tuple(&(entry->v4_key), &newkey);
393 ret = rte_hash_add_key(h, (void *) &newkey);
394 if (ret < 0) {
395 rte_exit(EXIT_FAILURE, "Unable to add entry %" PRIu32
396 " to the l3fwd hash.\n", i);
397 }
398 ipv4_l3fwd_out_if[ret] = entry->if_out;
399 ret = rte_eth_dev_info_get(em_route_base_v4[i].if_out,
400 &dev_info);
401 if (ret != 0)
402 rte_exit(EXIT_FAILURE,
403 "Error during getting device (port %u) info: %s\n",
404 em_route_base_v4[i].if_out, strerror(-ret));
405
406 src.s_addr = htonl(em_route_base_v4[i].v4_key.ip_src);
407 dst.s_addr = htonl(em_route_base_v4[i].v4_key.ip_dst);
408 printf("EM: Adding route %s, %s, %d, %d, %d (%d) [%s]\n",
409 inet_ntop(AF_INET, &dst, dstbuf, sizeof(dstbuf)),
410 inet_ntop(AF_INET, &src, srcbuf, sizeof(srcbuf)),
411 em_route_base_v4[i].v4_key.port_dst,
412 em_route_base_v4[i].v4_key.port_src,
413 em_route_base_v4[i].v4_key.proto,
414 em_route_base_v4[i].if_out, rte_dev_name(dev_info.device));
415 }
416 printf("Hash: Adding 0x%" PRIx64 " keys\n",
417 (uint64_t)route_num_v4);
418}
419
420#define BIT_16_TO_23 0x00ff0000
421static inline void

Callers 1

setup_hashFunction · 0.85

Calls 7

convert_ipv4_5tupleFunction · 0.85
rte_hash_add_keyFunction · 0.85
rte_exitFunction · 0.85
rte_eth_dev_info_getFunction · 0.85
inet_ntopFunction · 0.85
rte_dev_nameFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected