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

Function populate_ipv6_flow_into_table

dpdk/examples/l3fwd/l3fwd_em.c:421–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419
420#define BIT_16_TO_23 0x00ff0000
421static inline void
422populate_ipv6_flow_into_table(const struct rte_hash *h)
423{
424 int i;
425 int32_t ret;
426 struct rte_eth_dev_info dev_info;
427 char srcbuf[INET6_ADDRSTRLEN];
428 char dstbuf[INET6_ADDRSTRLEN];
429
430 mask1 = (rte_xmm_t){.u32 = {BIT_16_TO_23, ALL_32_BITS,
431 ALL_32_BITS, ALL_32_BITS} };
432
433 mask2 = (rte_xmm_t){.u32 = {ALL_32_BITS, ALL_32_BITS, 0, 0} };
434
435 for (i = 0; i < route_num_v6; i++) {
436 struct em_rule *entry;
437 union ipv6_5tuple_host newkey;
438
439 if ((1 << em_route_base_v6[i].if_out &
440 enabled_port_mask) == 0)
441 continue;
442
443 entry = &em_route_base_v6[i];
444 convert_ipv6_5tuple(&(entry->v6_key), &newkey);
445 ret = rte_hash_add_key(h, (void *) &newkey);
446 if (ret < 0) {
447 rte_exit(EXIT_FAILURE, "Unable to add entry %" PRIu32
448 " to the l3fwd hash.\n", i);
449 }
450 ipv6_l3fwd_out_if[ret] = entry->if_out;
451 ret = rte_eth_dev_info_get(em_route_base_v6[i].if_out,
452 &dev_info);
453 if (ret != 0)
454 rte_exit(EXIT_FAILURE,
455 "Error during getting device (port %u) info: %s\n",
456 em_route_base_v6[i].if_out, strerror(-ret));
457
458 printf("EM: Adding route %s, %s, %d, %d, %d (%d) [%s]\n",
459 inet_ntop(AF_INET6, em_route_base_v6[i].v6_key.ip_dst,
460 dstbuf, sizeof(dstbuf)),
461 inet_ntop(AF_INET6, em_route_base_v6[i].v6_key.ip_src,
462 srcbuf, sizeof(srcbuf)),
463 em_route_base_v6[i].v6_key.port_dst,
464 em_route_base_v6[i].v6_key.port_src,
465 em_route_base_v6[i].v6_key.proto,
466 em_route_base_v6[i].if_out, rte_dev_name(dev_info.device));
467 }
468 printf("Hash: Adding 0x%" PRIx64 "keys\n",
469 (uint64_t)route_num_v6);
470}
471
472/* Requirements:
473 * 1. IP packets without extension;

Callers 1

setup_hashFunction · 0.85

Calls 7

convert_ipv6_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