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

Function parse_args

dpdk/examples/l3fwd-graph/main.c:551–642  ·  view source on GitHub ↗

Parse the argument given in the command line of the application */

Source from the content-addressed store, hash-verified

549
550/* Parse the argument given in the command line of the application */
551static int
552parse_args(int argc, char **argv)
553{
554 char *prgname = argv[0];
555 int option_index;
556 char **argvopt;
557 int opt, ret;
558
559 argvopt = argv;
560
561 /* Error or normal output strings. */
562 while ((opt = getopt_long(argc, argvopt, short_options, lgopts,
563 &option_index)) != EOF) {
564
565 switch (opt) {
566 /* Portmask */
567 case 'p':
568 enabled_port_mask = parse_portmask(optarg);
569 if (enabled_port_mask == 0) {
570 fprintf(stderr, "Invalid portmask\n");
571 print_usage(prgname);
572 return -1;
573 }
574 break;
575
576 case 'P':
577 promiscuous_on = 1;
578 break;
579
580 /* Long options */
581 case CMD_LINE_OPT_CONFIG_NUM:
582 ret = parse_config(optarg);
583 if (ret) {
584 fprintf(stderr, "Invalid config\n");
585 print_usage(prgname);
586 return -1;
587 }
588 break;
589
590 case CMD_LINE_OPT_ETH_DEST_NUM:
591 parse_eth_dest(optarg);
592 break;
593
594 case CMD_LINE_OPT_NO_NUMA_NUM:
595 numa_on = 0;
596 break;
597
598 case CMD_LINE_OPT_MAX_PKT_LEN_NUM: {
599 max_pkt_len = parse_max_pkt_len(optarg);
600 break;
601 }
602
603 case CMD_LINE_OPT_PARSE_PER_PORT_POOL:
604 printf("Per port buffer pool is enabled\n");
605 per_port_pool = 1;
606 break;
607
608 case CMD_LINE_OPT_PARSE_PCAP_ENABLE:

Callers 1

mainFunction · 0.70

Calls 10

getopt_longFunction · 0.85
parse_num_pkt_capFunction · 0.85
rte_strlcpyFunction · 0.85
parse_worker_modelFunction · 0.85
parse_portmaskFunction · 0.70
print_usageFunction · 0.70
parse_configFunction · 0.70
parse_eth_destFunction · 0.70
parse_max_pkt_lenFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected