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

Function main

dpdk/examples/link_status_interrupt/main.c:532–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

530}
531
532int
533main(int argc, char **argv)
534{
535 struct lcore_queue_conf *qconf;
536 int ret;
537 uint16_t nb_ports;
538 uint16_t portid, portid_last = 0;
539 unsigned lcore_id, rx_lcore_id;
540 unsigned nb_ports_in_mask = 0;
541
542 /* init EAL */
543 ret = rte_eal_init(argc, argv);
544 if (ret < 0)
545 rte_exit(EXIT_FAILURE, "rte_eal_init failed");
546 argc -= ret;
547 argv += ret;
548
549 /* parse application arguments (after the EAL ones) */
550 ret = lsi_parse_args(argc, argv);
551 if (ret < 0)
552 rte_exit(EXIT_FAILURE, "Invalid arguments");
553
554 /* create the mbuf pool */
555 lsi_pktmbuf_pool =
556 rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, 0,
557 RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
558 if (lsi_pktmbuf_pool == NULL)
559 rte_panic("Cannot init mbuf pool\n");
560
561 nb_ports = rte_eth_dev_count_avail();
562 if (nb_ports == 0)
563 rte_panic("No Ethernet port - bye\n");
564
565 /* Each logical core is assigned a dedicated TX queue on each port. 8< */
566 for (portid = 0; portid < nb_ports; portid++) {
567 /* skip ports that are not enabled */
568 if ((lsi_enabled_port_mask & (1 << portid)) == 0)
569 continue;
570
571 /* save the destination port id */
572 if (nb_ports_in_mask % 2) {
573 lsi_dst_ports[portid] = portid_last;
574 lsi_dst_ports[portid_last] = portid;
575 }
576 else
577 portid_last = portid;
578
579 nb_ports_in_mask++;
580 }
581 /* >8 End of assigning logical core. */
582 if (nb_ports_in_mask < 2 || nb_ports_in_mask % 2)
583 rte_exit(EXIT_FAILURE, "Current enabled port number is %u, "
584 "but it should be even and at least 2\n",
585 nb_ports_in_mask);
586
587 rx_lcore_id = 0;
588 qconf = &lcore_queue_conf[rx_lcore_id];
589

Callers

nothing calls this directly

Calls 15

rte_exitFunction · 0.85
lsi_parse_argsFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_socket_idFunction · 0.85
rte_eth_dev_count_availFunction · 0.85
rte_lcore_is_enabledFunction · 0.85
rte_eth_dev_info_getFunction · 0.85
rte_eth_dev_configureFunction · 0.85
rte_eth_macaddr_getFunction · 0.85
rte_eth_rx_queue_setupFunction · 0.85

Tested by

no test coverage detected