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

Function configure_vdev

dpdk/app/pdump/main.c:579–623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579static inline int
580configure_vdev(uint16_t port_id)
581{
582 struct rte_ether_addr addr;
583 const uint16_t rxRings = 0, txRings = 1;
584 int ret;
585 uint16_t q;
586
587 if (!rte_eth_dev_is_valid_port(port_id))
588 return -1;
589
590 ret = rte_eth_dev_configure(port_id, rxRings, txRings,
591 &port_conf_default);
592 if (ret != 0)
593 rte_exit(EXIT_FAILURE, "dev config failed\n");
594
595 for (q = 0; q < txRings; q++) {
596 ret = rte_eth_tx_queue_setup(port_id, q, TX_DESC_PER_QUEUE,
597 rte_eth_dev_socket_id(port_id), NULL);
598 if (ret < 0)
599 rte_exit(EXIT_FAILURE, "queue setup failed\n");
600 }
601
602 ret = rte_eth_dev_start(port_id);
603 if (ret < 0)
604 rte_exit(EXIT_FAILURE, "dev start failed\n");
605
606 ret = rte_eth_macaddr_get(port_id, &addr);
607 if (ret != 0)
608 rte_exit(EXIT_FAILURE, "macaddr get failed\n");
609
610 printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
611 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
612 port_id, RTE_ETHER_ADDR_BYTES(&addr));
613
614 ret = rte_eth_promiscuous_enable(port_id);
615 if (ret != 0) {
616 rte_exit(EXIT_FAILURE,
617 "promiscuous mode enable failed: %s\n",
618 rte_strerror(-ret));
619 return ret;
620 }
621
622 return 0;
623}
624
625static void
626create_mp_ring_vdev(void)

Callers 1

create_mp_ring_vdevFunction · 0.85

Calls 10

rte_eth_dev_configureFunction · 0.85
rte_exitFunction · 0.85
rte_eth_tx_queue_setupFunction · 0.85
rte_eth_dev_socket_idFunction · 0.85
rte_eth_dev_startFunction · 0.85
rte_eth_macaddr_getFunction · 0.85
rte_strerrorFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected