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

Function main

dpdk/examples/ethtool/ethtool-app/main.c:275–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275int main(int argc, char **argv)
276{
277 int cnt_args_parsed;
278 uint32_t id_core;
279 uint32_t cnt_ports;
280
281 /* Init runtime environment */
282 cnt_args_parsed = rte_eal_init(argc, argv);
283 if (cnt_args_parsed < 0)
284 rte_exit(EXIT_FAILURE, "rte_eal_init(): Failed");
285
286 cnt_ports = rte_eth_dev_count_avail();
287 printf("Number of NICs: %i\n", cnt_ports);
288 if (cnt_ports == 0)
289 rte_exit(EXIT_FAILURE, "No available NIC ports!\n");
290 if (cnt_ports > MAX_PORTS) {
291 printf("Info: Using only %i of %i ports\n",
292 cnt_ports, MAX_PORTS
293 );
294 cnt_ports = MAX_PORTS;
295 }
296
297 setup_ports(&app_cfg, cnt_ports);
298
299 app_cfg.exit_now = 0;
300 app_cfg.cnt_ports = cnt_ports;
301
302 if (rte_lcore_count() < 2)
303 rte_exit(EXIT_FAILURE, "No available worker core!\n");
304
305 /* Assume there is an available worker.. */
306 id_core = rte_lcore_id();
307 id_core = rte_get_next_lcore(id_core, 1, 1);
308 rte_eal_remote_launch(worker_main, NULL, id_core);
309
310 ethapp_main();
311
312 app_cfg.exit_now = 1;
313 RTE_LCORE_FOREACH_WORKER(id_core) {
314 if (rte_eal_wait_lcore(id_core) < 0)
315 return -1;
316 }
317
318 close_ports();
319
320 /* clean up the EAL */
321 rte_eal_cleanup();
322
323 return 0;
324}

Callers

nothing calls this directly

Calls 13

rte_exitFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
setup_portsFunction · 0.85
rte_lcore_countFunction · 0.85
rte_lcore_idFunction · 0.85
rte_get_next_lcoreFunction · 0.85
rte_eal_remote_launchFunction · 0.85
ethapp_mainFunction · 0.85
rte_eal_wait_lcoreFunction · 0.85
close_portsFunction · 0.85
rte_eal_initFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected