MCPcopy Index your code
hub / github.com/F-Stack/f-stack / init_port_start

Function init_port_start

lib/ff_dpdk_if.c:593–869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591#endif
592
593static int
594init_port_start(void)
595{
596 int nb_ports = ff_global_cfg.dpdk.nb_ports, total_nb_ports;
597 unsigned socketid = 0;
598 struct rte_mempool *mbuf_pool;
599 uint16_t i, j;
600
601 total_nb_ports = nb_ports;
602#ifdef FF_KNI
603 if (enable_kni && rte_eal_process_type() == RTE_PROC_PRIMARY) {
604 total_nb_ports *= 2; /* one more virtio_user port for kernel per port */
605 }
606#endif
607
608 for (i = 0; i < total_nb_ports; i++) {
609 uint16_t port_id, u_port_id;
610 struct ff_port_cfg *pconf = NULL;
611 uint16_t nb_queues;
612 int nb_slaves;
613
614 if (i < nb_ports) {
615 u_port_id = ff_global_cfg.dpdk.portid_list[i];
616 pconf = &ff_global_cfg.dpdk.port_cfgs[u_port_id];
617 nb_queues = pconf->nb_lcores;
618 nb_slaves = pconf->nb_slaves;
619
620 if (nb_slaves > 0) {
621 rte_eth_bond_8023ad_dedicated_queues_enable(u_port_id);
622 }
623 } else {
624 /* kernel virtio user, port id start from `nb_dev_ports` */
625 u_port_id = i - nb_ports + nb_dev_ports;
626 nb_queues = 1; /* see ff_kni_alloc in ff_dpdk_kni.c */
627 nb_slaves = 0;
628 }
629
630 for (j = 0; j <= nb_slaves; j++) {
631 if (j < nb_slaves) {
632 port_id = pconf->slave_portid_list[j];
633 ff_log(FF_LOG_INFO, FF_LOGTYPE_FSTACK_LIB, "To init %s's %d'st slave port[%d]\n",
634 ff_global_cfg.dpdk.bond_cfgs->name,
635 j, port_id);
636 } else {
637 port_id = u_port_id;
638 }
639
640 struct rte_eth_dev_info dev_info;
641 struct rte_eth_conf port_conf = {0};
642 struct rte_eth_rxconf rxq_conf;
643 struct rte_eth_txconf txq_conf;
644
645 int ret = rte_eth_dev_info_get(port_id, &dev_info);
646 if (ret != 0)
647 rte_exit(EXIT_FAILURE,
648 "Error during getting device (port %u) info: %s\n",
649 port_id, strerror(-ret));
650

Callers 1

ff_dpdk_initFunction · 0.85

Calls 15

rte_eal_process_typeFunction · 0.85
ff_logFunction · 0.85
rte_eth_dev_info_getFunction · 0.85
rte_exitFunction · 0.85
rte_eth_macaddr_getFunction · 0.85
rte_eth_dev_configureFunction · 0.85
rte_lcore_to_socket_idFunction · 0.85
rte_eth_tx_queue_setupFunction · 0.85
rte_eth_rx_queue_setupFunction · 0.85
strncmpFunction · 0.85

Tested by

no test coverage detected