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

Function us_vhost_parse_args

dpdk/examples/vhost/main.c:693–894  ·  view source on GitHub ↗

* Parse the arguments given in the command line of the application. */

Source from the content-addressed store, hash-verified

691 * Parse the arguments given in the command line of the application.
692 */
693static int
694us_vhost_parse_args(int argc, char **argv)
695{
696 int opt, ret;
697 int option_index;
698 unsigned i;
699 const char *prgname = argv[0];
700 static struct option long_option[] = {
701 {OPT_VM2VM, required_argument,
702 NULL, OPT_VM2VM_NUM},
703 {OPT_RX_RETRY, required_argument,
704 NULL, OPT_RX_RETRY_NUM},
705 {OPT_RX_RETRY_DELAY, required_argument,
706 NULL, OPT_RX_RETRY_DELAY_NUM},
707 {OPT_RX_RETRY_NUMB, required_argument,
708 NULL, OPT_RX_RETRY_NUMB_NUM},
709 {OPT_MERGEABLE, required_argument,
710 NULL, OPT_MERGEABLE_NUM},
711 {OPT_STATS, required_argument,
712 NULL, OPT_STATS_NUM},
713 {OPT_SOCKET_FILE, required_argument,
714 NULL, OPT_SOCKET_FILE_NUM},
715 {OPT_TX_CSUM, required_argument,
716 NULL, OPT_TX_CSUM_NUM},
717 {OPT_TSO, required_argument,
718 NULL, OPT_TSO_NUM},
719 {OPT_CLIENT, no_argument,
720 NULL, OPT_CLIENT_NUM},
721 {OPT_BUILTIN_NET_DRIVER, no_argument,
722 NULL, OPT_BUILTIN_NET_DRIVER_NUM},
723 {OPT_DMAS, required_argument,
724 NULL, OPT_DMAS_NUM},
725 {OPT_NUM_MBUFS, required_argument,
726 NULL, OPT_NUM_MBUFS_NUM},
727 {NULL, 0, 0, 0},
728 };
729
730 /* Parse command line */
731 while ((opt = getopt_long(argc, argv, "p:P",
732 long_option, &option_index)) != EOF) {
733 switch (opt) {
734 /* Portmask */
735 case 'p':
736 enabled_port_mask = parse_portmask(optarg);
737 if (enabled_port_mask == 0) {
738 RTE_LOG(INFO, VHOST_CONFIG, "Invalid portmask\n");
739 us_vhost_usage(prgname);
740 return -1;
741 }
742 break;
743
744 case 'P':
745 promiscuous = 1;
746 vmdq_conf_default.rx_adv_conf.vmdq_rx_conf.rx_mode =
747 RTE_ETH_VMDQ_ACCEPT_BROADCAST |
748 RTE_ETH_VMDQ_ACCEPT_MULTICAST;
749 break;
750

Callers 1

mainFunction · 0.85

Calls 6

getopt_longFunction · 0.85
us_vhost_usageFunction · 0.85
parse_num_optFunction · 0.85
open_dmaFunction · 0.85
parse_portmaskFunction · 0.70

Tested by

no test coverage detected