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

Function eth_vhost_install_intr

dpdk/drivers/net/vhost/rte_eth_vhost.c:635–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

633}
634
635static int
636eth_vhost_install_intr(struct rte_eth_dev *dev)
637{
638 int nb_rxq = dev->data->nb_rx_queues;
639 struct vhost_queue *vq;
640
641 int ret;
642 int i;
643
644 dev->intr_handle = rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE);
645 if (dev->intr_handle == NULL) {
646 VHOST_LOG(ERR, "Fail to allocate intr_handle\n");
647 ret = -ENOMEM;
648 goto error;
649 }
650 if (rte_intr_efd_counter_size_set(dev->intr_handle, 0)) {
651 ret = -rte_errno;
652 goto error;
653 }
654
655 if (rte_intr_vec_list_alloc(dev->intr_handle, NULL, nb_rxq)) {
656 VHOST_LOG(ERR, "Failed to allocate memory for interrupt vector\n");
657 ret = -ENOMEM;
658 goto error;
659 }
660
661 VHOST_LOG(DEBUG, "Prepare intr vec\n");
662 for (i = 0; i < nb_rxq; i++) {
663 int epoll_fd = epoll_create1(0);
664
665 if (epoll_fd < 0) {
666 VHOST_LOG(ERR, "Failed to create proxy epoll fd for rxq-%d\n", i);
667 ret = -errno;
668 goto error;
669 }
670
671 if (rte_intr_vec_list_index_set(dev->intr_handle, i,
672 RTE_INTR_VEC_RXTX_OFFSET + i) ||
673 rte_intr_efds_index_set(dev->intr_handle, i, epoll_fd)) {
674 ret = -rte_errno;
675 close(epoll_fd);
676 goto error;
677 }
678
679 vq = dev->data->rx_queues[i];
680 memset(&vq->ev, 0, sizeof(vq->ev));
681 vq->ev.events = EPOLLIN;
682 vq->ev.data.fd = epoll_fd;
683 }
684
685 if (rte_intr_nb_efd_set(dev->intr_handle, nb_rxq)) {
686 ret = -rte_errno;
687 goto error;
688 }
689 if (rte_intr_max_intr_set(dev->intr_handle, nb_rxq + 1)) {
690 ret = -rte_errno;
691 goto error;
692 }

Callers 1

eth_dev_startFunction · 0.85

Calls 11

rte_intr_instance_allocFunction · 0.85
rte_intr_vec_list_allocFunction · 0.85
rte_intr_efds_index_setFunction · 0.85
memsetFunction · 0.85
rte_intr_nb_efd_setFunction · 0.85
rte_intr_max_intr_setFunction · 0.85
rte_intr_type_setFunction · 0.85
eth_vhost_uninstall_intrFunction · 0.85
closeFunction · 0.50

Tested by

no test coverage detected