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

Function main

dpdk/examples/dma/dmafwd.c:1046–1154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1044}
1045
1046int
1047main(int argc, char **argv)
1048{
1049 int ret;
1050 uint16_t nb_ports, portid;
1051 uint32_t i;
1052 unsigned int nb_mbufs;
1053 size_t sz;
1054
1055 /* Init EAL. 8< */
1056 ret = rte_eal_init(argc, argv);
1057 if (ret < 0)
1058 rte_exit(EXIT_FAILURE, "Invalid EAL arguments\n");
1059 /* >8 End of init EAL. */
1060 argc -= ret;
1061 argv += ret;
1062
1063 force_quit = false;
1064 signal(SIGINT, signal_handler);
1065 signal(SIGTERM, signal_handler);
1066 signal(SIGUSR1, signal_handler);
1067
1068 nb_ports = rte_eth_dev_count_avail();
1069 if (nb_ports == 0)
1070 rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
1071
1072 /* Parse application arguments (after the EAL ones) */
1073 ret = dma_parse_args(argc, argv, nb_ports);
1074 if (ret < 0)
1075 rte_exit(EXIT_FAILURE, "Invalid DMA arguments\n");
1076
1077 /* Allocates mempool to hold the mbufs. 8< */
1078 nb_mbufs = RTE_MAX(nb_ports * (nb_queues * (nb_rxd + nb_txd +
1079 4 * MAX_PKT_BURST + ring_size) + ring_size +
1080 rte_lcore_count() * MEMPOOL_CACHE_SIZE),
1081 MIN_POOL_SIZE);
1082
1083 /* Create the mbuf pool */
1084 sz = max_frame_size + RTE_PKTMBUF_HEADROOM;
1085 sz = RTE_MAX(sz, (size_t)RTE_MBUF_DEFAULT_BUF_SIZE);
1086 dma_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", nb_mbufs,
1087 MEMPOOL_CACHE_SIZE, 0, sz, rte_socket_id());
1088 if (dma_pktmbuf_pool == NULL)
1089 rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
1090 /* >8 End of allocates mempool to hold the mbufs. */
1091
1092 if (force_min_copy_size >
1093 (uint32_t)(rte_pktmbuf_data_room_size(dma_pktmbuf_pool) -
1094 RTE_PKTMBUF_HEADROOM))
1095 rte_exit(EXIT_FAILURE,
1096 "Force min copy size > packet mbuf size\n");
1097
1098 /* Initialize each port. 8< */
1099 cfg.nb_ports = 0;
1100 RTE_ETH_FOREACH_DEV(portid)
1101 port_init(portid, dma_pktmbuf_pool, nb_queues);
1102 /* >8 End of initializing each port. */
1103

Callers

nothing calls this directly

Calls 15

rte_exitFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
dma_parse_argsFunction · 0.85
rte_lcore_countFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_socket_idFunction · 0.85
memsetFunction · 0.85
check_link_statusFunction · 0.85
assign_dmadevsFunction · 0.85
assign_ringsFunction · 0.85
start_forwarding_coresFunction · 0.85

Tested by

no test coverage detected