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

Function rte_vhost_driver_get_protocol_features

dpdk/lib/vhost/socket.c:773–809  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

771}
772
773int
774rte_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
806unlock_exit:
807 pthread_mutex_unlock(&vhost_user.mutex);
808 return ret;
809}
810
811int
812rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num)

Calls 3

pthread_mutex_lockFunction · 0.85
find_vhost_user_socketFunction · 0.85
pthread_mutex_unlockFunction · 0.85

Tested by

no test coverage detected