MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_vhost_driver_get_queue_num

Function rte_vhost_driver_get_queue_num

dpdk/lib/vhost/socket.c:811–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

809}
810
811int
812rte_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
841unlock_exit:
842 pthread_mutex_unlock(&vhost_user.mutex);
843 return ret;
844}
845
846int
847rte_vhost_driver_set_max_queue_num(const char *path, uint32_t max_queue_pairs)

Callers 2

vduse_device_createFunction · 0.85
vhost_user_get_queue_numFunction · 0.85

Calls 3

pthread_mutex_lockFunction · 0.85
find_vhost_user_socketFunction · 0.85
pthread_mutex_unlockFunction · 0.85

Tested by

no test coverage detected