| 809 | } |
| 810 | |
| 811 | int |
| 812 | rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num) |
| 813 | { |
| 814 | struct vhost_user_socket *vsocket; |
| 815 | uint32_t vdpa_queue_num; |
| 816 | struct rte_vdpa_device *vdpa_dev; |
| 817 | int ret = 0; |
| 818 | |
| 819 | pthread_mutex_lock(&vhost_user.mutex); |
| 820 | vsocket = find_vhost_user_socket(path); |
| 821 | if (!vsocket) { |
| 822 | VHOST_LOG_CONFIG(path, ERR, "socket file is not registered yet.\n"); |
| 823 | ret = -1; |
| 824 | goto unlock_exit; |
| 825 | } |
| 826 | |
| 827 | vdpa_dev = vsocket->vdpa_dev; |
| 828 | if (!vdpa_dev) { |
| 829 | *queue_num = vsocket->max_queue_pairs; |
| 830 | goto unlock_exit; |
| 831 | } |
| 832 | |
| 833 | if (vdpa_dev->ops->get_queue_num(vdpa_dev, &vdpa_queue_num) < 0) { |
| 834 | VHOST_LOG_CONFIG(path, ERR, "failed to get vdpa queue number.\n"); |
| 835 | ret = -1; |
| 836 | goto unlock_exit; |
| 837 | } |
| 838 | |
| 839 | *queue_num = RTE_MIN(vsocket->max_queue_pairs, vdpa_queue_num); |
| 840 | |
| 841 | unlock_exit: |
| 842 | pthread_mutex_unlock(&vhost_user.mutex); |
| 843 | return ret; |
| 844 | } |
| 845 | |
| 846 | int |
| 847 | rte_vhost_driver_set_max_queue_num(const char *path, uint32_t max_queue_pairs) |
no test coverage detected