vhost: fix error code check when creating pthread
[dpdk.git] / lib / librte_vhost / socket.c
index 7018150..811e6bf 100644 (file)
@@ -68,6 +68,7 @@ struct vhost_user_socket {
        bool is_server;
        bool reconnect;
        bool dequeue_zero_copy;
+       bool iommu_support;
 
        /*
         * The "supported_features" indicates the feature bits the
@@ -471,7 +472,7 @@ vhost_user_reconnect_init(void)
 
        ret = pthread_create(&reconn_tid, NULL,
                             vhost_user_client_reconnect, NULL);
-       if (ret < 0) {
+       if (ret != 0) {
                RTE_LOG(ERR, VHOST_CONFIG, "failed to create reconnect thread");
                if (pthread_mutex_destroy(&reconn_list.mutex)) {
                        RTE_LOG(ERR, VHOST_CONFIG,
@@ -669,12 +670,16 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
        vsocket->supported_features = VIRTIO_NET_SUPPORTED_FEATURES;
        vsocket->features           = VIRTIO_NET_SUPPORTED_FEATURES;
 
+       if (!(flags & RTE_VHOST_USER_IOMMU_SUPPORT)) {
+               vsocket->supported_features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
+               vsocket->features &= ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
+       }
+
        if ((flags & RTE_VHOST_USER_CLIENT) != 0) {
                vsocket->reconnect = !(flags & RTE_VHOST_USER_NO_RECONNECT);
                if (vsocket->reconnect && reconn_tid == 0) {
-                       if (vhost_user_reconnect_init() < 0) {
+                       if (vhost_user_reconnect_init() != 0)
                                goto out_mutex;
-                       }
                }
        } else {
                vsocket->is_server = true;
@@ -831,7 +836,7 @@ rte_vhost_driver_start(const char *path)
        if (fdset_tid == 0) {
                int ret = pthread_create(&fdset_tid, NULL, fdset_event_dispatch,
                                     &vhost_user.fdset);
-               if (ret < 0)
+               if (ret != 0)
                        RTE_LOG(ERR, VHOST_CONFIG,
                                "failed to create fdset handling thread");
        }