| 722 | } |
| 723 | |
| 724 | int |
| 725 | rte_vhost_driver_get_features(const char *path, uint64_t *features) |
| 726 | { |
| 727 | struct vhost_user_socket *vsocket; |
| 728 | uint64_t vdpa_features; |
| 729 | struct rte_vdpa_device *vdpa_dev; |
| 730 | int ret = 0; |
| 731 | |
| 732 | pthread_mutex_lock(&vhost_user.mutex); |
| 733 | vsocket = find_vhost_user_socket(path); |
| 734 | if (!vsocket) { |
| 735 | VHOST_LOG_CONFIG(path, ERR, "socket file is not registered yet.\n"); |
| 736 | ret = -1; |
| 737 | goto unlock_exit; |
| 738 | } |
| 739 | |
| 740 | vdpa_dev = vsocket->vdpa_dev; |
| 741 | if (!vdpa_dev) { |
| 742 | *features = vsocket->features; |
| 743 | goto unlock_exit; |
| 744 | } |
| 745 | |
| 746 | if (vdpa_dev->ops->get_features(vdpa_dev, &vdpa_features) < 0) { |
| 747 | VHOST_LOG_CONFIG(path, ERR, "failed to get vdpa features for socket file.\n"); |
| 748 | ret = -1; |
| 749 | goto unlock_exit; |
| 750 | } |
| 751 | |
| 752 | *features = vsocket->features & vdpa_features; |
| 753 | |
| 754 | unlock_exit: |
| 755 | pthread_mutex_unlock(&vhost_user.mutex); |
| 756 | return ret; |
| 757 | } |
| 758 | |
| 759 | int |
| 760 | rte_vhost_driver_set_protocol_features(const char *path, |
no test coverage detected