| 771 | } |
| 772 | |
| 773 | int |
| 774 | rte_vhost_driver_get_protocol_features(const char *path, |
| 775 | uint64_t *protocol_features) |
| 776 | { |
| 777 | struct vhost_user_socket *vsocket; |
| 778 | uint64_t vdpa_protocol_features; |
| 779 | struct rte_vdpa_device *vdpa_dev; |
| 780 | int ret = 0; |
| 781 | |
| 782 | pthread_mutex_lock(&vhost_user.mutex); |
| 783 | vsocket = find_vhost_user_socket(path); |
| 784 | if (!vsocket) { |
| 785 | VHOST_LOG_CONFIG(path, ERR, "socket file is not registered yet.\n"); |
| 786 | ret = -1; |
| 787 | goto unlock_exit; |
| 788 | } |
| 789 | |
| 790 | vdpa_dev = vsocket->vdpa_dev; |
| 791 | if (!vdpa_dev) { |
| 792 | *protocol_features = vsocket->protocol_features; |
| 793 | goto unlock_exit; |
| 794 | } |
| 795 | |
| 796 | if (vdpa_dev->ops->get_protocol_features(vdpa_dev, |
| 797 | &vdpa_protocol_features) < 0) { |
| 798 | VHOST_LOG_CONFIG(path, ERR, "failed to get vdpa protocol features.\n"); |
| 799 | ret = -1; |
| 800 | goto unlock_exit; |
| 801 | } |
| 802 | |
| 803 | *protocol_features = vsocket->protocol_features |
| 804 | & vdpa_protocol_features; |
| 805 | |
| 806 | unlock_exit: |
| 807 | pthread_mutex_unlock(&vhost_user.mutex); |
| 808 | return ret; |
| 809 | } |
| 810 | |
| 811 | int |
| 812 | rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num) |
no test coverage detected