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

Function main

dpdk/examples/vdpa/main.c:464–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464int
465main(int argc, char *argv[])
466{
467 char ch;
468 int ret;
469 struct cmdline *cl;
470 struct rte_vdpa_device *vdev;
471 struct rte_device *dev;
472 struct rte_dev_iterator dev_iter;
473
474 ret = rte_eal_init(argc, argv);
475 if (ret < 0)
476 rte_exit(EXIT_FAILURE, "eal init failed\n");
477 argc -= ret;
478 argv += ret;
479
480 signal(SIGINT, signal_handler);
481 signal(SIGTERM, signal_handler);
482
483 ret = parse_args(argc, argv);
484 if (ret < 0)
485 rte_exit(EXIT_FAILURE, "invalid argument\n");
486
487 if (interactive == 1) {
488 cl = cmdline_stdin_new(main_ctx, "vdpa> ");
489 if (cl == NULL)
490 rte_panic("Cannot create cmdline instance\n");
491 cmdline_interact(cl);
492 cmdline_stdin_exit(cl);
493 } else {
494 RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
495 vdev = rte_vdpa_find_device_by_name(rte_dev_name(dev));
496 if (vdev == NULL) {
497 rte_panic("Failed to find vDPA dev for %s\n",
498 rte_dev_name(dev));
499 }
500 vports[devcnt].dev = vdev;
501 snprintf(vports[devcnt].ifname, MAX_PATH_LEN, "%s%d",
502 iface, devcnt);
503
504 start_vdpa(&vports[devcnt]);
505 devcnt++;
506 }
507
508 printf("enter \'q\' to quit\n");
509 while (scanf("%c", &ch)) {
510 if (ch == 'q')
511 break;
512 while (ch != '\n') {
513 if (scanf("%c", &ch))
514 printf("%c", ch);
515 }
516 printf("enter \'q\' to quit\n");
517 }
518 vdpa_sample_quit();
519 }
520
521 /* clean up the EAL */

Callers

nothing calls this directly

Calls 13

rte_exitFunction · 0.85
cmdline_stdin_newFunction · 0.85
cmdline_interactFunction · 0.85
cmdline_stdin_exitFunction · 0.85
rte_dev_nameFunction · 0.85
snprintfFunction · 0.85
start_vdpaFunction · 0.85
vdpa_sample_quitFunction · 0.85
parse_argsFunction · 0.70
rte_eal_initFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected