vhost: fix zero-copy server mode
[dpdk.git] / lib / librte_vhost / socket.c
index 85c6448..0a66ef9 100644 (file)
@@ -127,7 +127,8 @@ read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds,
 
        ret = recvmsg(sockfd, &msgh, 0);
        if (ret <= 0) {
-               VHOST_LOG_CONFIG(ERR, "recvmsg failed\n");
+               if (ret)
+                       VHOST_LOG_CONFIG(ERR, "recvmsg failed\n");
                return ret;
        }
 
@@ -925,6 +926,12 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
                        ret = -1;
                        goto out_mutex;
                }
+               if ((flags & RTE_VHOST_USER_CLIENT) != 0) {
+                       VHOST_LOG_CONFIG(ERR,
+                       "error: zero copy is incompatible with vhost client mode\n");
+                       ret = -1;
+                       goto out_mutex;
+               }
                vsocket->supported_features &= ~(1ULL << VIRTIO_F_IN_ORDER);
                vsocket->features &= ~(1ULL << VIRTIO_F_IN_ORDER);