| 1498 | } |
| 1499 | |
| 1500 | int |
| 1501 | rte_vhost_enable_guest_notification(int vid, uint16_t queue_id, int enable) |
| 1502 | { |
| 1503 | struct virtio_net *dev = get_device(vid); |
| 1504 | struct vhost_virtqueue *vq; |
| 1505 | int ret; |
| 1506 | |
| 1507 | if (!dev) |
| 1508 | return -1; |
| 1509 | |
| 1510 | if (queue_id >= VHOST_MAX_VRING) |
| 1511 | return -1; |
| 1512 | |
| 1513 | vq = dev->virtqueue[queue_id]; |
| 1514 | if (!vq) |
| 1515 | return -1; |
| 1516 | |
| 1517 | rte_rwlock_write_lock(&vq->access_lock); |
| 1518 | |
| 1519 | if (unlikely(!vq->access_ok)) { |
| 1520 | ret = -1; |
| 1521 | goto out_unlock; |
| 1522 | } |
| 1523 | |
| 1524 | vq->notif_enable = enable; |
| 1525 | ret = vhost_enable_guest_notification(dev, vq, enable); |
| 1526 | |
| 1527 | out_unlock: |
| 1528 | rte_rwlock_write_unlock(&vq->access_lock); |
| 1529 | |
| 1530 | return ret; |
| 1531 | } |
| 1532 | |
| 1533 | void |
| 1534 | rte_vhost_notify_guest(int vid, uint16_t queue_id) |
no test coverage detected