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

Function main

dpdk/examples/vm_power_manager/main.c:327–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327int
328main(int argc, char **argv)
329{
330 int ret;
331 unsigned lcore_id;
332 unsigned int nb_ports;
333 struct rte_mempool *mbuf_pool;
334 uint16_t portid;
335 struct core_info *ci;
336
337
338 ret = core_info_init();
339 if (ret < 0)
340 rte_panic("Cannot allocate core info\n");
341
342 ci = get_core_info();
343
344 ret = rte_eal_init(argc, argv);
345 if (ret < 0)
346 rte_panic("Cannot init EAL\n");
347
348 signal(SIGINT, sig_handler);
349 signal(SIGTERM, sig_handler);
350
351 argc -= ret;
352 argv += ret;
353
354 /* parse application arguments (after the EAL ones) */
355 ret = parse_args(argc, argv);
356 if (ret < 0)
357 rte_exit(EXIT_FAILURE, "Invalid arguments\n");
358
359 nb_ports = rte_eth_dev_count_avail();
360
361 if (nb_ports > 0) {
362 mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL",
363 NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0,
364 RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
365
366 if (mbuf_pool == NULL)
367 rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
368
369 /* Initialize ports. */
370 RTE_ETH_FOREACH_DEV(portid) {
371 struct rte_ether_addr eth;
372 int w, j;
373 int ret;
374
375 if ((enabled_port_mask & (1 << portid)) == 0)
376 continue;
377
378 eth.addr_bytes[0] = 0xe0;
379 eth.addr_bytes[1] = 0xe0;
380 eth.addr_bytes[2] = 0xe0;
381 eth.addr_bytes[3] = 0xe0;
382 eth.addr_bytes[4] = portid + 0xf0;
383
384 if (port_init(portid, mbuf_pool) != 0)

Callers

nothing calls this directly

Calls 15

core_info_initFunction · 0.85
get_core_infoFunction · 0.85
rte_exitFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_socket_idFunction · 0.85
rte_get_next_lcoreFunction · 0.85
rte_eal_remote_launchFunction · 0.85
power_manager_initFunction · 0.85

Tested by

no test coverage detected