| 547 | } |
| 548 | |
| 549 | static void |
| 550 | eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx) |
| 551 | { |
| 552 | struct rte_vhost_vring vring; |
| 553 | struct vhost_queue *vq; |
| 554 | |
| 555 | vq = eth_dev->data->rx_queues[rxq_idx]; |
| 556 | if (vq == NULL || vq->vid < 0) |
| 557 | return; |
| 558 | |
| 559 | if (rte_vhost_get_vhost_vring(vq->vid, (rxq_idx << 1) + 1, &vring) < 0) { |
| 560 | VHOST_LOG(DEBUG, "Failed to get rxq-%d's vring, skip!\n", rxq_idx); |
| 561 | return; |
| 562 | } |
| 563 | |
| 564 | rte_spinlock_lock(&vq->intr_lock); |
| 565 | |
| 566 | /* Remove previous kickfd from proxy epoll */ |
| 567 | if (vq->kickfd >= 0 && vq->kickfd != vring.kickfd) { |
| 568 | if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) { |
| 569 | VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n", |
| 570 | vq->kickfd, rxq_idx, strerror(errno)); |
| 571 | } else { |
| 572 | VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n", |
| 573 | vq->kickfd, rxq_idx); |
| 574 | } |
| 575 | vq->kickfd = -1; |
| 576 | } |
| 577 | |
| 578 | /* Add new one, if valid */ |
| 579 | if (vq->kickfd != vring.kickfd && vring.kickfd >= 0) { |
| 580 | if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_ADD, vring.kickfd, &vq->ev) < 0) { |
| 581 | VHOST_LOG(ERR, "Failed to register %d in rxq-%d epoll: %s\n", |
| 582 | vring.kickfd, rxq_idx, strerror(errno)); |
| 583 | } else { |
| 584 | vq->kickfd = vring.kickfd; |
| 585 | VHOST_LOG(DEBUG, "Registered %d in rxq-%d epoll\n", |
| 586 | vq->kickfd, rxq_idx); |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | rte_spinlock_unlock(&vq->intr_lock); |
| 591 | } |
| 592 | |
| 593 | static int |
| 594 | eth_rxq_intr_enable(struct rte_eth_dev *dev, uint16_t qid) |
no test coverage detected